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 #ifndef _XTABLE_HXX 23 #define _XTABLE_HXX 24 25 // include --------------------------------------------------------------- 26 27 #include <svx/xpoly.hxx> 28 #include <svx/xdash.hxx> 29 #include <svx/xhatch.hxx> 30 #include <svx/xgrad.hxx> 31 #include <svx/xflasit.hxx> 32 #include <svx/xlnasit.hxx> 33 #include <tools/color.hxx> 34 #include <tools/string.hxx> 35 #include <tools/table.hxx> 36 #include <svx/svxdllapi.h> 37 #include <basegfx/polygon/b2dpolypolygon.hxx> 38 #include <svtools/grfmgr.hxx> 39 #include <svx/XPropertyEntry.hxx> 40 41 class Color; 42 class Bitmap; 43 class VirtualDevice; 44 class XOutdevItemPool; 45 46 // Standard-Vergleichsstring 47 extern sal_Unicode __FAR_DATA pszStandard[]; // "standard" 48 49 // Funktion zum Konvertieren in echte RGB-Farben, da mit 50 // enum COL_NAME nicht verglichen werden kann. 51 SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName ); 52 53 // ------------------ 54 // class XColorEntry 55 // ------------------ 56 57 class XColorEntry : public XPropertyEntry 58 { 59 Color aColor; 60 61 public: 62 XColorEntry(const Color& rColor, const String& rName) : 63 XPropertyEntry(rName), aColor(rColor) {} 64 XColorEntry(const XColorEntry& rOther) : 65 XPropertyEntry(rOther), aColor(rOther.aColor) {} 66 67 void SetColor(const Color& rColor) { aColor = rColor; } 68 const Color& GetColor() const { return aColor; } 69 }; 70 71 // -------------------- 72 // class XLineEndEntry 73 // -------------------- 74 75 class XLineEndEntry : public XPropertyEntry 76 { 77 basegfx::B2DPolyPolygon aB2DPolyPolygon; 78 79 public: 80 XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName) 81 : XPropertyEntry(rName), 82 aB2DPolyPolygon(rB2DPolyPolygon) 83 {} 84 85 XLineEndEntry(const XLineEndEntry& rOther) 86 : XPropertyEntry(rOther), 87 aB2DPolyPolygon(rOther.aB2DPolyPolygon) 88 {} 89 90 void SetLineEnd(const basegfx::B2DPolyPolygon& rB2DPolyPolygon) 91 { 92 aB2DPolyPolygon = rB2DPolyPolygon; 93 } 94 95 const basegfx::B2DPolyPolygon& GetLineEnd() const 96 { 97 return aB2DPolyPolygon; 98 } 99 }; 100 101 // ------------------ 102 // class XDashEntry 103 // ------------------ 104 105 class XDashEntry : public XPropertyEntry 106 { 107 XDash aDash; 108 109 public: 110 XDashEntry(const XDash& rDash, const String& rName) : 111 XPropertyEntry(rName), aDash(rDash) {} 112 XDashEntry(const XDashEntry& rOther) : 113 XPropertyEntry(rOther), aDash(rOther.aDash) {} 114 115 void SetDash(const XDash& rDash) { aDash = rDash; } 116 const XDash& GetDash() const { return aDash; } 117 }; 118 119 // ------------------ 120 // class XHatchEntry 121 // ------------------ 122 123 class XHatchEntry : public XPropertyEntry 124 { 125 XHatch aHatch; 126 127 public: 128 XHatchEntry(const XHatch& rHatch, const String& rName) : 129 XPropertyEntry(rName), aHatch(rHatch) {} 130 XHatchEntry(const XHatchEntry& rOther) : 131 XPropertyEntry(rOther), aHatch(rOther.aHatch) {} 132 133 void SetHatch(const XHatch& rHatch) { aHatch = rHatch; } 134 const XHatch& GetHatch() const { return aHatch; } 135 }; 136 137 // --------------------- 138 // class XGradientEntry 139 // --------------------- 140 141 class XGradientEntry : public XPropertyEntry 142 { 143 XGradient aGradient; 144 145 public: 146 XGradientEntry(const XGradient& rGradient, const String& rName): 147 XPropertyEntry(rName), aGradient(rGradient) {} 148 XGradientEntry(const XGradientEntry& rOther) : 149 XPropertyEntry(rOther), aGradient(rOther.aGradient) {} 150 151 void SetGradient(const XGradient& rGrad) { aGradient = rGrad; } 152 const XGradient& GetGradient() const { return aGradient; } 153 }; 154 155 // --------------------- 156 // class XBitmapEntry 157 // --------------------- 158 159 class XBitmapEntry : public XPropertyEntry 160 { 161 private: 162 GraphicObject maGraphicObject; 163 164 public: 165 XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName) 166 : XPropertyEntry(rName), 167 maGraphicObject(rGraphicObject) 168 { 169 } 170 171 XBitmapEntry(const XBitmapEntry& rOther) 172 : XPropertyEntry(rOther), 173 maGraphicObject(rOther.maGraphicObject) 174 { 175 } 176 177 const GraphicObject& GetGraphicObject() const 178 { 179 return maGraphicObject; 180 } 181 182 void SetGraphicObject(const GraphicObject& rGraphicObject) 183 { 184 maGraphicObject = rGraphicObject; 185 } 186 }; 187 188 // -------------------- 189 // class XPropertyList 190 // -------------------- 191 192 class SVX_DLLPUBLIC XPropertyList 193 { 194 protected: 195 String maName; // nicht persistent ! 196 String maPath; 197 XOutdevItemPool* mpXPool; 198 199 List maList; 200 201 /// bitfield 202 bool mbListDirty : 1; 203 204 XPropertyList( const String& rPath, XOutdevItemPool* pXPool = 0 ); 205 void Clear(); 206 virtual Bitmap CreateBitmapForUI( long nIndex ) = 0; 207 208 public: 209 virtual ~XPropertyList(); 210 211 long Count() const; 212 213 void Insert( XPropertyEntry* pEntry, long nIndex = LIST_APPEND ); 214 XPropertyEntry* Replace( XPropertyEntry* pEntry, long nIndex ); 215 XPropertyEntry* Remove( long nIndex, sal_uInt16 nDummy ); 216 XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const; 217 218 long Get(const String& rName); 219 Bitmap GetUiBitmap( long nIndex ) const; 220 221 const String& GetName() const { return maName; } 222 void SetName( const String& rString ); 223 const String& GetPath() const { return maPath; } 224 void SetPath( const String& rString ) { maPath = rString; } 225 bool IsDirty() const { return mbListDirty; } 226 void SetDirty( bool bDirty = true ) { mbListDirty = bDirty; } 227 228 virtual sal_Bool Load() = 0; 229 virtual sal_Bool Save() = 0; 230 virtual sal_Bool Create() = 0; 231 }; 232 233 // ------------------- 234 // class XColorList 235 // ------------------- 236 237 class SVX_DLLPUBLIC XColorList : public XPropertyList 238 { 239 protected: 240 virtual Bitmap CreateBitmapForUI( long nIndex ); 241 242 public: 243 XColorList( const String& rPath, XOutdevItemPool* pXPool = 0 ); 244 virtual ~XColorList(); 245 246 using XPropertyList::Replace; 247 XColorEntry* Replace(XColorEntry* pEntry, long nIndex ); 248 using XPropertyList::Remove; 249 XColorEntry* Remove(long nIndex); 250 using XPropertyList::Get; 251 XColorEntry* GetColor(long nIndex) const; 252 253 virtual sal_Bool Load(); 254 virtual sal_Bool Save(); 255 virtual sal_Bool Create(); 256 257 static XColorList* GetStdColorList(); 258 }; 259 260 // ------------------- 261 // class XLineEndList 262 // ------------------- 263 class impXLineEndList; 264 265 class SVX_DLLPUBLIC XLineEndList : public XPropertyList 266 { 267 private: 268 impXLineEndList* mpData; 269 270 void impCreate(); 271 void impDestroy(); 272 273 protected: 274 virtual Bitmap CreateBitmapForUI(long nIndex); 275 276 public: 277 XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0); 278 virtual ~XLineEndList(); 279 280 using XPropertyList::Replace; 281 XLineEndEntry* Replace(XLineEndEntry* pEntry, long nIndex); 282 using XPropertyList::Remove; 283 XLineEndEntry* Remove(long nIndex); 284 using XPropertyList::Get; 285 XLineEndEntry* GetLineEnd(long nIndex) const; 286 287 virtual sal_Bool Load(); 288 virtual sal_Bool Save(); 289 virtual sal_Bool Create(); 290 }; 291 292 // ------------------- 293 // class XDashList 294 // ------------------- 295 class impXDashList; 296 297 class SVX_DLLPUBLIC XDashList : public XPropertyList 298 { 299 private: 300 impXDashList* mpData; 301 Bitmap maBitmapSolidLine; 302 String maStringSolidLine; 303 String maStringNoLine; 304 305 void impCreate(); 306 void impDestroy(); 307 308 protected: 309 Bitmap ImpCreateBitmapForXDash(const XDash* pDash); 310 virtual Bitmap CreateBitmapForUI(long nIndex); 311 312 public: 313 XDashList(const String& rPath, XOutdevItemPool* pXPool = 0); 314 virtual ~XDashList(); 315 316 using XPropertyList::Replace; 317 XDashEntry* Replace(XDashEntry* pEntry, long nIndex); 318 using XPropertyList::Remove; 319 XDashEntry* Remove(long nIndex); 320 using XPropertyList::Get; 321 XDashEntry* GetDash(long nIndex) const; 322 323 virtual sal_Bool Load(); 324 virtual sal_Bool Save(); 325 virtual sal_Bool Create(); 326 327 // Special call to get a bitmap for the solid line representation. It 328 // creates a bitmap fitting in size and style to the ones you get by 329 // using GetUiBitmap for existing entries. 330 Bitmap GetBitmapForUISolidLine() const; 331 332 // Special calls to get the translated strings for the UI entry for no 333 // line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs 334 String GetStringForUiSolidLine() const; 335 String GetStringForUiNoLine() const; 336 }; 337 338 // ------------------- 339 // class XHatchList 340 // ------------------- 341 class impXHatchList; 342 343 class SVX_DLLPUBLIC XHatchList : public XPropertyList 344 { 345 private: 346 impXHatchList* mpData; 347 348 void impCreate(); 349 void impDestroy(); 350 351 protected: 352 virtual Bitmap CreateBitmapForUI(long nIndex); 353 354 public: 355 XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0); 356 ~XHatchList(); 357 358 using XPropertyList::Replace; 359 XHatchEntry* Replace(XHatchEntry* pEntry, long nIndex); 360 using XPropertyList::Remove; 361 XHatchEntry* Remove(long nIndex); 362 using XPropertyList::Get; 363 XHatchEntry* GetHatch(long nIndex) const; 364 365 virtual sal_Bool Load(); 366 virtual sal_Bool Save(); 367 virtual sal_Bool Create(); 368 }; 369 370 // ------------------- 371 // class XGradientList 372 // ------------------- 373 class impXGradientList; 374 375 class SVX_DLLPUBLIC XGradientList : public XPropertyList 376 { 377 private: 378 impXGradientList* mpData; 379 380 void impCreate(); 381 void impDestroy(); 382 383 protected: 384 virtual Bitmap CreateBitmapForUI(long nIndex); 385 386 public: 387 XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0); 388 virtual ~XGradientList(); 389 390 using XPropertyList::Replace; 391 XGradientEntry* Replace(XGradientEntry* pEntry, long nIndex); 392 using XPropertyList::Remove; 393 XGradientEntry* Remove(long nIndex); 394 using XPropertyList::Get; 395 XGradientEntry* GetGradient(long nIndex) const; 396 397 virtual sal_Bool Load(); 398 virtual sal_Bool Save(); 399 virtual sal_Bool Create(); 400 }; 401 402 // ------------------- 403 // class XBitmapList 404 // ------------------- 405 406 class SVX_DLLPUBLIC XBitmapList : public XPropertyList 407 { 408 protected: 409 virtual Bitmap CreateBitmapForUI( long nIndex ); 410 411 public: 412 XBitmapList( const String& rPath, XOutdevItemPool* pXPool = 0); 413 virtual ~XBitmapList(); 414 415 using XPropertyList::Replace; 416 XBitmapEntry* Replace(XBitmapEntry* pEntry, long nIndex ); 417 using XPropertyList::Remove; 418 XBitmapEntry* Remove(long nIndex); 419 using XPropertyList::Get; 420 XBitmapEntry* GetBitmap(long nIndex) const; 421 422 virtual sal_Bool Load(); 423 virtual sal_Bool Save(); 424 virtual sal_Bool Create(); 425 }; 426 427 #endif // _XTABLE_HXX 428 429 // eof 430