Line data Source code
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 "ShapeFilterBase.hxx"
21 : #include "oox/drawingml/chart/chartconverter.hxx"
22 : #include "oox/ole/vbaproject.hxx"
23 : #include "oox/drawingml/theme.hxx"
24 :
25 : namespace oox {
26 : namespace shape {
27 :
28 : using namespace ::com::sun::star;
29 :
30 1510 : ShapeFilterBase::ShapeFilterBase( const uno::Reference< uno::XComponentContext >& rxContext ) throw( uno::RuntimeException ) :
31 : XmlFilterBase( rxContext ),
32 1510 : mxChartConv( new ::oox::drawingml::chart::ChartConverter )
33 : {
34 1510 : }
35 :
36 3020 : ShapeFilterBase::~ShapeFilterBase()
37 : {
38 3020 : }
39 :
40 17908 : const ::oox::drawingml::Theme* ShapeFilterBase::getCurrentTheme() const
41 : {
42 17908 : return mpTheme.get();
43 : }
44 :
45 2404 : void ShapeFilterBase::setCurrentTheme(::oox::drawingml::ThemePtr pTheme)
46 : {
47 2404 : mpTheme = pTheme;
48 2404 : }
49 :
50 0 : ::oox::vml::Drawing* ShapeFilterBase::getVmlDrawing()
51 : {
52 0 : return 0;
53 : }
54 :
55 0 : const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles()
56 : {
57 0 : return ::oox::drawingml::table::TableStyleListPtr();
58 : }
59 :
60 344 : ::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
61 : {
62 344 : return mxChartConv.get();
63 : }
64 :
65 0 : ::oox::ole::VbaProject* ShapeFilterBase::implCreateVbaProject() const
66 : {
67 0 : return new ::oox::ole::VbaProject( getComponentContext(), getModel(), "Writer" );
68 : }
69 :
70 0 : OUString ShapeFilterBase::implGetImplementationName() const
71 : {
72 0 : return OUString();
73 : }
74 :
75 : /// Graphic helper for shapes, that can manage color schemes.
76 3016 : class ShapeGraphicHelper : public GraphicHelper
77 : {
78 : public:
79 : explicit ShapeGraphicHelper( const ShapeFilterBase& rFilter );
80 : virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const SAL_OVERRIDE;
81 : private:
82 : const ShapeFilterBase& mrFilter;
83 : };
84 :
85 1508 : ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
86 1508 : GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
87 3016 : mrFilter( rFilter )
88 : {
89 1508 : }
90 :
91 10952 : sal_Int32 ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
92 : {
93 10952 : return mrFilter.getSchemeColor( nToken );
94 : }
95 :
96 1508 : GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
97 : {
98 1508 : return new ShapeGraphicHelper( *this );
99 : }
100 :
101 10952 : sal_Int32 ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
102 : {
103 10952 : sal_Int32 nColor = 0;
104 :
105 10952 : if (mpTheme.get())
106 10952 : mpTheme->getClrScheme().getColor( nToken, nColor );
107 :
108 10952 : return nColor;
109 : }
110 :
111 : }
112 408 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|