diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 9164d41668f1..09e4288b8a4f 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -213,6 +213,16 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellTextThemeColor) checkCellTextThemeColor(getScDoc()); } +CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellTextThemeColorODF) +{ + // Open the OOXML source + loadFromURL(u"xlsx/Test_ThemeColor_Text_Background_Border.xlsx"); + // Save as ODF and load again - checks import / export cycle + saveAndReload("calc8"); + // Check the values and show that the document is unchanged and all the data preserved + checkCellTextThemeColor(getScDoc()); +} + void checkCellBorderThemeColor(ScDocument* pDoc) { // C1 diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index bb38d305b9a3..9e5fb1598308 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -908,11 +908,6 @@ const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nTy pHdl = new XmlScPropHdl_Vertical; } break; - case XML_TYPE_COMPLEX_COLOR: - { - pHdl = new XMLComplexColorHandler; - } - break; } if(pHdl) diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 8e7f3208bfe9..2bad53c2130a 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -234,6 +234,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/style/PagePropertySetContext \ xmloff/source/style/SinglePropertySetInfoCache \ xmloff/source/style/StyleMap \ + xmloff/source/style/StylePropertiesContext \ xmloff/source/style/TransGradientStyle \ xmloff/source/style/WordWrapPropertyHdl \ xmloff/source/style/XMLBackgroundImageContext \ diff --git a/xmloff/source/style/StylePropertiesContext.cxx b/xmloff/source/style/StylePropertiesContext.cxx new file mode 100644 index 000000000000..1bda191485e6 --- /dev/null +++ b/xmloff/source/style/StylePropertiesContext.cxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "StylePropertiesContext.hxx" + +#include +#include +#include +#include + +#include + +using namespace xmloff::token; + +StylePropertiesContext::StylePropertiesContext( + SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference& xAttrList, sal_uInt32 nFamily, + std::vector& rProps, const rtl::Reference& rMap) + : SvXMLPropertySetContext(rImport, nElement, xAttrList, nFamily, rProps, rMap) +{ +} + +StylePropertiesContext::~StylePropertiesContext() {} + +css::uno::Reference +StylePropertiesContext::createFastChildContext( + sal_Int32 nElement, const css::uno::Reference& xAttrList, + std::vector& rProperties, const XMLPropertyState& rProperty) +{ + if (nElement == XML_ELEMENT(LO_EXT, XML_CHAR_COMPLEX_COLOR)) + { + return new XMLComplexColorContext(GetImport(), nElement, xAttrList, rProperty, rProperties); + } + return SvXMLPropertySetContext::createFastChildContext(nElement, xAttrList, rProperties, + rProperty); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/StylePropertiesContext.hxx b/xmloff/source/style/StylePropertiesContext.hxx new file mode 100644 index 000000000000..6fa3ef8703d9 --- /dev/null +++ b/xmloff/source/style/StylePropertiesContext.hxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include + +class StylePropertiesContext : public SvXMLPropertySetContext +{ +public: + StylePropertiesContext(SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference& xAttrList, + sal_uInt32 nFamily, std::vector& rProps, + const rtl::Reference& rMap); + + virtual ~StylePropertiesContext() override; + + using SvXMLPropertySetContext::createFastChildContext; + + virtual css::uno::Reference createFastChildContext( + sal_Int32 nElement, const css::uno::Reference& xAttrList, + std::vector& rProperties, const XMLPropertyState& rProperty) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx index 5ff7172834e4..a3ab3290bef2 100644 --- a/xmloff/source/style/prhdlfac.cxx +++ b/xmloff/source/style/prhdlfac.cxx @@ -56,6 +56,7 @@ #include #include #include "DrawAspectHdl.hxx" +#include #include @@ -474,7 +475,9 @@ std::unique_ptr XMLPropertyHandlerFactory::CreatePropertyHan pPropHdl.reset(new XMLNamedBoolPropertyHdl(GetXMLToken(XML_CLIP), GetXMLToken(XML_AUTO_CREATE_NEW_FRAME))); break; - + case XML_TYPE_COMPLEX_COLOR: + pPropHdl.reset(new XMLComplexColorHandler); + break; } return pPropHdl; diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index c688a3a24b31..ec5f2d7d8d85 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -43,6 +43,7 @@ #include #include #include +#include "StylePropertiesContext.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -208,12 +209,10 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLPropStyleContext::c { rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = mxStyles->GetImportPropertyMapper( GetFamily() ); - if( xImpPrMap.is() ) - return new SvXMLPropertySetContext( GetImport(), nElement, - xAttrList, - nFamily, - maProperties, - xImpPrMap ); + if (xImpPrMap.is()) + { + return new StylePropertiesContext(GetImport(), nElement, xAttrList, nFamily, maProperties, xImpPrMap); + } } XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); return nullptr;