[Libreoffice-commits] .: 4 commits - oox/inc oox/source sw/CppunitTest_sw_subsequent_ww8export.mk sw/qa sw/source test/inc test/Library_test.mk test/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Aug 1 01:57:13 PDT 2012


 oox/inc/oox/ole/axcontrol.hxx             |    3 ++-
 oox/source/ole/axcontrol.cxx              |   13 +++++++++----
 sw/CppunitTest_sw_subsequent_ww8export.mk |    1 +
 sw/qa/extras/ww8export/data/fdo45724.odt  |binary
 sw/qa/extras/ww8export/ww8export.cxx      |   15 +++++++++++++++
 sw/source/filter/ww8/wrtw8esh.cxx         |    2 ++
 test/Library_test.mk                      |    1 +
 test/inc/test/bootstrapfixture.hxx        |    3 +++
 test/source/bootstrapfixture.cxx          |    9 +++++++++
 9 files changed, 42 insertions(+), 5 deletions(-)

New commits:
commit a69691ff8c1cfeca6b67973000d17fa01947a0a5
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jul 31 13:04:10 2012 +0200

    fdo#45724 testcase
    
    Change-Id: I27811a6e35cd07dd117831eb9dee177c54f9ff50

diff --git a/sw/CppunitTest_sw_subsequent_ww8export.mk b/sw/CppunitTest_sw_subsequent_ww8export.mk
index 8c051e3..e01da9b 100644
--- a/sw/CppunitTest_sw_subsequent_ww8export.mk
+++ b/sw/CppunitTest_sw_subsequent_ww8export.mk
@@ -85,6 +85,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ww8export,\
     i18npool/util/i18npool \
     package/source/xstor/xstor \
     package/util/package2 \
+    sax/source/expatwrap/expwrap \
     sw/util/msword \
     sw/util/sw \
     sw/util/swd \
diff --git a/sw/qa/extras/ww8export/data/fdo45724.odt b/sw/qa/extras/ww8export/data/fdo45724.odt
new file mode 100644
index 0000000..45c6d9a
Binary files /dev/null and b/sw/qa/extras/ww8export/data/fdo45724.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 4bf4a57..58692a6 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -27,7 +27,9 @@
 
 #include "../swmodeltestbase.hxx"
 
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
@@ -39,10 +41,12 @@ class Test : public SwModelTestBase
 {
 public:
     void testN325936();
+    void testFdo45724();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
     CPPUNIT_TEST(testN325936);
+    CPPUNIT_TEST(testFdo45724);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -80,6 +84,17 @@ void Test::testN325936()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue);
 }
 
