diff options
-rw-r--r-- | comphelper/inc/comphelper/TypeGeneration.hxx | 1 | ||||
-rw-r--r-- | comphelper/source/property/TypeGeneration.cxx | 2 | ||||
-rw-r--r-- | sw/JunitTest_sw_complex.mk | 2 | ||||
-rw-r--r-- | sw/inc/cmdid.h | 1 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 11 | ||||
-rw-r--r-- | sw/qa/complex/writer/CheckTable.java | 273 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unoprnms.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 150 |
9 files changed, 385 insertions, 57 deletions
diff --git a/comphelper/inc/comphelper/TypeGeneration.hxx b/comphelper/inc/comphelper/TypeGeneration.hxx index c946916c29d3..8c99fcafbda7 100644 --- a/comphelper/inc/comphelper/TypeGeneration.hxx +++ b/comphelper/inc/comphelper/TypeGeneration.hxx @@ -67,6 +67,7 @@ namespace comphelper CPPUTYPE_PAGESTYLELAY, //getCppuType( (style::PageStyleLayout*)0 ) CPPUTYPE_VERTALIGN, //getCppuType( (style::VerticalAlignment*)0 ) CPPUTYPE_TABLEBORDER, //getCppuType( (table::TableBorder*)0 ) + CPPUTYPE_TABLEBORDER2, //getCppuType( (table::TableBorder*)0 ) CPPUTYPE_GRFCROP, //getCppuType( (text::GraphicCrop*)0 ) CPPUTYPE_SECTFILELNK, //getCppuType( (text::SectionFileLink*)0 ) CPPUTYPE_PAGENUMTYPE, //getCppuType( (const PageNumberType*)0 ) diff --git a/comphelper/source/property/TypeGeneration.cxx b/comphelper/source/property/TypeGeneration.cxx index 0273b0e14256..a6e8e172b05d 100644 --- a/comphelper/source/property/TypeGeneration.cxx +++ b/comphelper/source/property/TypeGeneration.cxx @@ -104,6 +104,7 @@ #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/table/TableBorder.hpp> +#include <com/sun/star/table/TableBorder2.hpp> #include <com/sun/star/table/TableBorderDistances.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/lang/Locale.hpp> @@ -174,6 +175,7 @@ namespace comphelper case CPPUTYPE_PAGESTYLELAY: pType = &::getCppuType( (style::PageStyleLayout*)0 ); break; case CPPUTYPE_VERTALIGN: pType = &::getCppuType( (style::VerticalAlignment*)0 ); break; case CPPUTYPE_TABLEBORDER: pType = &::getCppuType( (table::TableBorder*)0 ); break; + case CPPUTYPE_TABLEBORDER2: pType = &::getCppuType( (table::TableBorder2*)0 ); break; case CPPUTYPE_GRFCROP: pType = &::getCppuType( (text::GraphicCrop*)0 ); break; case CPPUTYPE_SECTFILELNK: pType = &::getCppuType( (text::SectionFileLink*)0 ); break; case CPPUTYPE_PAGENUMTYPE: pType = &::getCppuType( (text::PageNumberType*)0); break; diff --git a/sw/JunitTest_sw_complex.mk b/sw/JunitTest_sw_complex.mk index cbf6fe00fc8a..3c2378532b5a 100644 --- a/sw/JunitTest_sw_complex.mk +++ b/sw/JunitTest_sw_complex.mk @@ -43,6 +43,7 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sw_complex,\ sw/qa/complex/writer/CheckFields \ sw/qa/complex/writer/CheckIndexedPropertyValues \ sw/qa/complex/writer/CheckNamedPropertyValues \ + sw/qa/complex/writer/CheckTable \ sw/qa/complex/writer/LoadSaveTest \ sw/qa/complex/writer/TestDocument \ sw/qa/complex/writer/TextPortionEnumerationTest \ @@ -62,6 +63,7 @@ $(eval $(call gb_JunitTest_add_classes,sw_complex,\ complex.writer.CheckCrossReferences \ complex.writer.CheckFields\ complex.writer.CheckFlies \ + complex.writer.CheckTable \ complex.writer.CheckIndexedPropertyValues \ complex.writer.CheckNamedPropertyValues \ complex.writer.TextPortionEnumerationTest \ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index be1c84dfd918..e090d88fda99 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -664,6 +664,7 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_UNO_FIRST_SHARE_CONTENT (FN_EXTRA2 + 117) #define FN_UNO_HEADER_FIRST (FN_EXTRA2 + 118) #define FN_UNO_FOOTER_FIRST (FN_EXTRA2 + 119) +#define FN_UNO_TABLE_BORDER2 (FN_EXTRA2 + 120) /*------------------------------------------------ -------------------- Area: Help diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index b277f001118c..01922d1ef526 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -816,13 +816,14 @@ enum SwPropNameIds /* 0750 */ UNO_NAME_PARAGRAPH_STYLE_NAME, -/* 0750 */ UNO_NAME_FIRST_IS_SHARED, -/* 0751 */ UNO_NAME_HEADER_TEXT_FIRST, -/* 0752 */ UNO_NAME_FOOTER_TEXT_FIRST, +/* 0751 */ UNO_NAME_FIRST_IS_SHARED, +/* 0752 */ UNO_NAME_HEADER_TEXT_FIRST, +/* 0753 */ UNO_NAME_FOOTER_TEXT_FIRST, -/* 0753 */ UNO_NAME_INITIALS, +/* 0754 */ UNO_NAME_INITIALS, +/* 0755 */ UNO_NAME_TABLE_BORDER2, -/* 0754 */ SW_PROPNAME_END +/* 0756 */ SW_PROPNAME_END // new items in this array must match SwPropNameTab aPropNameTab }; diff --git a/sw/qa/complex/writer/CheckTable.java b/sw/qa/complex/writer/CheckTable.java new file mode 100644 index 000000000000..2405ace27e9c --- /dev/null +++ b/sw/qa/complex/writer/CheckTable.java @@ -0,0 +1,273 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package complex.writer; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XEnumeration; +import com.sun.star.util.XCloseable; +import com.sun.star.text.XText; +import com.sun.star.text.XTextContent; +import com.sun.star.text.XTextDocument; +import com.sun.star.text.XTextRange; +import com.sun.star.text.XTextCursor; +import com.sun.star.text.XTextTable; +import com.sun.star.table.TableBorder; +import com.sun.star.table.TableBorder2; +import com.sun.star.table.BorderLine; +import com.sun.star.table.BorderLine2; +import static com.sun.star.table.BorderLineStyle.*; + +import org.openoffice.test.OfficeConnection; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +import java.util.Set; +import java.util.HashSet; + + +public class CheckTable +{ + private static final OfficeConnection connection = new OfficeConnection(); + + @BeforeClass public static void setUpConnection() throws Exception { + connection.setUp(); +//Thread.sleep(5000); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + private XMultiServiceFactory m_xMSF = null; + private XComponentContext m_xContext = null; + private XTextDocument m_xDoc = null; + + @Before public void before() throws Exception + { + m_xMSF = UnoRuntime.queryInterface( + XMultiServiceFactory.class, + connection.getComponentContext().getServiceManager()); + m_xContext = connection.getComponentContext(); + assertNotNull("could not get component context.", m_xContext); + m_xDoc = util.WriterTools.createTextDoc(m_xMSF); + } + + @After public void after() + { + util.DesktopTools.closeDoc(m_xDoc); + } + + @Test + public void test_tableborder() throws Exception + { + // insert table + XMultiServiceFactory xDocF = + UnoRuntime.queryInterface(XMultiServiceFactory.class, m_xDoc); + XTextTable xTable = UnoRuntime.queryInterface(XTextTable.class, + xDocF.createInstance("com.sun.star.text.TextTable")); + xTable.initialize(3, 3); + XText xText = m_xDoc.getText(); + XTextCursor xCursor = xText.createTextCursor(); + xText.insertTextContent(xCursor, xTable, false); + // read orig border + XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, + xTable); + TableBorder border = (TableBorder) xProps.getPropertyValue("TableBorder"); + assertTrue(border.IsTopLineValid); + assertEquals(0, border.TopLine.InnerLineWidth); + assertEquals(2, border.TopLine.OuterLineWidth); + assertEquals(0, border.TopLine.LineDistance); + assertEquals(0, border.TopLine.Color); + assertTrue(border.IsBottomLineValid); + assertEquals(0, border.BottomLine.InnerLineWidth); + assertEquals(2, border.BottomLine.OuterLineWidth); + assertEquals(0, border.BottomLine.LineDistance); + assertEquals(0, border.BottomLine.Color); + assertTrue(border.IsLeftLineValid); + assertEquals(0, border.LeftLine.InnerLineWidth); + assertEquals(2, border.LeftLine.OuterLineWidth); + assertEquals(0, border.LeftLine.LineDistance); + assertEquals(0, border.LeftLine.Color); + assertTrue(border.IsRightLineValid); + assertEquals(0, border.RightLine.InnerLineWidth); + assertEquals(2, border.RightLine.OuterLineWidth); + assertEquals(0, border.RightLine.LineDistance); + assertEquals(0, border.RightLine.Color); + assertTrue(border.IsHorizontalLineValid); + assertEquals(0, border.HorizontalLine.InnerLineWidth); + assertEquals(2, border.HorizontalLine.OuterLineWidth); + assertEquals(0, border.HorizontalLine.LineDistance); + assertEquals(0, border.HorizontalLine.Color); + assertTrue(border.IsVerticalLineValid); + assertEquals(0, border.VerticalLine.InnerLineWidth); + assertEquals(2, border.VerticalLine.OuterLineWidth); + assertEquals(0, border.VerticalLine.LineDistance); + assertEquals(0, border.VerticalLine.Color); + assertTrue(border.IsDistanceValid); + assertEquals(97, border.Distance); + // set border + border.TopLine = new BorderLine(0, (short)11, (short)19, (short)19); + border.BottomLine = new BorderLine(0xFF, (short)0, (short)11, (short)0); + border.HorizontalLine = new BorderLine(0xFF00, (short)0, (short)90, (short)0); + xProps.setPropertyValue("TableBorder", border); + // read set border + border = (TableBorder) xProps.getPropertyValue("TableBorder"); + assertTrue(border.IsTopLineValid); + assertEquals(11, border.TopLine.InnerLineWidth); + assertEquals(19, border.TopLine.OuterLineWidth); + assertEquals(19, border.TopLine.LineDistance); + assertEquals(0, border.TopLine.Color); + assertTrue(border.IsBottomLineValid); + assertEquals(0, border.BottomLine.InnerLineWidth); + assertEquals(11, border.BottomLine.OuterLineWidth); + assertEquals(0, border.BottomLine.LineDistance); + assertEquals(0xFF, border.BottomLine.Color); + assertTrue(border.IsLeftLineValid); + assertEquals(0, border.LeftLine.InnerLineWidth); + assertEquals(2, border.LeftLine.OuterLineWidth); + assertEquals(0, border.LeftLine.LineDistance); + assertEquals(0, border.LeftLine.Color); + assertTrue(border.IsRightLineValid); + assertEquals(0, border.RightLine.InnerLineWidth); + assertEquals(2, border.RightLine.OuterLineWidth); + assertEquals(0, border.RightLine.LineDistance); + assertEquals(0, border.RightLine.Color); + assertTrue(border.IsHorizontalLineValid); + assertEquals(0, border.HorizontalLine.InnerLineWidth); + assertEquals(90, border.HorizontalLine.OuterLineWidth); + assertEquals(0, border.HorizontalLine.LineDistance); + assertEquals(0xFF00, border.HorizontalLine.Color); + assertTrue(border.IsVerticalLineValid); + assertEquals(0, border.VerticalLine.InnerLineWidth); + assertEquals(2, border.VerticalLine.OuterLineWidth); + assertEquals(0, border.VerticalLine.LineDistance); + assertEquals(0, border.VerticalLine.Color); + assertTrue(border.IsDistanceValid); + assertEquals(97, border.Distance); + TableBorder2 border2 = (TableBorder2) xProps.getPropertyValue("TableBorder2"); + assertTrue(border2.IsTopLineValid); + assertEquals(11, border2.TopLine.InnerLineWidth); + assertEquals(19, border2.TopLine.OuterLineWidth); + assertEquals(19, border2.TopLine.LineDistance); + assertEquals(0, border2.TopLine.Color); + assertEquals(DOUBLE, border2.TopLine.LineStyle); + assertEquals(49, border2.TopLine.LineWidth); + assertTrue(border2.IsBottomLineValid); + assertEquals(0, border2.BottomLine.InnerLineWidth); + assertEquals(11, border2.BottomLine.OuterLineWidth); + assertEquals(0, border2.BottomLine.LineDistance); + assertEquals(0xFF, border2.BottomLine.Color); + assertEquals(SOLID, border2.BottomLine.LineStyle); + assertEquals(11, border2.BottomLine.LineWidth); + assertTrue(border2.IsLeftLineValid); + assertEquals(0, border2.LeftLine.InnerLineWidth); + assertEquals(2, border2.LeftLine.OuterLineWidth); + assertEquals(0, border2.LeftLine.LineDistance); + assertEquals(0, border2.LeftLine.Color); + assertEquals(SOLID, border2.LeftLine.LineStyle); + assertEquals(2, border2.LeftLine.LineWidth); + assertTrue(border2.IsRightLineValid); + assertEquals(0, border2.RightLine.InnerLineWidth); + assertEquals(2, border2.RightLine.OuterLineWidth); + assertEquals(0, border2.RightLine.LineDistance); + assertEquals(0, border2.RightLine.Color); + assertEquals(SOLID, border2.RightLine.LineStyle); + assertEquals(2, border2.RightLine.LineWidth); + assertTrue(border2.IsHorizontalLineValid); + assertEquals(0, border2.HorizontalLine.InnerLineWidth); + assertEquals(90, border2.HorizontalLine.OuterLineWidth); + assertEquals(0, border2.HorizontalLine.LineDistance); + assertEquals(0xFF00, border2.HorizontalLine.Color); + assertEquals(SOLID, border2.HorizontalLine.LineStyle); + assertEquals(90, border2.HorizontalLine.LineWidth); + assertTrue(border2.IsVerticalLineValid); + assertEquals(0, border2.VerticalLine.InnerLineWidth); + assertEquals(2, border2.VerticalLine.OuterLineWidth); + assertEquals(0, border2.VerticalLine.LineDistance); + assertEquals(0, border2.VerticalLine.Color); + assertEquals(SOLID, border2.VerticalLine.LineStyle); + assertEquals(2, border2.VerticalLine.LineWidth); + assertTrue(border2.IsDistanceValid); + assertEquals(97, border2.Distance); + + // set border2 + border2.RightLine = + new BorderLine2(0, (short)0, (short)0, (short)0, THICKTHIN_LARGEGAP, 120); + border2.LeftLine = + new BorderLine2(0, (short)0, (short)0, (short)0, EMBOSSED, 90); + border2.VerticalLine = + new BorderLine2(0xFF, (short)0, (short)90, (short)0, DOTTED, 0); + border2.HorizontalLine = + new BorderLine2(0xFF00, (short)0, (short)0, (short)0, DASHED, 11); + xProps.setPropertyValue("TableBorder2", border2); + + // read set border2 + border2 = (TableBorder2) xProps.getPropertyValue("TableBorder2"); + assertTrue(border2.IsTopLineValid); + assertEquals(11, border2.TopLine.InnerLineWidth); + assertEquals(19, border2.TopLine.OuterLineWidth); + assertEquals(19, border2.TopLine.LineDistance); + assertEquals(0, border2.TopLine.Color); + assertEquals(DOUBLE, border2.TopLine.LineStyle); + assertEquals(49, border2.TopLine.LineWidth); + assertTrue(border2.IsBottomLineValid); + assertEquals(0, border2.BottomLine.InnerLineWidth); + assertEquals(11, border2.BottomLine.OuterLineWidth); + assertEquals(0, border2.BottomLine.LineDistance); + assertEquals(0xFF, border2.BottomLine.Color); + assertEquals(SOLID, border2.BottomLine.LineStyle); + assertEquals(11, border2.BottomLine.LineWidth); + assertTrue(border2.IsLeftLineValid); + assertEquals(23, border2.LeftLine.InnerLineWidth); + assertEquals(23, border2.LeftLine.OuterLineWidth); + assertEquals(46, border2.LeftLine.LineDistance); + assertEquals(0, border2.LeftLine.Color); + assertEquals(EMBOSSED, border2.LeftLine.LineStyle); + assertEquals(90, border2.LeftLine.LineWidth); + assertTrue(border2.IsRightLineValid); + assertEquals(53, border2.RightLine.InnerLineWidth); + assertEquals(26, border2.RightLine.OuterLineWidth); + assertEquals(41, border2.RightLine.LineDistance); + assertEquals(0, border2.RightLine.Color); + assertEquals(THICKTHIN_LARGEGAP, border2.RightLine.LineStyle); + assertEquals(120, border2.RightLine.LineWidth); + assertTrue(border2.IsHorizontalLineValid); + assertEquals(0, border2.HorizontalLine.InnerLineWidth); + assertEquals(11, border2.HorizontalLine.OuterLineWidth); + assertEquals(0, border2.HorizontalLine.LineDistance); + assertEquals(0xFF00, border2.HorizontalLine.Color); + assertEquals(DASHED, border2.HorizontalLine.LineStyle); + assertEquals(11, border2.HorizontalLine.LineWidth); + assertTrue(border2.IsVerticalLineValid); + assertEquals(0, border2.VerticalLine.InnerLineWidth); + assertEquals(90, border2.VerticalLine.OuterLineWidth); + assertEquals(0, border2.VerticalLine.LineDistance); + assertEquals(0xFF, border2.VerticalLine.Color); + assertEquals(DOTTED, border2.VerticalLine.LineStyle); + assertEquals(90, border2.VerticalLine.LineWidth); + assertTrue(border2.IsDistanceValid); + assertEquals(97, border2.Distance); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 35a7900d06f5..26348ed67236 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -909,6 +909,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_TABLE_BORDER), FN_UNO_TABLE_BORDER, CPPU_E2T(CPPUTYPE_TABLEBORDER), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_TABLE_BORDER2), FN_UNO_TABLE_BORDER2, CPPU_E2T(CPPUTYPE_TABLEBORDER2), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS }, { SW_PROP_NMID(UNO_NAME_TABLE_BORDER_DISTANCES), FN_UNO_TABLE_BORDER_DISTANCES, CPPU_E2T(CPPUTYPE_TABLEBORDERDISTANCES), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS }, { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_SEPARATORS), FN_UNO_TABLE_COLUMN_SEPARATORS, CPPU_E2T(CPPUTYPE_TBLCOLSEP), PropertyAttribute::MAYBEVOID, 0 }, { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_RELATIVE_SUM), FN_UNO_TABLE_COLUMN_RELATIVE_SUM, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0 }, diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index e6bf6e088791..28ff13eb7367 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -793,6 +793,7 @@ const SwPropNameTab aPropNameTab = { /* 0752 HEADER_TEXT_FIRST */ {MAP_CHAR_LEN("HeaderTextFirst")}, /* 0753 FOOTER_TEXT_FIRST */ {MAP_CHAR_LEN("FooterTextFirst")}, /* 0754 UNO_NAME_INITIALS */ {MAP_CHAR_LEN("Initials")}, +/* 0755 UNO_NAME_INITIALS */ {MAP_CHAR_LEN("TableBorder2")}, // new items in this array must match enum SwPropNameIds }; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 798fe4fc4943..5638ccf31964 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -70,6 +70,7 @@ #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/table/TableBorder.hpp> +#include <com/sun/star/table/TableBorder2.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/BorderLineStyle.hpp> #include <com/sun/star/table/TableBorderDistances.hpp> @@ -115,24 +116,6 @@ extern void lcl_GetTblBoxColStr( sal_uInt16 nCol, String& rNm ); #define UNO_TABLE_COLUMN_SUM 10000 -table::BorderLine lcl_SvxLineToLine(const SvxBorderLine* pLine) -{ - table::BorderLine2 aLine; - if(pLine) - { - aLine.Color = pLine->GetColor().GetColor() ; - aLine.LineWidth = TWIP_TO_MM100_UNSIGNED( pLine->GetWidth() ); - - // Set only for backwards compatibility - aLine.InnerLineWidth = TWIP_TO_MM100_UNSIGNED( pLine->GetInWidth() ); - aLine.OuterLineWidth = TWIP_TO_MM100_UNSIGNED( pLine->GetOutWidth() ); - aLine.LineDistance = TWIP_TO_MM100_UNSIGNED( pLine->GetDistance() ); - } - else - aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0; - return aLine; -} - sal_Bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine) { rSvxLine.SetColor(Color(rLine.Color)); @@ -3051,15 +3034,62 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, } break; case FN_UNO_TABLE_BORDER: + case FN_UNO_TABLE_BORDER2: { - const table::TableBorder* pBorder = - (const table::TableBorder* )aValue.getValue(); - if(aValue.getValueType() == ::getCppuType((const table::TableBorder* )0) - && pBorder) + table::TableBorder oldBorder; + table::TableBorder2 aBorder; + SvxBorderLine aTopLine; + SvxBorderLine aBottomLine; + SvxBorderLine aLeftLine; + SvxBorderLine aRightLine; + SvxBorderLine aHoriLine; + SvxBorderLine aVertLine; + if (aValue >>= oldBorder) + { + aBorder.IsTopLineValid = oldBorder.IsTopLineValid; + aBorder.IsBottomLineValid = oldBorder.IsBottomLineValid; + aBorder.IsLeftLineValid = oldBorder.IsLeftLineValid; + aBorder.IsRightLineValid = oldBorder.IsRightLineValid; + aBorder.IsHorizontalLineValid = oldBorder.IsHorizontalLineValid; + aBorder.IsVerticalLineValid = oldBorder.IsVerticalLineValid; + aBorder.Distance = oldBorder.Distance; + aBorder.IsDistanceValid = oldBorder.IsDistanceValid; + lcl_LineToSvxLine( + oldBorder.TopLine, aTopLine); + lcl_LineToSvxLine( + oldBorder.BottomLine, aBottomLine); + lcl_LineToSvxLine( + oldBorder.LeftLine, aLeftLine); + lcl_LineToSvxLine( + oldBorder.RightLine, aRightLine); + lcl_LineToSvxLine( + oldBorder.HorizontalLine, aHoriLine); + lcl_LineToSvxLine( + oldBorder.VerticalLine, aVertLine); + } + else if (aValue >>= aBorder) + { + SvxBoxItem::LineToSvxLine( + aBorder.TopLine, aTopLine, true); + SvxBoxItem::LineToSvxLine( + aBorder.BottomLine, aBottomLine, true); + SvxBoxItem::LineToSvxLine( + aBorder.LeftLine, aLeftLine, true); + SvxBoxItem::LineToSvxLine( + aBorder.RightLine, aRightLine, true); + SvxBoxItem::LineToSvxLine( + aBorder.HorizontalLine, aHoriLine, true); + SvxBoxItem::LineToSvxLine( + aBorder.VerticalLine, aVertLine, true); + } + else + { + break; // something else + } { SwDoc* pDoc = pFmt->GetDoc(); SwFrm* pFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt ); - //Tabellen ohne Layout (unsichtbare Header/Footer ) + // tables without layout (invisible header/footer?) if( pFrm ) { lcl_FormatTable(pFmt); @@ -3072,7 +3102,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const SwTableBox* pTLBox = lcl_FindCornerTableBox(rLines, true); const SwStartNode* pSttNd = pTLBox->GetSttNd(); SwPosition aPos(*pSttNd); - // Cursor in die obere linke Zelle des Ranges setzen + // set cursor to top left cell SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True); pUnoCrsr->Move( fnMoveForward, fnGoNode ); pUnoCrsr->SetRemainInSection( sal_False ); @@ -3093,34 +3123,27 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, SvxBoxItem aBox( RES_BOX ); SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); - SvxBorderLine aLine; - sal_Bool bSet = lcl_LineToSvxLine(pBorder->TopLine, aLine); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP); - aBoxInfo.SetValid(VALID_TOP, pBorder->IsTopLineValid); + aBox.SetLine(aTopLine.isEmpty() ? 0 : &aTopLine, BOX_LINE_TOP); + aBoxInfo.SetValid(VALID_TOP, aBorder.IsTopLineValid); - bSet = lcl_LineToSvxLine(pBorder->BottomLine, aLine); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM); - aBoxInfo.SetValid(VALID_BOTTOM, pBorder->IsBottomLineValid); + aBox.SetLine(aBottomLine.isEmpty() ? 0 : &aBottomLine, BOX_LINE_BOTTOM); + aBoxInfo.SetValid(VALID_BOTTOM, aBorder.IsBottomLineValid); - bSet = lcl_LineToSvxLine(pBorder->LeftLine, aLine); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT); - aBoxInfo.SetValid(VALID_LEFT, pBorder->IsLeftLineValid); + aBox.SetLine(aLeftLine.isEmpty() ? 0 : &aLeftLine, BOX_LINE_LEFT); + aBoxInfo.SetValid(VALID_LEFT, aBorder.IsLeftLineValid); - bSet = lcl_LineToSvxLine(pBorder->RightLine, aLine); - aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT); - aBoxInfo.SetValid(VALID_RIGHT, pBorder->IsRightLineValid); + aBox.SetLine(aRightLine.isEmpty() ? 0 : &aRightLine, BOX_LINE_RIGHT); + aBoxInfo.SetValid(VALID_RIGHT, aBorder.IsRightLineValid); - bSet = lcl_LineToSvxLine(pBorder->HorizontalLine, aLine); - aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI); - aBoxInfo.SetValid(VALID_HORI, pBorder->IsHorizontalLineValid); + aBoxInfo.SetLine(aHoriLine.isEmpty() ? 0 : &aHoriLine, BOXINFO_LINE_HORI); + aBoxInfo.SetValid(VALID_HORI, aBorder.IsHorizontalLineValid); - bSet = lcl_LineToSvxLine(pBorder->VerticalLine, aLine); - aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT); - aBoxInfo.SetValid(VALID_VERT, pBorder->IsVerticalLineValid); + aBoxInfo.SetLine(aVertLine.isEmpty() ? 0 : &aVertLine, BOXINFO_LINE_VERT); + aBoxInfo.SetValid(VALID_VERT, aBorder.IsVerticalLineValid); - aBox.SetDistance((sal_uInt16)MM100_TO_TWIP(pBorder->Distance)); - aBoxInfo.SetValid(VALID_DISTANCE, pBorder->IsDistanceValid); + aBox.SetDistance((sal_uInt16)MM100_TO_TWIP(aBorder.Distance)); + aBoxInfo.SetValid(VALID_DISTANCE, aBorder.IsDistanceValid); aSet.Put(aBox); aSet.Put(aBoxInfo); @@ -3251,6 +3274,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be } break; case FN_UNO_TABLE_BORDER: + case FN_UNO_TABLE_BORDER2: { SwDoc* pDoc = pFmt->GetDoc(); SwFrm* pFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt ); @@ -3289,22 +3313,44 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be const SvxBoxInfoItem& rBoxInfoItem = (const SvxBoxInfoItem&)aSet.Get(SID_ATTR_BORDER_INNER); const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX); + if (FN_UNO_TABLE_BORDER == pEntry->nWID) + { table::TableBorder aTableBorder; - aTableBorder.TopLine = lcl_SvxLineToLine(rBox.GetTop()); + aTableBorder.TopLine = SvxBoxItem::SvxLineToLine(rBox.GetTop(), true); aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(VALID_TOP); - aTableBorder.BottomLine = lcl_SvxLineToLine(rBox.GetBottom()); + aTableBorder.BottomLine = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), true); aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(VALID_BOTTOM); - aTableBorder.LeftLine = lcl_SvxLineToLine(rBox.GetLeft()); + aTableBorder.LeftLine = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), true); aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(VALID_LEFT); - aTableBorder.RightLine = lcl_SvxLineToLine(rBox.GetRight()); + aTableBorder.RightLine = SvxBoxItem::SvxLineToLine(rBox.GetRight(), true); aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(VALID_RIGHT ); - aTableBorder.HorizontalLine = lcl_SvxLineToLine(rBoxInfoItem.GetHori()); + aTableBorder.HorizontalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), true); aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI); - aTableBorder.VerticalLine = lcl_SvxLineToLine(rBoxInfoItem.GetVert()); + aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), true); aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT); aTableBorder.Distance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() ); aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE); - aRet.setValue(&aTableBorder, ::getCppuType((const table::TableBorder*)0)); + aRet <<= aTableBorder; + } + else + { + table::TableBorder2 aTableBorder; + aTableBorder.TopLine = SvxBoxItem::SvxLineToLine(rBox.GetTop(), true); + aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(VALID_TOP); + aTableBorder.BottomLine = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), true); + aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(VALID_BOTTOM); + aTableBorder.LeftLine = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), true); + aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(VALID_LEFT); + aTableBorder.RightLine = SvxBoxItem::SvxLineToLine(rBox.GetRight(), true); + aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(VALID_RIGHT ); + aTableBorder.HorizontalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), true); + aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI); + aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), true); + aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT); + aTableBorder.Distance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() ); + aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE); + aRet <<= aTableBorder; + } delete pUnoCrsr; } } |