Create a polygon form line intersection (Draw)

How to get a poligon from intersecting lines?

I have tryed the shape->intersect but it behaves completly unpredictably with lines. All the tutorials on the net used full 2d objects like intersecting two circles etc…

The image explains it better.

Hello, I just read this question.
For my own purposes I wrote a quite complex macro to
. intersect any lines in a drawing
. create the polygons and
give different colors to the Polygons (to be clearer, to the created polypolygonshapes PPS)
(the color depends on, how many adjacent PPS the polygon has)

The question, when you intersect any number of lines, is quite complex. (example: if you have another polygon INSIDE the first one, you have to take care, that the color has to be different)

So my question:
is your problem still open?

If yes, I am open to answer your question / specification (Think, it took me months to have the macro, as it is now

10/09/2014: following the administrators comment and my short reply I extend my answer:

my macro contains several different geometrical problems/ideas. The code is not beautyfied and would be a bad example presently. and it is about 3.000 loc. So I do not want to post it.
I try a better description.
Take a drawing.
place a lot of lines (presently up to 100)
the macro reads all lines, computes all intersections (and deletes lines, which have only one (1) connection line)
now you may have up to 1.500 lines
then the algorithm is searching all closed polygons and for each creates a polygonshape
the shapes can have a different number of edges (triangle, square, polygons with n lines)
each shape gets a colour depending on the number of edges and so, that adjacent shapes have different color

this works, but there are a lot of open questions, in which scenario you would like to run such an idea/macro. so it is presently not generlly usable.
to illustrate it a little bit:
sorry: i tried to create an image. LO → export to jpeg. but here the inclusion of an image AND the upload fail. both give me the dialog to select the file, but the filename is not transferred to the corresponding field in the upload-dialog. sorry

@JohannF, please edit your answer to include the indicate detail (or upload / link to the macro). This would be a great help. The question is still open. Thanks.

my macro contains several different geometrical problems/ideas. The code is not beautyfied and would be a bad example presently. and it is about 3.000 loc. So I do not want to post it.
I try a better description by expanding my response

Thanks @JohannF. That does sound complex and I am unsurprised at the size of the code.