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

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 31 06:40:20 PDT 2014


 sw/inc/unobrushitemhelper.hxx                 |    7 ++++++-
 sw/qa/extras/rtfexport/rtfexport.cxx          |    3 ---
 sw/source/core/attr/format.cxx                |   10 +++++-----
 sw/source/core/unocore/unobrushitemhelper.cxx |    4 ++++
 sw/source/core/unocore/unoframe.cxx           |   10 +++++-----
 sw/source/core/unocore/unostyle.cxx           |    6 +++---
 sw/source/filter/ww8/ww8atr.cxx               |   20 ++++++++++++++++++++
 7 files changed, 43 insertions(+), 17 deletions(-)

New commits:
commit ebf960960a69c1edb5da1994c330ddddbecac44d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 31 15:29:11 2014 +0200

    sw: put getSvx* and setSvx* to a namespace, now that these are public
    
    Change-Id: Iea2f6af83382608e4a36dd2e5803cbb936b78058

diff --git a/sw/inc/unobrushitemhelper.hxx b/sw/inc/unobrushitemhelper.hxx
index fa66383..9de5604 100644
--- a/sw/inc/unobrushitemhelper.hxx
+++ b/sw/inc/unobrushitemhelper.hxx
@@ -23,10 +23,14 @@
 #include <swdllapi.h>
 #include <editeng/brushitem.hxx>
 
+namespace sw {
+
 //UUUU helper function definintions for UNO API fallbacks to replace SvxBrushItem
 void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet);
 SW_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents = sal_True);
 
+} // namespace sw
+
 #endif // _UNOBRUSHITEMHELPER_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ded0649..776827c 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -396,7 +396,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents ) c
         // fill the local static SvxBrushItem from the current ItemSet so that
         // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
         // as good as possible to create a fallback representation and return that
-        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInParents);
+        aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bInParents);
 
         return aSvxBrushItem;
     }
@@ -421,7 +421,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent, con
             // to and return as state that it is set
             static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
 
-            aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bSrchInParent);
+            aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bSrchInParent);
             *ppItem = &aSvxBrushItem;
 
             return SFX_ITEM_SET;
@@ -459,7 +459,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
         // fill a local ItemSet with the attributes corresponding as good as possible
         // to the new fill properties [XATTR_FILL_FIRST .. XATTR_FILL_LAST] and set these
         // as ItemSet
-        setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
+        sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
 
         if(IsModifyLocked())
         {
@@ -553,7 +553,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
             // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Add the attributes
             // corresponding as good as possible to the new fill properties and set the whole ItemSet
             const SvxBrushItem& rSource(static_cast< const SvxBrushItem& >(*pSource));
-            setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
+            sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
 
             if(IsModifyLocked())
             {
@@ -782,7 +782,7 @@ const SvxBrushItem& SwFmt::GetBackground(sal_Bool bInP) const
         // fill the local static SvxBrushItem from the current ItemSet so that
         // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
         // as good as possible to create a fallback representation and return that
-        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInP);
+        aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bInP);
 
         return aSvxBrushItem;
     }
diff --git a/sw/source/core/unocore/unobrushitemhelper.cxx b/sw/source/core/unocore/unobrushitemhelper.cxx
index 07a6e69..ebf9a94 100644
--- a/sw/source/core/unocore/unobrushitemhelper.cxx
+++ b/sw/source/core/unocore/unobrushitemhelper.cxx
@@ -38,6 +38,8 @@
 #include <svx/xfltrit.hxx>
 #include <svx/xflhtit.hxx>
 
+namespace sw {
+
 //UUUU
 void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet)
 {
@@ -304,4 +306,6 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool
     return aRetval;
 }
 
+} // namespace sw
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 37bcb3d..b77266a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -327,7 +327,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
         }
 
-        setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
+        sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
     }
 
     if(bXFillStyleItemUsed)
