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 #ifndef _XTABLE_HXX 24 #define _XTABLE_HXX 25 26 // include --------------------------------------------------------------- 27 28 #include <svx/xpoly.hxx> 29 #include <svx/xdash.hxx> 30 #include <svx/xhatch.hxx> 31 #include <svx/xgrad.hxx> 32 #include <svx/xbitmap.hxx> 33 #include <svx/xflasit.hxx> 34 #include <svx/xlnasit.hxx> 35 36 #ifndef _SV_COLOR_HXX 37 #include <tools/color.hxx> 38 #endif 39 #include <tools/string.hxx> 40 41 #ifndef _TABLE_HXX //autogen 42 #include <tools/table.hxx> 43 #endif 44 #include "svx/svxdllapi.h" 45 #include <basegfx/polygon/b2dpolypolygon.hxx> 46 47 class Color; 48 class Bitmap; 49 class VirtualDevice; 50 class XOutdevItemPool; 51 52 // Breite und Hoehe der LB-Bitmaps 53 #define BITMAP_WIDTH 32 54 #define BITMAP_HEIGHT 12 55 56 // Standard-Vergleichsstring 57 extern sal_Unicode __FAR_DATA pszStandard[]; // "standard" 58 59 // Funktion zum Konvertieren in echte RGB-Farben, da mit 60 // enum COL_NAME nicht verglichen werden kann. 61 SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName ); 62 63 // --------------------- 64 // class XPropertyEntry 65 // --------------------- 66 67 class XPropertyEntry 68 { 69 protected: 70 String aName; 71 72 XPropertyEntry(const String& rName) : aName(rName) {} 73 XPropertyEntry(const XPropertyEntry& rOther): aName(rOther.aName) {} 74 public: 75 76 virtual ~XPropertyEntry() {} 77 void SetName(const String& rName) { aName = rName; } 78 String& GetName() { return aName; } 79 }; 80 81 // ------------------ 82 // class XColorEntry 83 // ------------------ 84 85 class XColorEntry : public XPropertyEntry 86 { 87 Color aColor; 88 89 public: 90 XColorEntry(const Color& rColor, const String& rName) : 91 XPropertyEntry(rName), aColor(rColor) {} 92 XColorEntry(const XColorEntry& rOther) : 93 XPropertyEntry(rOther), aColor(rOther.aColor) {} 94 95 void SetColor(const Color& rColor) { aColor = rColor; } 96 Color& GetColor() { return aColor; } 97 }; 98 99 // -------------------- 100 // class XLineEndEntry 101 // -------------------- 102 103 class XLineEndEntry : public XPropertyEntry 104 { 105 basegfx::B2DPolyPolygon aB2DPolyPolygon; 106 107 public: 108 XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName) 109 : XPropertyEntry(rName), 110 aB2DPolyPolygon(rB2DPolyPolygon) 111 {} 112 113 XLineEndEntry(const XLineEndEntry& rOther) 114 : XPropertyEntry(rOther), 115 aB2DPolyPolygon(rOther.aB2DPolyPolygon) 116 {} 117 118 void SetLineEnd(const basegfx::B2DPolyPolygon& rB2DPolyPolygon) 119 { 120 aB2DPolyPolygon = rB2DPolyPolygon; 121 } 122 123 basegfx::B2DPolyPolygon& GetLineEnd() 124 { 125 return aB2DPolyPolygon; 126 } 127 }; 128 129 // ------------------ 130 // class XDashEntry 131 // ------------------ 132 133 class XDashEntry : public XPropertyEntry 134 { 135 XDash aDash; 136 137 public: 138 XDashEntry(const XDash& rDash, const String& rName) : 139 XPropertyEntry(rName), aDash(rDash) {} 140 XDashEntry(const XDashEntry& rOther) : 141 XPropertyEntry(rOther), aDash(rOther.aDash) {} 142 143 void SetDash(const XDash& rDash) { aDash = rDash; } 144 XDash& GetDash() { return aDash; } 145 }; 146 147 // ------------------ 148 // class XHatchEntry 149 // ------------------ 150 151 class XHatchEntry : public XPropertyEntry 152 { 153 XHatch aHatch; 154 155 public: 156 XHatchEntry(const XHatch& rHatch, const String& rName) : 157 XPropertyEntry(rName), aHatch(rHatch) {} 158 XHatchEntry(const XHatchEntry& rOther) : 159 XPropertyEntry(rOther), aHatch(rOther.aHatch) {} 160 161 void SetHatch(const XHatch& rHatch) { aHatch = rHatch; } 162 XHatch& GetHatch() { return aHatch; } 163 }; 164 165 // --------------------- 166 // class XGradientEntry 167 // --------------------- 168 169 class XGradientEntry : public XPropertyEntry 170 { 171 XGradient aGradient; 172 173 public: 174 XGradientEntry(const XGradient& rGradient, const String& rName): 175 XPropertyEntry(rName), aGradient(rGradient) {} 176 XGradientEntry(const XGradientEntry& rOther) : 177 XPropertyEntry(rOther), aGradient(rOther.aGradient) {} 178 179 void SetGradient(const XGradient& rGrad) { aGradient = rGrad; } 180 XGradient& GetGradient() { return aGradient; } 181 }; 182 183 // --------------------- 184 // class XBitmapEntry 185 // --------------------- 186 187 class XBitmapEntry : public XPropertyEntry 188 { 189 XOBitmap aXOBitmap; 190 191 public: 192 XBitmapEntry( const XOBitmap& rXOBitmap, const String& rName ): 193 XPropertyEntry( rName ), aXOBitmap( rXOBitmap ) {} 194 XBitmapEntry( const XBitmapEntry& rOther ) : 195 XPropertyEntry( rOther ), aXOBitmap( rOther.aXOBitmap ) {} 196 197 void SetXBitmap(const XOBitmap& rXOBitmap) { aXOBitmap = rXOBitmap; } 198 XOBitmap& GetXBitmap() { return aXOBitmap; } 199 }; 200 201 // --------------------- 202 // class XPropertyTable 203 // --------------------- 204 205 class SVX_DLLPUBLIC XPropertyTable 206 { 207 protected: 208 String aName; // nicht persistent ! 209 String aPath; 210 XOutdevItemPool* pXPool; 211 212 Table aTable; 213 Table* pBmpTable; 214 215 sal_Bool bTableDirty; 216 sal_Bool bBitmapsDirty; 217 sal_Bool bOwnPool; 218 219 XPropertyTable( const String& rPath, 220 XOutdevItemPool* pXPool = NULL, 221 sal_uInt16 nInitSize = 16, 222 sal_uInt16 nReSize = 16 ); 223 XPropertyTable( SvStream& rIn ); 224 void Clear(); 225 226 public: 227 virtual ~XPropertyTable(); 228 229 long Count() const; 230 231 sal_Bool Insert(long nIndex, XPropertyEntry* pEntry); 232 XPropertyEntry* Replace(long nIndex, XPropertyEntry* pEntry); 233 XPropertyEntry* Remove(long nIndex, sal_uInt16 nDummy); 234 XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const; 235 236 long Get(const String& rName); 237 Bitmap* GetBitmap( long nIndex ) const; 238 239 const String& GetName() const { return aName; } 240 void SetName( const String& rString ); 241 const String& GetPath() const { return aPath; } 242 void SetPath( const String& rString ) { aPath = rString; } 243 sal_Bool IsDirty() const { return bTableDirty && bBitmapsDirty; } 244 void SetDirty( sal_Bool bDirty = sal_True ) 245 { bTableDirty = bDirty; bBitmapsDirty = bDirty; } 246 247 virtual sal_Bool Load() = 0; 248 virtual sal_Bool Save() = 0; 249 virtual sal_Bool Create() = 0; 250 virtual sal_Bool CreateBitmapsForUI() = 0; 251 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; 252 }; 253 254 // -------------------- 255 // class XPropertyList 256 // -------------------- 257 258 class SVX_DLLPUBLIC XPropertyList 259 { 260 protected: 261 String aName; // nicht persistent ! 262 String aPath; 263 XOutdevItemPool* pXPool; 264 265 List aList; 266 List* pBmpList; 267 268 sal_Bool bListDirty; 269 sal_Bool bBitmapsDirty; 270 sal_Bool bOwnPool; 271 272 XPropertyList( const String& rPath, 273 XOutdevItemPool* pXPool = NULL, 274 sal_uInt16 nInitSize = 16, 275 sal_uInt16 nReSize = 16 ); 276 XPropertyList( SvStream& rIn ); 277 void Clear(); 278 279 public: 280 virtual ~XPropertyList(); 281 282 long Count() const; 283 284 void Insert( XPropertyEntry* pEntry, long nIndex = LIST_APPEND ); 285 XPropertyEntry* Replace( XPropertyEntry* pEntry, long nIndex ); 286 XPropertyEntry* Remove( long nIndex, sal_uInt16 nDummy ); 287 XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const; 288 289 long Get(const String& rName); 290 Bitmap* GetBitmap( long nIndex ) const; 291 292 const String& GetName() const { return aName; } 293 void SetName( const String& rString ); 294 const String& GetPath() const { return aPath; } 295 void SetPath( const String& rString ) { aPath = rString; } 296 sal_Bool IsDirty() const { return bListDirty && bBitmapsDirty; } 297 void SetDirty( sal_Bool bDirty = sal_True ) 298 { bListDirty = bDirty; bBitmapsDirty = bDirty; } 299 300 virtual sal_Bool Load() = 0; 301 virtual sal_Bool Save() = 0; 302 virtual sal_Bool Create() = 0; 303 virtual sal_Bool CreateBitmapsForUI() = 0; 304 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; 305 }; 306 307 // ------------------ 308 // class XColorTable 309 // ------------------ 310 311 class SVX_DLLPUBLIC XColorTable : public XPropertyTable 312 { 313 public: 314 XColorTable( const String& rPath, 315 XOutdevItemPool* pXPool = NULL, 316 sal_uInt16 nInitSize = 16, 317 sal_uInt16 nReSize = 16 ); 318 virtual ~XColorTable(); 319 320 using XPropertyTable::Replace; 321 XColorEntry* Replace(long nIndex, XColorEntry* pEntry ); 322 using XPropertyTable::Remove; 323 XColorEntry* Remove(long nIndex); 324 using XPropertyTable::Get; 325 XColorEntry* GetColor(long nIndex) const; 326 327 virtual sal_Bool Load(); 328 virtual sal_Bool Save(); 329 virtual sal_Bool Create(); 330 virtual sal_Bool CreateBitmapsForUI(); 331 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 332 333 static XColorTable* GetStdColorTable(); 334 }; 335 336 // ------------------- 337 // class XColorList 338 // ------------------- 339 340 class XColorList : public XPropertyList 341 { 342 public: 343 XColorList( const String& rPath, 344 XOutdevItemPool* pXPool = NULL, 345 sal_uInt16 nInitSize = 16, 346 sal_uInt16 nReSize = 16 ); 347 virtual ~XColorList(); 348 349 using XPropertyList::Replace; 350 XColorEntry* Replace(XColorEntry* pEntry, long nIndex ); 351 using XPropertyList::Remove; 352 XColorEntry* Remove(long nIndex); 353 using XPropertyList::Get; 354 XColorEntry* GetColor(long nIndex) const; 355 356 virtual sal_Bool Load(); 357 virtual sal_Bool Save(); 358 virtual sal_Bool Create(); 359 virtual sal_Bool CreateBitmapsForUI(); 360 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 361 }; 362 363 // -------------------- 364 // class XLineEndTable 365 // -------------------- 366 367 class XLineEndTable : public XPropertyTable 368 { 369 public: 370 XLineEndTable( const String& rPath, 371 XOutdevItemPool* pXPool = NULL, 372 sal_uInt16 nInitSize = 16, 373 sal_uInt16 nReSize = 16 ); 374 virtual ~XLineEndTable(); 375 376 using XPropertyTable::Replace; 377 XLineEndEntry* Replace(long nIndex, XLineEndEntry* pEntry ); 378 using XPropertyTable::Remove; 379 XLineEndEntry* Remove(long nIndex); 380 using XPropertyTable::Get; 381 XLineEndEntry* GetLineEnd(long nIndex) const; 382 383 virtual sal_Bool Load(); 384 virtual sal_Bool Save(); 385 virtual sal_Bool Create(); 386 virtual sal_Bool CreateBitmapsForUI(); 387 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 388 }; 389 390 // ------------------- 391 // class XLineEndList 392 // ------------------- 393 class impXLineEndList; 394 395 class SVX_DLLPUBLIC XLineEndList : public XPropertyList 396 { 397 private: 398 impXLineEndList* mpData; 399 400 void impCreate(); 401 void impDestroy(); 402 403 public: 404 XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); 405 virtual ~XLineEndList(); 406 407 using XPropertyList::Replace; 408 XLineEndEntry* Replace(XLineEndEntry* pEntry, long nIndex); 409 using XPropertyList::Remove; 410 XLineEndEntry* Remove(long nIndex); 411 using XPropertyList::Get; 412 XLineEndEntry* GetLineEnd(long nIndex) const; 413 414 virtual sal_Bool Load(); 415 virtual sal_Bool Save(); 416 virtual sal_Bool Create(); 417 virtual sal_Bool CreateBitmapsForUI(); 418 virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); 419 }; 420 421 // -------------------- 422 // class XDashTable 423 // -------------------- 424 425 class XDashTable : public XPropertyTable 426 { 427 public: 428 XDashTable( const String& rPath, 429 XOutdevItemPool* pXPool = NULL, 430 sal_uInt16 nInitSize = 16, 431 sal_uInt16 nReSize = 16 ); 432 virtual ~XDashTable(); 433 434 using XPropertyTable::Replace; 435 XDashEntry* Replace(long nIndex, XDashEntry* pEntry ); 436 using XPropertyTable::Remove; 437 XDashEntry* Remove(long nIndex); 438 using XPropertyTable::Get; 439 XDashEntry* GetDash(long nIndex) const; 440 441 virtual sal_Bool Load(); 442 virtual sal_Bool Save(); 443 virtual sal_Bool Create(); 444 virtual sal_Bool CreateBitmapsForUI(); 445 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 446 }; 447 448 // ------------------- 449 // class XDashList 450 // ------------------- 451 class impXDashList; 452 453 class SVX_DLLPUBLIC XDashList : public XPropertyList 454 { 455 private: 456 impXDashList* mpData; 457 458 void impCreate(); 459 void impDestroy(); 460 461 public: 462 XDashList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); 463 virtual ~XDashList(); 464 465 using XPropertyList::Replace; 466 XDashEntry* Replace(XDashEntry* pEntry, long nIndex); 467 using XPropertyList::Remove; 468 XDashEntry* Remove(long nIndex); 469 using XPropertyList::Get; 470 XDashEntry* GetDash(long nIndex) const; 471 472 virtual sal_Bool Load(); 473 virtual sal_Bool Save(); 474 virtual sal_Bool Create(); 475 virtual sal_Bool CreateBitmapsForUI(); 476 virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); 477 }; 478 479 // -------------------- 480 // class XHatchTable 481 // -------------------- 482 483 class XHatchTable : public XPropertyTable 484 { 485 public: 486 XHatchTable( const String& rPath, 487 XOutdevItemPool* pXPool = NULL, 488 sal_uInt16 nInitSize = 16, 489 sal_uInt16 nReSize = 16 ); 490 virtual ~XHatchTable(); 491 492 using XPropertyTable::Replace; 493 XHatchEntry* Replace(long nIndex, XHatchEntry* pEntry ); 494 using XPropertyTable::Remove; 495 XHatchEntry* Remove(long nIndex); 496 using XPropertyTable::Get; 497 XHatchEntry* GetHatch(long nIndex) const; 498 499 virtual sal_Bool Load(); 500 virtual sal_Bool Save(); 501 virtual sal_Bool Create(); 502 virtual sal_Bool CreateBitmapsForUI(); 503 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 504 }; 505 506 // ------------------- 507 // class XHatchList 508 // ------------------- 509 class impXHatchList; 510 511 class SVX_DLLPUBLIC XHatchList : public XPropertyList 512 { 513 private: 514 impXHatchList* mpData; 515 516 void impCreate(); 517 void impDestroy(); 518 519 public: 520 XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); 521 ~XHatchList(); 522 523 using XPropertyList::Replace; 524 XHatchEntry* Replace(XHatchEntry* pEntry, long nIndex); 525 using XPropertyList::Remove; 526 XHatchEntry* Remove(long nIndex); 527 using XPropertyList::Get; 528 XHatchEntry* GetHatch(long nIndex) const; 529 530 virtual sal_Bool Load(); 531 virtual sal_Bool Save(); 532 virtual sal_Bool Create(); 533 virtual sal_Bool CreateBitmapsForUI(); 534 virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); 535 }; 536 537 // --------------------- 538 // class XGradientTable 539 // --------------------- 540 541 class XGradientTable : public XPropertyTable 542 { 543 public: 544 XGradientTable( const String& rPath, 545 XOutdevItemPool* pXPool = NULL, 546 sal_uInt16 nInitSize = 16, 547 sal_uInt16 nReSize = 16 ); 548 virtual ~XGradientTable(); 549 550 using XPropertyTable::Replace; 551 XGradientEntry* Replace(long nIndex, XGradientEntry* pEntry ); 552 using XPropertyTable::Remove; 553 XGradientEntry* Remove(long nIndex); 554 using XPropertyTable::Get; 555 XGradientEntry* GetGradient(long nIndex) const; 556 557 virtual sal_Bool Load(); 558 virtual sal_Bool Save(); 559 virtual sal_Bool Create(); 560 virtual sal_Bool CreateBitmapsForUI(); 561 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 562 }; 563 564 // ------------------- 565 // class XGradientList 566 // ------------------- 567 class impXGradientList; 568 569 class SVX_DLLPUBLIC XGradientList : public XPropertyList 570 { 571 private: 572 impXGradientList* mpData; 573 574 void impCreate(); 575 void impDestroy(); 576 577 public: 578 XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); 579 virtual ~XGradientList(); 580 581 using XPropertyList::Replace; 582 XGradientEntry* Replace(XGradientEntry* pEntry, long nIndex); 583 using XPropertyList::Remove; 584 XGradientEntry* Remove(long nIndex); 585 using XPropertyList::Get; 586 XGradientEntry* GetGradient(long nIndex) const; 587 588 virtual sal_Bool Load(); 589 virtual sal_Bool Save(); 590 virtual sal_Bool Create(); 591 virtual sal_Bool CreateBitmapsForUI(); 592 virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); 593 }; 594 595 // --------------------- 596 // class XBitmapTable 597 // --------------------- 598 599 class XBitmapTable : public XPropertyTable 600 { 601 public: 602 XBitmapTable( const String& rPath, 603 XOutdevItemPool* pXPool = NULL, 604 sal_uInt16 nInitSize = 16, 605 sal_uInt16 nReSize = 16 ); 606 virtual ~XBitmapTable(); 607 608 using XPropertyTable::Replace; 609 XBitmapEntry* Replace(long nIndex, XBitmapEntry* pEntry ); 610 using XPropertyTable::Remove; 611 XBitmapEntry* Remove(long nIndex); 612 using XPropertyTable::Get; 613 XBitmapEntry* GetBitmap(long nIndex) const; 614 615 virtual sal_Bool Load(); 616 virtual sal_Bool Save(); 617 virtual sal_Bool Create(); 618 virtual sal_Bool CreateBitmapsForUI(); 619 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 620 }; 621 622 // ------------------- 623 // class XBitmapList 624 // ------------------- 625 626 class SVX_DLLPUBLIC XBitmapList : public XPropertyList 627 { 628 public: 629 XBitmapList( const String& rPath, 630 XOutdevItemPool* pXPool = NULL, 631 sal_uInt16 nInitSize = 16, 632 sal_uInt16 nReSize = 16 ); 633 virtual ~XBitmapList(); 634 635 using XPropertyList::Replace; 636 XBitmapEntry* Replace(XBitmapEntry* pEntry, long nIndex ); 637 using XPropertyList::Remove; 638 XBitmapEntry* Remove(long nIndex); 639 using XPropertyList::Get; 640 XBitmapEntry* GetBitmap(long nIndex) const; 641 642 virtual sal_Bool Load(); 643 virtual sal_Bool Save(); 644 virtual sal_Bool Create(); 645 virtual sal_Bool CreateBitmapsForUI(); 646 virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); 647 }; 648 649 #endif // _XTABLE_HXX 650