diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-12-06 17:33:44 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-01-01 23:35:17 +0000 |
commit | 312100003fc7cae358038aaec853584782c698f8 (patch) | |
tree | 50c9dbedad29c04539c44880bd238c9015f1dabe /include | |
parent | d5a71bc6a28f8a3d726b2ac4688c7cef9d77ddf0 (diff) |
sw: read theme from OOXML file and set it to the draw page
This change extends writerfilter to use oox::ThemeFragmentHandler
to read the theme properties, and sets that to the one and only
draw page of a Writer document.
This change also removes ThemeTable and replaces it with the
ThemeHandler, which takes theme font data from svx::Theme
instead.
In addition, a test has been writen, which loads a document with
a theme, and asserts the draw page has the theme and the theme
properties currently supported.
Change-Id: Iff0048cd21ea030ac55287707852acc463ec3cb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143699
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/oox/drawingml/ThemeFilterBase.hxx | 58 | ||||
-rw-r--r-- | include/oox/drawingml/themefragmenthandler.hxx | 1 |
2 files changed, 59 insertions, 0 deletions
diff --git a/include/oox/drawingml/ThemeFilterBase.hxx b/include/oox/drawingml/ThemeFilterBase.hxx new file mode 100644 index 000000000000..7f311e206a90 --- /dev/null +++ b/include/oox/drawingml/ThemeFilterBase.hxx @@ -0,0 +1,58 @@ +/* -*- 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 <memory> +#include <oox/dllapi.h> +#include <oox/core/xmlfilterbase.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <rtl/ref.hxx> + +namespace oox::drawingml +{ +class OOX_DLLPUBLIC ThemeFilterBase final : public core::XmlFilterBase +{ +public: + typedef rtl::Reference<ThemeFilterBase> Pointer_t; + + explicit ThemeFilterBase(css::uno::Reference<css::uno::XComponentContext> const& rxContext); + + virtual ~ThemeFilterBase() override; + + /** Has to be implemented by each filter, returns the current theme. */ + virtual const oox::drawingml::Theme* getCurrentTheme() const override; + + /** May be implemented by filters which handle Diagrams, default returns empty ptr */ + virtual std::shared_ptr<oox::drawingml::Theme> getCurrentThemePtr() const override; + + void setCurrentTheme(const oox::drawingml::ThemePtr& pTheme); + + /** Has to be implemented by each filter to return the collection of VML shapes. */ + virtual oox::vml::Drawing* getVmlDrawing() override; + + /** Has to be implemented by each filter to return TableStyles. */ + virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override; + + virtual oox::drawingml::chart::ChartConverter* getChartConverter() override; + + virtual oox::ole::VbaProject* implCreateVbaProject() const override; + + virtual bool importDocument() override { return true; } + virtual bool exportDocument() override { return false; } + +private: + virtual OUString SAL_CALL getImplementationName() override; + + oox::drawingml::ThemePtr mpTheme; +}; + +} // namespace oox::drawingml + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx index e433c350de80..918a3eb861b9 100644 --- a/include/oox/drawingml/themefragmenthandler.hxx +++ b/include/oox/drawingml/themefragmenthandler.hxx @@ -44,6 +44,7 @@ public: virtual ~ThemeFragmentHandler() override; virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + void onStartElement(const AttributeList& rAttribs) override; private: Theme& mrTheme; |