1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SD_SLIDESORTER_VIEW_THEME_HXX 25 #define SD_SLIDESORTER_VIEW_THEME_HXX 26 27 #include "model/SlsVisualState.hxx" 28 29 #include <vcl/bitmapex.hxx> 30 #include <vcl/font.hxx> 31 #include <vcl/gradient.hxx> 32 #include <tools/color.hxx> 33 34 #include <boost/shared_ptr.hpp> 35 #include <boost/weak_ptr.hpp> 36 37 38 namespace sd { namespace slidesorter { namespace controller { 39 class Properties; 40 } } } 41 42 namespace sd { namespace slidesorter { namespace view { 43 44 45 /** Collection of colors and styles that are used to paint the slide sorter 46 view. 47 */ 48 class Theme 49 { 50 public: 51 Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties); 52 53 /** Call this method to update some colors as response to a change of 54 a system color change. 55 */ 56 void Update ( 57 const ::boost::shared_ptr<controller::Properties>& rpProperties); 58 59 // BitmapEx GetInsertIndicatorIcon (void) const; 60 61 enum FontType { 62 Font_PageNumber, 63 Font_PageCount, 64 Font_Button 65 }; 66 static ::boost::shared_ptr<Font> GetFont ( 67 const FontType eType, 68 const OutputDevice& rDevice); 69 70 enum ColorType { 71 Color_Background, 72 Color_ButtonBackground, 73 Color_ButtonText, 74 Color_ButtonTextHover, 75 Color_PageNumberDefault, 76 Color_PageNumberHover, 77 Color_PageNumberHighContrast, 78 Color_PageNumberBrightBackground, 79 Color_PageNumberDarkBackground, 80 Color_Selection, 81 Color_PreviewBorder, 82 Color_PageCountFontColor, 83 _ColorType_Size_ 84 }; 85 ColorData GetColor (const ColorType eType); 86 void SetColor (const ColorType eType, const ColorData aColorData); 87 88 enum GradientColorType { 89 Gradient_NormalPage, 90 Gradient_SelectedPage, 91 Gradient_SelectedAndFocusedPage, 92 Gradient_MouseOverPage, 93 Gradient_MouseOverSelectedAndFocusedPage, 94 Gradient_FocusedPage, 95 Gradient_ButtonBackground, 96 _GradientColorType_Size_ 97 }; 98 enum GradientColorClass { 99 Border1, 100 Border2, 101 Fill1, 102 Fill2, 103 Base 104 }; 105 ColorData GetGradientColor ( 106 const GradientColorType eType, 107 const GradientColorClass eClass); 108 sal_Int32 GetGradientOffset ( 109 const GradientColorType eType, 110 const GradientColorClass eClass); 111 void SetGradient ( 112 const GradientColorType eType, 113 const ColorData aBaseColor, 114 const sal_Int32 nSaturationOverride, 115 const sal_Int32 nBrightnessOverride, 116 const sal_Int32 nFillStartOffset, 117 const sal_Int32 nFillEndOffset, 118 const sal_Int32 nBorderStartOffset, 119 const sal_Int32 nBorderEndOffset); 120 sal_Int32 GetGradientSaturationOverride (const GradientColorType eType); 121 sal_Int32 GetGradientBrightnessOverride (const GradientColorType eType); 122 void SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue); 123 void SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue); 124 125 enum IconType 126 { 127 Icon_RawShadow, 128 Icon_RawInsertShadow, 129 Icon_HideSlideOverlay, 130 Icon_FocusBorder, 131 Icon_ButtonBarLarge, 132 Icon_ButtonBarMedium, 133 Icon_ButtonBarSmall, 134 Icon_Command1Large, 135 Icon_Command1LargeHover, 136 Icon_Command1Medium, 137 Icon_Command1MediumHover, 138 Icon_Command1Small, 139 Icon_Command1SmallHover, 140 Icon_Command2Large, 141 Icon_Command2LargeHover, 142 Icon_Command2Medium, 143 Icon_Command2MediumHover, 144 Icon_Command2Small, 145 Icon_Command2SmallHover, 146 Icon_Command2BLarge, 147 Icon_Command2BLargeHover, 148 Icon_Command2BMedium, 149 Icon_Command2BMediumHover, 150 Icon_Command2BSmall, 151 Icon_Command2BSmallHover, 152 Icon_Command3Large, 153 Icon_Command3LargeHover, 154 Icon_Command3Medium, 155 Icon_Command3MediumHover, 156 Icon_Command3Small, 157 Icon_Command3SmallHover, 158 _IconType_Size_ 159 }; 160 const BitmapEx& GetIcon (const IconType eType); 161 162 enum IntegerValueType 163 { 164 Integer_ButtonCornerRadius, 165 Integer_ButtonMaxAlpha, 166 Integer_ButtonBarMaxAlpha, 167 Integer_ButtonPaintType, 168 Integer_ButtonBorder, 169 Integer_ButtonGap, 170 Integer_ButtonFadeInDelay, 171 Integer_ButtonFadeInDuration, 172 Integer_ButtonFadeOutDelay, 173 Integer_ButtonFadeOutDuration, 174 Integer_ToolTipDelay, 175 Integer_FocusIndicatorWidth, 176 _IntegerValueType_Size_ 177 }; 178 sal_Int32 GetIntegerValue (const IntegerValueType eType) const; 179 void SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue); 180 181 enum StringType 182 { 183 String_Unhide, 184 String_DragAndDropPages, 185 String_DragAndDropSlides, 186 String_Command1, 187 String_Command2, 188 String_Command2B, 189 String_Command3, 190 _StringType_Size_ 191 }; 192 ::rtl::OUString GetString (const StringType eType) const; 193 194 private: 195 bool mbIsHighContrastMode; 196 class GradientDescriptor 197 { 198 public: 199 ColorData maBaseColor; 200 201 sal_Int32 mnSaturationOverride; 202 sal_Int32 mnBrightnessOverride; 203 204 ColorData maFillColor1; 205 ColorData maFillColor2; 206 ColorData maBorderColor1; 207 ColorData maBorderColor2; 208 209 sal_Int32 mnFillOffset1; 210 sal_Int32 mnFillOffset2; 211 sal_Int32 mnBorderOffset1; 212 sal_Int32 mnBorderOffset2; 213 }; 214 ColorData maBackgroundColor; 215 ColorData maPageBackgroundColor; 216 ::std::vector<GradientDescriptor> maGradients; 217 ::std::vector<BitmapEx> maIcons; 218 ::std::vector<ColorData> maColor; 219 ::std::vector<sal_Int32> maIntegerValues; 220 ::std::vector<rtl::OUString> maStrings; 221 222 GradientDescriptor& GetGradient (const GradientColorType eType); 223 /** Guarded initialization of the specified icon in the maIcons 224 container. Call only while a LocalResource object is active. 225 */ 226 void InitializeIcon (const IconType eType, sal_uInt16 nResourceId); 227 }; 228 229 230 } } } // end of namespace ::sd::slidesorter::view 231 232 #endif 233