diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-01 00:11:21 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-01 01:48:38 +0100 |
commit | 24077b2d52ab3d0fd0db5afb25d8b94b62386e3e (patch) | |
tree | fef53926c540c9194f8e893a69690ebbd5fed7be | |
parent | eaf1c5f85bcf33fbb7e0ad0d6de4b33ae07445ae (diff) |
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.
Change-Id: I026e38e1990ed2a460624a8d967a16ae3fb6c512
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/CellColorHandler.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 2 |
5 files changed, 23 insertions, 9 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 53a0b7ea6d12..1815242e63a6 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> @@ -631,9 +632,8 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtentMargin, "effectextent-margin.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 943223001e54..6f6538384443 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1217,9 +1217,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 3c8b5060a229..63e7ed4a2e50 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 8d21989ea085..f380c457c8a0 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 4e0950838f65..cd52d488fbbc 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 |