@@ -1725,14 +1725,14 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
             if(RES_BACKGROUND == pEntry->nWID)
             {
                 const SwAttrSet& rSet = pFmt->GetAttrSet();
-                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
+                const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
                 SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
 
                 aChangedBrushItem.PutValue(aValue, nMemberId);
 
                 if(!(aChangedBrushItem == aOriginalBrushItem))
                 {
-                    setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
+                    sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
                     pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
                 }
 
@@ -2158,7 +2158,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
             if(RES_BACKGROUND == pEntry->nWID)
             {
                 //UUUU
-                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
+                const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
 
                 if(!aOriginalBrushItem.QueryValue(aAny, nMemberId))
                 {
@@ -2311,7 +2311,7 @@ bool SwXFrame::needToMapFillItemsToSvxBrushItemTypes() const
     }
 
     //UUUU here different FillStyles can be excluded for export; it will depend on the
-    // quality these fallbacks can reach. That again is done in getSvxBrushItemFromSourceSet,
+    // quality these fallbacks can reach. That again is done in sw::getSvxBrushItemFromSourceSet,
     // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem.
     // For now, take them all - except XFILL_NONE
 
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 982b612..45047ed 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1749,14 +1749,14 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
             {
                 //UUUU
                 SfxItemSet& rStyleSet = rBase.GetItemSet();
-                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
+                const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rStyleSet));
                 SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
 
                 aChangedBrushItem.PutValue(aValue, nMemberId);
 
                 if(!(aChangedBrushItem == aOriginalBrushItem))
                 {
-                    setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
+                    sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
                 }
 
                 bDone = true;
@@ -2506,7 +2506,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                 {
                     //UUUU
                     const SfxItemSet& rSet = rBase.GetItemSet();
-                    const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
+                    const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
 
                     if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
                     {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 163a3fc..2ae3c5d 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -838,7 +838,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
                     case XFILL_SOLID:
                     {
                         // Construct an SvxBrushItem, as expected by the exporters.
-                        aSet.Put(getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet()));
+                        aSet.Put(sw::getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet()));
                         break;
                     }
                     default:
commit c7837b8caad61b8c0dfd3704a133cdeaffd69b06
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 31 15:00:35 2014 +0200

    sw: fix DOC/DOCX/RTF export of TextFrame background color
    
    Change-Id: I8b7c23af7548a0eb073e046eedfbabfb9f78fafe

diff --git a/sw/inc/unobrushitemhelper.hxx b/sw/inc/unobrushitemhelper.hxx
index 1c6a3ec..fa66383 100644
--- a/sw/inc/unobrushitemhelper.hxx
+++ b/sw/inc/unobrushitemhelper.hxx
@@ -20,11 +20,12 @@
 #ifndef _UNOBRUSHITEMHELPER_HXX
 #define _UNOBRUSHITEMHELPER_HXX
 
+#include <swdllapi.h>
 #include <editeng/brushitem.hxx>
 
 //UUUU helper function definintions for UNO API fallbacks to replace SvxBrushItem
 void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet);
-SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents = sal_True);
+SW_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents = sal_True);
 
 #endif // _UNOBRUSHITEMHELPER_HXX
 
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 0094004..4b409ad 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -459,8 +459,6 @@ DECLARE_RTFEXPORT_TEST(testHyperlink, "hyperlink.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(getRun(getParagraph(1), 3, "!"), "HyperLinkURL"));
 }
 
-#if 0
-// FIXME port to FillAttributes
 DECLARE_RTFEXPORT_TEST(testTextFrameBorders, "textframe-borders.rtf")
 {
     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
@@ -477,7 +475,6 @@ DECLARE_RTFEXPORT_TEST(testTextFrameBorders, "textframe-borders.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int16(48), aShadowFormat.ShadowWidth);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color);
 }
-#endif
 
 #if 0
 // FIXME port to FillAttributes
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index ea1592b..163a3fc 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -112,6 +112,8 @@
 #include <breakit.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <unotools/localedatawrapper.hxx>
+#include <unobrushitemhelper.hxx>
+#include <svx/xenum.hxx>
 #include <tgrditem.hxx>
 #include <flddropdown.hxx>
 #include <chpfld.hxx>
@@ -826,6 +828,24 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
                 if (SFX_ITEM_SET != aSet.GetItemState(RES_SURROUND))
                     aSet.Put(SwFmtSurround(SURROUND_NONE));
 
+                const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rFrmFmt.GetAttrSet().GetItem(XATTR_FILLSTYLE)));
+                if (pXFillStyleItem)
+                {
+                    switch (pXFillStyleItem->GetValue())
+                    {
+                    case XFILL_NONE:
+                        break;
+                    case XFILL_SOLID:
+                    {
+                        // Construct an SvxBrushItem, as expected by the exporters.
+                        aSet.Put(getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet()));
+                        break;
+                    }
+                    default:
+                        break;
+                    }
+                }
+
                 bOutFlyFrmAttrs = true;
                 //script doesn't matter if not exporting chp
                 OutputItemSet(aSet, true, false,


More information about the Libreoffice-commits mailing list