LibreOffice Module oox (master) 1
ShapeFilterBase.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <config_wasm_strip.h>
21
28
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>
32
33namespace oox::shape {
34
35using namespace ::com::sun::star;
36
37ShapeFilterBase::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
45{
46}
47
49{
50}
51
52const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
53{
54 return mpTheme.get();
55}
56
57std::shared_ptr<::oox::drawingml::Theme> ShapeFilterBase::getCurrentThemePtr() const
58{
59 return mpTheme;
60}
61
63{
64 mpTheme = pTheme;
65}
66
68{
69 return nullptr;
70}
71
73{
75}
76
78{
79 return mxChartConv.get();
80}
81
83{
84 return new ::oox::ole::VbaProject( getComponentContext(), getModel(), u"Writer" );
85}
86
88{
89 return OUString();
90}
91
92namespace {
93
95class ShapeGraphicHelper : public GraphicHelper
96{
97public:
98 explicit ShapeGraphicHelper( const ShapeFilterBase& rFilter );
99 virtual ::Color getSchemeColor( sal_Int32 nToken ) const override;
100private:
101 const ShapeFilterBase& mrFilter;
102};
103
104}
105
106ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
107 GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
108 mrFilter( rFilter )
109{
110}
111
112::Color ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
113{
114 return mrFilter.getSchemeColor( nToken );
115}
116
117GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
118{
119 GraphicHelper* pGraphicHelper = new ShapeGraphicHelper(*this);
120 if (mxGraphicMapper.is())
121 pGraphicHelper->setGraphicMapper(mxGraphicMapper);
122 return pGraphicHelper;
123}
124
125::Color ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
126{
127 ::Color nColor;
128
129 if (mpTheme)
130 mpTheme->getClrScheme().getColor( nToken, nColor );
131
132 return nColor;
133}
134
135}
136
137/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const ShapeFilterBase & mrFilter
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
void setGraphicMapper(css::uno::Reference< css::graphic::XGraphicMapper > const &rxGraphicMapper)
const css::uno::Reference< css::frame::XModel > & getModel() const
Returns the document model (always existing).
Definition: filterbase.cxx:220
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
Returns the component context passed in the filter constructor (always existing).
Definition: filterbase.cxx:215
virtual ::oox::ole::VbaProject * implCreateVbaProject() const override
Derived classes create a VBA project manager object.
virtual ::oox::vml::Drawing * getVmlDrawing() override
Has to be implemented by each filter to return the collection of VML shapes.
::oox::drawingml::ThemePtr mpTheme
std::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv
virtual std::shared_ptr<::oox::drawingml::Theme > getCurrentThemePtr() const override
May be implemented by filters which handle Diagrams, default returns empty ptr.
ShapeFilterBase(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual OUString SAL_CALL getImplementationName() override
virtual ~ShapeFilterBase() override
virtual const ::oox::drawingml::Theme * getCurrentTheme() const override
Has to be implemented by each filter, returns the current theme.
virtual ::oox::drawingml::table::TableStyleListPtr getTableStyles() override
Has to be implemented by each filter to return TableStyles.
virtual ::oox::drawingml::chart::ChartConverter * getChartConverter() override
Has to be implemented by each filter, returns a filter-specific chart converter object,...
void setCurrentTheme(const ::oox::drawingml::ThemePtr &pTheme)
Represents the collection of VML shapes for a complete draw page.
Definition: vmldrawing.hxx:94
float u
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
std::shared_ptr< T > make_shared(Args &&... args)
std::shared_ptr< TableStyleList > TableStyleListPtr
std::shared_ptr< Theme > ThemePtr
DefTokenId nToken