xmloff: fix import of CharComplexColor - add StylePropertiesContext
Import of CharComplexColor in Calc didn't work because the class XMLComplexColorContext wasn't used. This introduces a new class StylePropertiesContext, because the plain SvXMLPropertySetContext is not enough as we can't define to use XMLComplexColorContext when XML_CHAR_COMPLEX_COLOR is used on that class. Also adds a import/export test for CharComplexColor. Change-Id: I765ac71a801a5e9bcb105aaea73637df5e601b85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155008 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
d16d86685a
commit
b543463f63
7 changed files with 95 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 \
|
||||
|
|
44
xmloff/source/style/StylePropertiesContext.cxx
Normal file
44
xmloff/source/style/StylePropertiesContext.cxx
Normal file
|
@ -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 <tools/debug.hxx>
|
||||
#include <xmloff/xmlnamespace.hxx>
|
||||
#include <xmloff/xmltypes.hxx>
|
||||
#include <xmloff/xmlimp.hxx>
|
||||
|
||||
#include <xmloff/XMLComplexColorContext.hxx>
|
||||
|
||||
using namespace xmloff::token;
|
||||
|
||||
StylePropertiesContext::StylePropertiesContext(
|
||||
SvXMLImport& rImport, sal_Int32 nElement,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList, sal_uInt32 nFamily,
|
||||
std::vector<XMLPropertyState>& rProps, const rtl::Reference<SvXMLImportPropertyMapper>& rMap)
|
||||
: SvXMLPropertySetContext(rImport, nElement, xAttrList, nFamily, rProps, rMap)
|
||||
{
|
||||
}
|
||||
|
||||
StylePropertiesContext::~StylePropertiesContext() {}
|
||||
|
||||
css::uno::Reference<css::xml::sax::XFastContextHandler>
|
||||
StylePropertiesContext::createFastChildContext(
|
||||
sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
|
||||
std::vector<XMLPropertyState>& 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: */
|
31
xmloff/source/style/StylePropertiesContext.hxx
Normal file
31
xmloff/source/style/StylePropertiesContext.hxx
Normal file
|
@ -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 <xmloff/xmlprcon.hxx>
|
||||
|
||||
class StylePropertiesContext : public SvXMLPropertySetContext
|
||||
{
|
||||
public:
|
||||
StylePropertiesContext(SvXMLImport& rImport, sal_Int32 nElement,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
|
||||
sal_uInt32 nFamily, std::vector<XMLPropertyState>& rProps,
|
||||
const rtl::Reference<SvXMLImportPropertyMapper>& rMap);
|
||||
|
||||
virtual ~StylePropertiesContext() override;
|
||||
|
||||
using SvXMLPropertySetContext::createFastChildContext;
|
||||
|
||||
virtual css::uno::Reference<css::xml::sax::XFastContextHandler> createFastChildContext(
|
||||
sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
|
||||
std::vector<XMLPropertyState>& rProperties, const XMLPropertyState& rProperty) override;
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -56,6 +56,7 @@
|
|||
#include <XMLRectangleMembersHandler.hxx>
|
||||
#include <XMLNumberWithAutoForVoidPropHdl.hxx>
|
||||
#include "DrawAspectHdl.hxx"
|
||||
#include <xmloff/XMLComplexColorHandler.hxx>
|
||||
|
||||
#include <map>
|
||||
|
||||
|
@ -474,7 +475,9 @@ std::unique_ptr<XMLPropertyHandler> 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;
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <xmloff/xmlprmap.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <com/sun/star/drawing/FillStyle.hpp>
|
||||
#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;
|
||||
|
|
Loading…
Reference in a new issue