summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--offapi/com/sun/star/table/CellProperties.idl10
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/qa/extras/ooxmlexport/data/table-theme-preservation.docxbin0 -> 37411 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx18
-rw-r--r--sw/source/core/bastyp/init.cxx1
-rw-r--r--sw/source/core/unocore/unomap.cxx1
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx44
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
-rw-r--r--writerfilter/source/dmapper/TablePropertiesHandler.cxx10
10 files changed, 79 insertions, 8 deletions
diff --git a/offapi/com/sun/star/table/CellProperties.idl b/offapi/com/sun/star/table/CellProperties.idl
index 94b71db5ae80..3e01b315e2fe 100644
--- a/offapi/com/sun/star/table/CellProperties.idl
+++ b/offapi/com/sun/star/table/CellProperties.idl
@@ -263,6 +263,16 @@ published service CellProperties
*/
[optional, property] com::sun::star::table::BorderLine2 DiagonalBLTR2;
+ /** Grab bag of cell properties, used as a string-any map for interim interop purposes.
+
+ @since LibreOffice 4.3
+
+ <p>This property is intentionally not handled by the ODF filter. Any
+ member that should be handled there should be first moved out from this grab
+ bag to a separate property.</p>
+ */
+ [optional, property] sequence<com::sun::star::beans::PropertyValue> CellInteropGrabBag;
+
};
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index ab08fc277933..280c7e40f12c 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -839,6 +839,7 @@
#define UNO_NAME_STYLE_INTEROP_GRAB_BAG "StyleInteropGrabBag"
#define UNO_NAME_CHAR_INTEROP_GRAB_BAG "CharInteropGrabBag"
#define UNO_NAME_TEXT_VERT_ADJUST "TextVerticalAdjust"
+#define UNO_NAME_CELL_INTEROP_GRAB_BAG "CellInteropGrabBag"
#endif
diff --git a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
new file mode 100644
index 000000000000..fe6b9537bfa9
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fd080d0dd5bb..04f474c4ff0c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1937,6 +1937,24 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx")
assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeFill", "text2");
}
+DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.docx")
+{
+ xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ if (!pXmlDocument)
+ return;
+
+ // check cell theme colors have been preserved
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFill", "accent6");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillShade", "");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillTint", "33");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFill", "accent6");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillShade", "");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillTint", "");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFill", "accent6");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillShade", "80");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillTint", "");
+}
+
DECLARE_OOXMLEXPORT_TEST(testcantSplit, "2_table_doc.docx")
{
// if Split table value is true for a table then during export do not write <w:cantSplit w:val="false"/>
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index e3b57438a0e5..af7660230109 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -218,6 +218,7 @@ sal_uInt16 aTableBoxSetRange[] = {
RES_FRAMEDIR, RES_FRAMEDIR,
RES_BOXATR_BEGIN, RES_BOXATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
0
};
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 1e7125a41246..7e0a059f68d9 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1132,6 +1132,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
{ OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 },
{ OUString(UNO_NAME_ROW_SPAN), FN_UNO_CELL_ROW_SPAN, cppu::UnoType<sal_Int32>::get(), 0, 0 },
+ { OUString(UNO_NAME_CELL_INTEROP_GRAB_BAG), RES_FRMATR_GRABBAG, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), PROPERTY_NONE, 0 },
_REDLINE_NODE_PROPERTIES
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6e71a6d21410..d7cc220ba362 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2781,10 +2781,46 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
aColor = COL_AUTO;
OString sColor = msfilter::util::ConvertColor( aColor );
- m_pSerializer->singleElementNS( XML_w, XML_shd,
- FSNS( XML_w, XML_fill ), sColor.getStr( ),
- FSNS( XML_w, XML_val ), "clear",
- FSEND );
+
+ std::map<OUString, com::sun::star::uno::Any> aGrabBag;
+ if ( SFX_ITEM_ON == pFmt->GetAttrSet().GetItemState( RES_FRMATR_GRABBAG, false, &pI ) )
+ aGrabBag = dynamic_cast<const SfxGrabBagItem *>(pI)->GetGrabBag();
+
+ OString sOriginalColor;
+ std::map<OUString, com::sun::star::uno::Any>::iterator aGrabBagElement = aGrabBag.find("fill");
+ if( aGrabBagElement != aGrabBag.end() )
+ sOriginalColor = OUStringToOString( aGrabBagElement->second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
+
+ if ( sOriginalColor != sColor )
+ {
+ // color changed by the user, or no grab bag: write sColor
+ m_pSerializer->singleElementNS( XML_w, XML_shd,
+ FSNS( XML_w, XML_fill ), sColor.getStr( ),
+ FSNS( XML_w, XML_val ), "clear",
+ FSEND );
+ }
+ else
+ {
+ ::sax_fastparser::FastAttributeList* aAttrList = NULL;
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_fill ), sColor.getStr() );
+
+ for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != aGrabBag.end(); ++aGrabBagElement )
+ {
+ OString sValue = OUStringToOString( aGrabBagElement->second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
+ if( aGrabBagElement->first == "themeFill")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFill ), sValue.getStr() );
+ else if( aGrabBagElement->first == "themeFillTint")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFillTint ), sValue.getStr() );
+ else if( aGrabBagElement->first == "themeFillShade")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFillShade ), sValue.getStr() );
+ else if( aGrabBagElement->first == "color")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_color ), sValue.getStr() );
+ else if( aGrabBagElement->first == "val")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_val ), sValue.getStr() );
+ }
+ m_pSerializer->singleElementNS( XML_w, XML_shd,
+ XFastAttributeListRef( aAttrList ) );
+ }
}
void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 8bdba4e404b3..24e523be35de 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -388,6 +388,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_CHAR_STYLISTICSETS_TEXT_EFFECT : sName = "CharStylisticSetsTextEffect"; break;
case PROP_CHAR_CNTXTALTS_TEXT_EFFECT : sName = "CharCntxtAltsTextEffect"; break;
case PROP_SDTPR : sName = "SdtPr"; break;
+ case PROP_CELL_INTEROP_GRAB_BAG : sName = "CellInteropGrabBag"; 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 1d29c0b1c497..ab6f92f5c12e 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -360,6 +360,7 @@ enum PropertyIds
,PROP_CHAR_STYLISTICSETS_TEXT_EFFECT
,PROP_CHAR_CNTXTALTS_TEXT_EFFECT
,PROP_SDTPR
+ ,PROP_CELL_INTEROP_GRAB_BAG
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index e5e41726fdf6..877c602a5231 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -322,12 +322,14 @@ namespace dmapper {
if( pProperties.get())
{
CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
- if (m_pCurrentInteropGrabBag)
- pCellColorHandler->enableInteropGrabBag("shd");
+ pCellColorHandler->enableInteropGrabBag("shd"); //enable to store shd unsupported props in grab bag
pProperties->resolve( *pCellColorHandler );
+ beans::PropertyValue aGrabBag = pCellColorHandler->getInteropGrabBag();
if (m_pCurrentInteropGrabBag)
- m_pCurrentInteropGrabBag->push_back(pCellColorHandler->getInteropGrabBag());
- cellProps( pCellColorHandler->getProperties());
+ m_pCurrentInteropGrabBag->push_back(aGrabBag);
+ TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties();
+ pPropertyMap->Insert( PROP_CELL_INTEROP_GRAB_BAG, aGrabBag.Value );
+ cellProps( pPropertyMap );
}
}
break;