<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY>
Hi Eike<BR>
<BR>
Am Dienstag, den 07.02.2012, 23:50 +0100 schrieb Eike Rathke:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi Dietmar,
On Saturday, 2012-02-04 18:47:40 +0100, Dietmar wrote:
> is there a method to convert Borderline2 to Borderline (and vice versa),
> I can use in a Java extension?
Unfortunately not.
</PRE>
</BLOCKQUOTE>
I have already realized a function, actually w/o having yet looked up the code you mention below.<BR>
Here is the function if someone might want to use it (no guarantee for correctness):<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
        /** Convert BorderLine2 to BorderLine
         * @param inBL2
         * @return
         */
        private static com.sun.star.table.BorderLine convert2toBorderLine
                (com.sun.star.table.BorderLine2 inBL2) {
                com.sun.star.table.BorderLine outBL = new BorderLine();
                
                switch (inBL2.LineStyle) {
                        case com.sun.star.table.BorderLineStyle.NONE:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = 0;
                                outBL.LineDistance = 0;
                                outBL.OuterLineWidth = 0;
                                break;
                        case com.sun.star.table.BorderLineStyle.SOLID:
                        case com.sun.star.table.BorderLineStyle.DOTTED:
                        case com.sun.star.table.BorderLineStyle.DASHED:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = 0;
                                outBL.LineDistance = 0;
                                outBL.OuterLineWidth = (short) inBL2.LineWidth;
                                break;
                        case com.sun.star.table.BorderLineStyle.DOUBLE:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = (short) inBL2.LineWidth;
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth);
                                outBL.OuterLineWidth = (short) inBL2.LineWidth;
                                break;
                        case com.sun.star.table.BorderLineStyle.THINTHICK_SMALLGAP:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = 26;
                                outBL.LineDistance = 35;
                                outBL.OuterLineWidth = (short) inBL2.LineWidth;
                                break;
                        case com.sun.star.table.BorderLineStyle.THINTHICK_MEDIUMGAP:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = (short) (inBL2.LineWidth / 2);
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth / 2);
                                outBL.OuterLineWidth = (short) (inBL2.LineWidth);
                                break;
                        case com.sun.star.table.BorderLineStyle.THINTHICK_LARGEGAP:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = 26;
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth);
                                outBL.OuterLineWidth = 35;
                                break;
                        case com.sun.star.table.BorderLineStyle.THICKTHIN_SMALLGAP:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = (short) (inBL2.LineWidth);
                                outBL.LineDistance = 35;
                                outBL.OuterLineWidth = 26;
                                break;
                        case com.sun.star.table.BorderLineStyle.THICKTHIN_MEDIUMGAP:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = (short) (inBL2.LineWidth);
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth / 2);
                                outBL.OuterLineWidth = (short) (inBL2.LineWidth / 2);
                                break;
                        case com.sun.star.table.BorderLineStyle.THICKTHIN_LARGEGAP:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = 53;
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth);
                                outBL.OuterLineWidth = 26;
                                break;
                        case com.sun.star.table.BorderLineStyle.EMBOSSED:
                        case com.sun.star.table.BorderLineStyle.ENGRAVED:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = (short) (inBL2.LineWidth / 2);
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth);
                                outBL.OuterLineWidth = (short) (inBL2.LineWidth / 2);
                                break;
                        case com.sun.star.table.BorderLineStyle.OUTSET:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = (short) (inBL2.LineWidth);
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth);
                                outBL.OuterLineWidth = 26;
                                break;
                        case com.sun.star.table.BorderLineStyle.INSET:
                                outBL.Color = inBL2.Color;
                                outBL.InnerLineWidth = 26;
                                outBL.LineDistance = (short) Math.max(35, inBL2.LineWidth);
                                outBL.OuterLineWidth = (short) (inBL2.LineWidth);
                                break;
                }
                return outBL;
        }
</PRE>
</BLOCKQUOTE>
But that function actually did not help, because as far as I found out, TableBorder does not work the way it did before (OOo 2.3), but removes the lines in most cases. <BR>
I am still trying to find the cause (and hoping it's fixed in 3.5)<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
> ...
I'm working on a TableBorder2 property that contains BorderLine2 instead
of BorderLine, that will be for 3.6 though so probably doesn't help you
right now with your actual problem.
</PRE>
</BLOCKQUOTE>
I am looking forward to TabelBorder2
<BLOCKQUOTE TYPE=CITE>
<PRE>
> Simple type casting or picking the innerlinewidth etc. shows zero
> values.
That might also be due to some bugs around the BorderLine properties,
which we only recently fixed. Master and 3-5 may already be better,
some fixes are also in 3-5-0. Especially if for non-double lines only
InnerLineWidth was set and OuterLineWidth was 0 then no border was
drawn, may be workarounded by setting OuterLineWidth instead.
</PRE>
</BLOCKQUOTE>
I will check Tableborders again once 3.5 is out.
<BLOCKQUOTE TYPE=CITE>
<PRE>
> Before doing a conversion tool myself, i would like to know if this has
> already been done.
> If not, can someone point me to the code where Borderline2 is
> interpreted, so that I can reuse that code?
You can peek into editeng/source/items/frmitems.cxx methods
SvxBoxItem::LineToSvxLine() and lcl_lineToSvxLine() and
editeng/source/items/borderline.cxx method
SvxBorderLine::GuessLinesWidths().
Eike
</PRE>
</BLOCKQUOTE>
Thanks<BR>
Dietmar
<BLOCKQUOTE TYPE=CITE>
<PRE>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>