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 #ifndef INCLUDED_OOX_DRAWINGML_THEME_HXX
21 #define INCLUDED_OOX_DRAWINGML_THEME_HXX
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 #include <docmodel/theme/Theme.hxx>
35 namespace com::sun::star
{
36 namespace drawing
{ class XDrawPage
; }
37 namespace xml::dom
{ class XDocument
; }
43 namespace oox::drawingml
46 struct EffectProperties
;
47 struct FillProperties
;
48 struct LineProperties
;
49 struct TextCharacterProperties
;
51 const sal_Int32 THEMED_STYLE_SUBTLE
= 1;
52 const sal_Int32 THEMED_STYLE_MODERATE
= 2;
53 const sal_Int32 THEMED_STYLE_INTENSE
= 3;
55 typedef RefVector
< FillProperties
> FillStyleList
;
56 typedef RefVector
< LineProperties
> LineStyleList
;
57 typedef RefVector
< EffectProperties
> EffectStyleList
;
58 typedef RefMap
< sal_Int32
, TextCharacterProperties
> FontScheme
;
62 class OOX_DLLPUBLIC Theme
65 void setThemeName(OUString
const& rName
) { maThemeName
= rName
; }
66 void setFormatSchemeName(OUString
const& rName
) { maFormatSchemeName
= rName
; }
67 void setFontSchemeName(OUString
const& rName
) { maFontSchemeName
= rName
; }
69 ClrScheme
& getClrScheme() { return maClrScheme
; }
70 const ClrScheme
& getClrScheme() const { return maClrScheme
; }
72 FillStyleList
& getFillStyleList() { return maFillStyleList
; }
73 const FillStyleList
& getFillStyleList() const { return maFillStyleList
; }
74 FillStyleList
& getBgFillStyleList() { return maBgFillStyleList
; }
75 const FillStyleList
& getBgFillStyleList() const { return maBgFillStyleList
; }
76 /** Returns the fill properties of the passed one-based themed style index. */
77 const FillProperties
* getFillStyle( sal_Int32 nIndex
) const;
79 LineStyleList
& getLineStyleList() { return maLineStyleList
; }
80 const LineStyleList
& getLineStyleList() const { return maLineStyleList
; }
81 /** Returns the line properties of the passed one-based themed style index. */
82 const LineProperties
* getLineStyle( sal_Int32 nIndex
) const;
84 EffectStyleList
& getEffectStyleList() { return maEffectStyleList
; }
85 const EffectStyleList
& getEffectStyleList() const { return maEffectStyleList
; }
86 const EffectProperties
* getEffectStyle( sal_Int32 nIndex
) const;
88 FontScheme
& getFontScheme() { return maFontScheme
; }
89 const FontScheme
& getFontScheme() const { return maFontScheme
; }
91 std::map
<sal_Int32
, std::vector
<std::pair
<OUString
, OUString
>>>& getSupplementalFontMap() { return maSupplementalFontMap
; }
92 std::map
<sal_Int32
, std::vector
<std::pair
<OUString
, OUString
>>> const& getSupplementalFontMap() const { return maSupplementalFontMap
; }
94 /** Returns theme font properties by scheme type (major/minor). */
95 const TextCharacterProperties
* getFontStyle( sal_Int32 nSchemeType
) const;
96 /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
97 const TextFont
* resolveFont( std::u16string_view rName
) const;
99 Shape
& getSpDef() { return maSpDef
; }
100 const Shape
& getSpDef() const { return maSpDef
; }
102 Shape
& getLnDef() { return maLnDef
; }
103 const Shape
& getLnDef() const { return maLnDef
; }
105 Shape
& getTxDef() { return maTxDef
; }
106 const Shape
& getTxDef() const { return maTxDef
; }
108 const css::uno::Reference
<css::xml::dom::XDocument
>& getFragment() const { return mxFragment
; }
109 void setFragment( const css::uno::Reference
< css::xml::dom::XDocument
>& xRef
) { mxFragment
=xRef
; }
111 void addTheme(const css::uno::Reference
<css::drawing::XDrawPage
>& xDrawPage
) const;
113 void setTheme(std::shared_ptr
<model::Theme
> const& pTheme
)
118 std::shared_ptr
<model::Theme
> const& getTheme() const
123 OUString maThemeName
;
124 OUString maFontSchemeName
;
125 OUString maFormatSchemeName
;
126 ClrScheme maClrScheme
;
127 FillStyleList maFillStyleList
;
128 FillStyleList maBgFillStyleList
;
129 LineStyleList maLineStyleList
;
130 EffectStyleList maEffectStyleList
;
131 FontScheme maFontScheme
;
132 std::map
<sal_Int32
, std::vector
<std::pair
<OUString
, OUString
>>> maSupplementalFontMap
;
136 css::uno::Reference
< css::xml::dom::XDocument
> mxFragment
;
138 std::shared_ptr
<model::Theme
> mpTheme
;
142 } // namespace oox::drawingml
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */