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 : #ifndef SD_SLIDESORTER_VIEW_THEME_HXX
21 : #define SD_SLIDESORTER_VIEW_THEME_HXX
22 :
23 : #include "model/SlsVisualState.hxx"
24 :
25 : #include <vcl/bitmapex.hxx>
26 : #include <vcl/font.hxx>
27 : #include <vcl/gradient.hxx>
28 : #include <tools/color.hxx>
29 :
30 : #include <boost/shared_ptr.hpp>
31 : #include <boost/weak_ptr.hpp>
32 :
33 :
34 : namespace sd { namespace slidesorter { namespace controller {
35 : class Properties;
36 : } } }
37 :
38 : namespace sd { namespace slidesorter { namespace view {
39 :
40 : const int Theme_ToolTipDelay = 1000;
41 : const int Theme_FocusIndicatorWidth = 3;
42 :
43 : /** Collection of colors and styles that are used to paint the slide sorter
44 : view.
45 : */
46 0 : class Theme
47 : {
48 : public:
49 : Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties);
50 :
51 : /** Call this method to update some colors as response to a change of
52 : a system color change.
53 : */
54 : void Update (
55 : const ::boost::shared_ptr<controller::Properties>& rpProperties);
56 :
57 : // BitmapEx GetInsertIndicatorIcon (void) const;
58 :
59 : enum FontType {
60 : Font_PageNumber,
61 : Font_PageCount
62 : };
63 : static ::boost::shared_ptr<Font> GetFont (
64 : const FontType eType,
65 : const OutputDevice& rDevice);
66 :
67 : enum ColorType {
68 : Color_Background,
69 : Color_PageNumberDefault,
70 : Color_PageNumberHover,
71 : Color_PageNumberHighContrast,
72 : Color_PageNumberBrightBackground,
73 : Color_PageNumberDarkBackground,
74 : Color_Selection,
75 : Color_PreviewBorder,
76 : Color_PageCountFontColor,
77 : _ColorType_Size_
78 : };
79 : ColorData GetColor (const ColorType eType);
80 :
81 : enum GradientColorType {
82 : Gradient_NormalPage,
83 : Gradient_SelectedPage,
84 : Gradient_SelectedAndFocusedPage,
85 : Gradient_MouseOverPage,
86 : Gradient_MouseOverSelectedAndFocusedPage,
87 : Gradient_FocusedPage,
88 : _GradientColorType_Size_
89 : };
90 : enum GradientColorClass {
91 : Border1,
92 : Border2,
93 : Fill1,
94 : Fill2,
95 : Base
96 : };
97 : ColorData GetGradientColor (
98 : const GradientColorType eType,
99 : const GradientColorClass eClass);
100 : void SetGradient (
101 : const GradientColorType eType,
102 : const ColorData aBaseColor,
103 : const sal_Int32 nSaturationOverride,
104 : const sal_Int32 nBrightnessOverride,
105 : const sal_Int32 nFillStartOffset,
106 : const sal_Int32 nFillEndOffset,
107 : const sal_Int32 nBorderStartOffset,
108 : const sal_Int32 nBorderEndOffset);
109 :
110 : enum IconType
111 : {
112 : Icon_RawShadow,
113 : Icon_RawInsertShadow,
114 : Icon_HideSlideOverlay,
115 : Icon_FocusBorder,
116 : _IconType_Size_
117 : };
118 : const BitmapEx& GetIcon (const IconType eType);
119 :
120 : private:
121 : class GradientDescriptor
122 : {
123 : public:
124 : ColorData maBaseColor;
125 :
126 : sal_Int32 mnSaturationOverride;
127 : sal_Int32 mnBrightnessOverride;
128 :
129 : ColorData maFillColor1;
130 : ColorData maFillColor2;
131 : ColorData maBorderColor1;
132 : ColorData maBorderColor2;
133 :
134 : sal_Int32 mnFillOffset1;
135 : sal_Int32 mnFillOffset2;
136 : sal_Int32 mnBorderOffset1;
137 : sal_Int32 mnBorderOffset2;
138 : };
139 : ColorData maBackgroundColor;
140 : ColorData maPageBackgroundColor;
141 : ::std::vector<GradientDescriptor> maGradients;
142 : ::std::vector<BitmapEx> maIcons;
143 : ::std::vector<ColorData> maColor;
144 :
145 : GradientDescriptor& GetGradient (const GradientColorType eType);
146 : /** Guarded initialization of the specified icon in the maIcons
147 : container. Call only while a LocalResource object is active.
148 : */
149 : void InitializeIcon (const IconType eType, sal_uInt16 nResourceId);
150 : };
151 :
152 :
153 : } } } // end of namespace ::sd::slidesorter::view
154 :
155 : #endif
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|