[Libreoffice-commits] core.git: sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 31 03:17:42 PDT 2014


 sw/qa/complex/checkColor/CheckChangeColor.java |    3 -
 sw/qa/extras/rtfimport/rtfimport.cxx           |    3 -
 sw/source/core/unocore/unostyle.cxx            |   42 ++++++++++++++-----------
 3 files changed, 25 insertions(+), 23 deletions(-)

New commits:
commit e826950e9d7736a6e3f9042755ba1b528f58a505
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 31 11:51:24 2014 +0200

    sw: still use SvxBrushItem for page style background
    
    Commit 6e61ecd09679a66060f932835622821d39e92f01 (Merge back branch
    alg_writerframes to trunk, 2014-03-19) changed the sw UNO API, so that
    in case SvxBrushItem / RES_BACKGROUND was to be get/set, it mapped that
    to svx's fill style.
    
    This has two problems: 1) it does not work (see the failing unit test)
    and also page style editing UI sets SvxBrushItem, so even if the UI is
    used to (actually successfully) set the page background, it won't be
    saved to ODF.
    
    So, do this background <-> fill style mapping only for frames for now.
    
    Change-Id: I734880a40c891ae9e341cbddf8f88b0462361aac

diff --git a/sw/qa/complex/checkColor/CheckChangeColor.java b/sw/qa/complex/checkColor/CheckChangeColor.java
index 017ecc3..9324e35 100644
--- a/sw/qa/complex/checkColor/CheckChangeColor.java
+++ b/sw/qa/complex/checkColor/CheckChangeColor.java
@@ -59,7 +59,6 @@ public class CheckChangeColor {
         // create a PropertySet to set the properties for the new Pagestyle
         XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
 
-        /* FIXME port to FillAttributes
         assertEquals(
             "BackColor", new Any(Type.LONG, 0xFFFFFFFF),
             Any.complete(xPropertySet.getPropertyValue("BackColor")));
@@ -77,7 +76,7 @@ public class CheckChangeColor {
             Any.complete(xPropertySet.getPropertyValue("BackColor")));
         assertEquals(
             "IsLandscape", new Any(Type.BOOLEAN, true),
-            Any.complete(xPropertySet.getPropertyValue("IsLandscape")));*/
+            Any.complete(xPropertySet.getPropertyValue("IsLandscape")));
     }
 
     @Before public void setUpDocument() throws com.sun.star.uno.Exception {
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bd8828f..cb19476 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1096,15 +1096,12 @@ DECLARE_RTFIMPORT_TEST(testFdo64671, "fdo64671.rtf")
     getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
 }
 
-#if 0
-// FIXME port to FillAttributes
 DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf")
 {
     // The problem was that \background was ignored.
     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
 }
-#endif
 
 DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf")
 {
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 4625416..982b612 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1745,19 +1745,22 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
         }
         case RES_BACKGROUND:
         {
-            //UUUU
-            SfxItemSet& rStyleSet = rBase.GetItemSet();
-            const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
-            SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+            if (SFX_STYLE_FAMILY_FRAME == eFamily)
+            {
+                //UUUU
+                SfxItemSet& rStyleSet = rBase.GetItemSet();
+                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
+                SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
 
-            aChangedBrushItem.PutValue(aValue, nMemberId);
+                aChangedBrushItem.PutValue(aValue, nMemberId);
 
-            if(!(aChangedBrushItem == aOriginalBrushItem))
-            {
-                setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
-            }
+                if(!(aChangedBrushItem == aOriginalBrushItem))
+                {
+                    setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
+                }
 
-            bDone = true;
+                bDone = true;
+            }
             break;
         }
         case OWN_ATTR_FILLBMP_MODE:
@@ -2499,16 +2502,19 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
             }
             case RES_BACKGROUND:
             {
-                //UUUU
-                const SfxItemSet& rSet = rBase.GetItemSet();
-                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
-
-                if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
+                if (SFX_STYLE_FAMILY_FRAME == eFamily)
                 {
-                    OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
-                }
+                    //UUUU
+                    const SfxItemSet& rSet = rBase.GetItemSet();
+                    const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
 
-                bDone = true;
+                    if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
+                    {
+                        OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
+                    }
+
+                    bDone = true;
+                }
                 break;
             }
             case OWN_ATTR_FILLBMP_MODE:


More information about the Libreoffice-commits mailing list