+void Test::testFdo45724()
+{
+    roundtrip("fdo45724.odt");
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    uno::Reference<drawing::XControlShape> xControlShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<form::validation::XValidatableFormComponent> xComponent(xControlShape->getControl(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<sal_uInt32>(xComponent, "BackgroundColor"));
+    CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit f5a98e08e7f12453c469b277554b0e45f0c2310f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Aug 1 10:05:05 2012 +0200

    test::BootstrapFixture: make GraphicConverter work
    
    Change-Id: I566448db441eaa324cf619630a2e87cb8cbaeb99

diff --git a/test/Library_test.mk b/test/Library_test.mk
index d641b9c..48ca6b0 100644
--- a/test/Library_test.mk
+++ b/test/Library_test.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_libraries,test,\
     cppuhelper \
 	i18nisolang1 \
     sal \
+    svt \
 	tl \
 	utl \
 	ucbhelper \
diff --git a/test/inc/test/bootstrapfixture.hxx b/test/inc/test/bootstrapfixture.hxx
index feabafb..4896d8a 100644
--- a/test/inc/test/bootstrapfixture.hxx
+++ b/test/inc/test/bootstrapfixture.hxx
@@ -31,6 +31,8 @@
 #include <sal/config.h>
 
 #include <rtl/string.hxx>
+#include <tools/link.hxx>
+#include <vcl/salctype.hxx>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -55,6 +57,7 @@ class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
 {
   bool m_bNeedUCB;
   bool m_bAssertOnDialog;
+  DECL_LINK( ImplInitFilterHdl, ConvertData* );
 
 public:
   BootstrapFixture( bool bAssertOnDialog = true, bool bNeedUCB = true );
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index edb7b63..86e2acb 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -41,6 +41,7 @@
 
 #include <vcl/svapp.hxx>
 #include <tools/resmgr.hxx>
+#include <svtools/filter.hxx>
 #include <unotools/syslocaleoptions.hxx>
 
 using namespace ::com::sun::star;
@@ -103,6 +104,9 @@ void test::BootstrapFixture::setUp()
 
     if( m_bAssertOnDialog )
         ErrorHandler::RegisterDisplay( aBasicErrorFunc );
+
+    // Make GraphicConverter work, normally done in desktop::Desktop::Main()
+    Application::SetFilterHdl( LINK( this, test::BootstrapFixture, ImplInitFilterHdl ) );
 }
 
 void test::BootstrapFixture::tearDown()
@@ -115,4 +119,9 @@ test::BootstrapFixture::~BootstrapFixture()
 {
 }
 
+IMPL_LINK( test::BootstrapFixture, ImplInitFilterHdl, ConvertData*, pData )
+{
+    return GraphicFilter::GetGraphicFilter().GetFilterCallback().Call( pData );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 12a35ec8905559a5f2e0e00f792489bbcf0095db
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jul 31 12:33:41 2012 +0200

    fdo#45724 improve WW8 textbox export
    
    If there is no default value, but there is a current one, export that
    instead.
    
    Change-Id: I01af5cfa641b061b0aeb959e579bca66340781e9

diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 30aee56..d776893 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1709,6 +1709,9 @@ void AxTextBoxModel::convertFromProperties( PropertySet& rPropSet, const Control
     if ( rPropSet.getProperty( bRes,  PROP_HideInactiveSelection ) )
         setFlag( mnFlags, AX_FLAGS_HIDESELECTION, bRes );
     rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
+    if (maValue.isEmpty() && !mbAwtModel)
+        // No default value? Then try exporting the current one.
+        rPropSet.getProperty( maValue, PROP_Text);
     sal_Int16 nTmp(0);
     if ( rPropSet.getProperty( nTmp, PROP_MaxTextLen ) )
         mnMaxLength = nTmp;
commit 684539e19ef7a54afcb2c4f24ba966ec04a2ad87
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jul 31 11:18:31 2012 +0200

    fdo#45724 fix WW8 export of textbox default background color
    
    regression from 5609c512cd4d2899300b432d88d93cff05a05c87
    
    Change-Id: I5f3ce73943b2805b7de1ae41699e605af9086b15

diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx
index da042b9..4c453c3 100644
--- a/oox/inc/oox/ole/axcontrol.hxx
+++ b/oox/inc/oox/ole/axcontrol.hxx
@@ -219,7 +219,8 @@ public:
     void                convertToMSColor(
                             PropertySet& rPropSet,
                             sal_Int32 nPropId,
-                            sal_uInt32& nOleColor ) const;
+                            sal_uInt32& nOleColor,
+                            sal_uInt32 nDefault = 0 ) const;
 
 
     /** Converts the passed StdPic picture stream to UNO properties. */
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 4e113af..30aee56 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -273,11 +273,13 @@ void ControlConverter::convertColor( PropertyMap& rPropMap, sal_Int32 nPropId, s
     rPropMap.setProperty( nPropId, OleHelper::decodeOleColor( mrGraphicHelper, nOleColor, mbDefaultColorBgr ) );
 }
 
-void ControlConverter::convertToMSColor( PropertySet& rPropSet, sal_Int32 nPropId, sal_uInt32& nOleColor ) const
+void ControlConverter::convertToMSColor( PropertySet& rPropSet, sal_Int32 nPropId, sal_uInt32& nOleColor, sal_uInt32 nDefault ) const
 {
     sal_uInt32 nRGB = 0;
-    rPropSet.getProperty( nRGB, nPropId );
-    nOleColor = OleHelper::encodeOleColor( nRGB );
+    if (rPropSet.getProperty( nRGB, nPropId ))
+        nOleColor = OleHelper::encodeOleColor( nRGB );
+    else
+        nOleColor = nDefault;
 }
 void ControlConverter::convertPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData ) const
 {
@@ -1717,7 +1719,7 @@ void AxTextBoxModel::convertFromProperties( PropertySet& rPropSet, const Control
     if ( rPropSet.getProperty( bRes,  PROP_VScroll ) )
         setFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL, bRes );
 
-    rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+    rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor, 0x80000005L );
 
     rConv.convertToAxBorder( rPropSet, mnBorderColor, mnBorderStyle, mnSpecialEffect );
     AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 1c46ce1..e1061c0 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1648,6 +1648,8 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush,
 bool lcl_isInHeader(const SwFrmFmt& rFmt)
 {
     const SwFlyFrmFmt* pFlyFrmFmt = dynamic_cast<const SwFlyFrmFmt*>(&rFmt);
+    if (!pFlyFrmFmt)
+        return false;
     SwFlyFrm* pFlyFrm = const_cast<SwFlyFrm*>(pFlyFrmFmt->GetFrm());
     SwPageFrm* pPageFrm = pFlyFrm->FindPageFrmOfAnchor();
     SwFrm* pHeader = pPageFrm->Lower();


More information about the Libreoffice-commits mailing list