Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / oox / source / shape / ShapeFilterBase.cxx
blobad10c4fe670daea74972994e92176fb97a5133d9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_wasm_strip.h>
22 #include <oox/shape/ShapeFilterBase.hxx>
23 #include <oox/drawingml/chart/chartconverter.hxx>
24 #include <oox/drawingml/themefragmenthandler.hxx>
25 #include <oox/helper/graphichelper.hxx>
26 #include <oox/ole/vbaproject.hxx>
27 #include <oox/drawingml/theme.hxx>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/frame/XModel.hpp>
31 #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
33 namespace oox::shape {
35 using namespace ::com::sun::star;
37 ShapeFilterBase::ShapeFilterBase( const uno::Reference< uno::XComponentContext >& rxContext ) :
38 XmlFilterBase( rxContext ),
39 #if ENABLE_WASM_STRIP_CHART
40 // WASM_CHART change
41 mxChartConv( )
42 #else
43 mxChartConv( std::make_shared<::oox::drawingml::chart::ChartConverter>() )
44 #endif
48 ShapeFilterBase::~ShapeFilterBase()
52 const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
54 return mpTheme.get();
57 std::shared_ptr<::oox::drawingml::Theme> ShapeFilterBase::getCurrentThemePtr() const
59 return mpTheme;
62 void ShapeFilterBase::setCurrentTheme(const ::oox::drawingml::ThemePtr& pTheme)
64 mpTheme = pTheme;
67 ::oox::vml::Drawing* ShapeFilterBase::getVmlDrawing()
69 return nullptr;
72 ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles()
74 return ::oox::drawingml::table::TableStyleListPtr();
77 ::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
79 return mxChartConv.get();
82 ::oox::ole::VbaProject* ShapeFilterBase::implCreateVbaProject() const
84 return new ::oox::ole::VbaProject( getComponentContext(), getModel(), u"Writer" );
87 OUString ShapeFilterBase::getImplementationName()
89 return OUString();
92 namespace {
94 /// Graphic helper for shapes, that can manage color schemes.
95 class ShapeGraphicHelper : public GraphicHelper
97 public:
98 explicit ShapeGraphicHelper( const ShapeFilterBase& rFilter );
99 virtual ::Color getSchemeColor( sal_Int32 nToken ) const override;
100 private:
101 const ShapeFilterBase& mrFilter;
106 ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
107 GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
108 mrFilter( rFilter )
112 ::Color ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
114 return mrFilter.getSchemeColor( nToken );
117 GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
119 GraphicHelper* pGraphicHelper = new ShapeGraphicHelper(*this);
120 if (mxGraphicMapper.is())
121 pGraphicHelper->setGraphicMapper(mxGraphicMapper);
122 return pGraphicHelper;
125 ::Color ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
127 ::Color nColor;
129 if (mpTheme)
130 mpTheme->getClrScheme().getColor( nToken, nColor );
132 return nColor;
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */