[Libreoffice-commits] core.git: 3 commits - include/svx svx/source sw/inc sw/source

Michael Stahl mstahl at redhat.com
Fri Aug 21 16:02:19 PDT 2015


 include/svx/unobrushitemhelper.hxx        |    3 ++-
 svx/source/unodraw/unobrushitemhelper.cxx |    6 +++---
 sw/inc/fmtftn.hxx                         |    2 +-
 sw/source/core/unocore/unostyle.cxx       |    4 ++--
 sw/source/filter/html/svxcss1.cxx         |   29 ++++++++++++++---------------
 sw/source/filter/html/svxcss1.hxx         |   14 ++++++++------
 6 files changed, 30 insertions(+), 28 deletions(-)

New commits:
commit 79fb61efb847405fa47235002b52ee8efad5e339
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 21 18:28:23 2015 +0200

    tdf#92379: svx: don't overwrite fo:background-color on ODF import
    
    getSvxBrushItemFromSourceSet() is called once for each property of a
    frame style that is set, and the "solid" fill-style is set by first
    applying the BackColorRGB and then BackTransparency property.  So there
    is an intermediate state that has fill-style NONE but a XFillColorItem
    set - don't reset the color to white in that case!
    
    Apparently writerfilter generally relies on the current reset-to-AUTO
    implementation (loads of test failures), so for now limit the fix for
    when we know that a frame style is imported from ODF.
    
    (regression from 3d399b0e45720354fc64dc3d121ee486e01eff89)
    
    Change-Id: Ia987fe586ec819a1f3cd85acdbfb03c74ca0ec2c

diff --git a/include/svx/unobrushitemhelper.hxx b/include/svx/unobrushitemhelper.hxx
index eea95b6..4055c45 100644
--- a/include/svx/unobrushitemhelper.hxx
+++ b/include/svx/unobrushitemhelper.hxx
@@ -46,7 +46,8 @@ SVX_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(
 SVX_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(
     const SfxItemSet& rSourceSet,
     sal_uInt16 nBackgroundID,
-    bool bSearchInParents = true);
+    bool bSearchInParents = true,
+    bool bXMLImportHack = false);
 
 #endif // _UNOBRUSHITEMHELPER_HXX
 
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index 42b3d5f..1ae4c14 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -192,7 +192,7 @@ SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchI
 }
 
 //UUUU
-SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents)
+SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
 {
     const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents)));
 
@@ -201,8 +201,8 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt
         // no fill, still need to rescue the evtl. set RGB color, but use as transparent color (we have drawing::FillStyle_NONE)
         Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());
 
-        // when fill style is none, then don't allow anything other than 0 or auto.
-        if (aFillColor.GetColor() != 0)
+        // for writerfilter: when fill style is none, then don't allow anything other than 0 or auto.
+        if (!bXMLImportHack && aFillColor.GetColor() != 0)
             aFillColor.SetColor(COL_AUTO);
 
         aFillColor.SetTransparency(0xff);
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index a17eaf1..da3d56f 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1761,7 +1761,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
         {
             //UUUU
             SfxItemSet& rStyleSet = rBase.GetItemSet();
-            const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND));
+            const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
             SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
 
             aChangedBrushItem.PutValue(aValue, nMemberId);
@@ -4297,7 +4297,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
                 case RES_BACKGROUND:
                 {
                     //UUUU
-                    const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND));
+                    const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, pDocShell->GetDoc()->IsInXMLImport()));
                     SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
 
                     aChangedBrushItem.PutValue(aValue, nMemberId);
commit ece9da2f47def7ed5cd5e04add0eeb7a90a6e1b6
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 21 16:17:42 2015 +0200

    sw: translate that
    
    Change-Id: If218ecd47435c261de14bd5f838c1e54f826a6ab

diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index 046efad..6212381 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -42,7 +42,7 @@ class SW_DLLPUBLIC SwFormatFootnote
     friend class SwTextFootnote;
     SwTextFootnote* m_pTextAttr;   ///< My TextAttribute.
     OUString m_aNumber;     ///< User-defined 'Number'.
-    sal_uInt16 m_nNumber;   ///< Automatische Nummerierung
+    sal_uInt16 m_nNumber;   ///< automatic sequence number
     bool    m_bEndNote;     ///< Is it an End note?
 
     css::uno::WeakReference<css::text::XFootnote> m_wXFootnote;
commit 2ea45a407e2538e07dfbe17ae95cc5d4801aa7e2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 21 16:02:16 2015 +0200

    tdf#93240: replace boost::ptr_map with std::map<std::unique_ptr>
    
    Change-Id: I7bc614dc45154c8dd5a7d3948f2129e5127876b3

diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index c2acc83..6a259c8 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -19,7 +19,6 @@
 
 #include <stdlib.h>
 
-#include <o3tl/ptr_container.hxx>
 #include <svx/svxids.hrc>
 #include <i18nlangtag/languagetag.hxx>
 #include <svtools/ctrltool.hxx>
