code listing in a writer document

Hello,

i've got a writer document, where i want to cite code fragments.
so i set up a frame template with grey background and a template for the
text inside so the lines are numbered.

but i've got two problems:
1) i can't have lines without a number, which i need, if a code line
doesn't fit in a single line of the document

2) i can't assign a description to that listing, because captions do
always seem to be *inside* the frame - which looks terribly wrong.
so i have the description as a simple text line after the
code/listing-frame - which is bad, wenn i change big parts of the
document, because the self-made caption doesn't stick to the code-listing.

as one cannot attach files, here's the link to the screenshot:
http://upimg.de/img/libowritercodelisting_en_qn0ylc.png

thanks in advance,

Andreas

[second try, first one was with an attachment]

i've got a writer document, where i want to cite code fragments. so i set up a frame template with grey background and a template for the text inside so the lines are numbered. but i've got two problems:
1) i can't have lines without a number, which i need, if a code line doesn't fit in a single line of the document

I'm not sure how you are doing this (your screenshot shows only the appearance, not the structure) so I cannot really comment. But if I apply numbering on the Outline & Numbering tab of the paragraph style, it is paragraphs that are numbered, not lines. This will work if your code text is generally separated by paragraph breaks (inserted by pressing Enter) with your long lines broken by the natural flow of text or by line breaks (inserted by pressing Shift+Enter).

2) i can't assign a description to that listing, because captions do always seem to be *inside* the frame - which looks terribly wrong. so i have the description as a simple text line after the code/listing-frame - which is bad, when i change big parts of the document, because the self-made caption doesn't stick to the code-listing.

That's easier. You are evidently applying a border to the frame. Remove that border and apply it instead using the paragraph style. Then the caption can be inside the (invisible) frame but outside the visible paragraph border and will keep together with frame contents as you edit the material. Your grey background can also be applied to the paragraph or to the frame, so that it extends just to the contents or to the area including the caption - as you prefer.

I trust this helps.

Brian Barker