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 #ifndef INCLUDED_OOX_DRAWINGML_THEME_HXX
21 #define INCLUDED_OOX_DRAWINGML_THEME_HXX
22 
23 #include <functional>
24 
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <oox/drawingml/clrscheme.hxx>
27 #include <oox/drawingml/shape.hxx>
28 #include <oox/dllapi.h>
29 #include <oox/helper/refmap.hxx>
30 #include <oox/helper/refvector.hxx>
31 #include <rtl/ustring.hxx>
32 #include <sal/types.h>
33 
34 namespace com::sun::star {
35     namespace xml::dom { class XDocument; }
36 }
37 
38 namespace oox::drawingml {
39 
40 struct EffectProperties;
41 struct FillProperties;
42 struct LineProperties;
43 struct TextCharacterProperties;
44 
45 const sal_Int32 THEMED_STYLE_SUBTLE     = 1;
46 const sal_Int32 THEMED_STYLE_MODERATE   = 2;
47 const sal_Int32 THEMED_STYLE_INTENSE    = 3;
48 
49 typedef RefVector< FillProperties >                     FillStyleList;
50 typedef RefVector< LineProperties >                     LineStyleList;
51 typedef RefVector< EffectProperties >                   EffectStyleList;
52 typedef RefMap< sal_Int32, TextCharacterProperties >    FontScheme;
53 
54 class TextFont;
55 
56 class OOX_DLLPUBLIC Theme
57 {
58 public:
setStyleName(const OUString & rStyleName)59     void                     setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
60 
getClrScheme()61     ClrScheme&               getClrScheme() { return maClrScheme; }
getClrScheme() const62     const ClrScheme&         getClrScheme() const { return maClrScheme; }
63 
getFillStyleList()64     FillStyleList&           getFillStyleList() { return maFillStyleList; }
getFillStyleList() const65     const FillStyleList&     getFillStyleList() const { return maFillStyleList; }
getBgFillStyleList()66     FillStyleList&           getBgFillStyleList() { return maBgFillStyleList; }
getBgFillStyleList() const67     const FillStyleList&     getBgFillStyleList() const { return maBgFillStyleList; }
68     /** Returns the fill properties of the passed one-based themed style index. */
69     const FillProperties*           getFillStyle( sal_Int32 nIndex ) const;
70 
getLineStyleList()71     LineStyleList&           getLineStyleList() { return maLineStyleList; }
getLineStyleList() const72     const LineStyleList&     getLineStyleList() const { return maLineStyleList; }
73     /** Returns the line properties of the passed one-based themed style index. */
74     const LineProperties*           getLineStyle( sal_Int32 nIndex ) const;
75 
getEffectStyleList()76     EffectStyleList&         getEffectStyleList() { return maEffectStyleList; }
getEffectStyleList() const77     const EffectStyleList&   getEffectStyleList() const { return maEffectStyleList; }
78     const EffectProperties*         getEffectStyle( sal_Int32 nIndex ) const;
79 
getFontScheme()80     FontScheme&              getFontScheme() { return maFontScheme; }
getFontScheme() const81     const FontScheme&        getFontScheme() const { return maFontScheme; }
82     /** Returns theme font properties by scheme type (major/minor). */
83     const TextCharacterProperties*  getFontStyle( sal_Int32 nSchemeType ) const;
84     /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
85     const TextFont*                 resolveFont( const OUString& rName ) const;
86 
getSpDef()87     Shape&                   getSpDef() { return maSpDef; }
getSpDef() const88     const Shape&             getSpDef() const { return maSpDef; }
89 
getLnDef()90     Shape&                   getLnDef() { return maLnDef; }
getLnDef() const91     const Shape&             getLnDef() const { return maLnDef; }
92 
getTxDef()93     Shape&                   getTxDef() { return maTxDef; }
getTxDef() const94     const Shape&             getTxDef() const { return maTxDef; }
95 
getFragment() const96     const css::uno::Reference<css::xml::dom::XDocument>& getFragment() const { return mxFragment; }
setFragment(const css::uno::Reference<css::xml::dom::XDocument> & xRef)97     void                     setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
98 
99 private:
100     OUString            maStyleName;
101     ClrScheme           maClrScheme;
102     FillStyleList       maFillStyleList;
103     FillStyleList       maBgFillStyleList;
104     LineStyleList       maLineStyleList;
105     EffectStyleList     maEffectStyleList;
106     FontScheme          maFontScheme;
107     Shape               maSpDef;
108     Shape               maLnDef;
109     Shape               maTxDef;
110     css::uno::Reference< css::xml::dom::XDocument> mxFragment;
111 };
112 
113 
114 } // namespace oox::drawingml
115 
116 #endif
117 
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
119