@@ -772,26 +771,26 @@ void SvxCSS1Parser::InsertId( const OUString& rId,
                               const SfxItemSet& rItemSet,
                               const SvxCSS1PropertyInfo& rProp )
 {
-    InsertMapEntry( rId, rItemSet, rProp, aIds );
+    InsertMapEntry( rId, rItemSet, rProp, m_Ids );
 }
 
 const SvxCSS1MapEntry* SvxCSS1Parser::GetId( const OUString& rId ) const
 {
-    CSS1Map::const_iterator itr = aIds.find(rId);
-    return itr == aIds.end() ? NULL : itr->second;
+    CSS1Map::const_iterator itr = m_Ids.find(rId);
+    return itr == m_Ids.end() ? nullptr : itr->second.get();
 }
 
 void SvxCSS1Parser::InsertClass( const OUString& rClass,
                                  const SfxItemSet& rItemSet,
                                  const SvxCSS1PropertyInfo& rProp )
 {
-    InsertMapEntry( rClass, rItemSet, rProp, aClasses );
+    InsertMapEntry( rClass, rItemSet, rProp, m_Classes );
 }
 
 const SvxCSS1MapEntry* SvxCSS1Parser::GetClass( const OUString& rClass ) const
 {
-    CSS1Map::const_iterator itr = aClasses.find(rClass);
-    return itr == aClasses.end() ? NULL : itr->second;
+    CSS1Map::const_iterator itr = m_Classes.find(rClass);
+    return itr == m_Classes.end() ? nullptr : itr->second.get();
 }
 
 void SvxCSS1Parser::InsertPage( const OUString& rPage,
@@ -802,7 +801,7 @@ void SvxCSS1Parser::InsertPage( const OUString& rPage,
     OUString aKey( rPage );
     if( bPseudo )
         aKey = ":" + aKey;
-    InsertMapEntry( aKey, rItemSet, rProp, aPages );
+    InsertMapEntry( aKey, rItemSet, rProp, m_Pages );
 }
 
 SvxCSS1MapEntry* SvxCSS1Parser::GetPage( const OUString& rPage, bool bPseudo )
@@ -811,21 +810,21 @@ SvxCSS1MapEntry* SvxCSS1Parser::GetPage( const OUString& rPage, bool bPseudo )
     if( bPseudo )
         aKey = ":" + aKey;
 
-    CSS1Map::iterator itr = aPages.find(aKey);
-    return itr == aPages.end() ? NULL : itr->second;
+    CSS1Map::iterator itr = m_Pages.find(aKey);
+    return itr == m_Pages.end() ? nullptr : itr->second.get();
 }
 
 void SvxCSS1Parser::InsertTag( const OUString& rTag,
                                const SfxItemSet& rItemSet,
                                const SvxCSS1PropertyInfo& rProp )
 {
-    InsertMapEntry( rTag, rItemSet, rProp, aTags );
+    InsertMapEntry( rTag, rItemSet, rProp, m_Tags );
 }
 
 SvxCSS1MapEntry* SvxCSS1Parser::GetTag( const OUString& rTag )
 {
-    CSS1Map::iterator itr = aTags.find(rTag);
-    return itr == aTags.end() ? NULL : itr->second;
+    CSS1Map::iterator itr = m_Tags.find(rTag);
+    return itr == m_Tags.end() ? nullptr : itr->second.get();
 }
 
 bool SvxCSS1Parser::ParseStyleSheet( const OUString& rIn )
@@ -930,11 +929,11 @@ void SvxCSS1Parser::InsertMapEntry( const OUString& rKey,
     if (itr == rMap.end())
     {
         std::unique_ptr<SvxCSS1MapEntry> p(new SvxCSS1MapEntry(rKey, rItemSet, rProp));
-        o3tl::ptr_container::insert(rMap, rKey, std::move(p));
+        rMap.insert(std::make_pair(rKey, std::move(p)));
     }
     else
     {
-        SvxCSS1MapEntry* p = itr->second;
+        SvxCSS1MapEntry *const p = itr->second.get();
         MergeStyles( rItemSet, rProp,
                      p->GetItemSet(), p->GetPropertyInfo(), true );
     }
diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx
index 09414ed..697d3c7 100644
--- a/sw/source/filter/html/svxcss1.hxx
+++ b/sw/source/filter/html/svxcss1.hxx
@@ -25,7 +25,9 @@
 #include "parcss1.hxx"
 
 #include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/ptr_container/ptr_map.hpp>
+
+#include <memory>
+#include <map>
 
 class SfxItemPool;
 class SvxBoxItem;
@@ -197,13 +199,13 @@ inline bool operator<( const SvxCSS1MapEntry& rE1,  const SvxCSS1MapEntry& rE2 )
 class SvxCSS1Parser : public CSS1Parser
 {
     typedef ::boost::ptr_vector<CSS1Selector> CSS1Selectors;
-    typedef ::boost::ptr_map<OUString, SvxCSS1MapEntry> CSS1Map;
+    typedef ::std::map<OUString, std::unique_ptr<SvxCSS1MapEntry>> CSS1Map;
     CSS1Selectors aSelectors;   // Liste der "offenen" Selectoren
 
-    CSS1Map aIds;
-    CSS1Map aClasses;
-    CSS1Map aPages;
-    CSS1Map aTags;
+    CSS1Map m_Ids;
+    CSS1Map m_Classes;
+    CSS1Map m_Pages;
+    CSS1Map m_Tags;
 
     OUString sBaseURL;
 


More information about the Libreoffice-commits mailing list