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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 27 // include --------------------------------------------------------------- 28 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> 29 #include <com/sun/star/drawing/Hatch.hpp> 30 #include <com/sun/star/drawing/LineStyle.hpp> 31 #include <com/sun/star/drawing/LineDash.hpp> 32 #include <com/sun/star/drawing/DashStyle.hpp> 33 #include <com/sun/star/awt/Point.hpp> 34 #include <com/sun/star/drawing/PointSequence.hpp> 35 #include <com/sun/star/drawing/FillStyle.hpp> 36 #include <com/sun/star/awt/Gradient.hpp> 37 #include <com/sun/star/uno/Sequence.hxx> 38 #include <com/sun/star/beans/PropertyValue.hpp> 39 #include <svl/itempool.hxx> 40 #include <editeng/memberids.hrc> 41 #include <tools/stream.hxx> 42 43 #include "svx/unoapi.hxx" 44 #include <svl/style.hxx> 45 #include "unopolyhelper.hxx" 46 47 #include <tools/bigint.hxx> 48 #include <svl/itemset.hxx> 49 #include <svx/dialogs.hrc> 50 #include "svx/svdstr.hrc" 51 #include "svx/xattr.hxx" 52 #include <svx/xtable.hxx> 53 #include <svx/dialmgr.hxx> 54 #include <editeng/itemtype.hxx> 55 #include <svx/xdef.hxx> 56 #include <svx/unomid.hxx> 57 #include <svx/svdmodel.hxx> 58 #include <basegfx/polygon/b2dpolygon.hxx> 59 #include <basegfx/point/b2dpoint.hxx> 60 #include <basegfx/vector/b2dvector.hxx> 61 62 #include <stdio.h> 63 64 using namespace ::rtl; 65 using namespace ::com::sun::star; 66 67 #define GLOBALOVERFLOW 68 69 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 70 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) 71 72 /************************************************************************/ 73 74 #define VCLTOSVCOL( rCol ) (sal_uInt16)((((sal_uInt16)(rCol))<<8)|(rCol)) 75 76 /************************************************************************/ 77 78 XubString aNameOrIndexEmptyString; 79 80 TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem); 81 82 /************************************************************************* 83 |* 84 |* 85 |* 86 \*************************************************************************/ 87 88 long ScaleMetricValue( long nVal, long nMul, long nDiv ) 89 { 90 BigInt aVal( nVal ); 91 92 aVal *= nMul; 93 94 if ( aVal.IsNeg() != ( nDiv < 0 ) ) 95 aVal-=nDiv/2; // fuer korrektes Runden 96 else 97 aVal+=nDiv/2; // fuer korrektes Runden 98 99 aVal/=nDiv; 100 101 return long( aVal ); 102 } 103 104 /************************************************************************* 105 |* 106 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex) 107 |* 108 |* Beschreibung 109 |* Ersterstellung 14.11.94 110 |* Letzte Aenderung 14.11.94 111 |* 112 *************************************************************************/ 113 114 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, sal_Int32 nIndex) : 115 SfxStringItem(_nWhich, aNameOrIndexEmptyString), 116 nPalIndex(nIndex) 117 { 118 } 119 120 /************************************************************************* 121 |* 122 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, const String& rName) 123 |* 124 |* Beschreibung 125 |* Ersterstellung 14.11.94 126 |* Letzte Aenderung 14.11.94 127 |* 128 *************************************************************************/ 129 130 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const XubString& rName) : 131 SfxStringItem(_nWhich, rName), 132 nPalIndex(-1) 133 { 134 } 135 136 /************************************************************************* 137 |* 138 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, SvStream& rIn) 139 |* 140 |* Beschreibung 141 |* Ersterstellung 14.11.94 142 |* Letzte Aenderung 14.11.94 143 |* 144 *************************************************************************/ 145 146 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, SvStream& rIn) : 147 SfxStringItem(_nWhich, rIn) 148 { 149 rIn >> nPalIndex; 150 } 151 152 /************************************************************************* 153 |* 154 |* NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) 155 |* 156 |* Beschreibung 157 |* Ersterstellung 14.11.94 158 |* Letzte Aenderung 14.11.94 159 |* 160 *************************************************************************/ 161 162 NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) : 163 SfxStringItem(rNameOrIndex), 164 nPalIndex(rNameOrIndex.nPalIndex) 165 { 166 } 167 168 /************************************************************************* 169 |* 170 |* int NameOrIndex::operator==(const SfxPoolItem& rItem) const 171 |* 172 |* Beschreibung 173 |* Ersterstellung 14.11.94 174 |* Letzte Aenderung 14.11.94 175 |* 176 *************************************************************************/ 177 178 int NameOrIndex::operator==(const SfxPoolItem& rItem) const 179 { 180 return ( SfxStringItem::operator==(rItem) && 181 ((const NameOrIndex&) rItem).nPalIndex == nPalIndex ); 182 } 183 184 /************************************************************************* 185 |* 186 |* SfxPoolItem* NameOrIndex::Clone(SfxItemPool* pPool) const 187 |* 188 |* Beschreibung 189 |* Ersterstellung 14.11.94 190 |* Letzte Aenderung 14.11.94 191 |* 192 *************************************************************************/ 193 194 SfxPoolItem* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const 195 { 196 197 return new NameOrIndex(*this); 198 } 199 200 /************************************************************************* 201 |* 202 |* SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 nVer) const 203 |* 204 |* Beschreibung 205 |* Ersterstellung 14.11.94 206 |* Letzte Aenderung 14.11.94 207 |* 208 *************************************************************************/ 209 210 SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 211 { 212 return new NameOrIndex(Which(), rIn); 213 } 214 215 /************************************************************************* 216 |* 217 |* SvStream* NameOrIndex::Store(SvStream& rIn) const 218 |* 219 |* Beschreibung 220 |* Ersterstellung 14.11.94 221 |* Letzte Aenderung 14.11.94 222 |* 223 *************************************************************************/ 224 225 SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 226 { 227 SfxStringItem::Store( rOut, nItemVersion ); 228 rOut << nPalIndex; 229 return rOut; 230 } 231 232 /** this static checks if the given NameOrIndex item has a unique name for its value. 233 The returned String is a unique name for an item with this value in both given pools. 234 Argument pPool2 can be null. 235 If returned string equals NameOrIndex->GetName(), the name was already unique. 236 */ 237 String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, XPropertyList* pDefaults ) 238 { 239 sal_Bool bForceNew = sal_False; 240 241 String aUniqueName; 242 SvxUnogetInternalNameForItem( nWhich, pCheckItem->GetName(), aUniqueName ); 243 244 // 2. if we have a name check if there is already an item with the 245 // same name in the documents pool with a different line end or start 246 247 if( aUniqueName.Len() && pPool1 ) 248 { 249 const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich ); 250 251 const NameOrIndex *pItem; 252 for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 253 { 254 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate ); 255 256 if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) ) 257 { 258 // if there is already an item with the same name and the same 259 // value its ok to set it 260 if( !pCompareValueFunc( pItem, pCheckItem ) ) 261 { 262 // same name but different value, we need a new name for this item 263 aUniqueName = String(); 264 bForceNew = sal_True; 265 } 266 break; 267 } 268 } 269 } 270 271 // if we have no name yet, find existing item with same conent or 272 // create a unique name 273 if( aUniqueName.Len() == 0 ) 274 { 275 sal_Int32 nUserIndex = 1; 276 const ResId aRes(SVX_RES(nPrefixResId)); 277 String aUser( aRes ); 278 aUser += sal_Unicode( ' ' ); 279 280 if( pDefaults ) 281 { 282 const int nCount = pDefaults->Count(); 283 int nIndex; 284 for( nIndex = 0; nIndex < nCount; nIndex++ ) 285 { 286 XPropertyEntry* pEntry = pDefaults->Get( nIndex, 0 ); 287 if( pEntry ) 288 { 289 bool bFound = false; 290 291 switch( nWhich ) 292 { 293 case XATTR_FILLBITMAP: 294 { 295 const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject()); 296 const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject()); 297 298 bFound = (rGraphicObjectA == rGraphicObjectB); 299 break; 300 } 301 case XATTR_LINEDASH: 302 bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash()); 303 break; 304 case XATTR_LINESTART: 305 bFound = (((XLineStartItem*)pCheckItem)->GetLineStartValue() == ((XLineEndEntry*)pEntry)->GetLineEnd()); 306 break; 307 case XATTR_LINEEND: 308 bFound = (((XLineEndItem*)pCheckItem)->GetLineEndValue() == ((XLineEndEntry*)pEntry)->GetLineEnd()); 309 break; 310 case XATTR_FILLGRADIENT: 311 bFound = (((XFillGradientItem*)pCheckItem)->GetGradientValue() == ((XGradientEntry*)pEntry)->GetGradient()); 312 break; 313 case XATTR_FILLHATCH: 314 bFound = (((XFillHatchItem*)pCheckItem)->GetHatchValue() == ((XHatchEntry*)pEntry)->GetHatch()); 315 break; 316 } 317 318 if( bFound ) 319 { 320 aUniqueName = pEntry->GetName(); 321 break; 322 } 323 else 324 { 325 sal_Int32 nThisIndex = pEntry->GetName().Copy( aUser.Len() ).ToInt32(); 326 if( nThisIndex >= nUserIndex ) 327 nUserIndex = nThisIndex + 1; 328 } 329 } 330 } 331 } 332 333 if( (aUniqueName.Len() == 0) && pPool1 ) 334 { 335 const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich ); 336 const NameOrIndex *pItem; 337 for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 338 { 339 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate ); 340 341 if( pItem && pItem->GetName().Len() ) 342 { 343 if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) ) 344 return pItem->GetName(); 345 346 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) 347 { 348 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); 349 if( nThisIndex >= nUserIndex ) 350 nUserIndex = nThisIndex + 1; 351 } 352 } 353 } 354 aUniqueName = aUser; 355 aUniqueName += String::CreateFromInt32( nUserIndex ); 356 } 357 } 358 359 return aUniqueName; 360 } 361 362 //************************************************************************* 363 364 // ------------------- 365 // class XColorItem 366 // ------------------- 367 TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex); 368 369 /************************************************************************* 370 |* 371 |* XColorItem::XColorItem(sal_uInt16 nWhich, sal_Int32 nIndex, const Color& rTheColor) 372 |* 373 \************************************************************************/ 374 375 XColorItem::XColorItem(sal_uInt16 _nWhich, sal_Int32 nIndex, const Color& rTheColor) : 376 NameOrIndex(_nWhich, nIndex), 377 aColor(rTheColor) 378 { 379 } 380 381 /************************************************************************* 382 |* 383 |* XColorItem::XColorItem(sal_uInt16 nWhich, const String& rName, const Color& rTheColor) 384 |* 385 \************************************************************************/ 386 387 XColorItem::XColorItem(sal_uInt16 _nWhich, const XubString& rName, const Color& rTheColor) : 388 NameOrIndex(_nWhich, rName), 389 aColor(rTheColor) 390 { 391 } 392 393 /************************************************************************* 394 |* 395 |* XColorItem::XColorItem(const XColorItem& rItem) 396 |* 397 \************************************************************************/ 398 399 XColorItem::XColorItem(const XColorItem& rItem) : 400 NameOrIndex(rItem), 401 aColor(rItem.aColor) 402 { 403 } 404 405 /************************************************************************* 406 |* 407 |* XColorItem::XColorItem(sal_uInt16 nWhich, SvStream& rIn) 408 |* 409 \************************************************************************/ 410 411 XColorItem::XColorItem(sal_uInt16 _nWhich, SvStream& rIn) : 412 NameOrIndex(_nWhich, rIn) 413 { 414 if (!IsIndex()) 415 { 416 rIn >> aColor; 417 } 418 } 419 420 /************************************************************************* 421 |* 422 |* XColorItem::Clone(SfxItemPool* pPool) const 423 |* 424 \************************************************************************/ 425 426 SfxPoolItem* XColorItem::Clone(SfxItemPool* /*pPool*/) const 427 { 428 return new XColorItem(*this); 429 } 430 431 /************************************************************************* 432 |* 433 |* int XColorItem::operator==(const SfxPoolItem& rItem) const 434 |* 435 \************************************************************************/ 436 437 int XColorItem::operator==(const SfxPoolItem& rItem) const 438 { 439 return ( NameOrIndex::operator==(rItem) && 440 ((const XColorItem&) rItem).aColor == aColor ); 441 } 442 443 /************************************************************************* 444 |* 445 |* SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const 446 |* 447 \************************************************************************/ 448 449 SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 450 { 451 return new XColorItem(Which(), rIn); 452 } 453 454 /************************************************************************* 455 |* 456 |* SfxPoolItem* XColorItem::Store(SvStream& rOut) const 457 |* 458 \************************************************************************/ 459 460 SvStream& XColorItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 461 { 462 NameOrIndex::Store( rOut, nItemVersion ); 463 464 if ( !IsIndex() ) 465 { 466 rOut << aColor; 467 } 468 469 return rOut; 470 } 471 472 /************************************************************************* 473 |* 474 |* const XColor& XColorItem::GetColorValue(const XColorTable* pTable) const 475 |* 476 \************************************************************************/ 477 478 const Color& XColorItem::GetColorValue(const XColorTable* pTable) const 479 { 480 if (!IsIndex()) 481 return aColor; 482 else 483 return pTable->GetColor(GetIndex())->GetColor(); 484 485 } 486 487 sal_Bool XColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 488 { 489 rVal <<= (sal_Int32)GetColorValue().GetRGBColor(); 490 return sal_True; 491 } 492 493 sal_Bool XColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 494 { 495 sal_Int32 nValue = 0; 496 rVal >>= nValue; 497 SetColorValue( nValue ); 498 499 return sal_True; 500 } 501 502 503 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 504 // Linienattribute 505 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 506 507 //--------------------- 508 // class XLineStyleItem 509 //--------------------- 510 TYPEINIT1_AUTOFACTORY(XLineStyleItem, SfxEnumItem); 511 512 /************************************************************************* 513 |* 514 |* XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) 515 |* 516 |* Beschreibung 517 |* Ersterstellung 15.11.94 518 |* Letzte Aenderung 18.11.94 519 |* 520 *************************************************************************/ 521 522 XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) : 523 SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle)) 524 { 525 } 526 527 /************************************************************************* 528 |* 529 |* XLineStyleItem::XLineStyleItem(SvStream& rIn) 530 |* 531 |* Beschreibung 532 |* Ersterstellung 15.11.94 533 |* Letzte Aenderung 15.11.94 534 |* 535 *************************************************************************/ 536 537 XLineStyleItem::XLineStyleItem(SvStream& rIn) : 538 SfxEnumItem(XATTR_LINESTYLE, rIn) 539 { 540 } 541 542 /************************************************************************* 543 |* 544 |* XLineStyleItem::Clone(SfxItemPool* pPool) const 545 |* 546 |* Beschreibung 547 |* Ersterstellung 09.11.94 548 |* Letzte Aenderung 09.11.94 549 |* 550 *************************************************************************/ 551 552 SfxPoolItem* XLineStyleItem::Clone(SfxItemPool* /*pPool*/) const 553 { 554 return new XLineStyleItem( *this ); 555 } 556 557 /************************************************************************* 558 |* 559 |* SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const 560 |* 561 |* Beschreibung 562 |* Ersterstellung 15.11.94 563 |* Letzte Aenderung 15.11.94 564 |* 565 *************************************************************************/ 566 567 SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 568 { 569 return new XLineStyleItem(rIn); 570 } 571 572 //------------------------------------------------------------------------ 573 574 SfxItemPresentation XLineStyleItem::GetPresentation 575 ( 576 SfxItemPresentation ePres, 577 SfxMapUnit /*eCoreUnit*/, 578 SfxMapUnit /*ePresUnit*/, 579 XubString& rText, const IntlWrapper * 580 ) const 581 { 582 rText.Erase(); 583 584 switch ( ePres ) 585 { 586 case SFX_ITEM_PRESENTATION_NONE: 587 return ePres; 588 case SFX_ITEM_PRESENTATION_COMPLETE: 589 case SFX_ITEM_PRESENTATION_NAMELESS: 590 { 591 sal_uInt16 nId = 0; 592 593 switch( (sal_uInt16)GetValue() ) 594 { 595 case XLINE_NONE: 596 nId = RID_SVXSTR_INVISIBLE; 597 break; 598 case XLINE_SOLID: 599 nId = RID_SVXSTR_SOLID; 600 break; 601 } 602 603 if ( nId ) 604 rText = SVX_RESSTR( nId ); 605 return ePres; 606 } 607 default: 608 return SFX_ITEM_PRESENTATION_NONE; 609 } 610 } 611 612 sal_Bool XLineStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 613 { 614 ::com::sun::star::drawing::LineStyle eLS = (::com::sun::star::drawing::LineStyle)GetValue(); 615 rVal <<= eLS; 616 return sal_True; 617 } 618 619 sal_Bool XLineStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 620 { 621 ::com::sun::star::drawing::LineStyle eLS; 622 if(!(rVal >>= eLS )) 623 { 624 // also try an int (for Basic) 625 sal_Int32 nLS = 0; 626 if(!(rVal >>= nLS)) 627 return sal_False; 628 eLS = (::com::sun::star::drawing::LineStyle)nLS; 629 } 630 631 SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) ); 632 return sal_True; 633 } 634 635 //------------------------------------------------------------------------ 636 637 sal_uInt16 XLineStyleItem::GetValueCount() const 638 { 639 return 3; 640 } 641 642 643 // ------------ 644 // class XDash 645 // ------------ 646 /************************************************************************* 647 |* 648 |* XDash::XDash(XDashStyle, sal_uInt16, sal_uIntPtr, sal_uInt16, sal_uIntPtr, sal_uIntPtr) 649 |* 650 |* Beschreibung 651 |* Ersterstellung 21.11.94 652 |* Letzte Aenderung 21.11.94 653 |* 654 *************************************************************************/ 655 656 XDash::XDash(XDashStyle eTheDash, sal_uInt16 nTheDots, sal_uIntPtr nTheDotLen, 657 sal_uInt16 nTheDashes, sal_uIntPtr nTheDashLen, sal_uIntPtr nTheDistance) : 658 eDash(eTheDash), 659 nDots(nTheDots), 660 nDotLen(nTheDotLen), 661 nDashes(nTheDashes), 662 nDashLen(nTheDashLen), 663 nDistance(nTheDistance) 664 { 665 } 666 667 /************************************************************************* 668 |* 669 |* int XDash::operator==(const SfxPoolItem& rItem) const 670 |* 671 |* Beschreibung 672 |* Ersterstellung 29.11.94 673 |* Letzte Aenderung 29.11.94 674 |* 675 *************************************************************************/ 676 677 bool XDash::operator==(const XDash& rDash) const 678 { 679 return ( eDash == rDash.eDash && 680 nDots == rDash.nDots && 681 nDotLen == rDash.nDotLen && 682 nDashes == rDash.nDashes && 683 nDashLen == rDash.nDashLen && 684 nDistance == rDash.nDistance ); 685 } 686 687 // XDash is translated into an array of doubles which describe the lengths of the 688 // dashes, dots and empty passages. It returns the complete length of the full DashDot 689 // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it). 690 static double SMALLEST_DASH_WIDTH(26.95); 691 double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const 692 { 693 double fFullDotDashLen(0.0); 694 const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2; 695 rDotDashArray.resize( nNumDotDashArray, 0.0 ); 696 sal_uInt16 a; 697 sal_uInt16 nIns(0); 698 double fDashDotDistance = (double)GetDistance(); 699 double fSingleDashLen = (double)GetDashLen(); 700 double fSingleDotLen = (double)GetDotLen(); 701 702 if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE) 703 { 704 if(fLineWidth != 0.0) 705 { 706 double fFactor = fLineWidth / 100.0; 707 708 if(GetDashes()) 709 { 710 if(GetDashLen()) 711 { 712 // is a dash 713 fSingleDashLen *= fFactor; 714 } 715 else 716 { 717 // is a dot 718 fSingleDashLen = fLineWidth; 719 } 720 } 721 722 if(GetDots()) 723 { 724 if(GetDotLen()) 725 { 726 // is a dash 727 fSingleDotLen *= fFactor; 728 } 729 else 730 { 731 // is a dot 732 fSingleDotLen = fLineWidth; 733 } 734 } 735 736 if(GetDashes() || GetDots()) 737 { 738 if(GetDistance()) 739 { 740 fDashDotDistance *= fFactor; 741 } 742 else 743 { 744 fDashDotDistance = fLineWidth; 745 } 746 } 747 } 748 else 749 { 750 if(GetDashes()) 751 { 752 if(GetDashLen()) 753 { 754 // is a dash 755 fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0; 756 } 757 else 758 { 759 // is a dot 760 fSingleDashLen = SMALLEST_DASH_WIDTH; 761 } 762 } 763 764 if(GetDots()) 765 { 766 if(GetDotLen()) 767 { 768 // is a dash 769 fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0; 770 } 771 else 772 { 773 // is a dot 774 fSingleDotLen = SMALLEST_DASH_WIDTH; 775 } 776 } 777 778 if(GetDashes() || GetDots()) 779 { 780 if(GetDistance()) 781 { 782 // dash as distance 783 fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0; 784 } 785 else 786 { 787 // dot as distance 788 fDashDotDistance = SMALLEST_DASH_WIDTH; 789 } 790 } 791 } 792 } 793 else 794 { 795 // smallest dot size compare value 796 double fDotCompVal(fLineWidth != 0.0 ? fLineWidth : SMALLEST_DASH_WIDTH); 797 798 // absolute values 799 if(GetDashes()) 800 { 801 if(GetDashLen()) 802 { 803 // is a dash 804 if(fSingleDashLen < SMALLEST_DASH_WIDTH) 805 { 806 fSingleDashLen = SMALLEST_DASH_WIDTH; 807 } 808 } 809 else 810 { 811 // is a dot 812 if(fSingleDashLen < fDotCompVal) 813 { 814 fSingleDashLen = fDotCompVal; 815 } 816 } 817 } 818 819 if(GetDots()) 820 { 821 if(GetDotLen()) 822 { 823 // is a dash 824 if(fSingleDotLen < SMALLEST_DASH_WIDTH) 825 { 826 fSingleDotLen = SMALLEST_DASH_WIDTH; 827 } 828 } 829 else 830 { 831 // is a dot 832 if(fSingleDotLen < fDotCompVal) 833 { 834 fSingleDotLen = fDotCompVal; 835 } 836 } 837 } 838 839 if(GetDashes() || GetDots()) 840 { 841 if(GetDistance()) 842 { 843 // dash as distance 844 if(fDashDotDistance < SMALLEST_DASH_WIDTH) 845 { 846 fDashDotDistance = SMALLEST_DASH_WIDTH; 847 } 848 } 849 else 850 { 851 // dot as distance 852 if(fDashDotDistance < fDotCompVal) 853 { 854 fDashDotDistance = fDotCompVal; 855 } 856 } 857 } 858 } 859 860 for(a=0;a<GetDots();a++) 861 { 862 rDotDashArray[nIns++] = fSingleDotLen; 863 fFullDotDashLen += fSingleDotLen; 864 rDotDashArray[nIns++] = fDashDotDistance; 865 fFullDotDashLen += fDashDotDistance; 866 } 867 868 for(a=0;a<GetDashes();a++) 869 { 870 rDotDashArray[nIns++] = fSingleDashLen; 871 fFullDotDashLen += fSingleDashLen; 872 rDotDashArray[nIns++] = fDashDotDistance; 873 fFullDotDashLen += fDashDotDistance; 874 } 875 876 return fFullDotDashLen; 877 } 878 879 // ------------------- 880 // class XLineDashItem 881 // ------------------- 882 TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex); 883 884 /************************************************************************* 885 |* 886 |* XLineDashItem::XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash) 887 |* 888 |* Beschreibung 889 |* Ersterstellung 15.11.94 890 |* Letzte Aenderung 15.11.94 891 |* 892 *************************************************************************/ 893 894 XLineDashItem::XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash) : 895 NameOrIndex(XATTR_LINEDASH, nIndex), 896 aDash(rTheDash) 897 { 898 } 899 900 /************************************************************************* 901 |* 902 |* XLineDashItem::XLineDashItem(const String& rName, const XDash& rTheDash) 903 |* 904 |* Beschreibung 905 |* Ersterstellung 15.11.94 906 |* Letzte Aenderung 15.11.94 907 |* 908 *************************************************************************/ 909 910 XLineDashItem::XLineDashItem(const XubString& rName, const XDash& rTheDash) : 911 NameOrIndex(XATTR_LINEDASH, rName), 912 aDash(rTheDash) 913 { 914 } 915 916 /************************************************************************* 917 |* 918 |* XLineDashItem::XLineDashItem(const XLineDashItem& rItem) 919 |* 920 |* Beschreibung 921 |* Ersterstellung 15.11.94 922 |* Letzte Aenderung 15.11.94 923 |* 924 *************************************************************************/ 925 926 XLineDashItem::XLineDashItem(const XLineDashItem& rItem) : 927 NameOrIndex(rItem), 928 aDash(rItem.aDash) 929 { 930 } 931 932 /************************************************************************* 933 |* 934 |* XLineDashItem::XLineDashItem(SvStream& rIn) 935 |* 936 |* Beschreibung 937 |* Ersterstellung 15.11.94 938 |* Letzte Aenderung 15.11.94 939 |* 940 *************************************************************************/ 941 942 XLineDashItem::XLineDashItem(SvStream& rIn) : 943 NameOrIndex(XATTR_LINEDASH, rIn) 944 { 945 if (!IsIndex()) 946 { 947 sal_uInt16 nSTemp; 948 sal_uInt32 nLTemp; 949 sal_Int32 nITemp; 950 951 rIn >> nITemp; aDash.SetDashStyle((XDashStyle)nITemp); 952 rIn >> nSTemp; aDash.SetDots(nSTemp); 953 rIn >> nLTemp; aDash.SetDotLen(nLTemp); 954 rIn >> nSTemp; aDash.SetDashes(nSTemp); 955 rIn >> nLTemp; aDash.SetDashLen(nLTemp); 956 rIn >> nLTemp; aDash.SetDistance(nLTemp); 957 } 958 } 959 960 //************************************************************************* 961 962 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash) 963 : NameOrIndex( XATTR_LINEDASH, -1 ), 964 aDash(rTheDash) 965 { 966 } 967 968 //************************************************************************* 969 970 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/) 971 : NameOrIndex(XATTR_LINEDASH, -1 ) 972 { 973 } 974 975 /************************************************************************* 976 |* 977 |* XLineDashItem::Clone(SfxItemPool* pPool) const 978 |* 979 |* Beschreibung 980 |* Ersterstellung 15.11.94 981 |* Letzte Aenderung 15.11.94 982 |* 983 *************************************************************************/ 984 985 SfxPoolItem* XLineDashItem::Clone(SfxItemPool* /*pPool*/) const 986 { 987 return new XLineDashItem(*this); 988 } 989 990 /************************************************************************* 991 |* 992 |* int XLineDashItem::operator==(const SfxPoolItem& rItem) const 993 |* 994 |* Beschreibung 995 |* Ersterstellung 15.11.94 996 |* Letzte Aenderung 15.11.94 997 |* 998 *************************************************************************/ 999 1000 int XLineDashItem::operator==(const SfxPoolItem& rItem) const 1001 { 1002 return ( NameOrIndex::operator==(rItem) && 1003 aDash == ((const XLineDashItem&) rItem).aDash ); 1004 } 1005 1006 /************************************************************************* 1007 |* 1008 |* SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 nVer) const 1009 |* 1010 |* Beschreibung 1011 |* Ersterstellung 15.11.94 1012 |* Letzte Aenderung 15.11.94 1013 |* 1014 *************************************************************************/ 1015 1016 SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 1017 { 1018 return new XLineDashItem(rIn); 1019 } 1020 1021 /************************************************************************* 1022 |* 1023 |* SfxPoolItem* XLineDashItem::Store(SvStream& rOut) const 1024 |* 1025 |* Beschreibung 1026 |* Ersterstellung 15.11.94 1027 |* Letzte Aenderung 15.11.94 1028 |* 1029 *************************************************************************/ 1030 1031 SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 1032 { 1033 NameOrIndex::Store( rOut, nItemVersion ); 1034 1035 if (!IsIndex()) 1036 { 1037 rOut << (sal_Int32) aDash.GetDashStyle(); 1038 rOut << aDash.GetDots(); 1039 rOut << (sal_uInt32) aDash.GetDotLen(); 1040 rOut << aDash.GetDashes(); 1041 rOut << (sal_uInt32) aDash.GetDashLen(); 1042 rOut << (sal_uInt32) aDash.GetDistance(); 1043 } 1044 1045 return rOut; 1046 } 1047 1048 /************************************************************************* 1049 |* 1050 |* const XDash& XLineDashItem::GetValue(const XDashTable* pTable) const 1051 |* 1052 |* Beschreibung 1053 |* Ersterstellung 15.11.94 1054 |* Letzte Aenderung 18.11.94 1055 |* 1056 *************************************************************************/ 1057 1058 const XDash& XLineDashItem::GetDashValue(const XDashTable* pTable) const // GetValue -> GetDashValue 1059 { 1060 if (!IsIndex()) 1061 return aDash; 1062 else 1063 return pTable->GetDash(GetIndex())->GetDash(); 1064 } 1065 1066 //------------------------------------------------------------------------ 1067 1068 SfxItemPresentation XLineDashItem::GetPresentation 1069 ( 1070 SfxItemPresentation ePres, 1071 SfxMapUnit /*eCoreUnit*/, 1072 SfxMapUnit /*ePresUnit*/, 1073 XubString& rText, const IntlWrapper * 1074 ) const 1075 { 1076 switch ( ePres ) 1077 { 1078 case SFX_ITEM_PRESENTATION_NONE: 1079 rText.Erase(); 1080 return ePres; 1081 case SFX_ITEM_PRESENTATION_NAMELESS: 1082 case SFX_ITEM_PRESENTATION_COMPLETE: 1083 rText = GetName(); 1084 return ePres; 1085 default: 1086 return SFX_ITEM_PRESENTATION_NONE; 1087 } 1088 } 1089 1090 //------------------------------------------------------------------------ 1091 1092 FASTBOOL XLineDashItem::HasMetrics() const 1093 { 1094 return sal_True; 1095 } 1096 1097 //------------------------------------------------------------------------ 1098 1099 FASTBOOL XLineDashItem::ScaleMetrics(long nMul, long nDiv) 1100 { 1101 aDash.SetDotLen( ScaleMetricValue( aDash.GetDotLen(), nMul, nDiv ) ); 1102 aDash.SetDashLen( ScaleMetricValue( aDash.GetDashLen(), nMul, nDiv ) ); 1103 aDash.SetDistance( ScaleMetricValue( aDash.GetDistance(), nMul, nDiv ) ); 1104 return sal_True; 1105 } 1106 1107 sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 1108 { 1109 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1110 nMemberId &= ~CONVERT_TWIPS; 1111 1112 switch ( nMemberId ) 1113 { 1114 case 0: 1115 { 1116 uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); 1117 1118 ::com::sun::star::drawing::LineDash aLineDash; 1119 1120 const XDash& rXD = GetDashValue(); 1121 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle()); 1122 aLineDash.Dots = rXD.GetDots(); 1123 aLineDash.DotLen = rXD.GetDotLen(); 1124 aLineDash.Dashes = rXD.GetDashes(); 1125 aLineDash.DashLen = rXD.GetDashLen(); 1126 aLineDash.Distance = rXD.GetDistance(); 1127 1128 rtl::OUString aApiName; 1129 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 1130 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); 1131 aPropSeq[0].Value = uno::makeAny( aApiName ); 1132 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" )); 1133 aPropSeq[1].Value = uno::makeAny( aLineDash ); 1134 rVal = uno::makeAny( aPropSeq ); 1135 break; 1136 } 1137 1138 case MID_NAME: 1139 { 1140 rtl::OUString aApiName; 1141 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 1142 rVal <<= aApiName; 1143 break; 1144 } 1145 1146 case MID_LINEDASH: 1147 { 1148 const XDash& rXD = GetDashValue(); 1149 1150 ::com::sun::star::drawing::LineDash aLineDash; 1151 1152 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle()); 1153 aLineDash.Dots = rXD.GetDots(); 1154 aLineDash.DotLen = rXD.GetDotLen(); 1155 aLineDash.Dashes = rXD.GetDashes(); 1156 aLineDash.DashLen = rXD.GetDashLen(); 1157 aLineDash.Distance = rXD.GetDistance(); 1158 1159 rVal <<= aLineDash; 1160 break; 1161 } 1162 1163 case MID_LINEDASH_STYLE: 1164 { 1165 const XDash& rXD = GetDashValue(); 1166 rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle()); 1167 break; 1168 } 1169 1170 case MID_LINEDASH_DOTS: 1171 { 1172 const XDash& rXD = GetDashValue(); 1173 rVal <<= rXD.GetDots(); 1174 break; 1175 } 1176 1177 case MID_LINEDASH_DOTLEN: 1178 { 1179 const XDash& rXD = GetDashValue(); 1180 rVal <<= rXD.GetDotLen(); 1181 break; 1182 } 1183 1184 case MID_LINEDASH_DASHES: 1185 { 1186 const XDash& rXD = GetDashValue(); 1187 rVal <<= rXD.GetDashes(); 1188 break; 1189 } 1190 1191 case MID_LINEDASH_DASHLEN: 1192 { 1193 const XDash& rXD = GetDashValue(); 1194 rVal <<= rXD.GetDashLen(); 1195 break; 1196 } 1197 1198 case MID_LINEDASH_DISTANCE: 1199 { 1200 const XDash& rXD = GetDashValue(); 1201 rVal <<= rXD.GetDistance(); 1202 break; 1203 } 1204 1205 default: DBG_ERROR("Wrong MemberId!"); return sal_False; 1206 } 1207 1208 return sal_True; 1209 } 1210 1211 sal_Bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 1212 { 1213 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1214 nMemberId &= ~CONVERT_TWIPS; 1215 1216 switch ( nMemberId ) 1217 { 1218 case 0: 1219 { 1220 uno::Sequence< beans::PropertyValue > aPropSeq; 1221 ::com::sun::star::drawing::LineDash aLineDash; 1222 rtl::OUString aName; 1223 sal_Bool bLineDash( sal_False ); 1224 1225 if ( rVal >>= aPropSeq ) 1226 { 1227 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ ) 1228 { 1229 if ( aPropSeq[n].Name.equalsAsciiL( "Name", 4 )) 1230 aPropSeq[n].Value >>= aName; 1231 else if ( aPropSeq[n].Name.equalsAsciiL( "LineDash", 8 )) 1232 { 1233 if ( aPropSeq[n].Value >>= aLineDash ) 1234 bLineDash = sal_True; 1235 } 1236 } 1237 1238 SetName( aName ); 1239 if ( bLineDash ) 1240 { 1241 XDash aXDash; 1242 1243 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style))); 1244 aXDash.SetDots(aLineDash.Dots); 1245 aXDash.SetDotLen(aLineDash.DotLen); 1246 aXDash.SetDashes(aLineDash.Dashes); 1247 aXDash.SetDashLen(aLineDash.DashLen); 1248 aXDash.SetDistance(aLineDash.Distance); 1249 1250 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) 1251 aXDash.SetDots(1); 1252 1253 SetDashValue( aXDash ); 1254 } 1255 1256 return sal_True; 1257 } 1258 1259 return sal_False; 1260 } 1261 1262 case MID_NAME: 1263 { 1264 rtl::OUString aName; 1265 if (!(rVal >>= aName)) 1266 return sal_False; 1267 SetName( aName ); 1268 break; 1269 } 1270 1271 case MID_LINEDASH: 1272 { 1273 ::com::sun::star::drawing::LineDash aLineDash; 1274 if(!(rVal >>= aLineDash)) 1275 return sal_False; 1276 1277 XDash aXDash; 1278 1279 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style))); 1280 aXDash.SetDots(aLineDash.Dots); 1281 aXDash.SetDotLen(aLineDash.DotLen); 1282 aXDash.SetDashes(aLineDash.Dashes); 1283 aXDash.SetDashLen(aLineDash.DashLen); 1284 aXDash.SetDistance(aLineDash.Distance); 1285 1286 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) 1287 aXDash.SetDots(1); 1288 1289 SetDashValue( aXDash ); 1290 break; 1291 } 1292 1293 case MID_LINEDASH_STYLE: 1294 { 1295 sal_Int16 nVal = sal_Int16(); 1296 if(!(rVal >>= nVal)) 1297 return sal_False; 1298 1299 XDash aXDash = GetDashValue(); 1300 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(nVal))); 1301 1302 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) 1303 aXDash.SetDots(1); 1304 1305 SetDashValue( aXDash ); 1306 1307 break; 1308 } 1309 1310 case MID_LINEDASH_DOTS: 1311 case MID_LINEDASH_DASHES: 1312 { 1313 sal_Int16 nVal = sal_Int16(); 1314 if(!(rVal >>= nVal)) 1315 return sal_False; 1316 1317 XDash aXDash = GetDashValue(); 1318 if ( nMemberId == MID_LINEDASH_DOTS ) 1319 aXDash.SetDots( nVal ); 1320 else 1321 aXDash.SetDashes( nVal ); 1322 1323 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) 1324 aXDash.SetDots(1); 1325 1326 SetDashValue( aXDash ); 1327 break; 1328 } 1329 1330 case MID_LINEDASH_DOTLEN: 1331 case MID_LINEDASH_DASHLEN: 1332 case MID_LINEDASH_DISTANCE: 1333 { 1334 sal_Int32 nVal = 0; 1335 if(!(rVal >>= nVal)) 1336 return sal_False; 1337 1338 XDash aXDash = GetDashValue(); 1339 if ( nMemberId == MID_LINEDASH_DOTLEN ) 1340 aXDash.SetDotLen( nVal ); 1341 else if ( nMemberId == MID_LINEDASH_DASHLEN ) 1342 aXDash.SetDashLen( nVal ); 1343 else 1344 aXDash.SetDistance( nVal ); 1345 1346 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) 1347 aXDash.SetDots(1); 1348 1349 SetDashValue( aXDash ); 1350 break; 1351 } 1352 } 1353 1354 return sal_True; 1355 } 1356 1357 sal_Bool XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ) 1358 { 1359 return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue(); 1360 } 1361 1362 XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const 1363 { 1364 if( pModel ) 1365 { 1366 const String aUniqueName = NameOrIndex::CheckNamedItem( this, 1367 XATTR_LINEDASH, 1368 &pModel->GetItemPool(), 1369 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, 1370 XLineDashItem::CompareValueFunc, 1371 RID_SVXSTR_DASH11, 1372 pModel->GetDashList() ); 1373 1374 // if the given name is not valid, replace it! 1375 if( aUniqueName != GetName() ) 1376 { 1377 return new XLineDashItem( aUniqueName, aDash ); 1378 } 1379 } 1380 1381 return (XLineDashItem*)this; 1382 } 1383 1384 // ------------------- 1385 // class XLineWidthItem 1386 // ------------------- 1387 TYPEINIT1_AUTOFACTORY(XLineWidthItem, SfxMetricItem); 1388 1389 /************************************************************************* 1390 |* 1391 |* XLineWidthItem::XLineWidthItem(long nWidth) 1392 |* 1393 |* Beschreibung 1394 |* Ersterstellung 15.11.94 1395 |* Letzte Aenderung 18.11.94 1396 |* 1397 *************************************************************************/ 1398 1399 XLineWidthItem::XLineWidthItem(long nWidth) : 1400 SfxMetricItem(XATTR_LINEWIDTH, nWidth) 1401 { 1402 } 1403 1404 /************************************************************************* 1405 |* 1406 |* XLineWidthItem::XLineWidthItem(SvStream& rIn) 1407 |* 1408 |* Beschreibung 1409 |* Ersterstellung 15.11.94 1410 |* Letzte Aenderung 15.11.94 1411 |* 1412 *************************************************************************/ 1413 1414 XLineWidthItem::XLineWidthItem(SvStream& rIn) : 1415 SfxMetricItem(XATTR_LINEWIDTH, rIn) 1416 { 1417 } 1418 1419 /************************************************************************* 1420 |* 1421 |* XLineWidthItem::Clone(SfxItemPool* pPool) const 1422 |* 1423 |* Beschreibung 1424 |* Ersterstellung 15.11.94 1425 |* Letzte Aenderung 15.11.94 1426 |* 1427 *************************************************************************/ 1428 1429 SfxPoolItem* XLineWidthItem::Clone(SfxItemPool* /*pPool*/) const 1430 { 1431 return new XLineWidthItem(*this); 1432 } 1433 1434 /************************************************************************* 1435 |* 1436 |* SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const 1437 |* 1438 |* Beschreibung 1439 |* Ersterstellung 15.11.94 1440 |* Letzte Aenderung 15.11.94 1441 |* 1442 *************************************************************************/ 1443 1444 SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 1445 { 1446 return new XLineWidthItem(rIn); 1447 } 1448 1449 //------------------------------------------------------------------------ 1450 1451 SfxItemPresentation XLineWidthItem::GetPresentation 1452 ( 1453 SfxItemPresentation ePres, 1454 SfxMapUnit eCoreUnit, 1455 SfxMapUnit ePresUnit, 1456 XubString& rText, const IntlWrapper * pIntl 1457 ) const 1458 { 1459 switch ( ePres ) 1460 { 1461 case SFX_ITEM_PRESENTATION_NONE: 1462 rText.Erase(); 1463 return ePres; 1464 case SFX_ITEM_PRESENTATION_NAMELESS: 1465 case SFX_ITEM_PRESENTATION_COMPLETE: 1466 rText = GetMetricText( (long) GetValue(), 1467 eCoreUnit, ePresUnit, pIntl); 1468 rText += SVX_RESSTR( GetMetricId( ePresUnit) ); 1469 return ePres; 1470 default: 1471 return SFX_ITEM_PRESENTATION_NONE; 1472 } 1473 } 1474 1475 sal_Bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 1476 { 1477 sal_Int32 nValue = GetValue(); 1478 if( 0 != (nMemberId&CONVERT_TWIPS) ) 1479 nValue = TWIP_TO_MM100(nValue); 1480 1481 rVal <<= nValue; 1482 return sal_True; 1483 } 1484 1485 sal_Bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 1486 { 1487 sal_Int32 nValue = 0; 1488 rVal >>= nValue; 1489 if( 0 != (nMemberId&CONVERT_TWIPS) ) 1490 nValue = MM100_TO_TWIP(nValue); 1491 1492 SetValue( nValue ); 1493 return sal_True; 1494 } 1495 1496 // ------------------- 1497 // class XLineColorItem 1498 // ------------------- 1499 TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem); 1500 1501 /************************************************************************* 1502 |* 1503 |* XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) 1504 |* 1505 |* Beschreibung 1506 |* Ersterstellung 15.11.94 1507 |* Letzte Aenderung 15.11.94 1508 |* 1509 *************************************************************************/ 1510 1511 XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) : 1512 XColorItem(XATTR_LINECOLOR, nIndex, rTheColor) 1513 { 1514 } 1515 1516 /************************************************************************* 1517 |* 1518 |* XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) 1519 |* 1520 |* Beschreibung 1521 |* Ersterstellung 15.11.94 1522 |* Letzte Aenderung 15.11.94 1523 |* 1524 *************************************************************************/ 1525 1526 XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) : 1527 XColorItem(XATTR_LINECOLOR, rName, rTheColor) 1528 { 1529 } 1530 1531 /************************************************************************* 1532 |* 1533 |* XLineColorItem::XLineColorItem(SvStream& rIn) 1534 |* 1535 |* Beschreibung 1536 |* Ersterstellung 15.11.94 1537 |* Letzte Aenderung 15.11.94 1538 |* 1539 *************************************************************************/ 1540 1541 XLineColorItem::XLineColorItem(SvStream& rIn) : 1542 XColorItem(XATTR_LINECOLOR, rIn) 1543 { 1544 } 1545 1546 /************************************************************************* 1547 |* 1548 |* XLineColorItem::Clone(SfxItemPool* pPool) const 1549 |* 1550 |* Beschreibung 1551 |* Ersterstellung 15.11.94 1552 |* Letzte Aenderung 15.11.94 1553 |* 1554 *************************************************************************/ 1555 1556 SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const 1557 { 1558 return new XLineColorItem(*this); 1559 } 1560 1561 /************************************************************************* 1562 |* 1563 |* SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const 1564 |* 1565 |* Beschreibung 1566 |* Ersterstellung 15.11.94 1567 |* Letzte Aenderung 15.11.94 1568 |* 1569 *************************************************************************/ 1570 1571 SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 1572 { 1573 return new XLineColorItem(rIn); 1574 } 1575 1576 //------------------------------------------------------------------------ 1577 1578 SfxItemPresentation XLineColorItem::GetPresentation 1579 ( 1580 SfxItemPresentation ePres, 1581 SfxMapUnit /*eCoreUnit*/, 1582 SfxMapUnit /*ePresUnit*/, 1583 XubString& rText, const IntlWrapper * 1584 ) const 1585 { 1586 switch ( ePres ) 1587 { 1588 case SFX_ITEM_PRESENTATION_NONE: 1589 rText.Erase(); 1590 return ePres; 1591 case SFX_ITEM_PRESENTATION_NAMELESS: 1592 case SFX_ITEM_PRESENTATION_COMPLETE: 1593 rText = GetName(); 1594 return ePres; 1595 default: 1596 return SFX_ITEM_PRESENTATION_NONE; 1597 } 1598 } 1599 1600 sal_Bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 1601 { 1602 rVal <<= (sal_Int32)GetColorValue().GetRGBColor(); 1603 return sal_True; 1604 } 1605 1606 sal_Bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 1607 { 1608 sal_Int32 nValue = 0; 1609 if(!(rVal >>= nValue)) 1610 return sal_False; 1611 1612 SetColorValue( nValue ); 1613 return sal_True; 1614 } 1615 1616 ////////////////////////////////////////////////////////////////////////////// 1617 // tooling for simple spooling B2DPolygon to file and back 1618 1619 namespace 1620 { 1621 void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut) 1622 { 1623 const sal_uInt32 nPolygonCount(rPolyPolygon.count()); 1624 rOut << nPolygonCount; 1625 1626 for(sal_uInt32 a(0L); a < nPolygonCount; a++) 1627 { 1628 const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a)); 1629 const sal_uInt32 nPointCount(aCandidate.count()); 1630 const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0); 1631 const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0); 1632 rOut << nPointCount; 1633 rOut << bClosed; 1634 rOut << bControlPoints; 1635 1636 for(sal_uInt32 b(0L); b < nPointCount; b++) 1637 { 1638 const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b)); 1639 rOut << aPoint.getX(); 1640 rOut << aPoint.getY(); 1641 1642 if(bControlPoints) 1643 { 1644 const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0); 1645 rOut << bEdgeIsCurve; 1646 1647 if(bEdgeIsCurve) 1648 { 1649 const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b)); 1650 rOut << aControlVectorA.getX(); 1651 rOut << aControlVectorA.getY(); 1652 1653 const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b)); 1654 rOut << aControlVectorB.getX(); 1655 rOut << aControlVectorB.getY(); 1656 } 1657 } 1658 } 1659 } 1660 } 1661 1662 basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn) 1663 { 1664 basegfx::B2DPolyPolygon aRetval; 1665 sal_uInt32 nPolygonCount; 1666 rIn >> nPolygonCount; 1667 1668 for(sal_uInt32 a(0L); a < nPolygonCount; a++) 1669 { 1670 sal_uInt32 nPointCount; 1671 sal_uInt8 bClosed; 1672 sal_uInt8 bControlPoints; 1673 1674 rIn >> nPointCount; 1675 rIn >> bClosed; 1676 rIn >> bControlPoints; 1677 1678 basegfx::B2DPolygon aCandidate; 1679 aCandidate.setClosed(0 != bClosed); 1680 1681 for(sal_uInt32 b(0L); b < nPointCount; b++) 1682 { 1683 double fX, fY; 1684 rIn >> fX; 1685 rIn >> fY; 1686 aCandidate.append(basegfx::B2DPoint(fX, fY)); 1687 1688 if(0 != bControlPoints) 1689 { 1690 sal_uInt8 bEdgeIsCurve; 1691 rIn >> bEdgeIsCurve; 1692 1693 if(0 != bEdgeIsCurve) 1694 { 1695 rIn >> fX; 1696 rIn >> fY; 1697 aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY)); 1698 1699 rIn >> fX; 1700 rIn >> fY; 1701 aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY)); 1702 } 1703 } 1704 } 1705 1706 aRetval.append(aCandidate); 1707 } 1708 1709 return aRetval; 1710 } 1711 } 1712 1713 ////////////////////////////////////////////////////////////////////////////// 1714 1715 // ----------------------- 1716 // class XLineStartItem 1717 // ----------------------- 1718 TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex); 1719 1720 /************************************************************************* 1721 |* 1722 |* XLineStartItem::XLineStartItem(sal_Int32 nIndex) 1723 |* 1724 |* Beschreibung 1725 |* Ersterstellung 15.11.94 1726 |* Letzte Aenderung 18.11.94 1727 |* 1728 *************************************************************************/ 1729 1730 XLineStartItem::XLineStartItem(sal_Int32 nIndex) 1731 : NameOrIndex(XATTR_LINESTART, nIndex) 1732 { 1733 } 1734 1735 /************************************************************************* 1736 |* 1737 |* XLineStartItem::XLineStartItem(const XubString& rName, 1738 |* const basegfx::B2DPolyPolygon& rXPolygon) 1739 |* 1740 |* Beschreibung 1741 |* Ersterstellung 15.11.94 1742 |* Letzte Aenderung 18.11.94 1743 |* 1744 *************************************************************************/ 1745 1746 XLineStartItem::XLineStartItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon) 1747 : NameOrIndex(XATTR_LINESTART, rName), 1748 maPolyPolygon(rPolyPolygon) 1749 { 1750 } 1751 1752 /************************************************************************* 1753 |* 1754 |* XLineStartItem::XLineStartItem(const XLineStartItem& rItem) 1755 |* 1756 |* Beschreibung 1757 |* Ersterstellung 15.11.94 1758 |* Letzte Aenderung 17.11.94 1759 |* 1760 *************************************************************************/ 1761 1762 XLineStartItem::XLineStartItem(const XLineStartItem& rItem) 1763 : NameOrIndex(rItem), 1764 maPolyPolygon(rItem.maPolyPolygon) 1765 { 1766 } 1767 1768 /************************************************************************* 1769 |* 1770 |* XLineStartItem::XLineStartItem(SvStream& rIn) 1771 |* 1772 |* Beschreibung 1773 |* Ersterstellung 15.11.94 1774 |* Letzte Aenderung 17.11.94 1775 |* 1776 *************************************************************************/ 1777 1778 XLineStartItem::XLineStartItem(SvStream& rIn) : 1779 NameOrIndex(XATTR_LINESTART, rIn) 1780 { 1781 if (!IsIndex()) 1782 { 1783 maPolyPolygon = streamInB2DPolyPolygon(rIn); 1784 } 1785 } 1786 1787 //************************************************************************* 1788 1789 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon) 1790 : NameOrIndex( XATTR_LINESTART, -1 ), 1791 maPolyPolygon(rPolyPolygon) 1792 { 1793 } 1794 1795 //************************************************************************* 1796 1797 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/) 1798 : NameOrIndex(XATTR_LINESTART, -1 ) 1799 { 1800 } 1801 1802 /************************************************************************* 1803 |* 1804 |* XLineStartItem::Clone(SfxItemPool* pPool) const 1805 |* 1806 |* Beschreibung 1807 |* Ersterstellung 15.11.94 1808 |* Letzte Aenderung 15.11.94 1809 |* 1810 *************************************************************************/ 1811 1812 SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const 1813 { 1814 return new XLineStartItem(*this); 1815 } 1816 1817 /************************************************************************* 1818 |* 1819 |* int XLineStartItem::operator==(const SfxPoolItem& rItem) const 1820 |* 1821 |* Beschreibung 1822 |* Ersterstellung 15.11.94 1823 |* Letzte Aenderung 18.11.94 1824 |* 1825 *************************************************************************/ 1826 1827 int XLineStartItem::operator==(const SfxPoolItem& rItem) const 1828 { 1829 return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon ); 1830 } 1831 1832 /************************************************************************* 1833 |* 1834 |* SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const 1835 |* 1836 |* Beschreibung 1837 |* Ersterstellung 15.11.94 1838 |* Letzte Aenderung 15.11.94 1839 |* 1840 *************************************************************************/ 1841 1842 SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 1843 { 1844 return new XLineStartItem(rIn); 1845 } 1846 1847 /************************************************************************* 1848 |* 1849 |* SfxPoolItem* XLineStartItem::Store(SvStream& rOut) const 1850 |* 1851 |* Beschreibung 1852 |* Ersterstellung 15.11.94 1853 |* Letzte Aenderung 18.11.94 1854 |* 1855 *************************************************************************/ 1856 1857 SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 1858 { 1859 NameOrIndex::Store( rOut, nItemVersion ); 1860 1861 if (!IsIndex()) 1862 { 1863 streamOutB2DPolyPolygon(maPolyPolygon, rOut); 1864 } 1865 1866 return rOut; 1867 } 1868 1869 /************************************************************************* 1870 |* 1871 |* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndTable* pTable) 1872 |* const 1873 |* 1874 |* Beschreibung 1875 |* Ersterstellung 15.11.94 1876 |* Letzte Aenderung 18.11.94 1877 |* 1878 *************************************************************************/ 1879 1880 basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndTable* pTable) const 1881 { 1882 if (!IsIndex()) 1883 { 1884 return maPolyPolygon; 1885 } 1886 else 1887 { 1888 return pTable->GetLineEnd(GetIndex())->GetLineEnd(); 1889 } 1890 } 1891 1892 //------------------------------------------------------------------------ 1893 1894 SfxItemPresentation XLineStartItem::GetPresentation 1895 ( 1896 SfxItemPresentation ePres, 1897 SfxMapUnit /*eCoreUnit*/, 1898 SfxMapUnit /*ePresUnit*/, 1899 XubString& rText, const IntlWrapper * 1900 ) const 1901 { 1902 switch ( ePres ) 1903 { 1904 case SFX_ITEM_PRESENTATION_NONE: 1905 rText.Erase(); 1906 return ePres; 1907 case SFX_ITEM_PRESENTATION_NAMELESS: 1908 case SFX_ITEM_PRESENTATION_COMPLETE: 1909 rText = GetName(); 1910 return ePres; 1911 default: 1912 return SFX_ITEM_PRESENTATION_NONE; 1913 } 1914 } 1915 1916 sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 1917 { 1918 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1919 nMemberId &= ~CONVERT_TWIPS; 1920 if( nMemberId == MID_NAME ) 1921 { 1922 rtl::OUString aApiName; 1923 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 1924 rVal <<= aApiName; 1925 } 1926 else 1927 { 1928 com::sun::star::drawing::PolyPolygonBezierCoords aBezier; 1929 SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier ); 1930 rVal <<= aBezier; 1931 } 1932 1933 return sal_True; 1934 } 1935 1936 sal_Bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 1937 { 1938 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 1939 nMemberId &= ~CONVERT_TWIPS; 1940 if( nMemberId == MID_NAME ) 1941 { 1942 return sal_False; 1943 } 1944 else 1945 { 1946 maPolyPolygon.clear(); 1947 1948 if( rVal.hasValue() && rVal.getValue() ) 1949 { 1950 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) ) 1951 return sal_False; 1952 1953 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue(); 1954 if( pCoords->Coordinates.getLength() > 0 ) 1955 { 1956 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords ); 1957 // #i72807# close line start/end polygons hard 1958 // maPolyPolygon.setClosed(true); 1959 } 1960 } 1961 } 1962 1963 return sal_True; 1964 } 1965 1966 /** this function searches in both the models pool and the styles pool for XLineStartItem 1967 and XLineEndItem with the same value or name and returns an item with the value of 1968 this item and a unique name for an item with this value. */ 1969 XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const 1970 { 1971 if( pModel ) 1972 { 1973 XLineStartItem* pTempItem = NULL; 1974 const XLineStartItem* pLineStartItem = this; 1975 1976 String aUniqueName( GetName() ); 1977 1978 if( !maPolyPolygon.count() ) 1979 { 1980 // if the polygon is empty, check if the name is empty 1981 if( aUniqueName.Len() == 0 ) 1982 return (XLineStartItem*)this; 1983 1984 // force empty name for empty polygons 1985 return new XLineStartItem( String(), maPolyPolygon ); 1986 } 1987 1988 if( maPolyPolygon.count() > 1L ) 1989 { 1990 // check if the polygon is closed 1991 if(!maPolyPolygon.isClosed()) 1992 { 1993 // force a closed polygon 1994 basegfx::B2DPolyPolygon aNew(maPolyPolygon); 1995 aNew.setClosed(true); 1996 pTempItem = new XLineStartItem( aUniqueName, aNew ); 1997 pLineStartItem = pTempItem; 1998 } 1999 } 2000 2001 sal_Bool bForceNew = sal_False; 2002 2003 // 2. if we have a name check if there is already an item with the 2004 // same name in the documents pool with a different line end or start 2005 2006 sal_uInt32 nCount, nSurrogate; 2007 2008 const SfxItemPool* pPool1 = &pModel->GetItemPool(); 2009 if( aUniqueName.Len() && pPool1 ) 2010 { 2011 nCount = pPool1->GetItemCount2( XATTR_LINESTART ); 2012 2013 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2014 { 2015 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate ); 2016 2017 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) 2018 { 2019 // if there is already an item with the same name and the same 2020 // value its ok to set it 2021 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() ) 2022 { 2023 // same name but different value, we need a new name for this item 2024 aUniqueName = String(); 2025 bForceNew = sal_True; 2026 } 2027 break; 2028 } 2029 } 2030 2031 if( !bForceNew ) 2032 { 2033 nCount = pPool1->GetItemCount2( XATTR_LINEEND ); 2034 2035 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2036 { 2037 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate ); 2038 2039 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) 2040 { 2041 // if there is already an item with the same name and the same 2042 // value its ok to set it 2043 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() ) 2044 { 2045 // same name but different value, we need a new name for this item 2046 aUniqueName = String(); 2047 bForceNew = sal_True; 2048 } 2049 break; 2050 } 2051 } 2052 } 2053 } 2054 2055 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL; 2056 if( aUniqueName.Len() && pPool2) 2057 { 2058 nCount = pPool2->GetItemCount2( XATTR_LINESTART ); 2059 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2060 { 2061 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate ); 2062 2063 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) 2064 { 2065 // if there is already an item with the same name and the same 2066 // value its ok to set it 2067 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() ) 2068 { 2069 // same name but different value, we need a new name for this item 2070 aUniqueName = String(); 2071 bForceNew = sal_True; 2072 } 2073 break; 2074 } 2075 } 2076 2077 if( !bForceNew ) 2078 { 2079 nCount = pPool2->GetItemCount2( XATTR_LINEEND ); 2080 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2081 { 2082 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate ); 2083 2084 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) ) 2085 { 2086 // if there is already an item with the same name and the same 2087 // value its ok to set it 2088 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() ) 2089 { 2090 // same name but different value, we need a new name for this item 2091 aUniqueName = String(); 2092 bForceNew = sal_True; 2093 } 2094 break; 2095 } 2096 } 2097 } 2098 } 2099 2100 // if we have no name yet, find existing item with same conent or 2101 // create a unique name 2102 if( aUniqueName.Len() == 0 ) 2103 { 2104 sal_Bool bFoundExisting = sal_False; 2105 2106 sal_Int32 nUserIndex = 1; 2107 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND)); 2108 const String aUser( aRes ); 2109 2110 if( pPool1 ) 2111 { 2112 nCount = pPool1->GetItemCount2( XATTR_LINESTART ); 2113 sal_uInt32 nSurrogate2; 2114 2115 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) 2116 { 2117 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); 2118 2119 if( pItem && pItem->GetName().Len() ) 2120 { 2121 if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() ) 2122 { 2123 aUniqueName = pItem->GetName(); 2124 bFoundExisting = sal_True; 2125 break; 2126 } 2127 2128 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) 2129 { 2130 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); 2131 if( nThisIndex >= nUserIndex ) 2132 nUserIndex = nThisIndex + 1; 2133 } 2134 } 2135 } 2136 2137 nCount = pPool1->GetItemCount2( XATTR_LINEEND ); 2138 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) 2139 { 2140 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); 2141 2142 if( pItem && pItem->GetName().Len() ) 2143 { 2144 if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() ) 2145 { 2146 aUniqueName = pItem->GetName(); 2147 bFoundExisting = sal_True; 2148 break; 2149 } 2150 2151 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) 2152 { 2153 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); 2154 if( nThisIndex >= nUserIndex ) 2155 nUserIndex = nThisIndex + 1; 2156 } 2157 } 2158 } 2159 } 2160 2161 if( !bFoundExisting ) 2162 { 2163 aUniqueName = aUser; 2164 aUniqueName += sal_Unicode(' '); 2165 aUniqueName += String::CreateFromInt32( nUserIndex ); 2166 } 2167 } 2168 2169 // if the given name is not valid, replace it! 2170 if( aUniqueName != GetName() || pTempItem ) 2171 { 2172 if( pTempItem ) 2173 { 2174 pTempItem->SetName( aUniqueName ); 2175 return pTempItem; 2176 } 2177 else 2178 { 2179 return new XLineStartItem( aUniqueName, maPolyPolygon ); 2180 } 2181 } 2182 } 2183 2184 return (XLineStartItem*)this; 2185 } 2186 2187 // --------------------- 2188 // class XLineEndItem 2189 // --------------------- 2190 TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex); 2191 2192 /************************************************************************* 2193 |* 2194 |* XLineEndItem::XLineEndItem(sal_Int32 nIndex) 2195 |* 2196 |* Beschreibung 2197 |* Ersterstellung 15.11.94 2198 |* Letzte Aenderung 18.11.94 2199 |* 2200 *************************************************************************/ 2201 2202 XLineEndItem::XLineEndItem(sal_Int32 nIndex) 2203 : NameOrIndex(XATTR_LINEEND, nIndex) 2204 { 2205 } 2206 2207 /************************************************************************* 2208 |* 2209 |* XLineEndItem::XLineEndItem(const XubString& rName, 2210 |* const basegfx::B2DPolyPolygon& rXPolygon) 2211 |* 2212 |* Beschreibung 2213 |* Ersterstellung 15.11.94 2214 |* Letzte Aenderung 18.11.94 2215 |* 2216 *************************************************************************/ 2217 2218 XLineEndItem::XLineEndItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon) 2219 : NameOrIndex(XATTR_LINEEND, rName), 2220 maPolyPolygon(rPolyPolygon) 2221 { 2222 } 2223 2224 /************************************************************************* 2225 |* 2226 |* XLineEndItem::XLineEndItem(const XLineEndItem& rItem) 2227 |* 2228 |* Beschreibung 2229 |* Ersterstellung 15.11.94 2230 |* Letzte Aenderung 18.11.94 2231 |* 2232 *************************************************************************/ 2233 2234 XLineEndItem::XLineEndItem(const XLineEndItem& rItem) 2235 : NameOrIndex(rItem), 2236 maPolyPolygon(rItem.maPolyPolygon) 2237 { 2238 } 2239 2240 /************************************************************************* 2241 |* 2242 |* XLineEndItem::XLineEndItem(SvStream& rIn) 2243 |* 2244 |* Beschreibung 2245 |* Ersterstellung 15.11.94 2246 |* Letzte Aenderung 17.11.94 2247 |* 2248 *************************************************************************/ 2249 2250 XLineEndItem::XLineEndItem(SvStream& rIn) : 2251 NameOrIndex(XATTR_LINEEND, rIn) 2252 { 2253 if (!IsIndex()) 2254 { 2255 maPolyPolygon = streamInB2DPolyPolygon(rIn); 2256 } 2257 } 2258 2259 //************************************************************************* 2260 2261 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon) 2262 : NameOrIndex( XATTR_LINEEND, -1 ), 2263 maPolyPolygon(rPolyPolygon) 2264 { 2265 } 2266 2267 //************************************************************************* 2268 2269 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/) 2270 : NameOrIndex(XATTR_LINEEND, -1 ) 2271 { 2272 } 2273 2274 /************************************************************************* 2275 |* 2276 |* XLineEndItem::Clone(SfxItemPool* pPool) const 2277 |* 2278 |* Beschreibung 2279 |* Ersterstellung 15.11.94 2280 |* Letzte Aenderung 15.11.94 2281 |* 2282 *************************************************************************/ 2283 2284 SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const 2285 { 2286 return new XLineEndItem(*this); 2287 } 2288 2289 /************************************************************************* 2290 |* 2291 |* int XLineEndItem::operator==(const SfxPoolItem& rItem) const 2292 |* 2293 |* Beschreibung 2294 |* Ersterstellung 15.11.94 2295 |* Letzte Aenderung 17.11.94 2296 |* 2297 *************************************************************************/ 2298 2299 int XLineEndItem::operator==(const SfxPoolItem& rItem) const 2300 { 2301 return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon ); 2302 } 2303 2304 /************************************************************************* 2305 |* 2306 |* SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 nVer) const 2307 |* 2308 |* Beschreibung 2309 |* Ersterstellung 15.11.94 2310 |* Letzte Aenderung 15.11.94 2311 |* 2312 *************************************************************************/ 2313 2314 SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 2315 { 2316 return new XLineEndItem(rIn); 2317 } 2318 2319 /************************************************************************* 2320 |* 2321 |* SfxPoolItem* XLineEndItem::Store(SvStream& rOut) const 2322 |* 2323 |* Beschreibung 2324 |* Ersterstellung 15.11.94 2325 |* Letzte Aenderung 17.11.94 2326 |* 2327 *************************************************************************/ 2328 2329 SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 2330 { 2331 NameOrIndex::Store( rOut, nItemVersion ); 2332 2333 if (!IsIndex()) 2334 { 2335 streamOutB2DPolyPolygon(maPolyPolygon, rOut); 2336 } 2337 2338 return rOut; 2339 } 2340 2341 /************************************************************************* 2342 |* 2343 |* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndTable* pTable) const 2344 |* 2345 |* Beschreibung 2346 |* Ersterstellung 15.11.94 2347 |* Letzte Aenderung 18.11.94 2348 |* 2349 *************************************************************************/ 2350 2351 basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndTable* pTable) const 2352 { 2353 if (!IsIndex()) 2354 { 2355 return maPolyPolygon; 2356 } 2357 else 2358 { 2359 return pTable->GetLineEnd(GetIndex())->GetLineEnd(); 2360 } 2361 } 2362 2363 2364 /** this function searches in both the models pool and the styles pool for XLineStartItem 2365 and XLineEndItem with the same value or name and returns an item with the value of 2366 this item and a unique name for an item with this value. */ 2367 XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const 2368 { 2369 if( pModel ) 2370 { 2371 XLineEndItem* pTempItem = NULL; 2372 const XLineEndItem* pLineEndItem = this; 2373 2374 String aUniqueName( GetName() ); 2375 2376 if( !maPolyPolygon.count() ) 2377 { 2378 // if the polygon is empty, check if the name is empty 2379 if( aUniqueName.Len() == 0 ) 2380 return (XLineEndItem*)this; 2381 2382 // force empty name for empty polygons 2383 return new XLineEndItem( String(), maPolyPolygon ); 2384 } 2385 2386 if( maPolyPolygon.count() > 1L ) 2387 { 2388 // check if the polygon is closed 2389 if(!maPolyPolygon.isClosed()) 2390 { 2391 // force a closed polygon 2392 basegfx::B2DPolyPolygon aNew(maPolyPolygon); 2393 aNew.setClosed(true); 2394 pTempItem = new XLineEndItem( aUniqueName, aNew ); 2395 pLineEndItem = pTempItem; 2396 } 2397 } 2398 2399 sal_Bool bForceNew = sal_False; 2400 2401 // 2. if we have a name check if there is already an item with the 2402 // same name in the documents pool with a different line end or start 2403 2404 sal_uInt16 nCount, nSurrogate; 2405 2406 const SfxItemPool* pPool1 = &pModel->GetItemPool(); 2407 if( aUniqueName.Len() && pPool1 ) 2408 { 2409 nCount = pPool1->GetItemCount2( XATTR_LINESTART ); 2410 2411 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2412 { 2413 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate ); 2414 2415 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) 2416 { 2417 // if there is already an item with the same name and the same 2418 // value its ok to set it 2419 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() ) 2420 { 2421 // same name but different value, we need a new name for this item 2422 aUniqueName = String(); 2423 bForceNew = sal_True; 2424 } 2425 break; 2426 } 2427 } 2428 2429 if( !bForceNew ) 2430 { 2431 nCount = pPool1->GetItemCount2( XATTR_LINEEND ); 2432 2433 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2434 { 2435 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate ); 2436 2437 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) 2438 { 2439 // if there is already an item with the same name and the same 2440 // value its ok to set it 2441 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() ) 2442 { 2443 // same name but different value, we need a new name for this item 2444 aUniqueName = String(); 2445 bForceNew = sal_True; 2446 } 2447 break; 2448 } 2449 } 2450 } 2451 } 2452 2453 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL; 2454 if( aUniqueName.Len() && pPool2) 2455 { 2456 nCount = pPool2->GetItemCount2( XATTR_LINESTART ); 2457 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2458 { 2459 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate ); 2460 2461 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) 2462 { 2463 // if there is already an item with the same name and the same 2464 // value its ok to set it 2465 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() ) 2466 { 2467 // same name but different value, we need a new name for this item 2468 aUniqueName = String(); 2469 bForceNew = sal_True; 2470 } 2471 break; 2472 } 2473 } 2474 2475 if( !bForceNew ) 2476 { 2477 nCount = pPool2->GetItemCount2( XATTR_LINEEND ); 2478 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) 2479 { 2480 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate ); 2481 2482 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) ) 2483 { 2484 // if there is already an item with the same name and the same 2485 // value its ok to set it 2486 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() ) 2487 { 2488 // same name but different value, we need a new name for this item 2489 aUniqueName = String(); 2490 bForceNew = sal_True; 2491 } 2492 break; 2493 } 2494 } 2495 } 2496 } 2497 2498 // if we have no name yet, find existing item with same conent or 2499 // create a unique name 2500 if( aUniqueName.Len() == 0 ) 2501 { 2502 sal_Bool bFoundExisting = sal_False; 2503 2504 sal_Int32 nUserIndex = 1; 2505 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND)); 2506 const String aUser( aRes ); 2507 2508 if( pPool1 ) 2509 { 2510 nCount = pPool1->GetItemCount2( XATTR_LINESTART ); 2511 sal_uInt32 nSurrogate2; 2512 2513 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) 2514 { 2515 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 ); 2516 2517 if( pItem && pItem->GetName().Len() ) 2518 { 2519 if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() ) 2520 { 2521 aUniqueName = pItem->GetName(); 2522 bFoundExisting = sal_True; 2523 break; 2524 } 2525 2526 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) 2527 { 2528 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); 2529 if( nThisIndex >= nUserIndex ) 2530 nUserIndex = nThisIndex + 1; 2531 } 2532 } 2533 } 2534 2535 nCount = pPool1->GetItemCount2( XATTR_LINEEND ); 2536 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ ) 2537 { 2538 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 ); 2539 2540 if( pItem && pItem->GetName().Len() ) 2541 { 2542 if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() ) 2543 { 2544 aUniqueName = pItem->GetName(); 2545 bFoundExisting = sal_True; 2546 break; 2547 } 2548 2549 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 ) 2550 { 2551 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32(); 2552 if( nThisIndex >= nUserIndex ) 2553 nUserIndex = nThisIndex + 1; 2554 } 2555 } 2556 } 2557 } 2558 2559 if( !bFoundExisting ) 2560 { 2561 aUniqueName = aUser; 2562 aUniqueName += sal_Unicode(' '); 2563 aUniqueName += String::CreateFromInt32( nUserIndex ); 2564 } 2565 } 2566 2567 // if the given name is not valid, replace it! 2568 if( aUniqueName != GetName() || pTempItem ) 2569 { 2570 if( pTempItem ) 2571 { 2572 pTempItem->SetName( aUniqueName ); 2573 return pTempItem; 2574 } 2575 else 2576 { 2577 return new XLineEndItem( aUniqueName, maPolyPolygon ); 2578 } 2579 } 2580 } 2581 2582 return (XLineEndItem*)this; 2583 } 2584 2585 2586 //------------------------------------------------------------------------ 2587 2588 SfxItemPresentation XLineEndItem::GetPresentation 2589 ( 2590 SfxItemPresentation ePres, 2591 SfxMapUnit /*eCoreUnit*/, 2592 SfxMapUnit /*ePresUnit*/, 2593 XubString& rText, const IntlWrapper * 2594 ) const 2595 { 2596 switch ( ePres ) 2597 { 2598 case SFX_ITEM_PRESENTATION_NONE: 2599 rText.Erase(); 2600 return ePres; 2601 case SFX_ITEM_PRESENTATION_NAMELESS: 2602 case SFX_ITEM_PRESENTATION_COMPLETE: 2603 rText = GetName(); 2604 return ePres; 2605 default: 2606 return SFX_ITEM_PRESENTATION_NONE; 2607 } 2608 } 2609 2610 sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 2611 { 2612 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2613 nMemberId &= ~CONVERT_TWIPS; 2614 if( nMemberId == MID_NAME ) 2615 { 2616 rtl::OUString aApiName; 2617 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 2618 rVal <<= aApiName; 2619 } 2620 else 2621 { 2622 com::sun::star::drawing::PolyPolygonBezierCoords aBezier; 2623 SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier ); 2624 rVal <<= aBezier; 2625 } 2626 return sal_True; 2627 } 2628 2629 sal_Bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 2630 { 2631 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 2632 nMemberId &= ~CONVERT_TWIPS; 2633 if( nMemberId == MID_NAME ) 2634 { 2635 return sal_False; 2636 } 2637 else 2638 { 2639 maPolyPolygon.clear(); 2640 2641 if( rVal.hasValue() && rVal.getValue() ) 2642 { 2643 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) ) 2644 return sal_False; 2645 2646 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue(); 2647 if( pCoords->Coordinates.getLength() > 0 ) 2648 { 2649 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords ); 2650 // #i72807# close line start/end polygons hard 2651 // maPolyPolygon.setClosed(true); 2652 } 2653 } 2654 } 2655 2656 return sal_True; 2657 } 2658 2659 // ---------------------------- 2660 // class XLineStartWidthItem 2661 // ---------------------------- 2662 TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem); 2663 2664 /************************************************************************* 2665 |* 2666 |* XLineStartWidthItem::XLineStartWidthItem(sal_Int32 nWidth) 2667 |* 2668 |* Beschreibung 2669 |* Ersterstellung 15.11.94 2670 |* Letzte Aenderung 18.11.94 2671 |* 2672 *************************************************************************/ 2673 2674 XLineStartWidthItem::XLineStartWidthItem(long nWidth) : 2675 SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth) 2676 { 2677 } 2678 2679 /************************************************************************* 2680 |* 2681 |* XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) 2682 |* 2683 |* Beschreibung 2684 |* Ersterstellung 15.11.94 2685 |* Letzte Aenderung 15.11.94 2686 |* 2687 *************************************************************************/ 2688 2689 XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) : 2690 SfxMetricItem(XATTR_LINESTARTWIDTH, rIn) 2691 { 2692 } 2693 2694 /************************************************************************* 2695 |* 2696 |* XLineStartWidthItem::Clone(SfxItemPool* pPool) const 2697 |* 2698 |* Beschreibung 2699 |* Ersterstellung 15.11.94 2700 |* Letzte Aenderung 15.11.94 2701 |* 2702 *************************************************************************/ 2703 2704 SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const 2705 { 2706 return new XLineStartWidthItem(*this); 2707 } 2708 2709 /************************************************************************* 2710 |* 2711 |* SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) 2712 |* const 2713 |* 2714 |* Beschreibung 2715 |* Ersterstellung 15.11.94 2716 |* Letzte Aenderung 15.11.94 2717 |* 2718 *************************************************************************/ 2719 2720 SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 2721 { 2722 return new XLineStartWidthItem(rIn); 2723 } 2724 2725 //------------------------------------------------------------------------ 2726 2727 SfxItemPresentation XLineStartWidthItem::GetPresentation 2728 ( 2729 SfxItemPresentation ePres, 2730 SfxMapUnit eCoreUnit, 2731 SfxMapUnit ePresUnit, 2732 XubString& rText, const IntlWrapper * pIntl 2733 ) const 2734 { 2735 switch ( ePres ) 2736 { 2737 case SFX_ITEM_PRESENTATION_NONE: 2738 rText.Erase(); 2739 return ePres; 2740 case SFX_ITEM_PRESENTATION_NAMELESS: 2741 case SFX_ITEM_PRESENTATION_COMPLETE: 2742 rText = GetMetricText( (long) GetValue(), 2743 eCoreUnit, ePresUnit, pIntl); 2744 rText += SVX_RESSTR( GetMetricId( ePresUnit) ); 2745 return ePres; 2746 default: 2747 return SFX_ITEM_PRESENTATION_NONE; 2748 } 2749 } 2750 2751 sal_Bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 2752 { 2753 rVal <<= (sal_Int32)GetValue(); 2754 return sal_True; 2755 } 2756 2757 sal_Bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 2758 { 2759 sal_Int32 nValue = 0; 2760 rVal >>= nValue; 2761 SetValue( nValue ); 2762 return sal_True; 2763 } 2764 2765 2766 2767 // -------------------------- 2768 // class XLineEndWidthItem 2769 // -------------------------- 2770 TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem); 2771 2772 /************************************************************************* 2773 |* 2774 |* XLineEndWidthItem::XLineEndWidthItem(long nWidth) 2775 |* 2776 |* Beschreibung 2777 |* Ersterstellung 15.11.94 2778 |* Letzte Aenderung 15.11.94 2779 |* 2780 *************************************************************************/ 2781 2782 XLineEndWidthItem::XLineEndWidthItem(long nWidth) : 2783 SfxMetricItem(XATTR_LINEENDWIDTH, nWidth) 2784 { 2785 } 2786 2787 /************************************************************************* 2788 |* 2789 |* XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) 2790 |* 2791 |* Beschreibung 2792 |* Ersterstellung 15.11.94 2793 |* Letzte Aenderung 15.11.94 2794 |* 2795 *************************************************************************/ 2796 2797 XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) : 2798 SfxMetricItem(XATTR_LINEENDWIDTH, rIn) 2799 { 2800 } 2801 2802 /************************************************************************* 2803 |* 2804 |* XLineEndWidthItem::Clone(SfxItemPool* pPool) const 2805 |* 2806 |* Beschreibung 2807 |* Ersterstellung 15.11.94 2808 |* Letzte Aenderung 15.11.94 2809 |* 2810 *************************************************************************/ 2811 2812 SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const 2813 { 2814 return new XLineEndWidthItem(*this); 2815 } 2816 2817 /************************************************************************* 2818 |* 2819 |* SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const 2820 |* 2821 |* Beschreibung 2822 |* Ersterstellung 15.11.94 2823 |* Letzte Aenderung 15.11.94 2824 |* 2825 *************************************************************************/ 2826 2827 SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 2828 { 2829 return new XLineEndWidthItem(rIn); 2830 } 2831 2832 //------------------------------------------------------------------------ 2833 2834 SfxItemPresentation XLineEndWidthItem::GetPresentation 2835 ( 2836 SfxItemPresentation ePres, 2837 SfxMapUnit eCoreUnit, 2838 SfxMapUnit ePresUnit, 2839 XubString& rText, const IntlWrapper *pIntl 2840 ) const 2841 { 2842 switch ( ePres ) 2843 { 2844 case SFX_ITEM_PRESENTATION_NONE: 2845 rText.Erase(); 2846 return ePres; 2847 case SFX_ITEM_PRESENTATION_NAMELESS: 2848 case SFX_ITEM_PRESENTATION_COMPLETE: 2849 rText = GetMetricText( (long) GetValue(), 2850 eCoreUnit, ePresUnit, pIntl); 2851 rText += SVX_RESSTR( GetMetricId( ePresUnit) ); 2852 return ePres; 2853 default: 2854 return SFX_ITEM_PRESENTATION_NONE; 2855 } 2856 } 2857 2858 sal_Bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 2859 { 2860 rVal <<= (sal_Int32)GetValue(); 2861 return sal_True; 2862 } 2863 2864 sal_Bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 2865 { 2866 sal_Int32 nValue = 0; 2867 rVal >>= nValue; 2868 SetValue( nValue ); 2869 return sal_True; 2870 } 2871 2872 2873 // ----------------------------- 2874 // class XLineStartCenterItem 2875 // ----------------------------- 2876 TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem); 2877 2878 /************************************************************************* 2879 |* 2880 |* XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter) 2881 |* 2882 |* Beschreibung 2883 |* Ersterstellung 15.11.94 2884 |* Letzte Aenderung 15.11.94 2885 |* 2886 *************************************************************************/ 2887 2888 XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter) : 2889 SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter) 2890 { 2891 } 2892 2893 /************************************************************************* 2894 |* 2895 |* XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) 2896 |* 2897 |* Beschreibung 2898 |* Ersterstellung 15.11.94 2899 |* Letzte Aenderung 15.11.94 2900 |* 2901 *************************************************************************/ 2902 2903 XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) : 2904 SfxBoolItem(XATTR_LINESTARTCENTER, rIn) 2905 { 2906 } 2907 2908 /************************************************************************* 2909 |* 2910 |* XLineStartCenterItem::Clone(SfxItemPool* pPool) const 2911 |* 2912 |* Beschreibung 2913 |* Ersterstellung 15.11.94 2914 |* Letzte Aenderung 15.11.94 2915 |* 2916 *************************************************************************/ 2917 2918 SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const 2919 { 2920 return new XLineStartCenterItem(*this); 2921 } 2922 2923 /************************************************************************* 2924 |* 2925 |* SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 nVer) 2926 |* const 2927 |* 2928 |* Beschreibung 2929 |* Ersterstellung 15.11.94 2930 |* Letzte Aenderung 15.11.94 2931 |* 2932 *************************************************************************/ 2933 2934 SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 2935 { 2936 return new XLineStartCenterItem(rIn); 2937 } 2938 2939 //------------------------------------------------------------------------ 2940 2941 SfxItemPresentation XLineStartCenterItem::GetPresentation 2942 ( 2943 SfxItemPresentation ePres, 2944 SfxMapUnit /*eCoreUnit*/, 2945 SfxMapUnit /*ePresUnit*/, 2946 XubString& rText, const IntlWrapper * 2947 ) const 2948 { 2949 switch ( ePres ) 2950 { 2951 case SFX_ITEM_PRESENTATION_NONE: 2952 rText.Erase(); 2953 return ePres; 2954 case SFX_ITEM_PRESENTATION_NAMELESS: 2955 case SFX_ITEM_PRESENTATION_COMPLETE: 2956 rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED : 2957 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) ); 2958 return ePres; 2959 default: 2960 return SFX_ITEM_PRESENTATION_NONE; 2961 } 2962 } 2963 2964 sal_Bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 2965 { 2966 sal_Bool bValue = GetValue(); 2967 rVal.setValue( &bValue, ::getCppuBooleanType() ); 2968 return sal_True; 2969 } 2970 2971 sal_Bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 2972 { 2973 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() ) 2974 return sal_False; 2975 2976 SetValue( *(sal_Bool*)rVal.getValue() ); 2977 return sal_True; 2978 } 2979 2980 2981 // --------------------------- 2982 // class XLineEndCenterItem 2983 // --------------------------- 2984 TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem); 2985 2986 /************************************************************************* 2987 |* 2988 |* XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter) 2989 |* 2990 |* Beschreibung 2991 |* Ersterstellung 15.11.94 2992 |* Letzte Aenderung 15.11.94 2993 |* 2994 *************************************************************************/ 2995 2996 XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter) : 2997 SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter) 2998 { 2999 } 3000 3001 /************************************************************************* 3002 |* 3003 |* XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) 3004 |* 3005 |* Beschreibung 3006 |* Ersterstellung 15.11.94 3007 |* Letzte Aenderung 15.11.94 3008 |* 3009 *************************************************************************/ 3010 3011 XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) : 3012 SfxBoolItem(XATTR_LINEENDCENTER, rIn) 3013 { 3014 } 3015 3016 /************************************************************************* 3017 |* 3018 |* XLineEndCenterItem::Clone(SfxItemPool* pPool) const 3019 |* 3020 |* Beschreibung 3021 |* Ersterstellung 15.11.94 3022 |* Letzte Aenderung 15.11.94 3023 |* 3024 *************************************************************************/ 3025 3026 SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const 3027 { 3028 return new XLineEndCenterItem(*this); 3029 } 3030 3031 /************************************************************************* 3032 |* 3033 |* SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 nVer) 3034 |* const 3035 |* 3036 |* Beschreibung 3037 |* Ersterstellung 15.11.94 3038 |* Letzte Aenderung 15.11.94 3039 |* 3040 *************************************************************************/ 3041 3042 SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 3043 { 3044 return new XLineEndCenterItem(rIn); 3045 } 3046 3047 //------------------------------------------------------------------------ 3048 3049 SfxItemPresentation XLineEndCenterItem::GetPresentation 3050 ( 3051 SfxItemPresentation ePres, 3052 SfxMapUnit /*eCoreUnit*/, 3053 SfxMapUnit /*ePresUnit*/, 3054 XubString& rText, const IntlWrapper * 3055 ) const 3056 { 3057 switch ( ePres ) 3058 { 3059 case SFX_ITEM_PRESENTATION_NONE: 3060 rText.Erase(); 3061 return ePres; 3062 case SFX_ITEM_PRESENTATION_NAMELESS: 3063 case SFX_ITEM_PRESENTATION_COMPLETE: 3064 rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED : 3065 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) ); 3066 return ePres; 3067 default: 3068 return SFX_ITEM_PRESENTATION_NONE; 3069 } 3070 } 3071 3072 sal_Bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 3073 { 3074 sal_Bool bValue = GetValue(); 3075 rVal.setValue( &bValue, ::getCppuBooleanType() ); 3076 return sal_True; 3077 } 3078 3079 sal_Bool XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 3080 { 3081 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() ) 3082 return sal_False; 3083 3084 SetValue( *(sal_Bool*)rVal.getValue() ); 3085 return sal_True; 3086 } 3087 3088 3089 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3090 // Fuellattribute 3091 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3092 3093 // -------------------- 3094 // class XFillStyleItem 3095 // -------------------- 3096 TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem); 3097 3098 /************************************************************************* 3099 |* 3100 |* XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) 3101 |* 3102 |* Beschreibung 3103 |* Ersterstellung 15.11.94 3104 |* Letzte Aenderung 15.11.94 3105 |* 3106 *************************************************************************/ 3107 3108 XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) : 3109 SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle)) 3110 { 3111 } 3112 3113 /************************************************************************* 3114 |* 3115 |* XFillStyleItem::XFillStyleItem(SvStream& rIn) 3116 |* 3117 |* Beschreibung 3118 |* Ersterstellung 15.11.94 3119 |* Letzte Aenderung 15.11.94 3120 |* 3121 *************************************************************************/ 3122 3123 XFillStyleItem::XFillStyleItem(SvStream& rIn) : 3124 SfxEnumItem(XATTR_FILLSTYLE, rIn) 3125 { 3126 } 3127 3128 /************************************************************************* 3129 |* 3130 |* XFillStyleItem::Clone(SfxItemPool* pPool) const 3131 |* 3132 |* Beschreibung 3133 |* Ersterstellung 09.11.94 3134 |* Letzte Aenderung 09.11.94 3135 |* 3136 *************************************************************************/ 3137 3138 SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const 3139 { 3140 return new XFillStyleItem( *this ); 3141 } 3142 3143 /************************************************************************* 3144 |* 3145 |* SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const 3146 |* 3147 |* Beschreibung 3148 |* Ersterstellung 15.11.94 3149 |* Letzte Aenderung 15.11.94 3150 |* 3151 *************************************************************************/ 3152 3153 SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 3154 { 3155 return new XFillStyleItem(rIn); 3156 } 3157 3158 //------------------------------------------------------------------------ 3159 3160 SfxItemPresentation XFillStyleItem::GetPresentation 3161 ( 3162 SfxItemPresentation ePres, 3163 SfxMapUnit /*eCoreUnit*/, 3164 SfxMapUnit /*ePresUnit*/, 3165 XubString& rText, const IntlWrapper * 3166 ) const 3167 { 3168 rText.Erase(); 3169 3170 switch ( ePres ) 3171 { 3172 case SFX_ITEM_PRESENTATION_NONE: 3173 return ePres; 3174 3175 case SFX_ITEM_PRESENTATION_NAMELESS: 3176 case SFX_ITEM_PRESENTATION_COMPLETE: 3177 { 3178 sal_uInt16 nId = 0; 3179 3180 switch( (sal_uInt16)GetValue() ) 3181 { 3182 case XFILL_NONE: 3183 nId = RID_SVXSTR_INVISIBLE; 3184 break; 3185 case XFILL_SOLID: 3186 nId = RID_SVXSTR_SOLID; 3187 break; 3188 case XFILL_GRADIENT: 3189 nId = RID_SVXSTR_GRADIENT; 3190 break; 3191 case XFILL_HATCH: 3192 nId = RID_SVXSTR_HATCH; 3193 break; 3194 case XFILL_BITMAP: 3195 nId = RID_SVXSTR_BITMAP; 3196 break; 3197 } 3198 3199 if ( nId ) 3200 rText = SVX_RESSTR( nId ); 3201 return ePres; 3202 } 3203 default: 3204 return SFX_ITEM_PRESENTATION_NONE; 3205 } 3206 } 3207 3208 //------------------------------------------------------------------------ 3209 3210 sal_uInt16 XFillStyleItem::GetValueCount() const 3211 { 3212 return 5; 3213 } 3214 3215 // ----------------------------------------------------------------------- 3216 sal_Bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 3217 { 3218 ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue(); 3219 3220 rVal <<= eFS; 3221 3222 return sal_True; 3223 } 3224 3225 // ----------------------------------------------------------------------- 3226 sal_Bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 3227 { 3228 ::com::sun::star::drawing::FillStyle eFS; 3229 if(!(rVal >>= eFS)) 3230 { 3231 // also try an int (for Basic) 3232 sal_Int32 nFS = 0; 3233 if(!(rVal >>= nFS)) 3234 return sal_False; 3235 eFS = (::com::sun::star::drawing::FillStyle)nFS; 3236 } 3237 3238 SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) ); 3239 3240 return sal_True; 3241 } 3242 3243 3244 // ------------------- 3245 // class XFillColorItem 3246 // ------------------- 3247 TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem); 3248 3249 /************************************************************************* 3250 |* 3251 |* XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) 3252 |* 3253 |* Beschreibung 3254 |* Ersterstellung 15.11.94 3255 |* Letzte Aenderung 15.11.94 3256 |* 3257 *************************************************************************/ 3258 3259 XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) : 3260 XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor) 3261 { 3262 } 3263 3264 /************************************************************************* 3265 |* 3266 |* XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) 3267 |* 3268 |* Beschreibung 3269 |* Ersterstellung 15.11.94 3270 |* Letzte Aenderung 15.11.94 3271 |* 3272 *************************************************************************/ 3273 3274 XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) : 3275 XColorItem(XATTR_FILLCOLOR, rName, rTheColor) 3276 { 3277 } 3278 3279 /************************************************************************* 3280 |* 3281 |* XFillColorItem::XFillColorItem(SvStream& rIn) 3282 |* 3283 |* Beschreibung 3284 |* Ersterstellung 15.11.94 3285 |* Letzte Aenderung 15.11.94 3286 |* 3287 *************************************************************************/ 3288 3289 XFillColorItem::XFillColorItem(SvStream& rIn) : 3290 XColorItem(XATTR_FILLCOLOR, rIn) 3291 { 3292 } 3293 3294 /************************************************************************* 3295 |* 3296 |* XFillColorItem::Clone(SfxItemPool* pPool) const 3297 |* 3298 |* Beschreibung 3299 |* Ersterstellung 15.11.94 3300 |* Letzte Aenderung 15.11.94 3301 |* 3302 *************************************************************************/ 3303 3304 SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const 3305 { 3306 return new XFillColorItem(*this); 3307 } 3308 3309 /************************************************************************* 3310 |* 3311 |* SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const 3312 |* 3313 |* Beschreibung 3314 |* Ersterstellung 15.11.94 3315 |* Letzte Aenderung 15.11.94 3316 |* 3317 *************************************************************************/ 3318 3319 SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 3320 { 3321 return new XFillColorItem(rIn); 3322 } 3323 3324 //------------------------------------------------------------------------ 3325 3326 SfxItemPresentation XFillColorItem::GetPresentation 3327 ( 3328 SfxItemPresentation ePres, 3329 SfxMapUnit /*eCoreUnit*/, 3330 SfxMapUnit /*ePresUnit*/, 3331 XubString& rText, const IntlWrapper * 3332 ) const 3333 { 3334 switch ( ePres ) 3335 { 3336 case SFX_ITEM_PRESENTATION_NONE: 3337 rText.Erase(); 3338 return ePres; 3339 case SFX_ITEM_PRESENTATION_NAMELESS: 3340 case SFX_ITEM_PRESENTATION_COMPLETE: 3341 rText = GetName(); 3342 return ePres; 3343 default: 3344 return SFX_ITEM_PRESENTATION_NONE; 3345 } 3346 } 3347 3348 // ----------------------------------------------------------------------- 3349 3350 sal_Bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 3351 { 3352 rVal <<= (sal_Int32)GetColorValue().GetRGBColor(); 3353 3354 return sal_True; 3355 } 3356 3357 // ----------------------------------------------------------------------- 3358 3359 sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) 3360 { 3361 sal_Int32 nValue = 0; 3362 if(!(rVal >>= nValue )) 3363 return sal_False; 3364 3365 SetColorValue( nValue ); 3366 return sal_True; 3367 } 3368 3369 // ----------------------------- 3370 // class XSecondaryFillColorItem 3371 // ----------------------------- 3372 TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem); 3373 3374 XSecondaryFillColorItem::XSecondaryFillColorItem(sal_Int32 nIndex, const Color& rTheColor) : 3375 XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor) 3376 { 3377 } 3378 3379 XSecondaryFillColorItem::XSecondaryFillColorItem(const XubString& rName, const Color& rTheColor) : 3380 XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor) 3381 { 3382 } 3383 3384 XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) : 3385 XColorItem(XATTR_SECONDARYFILLCOLOR, rIn) 3386 { 3387 } 3388 3389 SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const 3390 { 3391 return new XSecondaryFillColorItem(*this); 3392 } 3393 3394 SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, sal_uInt16 nVer ) const 3395 { 3396 if ( nVer >= 2 ) 3397 return new XSecondaryFillColorItem( rIn ); 3398 else 3399 return new XSecondaryFillColorItem( String(), Color(0,184,255) ); 3400 } 3401 sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const 3402 { 3403 return 2; 3404 } 3405 SfxItemPresentation XSecondaryFillColorItem::GetPresentation 3406 ( 3407 SfxItemPresentation ePres, 3408 SfxMapUnit /*eCoreUnit*/, 3409 SfxMapUnit /*ePresUnit*/, 3410 XubString& rText, const IntlWrapper * 3411 ) const 3412 { 3413 switch ( ePres ) 3414 { 3415 case SFX_ITEM_PRESENTATION_NONE: 3416 rText.Erase(); 3417 return ePres; 3418 case SFX_ITEM_PRESENTATION_NAMELESS: 3419 case SFX_ITEM_PRESENTATION_COMPLETE: 3420 rText = GetName(); 3421 return ePres; 3422 default: 3423 return SFX_ITEM_PRESENTATION_NONE; 3424 } 3425 } 3426 3427 // ---------------- 3428 // class XGradient 3429 // ---------------- 3430 3431 /************************************************************************* 3432 |* 3433 |* XGradient::XGradient() 3434 |* 3435 *************************************************************************/ 3436 3437 XGradient::XGradient() : 3438 eStyle( XGRAD_LINEAR ), 3439 aStartColor( Color( COL_BLACK ) ), 3440 aEndColor( Color( COL_WHITE ) ), 3441 nAngle( 0 ), 3442 nBorder( 0 ), 3443 nOfsX( 50 ), 3444 nOfsY( 50 ), 3445 nIntensStart( 100 ), 3446 nIntensEnd( 100 ), 3447 nStepCount( 0 ) 3448 { 3449 } 3450 3451 /************************************************************************* 3452 |* 3453 |* XGradient::XGradient(XGradientStyle, const Color&, const Color&, 3454 |* long, sal_uInt16, sal_uInt16, sal_uInt16) 3455 |* 3456 |* Beschreibung 3457 |* Ersterstellung 21.11.94 3458 |* Letzte Aenderung 21.11.94 3459 |* 3460 *************************************************************************/ 3461 3462 XGradient::XGradient(const Color& rStart, const Color& rEnd, 3463 XGradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs, 3464 sal_uInt16 nYOfs, sal_uInt16 nTheBorder, 3465 sal_uInt16 nStartIntens, sal_uInt16 nEndIntens, 3466 sal_uInt16 nSteps) : 3467 eStyle(eTheStyle), 3468 aStartColor(rStart), 3469 aEndColor(rEnd), 3470 nAngle(nTheAngle), 3471 nBorder(nTheBorder), 3472 nOfsX(nXOfs), 3473 nOfsY(nYOfs), 3474 nIntensStart(nStartIntens), 3475 nIntensEnd(nEndIntens), 3476 nStepCount(nSteps) 3477 { 3478 } 3479 3480 /************************************************************************* 3481 |* 3482 |* int XGradient::operator==(const SfxPoolItem& rItem) const 3483 |* 3484 |* Beschreibung 3485 |* Ersterstellung 29.11.94 3486 |* Letzte Aenderung 29.11.94 3487 |* 3488 *************************************************************************/ 3489 3490 bool XGradient::operator==(const XGradient& rGradient) const 3491 { 3492 return ( eStyle == rGradient.eStyle && 3493 aStartColor == rGradient.aStartColor && 3494 aEndColor == rGradient.aEndColor && 3495 nAngle == rGradient.nAngle && 3496 nBorder == rGradient.nBorder && 3497 nOfsX == rGradient.nOfsX && 3498 nOfsY == rGradient.nOfsY && 3499 nIntensStart == rGradient.nIntensStart && 3500 nIntensEnd == rGradient.nIntensEnd && 3501 nStepCount == rGradient.nStepCount ); 3502 } 3503 3504 3505 // ----------------------- 3506 // class XFillGradientItem 3507 // ----------------------- 3508 TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex); 3509 3510 /************************************************************************* 3511 |* 3512 |* XFillGradientItem::XFillGradientItem(sal_Int32 nIndex, 3513 |* const XGradient& rTheGradient) 3514 |* 3515 |* Beschreibung 3516 |* Ersterstellung 15.11.94 3517 |* Letzte Aenderung 15.11.94 3518 |* 3519 *************************************************************************/ 3520 3521 XFillGradientItem::XFillGradientItem(sal_Int32 nIndex, 3522 const XGradient& rTheGradient) : 3523 NameOrIndex(XATTR_FILLGRADIENT, nIndex), 3524 aGradient(rTheGradient) 3525 { 3526 } 3527 3528 /************************************************************************* 3529 |* 3530 |* XFillGradientItem::XFillGradientItem(const XubString& rName, 3531 |* const XGradient& rTheGradient) 3532 |* 3533 |* Beschreibung 3534 |* Ersterstellung 15.11.94 3535 |* Letzte Aenderung 15.11.94 3536 |* 3537 *************************************************************************/ 3538 3539 XFillGradientItem::XFillGradientItem(const XubString& rName, 3540 const XGradient& rTheGradient) : 3541 NameOrIndex(XATTR_FILLGRADIENT, rName), 3542 aGradient(rTheGradient) 3543 { 3544 } 3545 3546 /************************************************************************* 3547 |* 3548 |* XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) 3549 |* 3550 |* Beschreibung 3551 |* Ersterstellung 15.11.94 3552 |* Letzte Aenderung 15.11.94 3553 |* 3554 *************************************************************************/ 3555 3556 XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) : 3557 NameOrIndex(rItem), 3558 aGradient(rItem.aGradient) 3559 { 3560 } 3561 3562 /************************************************************************* 3563 |* 3564 |* XFillGradientItem::XFillGradientItem(SvStream& rIn) 3565 |* 3566 |* Beschreibung 3567 |* Ersterstellung 15.11.94 3568 |* Letzte Aenderung 15.11.94 3569 |* 3570 *************************************************************************/ 3571 3572 XFillGradientItem::XFillGradientItem(SvStream& rIn, sal_uInt16 nVer) : 3573 NameOrIndex(XATTR_FILLGRADIENT, rIn), 3574 aGradient(COL_BLACK, COL_WHITE) 3575 { 3576 if (!IsIndex()) 3577 { 3578 sal_uInt16 nUSTemp; 3579 sal_uInt16 nRed; 3580 sal_uInt16 nGreen; 3581 sal_uInt16 nBlue; 3582 sal_Int16 nITemp; 3583 sal_Int32 nLTemp; 3584 3585 rIn >> nITemp; aGradient.SetGradientStyle((XGradientStyle)nITemp); 3586 rIn >> nRed; 3587 rIn >> nGreen; 3588 rIn >> nBlue; 3589 Color aCol; 3590 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) ); 3591 aGradient.SetStartColor( aCol ); 3592 3593 rIn >> nRed; 3594 rIn >> nGreen; 3595 rIn >> nBlue; 3596 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) ); 3597 aGradient.SetEndColor(aCol); 3598 rIn >> nLTemp; aGradient.SetAngle(nLTemp); 3599 rIn >> nUSTemp; aGradient.SetBorder(nUSTemp); 3600 rIn >> nUSTemp; aGradient.SetXOffset(nUSTemp); 3601 rIn >> nUSTemp; aGradient.SetYOffset(nUSTemp); 3602 rIn >> nUSTemp; aGradient.SetStartIntens(nUSTemp); 3603 rIn >> nUSTemp; aGradient.SetEndIntens(nUSTemp); 3604 3605 // bei neueren Versionen wird zusaetzlich 3606 // die Schrittweite mit eingelesen 3607 if (nVer >= 1) 3608 { 3609 rIn >> nUSTemp; aGradient.SetSteps(nUSTemp); 3610 } 3611 } 3612 } 3613 3614 //************************************************************************* 3615 3616 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient) 3617 : NameOrIndex( XATTR_FILLGRADIENT, -1 ), 3618 aGradient(rTheGradient) 3619 { 3620 } 3621 3622 //************************************************************************* 3623 3624 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/) 3625 : NameOrIndex(XATTR_FILLGRADIENT, -1 ) 3626 { 3627 } 3628 3629 /************************************************************************* 3630 |* 3631 |* XFillGradientItem::Clone(SfxItemPool* pPool) const 3632 |* 3633 |* Beschreibung 3634 |* Ersterstellung 15.11.94 3635 |* Letzte Aenderung 15.11.94 3636 |* 3637 *************************************************************************/ 3638 3639 SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const 3640 { 3641 return new XFillGradientItem(*this); 3642 } 3643 3644 /************************************************************************* 3645 |* 3646 |* int XFillGradientItem::operator==(const SfxPoolItem& rItem) const 3647 |* 3648 |* Beschreibung 3649 |* Ersterstellung 15.11.94 3650 |* Letzte Aenderung 15.11.94 3651 |* 3652 *************************************************************************/ 3653 3654 int XFillGradientItem::operator==(const SfxPoolItem& rItem) const 3655 { 3656 return ( NameOrIndex::operator==(rItem) && 3657 aGradient == ((const XFillGradientItem&) rItem).aGradient ); 3658 } 3659 3660 /************************************************************************* 3661 |* 3662 |* SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const 3663 |* 3664 |* Beschreibung 3665 |* Ersterstellung 15.11.94 3666 |* Letzte Aenderung 15.11.94 3667 |* 3668 *************************************************************************/ 3669 3670 SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const 3671 { 3672 return new XFillGradientItem(rIn, nVer); 3673 } 3674 3675 /************************************************************************* 3676 |* 3677 |* SfxPoolItem* XFillGradientItem::Store(SvStream& rOut) const 3678 |* 3679 |* Beschreibung 3680 |* Ersterstellung 15.11.94 3681 |* Letzte Aenderung 15.11.94 3682 |* 3683 *************************************************************************/ 3684 3685 SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 3686 { 3687 NameOrIndex::Store( rOut, nItemVersion ); 3688 3689 if (!IsIndex()) 3690 { 3691 rOut << (sal_Int16)aGradient.GetGradientStyle(); 3692 3693 sal_uInt16 nTmp; 3694 3695 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut << nTmp; 3696 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut << nTmp; 3697 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut << nTmp; 3698 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut << nTmp; 3699 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut << nTmp; 3700 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut << nTmp; 3701 3702 rOut << (sal_Int32) aGradient.GetAngle(); 3703 rOut << aGradient.GetBorder(); 3704 rOut << aGradient.GetXOffset(); 3705 rOut << aGradient.GetYOffset(); 3706 rOut << aGradient.GetStartIntens(); 3707 rOut << aGradient.GetEndIntens(); 3708 rOut << aGradient.GetSteps(); 3709 } 3710 3711 return rOut; 3712 } 3713 3714 /************************************************************************* 3715 |* 3716 |* const XGradient& XFillGradientItem::GetValue(const XGradientTable* pTable) 3717 |* const 3718 |* 3719 |* Beschreibung 3720 |* Ersterstellung 15.11.94 3721 |* Letzte Aenderung 18.11.94 3722 |* 3723 *************************************************************************/ 3724 3725 const XGradient& XFillGradientItem::GetGradientValue(const XGradientTable* pTable) const // GetValue -> GetGradientValue 3726 { 3727 if (!IsIndex()) 3728 return aGradient; 3729 else 3730 return pTable->GetGradient(GetIndex())->GetGradient(); 3731 } 3732 3733 3734 /************************************************************************* 3735 |* 3736 |* sal_uInt16 XFillGradientItem::GetVersion() const 3737 |* 3738 |* Beschreibung 3739 |* Ersterstellung 01.11.95 3740 |* Letzte Aenderung 01.11.95 3741 |* 3742 *************************************************************************/ 3743 3744 sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const 3745 { 3746 // !!! this version number also represents the version number of superclasses 3747 // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here, 3748 // !!! the superclass is also affected 3749 return 1; 3750 } 3751 3752 //------------------------------------------------------------------------ 3753 3754 SfxItemPresentation XFillGradientItem::GetPresentation 3755 ( 3756 SfxItemPresentation ePres, 3757 SfxMapUnit /*eCoreUnit*/, 3758 SfxMapUnit /*ePresUnit*/, 3759 XubString& rText, const IntlWrapper * 3760 ) const 3761 { 3762 switch ( ePres ) 3763 { 3764 case SFX_ITEM_PRESENTATION_NONE: 3765 rText.Erase(); 3766 return ePres; 3767 case SFX_ITEM_PRESENTATION_NAMELESS: 3768 case SFX_ITEM_PRESENTATION_COMPLETE: 3769 rText = GetName(); 3770 return ePres; 3771 default: 3772 return SFX_ITEM_PRESENTATION_NONE; 3773 } 3774 } 3775 3776 // ----------------------------------------------------------------------- 3777 sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 3778 { 3779 //sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3780 nMemberId &= ~CONVERT_TWIPS; 3781 switch ( nMemberId ) 3782 { 3783 case 0: 3784 { 3785 uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); 3786 3787 ::com::sun::star::awt::Gradient aGradient2; 3788 3789 const XGradient& aXGradient = GetGradientValue(); 3790 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle(); 3791 aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); 3792 aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); 3793 aGradient2.Angle = (short)aXGradient.GetAngle(); 3794 aGradient2.Border = aXGradient.GetBorder(); 3795 aGradient2.XOffset = aXGradient.GetXOffset(); 3796 aGradient2.YOffset = aXGradient.GetYOffset(); 3797 aGradient2.StartIntensity = aXGradient.GetStartIntens(); 3798 aGradient2.EndIntensity = aXGradient.GetEndIntens(); 3799 aGradient2.StepCount = aXGradient.GetSteps(); 3800 3801 rtl::OUString aApiName; 3802 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 3803 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); 3804 aPropSeq[0].Value = uno::makeAny( aApiName ); 3805 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" )); 3806 aPropSeq[1].Value = uno::makeAny( aGradient2 ); 3807 rVal = uno::makeAny( aPropSeq ); 3808 break; 3809 } 3810 3811 case MID_FILLGRADIENT: 3812 { 3813 const XGradient& aXGradient = GetGradientValue(); 3814 ::com::sun::star::awt::Gradient aGradient2; 3815 3816 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle(); 3817 aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); 3818 aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); 3819 aGradient2.Angle = (short)aXGradient.GetAngle(); 3820 aGradient2.Border = aXGradient.GetBorder(); 3821 aGradient2.XOffset = aXGradient.GetXOffset(); 3822 aGradient2.YOffset = aXGradient.GetYOffset(); 3823 aGradient2.StartIntensity = aXGradient.GetStartIntens(); 3824 aGradient2.EndIntensity = aXGradient.GetEndIntens(); 3825 aGradient2.StepCount = aXGradient.GetSteps(); 3826 3827 rVal <<= aGradient2; 3828 break; 3829 } 3830 3831 case MID_NAME: 3832 { 3833 rtl::OUString aApiName; 3834 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 3835 rVal <<= aApiName; 3836 break; 3837 } 3838 3839 case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break; 3840 case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break; 3841 case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break; 3842 case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break; 3843 case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break; 3844 case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break; 3845 case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break; 3846 case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break; 3847 case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break; 3848 case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break; 3849 3850 default: DBG_ERROR("Wrong MemberId!"); return sal_False; 3851 } 3852 3853 return sal_True; 3854 } 3855 3856 // ----------------------------------------------------------------------- 3857 sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 3858 { 3859 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 3860 nMemberId &= ~CONVERT_TWIPS; 3861 3862 switch ( nMemberId ) 3863 { 3864 case 0: 3865 { 3866 uno::Sequence< beans::PropertyValue > aPropSeq; 3867 ::com::sun::star::awt::Gradient aGradient2; 3868 rtl::OUString aName; 3869 bool bGradient( false ); 3870 3871 if ( rVal >>= aPropSeq ) 3872 { 3873 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ ) 3874 { 3875 if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ))) 3876 aPropSeq[n].Value >>= aName; 3877 else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillGradient" ))) 3878 { 3879 if ( aPropSeq[n].Value >>= aGradient2 ) 3880 bGradient = true; 3881 } 3882 } 3883 3884 SetName( aName ); 3885 if ( bGradient ) 3886 { 3887 XGradient aXGradient; 3888 3889 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style ); 3890 aXGradient.SetStartColor( aGradient2.StartColor ); 3891 aXGradient.SetEndColor( aGradient2.EndColor ); 3892 aXGradient.SetAngle( aGradient2.Angle ); 3893 aXGradient.SetBorder( aGradient2.Border ); 3894 aXGradient.SetXOffset( aGradient2.XOffset ); 3895 aXGradient.SetYOffset( aGradient2.YOffset ); 3896 aXGradient.SetStartIntens( aGradient2.StartIntensity ); 3897 aXGradient.SetEndIntens( aGradient2.EndIntensity ); 3898 aXGradient.SetSteps( aGradient2.StepCount ); 3899 3900 SetGradientValue( aXGradient ); 3901 } 3902 3903 return sal_True; 3904 } 3905 3906 return sal_False; 3907 } 3908 3909 case MID_NAME: 3910 { 3911 rtl::OUString aName; 3912 if (!(rVal >>= aName )) 3913 return sal_False; 3914 SetName( aName ); 3915 break; 3916 } 3917 3918 case MID_FILLGRADIENT: 3919 { 3920 ::com::sun::star::awt::Gradient aGradient2; 3921 if(!(rVal >>= aGradient2)) 3922 return sal_False; 3923 3924 XGradient aXGradient; 3925 3926 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style ); 3927 aXGradient.SetStartColor( aGradient2.StartColor ); 3928 aXGradient.SetEndColor( aGradient2.EndColor ); 3929 aXGradient.SetAngle( aGradient2.Angle ); 3930 aXGradient.SetBorder( aGradient2.Border ); 3931 aXGradient.SetXOffset( aGradient2.XOffset ); 3932 aXGradient.SetYOffset( aGradient2.YOffset ); 3933 aXGradient.SetStartIntens( aGradient2.StartIntensity ); 3934 aXGradient.SetEndIntens( aGradient2.EndIntensity ); 3935 aXGradient.SetSteps( aGradient2.StepCount ); 3936 3937 SetGradientValue( aXGradient ); 3938 break; 3939 } 3940 3941 case MID_GRADIENT_STARTCOLOR: 3942 case MID_GRADIENT_ENDCOLOR: 3943 { 3944 sal_Int32 nVal = 0; 3945 if(!(rVal >>= nVal )) 3946 return sal_False; 3947 3948 XGradient aXGradient = GetGradientValue(); 3949 3950 if ( nMemberId == MID_GRADIENT_STARTCOLOR ) 3951 aXGradient.SetStartColor( nVal ); 3952 else 3953 aXGradient.SetEndColor( nVal ); 3954 SetGradientValue( aXGradient ); 3955 break; 3956 } 3957 3958 case MID_GRADIENT_STYLE: 3959 case MID_GRADIENT_ANGLE: 3960 case MID_GRADIENT_BORDER: 3961 case MID_GRADIENT_STARTINTENSITY: 3962 case MID_GRADIENT_ENDINTENSITY: 3963 case MID_GRADIENT_STEPCOUNT: 3964 case MID_GRADIENT_XOFFSET: 3965 case MID_GRADIENT_YOFFSET: 3966 { 3967 sal_Int16 nVal = sal_Int16(); 3968 if(!(rVal >>= nVal )) 3969 return sal_False; 3970 3971 XGradient aXGradient = GetGradientValue(); 3972 3973 switch ( nMemberId ) 3974 { 3975 case MID_GRADIENT_STYLE: 3976 aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break; 3977 case MID_GRADIENT_ANGLE: 3978 aXGradient.SetAngle( nVal ); break; 3979 case MID_GRADIENT_BORDER: 3980 aXGradient.SetBorder( nVal ); break; 3981 case MID_GRADIENT_STARTINTENSITY: 3982 aXGradient.SetStartIntens( nVal ); break; 3983 case MID_GRADIENT_ENDINTENSITY: 3984 aXGradient.SetEndIntens( nVal ); break; 3985 case MID_GRADIENT_STEPCOUNT: 3986 aXGradient.SetSteps( nVal ); break; 3987 case MID_GRADIENT_XOFFSET: 3988 aXGradient.SetXOffset( nVal ); break; 3989 case MID_GRADIENT_YOFFSET: 3990 aXGradient.SetYOffset( nVal ); break; 3991 } 3992 3993 SetGradientValue( aXGradient ); 3994 break; 3995 } 3996 } 3997 3998 return sal_True; 3999 } 4000 4001 sal_Bool XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ) 4002 { 4003 return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue(); 4004 } 4005 4006 XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const 4007 { 4008 if( pModel ) 4009 { 4010 const String aUniqueName = NameOrIndex::CheckNamedItem( this, 4011 XATTR_FILLGRADIENT, 4012 &pModel->GetItemPool(), 4013 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, 4014 XFillGradientItem::CompareValueFunc, 4015 RID_SVXSTR_GRADIENT, 4016 pModel->GetGradientList() ); 4017 4018 // if the given name is not valid, replace it! 4019 if( aUniqueName != GetName() ) 4020 { 4021 return new XFillGradientItem( aUniqueName, aGradient ); 4022 } 4023 } 4024 4025 return (XFillGradientItem*)this; 4026 } 4027 4028 // ---------------------------------- 4029 // class XFillFloatTransparenceItem - 4030 // ---------------------------------- 4031 4032 TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem ); 4033 4034 // ----------------------------------------------------------------------------- 4035 4036 XFillFloatTransparenceItem::XFillFloatTransparenceItem() : 4037 bEnabled( sal_False ) 4038 { 4039 SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4040 } 4041 4042 //------------------------------------------------------------------------ 4043 4044 XFillFloatTransparenceItem::XFillFloatTransparenceItem( sal_Int32 nIndex, const XGradient& rGradient, sal_Bool bEnable ) : 4045 XFillGradientItem ( nIndex, rGradient ), 4046 bEnabled ( bEnable ) 4047 { 4048 SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4049 } 4050 4051 //------------------------------------------------------------------------ 4052 4053 XFillFloatTransparenceItem::XFillFloatTransparenceItem(const XubString& rName, const XGradient& rGradient, sal_Bool bEnable ) : 4054 XFillGradientItem ( rName, rGradient ), 4055 bEnabled ( bEnable ) 4056 { 4057 SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4058 } 4059 4060 //------------------------------------------------------------------------ 4061 4062 XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) : 4063 XFillGradientItem ( rItem ), 4064 bEnabled ( rItem.bEnabled ) 4065 { 4066 SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4067 } 4068 4069 //------------------------------------------------------------------------ 4070 4071 //XFillFloatTransparenceItem::XFillFloatTransparenceItem( SvStream& rIn, sal_uInt16 nVer ) : 4072 // XFillGradientItem ( rIn, nVer ) 4073 //{ 4074 // SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4075 // rIn >> bEnabled; 4076 //} 4077 4078 //************************************************************************* 4079 4080 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, sal_Bool bEnable ) 4081 : XFillGradientItem ( -1, rTheGradient ), 4082 bEnabled ( bEnable ) 4083 { 4084 SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4085 } 4086 4087 //************************************************************************* 4088 4089 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/) 4090 { 4091 SetWhich( XATTR_FILLFLOATTRANSPARENCE ); 4092 } 4093 4094 //------------------------------------------------------------------------ 4095 4096 int XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const 4097 { 4098 return ( NameOrIndex::operator==(rItem) ) && 4099 ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) && 4100 ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled ); 4101 } 4102 4103 //------------------------------------------------------------------------ 4104 4105 SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const 4106 { 4107 return new XFillFloatTransparenceItem( *this ); 4108 } 4109 4110 //------------------------------------------------------------------------ 4111 4112 //SfxPoolItem* XFillFloatTransparenceItem::Create( SvStream& rIn, sal_uInt16 nVer ) const 4113 //{ 4114 // return( ( 0 == nVer ) ? Clone( NULL ) : new XFillFloatTransparenceItem( rIn, nVer ) ); 4115 //} 4116 4117 //------------------------------------------------------------------------ 4118 4119 //SvStream& XFillFloatTransparenceItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 4120 //{ 4121 // XFillGradientItem::Store( rOut, nItemVersion ); 4122 // rOut << bEnabled; 4123 // return rOut; 4124 //} 4125 4126 //------------------------------------------------------------------------ 4127 4128 sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const 4129 { 4130 // !!! if version number of this object must be increased, please !!! 4131 // !!! increase version number of base class XFillGradientItem !!! 4132 return XFillGradientItem::GetVersion( nFileFormatVersion ); 4133 } 4134 4135 //------------------------------------------------------------------------ 4136 4137 sal_Bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 4138 { 4139 return XFillGradientItem::QueryValue( rVal, nMemberId ); 4140 } 4141 4142 //------------------------------------------------------------------------ 4143 4144 sal_Bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 4145 { 4146 return XFillGradientItem::PutValue( rVal, nMemberId ); 4147 } 4148 4149 //------------------------------------------------------------------------ 4150 4151 SfxItemPresentation XFillFloatTransparenceItem::GetPresentation( SfxItemPresentation ePres, 4152 SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit, 4153 XubString& rText, 4154 const IntlWrapper * pIntlWrapper ) const 4155 { 4156 return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper ); 4157 } 4158 4159 sal_Bool XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ) 4160 { 4161 return ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() && 4162 ((XFillFloatTransparenceItem*)p1)->GetGradientValue() == ((XFillFloatTransparenceItem*)p2)->GetGradientValue(); 4163 } 4164 4165 XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const 4166 { 4167 // #85953# unique name only necessary when enabled 4168 if(IsEnabled()) 4169 { 4170 if( pModel ) 4171 { 4172 const String aUniqueName = NameOrIndex::CheckNamedItem( this, 4173 XATTR_FILLFLOATTRANSPARENCE, 4174 &pModel->GetItemPool(), 4175 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, 4176 XFillFloatTransparenceItem::CompareValueFunc, 4177 RID_SVXSTR_TRASNGR0, 4178 NULL ); 4179 4180 // if the given name is not valid, replace it! 4181 if( aUniqueName != GetName() ) 4182 { 4183 return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), sal_True ); 4184 } 4185 } 4186 } 4187 else 4188 { 4189 // #85953# if disabled, force name to empty string 4190 if(GetName().Len()) 4191 { 4192 return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False); 4193 } 4194 } 4195 4196 return (XFillFloatTransparenceItem*)this; 4197 } 4198 4199 // ------------- 4200 // class XHatch 4201 // ------------- 4202 4203 /************************************************************************* 4204 |* 4205 |* XHatch::XHatch(XHatchStyle, const Color&, long, long) 4206 |* 4207 |* Beschreibung 4208 |* Ersterstellung 21.11.94 4209 |* Letzte Aenderung 21.11.94 4210 |* 4211 *************************************************************************/ 4212 4213 XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance, 4214 long nTheAngle) : 4215 eStyle(eTheStyle), 4216 aColor(rCol), 4217 nDistance(nTheDistance), 4218 nAngle(nTheAngle) 4219 { 4220 } 4221 4222 /************************************************************************* 4223 |* 4224 |* int XHatch::operator==(const SfxPoolItem& rItem) const 4225 |* 4226 |* Beschreibung 4227 |* Ersterstellung 29.11.94 4228 |* Letzte Aenderung 29.11.94 4229 |* 4230 *************************************************************************/ 4231 4232 bool XHatch::operator==(const XHatch& rHatch) const 4233 { 4234 return ( eStyle == rHatch.eStyle && 4235 aColor == rHatch.aColor && 4236 nDistance == rHatch.nDistance && 4237 nAngle == rHatch.nAngle ); 4238 } 4239 4240 4241 // ----------------------- 4242 // class XFillHatchItem 4243 // ----------------------- 4244 TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex); 4245 4246 /************************************************************************* 4247 |* 4248 |* XFillHatchItem::XFillHatchItem(sal_Int32 nIndex, 4249 |* const XHatch& rTheHatch) 4250 |* 4251 |* Beschreibung 4252 |* Ersterstellung 15.11.94 4253 |* Letzte Aenderung 15.11.94 4254 |* 4255 *************************************************************************/ 4256 4257 XFillHatchItem::XFillHatchItem(sal_Int32 nIndex, 4258 const XHatch& rTheHatch) : 4259 NameOrIndex(XATTR_FILLHATCH, nIndex), 4260 aHatch(rTheHatch) 4261 { 4262 } 4263 4264 /************************************************************************* 4265 |* 4266 |* XFillHatchItem::XFillHatchItem(const XubString& rName, 4267 |* const XHatch& rTheHatch) 4268 |* 4269 |* Beschreibung 4270 |* Ersterstellung 15.11.94 4271 |* Letzte Aenderung 15.11.94 4272 |* 4273 *************************************************************************/ 4274 4275 XFillHatchItem::XFillHatchItem(const XubString& rName, 4276 const XHatch& rTheHatch) : 4277 NameOrIndex(XATTR_FILLHATCH, rName), 4278 aHatch(rTheHatch) 4279 { 4280 } 4281 4282 /************************************************************************* 4283 |* 4284 |* XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) 4285 |* 4286 |* Beschreibung 4287 |* Ersterstellung 15.11.94 4288 |* Letzte Aenderung 15.11.94 4289 |* 4290 *************************************************************************/ 4291 4292 XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) : 4293 NameOrIndex(rItem), 4294 aHatch(rItem.aHatch) 4295 { 4296 } 4297 4298 /************************************************************************* 4299 |* 4300 |* XFillHatchItem::XFillHatchItem(SvStream& rIn) 4301 |* 4302 |* Beschreibung 4303 |* Ersterstellung 15.11.94 4304 |* Letzte Aenderung 15.11.94 4305 |* 4306 *************************************************************************/ 4307 4308 XFillHatchItem::XFillHatchItem(SvStream& rIn) : 4309 NameOrIndex(XATTR_FILLHATCH, rIn), 4310 aHatch(COL_BLACK) 4311 { 4312 if (!IsIndex()) 4313 { 4314 sal_uInt16 nRed; 4315 sal_uInt16 nGreen; 4316 sal_uInt16 nBlue; 4317 sal_Int16 nITemp; 4318 sal_Int32 nLTemp; 4319 4320 rIn >> nITemp; aHatch.SetHatchStyle((XHatchStyle)nITemp); 4321 rIn >> nRed; 4322 rIn >> nGreen; 4323 rIn >> nBlue; 4324 4325 Color aCol; 4326 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) ); 4327 aHatch.SetColor(aCol); 4328 rIn >> nLTemp; aHatch.SetDistance(nLTemp); 4329 rIn >> nLTemp; aHatch.SetAngle(nLTemp); 4330 } 4331 } 4332 4333 //************************************************************************* 4334 4335 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch) 4336 : NameOrIndex( XATTR_FILLHATCH, -1 ), 4337 aHatch(rTheHatch) 4338 { 4339 } 4340 4341 //************************************************************************* 4342 4343 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/) 4344 : NameOrIndex(XATTR_FILLHATCH, -1 ) 4345 { 4346 } 4347 4348 /************************************************************************* 4349 |* 4350 |* XFillHatchItem::Clone(SfxItemPool* pPool) const 4351 |* 4352 |* Beschreibung 4353 |* Ersterstellung 15.11.94 4354 |* Letzte Aenderung 15.11.94 4355 |* 4356 *************************************************************************/ 4357 4358 SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const 4359 { 4360 return new XFillHatchItem(*this); 4361 } 4362 4363 /************************************************************************* 4364 |* 4365 |* int XFillHatchItem::operator==(const SfxPoolItem& rItem) const 4366 |* 4367 |* Beschreibung 4368 |* Ersterstellung 15.11.94 4369 |* Letzte Aenderung 15.11.94 4370 |* 4371 *************************************************************************/ 4372 4373 int XFillHatchItem::operator==(const SfxPoolItem& rItem) const 4374 { 4375 return ( NameOrIndex::operator==(rItem) && 4376 aHatch == ((const XFillHatchItem&) rItem).aHatch ); 4377 } 4378 4379 /************************************************************************* 4380 |* 4381 |* SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 nVer) const 4382 |* 4383 |* Beschreibung 4384 |* Ersterstellung 15.11.94 4385 |* Letzte Aenderung 15.11.94 4386 |* 4387 *************************************************************************/ 4388 4389 SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 4390 { 4391 return new XFillHatchItem(rIn); 4392 } 4393 4394 /************************************************************************* 4395 |* 4396 |* SfxPoolItem* XFillHatchItem::Store(SvStream& rOut) const 4397 |* 4398 |* Beschreibung 4399 |* Ersterstellung 15.11.94 4400 |* Letzte Aenderung 15.11.94 4401 |* 4402 *************************************************************************/ 4403 4404 SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const 4405 { 4406 NameOrIndex::Store( rOut, nItemVersion ); 4407 4408 if (!IsIndex()) 4409 { 4410 rOut << (sal_Int16)aHatch.GetHatchStyle(); 4411 4412 sal_uInt16 nTmp; 4413 nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut << nTmp; 4414 nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut << nTmp; 4415 nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut << nTmp; 4416 4417 rOut << (sal_Int32) aHatch.GetDistance(); 4418 rOut << (sal_Int32) aHatch.GetAngle(); 4419 } 4420 4421 return rOut; 4422 } 4423 4424 /************************************************************************* 4425 |* 4426 |* const XHatch& XFillHatchItem::GetValue(const XHatchTable* pTable) const 4427 |* 4428 |* Beschreibung 4429 |* Ersterstellung 15.11.94 4430 |* Letzte Aenderung 18.11.94 4431 |* 4432 *************************************************************************/ 4433 4434 const XHatch& XFillHatchItem::GetHatchValue(const XHatchTable* pTable) const // GetValue -> GetHatchValue 4435 { 4436 if (!IsIndex()) 4437 return aHatch; 4438 else 4439 return pTable->GetHatch(GetIndex())->GetHatch(); 4440 } 4441 4442 //------------------------------------------------------------------------ 4443 4444 SfxItemPresentation XFillHatchItem::GetPresentation 4445 ( 4446 SfxItemPresentation ePres, 4447 SfxMapUnit /*eCoreUnit*/, 4448 SfxMapUnit /*ePresUnit*/, 4449 XubString& rText, const IntlWrapper * 4450 ) const 4451 { 4452 switch ( ePres ) 4453 { 4454 case SFX_ITEM_PRESENTATION_NONE: 4455 rText.Erase(); 4456 return ePres; 4457 case SFX_ITEM_PRESENTATION_NAMELESS: 4458 case SFX_ITEM_PRESENTATION_COMPLETE: 4459 rText = GetName(); 4460 return ePres; 4461 default: 4462 return SFX_ITEM_PRESENTATION_NONE; 4463 } 4464 } 4465 4466 //------------------------------------------------------------------------ 4467 4468 FASTBOOL XFillHatchItem::HasMetrics() const 4469 { 4470 return sal_True; 4471 } 4472 4473 //------------------------------------------------------------------------ 4474 4475 FASTBOOL XFillHatchItem::ScaleMetrics(long nMul, long nDiv) 4476 { 4477 aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) ); 4478 return sal_True; 4479 } 4480 4481 // ----------------------------------------------------------------------- 4482 sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const 4483 { 4484 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 4485 nMemberId &= ~CONVERT_TWIPS; 4486 4487 switch ( nMemberId ) 4488 { 4489 case 0: 4490 { 4491 uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); 4492 4493 ::com::sun::star::drawing::Hatch aUnoHatch; 4494 4495 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); 4496 aUnoHatch.Color = aHatch.GetColor().GetColor(); 4497 aUnoHatch.Distance = aHatch.GetDistance(); 4498 aUnoHatch.Angle = aHatch.GetAngle(); 4499 4500 rtl::OUString aApiName; 4501 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 4502 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )); 4503 aPropSeq[0].Value = uno::makeAny( aApiName ); 4504 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" )); 4505 aPropSeq[1].Value = uno::makeAny( aUnoHatch ); 4506 rVal = uno::makeAny( aPropSeq ); 4507 break; 4508 } 4509 4510 case MID_FILLHATCH: 4511 { 4512 ::com::sun::star::drawing::Hatch aUnoHatch; 4513 4514 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); 4515 aUnoHatch.Color = aHatch.GetColor().GetColor(); 4516 aUnoHatch.Distance = aHatch.GetDistance(); 4517 aUnoHatch.Angle = aHatch.GetAngle(); 4518 rVal <<= aUnoHatch; 4519 break; 4520 } 4521 4522 case MID_NAME: 4523 { 4524 rtl::OUString aApiName; 4525 SvxUnogetApiNameForItem( Which(), GetName(), aApiName ); 4526 rVal <<= aApiName; 4527 break; 4528 } 4529 4530 case MID_HATCH_STYLE: 4531 rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break; 4532 case MID_HATCH_COLOR: 4533 rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break; 4534 case MID_HATCH_DISTANCE: 4535 rVal <<= aHatch.GetDistance(); break; 4536 case MID_HATCH_ANGLE: 4537 rVal <<= aHatch.GetAngle(); break; 4538 4539 default: DBG_ERROR("Wrong MemberId!"); return sal_False; 4540 } 4541 4542 return sal_True; 4543 } 4544 4545 // ----------------------------------------------------------------------- 4546 sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) 4547 { 4548 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); 4549 nMemberId &= ~CONVERT_TWIPS; 4550 4551 switch ( nMemberId ) 4552 { 4553 case 0: 4554 { 4555 uno::Sequence< beans::PropertyValue > aPropSeq; 4556 ::com::sun::star::drawing::Hatch aUnoHatch; 4557 rtl::OUString aName; 4558 bool bHatch( false ); 4559 4560 if ( rVal >>= aPropSeq ) 4561 { 4562 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ ) 4563 { 4564 if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ))) 4565 aPropSeq[n].Value >>= aName; 4566 else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillHatch" ))) 4567 { 4568 if ( aPropSeq[n].Value >>= aUnoHatch ) 4569 bHatch = true; 4570 } 4571 } 4572 4573 SetName( aName ); 4574 if ( bHatch ) 4575 { 4576 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style ); 4577 aHatch.SetColor( aUnoHatch.Color ); 4578 aHatch.SetDistance( aUnoHatch.Distance ); 4579 aHatch.SetAngle( aUnoHatch.Angle ); 4580 } 4581 4582 return sal_True; 4583 } 4584 4585 return sal_False; 4586 } 4587 4588 case MID_FILLHATCH: 4589 { 4590 ::com::sun::star::drawing::Hatch aUnoHatch; 4591 if(!(rVal >>= aUnoHatch)) 4592 return sal_False; 4593 4594 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style ); 4595 aHatch.SetColor( aUnoHatch.Color ); 4596 aHatch.SetDistance( aUnoHatch.Distance ); 4597 aHatch.SetAngle( aUnoHatch.Angle ); 4598 break; 4599 } 4600 4601 case MID_NAME: 4602 { 4603 rtl::OUString aName; 4604 if (!(rVal >>= aName )) 4605 return sal_False; 4606 SetName( aName ); 4607 break; 4608 } 4609 4610 case MID_HATCH_STYLE: 4611 { 4612 sal_Int16 nVal = sal_Int16(); 4613 if (!(rVal >>= nVal )) 4614 return sal_False; 4615 aHatch.SetHatchStyle( (XHatchStyle)nVal ); 4616 break; 4617 } 4618 4619 case MID_HATCH_COLOR: 4620 case MID_HATCH_DISTANCE: 4621 case MID_HATCH_ANGLE: 4622 { 4623 sal_Int32 nVal = 0; 4624 if (!(rVal >>= nVal )) 4625 return sal_False; 4626 4627 if ( nMemberId == MID_HATCH_COLOR ) 4628 aHatch.SetColor( nVal ); 4629 else if ( nMemberId == MID_HATCH_DISTANCE ) 4630 aHatch.SetDistance( nVal ); 4631 else 4632 aHatch.SetAngle( nVal ); 4633 break; 4634 } 4635 4636 default: DBG_ERROR("Wrong MemberId!"); return sal_False; 4637 } 4638 4639 return sal_True; 4640 } 4641 4642 sal_Bool XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ) 4643 { 4644 return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue(); 4645 } 4646 4647 XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const 4648 { 4649 if( pModel ) 4650 { 4651 const String aUniqueName = NameOrIndex::CheckNamedItem( this, 4652 XATTR_FILLHATCH, 4653 &pModel->GetItemPool(), 4654 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL, 4655 XFillHatchItem::CompareValueFunc, 4656 RID_SVXSTR_HATCH10, 4657 pModel->GetHatchList() ); 4658 4659 // if the given name is not valid, replace it! 4660 if( aUniqueName != GetName() ) 4661 { 4662 return new XFillHatchItem( aUniqueName, aHatch ); 4663 } 4664 } 4665 4666 return (XFillHatchItem*)this; 4667 } 4668 4669 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4670 // FormText-Attribute 4671 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4672 4673 //------------------------- 4674 // class XFormTextStyleItem 4675 //------------------------- 4676 TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem); 4677 4678 /************************************************************************* 4679 |* 4680 |* XFormTextStyleItem::XFormTextStyleItem() 4681 |* 4682 |* Beschreibung 4683 |* Ersterstellung 02.02.95 ESO 4684 |* Letzte Aenderung 02.02.95 ESO 4685 |* 4686 *************************************************************************/ 4687 4688 XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) : 4689 SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle)) 4690 { 4691 } 4692 4693 /************************************************************************* 4694 |* 4695 |* XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) 4696 |* 4697 |* Beschreibung 4698 |* Ersterstellung 02.02.95 ESO 4699 |* Letzte Aenderung 02.02.95 ESO 4700 |* 4701 *************************************************************************/ 4702 4703 XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) : 4704 SfxEnumItem(XATTR_FORMTXTSTYLE, rIn) 4705 { 4706 } 4707 4708 /************************************************************************* 4709 |* 4710 |* XFormTextStyleItem::Clone(SfxItemPool* pPool) const 4711 |* 4712 |* Beschreibung 4713 |* Ersterstellung 02.02.95 ESO 4714 |* Letzte Aenderung 02.02.95 ESO 4715 |* 4716 *************************************************************************/ 4717 4718 SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const 4719 { 4720 return new XFormTextStyleItem( *this ); 4721 } 4722 4723 /************************************************************************* 4724 |* 4725 |* SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const 4726 |* 4727 |* Beschreibung 4728 |* Ersterstellung 02.02.95 ESO 4729 |* Letzte Aenderung 02.02.95 ESO 4730 |* 4731 *************************************************************************/ 4732 4733 SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 4734 { 4735 return new XFormTextStyleItem(rIn); 4736 } 4737 4738 /************************************************************************* 4739 |* 4740 |* 4741 |* 4742 \*************************************************************************/ 4743 4744 sal_uInt16 XFormTextStyleItem::GetValueCount() const 4745 { 4746 return 5; 4747 } 4748 4749 /************************************************************************* 4750 |* 4751 |* 4752 |* 4753 \*************************************************************************/ 4754 4755 // #FontWork# 4756 sal_Bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 4757 { 4758 rVal <<= (sal_Int32)GetValue(); 4759 return sal_True; 4760 } 4761 4762 /************************************************************************* 4763 |* 4764 |* 4765 |* 4766 \*************************************************************************/ 4767 4768 // #FontWork# 4769 sal_Bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 4770 { 4771 sal_Int32 nValue = 0; 4772 rVal >>= nValue; 4773 SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); 4774 4775 return sal_True; 4776 } 4777 4778 //------------------------- 4779 // class XFormTextAdjustItem 4780 //------------------------- 4781 TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem); 4782 4783 /************************************************************************* 4784 |* 4785 |* XFormTextAdjustItem::XFormTextAdjustItem() 4786 |* 4787 |* Beschreibung 4788 |* Ersterstellung 02.02.95 ESO 4789 |* Letzte Aenderung 02.02.95 ESO 4790 |* 4791 *************************************************************************/ 4792 4793 XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) : 4794 SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust)) 4795 { 4796 } 4797 4798 /************************************************************************* 4799 |* 4800 |* XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) 4801 |* 4802 |* Beschreibung 4803 |* Ersterstellung 02.02.95 ESO 4804 |* Letzte Aenderung 02.02.95 ESO 4805 |* 4806 *************************************************************************/ 4807 4808 XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) : 4809 SfxEnumItem(XATTR_FORMTXTADJUST, rIn) 4810 { 4811 } 4812 4813 /************************************************************************* 4814 |* 4815 |* XFormTextAdjustItem::Clone(SfxItemPool* pPool) const 4816 |* 4817 |* Beschreibung 4818 |* Ersterstellung 02.02.95 ESO 4819 |* Letzte Aenderung 02.02.95 ESO 4820 |* 4821 *************************************************************************/ 4822 4823 SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const 4824 { 4825 return new XFormTextAdjustItem( *this ); 4826 } 4827 4828 /************************************************************************* 4829 |* 4830 |* SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 nVer) const 4831 |* 4832 |* Beschreibung 4833 |* Ersterstellung 02.02.95 ESO 4834 |* Letzte Aenderung 02.02.95 ESO 4835 |* 4836 *************************************************************************/ 4837 4838 SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 4839 { 4840 return new XFormTextAdjustItem(rIn); 4841 } 4842 4843 /************************************************************************* 4844 |* 4845 |* 4846 |* 4847 \*************************************************************************/ 4848 4849 sal_uInt16 XFormTextAdjustItem::GetValueCount() const 4850 { 4851 return 4; 4852 } 4853 4854 /************************************************************************* 4855 |* 4856 |* 4857 |* 4858 \*************************************************************************/ 4859 4860 // #FontWork# 4861 sal_Bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 4862 { 4863 rVal <<= (sal_Int32)GetValue(); 4864 return sal_True; 4865 } 4866 4867 /************************************************************************* 4868 |* 4869 |* 4870 |* 4871 \*************************************************************************/ 4872 4873 // #FontWork# 4874 sal_Bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 4875 { 4876 sal_Int32 nValue = 0; 4877 rVal >>= nValue; 4878 SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); 4879 4880 return sal_True; 4881 } 4882 4883 //---------------------------- 4884 // class XFormTextDistanceItem 4885 //---------------------------- 4886 TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem); 4887 4888 /************************************************************************* 4889 |* 4890 |* XFormTextDistanceItem::XFormTextDistanceItem() 4891 |* 4892 |* Beschreibung 4893 |* Ersterstellung 02.02.95 ESO 4894 |* Letzte Aenderung 02.02.95 ESO 4895 |* 4896 *************************************************************************/ 4897 4898 XFormTextDistanceItem::XFormTextDistanceItem(long nDist) : 4899 SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist) 4900 { 4901 } 4902 4903 /************************************************************************* 4904 |* 4905 |* XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) 4906 |* 4907 |* Beschreibung 4908 |* Ersterstellung 02.02.95 ESO 4909 |* Letzte Aenderung 02.02.95 ESO 4910 |* 4911 *************************************************************************/ 4912 4913 XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) : 4914 SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn) 4915 { 4916 } 4917 4918 /************************************************************************* 4919 |* 4920 |* XFormTextDistanceItem::Clone(SfxItemPool* pPool) const 4921 |* 4922 |* Beschreibung 4923 |* Ersterstellung 02.02.95 ESO 4924 |* Letzte Aenderung 02.02.95 ESO 4925 |* 4926 *************************************************************************/ 4927 4928 SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const 4929 { 4930 return new XFormTextDistanceItem(*this); 4931 } 4932 4933 /************************************************************************* 4934 |* 4935 |* SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 nVer) const 4936 |* 4937 |* Beschreibung 4938 |* Ersterstellung 02.02.95 ESO 4939 |* Letzte Aenderung 02.02.95 ESO 4940 |* 4941 *************************************************************************/ 4942 4943 SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 4944 { 4945 return new XFormTextDistanceItem(rIn); 4946 } 4947 4948 //------------------------- 4949 // class XFormTextStartItem 4950 //------------------------- 4951 TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem); 4952 4953 /************************************************************************* 4954 |* 4955 |* XFormTextStartItem::XFormTextStartItem(long nStart) 4956 |* 4957 |* Beschreibung 4958 |* Ersterstellung 02.02.95 ESO 4959 |* Letzte Aenderung 02.02.95 ESO 4960 |* 4961 *************************************************************************/ 4962 4963 XFormTextStartItem::XFormTextStartItem(long nStart) : 4964 SfxMetricItem(XATTR_FORMTXTSTART, nStart) 4965 { 4966 } 4967 4968 /************************************************************************* 4969 |* 4970 |* XFormTextStartItem::XFormTextStartItem(SvStream& rIn) 4971 |* 4972 |* Beschreibung 4973 |* Ersterstellung 02.02.95 ESO 4974 |* Letzte Aenderung 02.02.95 ESO 4975 |* 4976 *************************************************************************/ 4977 4978 XFormTextStartItem::XFormTextStartItem(SvStream& rIn) : 4979 SfxMetricItem(XATTR_FORMTXTSTART, rIn) 4980 { 4981 } 4982 4983 /************************************************************************* 4984 |* 4985 |* XFormTextStartItem::Clone(SfxItemPool* pPool) const 4986 |* 4987 |* Beschreibung 4988 |* Ersterstellung 02.02.95 ESO 4989 |* Letzte Aenderung 02.02.95 ESO 4990 |* 4991 *************************************************************************/ 4992 4993 SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const 4994 { 4995 return new XFormTextStartItem(*this); 4996 } 4997 4998 /************************************************************************* 4999 |* 5000 |* SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const 5001 |* 5002 |* Beschreibung 5003 |* Ersterstellung 02.02.95 ESO 5004 |* Letzte Aenderung 02.02.95 ESO 5005 |* 5006 *************************************************************************/ 5007 5008 SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5009 { 5010 return new XFormTextStartItem(rIn); 5011 } 5012 5013 // ------------------------- 5014 // class XFormTextMirrorItem 5015 // ------------------------- 5016 TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem); 5017 5018 /************************************************************************* 5019 |* 5020 |* XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror) 5021 |* 5022 |* Ersterstellung 06.02.95 ESO 5023 |* Letzte Aenderung 06.02.95 ESO 5024 |* 5025 *************************************************************************/ 5026 5027 XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror) : 5028 SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror) 5029 { 5030 } 5031 5032 /************************************************************************* 5033 |* 5034 |* XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) 5035 |* 5036 |* Ersterstellung 06.02.95 ESO 5037 |* Letzte Aenderung 06.02.95 ESO 5038 |* 5039 *************************************************************************/ 5040 5041 XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) : 5042 SfxBoolItem(XATTR_FORMTXTMIRROR, rIn) 5043 { 5044 } 5045 5046 /************************************************************************* 5047 |* 5048 |* XFormTextMirrorItem::Clone(SfxItemPool* pPool) const 5049 |* 5050 |* Ersterstellung 06.02.95 ESO 5051 |* Letzte Aenderung 06.02.95 ESO 5052 |* 5053 *************************************************************************/ 5054 5055 SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const 5056 { 5057 return new XFormTextMirrorItem(*this); 5058 } 5059 5060 /************************************************************************* 5061 |* 5062 |* SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 nVer) 5063 |* const 5064 |* 5065 |* Ersterstellung 06.02.95 ESO 5066 |* Letzte Aenderung 06.02.95 ESO 5067 |* 5068 *************************************************************************/ 5069 5070 SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5071 { 5072 return new XFormTextMirrorItem(rIn); 5073 } 5074 5075 5076 // -------------------------- 5077 // class XFormTextOutlineItem 5078 // -------------------------- 5079 TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem); 5080 5081 /************************************************************************* 5082 |* 5083 |* XFormTextOutlineItem::XFormTextOutlineItem() 5084 |* 5085 |* Ersterstellung 27.06.95 ESO 5086 |* Letzte Aenderung 27.06.95 ESO 5087 |* 5088 *************************************************************************/ 5089 5090 XFormTextOutlineItem::XFormTextOutlineItem(sal_Bool bOutline) : 5091 SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline) 5092 { 5093 } 5094 5095 /************************************************************************* 5096 |* 5097 |* XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) 5098 |* 5099 |* Ersterstellung 27.06.95 ESO 5100 |* Letzte Aenderung 27.06.95 ESO 5101 |* 5102 *************************************************************************/ 5103 5104 XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) : 5105 SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn) 5106 { 5107 } 5108 5109 /************************************************************************* 5110 |* 5111 |* XFormTextOutlineItem::Clone(SfxItemPool* pPool) const 5112 |* 5113 |* Ersterstellung 27.06.95 ESO 5114 |* Letzte Aenderung 27.06.95 ESO 5115 |* 5116 *************************************************************************/ 5117 5118 SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const 5119 { 5120 return new XFormTextOutlineItem(*this); 5121 } 5122 5123 /************************************************************************* 5124 |* 5125 |* SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 nVer) 5126 |* const 5127 |* 5128 |* Ersterstellung 27.06.95 ESO 5129 |* Letzte Aenderung 27.06.95 ESO 5130 |* 5131 *************************************************************************/ 5132 5133 SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5134 { 5135 return new XFormTextOutlineItem(rIn); 5136 } 5137 5138 //-------------------------- 5139 // class XFormTextShadowItem 5140 //-------------------------- 5141 TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem); 5142 5143 /************************************************************************* 5144 |* 5145 |* XFormTextShadowItem::XFormTextShadowItem() 5146 |* 5147 |* Beschreibung 5148 |* Ersterstellung 27.06.95 5149 |* Letzte Aenderung 27.06.95 5150 |* 5151 *************************************************************************/ 5152 5153 XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) : 5154 SfxEnumItem( 5155 XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow)) 5156 { 5157 } 5158 5159 /************************************************************************* 5160 |* 5161 |* XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) 5162 |* 5163 |* Beschreibung 5164 |* Ersterstellung 27.06.95 5165 |* Letzte Aenderung 27.06.95 5166 |* 5167 *************************************************************************/ 5168 5169 XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) : 5170 SfxEnumItem(XATTR_FORMTXTSHADOW, rIn) 5171 { 5172 } 5173 5174 /************************************************************************* 5175 |* 5176 |* XFormTextShadowItem::Clone(SfxItemPool* pPool) const 5177 |* 5178 |* Beschreibung 5179 |* Ersterstellung 27.06.95 5180 |* Letzte Aenderung 27.06.95 5181 |* 5182 *************************************************************************/ 5183 5184 SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const 5185 { 5186 return new XFormTextShadowItem( *this ); 5187 } 5188 5189 /************************************************************************* 5190 |* 5191 |* SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 nVer) const 5192 |* 5193 |* Beschreibung 5194 |* Ersterstellung 27.06.95 5195 |* Letzte Aenderung 27.06.95 5196 |* 5197 *************************************************************************/ 5198 5199 SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5200 { 5201 return new XFormTextShadowItem(rIn); 5202 } 5203 5204 5205 /************************************************************************* 5206 |* 5207 |* 5208 |* 5209 \*************************************************************************/ 5210 5211 sal_uInt16 XFormTextShadowItem::GetValueCount() const 5212 { 5213 return 3; 5214 } 5215 5216 /************************************************************************* 5217 |* 5218 |* 5219 |* 5220 \*************************************************************************/ 5221 5222 // #FontWork# 5223 sal_Bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 5224 { 5225 rVal <<= (sal_Int32)GetValue(); 5226 return sal_True; 5227 } 5228 5229 /************************************************************************* 5230 |* 5231 |* 5232 |* 5233 \*************************************************************************/ 5234 5235 // #FontWork# 5236 sal_Bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 5237 { 5238 sal_Int32 nValue = 0; 5239 rVal >>= nValue; 5240 SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); 5241 5242 return sal_True; 5243 } 5244 5245 // ------------------------------- 5246 // class XFormTextShadowColorItem 5247 // ------------------------------- 5248 TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem); 5249 5250 /************************************************************************* 5251 |* 5252 |* XFormTextShadowColorItem::XFormTextShadowColorItem() 5253 |* 5254 |* Beschreibung 5255 |* Ersterstellung 27.06.95 5256 |* Letzte Aenderung 27.06.95 5257 |* 5258 *************************************************************************/ 5259 5260 XFormTextShadowColorItem::XFormTextShadowColorItem(sal_Int32 nIndex, 5261 const Color& rTheColor) : 5262 XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor) 5263 { 5264 } 5265 5266 /************************************************************************* 5267 |* 5268 |* XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, const Color& rTheColor) 5269 |* 5270 |* Beschreibung 5271 |* Ersterstellung 27.06.95 5272 |* Letzte Aenderung 27.06.95 5273 |* 5274 *************************************************************************/ 5275 5276 XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, 5277 const Color& rTheColor) : 5278 XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor) 5279 { 5280 } 5281 5282 /************************************************************************* 5283 |* 5284 |* XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) 5285 |* 5286 |* Beschreibung 5287 |* Ersterstellung 27.06.95 5288 |* Letzte Aenderung 27.06.95 5289 |* 5290 *************************************************************************/ 5291 5292 XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) : 5293 XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn) 5294 { 5295 } 5296 5297 /************************************************************************* 5298 |* 5299 |* XFormTextShadowColorItem::Clone(SfxItemPool* pPool) const 5300 |* 5301 |* Beschreibung 5302 |* Ersterstellung 27.06.95 5303 |* Letzte Aenderung 27.06.95 5304 |* 5305 *************************************************************************/ 5306 5307 SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const 5308 { 5309 return new XFormTextShadowColorItem(*this); 5310 } 5311 5312 /************************************************************************* 5313 |* 5314 |* SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const 5315 |* 5316 |* Beschreibung 5317 |* Ersterstellung 27.06.95 5318 |* Letzte Aenderung 27.06.95 5319 |* 5320 *************************************************************************/ 5321 5322 SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5323 { 5324 return new XFormTextShadowColorItem(rIn); 5325 } 5326 5327 //------------------------------ 5328 // class XFormTextShadowXValItem 5329 //------------------------------ 5330 TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem); 5331 5332 /************************************************************************* 5333 |* 5334 |* XFormTextShadowXValItem::XFormTextShadowXValItem(long) 5335 |* 5336 |* Beschreibung 5337 |* Ersterstellung 28.06.95 ESO 5338 |* Letzte Aenderung 28.06.95 ESO 5339 |* 5340 *************************************************************************/ 5341 5342 XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) : 5343 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal) 5344 { 5345 } 5346 5347 /************************************************************************* 5348 |* 5349 |* XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) 5350 |* 5351 |* Beschreibung 5352 |* Ersterstellung 28.06.95 ESO 5353 |* Letzte Aenderung 28.06.95 ESO 5354 |* 5355 *************************************************************************/ 5356 5357 XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) : 5358 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn) 5359 { 5360 } 5361 5362 /************************************************************************* 5363 |* 5364 |* XFormTextShadowXValItem::Clone(SfxItemPool* pPool) const 5365 |* 5366 |* Beschreibung 5367 |* Ersterstellung 28.06.95 ESO 5368 |* Letzte Aenderung 28.06.95 ESO 5369 |* 5370 *************************************************************************/ 5371 5372 SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const 5373 { 5374 return new XFormTextShadowXValItem(*this); 5375 } 5376 5377 /************************************************************************* 5378 |* 5379 |* SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 nVer) const 5380 |* 5381 |* Beschreibung 5382 |* Ersterstellung 28.06.95 ESO 5383 |* Letzte Aenderung 28.06.95 ESO 5384 |* 5385 *************************************************************************/ 5386 5387 SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5388 { 5389 return new XFormTextShadowXValItem(rIn); 5390 } 5391 5392 //------------------------------ 5393 // class XFormTextShadowYValItem 5394 //------------------------------ 5395 TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem); 5396 5397 /************************************************************************* 5398 |* 5399 |* XFormTextShadowYValItem::XFormTextShadowYValItem(long) 5400 |* 5401 |* Beschreibung 5402 |* Ersterstellung 28.06.95 ESO 5403 |* Letzte Aenderung 28.06.95 ESO 5404 |* 5405 *************************************************************************/ 5406 5407 XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) : 5408 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal) 5409 { 5410 } 5411 5412 /************************************************************************* 5413 |* 5414 |* XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) 5415 |* 5416 |* Beschreibung 5417 |* Ersterstellung 28.06.95 ESO 5418 |* Letzte Aenderung 28.06.95 ESO 5419 |* 5420 *************************************************************************/ 5421 5422 XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) : 5423 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn) 5424 { 5425 } 5426 5427 /************************************************************************* 5428 |* 5429 |* XFormTextShadowYValItem::Clone(SfxItemPool* pPool) const 5430 |* 5431 |* Beschreibung 5432 |* Ersterstellung 28.06.95 ESO 5433 |* Letzte Aenderung 28.06.95 ESO 5434 |* 5435 *************************************************************************/ 5436 5437 SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const 5438 { 5439 return new XFormTextShadowYValItem(*this); 5440 } 5441 5442 /************************************************************************* 5443 |* 5444 |* SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 nVer) const 5445 |* 5446 |* Beschreibung 5447 |* Ersterstellung 28.06.95 ESO 5448 |* Letzte Aenderung 28.06.95 ESO 5449 |* 5450 *************************************************************************/ 5451 5452 SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5453 { 5454 return new XFormTextShadowYValItem(rIn); 5455 } 5456 5457 //--------------------------- 5458 // class XFormTextStdFormItem 5459 //--------------------------- 5460 TYPEINIT1_AUTOFACTORY(XFormTextStdFormItem, SfxEnumItem); 5461 5462 /************************************************************************* 5463 |* 5464 |* XFormTextStdFormItem::XFormTextStdFormItem() 5465 |* 5466 |* Beschreibung 5467 |* Ersterstellung 27.06.95 5468 |* Letzte Aenderung 27.06.95 5469 |* 5470 *************************************************************************/ 5471 5472 XFormTextStdFormItem::XFormTextStdFormItem(XFormTextStdForm eFormTextStdForm) : 5473 SfxEnumItem( 5474 XATTR_FORMTXTSTDFORM, sal::static_int_cast< sal_uInt16 >(eFormTextStdForm)) 5475 { 5476 } 5477 5478 /************************************************************************* 5479 |* 5480 |* XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn) 5481 |* 5482 |* Beschreibung 5483 |* Ersterstellung 27.06.95 5484 |* Letzte Aenderung 27.06.95 5485 |* 5486 *************************************************************************/ 5487 5488 XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn) : 5489 SfxEnumItem(XATTR_FORMTXTSTDFORM, rIn) 5490 { 5491 } 5492 5493 /************************************************************************* 5494 |* 5495 |* XFormTextStdFormItem::Clone(SfxItemPool* pPool) const 5496 |* 5497 |* Beschreibung 5498 |* Ersterstellung 27.06.95 5499 |* Letzte Aenderung 27.06.95 5500 |* 5501 *************************************************************************/ 5502 5503 SfxPoolItem* XFormTextStdFormItem::Clone(SfxItemPool* /*pPool*/) const 5504 { 5505 return new XFormTextStdFormItem( *this ); 5506 } 5507 5508 /************************************************************************* 5509 |* 5510 |* SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, sal_uInt16 nVer) const 5511 |* 5512 |* Beschreibung 5513 |* Ersterstellung 27.06.95 5514 |* Letzte Aenderung 27.06.95 5515 |* 5516 *************************************************************************/ 5517 5518 SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5519 { 5520 return new XFormTextStdFormItem(rIn); 5521 } 5522 5523 5524 /************************************************************************* 5525 |* 5526 |* 5527 |* 5528 \*************************************************************************/ 5529 5530 sal_uInt16 XFormTextStdFormItem::GetValueCount() const 5531 { 5532 return 3; 5533 } 5534 5535 /************************************************************************* 5536 |* 5537 |* 5538 |* 5539 \*************************************************************************/ 5540 5541 // #FontWork# 5542 sal_Bool XFormTextStdFormItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 5543 { 5544 rVal <<= (sal_Int32)GetValue(); 5545 return sal_True; 5546 } 5547 5548 /************************************************************************* 5549 |* 5550 |* 5551 |* 5552 \*************************************************************************/ 5553 5554 // #FontWork# 5555 sal_Bool XFormTextStdFormItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 5556 { 5557 sal_Int32 nValue = 0; 5558 rVal >>= nValue; 5559 SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); 5560 5561 return sal_True; 5562 } 5563 5564 // -------------------------- 5565 // class XFormTextHideFormItem 5566 // -------------------------- 5567 TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem); 5568 5569 /************************************************************************* 5570 |* 5571 |* XFormTextHideFormItem::XFormTextHideFormItem() 5572 |* 5573 |* Ersterstellung 27.06.95 ESO 5574 |* Letzte Aenderung 27.06.95 ESO 5575 |* 5576 *************************************************************************/ 5577 5578 XFormTextHideFormItem::XFormTextHideFormItem(sal_Bool bHide) : 5579 SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide) 5580 { 5581 } 5582 5583 /************************************************************************* 5584 |* 5585 |* XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) 5586 |* 5587 |* Ersterstellung 27.06.95 ESO 5588 |* Letzte Aenderung 27.06.95 ESO 5589 |* 5590 *************************************************************************/ 5591 5592 XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) : 5593 SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn) 5594 { 5595 } 5596 5597 /************************************************************************* 5598 |* 5599 |* XFormTextHideFormItem::Clone(SfxItemPool* pPool) const 5600 |* 5601 |* Ersterstellung 27.06.95 ESO 5602 |* Letzte Aenderung 27.06.95 ESO 5603 |* 5604 *************************************************************************/ 5605 5606 SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const 5607 { 5608 return new XFormTextHideFormItem(*this); 5609 } 5610 5611 /************************************************************************* 5612 |* 5613 |* SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 nVer) 5614 |* const 5615 |* 5616 |* Ersterstellung 27.06.95 ESO 5617 |* Letzte Aenderung 27.06.95 ESO 5618 |* 5619 *************************************************************************/ 5620 5621 SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const 5622 { 5623 return new XFormTextHideFormItem(rIn); 5624 } 5625 5626 5627 5628 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5629 // SetItems 5630 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5631 5632 TYPEINIT1(XLineAttrSetItem, SfxSetItem); 5633 5634 /************************************************************************* 5635 |* 5636 |* Konstruktoren fuer Linienattribute-SetItem 5637 |* 5638 \************************************************************************/ 5639 5640 XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) : 5641 SfxSetItem( XATTRSET_LINE, pItemSet) 5642 { 5643 } 5644 5645 /************************************************************************/ 5646 5647 XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) : 5648 SfxSetItem( XATTRSET_LINE, 5649 new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST)) 5650 { 5651 } 5652 5653 /************************************************************************/ 5654 5655 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) : 5656 SfxSetItem( rLineAttr ) 5657 { 5658 } 5659 5660 /************************************************************************/ 5661 5662 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr, 5663 SfxItemPool* pItemPool) : 5664 SfxSetItem( rLineAttr, pItemPool ) 5665 { 5666 } 5667 5668 /************************************************************************* 5669 |* 5670 |* Clone-Funktion 5671 |* 5672 \************************************************************************/ 5673 5674 SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const 5675 { 5676 return new XLineAttrSetItem( *this, pPool ); 5677 } 5678 5679 /************************************************************************* 5680 |* 5681 |* SetItem aus Stream erzeugen 5682 |* 5683 \************************************************************************/ 5684 5685 SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const 5686 { 5687 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(), 5688 XATTR_LINE_FIRST, XATTR_LINE_LAST); 5689 pSet2->Load( rStream ); 5690 return new XLineAttrSetItem( pSet2 ); 5691 } 5692 5693 /************************************************************************* 5694 |* 5695 |* SetItem in Stream speichern 5696 |* 5697 \************************************************************************/ 5698 5699 SvStream& XLineAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const 5700 { 5701 return SfxSetItem::Store( rStream, nItemVersion ); 5702 } 5703 5704 5705 TYPEINIT1(XFillAttrSetItem, SfxSetItem); 5706 5707 /************************************************************************* 5708 |* 5709 |* Konstruktoren fuer Fuellattribute-SetItem 5710 |* 5711 \************************************************************************/ 5712 5713 XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) : 5714 SfxSetItem( XATTRSET_FILL, pItemSet) 5715 { 5716 } 5717 5718 /************************************************************************/ 5719 5720 XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) : 5721 SfxSetItem( XATTRSET_FILL, 5722 new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST)) 5723 { 5724 } 5725 5726 /************************************************************************/ 5727 5728 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) : 5729 SfxSetItem( rFillAttr ) 5730 { 5731 } 5732 5733 /************************************************************************/ 5734 5735 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr, 5736 SfxItemPool* pItemPool ) : 5737 SfxSetItem( rFillAttr, pItemPool ) 5738 { 5739 } 5740 5741 /************************************************************************* 5742 |* 5743 |* Clone-Funktion 5744 |* 5745 \************************************************************************/ 5746 5747 SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const 5748 { 5749 return new XFillAttrSetItem( *this, pPool ); 5750 } 5751 5752 /************************************************************************* 5753 |* 5754 |* SetItem aus Stream erzeugen 5755 |* 5756 \************************************************************************/ 5757 5758 SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const 5759 { 5760 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(), 5761 XATTR_FILL_FIRST, XATTR_FILL_LAST); 5762 pSet2->Load( rStream ); 5763 return new XFillAttrSetItem( pSet2 ); 5764 } 5765 5766 /************************************************************************* 5767 |* 5768 |* SetItem in Stream speichern 5769 |* 5770 \************************************************************************/ 5771 5772 SvStream& XFillAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const 5773 { 5774 return SfxSetItem::Store( rStream, nItemVersion ); 5775 } 5776 5777 // eof 5778 5779