dbaccess/source/ui/dlg/dsselect.cxx | 5 dbaccess/source/ui/dlg/dsselect.hxx | 2 include/xmloff/txtprmap.hxx | 2 sw/CppunitTest_sw_odfexport.mk | 3 sw/qa/extras/odfexport/data/tdf92379.fodt | 89 +++++++++ sw/qa/extras/odfexport/odfexport.cxx | 80 ++++++++ sw/qa/extras/uiwriter/uiwriter.cxx | 294 ++++++++++++++---------------- sw/source/core/unocore/swunohelper.cxx | 14 + sw/source/core/unocore/unostyle.cxx | 6 sw/source/filter/xml/xmlimp.cxx | 12 + xmloff/source/draw/sdpropls.cxx | 4 xmloff/source/text/txtimppr.cxx | 14 + 12 files changed, 366 insertions(+), 159 deletions(-)
New commits: commit 13cd7ea2b3123e24bb5ff29a8dcbb55a8fcf3859 Author: Michael Stahl <mst...@redhat.com> Date: Wed Aug 26 21:48:13 2015 +0200 dbaccess: fix windows build breakage Change-Id: I69f45dd2d7426ecd99dca7e80e98e95c3e52d4a0 diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx index a812a6b..baa9047 100644 --- a/dbaccess/source/ui/dlg/dsselect.cxx +++ b/dbaccess/source/ui/dlg/dsselect.cxx @@ -102,7 +102,7 @@ bool ODatasourceSelectDialog::Close() } #ifdef HAVE_ODBC_ADMINISTRATION -IMPL_LINK_NOARG(ODatasourceSelectDialog, ManageClickHdl) +IMPL_LINK_NOARG_TYPED(ODatasourceSelectDialog, ManageClickHdl, Button*, void) { if ( !m_pODBCManagement.get() ) m_pODBCManagement.reset( new OOdbcManagement( LINK( this, ODatasourceSelectDialog, ManageProcessFinished ) ) ); @@ -112,7 +112,7 @@ IMPL_LINK_NOARG(ODatasourceSelectDialog, ManageClickHdl) // TODO: error message m_pDatasource->GrabFocus(); m_pManageDatasources->Disable(); - return 1L; + return; } m_pDatasource->Disable(); @@ -121,7 +121,6 @@ IMPL_LINK_NOARG(ODatasourceSelectDialog, ManageClickHdl) m_pManageDatasources->Disable(); SAL_WARN_IF( !m_pODBCManagement->isRunning(), "dbaccess.ui", "ODatasourceSelectDialog::ManageClickHdl: success, but not running - you were *fast*!" ); - return 0L; } IMPL_LINK_NOARG( ODatasourceSelectDialog, ManageProcessFinished ) diff --git a/dbaccess/source/ui/dlg/dsselect.hxx b/dbaccess/source/ui/dlg/dsselect.hxx index 2cb4cb6..31c8116 100644 --- a/dbaccess/source/ui/dlg/dsselect.hxx +++ b/dbaccess/source/ui/dlg/dsselect.hxx @@ -63,7 +63,7 @@ public: protected: DECL_LINK( ListDblClickHdl, ListBox * ); #ifdef HAVE_ODBC_ADMINISTRATION - DECL_LINK( ManageClickHdl, void* ); + DECL_LINK_TYPED(ManageClickHdl, Button*, void); DECL_LINK( ManageProcessFinished, void* ); #endif void fillListBox(const StringBag& _rDatasources); commit 68efa6f5128abf4cd097ae81a4cfd7fecbcb2a80 Author: Michael Stahl <mst...@redhat.com> Date: Wed Aug 26 19:04:50 2015 +0200 ODF import: workaround dubious draw:fill="solid" on frame styles Since the gradient frame backgrounds were added in LO 4.1, we export this: fo:background-color="transparent" draw:fill="solid" Which doesn't make a whole lot of sense as this is really a "none" fill, and now with the backward compatibility stuff in the style import code we get the pool default color added when setting the BackTransparent property, and with the draw:fill="solid" it becomes visible and the background color is now Sky Blue 1. So try to detect draw:fill="solid" without draw:fill-color attribute and contradicting transparent legacy attribute and nerf it. This way we also export draw:fill="none" again, although still with a bogus draw:fill-color but that shouldn't cause any harm. Change-Id: I1c2bea46ba7d9a3f042b875df0ca12c7f6037909 diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx index 2562abb..5fa8e3c 100644 --- a/include/xmloff/txtprmap.hxx +++ b/include/xmloff/txtprmap.hxx @@ -198,6 +198,8 @@ #define CTF_RELHEIGHTREL (XML_TEXT_CTF_START + 169) #define CTF_CHAR_BACKGROUND (XML_TEXT_CTF_START + 170) #define CTF_CHAR_HIGHLIGHT (XML_TEXT_CTF_START + 171) +#define CTF_FILLSTYLE (XML_TEXT_CTF_START + 172) +#define CTF_FILLCOLOR (XML_TEXT_CTF_START + 173) enum class TextPropMap { diff --git a/sw/qa/extras/odfexport/data/tdf92379.fodt b/sw/qa/extras/odfexport/data/tdf92379.fodt index 8aeb9c4..762a04d 100644 --- a/sw/qa/extras/odfexport/data/tdf92379.fodt +++ b/sw/qa/extras/odfexport/data/tdf92379.fodt @@ -36,6 +36,11 @@ <style:columns fo:column-count="1" fo:column-gap="0in"/> </style:graphic-properties> </style:style> + <style:style style:name="Untitled1" style:family="graphic" style:parent-style-name="encarts"> + <style:graphic-properties fo:background-color="transparent" style:background-transparency="100%" draw:fill="solid"> + <style:background-image/> + </style:graphic-properties> + </style:style> <!-- "Titre Avis expert" and derived styles from bugdoc --> <style:style style:name="Titre_20_Avis_20_expert" style:display-name="Titre Avis expert" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name=""> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index a18b3b3..bfb24d1 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -280,6 +280,23 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffcc99), getProperty<sal_Int32>(xStyle, "FillColor")); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, "FillTransparence")); + uno::Reference<beans::XPropertySet> xFrameStyle2(xStyles->getByName("Untitled1"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xFrameStyle2, "BackColorRGB")); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xFrameStyle2, "BackTransparent")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xFrameStyle2, "BackColorTransparency")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xFrameStyle2, "FillStyle")); +// unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE +// CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xFrameStyle2, "FillColor")); +// CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xFrameStyle2, "FillTransparence")); + + if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + { + // check that fo:background-color attribute is exported properly + assertXPath(pXmlDoc, "//style:style[@style:family='graphic' and @style:name='encarts']/style:graphic-properties[@fo:background-color='#ffcc99']", 1); + assertXPath(pXmlDoc, "//style:style[@style:family='graphic' and @style:name='Untitled1']/style:graphic-properties[@fo:background-color='transparent']", 1); + } + // paragraph style fo:background-color was wrongly inherited despite being // overridden in derived style uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles")); diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 45920d9..442e5db 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -106,8 +106,8 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP( "LineCap", XML_NAMESPACE_SVG , XML_STROKE_LINECAP, XML_SD_TYPE_LINECAP, 0 ), // fill attributes - GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, 0 ), - GMAP_D("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0), + GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, CTF_FILLSTYLE ), + GMAP_D("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_FILLCOLOR ), GMAP_D("FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0), GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ), GMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ), diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 1a0f67e..7e65d79 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -20,6 +20,7 @@ #include <osl/thread.h> #include <com/sun/star/awt/FontFamily.hpp> #include <com/sun/star/awt/FontPitch.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/SizeType.hpp> @@ -410,6 +411,8 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pAllMargin = 0; XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; ::std::unique_ptr<XMLPropertyState> pNewMargins[4]; + XMLPropertyState* pFillStyle(nullptr); + XMLPropertyState* pFillColor(nullptr); for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != rProperties.end(); @@ -493,6 +496,8 @@ void XMLTextImportPropertyMapper::finished( bHasAnyWidth = true; break; case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; + case CTF_FILLSTYLE: pFillStyle = property; break; + case CTF_FILLCOLOR: pFillColor = property; break; case CTF_PARAMARGINALL: case CTF_PARAMARGINALL_REL: pAllParaMargin = property; break; @@ -655,6 +660,15 @@ void XMLTextImportPropertyMapper::finished( pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL, &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL ); + if (pFillStyle && !pFillColor && pBackTransparent + && drawing::FillStyle_SOLID == pFillStyle->maValue.get<drawing::FillStyle>() + && pBackTransparent->maValue.get<bool>()) + { + // fo:background="transparent", draw:fill="solid" without draw:fill-color + // prevent getSvxBrushItemFromSourceSet from adding bogus default color + pFillStyle->mnIndex = -1; + } + // #i5775# don't overwrite %transparency with binary transparency if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) ) { commit 25c50a71ffdf7c43f8f3dd10736188271cc75ef0 Author: Michael Stahl <mst...@redhat.com> Date: Tue Aug 25 23:29:18 2015 +0200 related: tdf#92379: sw: backward compatible ODF export of overriding ... frame/paragraph backgrounds. If a style is set to have draw:fill="solid" and a derived style to draw:fill="none" then the derived one must have fo:background-color="transparent" to override the parent for old consumers like LO <= 4.3/AOO <= 4.1 that don't understand draw:fill. Change-Id: I5b56c7ace927338239195c6bfcfef1950544c8d2 diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 956548c..a18b3b3 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -320,6 +320,15 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle32, "FillColor")); // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence")); CPPUNIT_ASSERT_EQUAL(sal_Int32(0x461900), getProperty<sal_Int32>(xStyle32, "CharColor")); + + if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + { + // check that fo:background-color attribute is exported properly + assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Titre Avis expert']/style:paragraph-properties[@fo:background-color='#661900']", 1); + assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Avis expert questions']/style:paragraph-properties[@fo:background-color='transparent']", 1); + assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='avis expert questions non cadres']/style:paragraph-properties[@fo:background-color='#801900']", 1); + assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Avis expert rXponses']/style:paragraph-properties[@fo:background-color='transparent']", 1); + } } DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt") diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 05dd0da..b4a8a4f 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -286,7 +286,18 @@ bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet, switch (eFill) { case drawing::FillStyle_NONE: - return false; // ignoring some extremely limited XFillColorItem eval + // claim that BackColor and BackTransparent are available so that + // fo:background="transparent" attribute is exported to override + // the parent style in case it is != NONE + switch (nMID) + { + case MID_BACK_COLOR: + case MID_BACK_COLOR_R_G_B: + case MID_GRAPHIC_TRANSPARENT: // this is *BackTransparent + return true; + default: + return false; + } break; case drawing::FillStyle_SOLID: case drawing::FillStyle_GRADIENT: // gradient and hatch don't exist in @@ -294,6 +305,7 @@ bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet, switch (nMID) { case MID_BACK_COLOR: + case MID_GRAPHIC_TRANSPARENT: // this is *BackTransparent // Gradient/Hatch always have emulated color return (drawing::FillStyle_SOLID != eFill) || SfxItemState::SET == rSet.GetItemState(XATTR_FILLCOLOR) commit f38f018053a43d1f7b473103e936abe2d4d8fa05 Author: Michael Stahl <mst...@redhat.com> Date: Tue Aug 25 19:08:00 2015 +0200 tdf#92379: sw: ODF import: fix fo:background-color="transparent" The problem is that if the FillStyle is NONE, setting only ParaBackTransparent but not ParaBackColor does absolutely nothing. This means that if a parent style sets a background color, then a derived style cannot override it to be transparent. Cause is that getSvxBrushItemFromSourceSet() defaults to setting a 0xFF transparency on the SvxBrushItem. There is still a problem that getSvxBrushItemFromSourceSet() sets the pool default item's color and that is also exported to ODF again as draw:fill-color, but together with draw:fill="none" it should not cause harm, at least for consumers that prefer draw:fill attributes like LO >= 4.4. (regression from 7d9bb549d498d6beed2c4050c402d09643febdfa) Change-Id: I5312901166a0e6f0cf02369b173dc8498e4113ed diff --git a/sw/qa/extras/odfexport/data/tdf92379.fodt b/sw/qa/extras/odfexport/data/tdf92379.fodt index 280dc5a..8aeb9c4 100644 --- a/sw/qa/extras/odfexport/data/tdf92379.fodt +++ b/sw/qa/extras/odfexport/data/tdf92379.fodt @@ -37,6 +37,32 @@ </style:graphic-properties> </style:style> + <!-- "Titre Avis expert" and derived styles from bugdoc --> + <style:style style:name="Titre_20_Avis_20_expert" style:display-name="Titre Avis expert" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name=""> + <style:paragraph-properties fo:text-align="start" style:justify-single-word="false" style:page-number="auto" fo:background-color="#661900"> + <style:background-image/> + </style:paragraph-properties> + <style:text-properties fo:color="#ffffff" /> + </style:style> + <style:style style:name="Avis_20_expert_20_questions" style:display-name="Avis expert questions" style:family="paragraph" style:parent-style-name="Titre_20_Avis_20_expert" style:master-page-name=""> + <style:paragraph-properties fo:line-height="100%" fo:text-align="start" style:justify-single-word="false" style:page-number="auto" fo:background-color="transparent"> + <style:background-image/> + </style:paragraph-properties> + <style:text-properties fo:color="#661900" /> + </style:style> + <style:style style:name="avis_20_expert_20_questions_20_non_20_cadres" style:display-name="avis expert questions non cadres" style:family="paragraph" style:parent-style-name="Avis_20_expert_20_questions" style:master-page-name=""> + <style:paragraph-properties style:page-number="auto" fo:background-color="#801900" style:shadow="none"> + <style:tab-stops/> + <style:background-image/> + </style:paragraph-properties> + </style:style> + <style:style style:name="Avis_20_expert_20_rXponses" style:display-name="Avis expert rXponses" style:family="paragraph" style:parent-style-name="Avis_20_expert_20_questions" style:master-page-name=""> + <style:paragraph-properties fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false" fo:orphans="0" fo:widows="0" fo:hyphenation-ladder-count="1" style:page-number="auto" fo:background-color="transparent"> + <style:background-image/> + </style:paragraph-properties> + <style:text-properties fo:color="#461900" fo:hyphenate="true" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/> + </style:style> + </office:styles> <office:automatic-styles> <style:page-layout style:name="pm1"> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index d313f37..956548c 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -278,7 +278,48 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xStyle, "BackColorTransparency")); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle, "FillStyle")); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffcc99), getProperty<sal_Int32>(xStyle, "FillColor")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xStyle, "FillTransparence")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, "FillTransparence")); + + // paragraph style fo:background-color was wrongly inherited despite being + // overridden in derived style + uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles")); + uno::Reference<beans::XPropertySet> xStyle1(xParaStyles->getByName( + "Titre Avis expert"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle1, "ParaBackColor")); + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStyle1, "ParaBackTransparent")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle1, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle1, "FillColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle1, "FillTransparence")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle1, "CharColor")); + + uno::Reference<beans::XPropertySet> xStyle2(xParaStyles->getByName( + "Avis expert questions"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xStyle2, "ParaBackColor")); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle2, "ParaBackTransparent")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xStyle2, "FillStyle")); +// unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE +// CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle2, "FillColor")); +// CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle2, "FillTransparence")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle2, "CharColor")); + + uno::Reference<beans::XPropertySet> xStyle31(xParaStyles->getByName( + "avis expert questions non cadres"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x801900), getProperty<sal_Int32>(xStyle31, "ParaBackColor")); + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStyle31, "ParaBackTransparent")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle31, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x801900), getProperty<sal_Int32>(xStyle31, "FillColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle31, "FillTransparence")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle31, "CharColor")); + + uno::Reference<beans::XPropertySet> xStyle32(xParaStyles->getByName( + "Avis expert rXponses"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xStyle32, "ParaBackColor")); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle32, "ParaBackTransparent")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xStyle32, "FillStyle")); +// unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE +// CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle32, "FillColor")); +// CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x461900), getProperty<sal_Int32>(xStyle32, "CharColor")); } DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt") diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index da3d56f..815b274 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1766,7 +1766,11 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, aChangedBrushItem.PutValue(aValue, nMemberId); - if(!(aChangedBrushItem == aOriginalBrushItem)) + if (!(aChangedBrushItem == aOriginalBrushItem) || + // 0xff is already the default - but if BackTransparent is set + // to true, it must be applied in the item set on ODF import + // to potentially override parent style, which is unknown yet + (MID_GRAPHIC_TRANSPARENT == nMemberId && aValue.has<bool>() && aValue.get<bool>())) { setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); } commit 982537d77c2db463cc053cfdcd522530a3834c9e Author: Michael Stahl <mst...@redhat.com> Date: Mon Aug 24 23:27:06 2015 +0200 tdf#92379: sw: unit test for frame style background color Change-Id: I736964e0ae1419de212a7b608377804c764443e7 diff --git a/sw/CppunitTest_sw_odfexport.mk b/sw/CppunitTest_sw_odfexport.mk index 5edd9b5..c6434ac 100644 --- a/sw/CppunitTest_sw_odfexport.mk +++ b/sw/CppunitTest_sw_odfexport.mk @@ -56,6 +56,9 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfexport,\ embeddedobj/util/embobj \ filter/source/config/cache/filterconfig1 \ filter/source/storagefilterdetect/storagefd \ + filter/source/odfflatxml/odfflatxml \ + filter/source/xmlfilterdetect/xmlfd \ + filter/source/xmlfilteradaptor/xmlfa \ framework/util/fwk \ i18npool/util/i18npool \ linguistic/source/lng \ diff --git a/sw/qa/extras/odfexport/data/tdf92379.fodt b/sw/qa/extras/odfexport/data/tdf92379.fodt new file mode 100644 index 0000000..280dc5a --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf92379.fodt @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:initial-creator>ms </meta:initial-creator><meta:creation-date>2015-08-24T21:49:45.305718699</meta:creation-date><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0" meta:non-whitespace-character-count="0"/><meta:generator>LibreOfficeDev/4.3.7.2$Linux_X86_64 LibreOffice_project/8a35821d8636a03b8bf4e15b48f59794652c68ba</meta:generator></office:meta> + <office:font-face-decls> + <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> + <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Source Han Sans CN Regular" svg:font-family="'Source Han Sans CN Regular'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Regular" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + + <!-- "encarts" from bugdoc --> + <style:style style:name="encarts" style:family="graphic"> + <style:graphic-properties svg:width="3.9701in" svg:height="0.1402in" text:anchor-type="paragraph" fo:background-color="#ffcc99" style:background-transparency="0%" draw:fill="solid" fo:padding="0.0193in" fo:border="0.79pt solid #661900" style:shadow="none" draw:shadow-opacity="100%"> + <style:background-image/> + <style:columns fo:column-count="1" fo:column-gap="0in"/> + </style:graphic-properties> + </style:style> + + </office:styles> + <office:automatic-styles> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <text:p text:style-name="Standard"/> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 85a4c01..d313f37 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -268,6 +268,19 @@ DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt") CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials")); } +DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") +{ + // frame style fo:background-color was not imported + uno::Reference<container::XNameAccess> xStyles(getStyles("FrameStyles")); + uno::Reference<beans::XPropertySet> xStyle(xStyles->getByName("encarts"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffcc99), getProperty<sal_Int32>(xStyle, "BackColorRGB")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xStyle, "BackColorTransparency")); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffcc99), getProperty<sal_Int32>(xStyle, "FillColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xStyle, "FillTransparence")); +} + DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt") { // the boolean properties of the index were not exported properly commit 27a02d1708be7812668a84ea956edc8ecb312246 Author: Michael Stahl <mst...@redhat.com> Date: Mon Aug 24 22:56:17 2015 +0200 sw: Flat ODF import: set the InReading and InXMLImport flags Flat ODF Import does not use SwReader but uses SwXMLImport::startDocument() and SwXMLImport::endDocument() to set up the document, so make sure those set the import relevant SwDoc flags. Change-Id: Ife3e58eeebd73ad895fe328662822b847cf9bfec diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 6fa4e54..b7e771a 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -652,6 +652,13 @@ void SwXMLImport::startDocument() if( !pDoc ) return; + if (SvXMLImportFlags::ALL == getImportFlags()) + { + // for flat ODF - this is done in SwReader::Read() for package ODF + pDoc->SetInReading(true); + pDoc->SetInXMLImport(true); + } + if( (getImportFlags() & SvXMLImportFlags::CONTENT) && !IsStylesOnlyMode() ) { pSttNdIdx = new SwNodeIndex( pDoc->GetNodes() ); @@ -876,6 +883,11 @@ void SwXMLImport::endDocument() pDoc->PrtOLENotify( false ); else if ( pDoc->IsOLEPrtNotifyPending() ) pDoc->PrtOLENotify( true ); + + assert(pDoc->IsInReading()); + assert(pDoc->IsInXMLImport()); + pDoc->SetInReading(false); + pDoc->SetInXMLImport(false); } SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); commit e85a8110cd7494bae592329d3daa71f401778a22 Author: Michael Stahl <mst...@redhat.com> Date: Mon Aug 24 18:54:31 2015 +0200 sw: adapt some badly named variables in uiwriter.cxx to coding conventions. Change-Id: I36c11a979f7f003bfdfff766940a7832fd19e906 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 644d89f..764ad7a 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -126,7 +126,7 @@ public: void testTdf90003(); void testTdf51741(); void testDefaultsOfOutlineNumbering(); - void testdelofTableRedlines(); + void testDeleteTableRedlines(); void testXFlatParagraph(); void testTdf81995(); void testExportToPicture(); @@ -199,7 +199,7 @@ public: CPPUNIT_TEST(testTdf90003); CPPUNIT_TEST(testTdf51741); CPPUNIT_TEST(testDefaultsOfOutlineNumbering); - CPPUNIT_TEST(testdelofTableRedlines); + CPPUNIT_TEST(testDeleteTableRedlines); CPPUNIT_TEST(testXFlatParagraph); CPPUNIT_TEST(testTdf81995); CPPUNIT_TEST(testExportToPicture); @@ -357,11 +357,11 @@ void SwUiWriterTest::testFdo70807() { load(DATA_DIRECTORY, "fdo70807.odt"); - uno::Reference<container::XIndexAccess> stylesIter(getStyles("PageStyles"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xStylesIter(getStyles("PageStyles"), uno::UNO_QUERY); - for (sal_Int32 i = 0; i < stylesIter->getCount(); ++i) + for (sal_Int32 i = 0; i < xStylesIter->getCount(); ++i) { - uno::Reference<style::XStyle> xStyle(stylesIter->getByIndex(i), uno::UNO_QUERY); + uno::Reference<style::XStyle> xStyle(xStylesIter->getByIndex(i), uno::UNO_QUERY); uno::Reference<container::XNamed> xName(xStyle, uno::UNO_QUERY); bool expectedUsedStyle = false; @@ -636,7 +636,6 @@ void SwUiWriterTest::testChineseConversionBlank() true, false, false ); aWrap.Convert(); - // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); CPPUNIT_ASSERT_EQUAL(OUString(), pTextNode->GetText()); @@ -655,14 +654,12 @@ void SwUiWriterTest::testChineseConversionNonChineseText() SwPaM aPaM(aIdx); pDoc->getIDocumentContentOperations().InsertString(aPaM, NON_CHINESE_CONTENT); - // When SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_TRADITIONAL, LANGUAGE_CHINESE_SIMPLIFIED, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, false, true, false, false ); aWrap.Convert(); - // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); CPPUNIT_ASSERT_EQUAL(NON_CHINESE_CONTENT, pTextNode->GetText()); @@ -681,14 +678,12 @@ void SwUiWriterTest::testChineseConversionTraditionalToSimplified() SwPaM aPaM(aIdx); pDoc->getIDocumentContentOperations().InsertString(aPaM, CHINESE_TRADITIONAL_CONTENT); - // When SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_TRADITIONAL, LANGUAGE_CHINESE_SIMPLIFIED, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, false, true, false, false ); aWrap.Convert(); - // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); CPPUNIT_ASSERT_EQUAL(CHINESE_SIMPLIFIED_CONTENT, pTextNode->GetText()); @@ -707,14 +702,12 @@ void SwUiWriterTest::testChineseConversionSimplifiedToTraditional() SwPaM aPaM(aIdx); pDoc->getIDocumentContentOperations().InsertString(aPaM, CHINESE_SIMPLIFIED_CONTENT); - // When SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_TRADITIONAL, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, false, true, false, false ); aWrap.Convert(); - // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); CPPUNIT_ASSERT_EQUAL(CHINESE_TRADITIONAL_CONTENT, pTextNode->GetText()); @@ -1083,23 +1076,23 @@ void SwUiWriterTest::testDefaultsOfOutlineNumbering() } } -void SwUiWriterTest::testdelofTableRedlines() +void SwUiWriterTest::testDeleteTableRedlines() { SwDoc* pDoc = createDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0); - const SwTable& tbl = pWrtShell->InsertTable(TableOpt, 1, 3); + const SwTable& rTbl = pWrtShell->InsertTable(TableOpt, 1, 3); uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount()); uno::Sequence<beans::PropertyValue> aDescriptor; - SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(tbl.GetTableBox(OUString("A1")))), OUString("TableCellInsert"), aDescriptor); - SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(tbl.GetTableBox(OUString("B1")))), OUString("TableCellInsert"), aDescriptor); - SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(tbl.GetTableBox(OUString("C1")))), OUString("TableCellInsert"), aDescriptor); - IDocumentRedlineAccess& pDocRed = pDoc->getIDocumentRedlineAccess(); - SwExtraRedlineTable& redtbl = pDocRed.GetExtraRedlineTable(); - redtbl.DeleteAllTableRedlines(pDoc, tbl, false, sal_uInt16(USHRT_MAX)); - CPPUNIT_ASSERT(redtbl.IsEmpty()); + SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(rTbl.GetTableBox(OUString("A1")))), OUString("TableCellInsert"), aDescriptor); + SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(rTbl.GetTableBox(OUString("B1")))), OUString("TableCellInsert"), aDescriptor); + SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(rTbl.GetTableBox(OUString("C1")))), OUString("TableCellInsert"), aDescriptor); + IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess(); + SwExtraRedlineTable& rExtras = rIDRA.GetExtraRedlineTable(); + rExtras.DeleteAllTableRedlines(pDoc, rTbl, false, sal_uInt16(USHRT_MAX)); + CPPUNIT_ASSERT(rExtras.IsEmpty()); } void SwUiWriterTest::testXFlatParagraph() @@ -1236,10 +1229,10 @@ void SwUiWriterTest::testTdf79236() sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); //Getting some paragraph style SwTextFormatColl* pTextFormat = pDoc->FindTextFormatCollByName(OUString("Text Body")); - const SwAttrSet& attrSet = pTextFormat->GetAttrSet(); - SfxItemSet* itemSet = attrSet.Clone(); - sal_uInt16 initialCount = itemSet->Count(); - SvxAdjustItem AdjustItem = attrSet.GetAdjust(); + const SwAttrSet& rAttrSet = pTextFormat->GetAttrSet(); + SfxItemSet* pNewSet = rAttrSet.Clone(); + sal_uInt16 initialCount = pNewSet->Count(); + SvxAdjustItem AdjustItem = rAttrSet.GetAdjust(); SvxAdjust initialAdjust = AdjustItem.GetAdjust(); //By default the adjust is LEFT CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_LEFT, initialAdjust); @@ -1249,41 +1242,41 @@ void SwUiWriterTest::testTdf79236() SvxAdjust modifiedAdjust = AdjustItem.GetAdjust(); CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_RIGHT, modifiedAdjust); //Modifying the itemset, putting *one* item - itemSet->Put(AdjustItem); + pNewSet->Put(AdjustItem); //The count should increment by 1 - sal_uInt16 modifiedCount = itemSet->Count(); + sal_uInt16 modifiedCount = pNewSet->Count(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(initialCount + 1), modifiedCount); //Setting the updated item set on the style - pDoc->ChgFormat(*pTextFormat, *itemSet); + pDoc->ChgFormat(*pTextFormat, *pNewSet); //Checking the Changes SwTextFormatColl* pTextFormat2 = pDoc->FindTextFormatCollByName(OUString("Text Body")); - const SwAttrSet& attrSet2 = pTextFormat2->GetAttrSet(); - const SvxAdjustItem& AdjustItem2 = attrSet2.GetAdjust(); - SvxAdjust Adjust2 = AdjustItem2.GetAdjust(); + const SwAttrSet& rAttrSet2 = pTextFormat2->GetAttrSet(); + const SvxAdjustItem& rAdjustItem2 = rAttrSet2.GetAdjust(); + SvxAdjust Adjust2 = rAdjustItem2.GetAdjust(); //The adjust should be RIGHT as per the modifications made CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_RIGHT, Adjust2); //Undo the changes rUndoManager.Undo(); SwTextFormatColl* pTextFormat3 = pDoc->FindTextFormatCollByName(OUString("Text Body")); - const SwAttrSet& attrSet3 = pTextFormat3->GetAttrSet(); - const SvxAdjustItem& AdjustItem3 = attrSet3.GetAdjust(); - SvxAdjust Adjust3 = AdjustItem3.GetAdjust(); + const SwAttrSet& rAttrSet3 = pTextFormat3->GetAttrSet(); + const SvxAdjustItem& rAdjustItem3 = rAttrSet3.GetAdjust(); + SvxAdjust Adjust3 = rAdjustItem3.GetAdjust(); //The adjust should be back to default, LEFT CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_LEFT, Adjust3); //Redo the changes rUndoManager.Redo(); SwTextFormatColl* pTextFormat4 = pDoc->FindTextFormatCollByName(OUString("Text Body")); - const SwAttrSet& attrSet4 = pTextFormat4->GetAttrSet(); - const SvxAdjustItem& AdjustItem4 = attrSet4.GetAdjust(); - SvxAdjust Adjust4 = AdjustItem4.GetAdjust(); + const SwAttrSet& rAttrSet4 = pTextFormat4->GetAttrSet(); + const SvxAdjustItem& rAdjustItem4 = rAttrSet4.GetAdjust(); + SvxAdjust Adjust4 = rAdjustItem4.GetAdjust(); //The adjust should be RIGHT as per the modifications made CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_RIGHT, Adjust4); //Undo the changes rUndoManager.Undo(); SwTextFormatColl* pTextFormat5 = pDoc->FindTextFormatCollByName(OUString("Text Body")); - const SwAttrSet& attrSet5 = pTextFormat5->GetAttrSet(); - const SvxAdjustItem& AdjustItem5 = attrSet5.GetAdjust(); - SvxAdjust Adjust5 = AdjustItem5.GetAdjust(); + const SwAttrSet& rAttrSet5 = pTextFormat5->GetAttrSet(); + const SvxAdjustItem& rAdjustItem5 = rAttrSet5.GetAdjust(); + SvxAdjust Adjust5 = rAdjustItem5.GetAdjust(); //The adjust should be back to default, LEFT CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_LEFT, Adjust5); } @@ -1380,51 +1373,51 @@ void SwUiWriterTest::testTdf69282() SwPageDesc* tPageDesc = target->MakePageDesc(OUString("TargetStyle")); sPageDesc->ChgFirstShare(false); CPPUNIT_ASSERT(!sPageDesc->IsFirstShared()); - SwFrameFormat& sMasterFormat = sPageDesc->GetMaster(); + SwFrameFormat& rSourceMasterFormat = sPageDesc->GetMaster(); //Setting horizontal spaces on master SvxLRSpaceItem horizontalSpace(RES_LR_SPACE); horizontalSpace.SetLeft(11); horizontalSpace.SetRight(12); - sMasterFormat.SetFormatAttr(horizontalSpace); + rSourceMasterFormat.SetFormatAttr(horizontalSpace); //Setting vertical spaces on master SvxULSpaceItem verticalSpace(RES_UL_SPACE); verticalSpace.SetUpper(13); verticalSpace.SetLower(14); - sMasterFormat.SetFormatAttr(verticalSpace); + rSourceMasterFormat.SetFormatAttr(verticalSpace); //Changing the style and copying it to target source->ChgPageDesc(OUString("SourceStyle"), *sPageDesc); target->CopyPageDesc(*sPageDesc, *tPageDesc); //Checking the set values on all Formats in target - SwFrameFormat& tMasterFormat = tPageDesc->GetMaster(); - SwFrameFormat& tLeftFormat = tPageDesc->GetLeft(); - SwFrameFormat& tFirstMasterFormat = tPageDesc->GetFirstMaster(); - SwFrameFormat& tFirstLeftFormat = tPageDesc->GetFirstLeft(); + SwFrameFormat& rTargetMasterFormat = tPageDesc->GetMaster(); + SwFrameFormat& rTargetLeftFormat = tPageDesc->GetLeft(); + SwFrameFormat& rTargetFirstMasterFormat = tPageDesc->GetFirstMaster(); + SwFrameFormat& rTargetFirstLeftFormat = tPageDesc->GetFirstLeft(); //Checking horizontal spaces - const SvxLRSpaceItem hMasterFormatSpace = tMasterFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hMasterFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hMasterFormatSpace.GetRight()); - const SvxLRSpaceItem hLeftFormatSpace = tLeftFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hLeftFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hLeftFormatSpace.GetRight()); - const SvxLRSpaceItem hFirstMasterFormatSpace = tFirstMasterFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstMasterFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstMasterFormatSpace.GetRight()); - const SvxLRSpaceItem hFirstLeftFormatSpace = tFirstLeftFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstLeftFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstLeftFormatSpace.GetRight()); + const SvxLRSpaceItem MasterLRSpace = rTargetMasterFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), MasterLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), MasterLRSpace.GetRight()); + const SvxLRSpaceItem LeftLRSpace = rTargetLeftFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), LeftLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), LeftLRSpace.GetRight()); + const SvxLRSpaceItem FirstMasterLRSpace = rTargetFirstMasterFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstMasterLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstMasterLRSpace.GetRight()); + const SvxLRSpaceItem FirstLeftLRSpace = rTargetFirstLeftFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstLeftLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstLeftLRSpace.GetRight()); //Checking vertical spaces - const SvxULSpaceItem vMasterFormatSpace = tMasterFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vMasterFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vMasterFormatSpace.GetLower()); - const SvxULSpaceItem vLeftFormatSpace = tLeftFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vLeftFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vLeftFormatSpace.GetLower()); - const SvxULSpaceItem vFirstMasterFormatSpace = tFirstMasterFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstMasterFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstMasterFormatSpace.GetLower()); - const SvxULSpaceItem vFirstLeftFormatSpace = tFirstLeftFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstLeftFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstLeftFormatSpace.GetLower()); + const SvxULSpaceItem MasterULSpace = rTargetMasterFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), MasterULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), MasterULSpace.GetLower()); + const SvxULSpaceItem LeftULSpace = rTargetLeftFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), LeftULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), LeftULSpace.GetLower()); + const SvxULSpaceItem FirstMasterULSpace = rTargetFirstMasterFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), FirstMasterULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), FirstMasterULSpace.GetLower()); + const SvxULSpaceItem FirstLeftULSpace = rTargetFirstLeftFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), FirstLeftULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), FirstLeftULSpace.GetLower()); xSourceDoc->dispose(); } @@ -1441,53 +1434,53 @@ void SwUiWriterTest::testTdf69282WithMirror() SwPageDesc* tPageDesc = target->MakePageDesc(OUString("TargetStyle")); //Enabling Mirror sPageDesc->SetUseOn(nsUseOnPage::PD_MIRROR); - SwFrameFormat& sMasterFormat = sPageDesc->GetMaster(); + SwFrameFormat& rSourceMasterFormat = sPageDesc->GetMaster(); //Setting horizontal spaces on master SvxLRSpaceItem horizontalSpace(RES_LR_SPACE); horizontalSpace.SetLeft(11); horizontalSpace.SetRight(12); - sMasterFormat.SetFormatAttr(horizontalSpace); + rSourceMasterFormat.SetFormatAttr(horizontalSpace); //Setting vertical spaces on master SvxULSpaceItem verticalSpace(RES_UL_SPACE); verticalSpace.SetUpper(13); verticalSpace.SetLower(14); - sMasterFormat.SetFormatAttr(verticalSpace); + rSourceMasterFormat.SetFormatAttr(verticalSpace); //Changing the style and copying it to target source->ChgPageDesc(OUString("SourceStyle"), *sPageDesc); target->CopyPageDesc(*sPageDesc, *tPageDesc); //Checking the set values on all Formats in target - SwFrameFormat& tMasterFormat = tPageDesc->GetMaster(); - SwFrameFormat& tLeftFormat = tPageDesc->GetLeft(); - SwFrameFormat& tFirstMasterFormat = tPageDesc->GetFirstMaster(); - SwFrameFormat& tFirstLeftFormat = tPageDesc->GetFirstLeft(); + SwFrameFormat& rTargetMasterFormat = tPageDesc->GetMaster(); + SwFrameFormat& rTargetLeftFormat = tPageDesc->GetLeft(); + SwFrameFormat& rTargetFirstMasterFormat = tPageDesc->GetFirstMaster(); + SwFrameFormat& rTargetFirstLeftFormat = tPageDesc->GetFirstLeft(); //Checking horizontal spaces - const SvxLRSpaceItem hMasterFormatSpace = tMasterFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hMasterFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hMasterFormatSpace.GetRight()); + const SvxLRSpaceItem MasterLRSpace = rTargetMasterFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), MasterLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), MasterLRSpace.GetRight()); //mirror effect should be present - const SvxLRSpaceItem hLeftFormatSpace = tLeftFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hLeftFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hLeftFormatSpace.GetRight()); - const SvxLRSpaceItem hFirstMasterFormatSpace = tFirstMasterFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstMasterFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstMasterFormatSpace.GetRight()); + const SvxLRSpaceItem LeftLRSpace = rTargetLeftFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), LeftLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), LeftLRSpace.GetRight()); + const SvxLRSpaceItem FirstMasterLRSpace = rTargetFirstMasterFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstMasterLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstMasterLRSpace.GetRight()); //mirror effect should be present - const SvxLRSpaceItem hFirstLeftFormatSpace = tFirstLeftFormat.GetLRSpace(); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstLeftFormatSpace.GetLeft()); - CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstLeftFormatSpace.GetRight()); + const SvxLRSpaceItem FirstLeftLRSpace = rTargetFirstLeftFormat.GetLRSpace(); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), FirstLeftLRSpace.GetLeft()); + CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), FirstLeftLRSpace.GetRight()); //Checking vertical spaces - const SvxULSpaceItem vMasterFormatSpace = tMasterFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vMasterFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vMasterFormatSpace.GetLower()); - const SvxULSpaceItem vLeftFormatSpace = tLeftFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vLeftFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vLeftFormatSpace.GetLower()); - const SvxULSpaceItem vFirstMasterFormatSpace = tFirstMasterFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstMasterFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstMasterFormatSpace.GetLower()); - const SvxULSpaceItem vFirstLeftFormatSpace = tFirstLeftFormat.GetULSpace(); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstLeftFormatSpace.GetUpper()); - CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstLeftFormatSpace.GetLower()); + const SvxULSpaceItem MasterULSpace = rTargetMasterFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), MasterULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), MasterULSpace.GetLower()); + const SvxULSpaceItem LeftULSpace = rTargetLeftFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), LeftULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), LeftULSpace.GetLower()); + const SvxULSpaceItem FirstMasterULSpace = rTargetFirstMasterFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), FirstMasterULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), FirstMasterULSpace.GetLower()); + const SvxULSpaceItem FirstLeftULSpace = rTargetFirstLeftFormat.GetULSpace(); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), FirstLeftULSpace.GetUpper()); + CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), FirstLeftULSpace.GetLower()); xSourceDoc->dispose(); } @@ -1566,45 +1559,45 @@ void SwUiWriterTest::testTdf60967() SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0); pWrtShell->InsertTable(TableOpt, 2, 2); //getting the cursor's position just after the table insert - SwPosition xPosAfterTable(*(pCrsr->GetPoint())); + SwPosition aPosAfterTable(*(pCrsr->GetPoint())); //moving cursor to B2 (bottom right cell) pCrsr->Move(fnMoveBackward); - SwPosition xPosInTable(*(pCrsr->GetPoint())); + SwPosition aPosInTable(*(pCrsr->GetPoint())); //deleting paragraph following table with Ctrl+Shift+Del sal_Int32 val = pWrtShell->DelToEndOfSentence(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), val); //getting the cursor's position just after the paragraph deletion - SwPosition xPosAfterDel(*(pCrsr->GetPoint())); + SwPosition aPosAfterDel(*(pCrsr->GetPoint())); //moving cursor forward to check whether there is any node following the table, BTW there should not be any such node pCrsr->Move(fnMoveForward); - SwPosition xPosMoveAfterDel(*(pCrsr->GetPoint())); + SwPosition aPosMoveAfterDel(*(pCrsr->GetPoint())); //checking the positons to verify that the paragraph is actually deleted - CPPUNIT_ASSERT(xPosInTable==xPosAfterDel); - CPPUNIT_ASSERT(xPosInTable==xPosMoveAfterDel); + CPPUNIT_ASSERT(aPosInTable == aPosAfterDel); + CPPUNIT_ASSERT(aPosInTable == aPosMoveAfterDel); //Undo the changes rUndoManager.Undo(); { //paragraph *text node* should be back - SwPosition xPosAfterUndo(*(pCrsr->GetPoint())); - //after undo xPosAfterTable increases the node position by one, since this contains the position *text node* so xPosAfterUndo should be less than xPosAfterTable - CPPUNIT_ASSERT(xPosAfterTable>xPosAfterUndo); + SwPosition aPosAfterUndo(*(pCrsr->GetPoint())); + //after undo aPosAfterTable increases the node position by one, since this contains the position *text node* so aPosAfterUndo should be less than aPosAfterTable + CPPUNIT_ASSERT(aPosAfterTable > aPosAfterUndo); //moving cursor forward to check whether there is any node following the paragraph, BTW there should not be any such node as paragraph node is the last one in header pCrsr->Move(fnMoveForward); - SwPosition xPosMoveAfterUndo(*(pCrsr->GetPoint())); + SwPosition aPosMoveAfterUndo(*(pCrsr->GetPoint())); //checking positions to verify that paragraph node is the last one and we are paragraph node only - CPPUNIT_ASSERT(xPosAfterTable>xPosMoveAfterUndo); - CPPUNIT_ASSERT(xPosMoveAfterUndo==xPosAfterUndo); + CPPUNIT_ASSERT(aPosAfterTable > aPosMoveAfterUndo); + CPPUNIT_ASSERT(aPosMoveAfterUndo == aPosAfterUndo); } //Redo the changes rUndoManager.Redo(); //paragraph *text node* should not be there - SwPosition xPosAfterRedo(*(pCrsr->GetPoint())); + SwPosition aPosAfterRedo(*(pCrsr->GetPoint())); //position should be exactly same as it was after deletion of *text node* - CPPUNIT_ASSERT(xPosMoveAfterDel==xPosAfterRedo); + CPPUNIT_ASSERT(aPosMoveAfterDel == aPosAfterRedo); //moving the cursor forward, but it should not actually move as there is no *text node* after the table due to this same postion is expected after move as it was before move pCrsr->Move(fnMoveForward); - SwPosition xPosAfterUndoMove(*(pCrsr->GetPoint())); - CPPUNIT_ASSERT(xPosAfterUndoMove==xPosAfterRedo); + SwPosition aPosAfterUndoMove(*(pCrsr->GetPoint())); + CPPUNIT_ASSERT(aPosAfterUndoMove == aPosAfterRedo); } void SwUiWriterTest::testSearchWithTransliterate() @@ -1653,23 +1646,23 @@ void SwUiWriterTest::testTdf77342() //moving cursor to the starting of document pWrtShell->SttDoc(); //inserting refernce field 1 - SwGetRefField xField1(pRefType, OUString(""), REF_FOOTNOTE, sal_uInt16(0), REF_CONTENT); - pWrtShell->Insert(xField1); + SwGetRefField aField1(pRefType, OUString(""), REF_FOOTNOTE, sal_uInt16(0), REF_CONTENT); + pWrtShell->Insert(aField1); //inserting second footnote pWrtShell->InsertFootnote(OUString("")); pWrtShell->SttDoc(); pCrsr->Move(fnMoveForward); //inserting refernce field 2 - SwGetRefField xField2(pRefType, OUString(""), REF_FOOTNOTE, sal_uInt16(1), REF_CONTENT); - pWrtShell->Insert(xField2); + SwGetRefField aField2(pRefType, OUString(""), REF_FOOTNOTE, sal_uInt16(1), REF_CONTENT); + pWrtShell->Insert(aField2); //inserting third footnote pWrtShell->InsertFootnote(OUString("")); pWrtShell->SttDoc(); pCrsr->Move(fnMoveForward); pCrsr->Move(fnMoveForward); //inserting refernce field 3 - SwGetRefField xField3(pRefType, OUString(""), REF_FOOTNOTE, sal_uInt16(2), REF_CONTENT); - pWrtShell->Insert(xField3); + SwGetRefField aField3(pRefType, OUString(""), REF_FOOTNOTE, sal_uInt16(2), REF_CONTENT); + pWrtShell->Insert(aField3); //updating the fields IDocumentFieldsAccess& rField(pDoc->getIDocumentFieldsAccess()); rField.UpdateExpFields(nullptr, true); @@ -2098,38 +2091,38 @@ void SwUiWriterTest::testTdf90808() xText->setString(OUString("Hello World!")); uno::Reference<lang::XMultiServiceFactory> xFact(mxComponent, uno::UNO_QUERY); //creating bookmark 1 - uno::Reference<text::XTextContent> type1bookmark1(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); - uno::Reference<container::XNamed> xName1(type1bookmark1, uno::UNO_QUERY); - xName1->setName("__RefHeading__1"); + uno::Reference<text::XTextContent> xHeadingBookmark1(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); + uno::Reference<container::XNamed> xHeadingName1(xHeadingBookmark1, uno::UNO_QUERY); + xHeadingName1->setName("__RefHeading__1"); //moving cursor to the starting of paragraph xCrsr->gotoStartOfParagraph(false); //inserting the bookmark in paragraph - xText->insertTextContent(xCrsr, type1bookmark1, true); + xText->insertTextContent(xCrsr, xHeadingBookmark1, true); //creating bookmark 2 - uno::Reference<text::XTextContent> type1bookmark2(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); - uno::Reference<container::XNamed> xName2(type1bookmark2, uno::UNO_QUERY); - xName2->setName("__RefHeading__2"); + uno::Reference<text::XTextContent> xHeadingBookmark2(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); + uno::Reference<container::XNamed> xHeadingName2(xHeadingBookmark2, uno::UNO_QUERY); + xHeadingName2->setName("__RefHeading__2"); //inserting the bookmark in same paragraph, at the end //only one bookmark of this type is allowed in each paragraph an exception of com.sun.star.lang.IllegalArgumentException must be thrown when inserting the other bookmark in same paragraph xCrsr->gotoEndOfParagraph(true); - CPPUNIT_ASSERT_THROW(xText->insertTextContent(xCrsr, type1bookmark2, true), com::sun::star::lang::IllegalArgumentException); + CPPUNIT_ASSERT_THROW(xText->insertTextContent(xCrsr, xHeadingBookmark2, true), com::sun::star::lang::IllegalArgumentException); //now testing for __RefNumPara__ //creating bookmark 1 - uno::Reference<text::XTextContent> type2bookmark1(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); - uno::Reference<container::XNamed> xName3(type2bookmark1, uno::UNO_QUERY); - xName3->setName("__RefNumPara__1"); + uno::Reference<text::XTextContent> xNumBookmark1(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); + uno::Reference<container::XNamed> xNumName1(xNumBookmark1, uno::UNO_QUERY); + xNumName1->setName("__RefNumPara__1"); //moving cursor to the starting of paragraph xCrsr->gotoStartOfParagraph(false); //inserting the bookmark in paragraph - xText->insertTextContent(xCrsr, type2bookmark1, true); + xText->insertTextContent(xCrsr, xNumBookmark1, true); //creating bookmark 2 - uno::Reference<text::XTextContent> type2bookmark2(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); - uno::Reference<container::XNamed> xName4(type2bookmark2, uno::UNO_QUERY); - xName4->setName("__RefNumPara__2"); + uno::Reference<text::XTextContent> xNumBookmark2(xFact->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); + uno::Reference<container::XNamed> xNumName2(xNumBookmark2, uno::UNO_QUERY); + xNumName2->setName("__RefNumPara__2"); //inserting the bookmark in same paragraph, at the end //only one bookmark of this type is allowed in each paragraph an exception of com.sun.star.lang.IllegalArgumentException must be thrown when inserting the other bookmark in same paragraph xCrsr->gotoEndOfParagraph(true); - CPPUNIT_ASSERT_THROW(xText->insertTextContent(xCrsr, type2bookmark2, true), com::sun::star::lang::IllegalArgumentException); + CPPUNIT_ASSERT_THROW(xText->insertTextContent(xCrsr, xNumBookmark2, true), com::sun::star::lang::IllegalArgumentException); } void SwUiWriterTest::testTdf75137() @@ -2251,7 +2244,7 @@ void SwUiWriterTest::testTableBackgroundColor() pWrtShell->SetBoxBackground(SvxBrushItem(colour, sal_Int16(RES_BACKGROUND))); //Checking cells for background color only A1 should be modified uno::Reference<table::XCell> xCell; - xCell = xTable->getCellByName("A1"); + xCell = xTable->getCellByName("A1"); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFF00FF), getProperty<sal_Int32>(xCell, "BackColor")); xCell = xTable->getCellByName("A2"); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor")); @@ -2342,17 +2335,16 @@ void SwUiWriterTest::testUndoCharAttribute() SfxItemSet aSet( pDoc->GetAttrPool(), RES_CHRATR_WEIGHT, RES_CHRATR_WEIGHT); // Adds selected text's attributes to aSet pCrsr->GetNode().GetTextNode()->GetAttr(aSet, 10, 19); - SfxPoolItem const * aPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); - SfxPoolItem& ampPoolItem = aWeightItem; + SfxPoolItem const * pPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); // Check that bold is active on the selection; checks if it's in aSet - CPPUNIT_ASSERT_EQUAL((*aPoolItem == ampPoolItem), true); + CPPUNIT_ASSERT_EQUAL((*pPoolItem == aWeightItem), true); // Invoke Undo rUndoManager.Undo(); // Check that bold is no longer active aSet.ClearItem(RES_CHRATR_WEIGHT); pCrsr->GetNode().GetTextNode()->GetAttr(aSet, 10, 19); - aPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); - CPPUNIT_ASSERT_EQUAL((*aPoolItem == ampPoolItem), false); + pPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); + CPPUNIT_ASSERT_EQUAL((*pPoolItem == aWeightItem), false); } void SwUiWriterTest::testTdf86639() @@ -2434,12 +2426,12 @@ void SwUiWriterTest::testUnoCursorPointer() dynamic_cast<SwXTextDocument *>(xDocComponent.get())); CPPUNIT_ASSERT(pxDocDocument); SwDoc* const pDoc(pxDocDocument->GetDocShell()->GetDoc()); - std::unique_ptr<SwNodeIndex> xIdx(new SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1)); - std::unique_ptr<SwPosition> xPos(new SwPosition(*xIdx)); - sw::UnoCursorPointer pCursor(pDoc->CreateUnoCrsr(*xPos)); + std::unique_ptr<SwNodeIndex> pIdx(new SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1)); + std::unique_ptr<SwPosition> pPos(new SwPosition(*pIdx)); + sw::UnoCursorPointer pCursor(pDoc->CreateUnoCrsr(*pPos)); CPPUNIT_ASSERT(static_cast<bool>(pCursor)); - xPos.reset(); // we need to kill the SwPosition before disposing - xIdx.reset(); // we need to kill the SwNodeIndex before disposing + pPos.reset(); // we need to kill the SwPosition before disposing + pIdx.reset(); // we need to kill the SwNodeIndex before disposing xDocComponent->dispose(); CPPUNIT_ASSERT(!static_cast<bool>(pCursor)); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits