Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / shape / ShapeFilterBase.cxx
blob1f8b78a93230db7f1d613d6865ef78e15759f1e4
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 "ShapeFilterBase.hxx"
21 #include "oox/drawingml/chart/chartconverter.hxx"
22 #include <oox/helper/graphichelper.hxx>
23 #include "oox/ole/vbaproject.hxx"
24 #include "oox/drawingml/theme.hxx"
26 namespace oox {
27 namespace shape {
29 using namespace ::com::sun::star;
31 ShapeFilterBase::ShapeFilterBase( const uno::Reference< uno::XComponentContext >& rxContext ) :
32 XmlFilterBase( rxContext ),
33 mxChartConv( new ::oox::drawingml::chart::ChartConverter )
37 ShapeFilterBase::~ShapeFilterBase()
41 const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
43 return mpTheme.get();
46 void ShapeFilterBase::setCurrentTheme(const ::oox::drawingml::ThemePtr& pTheme)
48 mpTheme = pTheme;
51 ::oox::vml::Drawing* ShapeFilterBase::getVmlDrawing()
53 return nullptr;
56 const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles()
58 return ::oox::drawingml::table::TableStyleListPtr();
61 ::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
63 return mxChartConv.get();
66 ::oox::ole::VbaProject* ShapeFilterBase::implCreateVbaProject() const
68 return new ::oox::ole::VbaProject( getComponentContext(), getModel(), "Writer" );
71 OUString ShapeFilterBase::getImplementationName()
73 return OUString();
76 /// Graphic helper for shapes, that can manage color schemes.
77 class ShapeGraphicHelper : public GraphicHelper
79 public:
80 explicit ShapeGraphicHelper( const ShapeFilterBase& rFilter );
81 virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const override;
82 private:
83 const ShapeFilterBase& mrFilter;
86 ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
87 GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
88 mrFilter( rFilter )
92 sal_Int32 ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
94 return mrFilter.getSchemeColor( nToken );
97 GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
99 return new ShapeGraphicHelper( *this );
102 sal_Int32 ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
104 sal_Int32 nColor = 0;
106 if (mpTheme.get())
107 mpTheme->getClrScheme().getColor( nToken, nColor );
109 return nColor;
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */