[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 9 08:02:37 PST 2015


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx         |    6 +++---
 sw/source/core/unocore/unocrsrhelper.cxx         |   10 +++++++---
 writerfilter/source/dmapper/CellColorHandler.cxx |   12 +++++++++---
 writerfilter/source/dmapper/PropertyIds.cxx      |    2 ++
 writerfilter/source/dmapper/PropertyIds.hxx      |    2 ++
 5 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 5b48d5e25c8e7918f4669195144afb1fae049d41
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Feb 1 00:11:21 2015 +0100

    Related: tdf#88583 writerfilter: import paragraph color as fill attributes
    
    In theory this is to be in sync with the ODF import. In practice the old
    UNO property seems not to have a proper fallback to populate the doc
    model with the fillattributes, so without this even if the import result
    is visible, it would be lost on ODF export.
    
    Additionally, this detected a bug in SwUnoCursorHelper::makeRedline(),
    where paragraph format redline tried to use the map of a text portion
    instead of a paragraph.
    
    (cherry picked from commit 24077b2d52ab3d0fd0db5afb25d8b94b62386e3e)
    
    Change-Id: I026e38e1990ed2a460624a8d967a16ae3fb6c512
    Reviewed-on: https://gerrit.libreoffice.org/14353
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 64dcfd7..5e05f6a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -10,6 +10,7 @@
 #include <swmodeltestbase.hxx>
 
 #include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/style/BreakType.hpp>
 #include <com/sun/star/text/FontEmphasis.hpp>
@@ -608,9 +609,8 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideStart, "num-override-start.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf88583, "tdf88583.odt")
 {
-    if (xmlDocPtr pXmlDoc = parseExport())
-        // <w:pPr> had no <w:shd> child element, paragraph background was lost.
-        assertXPath(pXmlDoc, "//w:pPr/w:shd", "fill", "00CC00");
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle"));
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), getProperty<sal_Int32>(getParagraph(1), "FillColor"));
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index efe476a..faa268c 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1219,9 +1219,13 @@ void makeRedline( SwPaM& rPaM,
     // Check if the value exists
     if ( aRevertPropertiesValue >>= aRevertProperties )
     {
-        // sw/source/core/unocore/unoport.cxx#83 is where it's decided what map gets used for a text portion
-        // so it's PROPERTY_MAP_TEXTPORTION_EXTENSIONS, unless it's a redline portion
-        SfxItemPropertySet const& rPropSet = (*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXTPORTION_EXTENSIONS));
+        int nMap = 0;
+        // Make sure that paragraph format gets its own map, otherwise e.g. fill attributes are not preserved.
+        if (eType == nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT)
+            nMap = PROPERTY_MAP_PARAGRAPH;
+        else
+            nMap = PROPERTY_MAP_TEXTPORTION_EXTENSIONS;
+        SfxItemPropertySet const& rPropSet = (*aSwMapProvider.GetPropertySet(nMap));
 
         // Check if there are any properties
         if (aRevertProperties.getLength())
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index 632bc07..dc2bda9 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -21,6 +21,7 @@
 #include <ConversionHelper.hxx>
 #include <TDefTableHandler.hxx>
 #include <ooxml/resourceids.hxx>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/ShadingPattern.hpp>
 #include <sal/macros.h>
 #include <filter/msfilter/util.hxx>
@@ -268,9 +269,14 @@ TablePropertyMapPtr  CellColorHandler::getProperties()
         pPropertyMap->Insert(PROP_CHAR_SHADING_VALUE, uno::makeAny( nShadingPattern ));
     }
 
-    pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
-                        : m_OutputFormat == Paragraph ? PROP_PARA_BACK_COLOR
-                        : PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
+    if (m_OutputFormat == Paragraph)
+    {
+        pPropertyMap->Insert(PROP_FILL_STYLE, uno::makeAny(drawing::FillStyle_SOLID));
+        pPropertyMap->Insert(PROP_FILL_COLOR, uno::makeAny(nApplyColor));
+    }
+    else
+        pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
+                            : PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
 
     createGrabBag("originalColor", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nApplyColor, true))));
 
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 8d21989..f380c45 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -401,6 +401,8 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_ROW_CNF_STYLE: sName = "RowCnfStyle"; break;
             case PROP_CELL_HIDE_MARK: sName = "CellHideMark"; break;
             case PROP_FOLLOW_TEXT_FLOW: sName = "IsFollowingTextFlow"; break;
+            case PROP_FILL_STYLE: sName = "FillStyle"; break;
+            case PROP_FILL_COLOR: sName = "FillColor"; break;
         }
         ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
                 m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 4e09508..cd52d48 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -373,6 +373,8 @@ enum PropertyIds
         ,PROP_ROW_CNF_STYLE
         ,PROP_CELL_HIDE_MARK
         ,PROP_FOLLOW_TEXT_FLOW
+        ,PROP_FILL_STYLE
+        ,PROP_FILL_COLOR
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier


More information about the Libreoffice-commits mailing list