1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
46 void ShapeFilterBase::setCurrentTheme(const ::oox::drawingml::ThemePtr
& pTheme
)
51 ::oox::vml::Drawing
* ShapeFilterBase::getVmlDrawing()
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()
76 /// Graphic helper for shapes, that can manage color schemes.
77 class ShapeGraphicHelper
: public GraphicHelper
80 explicit ShapeGraphicHelper( const ShapeFilterBase
& rFilter
);
81 virtual sal_Int32
getSchemeColor( sal_Int32 nToken
) const override
;
83 const ShapeFilterBase
& mrFilter
;
86 ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase
& rFilter
) :
87 GraphicHelper( rFilter
.getComponentContext(), rFilter
.getTargetFrame(), rFilter
.getStorage() ),
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;
107 mpTheme
->getClrScheme().getColor( nToken
, nColor
);
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */