diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-07-18 13:18:11 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-07-18 15:11:02 +0200 |
commit | 2455826917868a5da5ab1bb4586e067d6c968c43 (patch) | |
tree | 114e31c804a5becc7a6e0d38bde0a7a64a29bf77 /include/xmloff | |
parent | 4adc868328e958a4a9cead3731bd3468497c97c8 (diff) |
xmloff: move XMLComplexColor* import/export classes to public include
Change-Id: I52aad31f63858eba905481812cbf971493252642
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154570
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/xmloff')
-rw-r--r-- | include/xmloff/XMLComplexColorContext.hxx | 34 | ||||
-rw-r--r-- | include/xmloff/XMLComplexColorExport.hxx | 31 | ||||
-rw-r--r-- | include/xmloff/XMLComplexColorHandler.hxx | 45 | ||||
-rw-r--r-- | include/xmloff/XMLElementPropertyContext.hxx | 51 |
4 files changed, 161 insertions, 0 deletions
diff --git a/include/xmloff/XMLComplexColorContext.hxx b/include/xmloff/XMLComplexColorContext.hxx new file mode 100644 index 000000000000..cbb785994169 --- /dev/null +++ b/include/xmloff/XMLComplexColorContext.hxx @@ -0,0 +1,34 @@ +/* -*- 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/dllapi.h> +#include <memory> +#include <xmloff/XMLElementPropertyContext.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> + +class XMLOFF_DLLPUBLIC XMLComplexColorContext final : public XMLElementPropertyContext +{ + model::ComplexColor maComplexColor; + sal_Int32 mnRootElement; + +public: + XMLComplexColorContext(SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList, + const XMLPropertyState& rProp, std::vector<XMLPropertyState>& rProps); + + css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList>& AttrList) override; + + void SAL_CALL endFastElement(sal_Int32 nElement) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLComplexColorExport.hxx b/include/xmloff/XMLComplexColorExport.hxx new file mode 100644 index 000000000000..28911737ff89 --- /dev/null +++ b/include/xmloff/XMLComplexColorExport.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 <xmloff/dllapi.h> +#include <sal/types.h> +#include <rtl/ustring.hxx> + +namespace com::sun::star::uno +{ +class Any; +} +class SvXMLExport; + +class XMLOFF_DLLPUBLIC XMLComplexColorExport +{ + SvXMLExport& mrExport; + +public: + XMLComplexColorExport(SvXMLExport& rExport); + + void exportXML(const css::uno::Any& rAny, sal_uInt16 nPrefix, const OUString& rLocalName); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLComplexColorHandler.hxx b/include/xmloff/XMLComplexColorHandler.hxx new file mode 100644 index 000000000000..8d40c8459f30 --- /dev/null +++ b/include/xmloff/XMLComplexColorHandler.hxx @@ -0,0 +1,45 @@ +/* -*- 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/dllapi.h> +#include <docmodel/uno/UnoComplexColor.hxx> + +using namespace ::xmloff::token; +using namespace css; + +class XMLOFF_DLLPUBLIC XMLComplexColorHandler : public XMLPropertyHandler +{ +public: + bool importXML(const OUString& /*rStrImpValue*/, css::uno::Any& /*rValue*/, + const SvXMLUnitConverter&) const override + { + return false; + } + + bool exportXML(OUString& /*rStrExpValue*/, const css::uno::Any& /*rValue*/, + const SvXMLUnitConverter&) const override + { + return false; + } + + bool equals(const css::uno::Any& rAny1, const css::uno::Any& rAny2) const override + { + uno::Reference<util::XComplexColor> xComplexColor1; + uno::Reference<util::XComplexColor> xComplexColor2; + rAny1 >>= xComplexColor1; + rAny2 >>= xComplexColor2; + model::ComplexColor aComplexColor1 = model::color::getFromXComplexColor(xComplexColor1); + model::ComplexColor aComplexColor2 = model::color::getFromXComplexColor(xComplexColor2); + return aComplexColor1 == aComplexColor2; + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLElementPropertyContext.hxx b/include/xmloff/XMLElementPropertyContext.hxx new file mode 100644 index 000000000000..70b915f17f59 --- /dev/null +++ b/include/xmloff/XMLElementPropertyContext.hxx @@ -0,0 +1,51 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmlictxt.hxx> +#include <xmloff/maptype.hxx> + +class SvXMLImport; + + +class XMLElementPropertyContext : public SvXMLImportContext +{ + bool bInsert; + +protected: + + ::std::vector< XMLPropertyState > &rProperties; + XMLPropertyState aProp; + + void SetInsert( bool bIns ) { bInsert = bIns; } + +public: + + XMLElementPropertyContext( SvXMLImport& rImport, sal_Int32 nElement, + XMLPropertyState aProp, + ::std::vector< XMLPropertyState > &rProps ); + + virtual ~XMLElementPropertyContext() override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |