diff options
author | Jakub Trzebiatowski <ubap.dev@gmail.com> | 2016-06-21 00:31:01 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-07-07 09:02:15 +0000 |
commit | 40fba0f4418084d50cc5c388cb0b6e1abe395d61 (patch) | |
tree | 4b1e97aa7755c80d9a8749fb94dc3fe26a2f35fb | |
parent | 046244bcfe1c5c1cd2325fe74b933c05e43cf190 (diff) |
GSoC Writer Table Styles Import
This patch is implementing import of table styles (table-template).
Modified shared code: Added "background" to the cell styles export.
To make cell export properties map accessible by both export and import code,
moved from xmloff/source/table/XMLTableExport.cxx to xmloff/txtprmap.hxx.
To avoid export of default valued properties implemented XPropertyState for
SwXTextCellStyle
Change-Id: I8b4f12e4b51f478f8ce8fde1203cd4611d7ae852
Reviewed-on: https://gerrit.libreoffice.org/26721
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | include/sal/log-areas.dox | 2 | ||||
-rw-r--r-- | include/xmloff/table/XMLTableImport.hxx | 5 | ||||
-rw-r--r-- | include/xmloff/txtimp.hxx | 3 | ||||
-rw-r--r-- | include/xmloff/txtprmap.hxx | 3 | ||||
-rw-r--r-- | sw/inc/tblafmt.hxx | 1 | ||||
-rw-r--r-- | sw/inc/unostyle.hxx | 7 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/data/table_styles_1.odt | bin | 0 -> 9874 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 40 | ||||
-rw-r--r-- | sw/source/core/doc/tblafmt.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 94 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmt.cxx | 39 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltble.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltbli.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltbli.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/style/prstylei.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/table/XMLTableExport.cxx | 30 | ||||
-rw-r--r-- | xmloff/source/table/XMLTableImport.cxx | 129 | ||||
-rw-r--r-- | xmloff/source/table/table.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 23 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 26 |
21 files changed, 405 insertions, 48 deletions
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index e88e1a2981cb..73df243d7c14 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -478,6 +478,7 @@ certain functionality. @li @c sw.ww8 - .doc/.docx export filter, .doc import filter (not writerfilter) @li @c sw.ww8.level2 - further info for sw.ww8 @li @c sw.html - Writer HTML import/export +@li @c sw.xml - Writer .odt import/export @section writerfilter @@ -499,6 +500,7 @@ certain functionality. @li @c xmloff.draw @li @c xmloff.forms @li @c xmloff.style +@li @c xmloff.table @li @c xmloff.text @li @c xmloff.transform diff --git a/include/xmloff/table/XMLTableImport.hxx b/include/xmloff/table/XMLTableImport.hxx index 7f8a56851890..7d5ddf041aa1 100644 --- a/include/xmloff/table/XMLTableImport.hxx +++ b/include/xmloff/table/XMLTableImport.hxx @@ -38,7 +38,7 @@ class SvXMLStyleContext; typedef std::map< OUString, OUString > XMLTableTemplate; typedef std::map < OUString, std::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap; -class XMLTableImport : public salhelper::SimpleReferenceObject +class XMLOFF_DLLPUBLIC XMLTableImport : public salhelper::SimpleReferenceObject { friend class XMLTableImportContext; @@ -56,6 +56,9 @@ public: const rtl::Reference< SvXMLImportPropertyMapper >& GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; } void addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ); + /// Inserts to the doc template with given name. + void insertTabletemplate( const OUString& rsStyleName, bool bOverwrite = false); + /// Inserts all table templates. void finishStyles(); private: diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index 8bc38d66f0ce..225d8c7e15e9 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -530,6 +530,8 @@ public: const css::uno::Reference< css::container::XNameContainer> & GetPageStyles() const; + const css::uno::Reference< css::container::XNameContainer> & GetCellStyles() const; + const css::uno::Reference< css::container::XIndexReplace > & GetChapterNumbering() const; @@ -552,6 +554,7 @@ public: static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&); static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&); static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper* CreateTableCellExtPropMapper(SvXMLImport&); SvI18NMap& GetRenameMap(); diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx index 79baf8bbaa3c..fc4039e0344c 100644 --- a/include/xmloff/txtprmap.hxx +++ b/include/xmloff/txtprmap.hxx @@ -214,7 +214,8 @@ enum class TextPropMap { SHAPE_PARA = 7, TEXT_ADDITIONAL_DEFAULTS = 8, TABLE_DEFAULTS = 9, - TABLE_ROW_DEFAULTS = 10 + TABLE_ROW_DEFAULTS = 10, + CELL = 11 }; class XMLOFF_DLLPUBLIC XMLTextPropertySetMapper : public XMLPropertySetMapper diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 0eb799ac2a87..06aa12b6adcc 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -276,6 +276,7 @@ public: void SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 nPos ); const SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ) const; SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ); + static const SwBoxAutoFormat& GetDefaultBoxFormat(); void SetName( const OUString& rNew ) { m_aName = rNew; nStrResId = USHRT_MAX; } const OUString& GetName() const { return m_aName; } diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index cc24073874a6..a2b5f522a23e 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -348,6 +348,7 @@ class SwXTextCellStyle : public cppu::WeakImplHelper < css::style::XStyle, css::beans::XPropertySet, + css::beans::XPropertyState, css::lang::XServiceInfo > { @@ -399,6 +400,12 @@ class SwXTextCellStyle : public cppu::WeakImplHelper virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override; + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString& PropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) override; + virtual css::uno::Sequence<css::beans::PropertyState> SAL_CALL getPropertyStates(const css::uno::Sequence< OUString >& aPropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) override; + virtual void SAL_CALL setPropertyToDefault(const OUString& PropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) override; + virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString& aPropertyName) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override; + //XServiceInfo virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override; virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) throw(css::uno::RuntimeException, std::exception) override; diff --git a/sw/qa/extras/odfexport/data/table_styles_1.odt b/sw/qa/extras/odfexport/data/table_styles_1.odt Binary files differnew file mode 100644 index 000000000000..701fd92c2aaa --- /dev/null +++ b/sw/qa/extras/odfexport/data/table_styles_1.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index aa384775a1ed..313d2cfd39e8 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -816,6 +816,46 @@ DECLARE_ODFEXPORT_TEST(testEmbeddedPdf, "embedded-pdf.odt") CPPUNIT_ASSERT(!getProperty<OUString>(xShape, "ReplacementGraphicURL").isEmpty()); } +DECLARE_ODFEXPORT_TEST(testTableStyles1, "table_styles_1.odt") +{ + // Table styles basic graphic test. + // Doesn't cover all attributes. + uno::Reference<style::XStyleFamiliesSupplier> XFamiliesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xFamilies(XFamiliesSupplier->getStyleFamilies()); + uno::Reference<container::XNameAccess> xCellFamily(xFamilies->getByName("CellStyles"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xCell1Style; + xCellFamily->getByName("Test style.1") >>= xCell1Style; + + sal_Int64 nInt64 = 0xF0F0F0; + sal_Int32 nInt32 = 0xF0F0F0; + table::BorderLine2 oBorder; + + xCell1Style->getPropertyValue("BackColor") >>= nInt64; + CPPUNIT_ASSERT_EQUAL(sal_Int64(0xCC0000), nInt64); + xCell1Style->getPropertyValue("WritingMode") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nInt32); + xCell1Style->getPropertyValue("VertOrient") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32); + xCell1Style->getPropertyValue("BorderDistance") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32); + xCell1Style->getPropertyValue("LeftBorderDistance") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32); + xCell1Style->getPropertyValue("RightBorderDistance") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32); + xCell1Style->getPropertyValue("TopBorderDistance") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32); + xCell1Style->getPropertyValue("BottomBorderDistance") >>= nInt32; + CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32); + xCell1Style->getPropertyValue("RightBorder") >>= oBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color); + xCell1Style->getPropertyValue("LeftBorder") >>= oBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color); + xCell1Style->getPropertyValue("TopBorder") >>= oBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color); + xCell1Style->getPropertyValue("BottomBorder") >>= oBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 66202a1b4a01..0034998e75f3 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -709,6 +709,14 @@ SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) return *pFormat; } +const SwBoxAutoFormat& SwTableAutoFormat::GetDefaultBoxFormat() +{ + if(!pDfltBoxAutoFormat) + pDfltBoxAutoFormat = new SwBoxAutoFormat(); + + return *pDfltBoxAutoFormat; +} + void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet, UpdateFlags eFlags, @@ -847,7 +855,11 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet, rSet.Put( rChg.GetBackground() ); rSet.Put(rChg.GetTextOrientation()); - rSet.Put(rChg.GetVerticalAlignment()); + + // Do not put a VertAlign when it has default value. + // It prevents the export of default value by automatic cell-styles export. + if (rChg.GetVerticalAlignment().GetVertOrient() != GetDefaultBoxFormat().GetVerticalAlignment().GetVertOrient()) + rSet.Put(rChg.GetVerticalAlignment()); if( IsValueFormat() && pNFormatr ) { diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 87e3c55cc34f..c38c1e31978c 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -26,6 +26,7 @@ #include <svl/style.hxx> #include <svl/itemiter.hxx> #include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include <svx/pageitem.hxx> #include <editeng/sizeitem.hxx> #include <editeng/ulspitem.hxx> @@ -4925,11 +4926,47 @@ void SAL_CALL SwXTextCellStyle::setPropertyValue(const OUString& rPropertyName, { case RES_BACKGROUND: { - SvxBrushItem rBrush( m_pBoxAutoFormat->GetBackground() ); + SvxBrushItem rBrush = m_pBoxAutoFormat->GetBackground(); rBrush.PutValue(aValue, 0); m_pBoxAutoFormat->SetBackground(rBrush); return; } + case RES_BOX: + { + SvxBoxItem rBox = m_pBoxAutoFormat->GetBox(); + rBox.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetBox(rBox); + return; + } + case RES_VERT_ORIENT: + { + SwFormatVertOrient rVertOrient = m_pBoxAutoFormat->GetVerticalAlignment(); + rVertOrient.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetVerticalAlignment(rVertOrient); + return; + } + case RES_FRAMEDIR: + { + SvxFrameDirectionItem rDirItem = m_pBoxAutoFormat->GetTextOrientation(); + rDirItem.PutValue(aValue, pEntry->nMemberId); + m_pBoxAutoFormat->SetTextOrientation(rDirItem); + return; + } + case RES_BOXATR_FORMAT: + { + sal_uInt32 nKey; + if (aValue >>= nKey) + { + // FIXME: Its not working for old "automatic" currency formats, which are still in use by autotbl.fmt. + // Scenario: + // 1) Mark all styles present by default in autotbl.fmt as default. + // 2) convert all currencies present in autotbl.fmt before calling this code + const SvNumberformat* pNumFormat = m_pDocShell->GetDoc()->GetNumberFormatter()->GetEntry(nKey); + if (pNumFormat) + m_pBoxAutoFormat->SetValueFormat(pNumFormat->GetFormatstring(), pNumFormat->GetLanguage(), GetAppLanguage()); + } + return; + } default: SAL_WARN("sw.uno", "SwXTextCellStyle unknown nWID"); throw css::uno::RuntimeException(); @@ -5014,6 +5051,61 @@ void SAL_CALL SwXTextCellStyle::removeVetoableChangeListener( const OUString& /* SAL_WARN("sw.uno", "not implemented"); } +//XPropertyState +css::beans::PropertyState SAL_CALL SwXTextCellStyle::getPropertyState(const OUString& rPropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + uno::Sequence<OUString> aNames { rPropertyName }; + uno::Sequence<beans::PropertyState> aStates = getPropertyStates(aNames); + return aStates.getConstArray()[0]; +} + +css::uno::Sequence<css::beans::PropertyState> SAL_CALL SwXTextCellStyle::getPropertyStates(const css::uno::Sequence<OUString>& aPropertyNames) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength()); + beans::PropertyState* pStates = aRet.getArray(); + const SwBoxAutoFormat& rDefaultBoxFormat = SwTableAutoFormat::GetDefaultBoxFormat(); + const SfxItemPropertyMap& rMap = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CELL_STYLE)->getPropertyMap(); + const OUString* pNames = aPropertyNames.getConstArray(); + for(sal_Int32 i=0; i < aPropertyNames.getLength(); ++i) + { + const OUString sPropName = pNames[i]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); + if(pEntry) + { + switch(pEntry->nWID) + { + case RES_VERT_ORIENT: + if (m_pBoxAutoFormat->GetVerticalAlignment() == rDefaultBoxFormat.GetVerticalAlignment()) + pStates[i] = beans::PropertyState_DEFAULT_VALUE; + break; + default: + // falltrough to DIRECT_VALUE, to export properties for which getPropertyStates is not implemented + pStates[i] = beans::PropertyState_DIRECT_VALUE; + } + } + else + { + SAL_WARN("sw.uno", "SwXTextCellStyle unknown property:" + sPropName); + throw css::beans::UnknownPropertyException(); + } + } + return aRet; +} + +void SAL_CALL SwXTextCellStyle::setPropertyToDefault(const OUString& /*PropertyName*/) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) +{ + SAL_WARN("sw.uno", "not implemented"); +} + +css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyDefault(const OUString& /*aPropertyName*/) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) +{ + SAL_WARN("sw.uno", "not implemented"); + uno::Any aRet; + return aRet; +} + //XServiceInfo OUString SAL_CALL SwXTextCellStyle::getImplementationName() throw(css::uno::RuntimeException, std::exception) { diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 0961d7762b97..94e6d013b177 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -49,6 +49,7 @@ #include <undobj.hxx> #include <swundo.hxx> #include <swtable.hxx> +#include <tblafmt.hxx> #include <tblsel.hxx> #include <pagedesc.hxx> #include <poolfmt.hxx> @@ -344,6 +345,8 @@ sal_uLong SwReader::Read( const Reader& rOptions ) pDoc->ChkCondColls(); pDoc->SetAllUniqueFlyNames(); pDoc->getIDocumentState().SetLoaded(); + // Clear unassigned cell styles, because they aren't needed anymore. + pDoc->GetCellStyles().clear(); pDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo); if (!bReadPageDescs) diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index dcf39d823327..02a261fd3d8d 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -699,6 +699,10 @@ class SwXMLStylesContext_Impl : public SvXMLStylesContext protected: + virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override; + virtual SvXMLStyleContext *CreateStyleStyleChildContext( sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override; @@ -729,6 +733,22 @@ public: virtual void EndElement() override; }; +SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) +{ + SvXMLStyleContext* pContext = nullptr; + + if(nPrefix == XML_NAMESPACE_TABLE && IsXMLToken(rLocalName, XML_TABLE_TEMPLATE)) + { + rtl::Reference<XMLTableImport> xTableImport = GetImport().GetShapeImport()->GetShapeTableImport(); + pContext = xTableImport->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList); + } + if (!pContext) + pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList); + + return pContext; +} SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext( sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, @@ -746,8 +766,13 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext( case XML_STYLE_FAMILY_TABLE_COLUMN: case XML_STYLE_FAMILY_TABLE_ROW: case XML_STYLE_FAMILY_TABLE_CELL: - pStyle = new SwXMLItemSetStyleContext_Impl( GetSwImport(), nPrefix, - rLocalName, xAttrList, *this, nFamily ); + // Distinguish real and automatic styles. + if (IsAutomaticStyle()) + pStyle = new SwXMLItemSetStyleContext_Impl(GetSwImport(), nPrefix, rLocalName, xAttrList, *this, nFamily); + else if (nFamily == XML_STYLE_FAMILY_TABLE_CELL) // Real cell styles are used for table-template import. + pStyle = new XMLPropStyleContext(GetSwImport(), nPrefix, rLocalName, xAttrList, *this, nFamily); + else + SAL_WARN("sw.xml", "Context does not exists for non automatic table, column or row style."); break; case XML_STYLE_FAMILY_SD_GRAPHICS_ID: // As long as there are no element items, we can use the text @@ -855,6 +880,9 @@ rtl::Reference < SvXMLImportPropertyMapper > SwXMLStylesContext_Impl::GetImportP else if( nFamily == XML_STYLE_FAMILY_TABLE_ROW ) xMapper = XMLTextImportHelper::CreateTableRowDefaultExtPropMapper( const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); + else if( nFamily == XML_STYLE_FAMILY_TABLE_CELL ) + xMapper = XMLTextImportHelper::CreateTableCellExtPropMapper( + const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() ); else xMapper = SvXMLStylesContext::GetImportPropertyMapper( nFamily ); return xMapper; @@ -866,7 +894,10 @@ uno::Reference < container::XNameContainer > SwXMLStylesContext_Impl::GetStylesC uno::Reference < container::XNameContainer > xStyles; if( XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily ) xStyles = const_cast<SvXMLImport *>(&GetImport())->GetTextImport()->GetFrameStyles(); - else + else if( XML_STYLE_FAMILY_TABLE_CELL == nFamily ) + xStyles = const_cast<SvXMLImport *>(&GetImport())->GetTextImport()->GetCellStyles(); + + if (!xStyles.is()) xStyles = SvXMLStylesContext::GetStylesContainer( nFamily ); return xStyles; @@ -876,6 +907,8 @@ OUString SwXMLStylesContext_Impl::GetServiceName( sal_uInt16 nFamily ) const { if( XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily ) return OUString( "com.sun.star.style.FrameStyle" ); + else if( XML_STYLE_FAMILY_TABLE_CELL == nFamily ) + return OUString( "com.sun.star.style.CellStyle" ); return SvXMLStylesContext::GetServiceName( nFamily ); } diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 59a2f24db9dd..124debfa84b1 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -1095,6 +1095,10 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd ) EncodeStyleName( pTableFormat->GetName() ) ); } + // table:template-name= + if (!rTable.GetTableStyleName().isEmpty()) + AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, rTable.GetTableStyleName()); + sal_uInt16 nPrefix = XML_NAMESPACE_TABLE; if (const SwFrameFormat* pFlyFormat = rTableNd.GetFlyFormat()) { diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index d8f0d8d7ae60..60c2327505b1 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1319,6 +1319,8 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, aName = rValue; else if( IsXMLToken( aLocalName, XML_DEFAULT_CELL_STYLE_NAME ) ) m_aDfltCellStyleName = rValue; + else if( IsXMLToken( aLocalName, XML_TEMPLATE_NAME ) ) + m_aTemplateName = rValue; } else if ( (XML_NAMESPACE_XML == nPrefix) && IsXMLToken( aLocalName, XML_ID ) ) @@ -2661,6 +2663,7 @@ void SwXMLTableContext::MakeTable() m_pTableNode->GetTable().SetRowsToRepeat( m_nHeaderRows ); m_pTableNode->GetTable().SetTableModel( !m_bHasSubTables ); + m_pTableNode->GetTable().SetTableStyleName( m_aTemplateName ); const SfxItemSet *pAutoItemSet = nullptr; if( !m_aStyleName.isEmpty() && diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx index 9acb2fde0833..04fd0b945434 100644 --- a/sw/source/filter/xml/xmltbli.hxx +++ b/sw/source/filter/xml/xmltbli.hxx @@ -49,6 +49,7 @@ class SwXMLTableContext : public XMLTextTableContext { OUString m_aStyleName; OUString m_aDfltCellStyleName; + OUString m_aTemplateName; //! Holds basic information about a column's width. struct ColumnWidthInfo { diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index 5c1b63b2e666..9aa121bdb53b 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -385,8 +385,6 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) if( bOverwrite || bNew ) { - Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY ); - rtl::Reference < XMLPropertySetMapper > xPrMap; if( xImpPrMap.is() ) xPrMap = xImpPrMap->getPropertySetMapper(); @@ -409,17 +407,20 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) if( xPropSetInfo->hasPropertyByName( rPrName ) ) aNameSet.insert( rPrName ); } - - nCount = aNameSet.size(); - Sequence<OUString> aNames( comphelper::containerToSequence<OUString>(aNameSet) ); - Sequence < PropertyState > aStates( xPropState->getPropertyStates(aNames) ); - const PropertyState *pStates = aStates.getConstArray(); - OUString* pNames = aNames.getArray(); - - for( i = 0; i < nCount; i++ ) + Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY ); + if (xPropState.is()) { - if( PropertyState_DIRECT_VALUE == *pStates++ ) - xPropState->setPropertyToDefault( pNames[i] ); + nCount = aNameSet.size(); + Sequence<OUString> aNames( comphelper::containerToSequence<OUString>(aNameSet) ); + Sequence < PropertyState > aStates( xPropState->getPropertyStates(aNames) ); + const PropertyState *pStates = aStates.getConstArray(); + OUString* pNames = aNames.getArray(); + + for( i = 0; i < nCount; i++ ) + { + if( PropertyState_DIRECT_VALUE == *pStates++ ) + xPropState->setPropertyToDefault( pNames[i] ); + } } } } diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index f0f51c7fdd09..ecf3fe023189 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -46,6 +46,7 @@ #include <xmloff/xmltypes.hxx> #include <xmloff/maptype.hxx> #include <xmloff/prhdlfac.hxx> +#include <xmloff/txtprmap.hxx> #include <tools/debug.hxx> #include "table.hxx" @@ -61,7 +62,6 @@ using namespace ::com::sun::star::style; #define MAP_(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010, false } #define CMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_COLUMN,context) #define RMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_ROW,context) -#define CELLMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_CELL,context) #define MAP_END { nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false } const XMLPropertyMapEntry* getColumnPropertiesMap() @@ -89,29 +89,6 @@ const XMLPropertyMapEntry* getRowPropertiesMap() return &aXMLRowProperties[0]; } -const XMLPropertyMapEntry* getSwCellStylePropertiesMap() -{ - static const XMLPropertyMapEntry aXMLSwCellStyleProperties[] = - { - CELLMAP( "BackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), - CELLMAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, 0 ), - CELLMAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, 0 ), - CELLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, 0 ), - CELLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, 0 ), - CELLMAP( "BorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), - CELLMAP( "LeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), - CELLMAP( "RightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), - CELLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), - CELLMAP( "BottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), - CELLMAP( "VertOrient", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_TEXT_VERTICAL_POS, 0 ), - CELLMAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ), - CELLMAP( "NumberFormat", XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER, 0 ), - MAP_END - }; - - return &aXMLSwCellStyleProperties[0]; -} - class StringStatisticHelper { private: @@ -184,7 +161,7 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExp if (mbWriter) { - mxCellExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getSwCellStylePropertiesMap(), xFactoryRef.get(), true ) ); + mxCellExportPropertySetMapper = new SvXMLExportPropertyMapper(new XMLTextPropertySetMapper(TextPropMap::CELL, true)); } else { @@ -534,6 +511,7 @@ const TableStyleElement* getTableStyleMap() { XML_ODD_ROWS, OUString("odd-rows") }, { XML_EVEN_COLUMNS, OUString("even-columns") }, { XML_ODD_COLUMNS, OUString("odd-columns") }, + { XML_BACKGROUND, OUString("background") }, { XML_TOKEN_END, OUString() } }; @@ -596,7 +574,7 @@ void XMLTableExport::exportTableTemplates() const TableStyleElement* pElements; if (mbWriter) { - mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, GetExport().EncodeStyleName(xTableStyle->getName())); + mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, xTableStyle->getName()); Reference<XPropertySet> xTableStylePropSet(xTableStyle.get(), UNO_QUERY_THROW); pElements = getWriterSpecificTableStyleAttributes(); while(pElements->meElement != XML_TOKEN_END) diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index d4b505d8bb9e..6ac15996f9d0 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/table/XTable.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <xmloff/table/XMLTableImport.hxx> @@ -37,6 +38,7 @@ #include <xmloff/prstylei.hxx> #include <xmloff/xmlnmspe.hxx> +#include <xmloff/xmluconv.hxx> #include "table.hxx" #include <osl/diagnose.h> @@ -160,6 +162,7 @@ public: virtual void EndElement() override; + virtual void CreateAndInsert( bool bOverwrite ) override; private: XMLTableTemplate maTableTemplate; OUString msTemplateStyleName; @@ -186,8 +189,37 @@ SvXMLImportContext * XMLProxyContext::CreateChildContext( sal_uInt16 nPrefix, co XMLTableImport::XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef ) : mrImport( rImport ) { - mxCellImportPropertySetMapper = new SvXMLImportPropertyMapper( xCellPropertySetMapper.get(), rImport ); - mxCellImportPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImport)); + bool bWriter = false; + // check if called by Writer + Reference<XMultiServiceFactory> xFac(rImport.GetModel(), UNO_QUERY); + if (xFac.is()) try + { + Sequence<OUString> sSNS = xFac->getAvailableServiceNames(); + const sal_Int32 nLength = sSNS.getLength(); + const OUString* pSNS = sSNS.getConstArray(); + for (sal_Int32 i=0; i < nLength; ++i, ++pSNS) + { + if (*pSNS == "com.sun.star.style.TableStyle") + { + bWriter = true; + break; + } + } + } + catch(const Exception&) + { + SAL_WARN("xmloff.table", "Error while checking avaiable service names"); + } + + if (bWriter) + { + mxCellImportPropertySetMapper = XMLTextImportHelper::CreateTableCellExtPropMapper(rImport); + } + else + { + mxCellImportPropertySetMapper = new SvXMLImportPropertyMapper( xCellPropertySetMapper.get(), rImport ); + mxCellImportPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImport)); + } rtl::Reference < XMLPropertySetMapper > xRowMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get(), false ) ); mxRowImportPropertySetMapper = new SvXMLImportPropertyMapper( xRowMapper, rImport ); @@ -218,6 +250,67 @@ void XMLTableImport::addTableTemplate( const OUString& rsStyleName, XMLTableTemp maTableTemplates[rsStyleName] = xPtr; } +void XMLTableImport::insertTabletemplate(const OUString& rsStyleName, bool bOverwrite) +{ + XMLTableTemplateMap::iterator it = maTableTemplates.find(rsStyleName); + if (it == maTableTemplates.end()) + return; + + try + { + Reference<XStyleFamiliesSupplier> xFamiliesSupp(mrImport.GetModel(), UNO_QUERY_THROW); + Reference<XNameAccess> xFamilies(xFamiliesSupp->getStyleFamilies()); + const OUString sFamilyName("TableStyles"); + const OUString sCellFamilyName("CellStyles"); + + Reference<XNameContainer> xTableFamily(xFamilies->getByName(sFamilyName), UNO_QUERY_THROW); + Reference<XIndexAccess> xCellFamily(xFamilies->getByName(sCellFamilyName), UNO_QUERY_THROW); + + const OUString sTemplateName(it->first); + Reference<XMultiServiceFactory> xFactory(mrImport.GetModel(), UNO_QUERY_THROW); + Reference<XNameReplace> xTemplate(xFactory->createInstance("com.sun.star.style.TableStyle"), UNO_QUERY_THROW); + + std::shared_ptr<XMLTableTemplate> xT(it->second); + + for (auto aStyleIter=xT->begin(); aStyleIter != xT->end(); ++aStyleIter) try + { + const OUString sPropName((*aStyleIter).first); + const OUString sStyleName((*aStyleIter).second); + // Internally unassigned cell styles are stored by display name. + // However table-template elements reference cell styles by its encoded name. + // This loop is looking for cell style by their encoded names. + sal_Int32 nCount = xCellFamily->getCount(); + for (sal_Int32 i=0; i < nCount; ++i) + { + Any xCellStyle = xCellFamily->getByIndex(i); + OUString sEncodedStyleName = mrImport.GetMM100UnitConverter().encodeStyleName( + xCellStyle.get<Reference<XStyle>>()->getName()); + if (sEncodedStyleName == sStyleName) + { + xTemplate->replaceByName(sPropName, xCellStyle); + break; + } + } + } + catch (Exception&) + { + SAL_WARN("xmloff.table", "XMLTableImport::insertTabletemplate(), exception caught!"); + } + + if (xTemplate.is()) + { + if (xTableFamily->hasByName(sTemplateName) && bOverwrite) + xTableFamily->replaceByName(sTemplateName, Any(xTemplate)); + else + xTableFamily->insertByName(sTemplateName, Any(xTemplate)); + } + } + catch (Exception&) + { + SAL_WARN("xmloff.table", "XMLTableImport::insertTabletemplate(), exception caught!"); + } +} + void XMLTableImport::finishStyles() { if( !maTableTemplates.empty() ) try @@ -692,7 +785,9 @@ void XMLTableTemplateContext::StartElement( const Reference< XAttributeList >& x { OUString sAttrName; sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( i ), &sAttrName ); - if( (nAttrPrefix == XML_NAMESPACE_TEXT ) && IsXMLToken( sAttrName, XML_STYLE_NAME ) ) + if( (nAttrPrefix == XML_NAMESPACE_TEXT && IsXMLToken( sAttrName, XML_STYLE_NAME )) + // Writer specific: according to oasis odf 1.2 prefix should be "table" and element name should be "name" + || (nAttrPrefix == XML_NAMESPACE_TABLE && IsXMLToken( sAttrName, XML_NAME ))) { msTemplateStyleName = xAttrList->getValueByIndex( i ); break; @@ -707,6 +802,13 @@ void XMLTableTemplateContext::EndElement() xTableImport->addTableTemplate( msTemplateStyleName, maTableTemplate ); } +void XMLTableTemplateContext::CreateAndInsert(bool bOverwrite) +{ + rtl::Reference<XMLTableImport> xTableImport(GetImport().GetShapeImport()->GetShapeTableImport()); + if(xTableImport.is()) + xTableImport->insertTabletemplate(msTemplateStyleName, bOverwrite); +} + SvXMLImportContext * XMLTableTemplateContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList ) { if( nPrefix == XML_NAMESPACE_TABLE ) @@ -730,6 +832,27 @@ SvXMLImportContext * XMLTableTemplateContext::CreateChildContext( sal_uInt16 nPr } } } + } else if (nPrefix == XML_NAMESPACE_LO_EXT) // Writer specific cell styles + { + const TableStyleElement* pElements = getWriterSpecificTableStyleMap(); + while ((pElements->meElement != XML_TOKEN_END) && !IsXMLToken(rLocalName, pElements->meElement )) + pElements++; + + if (pElements->meElement != XML_TOKEN_END) + { + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for (sal_Int16 i=0; i < nAttrCount; i++) + { + OUString sAttrName; + sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex( i ), &sAttrName); + if( (nAttrPrefix == XML_NAMESPACE_TEXT || nAttrPrefix == XML_NAMESPACE_TABLE) && + IsXMLToken( sAttrName, XML_STYLE_NAME ) ) + { + maTableTemplate[pElements->msStyleName] = xAttrList->getValueByIndex(i); + break; + } + } + } } return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); diff --git a/xmloff/source/table/table.hxx b/xmloff/source/table/table.hxx index 4488c97e3b27..cb00e7cb13f4 100644 --- a/xmloff/source/table/table.hxx +++ b/xmloff/source/table/table.hxx @@ -31,6 +31,7 @@ struct TableStyleElement }; extern const TableStyleElement* getTableStyleMap(); +extern const TableStyleElement* getWriterSpecificTableStyleMap(); extern const XMLPropertyMapEntry* getColumnPropertiesMap(); extern const XMLPropertyMapEntry* getRowPropertiesMap(); diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 9fb143c65887..468c31ea7f88 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -545,6 +545,7 @@ struct XMLTextImportHelper::Impl uno::Reference<container::XNameContainer> m_xNumStyles; uno::Reference<container::XNameContainer> m_xFrameStyles; uno::Reference<container::XNameContainer> m_xPageStyles; + uno::Reference<container::XNameContainer> m_xCellStyles; uno::Reference<container::XIndexReplace> m_xChapterNumbering; uno::Reference<container::XNameAccess> m_xTextFrames; uno::Reference<container::XNameAccess> m_xGraphics; @@ -679,6 +680,12 @@ XMLTextImportHelper::GetPageStyles() const return m_xImpl->m_xPageStyles; } +uno::Reference<container::XNameContainer> const& +XMLTextImportHelper::GetCellStyles() const +{ + return m_xImpl->m_xCellStyles; +} + uno::Reference<container::XIndexReplace> const& XMLTextImportHelper::GetChapterNumbering() const { @@ -969,6 +976,13 @@ XMLTextImportHelper::XMLTextImportHelper( m_xImpl->m_xPageStyles.set(xFamilies->getByName(aPageStyles), UNO_QUERY); } + + const OUString aCellStyles("CellStyles"); + if( xFamilies->hasByName( aCellStyles ) ) + { + m_xImpl->m_xCellStyles.set(xFamilies->getByName(aCellStyles), + UNO_QUERY); + } } Reference < XTextFramesSupplier > xTFS( rModel, UNO_QUERY ); @@ -1060,6 +1074,15 @@ SvXMLImportPropertyMapper* return new SvXMLImportPropertyMapper( pPropMapper, rImport ); } +SvXMLImportPropertyMapper* + XMLTextImportHelper::CreateTableCellExtPropMapper( + SvXMLImport& rImport ) +{ + XMLPropertySetMapper *pPropMapper = + new XMLTextPropertySetMapper( TextPropMap::CELL, false ); + return new SvXMLImportPropertyMapper( pPropMapper, rImport ); +} + void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor ) { m_xImpl->m_xCursor.set(rCursor); diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index dc60fae7fb8d..b6c8a02cac9d 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -70,6 +70,10 @@ using namespace ::xmloff::token; #define MR_E( a, p, l, t, c ) \ M_E_( a, p, l, (t|XML_TYPE_PROP_RUBY), c ) +// cell propertiess +#define MC_E( a, p, l, t, c ) \ + M_E_( a, p, l, (t|XML_TYPE_PROP_TABLE_CELL), c ) + // extensions import/export #define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_012_EXT_COMPAT, false } // extensions import only @@ -992,6 +996,25 @@ XMLPropertyMapEntry aXMLTableRowDefaultsMap[] = M_END() }; +XMLPropertyMapEntry aXMLCellPropMap[] = +{ + MC_E( "BackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + MC_E( "LeftBorder", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ), + MC_E( "RightBorder", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ), + MC_E( "TopBorder", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), + MC_E( "BottomBorder", FO, BORDER_BOTTOM, XML_TYPE_BORDER, 0 ), + MC_E( "BorderDistance", FO, PADDING, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), + MC_E( "LeftBorderDistance", FO, PADDING_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), + MC_E( "RightBorderDistance", FO, PADDING_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), + MC_E( "TopBorderDistance", FO, PADDING_TOP, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), + MC_E( "BottomBorderDistance", FO, PADDING_BOTTOM, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, 0 ), + MC_E( "VertOrient", STYLE, VERTICAL_ALIGN, XML_TYPE_TEXT_VERTICAL_POS, 0 ), + MC_E( "WritingMode", STYLE, WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ), + MC_E( "NumberFormat", STYLE, DATA_STYLE_NAME, XML_TYPE_NUMBER, 0 ), + + M_END() +}; + static XMLPropertyMapEntry *lcl_txtprmap_getMap( TextPropMap nType ) { XMLPropertyMapEntry *pMap = nullptr; @@ -1036,6 +1059,9 @@ static XMLPropertyMapEntry *lcl_txtprmap_getMap( TextPropMap nType ) case TextPropMap::TABLE_ROW_DEFAULTS: pMap = aXMLTableRowDefaultsMap; break; + case TextPropMap::CELL: + pMap = aXMLCellPropMap; + break; } SAL_WARN_IF( !pMap, "xmloff", "illegal map type" ); return pMap; |