update dev300-m58
[ooovba.git] / svx / source / xoutdev / xattr.cxx
blob1e527885b7373fab7b858619fd75de6668ff793d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xattr.cxx,v $
10 * $Revision: 1.42 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // include ---------------------------------------------------------------
35 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
36 #include <com/sun/star/drawing/Hatch.hpp>
37 #include <com/sun/star/drawing/LineStyle.hpp>
38 #include <com/sun/star/drawing/LineDash.hpp>
39 #include <com/sun/star/drawing/DashStyle.hpp>
40 #include <com/sun/star/awt/Point.hpp>
41 #include <com/sun/star/drawing/PointSequence.hpp>
42 #include <com/sun/star/drawing/FillStyle.hpp>
43 #include <com/sun/star/awt/Gradient.hpp>
44 #include <com/sun/star/uno/Sequence.hxx>
45 #include <com/sun/star/beans/PropertyValue.hpp>
46 #include <svtools/itempool.hxx>
48 #include <tools/stream.hxx>
50 #include "unoapi.hxx"
51 #include <svtools/style.hxx>
52 #include "unopolyhelper.hxx"
54 #include <tools/bigint.hxx>
55 #include <svtools/itemset.hxx>
56 #include <svx/dialogs.hrc>
57 #include "svdstr.hrc"
58 #include "xattr.hxx"
59 #include <svx/xtable.hxx>
60 #include <svx/dialmgr.hxx>
61 #include <svx/itemtype.hxx>
62 #include <svx/xdef.hxx>
63 #include <svx/unomid.hxx>
64 #include <svx/svdmodel.hxx>
65 #include <basegfx/polygon/b2dpolygon.hxx>
66 #include <basegfx/point/b2dpoint.hxx>
67 #include <basegfx/vector/b2dvector.hxx>
69 #include <stdio.h>
71 using namespace ::rtl;
72 using namespace ::com::sun::star;
74 #define GLOBALOVERFLOW
76 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
77 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
79 /************************************************************************/
81 #define VCLTOSVCOL( rCol ) (USHORT)((((USHORT)(rCol))<<8)|(rCol))
83 /************************************************************************/
85 XubString aNameOrIndexEmptyString;
87 TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem);
89 /*************************************************************************
93 \*************************************************************************/
95 long ScaleMetricValue( long nVal, long nMul, long nDiv )
97 BigInt aVal( nVal );
99 aVal *= nMul;
101 if ( aVal.IsNeg() != ( nDiv < 0 ) )
102 aVal-=nDiv/2; // fuer korrektes Runden
103 else
104 aVal+=nDiv/2; // fuer korrektes Runden
106 aVal/=nDiv;
108 return long( aVal );
111 /*************************************************************************
113 |* NameOrIndex::NameOrIndex(USHORT nWhich, INT32 nIndex)
115 |* Beschreibung
116 |* Ersterstellung 14.11.94
117 |* Letzte Aenderung 14.11.94
119 *************************************************************************/
121 NameOrIndex::NameOrIndex(USHORT _nWhich, INT32 nIndex) :
122 SfxStringItem(_nWhich, aNameOrIndexEmptyString),
123 nPalIndex(nIndex)
127 /*************************************************************************
129 |* NameOrIndex::NameOrIndex(USHORT nWhich, const String& rName)
131 |* Beschreibung
132 |* Ersterstellung 14.11.94
133 |* Letzte Aenderung 14.11.94
135 *************************************************************************/
137 NameOrIndex::NameOrIndex(USHORT _nWhich, const XubString& rName) :
138 SfxStringItem(_nWhich, rName),
139 nPalIndex(-1)
143 /*************************************************************************
145 |* NameOrIndex::NameOrIndex(USHORT nWhich, SvStream& rIn)
147 |* Beschreibung
148 |* Ersterstellung 14.11.94
149 |* Letzte Aenderung 14.11.94
151 *************************************************************************/
153 NameOrIndex::NameOrIndex(USHORT _nWhich, SvStream& rIn) :
154 SfxStringItem(_nWhich, rIn)
156 rIn >> nPalIndex;
159 /*************************************************************************
161 |* NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex)
163 |* Beschreibung
164 |* Ersterstellung 14.11.94
165 |* Letzte Aenderung 14.11.94
167 *************************************************************************/
169 NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) :
170 SfxStringItem(rNameOrIndex),
171 nPalIndex(rNameOrIndex.nPalIndex)
175 /*************************************************************************
177 |* int NameOrIndex::operator==(const SfxPoolItem& rItem) const
179 |* Beschreibung
180 |* Ersterstellung 14.11.94
181 |* Letzte Aenderung 14.11.94
183 *************************************************************************/
185 int NameOrIndex::operator==(const SfxPoolItem& rItem) const
187 return ( SfxStringItem::operator==(rItem) &&
188 ((const NameOrIndex&) rItem).nPalIndex == nPalIndex );
191 /*************************************************************************
193 |* SfxPoolItem* NameOrIndex::Clone(SfxItemPool* pPool) const
195 |* Beschreibung
196 |* Ersterstellung 14.11.94
197 |* Letzte Aenderung 14.11.94
199 *************************************************************************/
201 SfxPoolItem* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const
204 return new NameOrIndex(*this);
207 /*************************************************************************
209 |* SfxPoolItem* NameOrIndex::Create(SvStream& rIn, USHORT nVer) const
211 |* Beschreibung
212 |* Ersterstellung 14.11.94
213 |* Letzte Aenderung 14.11.94
215 *************************************************************************/
217 SfxPoolItem* NameOrIndex::Create(SvStream& rIn, USHORT /*nVer*/) const
219 return new NameOrIndex(Which(), rIn);
222 /*************************************************************************
224 |* SvStream* NameOrIndex::Store(SvStream& rIn) const
226 |* Beschreibung
227 |* Ersterstellung 14.11.94
228 |* Letzte Aenderung 14.11.94
230 *************************************************************************/
232 SvStream& NameOrIndex::Store( SvStream& rOut, USHORT nItemVersion ) const
234 SfxStringItem::Store( rOut, nItemVersion );
235 rOut << nPalIndex;
236 return rOut;
239 /** this static checks if the given NameOrIndex item has a unique name for its value.
240 The returned String is a unique name for an item with this value in both given pools.
241 Argument pPool2 can be null.
242 If returned string equals NameOrIndex->GetName(), the name was already unique.
244 String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, USHORT nPrefixResId, XPropertyList* pDefaults )
246 sal_Bool bForceNew = sal_False;
248 String aUniqueName;
249 SvxUnogetInternalNameForItem( nWhich, pCheckItem->GetName(), aUniqueName );
251 // 2. if we have a name check if there is already an item with the
252 // same name in the documents pool with a different line end or start
254 if( aUniqueName.Len() && pPool1 )
256 const sal_uInt16 nCount = pPool1->GetItemCount( nWhich );
258 const NameOrIndex *pItem;
259 for( sal_uInt16 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
261 pItem = (NameOrIndex*)pPool1->GetItem( nWhich, nSurrogate );
263 if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) )
265 // if there is already an item with the same name and the same
266 // value its ok to set it
267 if( !pCompareValueFunc( pItem, pCheckItem ) )
269 // same name but different value, we need a new name for this item
270 aUniqueName = String();
271 bForceNew = sal_True;
273 break;
278 // if we have no name yet, find existing item with same conent or
279 // create a unique name
280 if( aUniqueName.Len() == 0 )
282 sal_Int32 nUserIndex = 1;
283 const ResId aRes(SVX_RES(nPrefixResId));
284 String aUser( aRes );
285 aUser += sal_Unicode( ' ' );
287 if( pDefaults )
289 const int nCount = pDefaults->Count();
290 int nIndex;
291 for( nIndex = 0; nIndex < nCount; nIndex++ )
293 XPropertyEntry* pEntry = pDefaults->Get( nIndex, 0 );
294 if( pEntry )
296 bool bFound = false;
298 switch( nWhich )
300 case XATTR_FILLBITMAP:
301 bFound = (((XFillBitmapItem*)pCheckItem)->GetBitmapValue().GetGraphicObject().GetUniqueID() ==
302 ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID());
303 break;
304 case XATTR_LINEDASH:
305 bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash());
306 break;
307 case XATTR_LINESTART:
308 bFound = (((XLineStartItem*)pCheckItem)->GetLineStartValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
309 break;
310 case XATTR_LINEEND:
311 bFound = (((XLineEndItem*)pCheckItem)->GetLineEndValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
312 break;
313 case XATTR_FILLGRADIENT:
314 bFound = (((XFillGradientItem*)pCheckItem)->GetGradientValue() == ((XGradientEntry*)pEntry)->GetGradient());
315 break;
316 case XATTR_FILLHATCH:
317 bFound = (((XFillHatchItem*)pCheckItem)->GetHatchValue() == ((XHatchEntry*)pEntry)->GetHatch());
318 break;
321 if( bFound )
323 aUniqueName = pEntry->GetName();
324 break;
326 else
328 sal_Int32 nThisIndex = pEntry->GetName().Copy( aUser.Len() ).ToInt32();
329 if( nThisIndex >= nUserIndex )
330 nUserIndex = nThisIndex + 1;
336 if( (aUniqueName.Len() == 0) && pPool1 )
338 const sal_uInt16 nCount = pPool1->GetItemCount( nWhich );
339 const NameOrIndex *pItem;
340 for( sal_uInt16 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
342 pItem = (NameOrIndex*)pPool1->GetItem( nWhich, nSurrogate );
344 if( pItem && pItem->GetName().Len() )
346 if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) )
347 return pItem->GetName();
349 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
351 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
352 if( nThisIndex >= nUserIndex )
353 nUserIndex = nThisIndex + 1;
357 aUniqueName = aUser;
358 aUniqueName += String::CreateFromInt32( nUserIndex );
362 return aUniqueName;
365 //*************************************************************************
367 // -------------------
368 // class XColorItem
369 // -------------------
370 TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
372 /*************************************************************************
374 |* XColorItem::XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor)
376 \************************************************************************/
378 XColorItem::XColorItem(USHORT _nWhich, INT32 nIndex, const Color& rTheColor) :
379 NameOrIndex(_nWhich, nIndex),
380 aColor(rTheColor)
384 /*************************************************************************
386 |* XColorItem::XColorItem(USHORT nWhich, const String& rName, const Color& rTheColor)
388 \************************************************************************/
390 XColorItem::XColorItem(USHORT _nWhich, const XubString& rName, const Color& rTheColor) :
391 NameOrIndex(_nWhich, rName),
392 aColor(rTheColor)
396 /*************************************************************************
398 |* XColorItem::XColorItem(const XColorItem& rItem)
400 \************************************************************************/
402 XColorItem::XColorItem(const XColorItem& rItem) :
403 NameOrIndex(rItem),
404 aColor(rItem.aColor)
408 /*************************************************************************
410 |* XColorItem::XColorItem(USHORT nWhich, SvStream& rIn)
412 \************************************************************************/
414 XColorItem::XColorItem(USHORT _nWhich, SvStream& rIn) :
415 NameOrIndex(_nWhich, rIn)
417 if (!IsIndex())
419 rIn >> aColor;
423 /*************************************************************************
425 |* XColorItem::Clone(SfxItemPool* pPool) const
427 \************************************************************************/
429 SfxPoolItem* XColorItem::Clone(SfxItemPool* /*pPool*/) const
431 return new XColorItem(*this);
434 /*************************************************************************
436 |* int XColorItem::operator==(const SfxPoolItem& rItem) const
438 \************************************************************************/
440 int XColorItem::operator==(const SfxPoolItem& rItem) const
442 return ( NameOrIndex::operator==(rItem) &&
443 ((const XColorItem&) rItem).aColor == aColor );
446 /*************************************************************************
448 |* SfxPoolItem* XColorItem::Create(SvStream& rIn, USHORT nVer) const
450 \************************************************************************/
452 SfxPoolItem* XColorItem::Create(SvStream& rIn, USHORT /*nVer*/) const
454 return new XColorItem(Which(), rIn);
457 /*************************************************************************
459 |* SfxPoolItem* XColorItem::Store(SvStream& rOut) const
461 \************************************************************************/
463 SvStream& XColorItem::Store( SvStream& rOut, USHORT nItemVersion ) const
465 NameOrIndex::Store( rOut, nItemVersion );
467 if ( !IsIndex() )
469 rOut << aColor;
472 return rOut;
475 /*************************************************************************
477 |* const XColor& XColorItem::GetColorValue(const XColorTable* pTable) const
479 \************************************************************************/
481 const Color& XColorItem::GetColorValue(const XColorTable* pTable) const
483 if (!IsIndex())
484 return aColor;
485 else
486 return pTable->GetColor(GetIndex())->GetColor();
490 sal_Bool XColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
492 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
493 return sal_True;
496 sal_Bool XColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
498 sal_Int32 nValue = 0;
499 rVal >>= nValue;
500 SetColorValue( nValue );
502 return sal_True;
506 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
507 // Linienattribute
508 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
510 //---------------------
511 // class XLineStyleItem
512 //---------------------
513 TYPEINIT1_AUTOFACTORY(XLineStyleItem, SfxEnumItem);
515 /*************************************************************************
517 |* XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle)
519 |* Beschreibung
520 |* Ersterstellung 15.11.94
521 |* Letzte Aenderung 18.11.94
523 *************************************************************************/
525 XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) :
526 SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< USHORT >(eTheLineStyle))
530 /*************************************************************************
532 |* XLineStyleItem::XLineStyleItem(SvStream& rIn)
534 |* Beschreibung
535 |* Ersterstellung 15.11.94
536 |* Letzte Aenderung 15.11.94
538 *************************************************************************/
540 XLineStyleItem::XLineStyleItem(SvStream& rIn) :
541 SfxEnumItem(XATTR_LINESTYLE, rIn)
545 /*************************************************************************
547 |* XLineStyleItem::Clone(SfxItemPool* pPool) const
549 |* Beschreibung
550 |* Ersterstellung 09.11.94
551 |* Letzte Aenderung 09.11.94
553 *************************************************************************/
555 SfxPoolItem* XLineStyleItem::Clone(SfxItemPool* /*pPool*/) const
557 return new XLineStyleItem( *this );
560 /*************************************************************************
562 |* SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, USHORT nVer) const
564 |* Beschreibung
565 |* Ersterstellung 15.11.94
566 |* Letzte Aenderung 15.11.94
568 *************************************************************************/
570 SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, USHORT /*nVer*/) const
572 return new XLineStyleItem(rIn);
575 //------------------------------------------------------------------------
577 SfxItemPresentation XLineStyleItem::GetPresentation
579 SfxItemPresentation ePres,
580 SfxMapUnit /*eCoreUnit*/,
581 SfxMapUnit /*ePresUnit*/,
582 XubString& rText, const IntlWrapper *
583 ) const
585 rText.Erase();
587 switch ( ePres )
589 case SFX_ITEM_PRESENTATION_NONE:
590 return ePres;
591 case SFX_ITEM_PRESENTATION_COMPLETE:
592 case SFX_ITEM_PRESENTATION_NAMELESS:
594 USHORT nId = 0;
596 switch( (USHORT)GetValue() )
598 case XLINE_NONE:
599 nId = RID_SVXSTR_INVISIBLE;
600 break;
601 case XLINE_SOLID:
602 nId = RID_SVXSTR_SOLID;
603 break;
606 if ( nId )
607 rText = SVX_RESSTR( nId );
608 return ePres;
610 default:
611 return SFX_ITEM_PRESENTATION_NONE;
615 sal_Bool XLineStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
617 ::com::sun::star::drawing::LineStyle eLS = (::com::sun::star::drawing::LineStyle)GetValue();
618 rVal <<= eLS;
619 return sal_True;
622 sal_Bool XLineStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
624 ::com::sun::star::drawing::LineStyle eLS;
625 if(!(rVal >>= eLS ))
627 // also try an int (for Basic)
628 sal_Int32 nLS = 0;
629 if(!(rVal >>= nLS))
630 return sal_False;
631 eLS = (::com::sun::star::drawing::LineStyle)nLS;
634 SetValue( sal::static_int_cast< USHORT >( eLS ) );
635 return sal_True;
638 //------------------------------------------------------------------------
640 USHORT XLineStyleItem::GetValueCount() const
642 return 3;
646 // ------------
647 // class XDash
648 // ------------
649 /*************************************************************************
651 |* XDash::XDash(XDashStyle, USHORT, ULONG, USHORT, ULONG, ULONG)
653 |* Beschreibung
654 |* Ersterstellung 21.11.94
655 |* Letzte Aenderung 21.11.94
657 *************************************************************************/
659 XDash::XDash(XDashStyle eTheDash, USHORT nTheDots, ULONG nTheDotLen,
660 USHORT nTheDashes, ULONG nTheDashLen, ULONG nTheDistance) :
661 eDash(eTheDash),
662 nDots(nTheDots),
663 nDotLen(nTheDotLen),
664 nDashes(nTheDashes),
665 nDashLen(nTheDashLen),
666 nDistance(nTheDistance)
670 /*************************************************************************
672 |* int XDash::operator==(const SfxPoolItem& rItem) const
674 |* Beschreibung
675 |* Ersterstellung 29.11.94
676 |* Letzte Aenderung 29.11.94
678 *************************************************************************/
680 bool XDash::operator==(const XDash& rDash) const
682 return ( eDash == rDash.eDash &&
683 nDots == rDash.nDots &&
684 nDotLen == rDash.nDotLen &&
685 nDashes == rDash.nDashes &&
686 nDashLen == rDash.nDashLen &&
687 nDistance == rDash.nDistance );
690 // XDash is translated into an array of doubles which describe the lengths of the
691 // dashes, dots and empty passages. It returns the complete length of the full DashDot
692 // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
693 static double SMALLEST_DASH_WIDTH(26.95);
694 double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const
696 double fFullDotDashLen(0.0);
697 const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2;
698 rDotDashArray.resize( nNumDotDashArray, 0.0 );
699 sal_uInt16 a;
700 sal_uInt16 nIns(0);
701 double fDashDotDistance = (double)GetDistance();
702 double fSingleDashLen = (double)GetDashLen();
703 double fSingleDotLen = (double)GetDotLen();
705 if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE)
707 if(fLineWidth != 0.0)
709 double fFactor = fLineWidth / 100.0;
711 if(GetDashes())
713 if(GetDashLen())
715 // is a dash
716 fSingleDashLen *= fFactor;
718 else
720 // is a dot
721 fSingleDashLen = fLineWidth;
725 if(GetDots())
727 if(GetDotLen())
729 // is a dash
730 fSingleDotLen *= fFactor;
732 else
734 // is a dot
735 fSingleDotLen = fLineWidth;
739 if(GetDashes() || GetDots())
741 if(GetDistance())
743 fDashDotDistance *= fFactor;
745 else
747 fDashDotDistance = fLineWidth;
751 else
753 if(GetDashes())
755 if(GetDashLen())
757 // is a dash
758 fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0;
760 else
762 // is a dot
763 fSingleDashLen = SMALLEST_DASH_WIDTH;
767 if(GetDots())
769 if(GetDotLen())
771 // is a dash
772 fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0;
774 else
776 // is a dot
777 fSingleDotLen = SMALLEST_DASH_WIDTH;
781 if(GetDashes() || GetDots())
783 if(GetDistance())
785 // dash as distance
786 fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0;
788 else
790 // dot as distance
791 fDashDotDistance = SMALLEST_DASH_WIDTH;
796 else
798 // smallest dot size compare value
799 double fDotCompVal(fLineWidth != 0.0 ? fLineWidth : SMALLEST_DASH_WIDTH);
801 // absolute values
802 if(GetDashes())
804 if(GetDashLen())
806 // is a dash
807 if(fSingleDashLen < SMALLEST_DASH_WIDTH)
809 fSingleDashLen = SMALLEST_DASH_WIDTH;
812 else
814 // is a dot
815 if(fSingleDashLen < fDotCompVal)
817 fSingleDashLen = fDotCompVal;
822 if(GetDots())
824 if(GetDotLen())
826 // is a dash
827 if(fSingleDotLen < SMALLEST_DASH_WIDTH)
829 fSingleDotLen = SMALLEST_DASH_WIDTH;
832 else
834 // is a dot
835 if(fSingleDotLen < fDotCompVal)
837 fSingleDotLen = fDotCompVal;
842 if(GetDashes() || GetDots())
844 if(GetDistance())
846 // dash as distance
847 if(fDashDotDistance < SMALLEST_DASH_WIDTH)
849 fDashDotDistance = SMALLEST_DASH_WIDTH;
852 else
854 // dot as distance
855 if(fDashDotDistance < fDotCompVal)
857 fDashDotDistance = fDotCompVal;
863 for(a=0;a<GetDots();a++)
865 rDotDashArray[nIns++] = fSingleDotLen;
866 fFullDotDashLen += fSingleDotLen;
867 rDotDashArray[nIns++] = fDashDotDistance;
868 fFullDotDashLen += fDashDotDistance;
871 for(a=0;a<GetDashes();a++)
873 rDotDashArray[nIns++] = fSingleDashLen;
874 fFullDotDashLen += fSingleDashLen;
875 rDotDashArray[nIns++] = fDashDotDistance;
876 fFullDotDashLen += fDashDotDistance;
879 return fFullDotDashLen;
882 // -------------------
883 // class XLineDashItem
884 // -------------------
885 TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
887 /*************************************************************************
889 |* XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash)
891 |* Beschreibung
892 |* Ersterstellung 15.11.94
893 |* Letzte Aenderung 15.11.94
895 *************************************************************************/
897 XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash) :
898 NameOrIndex(XATTR_LINEDASH, nIndex),
899 aDash(rTheDash)
903 /*************************************************************************
905 |* XLineDashItem::XLineDashItem(const String& rName, const XDash& rTheDash)
907 |* Beschreibung
908 |* Ersterstellung 15.11.94
909 |* Letzte Aenderung 15.11.94
911 *************************************************************************/
913 XLineDashItem::XLineDashItem(const XubString& rName, const XDash& rTheDash) :
914 NameOrIndex(XATTR_LINEDASH, rName),
915 aDash(rTheDash)
919 /*************************************************************************
921 |* XLineDashItem::XLineDashItem(const XLineDashItem& rItem)
923 |* Beschreibung
924 |* Ersterstellung 15.11.94
925 |* Letzte Aenderung 15.11.94
927 *************************************************************************/
929 XLineDashItem::XLineDashItem(const XLineDashItem& rItem) :
930 NameOrIndex(rItem),
931 aDash(rItem.aDash)
935 /*************************************************************************
937 |* XLineDashItem::XLineDashItem(SvStream& rIn)
939 |* Beschreibung
940 |* Ersterstellung 15.11.94
941 |* Letzte Aenderung 15.11.94
943 *************************************************************************/
945 XLineDashItem::XLineDashItem(SvStream& rIn) :
946 NameOrIndex(XATTR_LINEDASH, rIn)
948 if (!IsIndex())
950 USHORT nSTemp;
951 UINT32 nLTemp;
952 INT32 nITemp;
954 rIn >> nITemp; aDash.SetDashStyle((XDashStyle)nITemp);
955 rIn >> nSTemp; aDash.SetDots(nSTemp);
956 rIn >> nLTemp; aDash.SetDotLen(nLTemp);
957 rIn >> nSTemp; aDash.SetDashes(nSTemp);
958 rIn >> nLTemp; aDash.SetDashLen(nLTemp);
959 rIn >> nLTemp; aDash.SetDistance(nLTemp);
963 //*************************************************************************
965 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash)
966 : NameOrIndex( XATTR_LINEDASH, -1 ),
967 aDash(rTheDash)
971 //*************************************************************************
973 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/)
974 : NameOrIndex(XATTR_LINEDASH, -1 )
978 /*************************************************************************
980 |* XLineDashItem::Clone(SfxItemPool* pPool) const
982 |* Beschreibung
983 |* Ersterstellung 15.11.94
984 |* Letzte Aenderung 15.11.94
986 *************************************************************************/
988 SfxPoolItem* XLineDashItem::Clone(SfxItemPool* /*pPool*/) const
990 return new XLineDashItem(*this);
993 /*************************************************************************
995 |* int XLineDashItem::operator==(const SfxPoolItem& rItem) const
997 |* Beschreibung
998 |* Ersterstellung 15.11.94
999 |* Letzte Aenderung 15.11.94
1001 *************************************************************************/
1003 int XLineDashItem::operator==(const SfxPoolItem& rItem) const
1005 return ( NameOrIndex::operator==(rItem) &&
1006 aDash == ((const XLineDashItem&) rItem).aDash );
1009 /*************************************************************************
1011 |* SfxPoolItem* XLineDashItem::Create(SvStream& rIn, USHORT nVer) const
1013 |* Beschreibung
1014 |* Ersterstellung 15.11.94
1015 |* Letzte Aenderung 15.11.94
1017 *************************************************************************/
1019 SfxPoolItem* XLineDashItem::Create(SvStream& rIn, USHORT /*nVer*/) const
1021 return new XLineDashItem(rIn);
1024 /*************************************************************************
1026 |* SfxPoolItem* XLineDashItem::Store(SvStream& rOut) const
1028 |* Beschreibung
1029 |* Ersterstellung 15.11.94
1030 |* Letzte Aenderung 15.11.94
1032 *************************************************************************/
1034 SvStream& XLineDashItem::Store( SvStream& rOut, USHORT nItemVersion ) const
1036 NameOrIndex::Store( rOut, nItemVersion );
1038 if (!IsIndex())
1040 rOut << (INT32) aDash.GetDashStyle();
1041 rOut << aDash.GetDots();
1042 rOut << (UINT32) aDash.GetDotLen();
1043 rOut << aDash.GetDashes();
1044 rOut << (UINT32) aDash.GetDashLen();
1045 rOut << (UINT32) aDash.GetDistance();
1048 return rOut;
1051 /*************************************************************************
1053 |* const XDash& XLineDashItem::GetValue(const XDashTable* pTable) const
1055 |* Beschreibung
1056 |* Ersterstellung 15.11.94
1057 |* Letzte Aenderung 18.11.94
1059 *************************************************************************/
1061 const XDash& XLineDashItem::GetDashValue(const XDashTable* pTable) const // GetValue -> GetDashValue
1063 if (!IsIndex())
1064 return aDash;
1065 else
1066 return pTable->GetDash(GetIndex())->GetDash();
1069 //------------------------------------------------------------------------
1071 SfxItemPresentation XLineDashItem::GetPresentation
1073 SfxItemPresentation ePres,
1074 SfxMapUnit /*eCoreUnit*/,
1075 SfxMapUnit /*ePresUnit*/,
1076 XubString& rText, const IntlWrapper *
1077 ) const
1079 switch ( ePres )
1081 case SFX_ITEM_PRESENTATION_NONE:
1082 rText.Erase();
1083 return ePres;
1084 case SFX_ITEM_PRESENTATION_NAMELESS:
1085 case SFX_ITEM_PRESENTATION_COMPLETE:
1086 rText = GetName();
1087 return ePres;
1088 default:
1089 return SFX_ITEM_PRESENTATION_NONE;
1093 //------------------------------------------------------------------------
1095 FASTBOOL XLineDashItem::HasMetrics() const
1097 return TRUE;
1100 //------------------------------------------------------------------------
1102 FASTBOOL XLineDashItem::ScaleMetrics(long nMul, long nDiv)
1104 aDash.SetDotLen( ScaleMetricValue( aDash.GetDotLen(), nMul, nDiv ) );
1105 aDash.SetDashLen( ScaleMetricValue( aDash.GetDashLen(), nMul, nDiv ) );
1106 aDash.SetDistance( ScaleMetricValue( aDash.GetDistance(), nMul, nDiv ) );
1107 return TRUE;
1110 sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
1112 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1113 nMemberId &= ~CONVERT_TWIPS;
1115 switch ( nMemberId )
1117 case 0:
1119 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
1121 ::com::sun::star::drawing::LineDash aLineDash;
1123 const XDash& rXD = GetDashValue();
1124 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((UINT16)rXD.GetDashStyle());
1125 aLineDash.Dots = rXD.GetDots();
1126 aLineDash.DotLen = rXD.GetDotLen();
1127 aLineDash.Dashes = rXD.GetDashes();
1128 aLineDash.DashLen = rXD.GetDashLen();
1129 aLineDash.Distance = rXD.GetDistance();
1131 rtl::OUString aApiName;
1132 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1133 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
1134 aPropSeq[0].Value = uno::makeAny( aApiName );
1135 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" ));
1136 aPropSeq[1].Value = uno::makeAny( aLineDash );
1137 rVal = uno::makeAny( aPropSeq );
1138 break;
1141 case MID_NAME:
1143 rtl::OUString aApiName;
1144 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1145 rVal <<= aApiName;
1146 break;
1149 case MID_LINEDASH:
1151 const XDash& rXD = GetDashValue();
1153 ::com::sun::star::drawing::LineDash aLineDash;
1155 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((UINT16)rXD.GetDashStyle());
1156 aLineDash.Dots = rXD.GetDots();
1157 aLineDash.DotLen = rXD.GetDotLen();
1158 aLineDash.Dashes = rXD.GetDashes();
1159 aLineDash.DashLen = rXD.GetDashLen();
1160 aLineDash.Distance = rXD.GetDistance();
1162 rVal <<= aLineDash;
1163 break;
1166 case MID_LINEDASH_STYLE:
1168 const XDash& rXD = GetDashValue();
1169 rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle());
1170 break;
1173 case MID_LINEDASH_DOTS:
1175 const XDash& rXD = GetDashValue();
1176 rVal <<= rXD.GetDots();
1177 break;
1180 case MID_LINEDASH_DOTLEN:
1182 const XDash& rXD = GetDashValue();
1183 rVal <<= rXD.GetDotLen();
1184 break;
1187 case MID_LINEDASH_DASHES:
1189 const XDash& rXD = GetDashValue();
1190 rVal <<= rXD.GetDashes();
1191 break;
1194 case MID_LINEDASH_DASHLEN:
1196 const XDash& rXD = GetDashValue();
1197 rVal <<= rXD.GetDashLen();
1198 break;
1201 case MID_LINEDASH_DISTANCE:
1203 const XDash& rXD = GetDashValue();
1204 rVal <<= rXD.GetDistance();
1205 break;
1208 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
1211 return sal_True;
1214 sal_Bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
1216 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1217 nMemberId &= ~CONVERT_TWIPS;
1219 switch ( nMemberId )
1221 case 0:
1223 uno::Sequence< beans::PropertyValue > aPropSeq;
1224 ::com::sun::star::drawing::LineDash aLineDash;
1225 rtl::OUString aName;
1226 sal_Bool bLineDash( sal_False );
1228 if ( rVal >>= aPropSeq )
1230 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
1232 if ( aPropSeq[n].Name.equalsAsciiL( "Name", 4 ))
1233 aPropSeq[n].Value >>= aName;
1234 else if ( aPropSeq[n].Name.equalsAsciiL( "LineDash", 8 ))
1236 if ( aPropSeq[n].Value >>= aLineDash )
1237 bLineDash = sal_True;
1241 SetName( aName );
1242 if ( bLineDash )
1244 XDash aXDash;
1246 aXDash.SetDashStyle((XDashStyle)((UINT16)(aLineDash.Style)));
1247 aXDash.SetDots(aLineDash.Dots);
1248 aXDash.SetDotLen(aLineDash.DotLen);
1249 aXDash.SetDashes(aLineDash.Dashes);
1250 aXDash.SetDashLen(aLineDash.DashLen);
1251 aXDash.SetDistance(aLineDash.Distance);
1253 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1254 aXDash.SetDots(1);
1256 SetDashValue( aXDash );
1259 return sal_True;
1262 return sal_False;
1265 case MID_NAME:
1267 rtl::OUString aName;
1268 if (!(rVal >>= aName))
1269 return sal_False;
1270 SetName( aName );
1271 break;
1274 case MID_LINEDASH:
1276 ::com::sun::star::drawing::LineDash aLineDash;
1277 if(!(rVal >>= aLineDash))
1278 return sal_False;
1280 XDash aXDash;
1282 aXDash.SetDashStyle((XDashStyle)((UINT16)(aLineDash.Style)));
1283 aXDash.SetDots(aLineDash.Dots);
1284 aXDash.SetDotLen(aLineDash.DotLen);
1285 aXDash.SetDashes(aLineDash.Dashes);
1286 aXDash.SetDashLen(aLineDash.DashLen);
1287 aXDash.SetDistance(aLineDash.Distance);
1289 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1290 aXDash.SetDots(1);
1292 SetDashValue( aXDash );
1293 break;
1296 case MID_LINEDASH_STYLE:
1298 sal_Int16 nVal = sal_Int16();
1299 if(!(rVal >>= nVal))
1300 return sal_False;
1302 XDash aXDash = GetDashValue();
1303 aXDash.SetDashStyle((XDashStyle)((UINT16)(nVal)));
1305 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1306 aXDash.SetDots(1);
1308 SetDashValue( aXDash );
1310 break;
1313 case MID_LINEDASH_DOTS:
1314 case MID_LINEDASH_DASHES:
1316 sal_Int16 nVal = sal_Int16();
1317 if(!(rVal >>= nVal))
1318 return sal_False;
1320 XDash aXDash = GetDashValue();
1321 if ( nMemberId == MID_LINEDASH_DOTS )
1322 aXDash.SetDots( nVal );
1323 else
1324 aXDash.SetDashes( nVal );
1326 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1327 aXDash.SetDots(1);
1329 SetDashValue( aXDash );
1330 break;
1333 case MID_LINEDASH_DOTLEN:
1334 case MID_LINEDASH_DASHLEN:
1335 case MID_LINEDASH_DISTANCE:
1337 sal_Int32 nVal = 0;
1338 if(!(rVal >>= nVal))
1339 return sal_False;
1341 XDash aXDash = GetDashValue();
1342 if ( nMemberId == MID_LINEDASH_DOTLEN )
1343 aXDash.SetDotLen( nVal );
1344 else if ( nMemberId == MID_LINEDASH_DASHLEN )
1345 aXDash.SetDashLen( nVal );
1346 else
1347 aXDash.SetDistance( nVal );
1349 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1350 aXDash.SetDots(1);
1352 SetDashValue( aXDash );
1353 break;
1357 return sal_True;
1360 BOOL XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
1362 return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue();
1365 XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const
1367 if( pModel )
1369 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
1370 XATTR_LINEDASH,
1371 &pModel->GetItemPool(),
1372 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
1373 XLineDashItem::CompareValueFunc,
1374 RID_SVXSTR_DASH11,
1375 pModel->GetDashList() );
1377 // if the given name is not valid, replace it!
1378 if( aUniqueName != GetName() )
1380 return new XLineDashItem( aUniqueName, aDash );
1384 return (XLineDashItem*)this;
1387 // -------------------
1388 // class XLineWidthItem
1389 // -------------------
1390 TYPEINIT1_AUTOFACTORY(XLineWidthItem, SfxMetricItem);
1392 /*************************************************************************
1394 |* XLineWidthItem::XLineWidthItem(long nWidth)
1396 |* Beschreibung
1397 |* Ersterstellung 15.11.94
1398 |* Letzte Aenderung 18.11.94
1400 *************************************************************************/
1402 XLineWidthItem::XLineWidthItem(long nWidth) :
1403 SfxMetricItem(XATTR_LINEWIDTH, nWidth)
1407 /*************************************************************************
1409 |* XLineWidthItem::XLineWidthItem(SvStream& rIn)
1411 |* Beschreibung
1412 |* Ersterstellung 15.11.94
1413 |* Letzte Aenderung 15.11.94
1415 *************************************************************************/
1417 XLineWidthItem::XLineWidthItem(SvStream& rIn) :
1418 SfxMetricItem(XATTR_LINEWIDTH, rIn)
1422 /*************************************************************************
1424 |* XLineWidthItem::Clone(SfxItemPool* pPool) const
1426 |* Beschreibung
1427 |* Ersterstellung 15.11.94
1428 |* Letzte Aenderung 15.11.94
1430 *************************************************************************/
1432 SfxPoolItem* XLineWidthItem::Clone(SfxItemPool* /*pPool*/) const
1434 return new XLineWidthItem(*this);
1437 /*************************************************************************
1439 |* SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, USHORT nVer) const
1441 |* Beschreibung
1442 |* Ersterstellung 15.11.94
1443 |* Letzte Aenderung 15.11.94
1445 *************************************************************************/
1447 SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, USHORT /*nVer*/) const
1449 return new XLineWidthItem(rIn);
1452 //------------------------------------------------------------------------
1454 SfxItemPresentation XLineWidthItem::GetPresentation
1456 SfxItemPresentation ePres,
1457 SfxMapUnit eCoreUnit,
1458 SfxMapUnit ePresUnit,
1459 XubString& rText, const IntlWrapper * pIntl
1460 ) const
1462 switch ( ePres )
1464 case SFX_ITEM_PRESENTATION_NONE:
1465 rText.Erase();
1466 return ePres;
1467 case SFX_ITEM_PRESENTATION_NAMELESS:
1468 case SFX_ITEM_PRESENTATION_COMPLETE:
1469 rText = GetMetricText( (long) GetValue(),
1470 eCoreUnit, ePresUnit, pIntl);
1471 rText += SVX_RESSTR( GetMetricId( ePresUnit) );
1472 return ePres;
1473 default:
1474 return SFX_ITEM_PRESENTATION_NONE;
1478 sal_Bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
1480 sal_Int32 nValue = GetValue();
1481 if( 0 != (nMemberId&CONVERT_TWIPS) )
1482 nValue = TWIP_TO_MM100(nValue);
1484 rVal <<= nValue;
1485 return sal_True;
1488 sal_Bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
1490 sal_Int32 nValue = 0;
1491 rVal >>= nValue;
1492 if( 0 != (nMemberId&CONVERT_TWIPS) )
1493 nValue = MM100_TO_TWIP(nValue);
1495 SetValue( nValue );
1496 return sal_True;
1499 // -------------------
1500 // class XLineColorItem
1501 // -------------------
1502 TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
1504 /*************************************************************************
1506 |* XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor)
1508 |* Beschreibung
1509 |* Ersterstellung 15.11.94
1510 |* Letzte Aenderung 15.11.94
1512 *************************************************************************/
1514 XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor) :
1515 XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
1519 /*************************************************************************
1521 |* XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor)
1523 |* Beschreibung
1524 |* Ersterstellung 15.11.94
1525 |* Letzte Aenderung 15.11.94
1527 *************************************************************************/
1529 XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) :
1530 XColorItem(XATTR_LINECOLOR, rName, rTheColor)
1534 /*************************************************************************
1536 |* XLineColorItem::XLineColorItem(SvStream& rIn)
1538 |* Beschreibung
1539 |* Ersterstellung 15.11.94
1540 |* Letzte Aenderung 15.11.94
1542 *************************************************************************/
1544 XLineColorItem::XLineColorItem(SvStream& rIn) :
1545 XColorItem(XATTR_LINECOLOR, rIn)
1549 /*************************************************************************
1551 |* XLineColorItem::Clone(SfxItemPool* pPool) const
1553 |* Beschreibung
1554 |* Ersterstellung 15.11.94
1555 |* Letzte Aenderung 15.11.94
1557 *************************************************************************/
1559 SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const
1561 return new XLineColorItem(*this);
1564 /*************************************************************************
1566 |* SfxPoolItem* XLineColorItem::Create(SvStream& rIn, USHORT nVer) const
1568 |* Beschreibung
1569 |* Ersterstellung 15.11.94
1570 |* Letzte Aenderung 15.11.94
1572 *************************************************************************/
1574 SfxPoolItem* XLineColorItem::Create(SvStream& rIn, USHORT /*nVer*/) const
1576 return new XLineColorItem(rIn);
1579 //------------------------------------------------------------------------
1581 SfxItemPresentation XLineColorItem::GetPresentation
1583 SfxItemPresentation ePres,
1584 SfxMapUnit /*eCoreUnit*/,
1585 SfxMapUnit /*ePresUnit*/,
1586 XubString& rText, const IntlWrapper *
1587 ) const
1589 switch ( ePres )
1591 case SFX_ITEM_PRESENTATION_NONE:
1592 rText.Erase();
1593 return ePres;
1594 case SFX_ITEM_PRESENTATION_NAMELESS:
1595 case SFX_ITEM_PRESENTATION_COMPLETE:
1596 rText = GetName();
1597 return ePres;
1598 default:
1599 return SFX_ITEM_PRESENTATION_NONE;
1603 sal_Bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
1605 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
1606 return sal_True;
1609 sal_Bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
1611 sal_Int32 nValue = 0;
1612 if(!(rVal >>= nValue))
1613 return sal_False;
1615 SetColorValue( nValue );
1616 return sal_True;
1619 //////////////////////////////////////////////////////////////////////////////
1620 // tooling for simple spooling B2DPolygon to file and back
1622 namespace
1624 void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut)
1626 const sal_uInt32 nPolygonCount(rPolyPolygon.count());
1627 rOut << nPolygonCount;
1629 for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1631 const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
1632 const sal_uInt32 nPointCount(aCandidate.count());
1633 const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0);
1634 const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0);
1635 rOut << nPointCount;
1636 rOut << bClosed;
1637 rOut << bControlPoints;
1639 for(sal_uInt32 b(0L); b < nPointCount; b++)
1641 const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b));
1642 rOut << aPoint.getX();
1643 rOut << aPoint.getY();
1645 if(bControlPoints)
1647 const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0);
1648 rOut << bEdgeIsCurve;
1650 if(bEdgeIsCurve)
1652 const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b));
1653 rOut << aControlVectorA.getX();
1654 rOut << aControlVectorA.getY();
1656 const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b));
1657 rOut << aControlVectorB.getX();
1658 rOut << aControlVectorB.getY();
1665 basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn)
1667 basegfx::B2DPolyPolygon aRetval;
1668 sal_uInt32 nPolygonCount;
1669 rIn >> nPolygonCount;
1671 for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1673 sal_uInt32 nPointCount;
1674 sal_uInt8 bClosed;
1675 sal_uInt8 bControlPoints;
1677 rIn >> nPointCount;
1678 rIn >> bClosed;
1679 rIn >> bControlPoints;
1681 basegfx::B2DPolygon aCandidate;
1682 aCandidate.setClosed(0 != bClosed);
1684 for(sal_uInt32 b(0L); b < nPointCount; b++)
1686 double fX, fY;
1687 rIn >> fX;
1688 rIn >> fY;
1689 aCandidate.append(basegfx::B2DPoint(fX, fY));
1691 if(0 != bControlPoints)
1693 sal_uInt8 bEdgeIsCurve;
1694 rIn >> bEdgeIsCurve;
1696 if(0 != bEdgeIsCurve)
1698 rIn >> fX;
1699 rIn >> fY;
1700 aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY));
1702 rIn >> fX;
1703 rIn >> fY;
1704 aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY));
1709 aRetval.append(aCandidate);
1712 return aRetval;
1716 //////////////////////////////////////////////////////////////////////////////
1718 // -----------------------
1719 // class XLineStartItem
1720 // -----------------------
1721 TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
1723 /*************************************************************************
1725 |* XLineStartItem::XLineStartItem(INT32 nIndex)
1727 |* Beschreibung
1728 |* Ersterstellung 15.11.94
1729 |* Letzte Aenderung 18.11.94
1731 *************************************************************************/
1733 XLineStartItem::XLineStartItem(INT32 nIndex)
1734 : NameOrIndex(XATTR_LINESTART, nIndex)
1738 /*************************************************************************
1740 |* XLineStartItem::XLineStartItem(const XubString& rName,
1741 |* const basegfx::B2DPolyPolygon& rXPolygon)
1743 |* Beschreibung
1744 |* Ersterstellung 15.11.94
1745 |* Letzte Aenderung 18.11.94
1747 *************************************************************************/
1749 XLineStartItem::XLineStartItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1750 : NameOrIndex(XATTR_LINESTART, rName),
1751 maPolyPolygon(rPolyPolygon)
1755 /*************************************************************************
1757 |* XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1759 |* Beschreibung
1760 |* Ersterstellung 15.11.94
1761 |* Letzte Aenderung 17.11.94
1763 *************************************************************************/
1765 XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1766 : NameOrIndex(rItem),
1767 maPolyPolygon(rItem.maPolyPolygon)
1771 /*************************************************************************
1773 |* XLineStartItem::XLineStartItem(SvStream& rIn)
1775 |* Beschreibung
1776 |* Ersterstellung 15.11.94
1777 |* Letzte Aenderung 17.11.94
1779 *************************************************************************/
1781 XLineStartItem::XLineStartItem(SvStream& rIn) :
1782 NameOrIndex(XATTR_LINESTART, rIn)
1784 if (!IsIndex())
1786 maPolyPolygon = streamInB2DPolyPolygon(rIn);
1790 //*************************************************************************
1792 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
1793 : NameOrIndex( XATTR_LINESTART, -1 ),
1794 maPolyPolygon(rPolyPolygon)
1798 //*************************************************************************
1800 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/)
1801 : NameOrIndex(XATTR_LINESTART, -1 )
1805 /*************************************************************************
1807 |* XLineStartItem::Clone(SfxItemPool* pPool) const
1809 |* Beschreibung
1810 |* Ersterstellung 15.11.94
1811 |* Letzte Aenderung 15.11.94
1813 *************************************************************************/
1815 SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const
1817 return new XLineStartItem(*this);
1820 /*************************************************************************
1822 |* int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1824 |* Beschreibung
1825 |* Ersterstellung 15.11.94
1826 |* Letzte Aenderung 18.11.94
1828 *************************************************************************/
1830 int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1832 return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon );
1835 /*************************************************************************
1837 |* SfxPoolItem* XLineStartItem::Create(SvStream& rIn, USHORT nVer) const
1839 |* Beschreibung
1840 |* Ersterstellung 15.11.94
1841 |* Letzte Aenderung 15.11.94
1843 *************************************************************************/
1845 SfxPoolItem* XLineStartItem::Create(SvStream& rIn, USHORT /*nVer*/) const
1847 return new XLineStartItem(rIn);
1850 /*************************************************************************
1852 |* SfxPoolItem* XLineStartItem::Store(SvStream& rOut) const
1854 |* Beschreibung
1855 |* Ersterstellung 15.11.94
1856 |* Letzte Aenderung 18.11.94
1858 *************************************************************************/
1860 SvStream& XLineStartItem::Store( SvStream& rOut, USHORT nItemVersion ) const
1862 NameOrIndex::Store( rOut, nItemVersion );
1864 if (!IsIndex())
1866 streamOutB2DPolyPolygon(maPolyPolygon, rOut);
1869 return rOut;
1872 /*************************************************************************
1874 |* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndTable* pTable)
1875 |* const
1877 |* Beschreibung
1878 |* Ersterstellung 15.11.94
1879 |* Letzte Aenderung 18.11.94
1881 *************************************************************************/
1883 basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndTable* pTable) const
1885 if (!IsIndex())
1887 return maPolyPolygon;
1889 else
1891 return pTable->GetLineEnd(GetIndex())->GetLineEnd();
1895 //------------------------------------------------------------------------
1897 SfxItemPresentation XLineStartItem::GetPresentation
1899 SfxItemPresentation ePres,
1900 SfxMapUnit /*eCoreUnit*/,
1901 SfxMapUnit /*ePresUnit*/,
1902 XubString& rText, const IntlWrapper *
1903 ) const
1905 switch ( ePres )
1907 case SFX_ITEM_PRESENTATION_NONE:
1908 rText.Erase();
1909 return ePres;
1910 case SFX_ITEM_PRESENTATION_NAMELESS:
1911 case SFX_ITEM_PRESENTATION_COMPLETE:
1912 rText = GetName();
1913 return ePres;
1914 default:
1915 return SFX_ITEM_PRESENTATION_NONE;
1919 sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
1921 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1922 nMemberId &= ~CONVERT_TWIPS;
1923 if( nMemberId == MID_NAME )
1925 rtl::OUString aApiName;
1926 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1927 rVal <<= aApiName;
1929 else
1931 com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
1932 SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
1933 rVal <<= aBezier;
1936 return sal_True;
1939 sal_Bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
1941 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1942 nMemberId &= ~CONVERT_TWIPS;
1943 if( nMemberId == MID_NAME )
1945 return sal_False;
1947 else
1949 maPolyPolygon.clear();
1951 if( rVal.hasValue() && rVal.getValue() )
1953 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
1954 return sal_False;
1956 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
1957 if( pCoords->Coordinates.getLength() > 0 )
1959 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
1960 // #i72807# close line start/end polygons hard
1961 // maPolyPolygon.setClosed(true);
1966 return sal_True;
1969 /** this function searches in both the models pool and the styles pool for XLineStartItem
1970 and XLineEndItem with the same value or name and returns an item with the value of
1971 this item and a unique name for an item with this value. */
1972 XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
1974 if( pModel )
1976 XLineStartItem* pTempItem = NULL;
1977 const XLineStartItem* pLineStartItem = this;
1979 String aUniqueName( GetName() );
1981 if( !maPolyPolygon.count() )
1983 // if the polygon is empty, check if the name is empty
1984 if( aUniqueName.Len() == 0 )
1985 return (XLineStartItem*)this;
1987 // force empty name for empty polygons
1988 return new XLineStartItem( String(), maPolyPolygon );
1991 if( maPolyPolygon.count() > 1L )
1993 // check if the polygon is closed
1994 if(!maPolyPolygon.isClosed())
1996 // force a closed polygon
1997 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
1998 aNew.setClosed(true);
1999 pTempItem = new XLineStartItem( aUniqueName, aNew );
2000 pLineStartItem = pTempItem;
2004 sal_Bool bForceNew = sal_False;
2006 // 2. if we have a name check if there is already an item with the
2007 // same name in the documents pool with a different line end or start
2009 sal_uInt16 nCount, nSurrogate;
2011 const SfxItemPool* pPool1 = &pModel->GetItemPool();
2012 if( aUniqueName.Len() && pPool1 )
2014 nCount = pPool1->GetItemCount( XATTR_LINESTART );
2016 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2018 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate );
2020 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2022 // if there is already an item with the same name and the same
2023 // value its ok to set it
2024 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
2026 // same name but different value, we need a new name for this item
2027 aUniqueName = String();
2028 bForceNew = sal_True;
2030 break;
2034 if( !bForceNew )
2036 nCount = pPool1->GetItemCount( XATTR_LINEEND );
2038 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2040 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate );
2042 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2044 // if there is already an item with the same name and the same
2045 // value its ok to set it
2046 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
2048 // same name but different value, we need a new name for this item
2049 aUniqueName = String();
2050 bForceNew = sal_True;
2052 break;
2058 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2059 if( aUniqueName.Len() && pPool2)
2061 nCount = pPool2->GetItemCount( XATTR_LINESTART );
2062 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2064 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem( XATTR_LINESTART, nSurrogate );
2066 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2068 // if there is already an item with the same name and the same
2069 // value its ok to set it
2070 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
2072 // same name but different value, we need a new name for this item
2073 aUniqueName = String();
2074 bForceNew = sal_True;
2076 break;
2080 if( !bForceNew )
2082 nCount = pPool2->GetItemCount( XATTR_LINEEND );
2083 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2085 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem( XATTR_LINEEND, nSurrogate );
2087 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2089 // if there is already an item with the same name and the same
2090 // value its ok to set it
2091 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
2093 // same name but different value, we need a new name for this item
2094 aUniqueName = String();
2095 bForceNew = sal_True;
2097 break;
2103 // if we have no name yet, find existing item with same conent or
2104 // create a unique name
2105 if( aUniqueName.Len() == 0 )
2107 sal_Bool bFoundExisting = sal_False;
2109 sal_Int32 nUserIndex = 1;
2110 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2111 const String aUser( aRes );
2113 if( pPool1 )
2115 nCount = pPool1->GetItemCount( XATTR_LINESTART );
2116 sal_uInt16 nSurrogate2;
2118 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2120 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate2 );
2122 if( pItem && pItem->GetName().Len() )
2124 if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
2126 aUniqueName = pItem->GetName();
2127 bFoundExisting = sal_True;
2128 break;
2131 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2133 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2134 if( nThisIndex >= nUserIndex )
2135 nUserIndex = nThisIndex + 1;
2140 nCount = pPool1->GetItemCount( XATTR_LINEEND );
2141 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2143 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate2 );
2145 if( pItem && pItem->GetName().Len() )
2147 if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
2149 aUniqueName = pItem->GetName();
2150 bFoundExisting = sal_True;
2151 break;
2154 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2156 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2157 if( nThisIndex >= nUserIndex )
2158 nUserIndex = nThisIndex + 1;
2164 if( !bFoundExisting )
2166 aUniqueName = aUser;
2167 aUniqueName += sal_Unicode(' ');
2168 aUniqueName += String::CreateFromInt32( nUserIndex );
2172 // if the given name is not valid, replace it!
2173 if( aUniqueName != GetName() || pTempItem )
2175 if( pTempItem )
2177 pTempItem->SetName( aUniqueName );
2178 return pTempItem;
2180 else
2182 return new XLineStartItem( aUniqueName, maPolyPolygon );
2187 return (XLineStartItem*)this;
2190 // ---------------------
2191 // class XLineEndItem
2192 // ---------------------
2193 TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
2195 /*************************************************************************
2197 |* XLineEndItem::XLineEndItem(INT32 nIndex)
2199 |* Beschreibung
2200 |* Ersterstellung 15.11.94
2201 |* Letzte Aenderung 18.11.94
2203 *************************************************************************/
2205 XLineEndItem::XLineEndItem(INT32 nIndex)
2206 : NameOrIndex(XATTR_LINEEND, nIndex)
2210 /*************************************************************************
2212 |* XLineEndItem::XLineEndItem(const XubString& rName,
2213 |* const basegfx::B2DPolyPolygon& rXPolygon)
2215 |* Beschreibung
2216 |* Ersterstellung 15.11.94
2217 |* Letzte Aenderung 18.11.94
2219 *************************************************************************/
2221 XLineEndItem::XLineEndItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
2222 : NameOrIndex(XATTR_LINEEND, rName),
2223 maPolyPolygon(rPolyPolygon)
2227 /*************************************************************************
2229 |* XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2231 |* Beschreibung
2232 |* Ersterstellung 15.11.94
2233 |* Letzte Aenderung 18.11.94
2235 *************************************************************************/
2237 XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2238 : NameOrIndex(rItem),
2239 maPolyPolygon(rItem.maPolyPolygon)
2243 /*************************************************************************
2245 |* XLineEndItem::XLineEndItem(SvStream& rIn)
2247 |* Beschreibung
2248 |* Ersterstellung 15.11.94
2249 |* Letzte Aenderung 17.11.94
2251 *************************************************************************/
2253 XLineEndItem::XLineEndItem(SvStream& rIn) :
2254 NameOrIndex(XATTR_LINEEND, rIn)
2256 if (!IsIndex())
2258 maPolyPolygon = streamInB2DPolyPolygon(rIn);
2262 //*************************************************************************
2264 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
2265 : NameOrIndex( XATTR_LINEEND, -1 ),
2266 maPolyPolygon(rPolyPolygon)
2270 //*************************************************************************
2272 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/)
2273 : NameOrIndex(XATTR_LINEEND, -1 )
2277 /*************************************************************************
2279 |* XLineEndItem::Clone(SfxItemPool* pPool) const
2281 |* Beschreibung
2282 |* Ersterstellung 15.11.94
2283 |* Letzte Aenderung 15.11.94
2285 *************************************************************************/
2287 SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const
2289 return new XLineEndItem(*this);
2292 /*************************************************************************
2294 |* int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2296 |* Beschreibung
2297 |* Ersterstellung 15.11.94
2298 |* Letzte Aenderung 17.11.94
2300 *************************************************************************/
2302 int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2304 return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon );
2307 /*************************************************************************
2309 |* SfxPoolItem* XLineEndItem::Create(SvStream& rIn, USHORT nVer) const
2311 |* Beschreibung
2312 |* Ersterstellung 15.11.94
2313 |* Letzte Aenderung 15.11.94
2315 *************************************************************************/
2317 SfxPoolItem* XLineEndItem::Create(SvStream& rIn, USHORT /*nVer*/) const
2319 return new XLineEndItem(rIn);
2322 /*************************************************************************
2324 |* SfxPoolItem* XLineEndItem::Store(SvStream& rOut) const
2326 |* Beschreibung
2327 |* Ersterstellung 15.11.94
2328 |* Letzte Aenderung 17.11.94
2330 *************************************************************************/
2332 SvStream& XLineEndItem::Store( SvStream& rOut, USHORT nItemVersion ) const
2334 NameOrIndex::Store( rOut, nItemVersion );
2336 if (!IsIndex())
2338 streamOutB2DPolyPolygon(maPolyPolygon, rOut);
2341 return rOut;
2344 /*************************************************************************
2346 |* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndTable* pTable) const
2348 |* Beschreibung
2349 |* Ersterstellung 15.11.94
2350 |* Letzte Aenderung 18.11.94
2352 *************************************************************************/
2354 basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndTable* pTable) const
2356 if (!IsIndex())
2358 return maPolyPolygon;
2360 else
2362 return pTable->GetLineEnd(GetIndex())->GetLineEnd();
2367 /** this function searches in both the models pool and the styles pool for XLineStartItem
2368 and XLineEndItem with the same value or name and returns an item with the value of
2369 this item and a unique name for an item with this value. */
2370 XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
2372 if( pModel )
2374 XLineEndItem* pTempItem = NULL;
2375 const XLineEndItem* pLineEndItem = this;
2377 String aUniqueName( GetName() );
2379 if( !maPolyPolygon.count() )
2381 // if the polygon is empty, check if the name is empty
2382 if( aUniqueName.Len() == 0 )
2383 return (XLineEndItem*)this;
2385 // force empty name for empty polygons
2386 return new XLineEndItem( String(), maPolyPolygon );
2389 if( maPolyPolygon.count() > 1L )
2391 // check if the polygon is closed
2392 if(!maPolyPolygon.isClosed())
2394 // force a closed polygon
2395 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
2396 aNew.setClosed(true);
2397 pTempItem = new XLineEndItem( aUniqueName, aNew );
2398 pLineEndItem = pTempItem;
2402 sal_Bool bForceNew = sal_False;
2404 // 2. if we have a name check if there is already an item with the
2405 // same name in the documents pool with a different line end or start
2407 sal_uInt16 nCount, nSurrogate;
2409 const SfxItemPool* pPool1 = &pModel->GetItemPool();
2410 if( aUniqueName.Len() && pPool1 )
2412 nCount = pPool1->GetItemCount( XATTR_LINESTART );
2414 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2416 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate );
2418 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2420 // if there is already an item with the same name and the same
2421 // value its ok to set it
2422 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2424 // same name but different value, we need a new name for this item
2425 aUniqueName = String();
2426 bForceNew = sal_True;
2428 break;
2432 if( !bForceNew )
2434 nCount = pPool1->GetItemCount( XATTR_LINEEND );
2436 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2438 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate );
2440 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2442 // if there is already an item with the same name and the same
2443 // value its ok to set it
2444 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2446 // same name but different value, we need a new name for this item
2447 aUniqueName = String();
2448 bForceNew = sal_True;
2450 break;
2456 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2457 if( aUniqueName.Len() && pPool2)
2459 nCount = pPool2->GetItemCount( XATTR_LINESTART );
2460 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2462 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem( XATTR_LINESTART, nSurrogate );
2464 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2466 // if there is already an item with the same name and the same
2467 // value its ok to set it
2468 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2470 // same name but different value, we need a new name for this item
2471 aUniqueName = String();
2472 bForceNew = sal_True;
2474 break;
2478 if( !bForceNew )
2480 nCount = pPool2->GetItemCount( XATTR_LINEEND );
2481 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2483 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem( XATTR_LINEEND, nSurrogate );
2485 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2487 // if there is already an item with the same name and the same
2488 // value its ok to set it
2489 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2491 // same name but different value, we need a new name for this item
2492 aUniqueName = String();
2493 bForceNew = sal_True;
2495 break;
2501 // if we have no name yet, find existing item with same conent or
2502 // create a unique name
2503 if( aUniqueName.Len() == 0 )
2505 sal_Bool bFoundExisting = sal_False;
2507 sal_Int32 nUserIndex = 1;
2508 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2509 const String aUser( aRes );
2511 if( pPool1 )
2513 nCount = pPool1->GetItemCount( XATTR_LINESTART );
2514 sal_uInt16 nSurrogate2;
2516 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2518 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem( XATTR_LINESTART, nSurrogate2 );
2520 if( pItem && pItem->GetName().Len() )
2522 if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
2524 aUniqueName = pItem->GetName();
2525 bFoundExisting = sal_True;
2526 break;
2529 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2531 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2532 if( nThisIndex >= nUserIndex )
2533 nUserIndex = nThisIndex + 1;
2538 nCount = pPool1->GetItemCount( XATTR_LINEEND );
2539 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2541 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem( XATTR_LINEEND, nSurrogate2 );
2543 if( pItem && pItem->GetName().Len() )
2545 if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
2547 aUniqueName = pItem->GetName();
2548 bFoundExisting = sal_True;
2549 break;
2552 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2554 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2555 if( nThisIndex >= nUserIndex )
2556 nUserIndex = nThisIndex + 1;
2562 if( !bFoundExisting )
2564 aUniqueName = aUser;
2565 aUniqueName += sal_Unicode(' ');
2566 aUniqueName += String::CreateFromInt32( nUserIndex );
2570 // if the given name is not valid, replace it!
2571 if( aUniqueName != GetName() || pTempItem )
2573 if( pTempItem )
2575 pTempItem->SetName( aUniqueName );
2576 return pTempItem;
2578 else
2580 return new XLineEndItem( aUniqueName, maPolyPolygon );
2585 return (XLineEndItem*)this;
2589 //------------------------------------------------------------------------
2591 SfxItemPresentation XLineEndItem::GetPresentation
2593 SfxItemPresentation ePres,
2594 SfxMapUnit /*eCoreUnit*/,
2595 SfxMapUnit /*ePresUnit*/,
2596 XubString& rText, const IntlWrapper *
2597 ) const
2599 switch ( ePres )
2601 case SFX_ITEM_PRESENTATION_NONE:
2602 rText.Erase();
2603 return ePres;
2604 case SFX_ITEM_PRESENTATION_NAMELESS:
2605 case SFX_ITEM_PRESENTATION_COMPLETE:
2606 rText = GetName();
2607 return ePres;
2608 default:
2609 return SFX_ITEM_PRESENTATION_NONE;
2613 sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
2615 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2616 nMemberId &= ~CONVERT_TWIPS;
2617 if( nMemberId == MID_NAME )
2619 rtl::OUString aApiName;
2620 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
2621 rVal <<= aApiName;
2623 else
2625 com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
2626 SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
2627 rVal <<= aBezier;
2629 return sal_True;
2632 sal_Bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
2634 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2635 nMemberId &= ~CONVERT_TWIPS;
2636 if( nMemberId == MID_NAME )
2638 return sal_False;
2640 else
2642 maPolyPolygon.clear();
2644 if( rVal.hasValue() && rVal.getValue() )
2646 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
2647 return sal_False;
2649 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
2650 if( pCoords->Coordinates.getLength() > 0 )
2652 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
2653 // #i72807# close line start/end polygons hard
2654 // maPolyPolygon.setClosed(true);
2659 return sal_True;
2662 // ----------------------------
2663 // class XLineStartWidthItem
2664 // ----------------------------
2665 TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
2667 /*************************************************************************
2669 |* XLineStartWidthItem::XLineStartWidthItem(INT32 nWidth)
2671 |* Beschreibung
2672 |* Ersterstellung 15.11.94
2673 |* Letzte Aenderung 18.11.94
2675 *************************************************************************/
2677 XLineStartWidthItem::XLineStartWidthItem(long nWidth) :
2678 SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth)
2682 /*************************************************************************
2684 |* XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn)
2686 |* Beschreibung
2687 |* Ersterstellung 15.11.94
2688 |* Letzte Aenderung 15.11.94
2690 *************************************************************************/
2692 XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) :
2693 SfxMetricItem(XATTR_LINESTARTWIDTH, rIn)
2697 /*************************************************************************
2699 |* XLineStartWidthItem::Clone(SfxItemPool* pPool) const
2701 |* Beschreibung
2702 |* Ersterstellung 15.11.94
2703 |* Letzte Aenderung 15.11.94
2705 *************************************************************************/
2707 SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const
2709 return new XLineStartWidthItem(*this);
2712 /*************************************************************************
2714 |* SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, USHORT nVer)
2715 |* const
2717 |* Beschreibung
2718 |* Ersterstellung 15.11.94
2719 |* Letzte Aenderung 15.11.94
2721 *************************************************************************/
2723 SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, USHORT /*nVer*/) const
2725 return new XLineStartWidthItem(rIn);
2728 //------------------------------------------------------------------------
2730 SfxItemPresentation XLineStartWidthItem::GetPresentation
2732 SfxItemPresentation ePres,
2733 SfxMapUnit eCoreUnit,
2734 SfxMapUnit ePresUnit,
2735 XubString& rText, const IntlWrapper * pIntl
2736 ) const
2738 switch ( ePres )
2740 case SFX_ITEM_PRESENTATION_NONE:
2741 rText.Erase();
2742 return ePres;
2743 case SFX_ITEM_PRESENTATION_NAMELESS:
2744 case SFX_ITEM_PRESENTATION_COMPLETE:
2745 rText = GetMetricText( (long) GetValue(),
2746 eCoreUnit, ePresUnit, pIntl);
2747 rText += SVX_RESSTR( GetMetricId( ePresUnit) );
2748 return ePres;
2749 default:
2750 return SFX_ITEM_PRESENTATION_NONE;
2754 sal_Bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
2756 rVal <<= (sal_Int32)GetValue();
2757 return sal_True;
2760 sal_Bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
2762 sal_Int32 nValue = 0;
2763 rVal >>= nValue;
2764 SetValue( nValue );
2765 return sal_True;
2770 // --------------------------
2771 // class XLineEndWidthItem
2772 // --------------------------
2773 TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem);
2775 /*************************************************************************
2777 |* XLineEndWidthItem::XLineEndWidthItem(long nWidth)
2779 |* Beschreibung
2780 |* Ersterstellung 15.11.94
2781 |* Letzte Aenderung 15.11.94
2783 *************************************************************************/
2785 XLineEndWidthItem::XLineEndWidthItem(long nWidth) :
2786 SfxMetricItem(XATTR_LINEENDWIDTH, nWidth)
2790 /*************************************************************************
2792 |* XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn)
2794 |* Beschreibung
2795 |* Ersterstellung 15.11.94
2796 |* Letzte Aenderung 15.11.94
2798 *************************************************************************/
2800 XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) :
2801 SfxMetricItem(XATTR_LINEENDWIDTH, rIn)
2805 /*************************************************************************
2807 |* XLineEndWidthItem::Clone(SfxItemPool* pPool) const
2809 |* Beschreibung
2810 |* Ersterstellung 15.11.94
2811 |* Letzte Aenderung 15.11.94
2813 *************************************************************************/
2815 SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const
2817 return new XLineEndWidthItem(*this);
2820 /*************************************************************************
2822 |* SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, USHORT nVer) const
2824 |* Beschreibung
2825 |* Ersterstellung 15.11.94
2826 |* Letzte Aenderung 15.11.94
2828 *************************************************************************/
2830 SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, USHORT /*nVer*/) const
2832 return new XLineEndWidthItem(rIn);
2835 //------------------------------------------------------------------------
2837 SfxItemPresentation XLineEndWidthItem::GetPresentation
2839 SfxItemPresentation ePres,
2840 SfxMapUnit eCoreUnit,
2841 SfxMapUnit ePresUnit,
2842 XubString& rText, const IntlWrapper *pIntl
2843 ) const
2845 switch ( ePres )
2847 case SFX_ITEM_PRESENTATION_NONE:
2848 rText.Erase();
2849 return ePres;
2850 case SFX_ITEM_PRESENTATION_NAMELESS:
2851 case SFX_ITEM_PRESENTATION_COMPLETE:
2852 rText = GetMetricText( (long) GetValue(),
2853 eCoreUnit, ePresUnit, pIntl);
2854 rText += SVX_RESSTR( GetMetricId( ePresUnit) );
2855 return ePres;
2856 default:
2857 return SFX_ITEM_PRESENTATION_NONE;
2861 sal_Bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
2863 rVal <<= (sal_Int32)GetValue();
2864 return sal_True;
2867 sal_Bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
2869 sal_Int32 nValue = 0;
2870 rVal >>= nValue;
2871 SetValue( nValue );
2872 return sal_True;
2876 // -----------------------------
2877 // class XLineStartCenterItem
2878 // -----------------------------
2879 TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem);
2881 /*************************************************************************
2883 |* XLineStartCenterItem::XLineStartCenterItem(BOOL bStartCenter)
2885 |* Beschreibung
2886 |* Ersterstellung 15.11.94
2887 |* Letzte Aenderung 15.11.94
2889 *************************************************************************/
2891 XLineStartCenterItem::XLineStartCenterItem(BOOL bStartCenter) :
2892 SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
2896 /*************************************************************************
2898 |* XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn)
2900 |* Beschreibung
2901 |* Ersterstellung 15.11.94
2902 |* Letzte Aenderung 15.11.94
2904 *************************************************************************/
2906 XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) :
2907 SfxBoolItem(XATTR_LINESTARTCENTER, rIn)
2911 /*************************************************************************
2913 |* XLineStartCenterItem::Clone(SfxItemPool* pPool) const
2915 |* Beschreibung
2916 |* Ersterstellung 15.11.94
2917 |* Letzte Aenderung 15.11.94
2919 *************************************************************************/
2921 SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const
2923 return new XLineStartCenterItem(*this);
2926 /*************************************************************************
2928 |* SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, USHORT nVer)
2929 |* const
2931 |* Beschreibung
2932 |* Ersterstellung 15.11.94
2933 |* Letzte Aenderung 15.11.94
2935 *************************************************************************/
2937 SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, USHORT /*nVer*/) const
2939 return new XLineStartCenterItem(rIn);
2942 //------------------------------------------------------------------------
2944 SfxItemPresentation XLineStartCenterItem::GetPresentation
2946 SfxItemPresentation ePres,
2947 SfxMapUnit /*eCoreUnit*/,
2948 SfxMapUnit /*ePresUnit*/,
2949 XubString& rText, const IntlWrapper *
2950 ) const
2952 switch ( ePres )
2954 case SFX_ITEM_PRESENTATION_NONE:
2955 rText.Erase();
2956 return ePres;
2957 case SFX_ITEM_PRESENTATION_NAMELESS:
2958 case SFX_ITEM_PRESENTATION_COMPLETE:
2959 rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
2960 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
2961 return ePres;
2962 default:
2963 return SFX_ITEM_PRESENTATION_NONE;
2967 sal_Bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
2969 sal_Bool bValue = GetValue();
2970 rVal.setValue( &bValue, ::getCppuBooleanType() );
2971 return sal_True;
2974 sal_Bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
2976 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
2977 return sal_False;
2979 SetValue( *(sal_Bool*)rVal.getValue() );
2980 return sal_True;
2984 // ---------------------------
2985 // class XLineEndCenterItem
2986 // ---------------------------
2987 TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem);
2989 /*************************************************************************
2991 |* XLineEndCenterItem::XLineEndCenterItem(BOOL bEndCenter)
2993 |* Beschreibung
2994 |* Ersterstellung 15.11.94
2995 |* Letzte Aenderung 15.11.94
2997 *************************************************************************/
2999 XLineEndCenterItem::XLineEndCenterItem(BOOL bEndCenter) :
3000 SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
3004 /*************************************************************************
3006 |* XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn)
3008 |* Beschreibung
3009 |* Ersterstellung 15.11.94
3010 |* Letzte Aenderung 15.11.94
3012 *************************************************************************/
3014 XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) :
3015 SfxBoolItem(XATTR_LINEENDCENTER, rIn)
3019 /*************************************************************************
3021 |* XLineEndCenterItem::Clone(SfxItemPool* pPool) const
3023 |* Beschreibung
3024 |* Ersterstellung 15.11.94
3025 |* Letzte Aenderung 15.11.94
3027 *************************************************************************/
3029 SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const
3031 return new XLineEndCenterItem(*this);
3034 /*************************************************************************
3036 |* SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, USHORT nVer)
3037 |* const
3039 |* Beschreibung
3040 |* Ersterstellung 15.11.94
3041 |* Letzte Aenderung 15.11.94
3043 *************************************************************************/
3045 SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, USHORT /*nVer*/) const
3047 return new XLineEndCenterItem(rIn);
3050 //------------------------------------------------------------------------
3052 SfxItemPresentation XLineEndCenterItem::GetPresentation
3054 SfxItemPresentation ePres,
3055 SfxMapUnit /*eCoreUnit*/,
3056 SfxMapUnit /*ePresUnit*/,
3057 XubString& rText, const IntlWrapper *
3058 ) const
3060 switch ( ePres )
3062 case SFX_ITEM_PRESENTATION_NONE:
3063 rText.Erase();
3064 return ePres;
3065 case SFX_ITEM_PRESENTATION_NAMELESS:
3066 case SFX_ITEM_PRESENTATION_COMPLETE:
3067 rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
3068 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
3069 return ePres;
3070 default:
3071 return SFX_ITEM_PRESENTATION_NONE;
3075 sal_Bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
3077 sal_Bool bValue = GetValue();
3078 rVal.setValue( &bValue, ::getCppuBooleanType() );
3079 return sal_True;
3082 BOOL XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
3084 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
3085 return sal_False;
3087 SetValue( *(sal_Bool*)rVal.getValue() );
3088 return sal_True;
3092 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3093 // Fuellattribute
3094 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3096 // --------------------
3097 // class XFillStyleItem
3098 // --------------------
3099 TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem);
3101 /*************************************************************************
3103 |* XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle)
3105 |* Beschreibung
3106 |* Ersterstellung 15.11.94
3107 |* Letzte Aenderung 15.11.94
3109 *************************************************************************/
3111 XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) :
3112 SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< USHORT >(eFillStyle))
3116 /*************************************************************************
3118 |* XFillStyleItem::XFillStyleItem(SvStream& rIn)
3120 |* Beschreibung
3121 |* Ersterstellung 15.11.94
3122 |* Letzte Aenderung 15.11.94
3124 *************************************************************************/
3126 XFillStyleItem::XFillStyleItem(SvStream& rIn) :
3127 SfxEnumItem(XATTR_FILLSTYLE, rIn)
3131 /*************************************************************************
3133 |* XFillStyleItem::Clone(SfxItemPool* pPool) const
3135 |* Beschreibung
3136 |* Ersterstellung 09.11.94
3137 |* Letzte Aenderung 09.11.94
3139 *************************************************************************/
3141 SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const
3143 return new XFillStyleItem( *this );
3146 /*************************************************************************
3148 |* SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, USHORT nVer) const
3150 |* Beschreibung
3151 |* Ersterstellung 15.11.94
3152 |* Letzte Aenderung 15.11.94
3154 *************************************************************************/
3156 SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, USHORT /*nVer*/) const
3158 return new XFillStyleItem(rIn);
3161 //------------------------------------------------------------------------
3163 SfxItemPresentation XFillStyleItem::GetPresentation
3165 SfxItemPresentation ePres,
3166 SfxMapUnit /*eCoreUnit*/,
3167 SfxMapUnit /*ePresUnit*/,
3168 XubString& rText, const IntlWrapper *
3169 ) const
3171 rText.Erase();
3173 switch ( ePres )
3175 case SFX_ITEM_PRESENTATION_NONE:
3176 return ePres;
3178 case SFX_ITEM_PRESENTATION_NAMELESS:
3179 case SFX_ITEM_PRESENTATION_COMPLETE:
3181 USHORT nId = 0;
3183 switch( (USHORT)GetValue() )
3185 case XFILL_NONE:
3186 nId = RID_SVXSTR_INVISIBLE;
3187 break;
3188 case XFILL_SOLID:
3189 nId = RID_SVXSTR_SOLID;
3190 break;
3191 case XFILL_GRADIENT:
3192 nId = RID_SVXSTR_GRADIENT;
3193 break;
3194 case XFILL_HATCH:
3195 nId = RID_SVXSTR_HATCH;
3196 break;
3197 case XFILL_BITMAP:
3198 nId = RID_SVXSTR_BITMAP;
3199 break;
3202 if ( nId )
3203 rText = SVX_RESSTR( nId );
3204 return ePres;
3206 default:
3207 return SFX_ITEM_PRESENTATION_NONE;
3211 //------------------------------------------------------------------------
3213 USHORT XFillStyleItem::GetValueCount() const
3215 return 5;
3218 // -----------------------------------------------------------------------
3219 sal_Bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
3221 ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue();
3223 rVal <<= eFS;
3225 return sal_True;
3228 // -----------------------------------------------------------------------
3229 sal_Bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
3231 ::com::sun::star::drawing::FillStyle eFS;
3232 if(!(rVal >>= eFS))
3234 // also try an int (for Basic)
3235 sal_Int32 nFS = 0;
3236 if(!(rVal >>= nFS))
3237 return sal_False;
3238 eFS = (::com::sun::star::drawing::FillStyle)nFS;
3241 SetValue( sal::static_int_cast< USHORT >( eFS ) );
3243 return sal_True;
3247 // -------------------
3248 // class XFillColorItem
3249 // -------------------
3250 TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
3252 /*************************************************************************
3254 |* XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor)
3256 |* Beschreibung
3257 |* Ersterstellung 15.11.94
3258 |* Letzte Aenderung 15.11.94
3260 *************************************************************************/
3262 XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor) :
3263 XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
3267 /*************************************************************************
3269 |* XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor)
3271 |* Beschreibung
3272 |* Ersterstellung 15.11.94
3273 |* Letzte Aenderung 15.11.94
3275 *************************************************************************/
3277 XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) :
3278 XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
3282 /*************************************************************************
3284 |* XFillColorItem::XFillColorItem(SvStream& rIn)
3286 |* Beschreibung
3287 |* Ersterstellung 15.11.94
3288 |* Letzte Aenderung 15.11.94
3290 *************************************************************************/
3292 XFillColorItem::XFillColorItem(SvStream& rIn) :
3293 XColorItem(XATTR_FILLCOLOR, rIn)
3297 /*************************************************************************
3299 |* XFillColorItem::Clone(SfxItemPool* pPool) const
3301 |* Beschreibung
3302 |* Ersterstellung 15.11.94
3303 |* Letzte Aenderung 15.11.94
3305 *************************************************************************/
3307 SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3309 return new XFillColorItem(*this);
3312 /*************************************************************************
3314 |* SfxPoolItem* XFillColorItem::Create(SvStream& rIn, USHORT nVer) const
3316 |* Beschreibung
3317 |* Ersterstellung 15.11.94
3318 |* Letzte Aenderung 15.11.94
3320 *************************************************************************/
3322 SfxPoolItem* XFillColorItem::Create(SvStream& rIn, USHORT /*nVer*/) const
3324 return new XFillColorItem(rIn);
3327 //------------------------------------------------------------------------
3329 SfxItemPresentation XFillColorItem::GetPresentation
3331 SfxItemPresentation ePres,
3332 SfxMapUnit /*eCoreUnit*/,
3333 SfxMapUnit /*ePresUnit*/,
3334 XubString& rText, const IntlWrapper *
3335 ) const
3337 switch ( ePres )
3339 case SFX_ITEM_PRESENTATION_NONE:
3340 rText.Erase();
3341 return ePres;
3342 case SFX_ITEM_PRESENTATION_NAMELESS:
3343 case SFX_ITEM_PRESENTATION_COMPLETE:
3344 rText = GetName();
3345 return ePres;
3346 default:
3347 return SFX_ITEM_PRESENTATION_NONE;
3351 // -----------------------------------------------------------------------
3353 sal_Bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/) const
3355 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
3357 return sal_True;
3360 // -----------------------------------------------------------------------
3362 sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/)
3364 sal_Int32 nValue = 0;
3365 if(!(rVal >>= nValue ))
3366 return sal_False;
3368 SetColorValue( nValue );
3369 return sal_True;
3372 // -----------------------------
3373 // class XSecondaryFillColorItem
3374 // -----------------------------
3375 TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
3377 XSecondaryFillColorItem::XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor) :
3378 XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor)
3382 XSecondaryFillColorItem::XSecondaryFillColorItem(const XubString& rName, const Color& rTheColor) :
3383 XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
3387 XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) :
3388 XColorItem(XATTR_SECONDARYFILLCOLOR, rIn)
3392 SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3394 return new XSecondaryFillColorItem(*this);
3397 SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, USHORT nVer ) const
3399 if ( nVer >= 2 )
3400 return new XSecondaryFillColorItem( rIn );
3401 else
3402 return new XSecondaryFillColorItem( String(), Color(0,184,255) );
3404 USHORT XSecondaryFillColorItem::GetVersion( USHORT /*nFileFormatVersion*/ ) const
3406 return 2;
3408 SfxItemPresentation XSecondaryFillColorItem::GetPresentation
3410 SfxItemPresentation ePres,
3411 SfxMapUnit /*eCoreUnit*/,
3412 SfxMapUnit /*ePresUnit*/,
3413 XubString& rText, const IntlWrapper *
3414 ) const
3416 switch ( ePres )
3418 case SFX_ITEM_PRESENTATION_NONE:
3419 rText.Erase();
3420 return ePres;
3421 case SFX_ITEM_PRESENTATION_NAMELESS:
3422 case SFX_ITEM_PRESENTATION_COMPLETE:
3423 rText = GetName();
3424 return ePres;
3425 default:
3426 return SFX_ITEM_PRESENTATION_NONE;
3430 // ----------------
3431 // class XGradient
3432 // ----------------
3434 /*************************************************************************
3436 |* XGradient::XGradient()
3438 *************************************************************************/
3440 XGradient::XGradient() :
3441 eStyle( XGRAD_LINEAR ),
3442 aStartColor( Color( COL_BLACK ) ),
3443 aEndColor( Color( COL_WHITE ) ),
3444 nAngle( 0 ),
3445 nBorder( 0 ),
3446 nOfsX( 50 ),
3447 nOfsY( 50 ),
3448 nIntensStart( 100 ),
3449 nIntensEnd( 100 ),
3450 nStepCount( 0 )
3454 /*************************************************************************
3456 |* XGradient::XGradient(XGradientStyle, const Color&, const Color&,
3457 |* long, USHORT, USHORT, USHORT)
3459 |* Beschreibung
3460 |* Ersterstellung 21.11.94
3461 |* Letzte Aenderung 21.11.94
3463 *************************************************************************/
3465 XGradient::XGradient(const Color& rStart, const Color& rEnd,
3466 XGradientStyle eTheStyle, long nTheAngle, USHORT nXOfs,
3467 USHORT nYOfs, USHORT nTheBorder,
3468 USHORT nStartIntens, USHORT nEndIntens,
3469 USHORT nSteps) :
3470 eStyle(eTheStyle),
3471 aStartColor(rStart),
3472 aEndColor(rEnd),
3473 nAngle(nTheAngle),
3474 nBorder(nTheBorder),
3475 nOfsX(nXOfs),
3476 nOfsY(nYOfs),
3477 nIntensStart(nStartIntens),
3478 nIntensEnd(nEndIntens),
3479 nStepCount(nSteps)
3483 /*************************************************************************
3485 |* int XGradient::operator==(const SfxPoolItem& rItem) const
3487 |* Beschreibung
3488 |* Ersterstellung 29.11.94
3489 |* Letzte Aenderung 29.11.94
3491 *************************************************************************/
3493 bool XGradient::operator==(const XGradient& rGradient) const
3495 return ( eStyle == rGradient.eStyle &&
3496 aStartColor == rGradient.aStartColor &&
3497 aEndColor == rGradient.aEndColor &&
3498 nAngle == rGradient.nAngle &&
3499 nBorder == rGradient.nBorder &&
3500 nOfsX == rGradient.nOfsX &&
3501 nOfsY == rGradient.nOfsY &&
3502 nIntensStart == rGradient.nIntensStart &&
3503 nIntensEnd == rGradient.nIntensEnd &&
3504 nStepCount == rGradient.nStepCount );
3508 // -----------------------
3509 // class XFillGradientItem
3510 // -----------------------
3511 TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
3513 /*************************************************************************
3515 |* XFillGradientItem::XFillGradientItem(INT32 nIndex,
3516 |* const XGradient& rTheGradient)
3518 |* Beschreibung
3519 |* Ersterstellung 15.11.94
3520 |* Letzte Aenderung 15.11.94
3522 *************************************************************************/
3524 XFillGradientItem::XFillGradientItem(INT32 nIndex,
3525 const XGradient& rTheGradient) :
3526 NameOrIndex(XATTR_FILLGRADIENT, nIndex),
3527 aGradient(rTheGradient)
3531 /*************************************************************************
3533 |* XFillGradientItem::XFillGradientItem(const XubString& rName,
3534 |* const XGradient& rTheGradient)
3536 |* Beschreibung
3537 |* Ersterstellung 15.11.94
3538 |* Letzte Aenderung 15.11.94
3540 *************************************************************************/
3542 XFillGradientItem::XFillGradientItem(const XubString& rName,
3543 const XGradient& rTheGradient) :
3544 NameOrIndex(XATTR_FILLGRADIENT, rName),
3545 aGradient(rTheGradient)
3549 /*************************************************************************
3551 |* XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem)
3553 |* Beschreibung
3554 |* Ersterstellung 15.11.94
3555 |* Letzte Aenderung 15.11.94
3557 *************************************************************************/
3559 XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) :
3560 NameOrIndex(rItem),
3561 aGradient(rItem.aGradient)
3565 /*************************************************************************
3567 |* XFillGradientItem::XFillGradientItem(SvStream& rIn)
3569 |* Beschreibung
3570 |* Ersterstellung 15.11.94
3571 |* Letzte Aenderung 15.11.94
3573 *************************************************************************/
3575 XFillGradientItem::XFillGradientItem(SvStream& rIn, USHORT nVer) :
3576 NameOrIndex(XATTR_FILLGRADIENT, rIn),
3577 aGradient(COL_BLACK, COL_WHITE)
3579 if (!IsIndex())
3581 USHORT nUSTemp;
3582 USHORT nRed;
3583 USHORT nGreen;
3584 USHORT nBlue;
3585 INT16 nITemp;
3586 INT32 nLTemp;
3588 rIn >> nITemp; aGradient.SetGradientStyle((XGradientStyle)nITemp);
3589 rIn >> nRed;
3590 rIn >> nGreen;
3591 rIn >> nBlue;
3592 Color aCol;
3593 aCol = Color( (BYTE)( nRed >> 8 ), (BYTE)( nGreen >> 8 ), (BYTE)( nBlue >> 8 ) );
3594 aGradient.SetStartColor( aCol );
3596 rIn >> nRed;
3597 rIn >> nGreen;
3598 rIn >> nBlue;
3599 aCol = Color( (BYTE)( nRed >> 8 ), (BYTE)( nGreen >> 8 ), (BYTE)( nBlue >> 8 ) );
3600 aGradient.SetEndColor(aCol);
3601 rIn >> nLTemp; aGradient.SetAngle(nLTemp);
3602 rIn >> nUSTemp; aGradient.SetBorder(nUSTemp);
3603 rIn >> nUSTemp; aGradient.SetXOffset(nUSTemp);
3604 rIn >> nUSTemp; aGradient.SetYOffset(nUSTemp);
3605 rIn >> nUSTemp; aGradient.SetStartIntens(nUSTemp);
3606 rIn >> nUSTemp; aGradient.SetEndIntens(nUSTemp);
3608 // bei neueren Versionen wird zusaetzlich
3609 // die Schrittweite mit eingelesen
3610 if (nVer >= 1)
3612 rIn >> nUSTemp; aGradient.SetSteps(nUSTemp);
3617 //*************************************************************************
3619 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient)
3620 : NameOrIndex( XATTR_FILLGRADIENT, -1 ),
3621 aGradient(rTheGradient)
3625 //*************************************************************************
3627 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/)
3628 : NameOrIndex(XATTR_FILLGRADIENT, -1 )
3632 /*************************************************************************
3634 |* XFillGradientItem::Clone(SfxItemPool* pPool) const
3636 |* Beschreibung
3637 |* Ersterstellung 15.11.94
3638 |* Letzte Aenderung 15.11.94
3640 *************************************************************************/
3642 SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const
3644 return new XFillGradientItem(*this);
3647 /*************************************************************************
3649 |* int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3651 |* Beschreibung
3652 |* Ersterstellung 15.11.94
3653 |* Letzte Aenderung 15.11.94
3655 *************************************************************************/
3657 int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3659 return ( NameOrIndex::operator==(rItem) &&
3660 aGradient == ((const XFillGradientItem&) rItem).aGradient );
3663 /*************************************************************************
3665 |* SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, USHORT nVer) const
3667 |* Beschreibung
3668 |* Ersterstellung 15.11.94
3669 |* Letzte Aenderung 15.11.94
3671 *************************************************************************/
3673 SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, USHORT nVer) const
3675 return new XFillGradientItem(rIn, nVer);
3678 /*************************************************************************
3680 |* SfxPoolItem* XFillGradientItem::Store(SvStream& rOut) const
3682 |* Beschreibung
3683 |* Ersterstellung 15.11.94
3684 |* Letzte Aenderung 15.11.94
3686 *************************************************************************/
3688 SvStream& XFillGradientItem::Store( SvStream& rOut, USHORT nItemVersion ) const
3690 NameOrIndex::Store( rOut, nItemVersion );
3692 if (!IsIndex())
3694 rOut << (INT16)aGradient.GetGradientStyle();
3696 USHORT nTmp;
3698 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut << nTmp;
3699 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut << nTmp;
3700 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut << nTmp;
3701 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut << nTmp;
3702 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut << nTmp;
3703 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut << nTmp;
3705 rOut << (INT32) aGradient.GetAngle();
3706 rOut << aGradient.GetBorder();
3707 rOut << aGradient.GetXOffset();
3708 rOut << aGradient.GetYOffset();
3709 rOut << aGradient.GetStartIntens();
3710 rOut << aGradient.GetEndIntens();
3711 rOut << aGradient.GetSteps();
3714 return rOut;
3717 /*************************************************************************
3719 |* const XGradient& XFillGradientItem::GetValue(const XGradientTable* pTable)
3720 |* const
3722 |* Beschreibung
3723 |* Ersterstellung 15.11.94
3724 |* Letzte Aenderung 18.11.94
3726 *************************************************************************/
3728 const XGradient& XFillGradientItem::GetGradientValue(const XGradientTable* pTable) const // GetValue -> GetGradientValue
3730 if (!IsIndex())
3731 return aGradient;
3732 else
3733 return pTable->GetGradient(GetIndex())->GetGradient();
3737 /*************************************************************************
3739 |* USHORT XFillGradientItem::GetVersion() const
3741 |* Beschreibung
3742 |* Ersterstellung 01.11.95
3743 |* Letzte Aenderung 01.11.95
3745 *************************************************************************/
3747 USHORT XFillGradientItem::GetVersion( USHORT /*nFileFormatVersion*/) const
3749 // !!! this version number also represents the version number of superclasses
3750 // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here,
3751 // !!! the superclass is also affected
3752 return 1;
3755 //------------------------------------------------------------------------
3757 SfxItemPresentation XFillGradientItem::GetPresentation
3759 SfxItemPresentation ePres,
3760 SfxMapUnit /*eCoreUnit*/,
3761 SfxMapUnit /*ePresUnit*/,
3762 XubString& rText, const IntlWrapper *
3763 ) const
3765 switch ( ePres )
3767 case SFX_ITEM_PRESENTATION_NONE:
3768 rText.Erase();
3769 return ePres;
3770 case SFX_ITEM_PRESENTATION_NAMELESS:
3771 case SFX_ITEM_PRESENTATION_COMPLETE:
3772 rText = GetName();
3773 return ePres;
3774 default:
3775 return SFX_ITEM_PRESENTATION_NONE;
3779 // -----------------------------------------------------------------------
3780 sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
3782 //sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3783 nMemberId &= ~CONVERT_TWIPS;
3784 switch ( nMemberId )
3786 case 0:
3788 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
3790 ::com::sun::star::awt::Gradient aGradient2;
3792 const XGradient& aXGradient = GetGradientValue();
3793 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3794 aGradient2.StartColor = (INT32)aXGradient.GetStartColor().GetColor();
3795 aGradient2.EndColor = (INT32)aXGradient.GetEndColor().GetColor();
3796 aGradient2.Angle = (short)aXGradient.GetAngle();
3797 aGradient2.Border = aXGradient.GetBorder();
3798 aGradient2.XOffset = aXGradient.GetXOffset();
3799 aGradient2.YOffset = aXGradient.GetYOffset();
3800 aGradient2.StartIntensity = aXGradient.GetStartIntens();
3801 aGradient2.EndIntensity = aXGradient.GetEndIntens();
3802 aGradient2.StepCount = aXGradient.GetSteps();
3804 rtl::OUString aApiName;
3805 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
3806 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
3807 aPropSeq[0].Value = uno::makeAny( aApiName );
3808 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ));
3809 aPropSeq[1].Value = uno::makeAny( aGradient2 );
3810 rVal = uno::makeAny( aPropSeq );
3811 break;
3814 case MID_FILLGRADIENT:
3816 const XGradient& aXGradient = GetGradientValue();
3817 ::com::sun::star::awt::Gradient aGradient2;
3819 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3820 aGradient2.StartColor = (INT32)aXGradient.GetStartColor().GetColor();
3821 aGradient2.EndColor = (INT32)aXGradient.GetEndColor().GetColor();
3822 aGradient2.Angle = (short)aXGradient.GetAngle();
3823 aGradient2.Border = aXGradient.GetBorder();
3824 aGradient2.XOffset = aXGradient.GetXOffset();
3825 aGradient2.YOffset = aXGradient.GetYOffset();
3826 aGradient2.StartIntensity = aXGradient.GetStartIntens();
3827 aGradient2.EndIntensity = aXGradient.GetEndIntens();
3828 aGradient2.StepCount = aXGradient.GetSteps();
3830 rVal <<= aGradient2;
3831 break;
3834 case MID_NAME:
3836 rtl::OUString aApiName;
3837 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
3838 rVal <<= aApiName;
3839 break;
3842 case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break;
3843 case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break;
3844 case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break;
3845 case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break;
3846 case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
3847 case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
3848 case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
3849 case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break;
3850 case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
3851 case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
3853 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
3856 return sal_True;
3859 // -----------------------------------------------------------------------
3860 sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
3862 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3863 nMemberId &= ~CONVERT_TWIPS;
3865 switch ( nMemberId )
3867 case 0:
3869 uno::Sequence< beans::PropertyValue > aPropSeq;
3870 ::com::sun::star::awt::Gradient aGradient2;
3871 rtl::OUString aName;
3872 bool bGradient( false );
3874 if ( rVal >>= aPropSeq )
3876 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
3878 if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
3879 aPropSeq[n].Value >>= aName;
3880 else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillGradient" )))
3882 if ( aPropSeq[n].Value >>= aGradient2 )
3883 bGradient = true;
3887 SetName( aName );
3888 if ( bGradient )
3890 XGradient aXGradient;
3892 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3893 aXGradient.SetStartColor( aGradient2.StartColor );
3894 aXGradient.SetEndColor( aGradient2.EndColor );
3895 aXGradient.SetAngle( aGradient2.Angle );
3896 aXGradient.SetBorder( aGradient2.Border );
3897 aXGradient.SetXOffset( aGradient2.XOffset );
3898 aXGradient.SetYOffset( aGradient2.YOffset );
3899 aXGradient.SetStartIntens( aGradient2.StartIntensity );
3900 aXGradient.SetEndIntens( aGradient2.EndIntensity );
3901 aXGradient.SetSteps( aGradient2.StepCount );
3903 SetGradientValue( aXGradient );
3906 return sal_True;
3909 return sal_False;
3912 case MID_NAME:
3914 rtl::OUString aName;
3915 if (!(rVal >>= aName ))
3916 return sal_False;
3917 SetName( aName );
3918 break;
3921 case MID_FILLGRADIENT:
3923 ::com::sun::star::awt::Gradient aGradient2;
3924 if(!(rVal >>= aGradient2))
3925 return sal_False;
3927 XGradient aXGradient;
3929 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3930 aXGradient.SetStartColor( aGradient2.StartColor );
3931 aXGradient.SetEndColor( aGradient2.EndColor );
3932 aXGradient.SetAngle( aGradient2.Angle );
3933 aXGradient.SetBorder( aGradient2.Border );
3934 aXGradient.SetXOffset( aGradient2.XOffset );
3935 aXGradient.SetYOffset( aGradient2.YOffset );
3936 aXGradient.SetStartIntens( aGradient2.StartIntensity );
3937 aXGradient.SetEndIntens( aGradient2.EndIntensity );
3938 aXGradient.SetSteps( aGradient2.StepCount );
3940 SetGradientValue( aXGradient );
3941 break;
3944 case MID_GRADIENT_STARTCOLOR:
3945 case MID_GRADIENT_ENDCOLOR:
3947 sal_Int32 nVal = 0;
3948 if(!(rVal >>= nVal ))
3949 return sal_False;
3951 XGradient aXGradient = GetGradientValue();
3953 if ( nMemberId == MID_GRADIENT_STARTCOLOR )
3954 aXGradient.SetStartColor( nVal );
3955 else
3956 aXGradient.SetEndColor( nVal );
3957 SetGradientValue( aXGradient );
3958 break;
3961 case MID_GRADIENT_STYLE:
3962 case MID_GRADIENT_ANGLE:
3963 case MID_GRADIENT_BORDER:
3964 case MID_GRADIENT_STARTINTENSITY:
3965 case MID_GRADIENT_ENDINTENSITY:
3966 case MID_GRADIENT_STEPCOUNT:
3967 case MID_GRADIENT_XOFFSET:
3968 case MID_GRADIENT_YOFFSET:
3970 sal_Int16 nVal = sal_Int16();
3971 if(!(rVal >>= nVal ))
3972 return sal_False;
3974 XGradient aXGradient = GetGradientValue();
3976 switch ( nMemberId )
3978 case MID_GRADIENT_STYLE:
3979 aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break;
3980 case MID_GRADIENT_ANGLE:
3981 aXGradient.SetAngle( nVal ); break;
3982 case MID_GRADIENT_BORDER:
3983 aXGradient.SetBorder( nVal ); break;
3984 case MID_GRADIENT_STARTINTENSITY:
3985 aXGradient.SetStartIntens( nVal ); break;
3986 case MID_GRADIENT_ENDINTENSITY:
3987 aXGradient.SetEndIntens( nVal ); break;
3988 case MID_GRADIENT_STEPCOUNT:
3989 aXGradient.SetSteps( nVal ); break;
3990 case MID_GRADIENT_XOFFSET:
3991 aXGradient.SetXOffset( nVal ); break;
3992 case MID_GRADIENT_YOFFSET:
3993 aXGradient.SetYOffset( nVal ); break;
3996 SetGradientValue( aXGradient );
3997 break;
4001 return sal_True;
4004 BOOL XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4006 return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue();
4009 XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
4011 if( pModel )
4013 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4014 XATTR_FILLGRADIENT,
4015 &pModel->GetItemPool(),
4016 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4017 XFillGradientItem::CompareValueFunc,
4018 RID_SVXSTR_GRADIENT,
4019 pModel->GetGradientList() );
4021 // if the given name is not valid, replace it!
4022 if( aUniqueName != GetName() )
4024 return new XFillGradientItem( aUniqueName, aGradient );
4028 return (XFillGradientItem*)this;
4031 // ----------------------------------
4032 // class XFillFloatTransparenceItem -
4033 // ----------------------------------
4035 TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem );
4037 // -----------------------------------------------------------------------------
4039 XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
4040 bEnabled( FALSE )
4042 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4045 //------------------------------------------------------------------------
4047 XFillFloatTransparenceItem::XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable ) :
4048 XFillGradientItem ( nIndex, rGradient ),
4049 bEnabled ( bEnable )
4051 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4054 //------------------------------------------------------------------------
4056 XFillFloatTransparenceItem::XFillFloatTransparenceItem(const XubString& rName, const XGradient& rGradient, BOOL bEnable ) :
4057 XFillGradientItem ( rName, rGradient ),
4058 bEnabled ( bEnable )
4060 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4063 //------------------------------------------------------------------------
4065 XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) :
4066 XFillGradientItem ( rItem ),
4067 bEnabled ( rItem.bEnabled )
4069 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4072 //------------------------------------------------------------------------
4074 //XFillFloatTransparenceItem::XFillFloatTransparenceItem( SvStream& rIn, USHORT nVer ) :
4075 // XFillGradientItem ( rIn, nVer )
4077 // SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4078 // rIn >> bEnabled;
4081 //*************************************************************************
4083 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, BOOL bEnable )
4084 : XFillGradientItem ( -1, rTheGradient ),
4085 bEnabled ( bEnable )
4087 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4090 //*************************************************************************
4092 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/)
4094 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4097 //------------------------------------------------------------------------
4099 int XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const
4101 return ( NameOrIndex::operator==(rItem) ) &&
4102 ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) &&
4103 ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled );
4106 //------------------------------------------------------------------------
4108 SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
4110 return new XFillFloatTransparenceItem( *this );
4113 //------------------------------------------------------------------------
4115 //SfxPoolItem* XFillFloatTransparenceItem::Create( SvStream& rIn, USHORT nVer ) const
4117 // return( ( 0 == nVer ) ? Clone( NULL ) : new XFillFloatTransparenceItem( rIn, nVer ) );
4120 //------------------------------------------------------------------------
4122 //SvStream& XFillFloatTransparenceItem::Store( SvStream& rOut, USHORT nItemVersion ) const
4124 // XFillGradientItem::Store( rOut, nItemVersion );
4125 // rOut << bEnabled;
4126 // return rOut;
4129 //------------------------------------------------------------------------
4131 USHORT XFillFloatTransparenceItem::GetVersion( USHORT nFileFormatVersion ) const
4133 // !!! if version number of this object must be increased, please !!!
4134 // !!! increase version number of base class XFillGradientItem !!!
4135 return XFillGradientItem::GetVersion( nFileFormatVersion );
4138 //------------------------------------------------------------------------
4140 sal_Bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
4142 return XFillGradientItem::QueryValue( rVal, nMemberId );
4145 //------------------------------------------------------------------------
4147 sal_Bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
4149 return XFillGradientItem::PutValue( rVal, nMemberId );
4152 //------------------------------------------------------------------------
4154 SfxItemPresentation XFillFloatTransparenceItem::GetPresentation( SfxItemPresentation ePres,
4155 SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit,
4156 XubString& rText,
4157 const IntlWrapper * pIntlWrapper ) const
4159 return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper );
4162 BOOL XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4164 return ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() &&
4165 ((XFillFloatTransparenceItem*)p1)->GetGradientValue() == ((XFillFloatTransparenceItem*)p2)->GetGradientValue();
4168 XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
4170 // #85953# unique name only necessary when enabled
4171 if(IsEnabled())
4173 if( pModel )
4175 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4176 XATTR_FILLFLOATTRANSPARENCE,
4177 &pModel->GetItemPool(),
4178 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4179 XFillFloatTransparenceItem::CompareValueFunc,
4180 RID_SVXSTR_TRASNGR0,
4181 NULL );
4183 // if the given name is not valid, replace it!
4184 if( aUniqueName != GetName() )
4186 return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), TRUE );
4190 else
4192 // #85953# if disabled, force name to empty string
4193 if(GetName().Len())
4195 return new XFillFloatTransparenceItem(String(), GetGradientValue(), FALSE);
4199 return (XFillFloatTransparenceItem*)this;
4202 // -------------
4203 // class XHatch
4204 // -------------
4206 /*************************************************************************
4208 |* XHatch::XHatch(XHatchStyle, const Color&, long, long)
4210 |* Beschreibung
4211 |* Ersterstellung 21.11.94
4212 |* Letzte Aenderung 21.11.94
4214 *************************************************************************/
4216 XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance,
4217 long nTheAngle) :
4218 eStyle(eTheStyle),
4219 aColor(rCol),
4220 nDistance(nTheDistance),
4221 nAngle(nTheAngle)
4225 /*************************************************************************
4227 |* int XHatch::operator==(const SfxPoolItem& rItem) const
4229 |* Beschreibung
4230 |* Ersterstellung 29.11.94
4231 |* Letzte Aenderung 29.11.94
4233 *************************************************************************/
4235 bool XHatch::operator==(const XHatch& rHatch) const
4237 return ( eStyle == rHatch.eStyle &&
4238 aColor == rHatch.aColor &&
4239 nDistance == rHatch.nDistance &&
4240 nAngle == rHatch.nAngle );
4244 // -----------------------
4245 // class XFillHatchItem
4246 // -----------------------
4247 TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
4249 /*************************************************************************
4251 |* XFillHatchItem::XFillHatchItem(INT32 nIndex,
4252 |* const XHatch& rTheHatch)
4254 |* Beschreibung
4255 |* Ersterstellung 15.11.94
4256 |* Letzte Aenderung 15.11.94
4258 *************************************************************************/
4260 XFillHatchItem::XFillHatchItem(INT32 nIndex,
4261 const XHatch& rTheHatch) :
4262 NameOrIndex(XATTR_FILLHATCH, nIndex),
4263 aHatch(rTheHatch)
4267 /*************************************************************************
4269 |* XFillHatchItem::XFillHatchItem(const XubString& rName,
4270 |* const XHatch& rTheHatch)
4272 |* Beschreibung
4273 |* Ersterstellung 15.11.94
4274 |* Letzte Aenderung 15.11.94
4276 *************************************************************************/
4278 XFillHatchItem::XFillHatchItem(const XubString& rName,
4279 const XHatch& rTheHatch) :
4280 NameOrIndex(XATTR_FILLHATCH, rName),
4281 aHatch(rTheHatch)
4285 /*************************************************************************
4287 |* XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem)
4289 |* Beschreibung
4290 |* Ersterstellung 15.11.94
4291 |* Letzte Aenderung 15.11.94
4293 *************************************************************************/
4295 XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) :
4296 NameOrIndex(rItem),
4297 aHatch(rItem.aHatch)
4301 /*************************************************************************
4303 |* XFillHatchItem::XFillHatchItem(SvStream& rIn)
4305 |* Beschreibung
4306 |* Ersterstellung 15.11.94
4307 |* Letzte Aenderung 15.11.94
4309 *************************************************************************/
4311 XFillHatchItem::XFillHatchItem(SvStream& rIn) :
4312 NameOrIndex(XATTR_FILLHATCH, rIn),
4313 aHatch(COL_BLACK)
4315 if (!IsIndex())
4317 USHORT nRed;
4318 USHORT nGreen;
4319 USHORT nBlue;
4320 INT16 nITemp;
4321 INT32 nLTemp;
4323 rIn >> nITemp; aHatch.SetHatchStyle((XHatchStyle)nITemp);
4324 rIn >> nRed;
4325 rIn >> nGreen;
4326 rIn >> nBlue;
4328 Color aCol;
4329 aCol = Color( (BYTE)( nRed >> 8 ), (BYTE)( nGreen >> 8 ), (BYTE)( nBlue >> 8 ) );
4330 aHatch.SetColor(aCol);
4331 rIn >> nLTemp; aHatch.SetDistance(nLTemp);
4332 rIn >> nLTemp; aHatch.SetAngle(nLTemp);
4336 //*************************************************************************
4338 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch)
4339 : NameOrIndex( XATTR_FILLHATCH, -1 ),
4340 aHatch(rTheHatch)
4344 //*************************************************************************
4346 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/)
4347 : NameOrIndex(XATTR_FILLHATCH, -1 )
4351 /*************************************************************************
4353 |* XFillHatchItem::Clone(SfxItemPool* pPool) const
4355 |* Beschreibung
4356 |* Ersterstellung 15.11.94
4357 |* Letzte Aenderung 15.11.94
4359 *************************************************************************/
4361 SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const
4363 return new XFillHatchItem(*this);
4366 /*************************************************************************
4368 |* int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
4370 |* Beschreibung
4371 |* Ersterstellung 15.11.94
4372 |* Letzte Aenderung 15.11.94
4374 *************************************************************************/
4376 int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
4378 return ( NameOrIndex::operator==(rItem) &&
4379 aHatch == ((const XFillHatchItem&) rItem).aHatch );
4382 /*************************************************************************
4384 |* SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, USHORT nVer) const
4386 |* Beschreibung
4387 |* Ersterstellung 15.11.94
4388 |* Letzte Aenderung 15.11.94
4390 *************************************************************************/
4392 SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, USHORT /*nVer*/) const
4394 return new XFillHatchItem(rIn);
4397 /*************************************************************************
4399 |* SfxPoolItem* XFillHatchItem::Store(SvStream& rOut) const
4401 |* Beschreibung
4402 |* Ersterstellung 15.11.94
4403 |* Letzte Aenderung 15.11.94
4405 *************************************************************************/
4407 SvStream& XFillHatchItem::Store( SvStream& rOut, USHORT nItemVersion ) const
4409 NameOrIndex::Store( rOut, nItemVersion );
4411 if (!IsIndex())
4413 rOut << (INT16)aHatch.GetHatchStyle();
4415 USHORT nTmp;
4416 nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut << nTmp;
4417 nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut << nTmp;
4418 nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut << nTmp;
4420 rOut << (INT32) aHatch.GetDistance();
4421 rOut << (INT32) aHatch.GetAngle();
4424 return rOut;
4427 /*************************************************************************
4429 |* const XHatch& XFillHatchItem::GetValue(const XHatchTable* pTable) const
4431 |* Beschreibung
4432 |* Ersterstellung 15.11.94
4433 |* Letzte Aenderung 18.11.94
4435 *************************************************************************/
4437 const XHatch& XFillHatchItem::GetHatchValue(const XHatchTable* pTable) const // GetValue -> GetHatchValue
4439 if (!IsIndex())
4440 return aHatch;
4441 else
4442 return pTable->GetHatch(GetIndex())->GetHatch();
4445 //------------------------------------------------------------------------
4447 SfxItemPresentation XFillHatchItem::GetPresentation
4449 SfxItemPresentation ePres,
4450 SfxMapUnit /*eCoreUnit*/,
4451 SfxMapUnit /*ePresUnit*/,
4452 XubString& rText, const IntlWrapper *
4453 ) const
4455 switch ( ePres )
4457 case SFX_ITEM_PRESENTATION_NONE:
4458 rText.Erase();
4459 return ePres;
4460 case SFX_ITEM_PRESENTATION_NAMELESS:
4461 case SFX_ITEM_PRESENTATION_COMPLETE:
4462 rText = GetName();
4463 return ePres;
4464 default:
4465 return SFX_ITEM_PRESENTATION_NONE;
4469 //------------------------------------------------------------------------
4471 FASTBOOL XFillHatchItem::HasMetrics() const
4473 return TRUE;
4476 //------------------------------------------------------------------------
4478 FASTBOOL XFillHatchItem::ScaleMetrics(long nMul, long nDiv)
4480 aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) );
4481 return TRUE;
4484 // -----------------------------------------------------------------------
4485 sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
4487 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4488 nMemberId &= ~CONVERT_TWIPS;
4490 switch ( nMemberId )
4492 case 0:
4494 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
4496 ::com::sun::star::drawing::Hatch aUnoHatch;
4498 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4499 aUnoHatch.Color = aHatch.GetColor().GetColor();
4500 aUnoHatch.Distance = aHatch.GetDistance();
4501 aUnoHatch.Angle = aHatch.GetAngle();
4503 rtl::OUString aApiName;
4504 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
4505 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
4506 aPropSeq[0].Value = uno::makeAny( aApiName );
4507 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ));
4508 aPropSeq[1].Value = uno::makeAny( aUnoHatch );
4509 rVal = uno::makeAny( aPropSeq );
4510 break;
4513 case MID_FILLHATCH:
4515 ::com::sun::star::drawing::Hatch aUnoHatch;
4517 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4518 aUnoHatch.Color = aHatch.GetColor().GetColor();
4519 aUnoHatch.Distance = aHatch.GetDistance();
4520 aUnoHatch.Angle = aHatch.GetAngle();
4521 rVal <<= aUnoHatch;
4522 break;
4525 case MID_NAME:
4527 rtl::OUString aApiName;
4528 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
4529 rVal <<= aApiName;
4530 break;
4533 case MID_HATCH_STYLE:
4534 rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break;
4535 case MID_HATCH_COLOR:
4536 rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break;
4537 case MID_HATCH_DISTANCE:
4538 rVal <<= aHatch.GetDistance(); break;
4539 case MID_HATCH_ANGLE:
4540 rVal <<= aHatch.GetAngle(); break;
4542 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
4545 return sal_True;
4548 // -----------------------------------------------------------------------
4549 sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
4551 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4552 nMemberId &= ~CONVERT_TWIPS;
4554 switch ( nMemberId )
4556 case 0:
4558 uno::Sequence< beans::PropertyValue > aPropSeq;
4559 ::com::sun::star::drawing::Hatch aUnoHatch;
4560 rtl::OUString aName;
4561 bool bHatch( false );
4563 if ( rVal >>= aPropSeq )
4565 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
4567 if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
4568 aPropSeq[n].Value >>= aName;
4569 else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillHatch" )))
4571 if ( aPropSeq[n].Value >>= aUnoHatch )
4572 bHatch = true;
4576 SetName( aName );
4577 if ( bHatch )
4579 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4580 aHatch.SetColor( aUnoHatch.Color );
4581 aHatch.SetDistance( aUnoHatch.Distance );
4582 aHatch.SetAngle( aUnoHatch.Angle );
4585 return sal_True;
4588 return sal_False;
4591 case MID_FILLHATCH:
4593 ::com::sun::star::drawing::Hatch aUnoHatch;
4594 if(!(rVal >>= aUnoHatch))
4595 return sal_False;
4597 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4598 aHatch.SetColor( aUnoHatch.Color );
4599 aHatch.SetDistance( aUnoHatch.Distance );
4600 aHatch.SetAngle( aUnoHatch.Angle );
4601 break;
4604 case MID_NAME:
4606 rtl::OUString aName;
4607 if (!(rVal >>= aName ))
4608 return sal_False;
4609 SetName( aName );
4610 break;
4613 case MID_HATCH_STYLE:
4615 sal_Int16 nVal = sal_Int16();
4616 if (!(rVal >>= nVal ))
4617 return sal_False;
4618 aHatch.SetHatchStyle( (XHatchStyle)nVal );
4619 break;
4622 case MID_HATCH_COLOR:
4623 case MID_HATCH_DISTANCE:
4624 case MID_HATCH_ANGLE:
4626 sal_Int32 nVal = 0;
4627 if (!(rVal >>= nVal ))
4628 return sal_False;
4630 if ( nMemberId == MID_HATCH_COLOR )
4631 aHatch.SetColor( nVal );
4632 else if ( nMemberId == MID_HATCH_DISTANCE )
4633 aHatch.SetDistance( nVal );
4634 else
4635 aHatch.SetAngle( nVal );
4636 break;
4639 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
4642 return sal_True;
4645 BOOL XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4647 return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue();
4650 XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
4652 if( pModel )
4654 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4655 XATTR_FILLHATCH,
4656 &pModel->GetItemPool(),
4657 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4658 XFillHatchItem::CompareValueFunc,
4659 RID_SVXSTR_HATCH10,
4660 pModel->GetHatchList() );
4662 // if the given name is not valid, replace it!
4663 if( aUniqueName != GetName() )
4665 return new XFillHatchItem( aUniqueName, aHatch );
4669 return (XFillHatchItem*)this;
4672 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4673 // FormText-Attribute
4674 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4676 //-------------------------
4677 // class XFormTextStyleItem
4678 //-------------------------
4679 TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem);
4681 /*************************************************************************
4683 |* XFormTextStyleItem::XFormTextStyleItem()
4685 |* Beschreibung
4686 |* Ersterstellung 02.02.95 ESO
4687 |* Letzte Aenderung 02.02.95 ESO
4689 *************************************************************************/
4691 XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
4692 SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< USHORT >(eTheStyle))
4696 /*************************************************************************
4698 |* XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn)
4700 |* Beschreibung
4701 |* Ersterstellung 02.02.95 ESO
4702 |* Letzte Aenderung 02.02.95 ESO
4704 *************************************************************************/
4706 XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) :
4707 SfxEnumItem(XATTR_FORMTXTSTYLE, rIn)
4711 /*************************************************************************
4713 |* XFormTextStyleItem::Clone(SfxItemPool* pPool) const
4715 |* Beschreibung
4716 |* Ersterstellung 02.02.95 ESO
4717 |* Letzte Aenderung 02.02.95 ESO
4719 *************************************************************************/
4721 SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const
4723 return new XFormTextStyleItem( *this );
4726 /*************************************************************************
4728 |* SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, USHORT nVer) const
4730 |* Beschreibung
4731 |* Ersterstellung 02.02.95 ESO
4732 |* Letzte Aenderung 02.02.95 ESO
4734 *************************************************************************/
4736 SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, USHORT /*nVer*/) const
4738 return new XFormTextStyleItem(rIn);
4741 /*************************************************************************
4745 \*************************************************************************/
4747 USHORT XFormTextStyleItem::GetValueCount() const
4749 return 5;
4752 /*************************************************************************
4756 \*************************************************************************/
4758 // #FontWork#
4759 sal_Bool XFormTextStyleItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
4761 rVal <<= (sal_Int32)GetValue();
4762 return sal_True;
4765 /*************************************************************************
4769 \*************************************************************************/
4771 // #FontWork#
4772 sal_Bool XFormTextStyleItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
4774 sal_Int32 nValue = 0;
4775 rVal >>= nValue;
4776 SetValue(sal::static_int_cast< USHORT >(nValue));
4778 return sal_True;
4781 //-------------------------
4782 // class XFormTextAdjustItem
4783 //-------------------------
4784 TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem);
4786 /*************************************************************************
4788 |* XFormTextAdjustItem::XFormTextAdjustItem()
4790 |* Beschreibung
4791 |* Ersterstellung 02.02.95 ESO
4792 |* Letzte Aenderung 02.02.95 ESO
4794 *************************************************************************/
4796 XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
4797 SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< USHORT >(eTheAdjust))
4801 /*************************************************************************
4803 |* XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn)
4805 |* Beschreibung
4806 |* Ersterstellung 02.02.95 ESO
4807 |* Letzte Aenderung 02.02.95 ESO
4809 *************************************************************************/
4811 XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) :
4812 SfxEnumItem(XATTR_FORMTXTADJUST, rIn)
4816 /*************************************************************************
4818 |* XFormTextAdjustItem::Clone(SfxItemPool* pPool) const
4820 |* Beschreibung
4821 |* Ersterstellung 02.02.95 ESO
4822 |* Letzte Aenderung 02.02.95 ESO
4824 *************************************************************************/
4826 SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const
4828 return new XFormTextAdjustItem( *this );
4831 /*************************************************************************
4833 |* SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, USHORT nVer) const
4835 |* Beschreibung
4836 |* Ersterstellung 02.02.95 ESO
4837 |* Letzte Aenderung 02.02.95 ESO
4839 *************************************************************************/
4841 SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, USHORT /*nVer*/) const
4843 return new XFormTextAdjustItem(rIn);
4846 /*************************************************************************
4850 \*************************************************************************/
4852 USHORT XFormTextAdjustItem::GetValueCount() const
4854 return 4;
4857 /*************************************************************************
4861 \*************************************************************************/
4863 // #FontWork#
4864 sal_Bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
4866 rVal <<= (sal_Int32)GetValue();
4867 return sal_True;
4870 /*************************************************************************
4874 \*************************************************************************/
4876 // #FontWork#
4877 sal_Bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
4879 sal_Int32 nValue = 0;
4880 rVal >>= nValue;
4881 SetValue(sal::static_int_cast< USHORT >(nValue));
4883 return sal_True;
4886 //----------------------------
4887 // class XFormTextDistanceItem
4888 //----------------------------
4889 TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem);
4891 /*************************************************************************
4893 |* XFormTextDistanceItem::XFormTextDistanceItem()
4895 |* Beschreibung
4896 |* Ersterstellung 02.02.95 ESO
4897 |* Letzte Aenderung 02.02.95 ESO
4899 *************************************************************************/
4901 XFormTextDistanceItem::XFormTextDistanceItem(long nDist) :
4902 SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist)
4906 /*************************************************************************
4908 |* XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn)
4910 |* Beschreibung
4911 |* Ersterstellung 02.02.95 ESO
4912 |* Letzte Aenderung 02.02.95 ESO
4914 *************************************************************************/
4916 XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) :
4917 SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn)
4921 /*************************************************************************
4923 |* XFormTextDistanceItem::Clone(SfxItemPool* pPool) const
4925 |* Beschreibung
4926 |* Ersterstellung 02.02.95 ESO
4927 |* Letzte Aenderung 02.02.95 ESO
4929 *************************************************************************/
4931 SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const
4933 return new XFormTextDistanceItem(*this);
4936 /*************************************************************************
4938 |* SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, USHORT nVer) const
4940 |* Beschreibung
4941 |* Ersterstellung 02.02.95 ESO
4942 |* Letzte Aenderung 02.02.95 ESO
4944 *************************************************************************/
4946 SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, USHORT /*nVer*/) const
4948 return new XFormTextDistanceItem(rIn);
4951 //-------------------------
4952 // class XFormTextStartItem
4953 //-------------------------
4954 TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem);
4956 /*************************************************************************
4958 |* XFormTextStartItem::XFormTextStartItem(long nStart)
4960 |* Beschreibung
4961 |* Ersterstellung 02.02.95 ESO
4962 |* Letzte Aenderung 02.02.95 ESO
4964 *************************************************************************/
4966 XFormTextStartItem::XFormTextStartItem(long nStart) :
4967 SfxMetricItem(XATTR_FORMTXTSTART, nStart)
4971 /*************************************************************************
4973 |* XFormTextStartItem::XFormTextStartItem(SvStream& rIn)
4975 |* Beschreibung
4976 |* Ersterstellung 02.02.95 ESO
4977 |* Letzte Aenderung 02.02.95 ESO
4979 *************************************************************************/
4981 XFormTextStartItem::XFormTextStartItem(SvStream& rIn) :
4982 SfxMetricItem(XATTR_FORMTXTSTART, rIn)
4986 /*************************************************************************
4988 |* XFormTextStartItem::Clone(SfxItemPool* pPool) const
4990 |* Beschreibung
4991 |* Ersterstellung 02.02.95 ESO
4992 |* Letzte Aenderung 02.02.95 ESO
4994 *************************************************************************/
4996 SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const
4998 return new XFormTextStartItem(*this);
5001 /*************************************************************************
5003 |* SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, USHORT nVer) const
5005 |* Beschreibung
5006 |* Ersterstellung 02.02.95 ESO
5007 |* Letzte Aenderung 02.02.95 ESO
5009 *************************************************************************/
5011 SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5013 return new XFormTextStartItem(rIn);
5016 // -------------------------
5017 // class XFormTextMirrorItem
5018 // -------------------------
5019 TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem);
5021 /*************************************************************************
5023 |* XFormTextMirrorItem::XFormTextMirrorItem(BOOL bMirror)
5025 |* Ersterstellung 06.02.95 ESO
5026 |* Letzte Aenderung 06.02.95 ESO
5028 *************************************************************************/
5030 XFormTextMirrorItem::XFormTextMirrorItem(BOOL bMirror) :
5031 SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror)
5035 /*************************************************************************
5037 |* XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn)
5039 |* Ersterstellung 06.02.95 ESO
5040 |* Letzte Aenderung 06.02.95 ESO
5042 *************************************************************************/
5044 XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) :
5045 SfxBoolItem(XATTR_FORMTXTMIRROR, rIn)
5049 /*************************************************************************
5051 |* XFormTextMirrorItem::Clone(SfxItemPool* pPool) const
5053 |* Ersterstellung 06.02.95 ESO
5054 |* Letzte Aenderung 06.02.95 ESO
5056 *************************************************************************/
5058 SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const
5060 return new XFormTextMirrorItem(*this);
5063 /*************************************************************************
5065 |* SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, USHORT nVer)
5066 |* const
5068 |* Ersterstellung 06.02.95 ESO
5069 |* Letzte Aenderung 06.02.95 ESO
5071 *************************************************************************/
5073 SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5075 return new XFormTextMirrorItem(rIn);
5079 // --------------------------
5080 // class XFormTextOutlineItem
5081 // --------------------------
5082 TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem);
5084 /*************************************************************************
5086 |* XFormTextOutlineItem::XFormTextOutlineItem()
5088 |* Ersterstellung 27.06.95 ESO
5089 |* Letzte Aenderung 27.06.95 ESO
5091 *************************************************************************/
5093 XFormTextOutlineItem::XFormTextOutlineItem(BOOL bOutline) :
5094 SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline)
5098 /*************************************************************************
5100 |* XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn)
5102 |* Ersterstellung 27.06.95 ESO
5103 |* Letzte Aenderung 27.06.95 ESO
5105 *************************************************************************/
5107 XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) :
5108 SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn)
5112 /*************************************************************************
5114 |* XFormTextOutlineItem::Clone(SfxItemPool* pPool) const
5116 |* Ersterstellung 27.06.95 ESO
5117 |* Letzte Aenderung 27.06.95 ESO
5119 *************************************************************************/
5121 SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const
5123 return new XFormTextOutlineItem(*this);
5126 /*************************************************************************
5128 |* SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, USHORT nVer)
5129 |* const
5131 |* Ersterstellung 27.06.95 ESO
5132 |* Letzte Aenderung 27.06.95 ESO
5134 *************************************************************************/
5136 SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5138 return new XFormTextOutlineItem(rIn);
5141 //--------------------------
5142 // class XFormTextShadowItem
5143 //--------------------------
5144 TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem);
5146 /*************************************************************************
5148 |* XFormTextShadowItem::XFormTextShadowItem()
5150 |* Beschreibung
5151 |* Ersterstellung 27.06.95
5152 |* Letzte Aenderung 27.06.95
5154 *************************************************************************/
5156 XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
5157 SfxEnumItem(
5158 XATTR_FORMTXTSHADOW, sal::static_int_cast< USHORT >(eFormTextShadow))
5162 /*************************************************************************
5164 |* XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn)
5166 |* Beschreibung
5167 |* Ersterstellung 27.06.95
5168 |* Letzte Aenderung 27.06.95
5170 *************************************************************************/
5172 XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) :
5173 SfxEnumItem(XATTR_FORMTXTSHADOW, rIn)
5177 /*************************************************************************
5179 |* XFormTextShadowItem::Clone(SfxItemPool* pPool) const
5181 |* Beschreibung
5182 |* Ersterstellung 27.06.95
5183 |* Letzte Aenderung 27.06.95
5185 *************************************************************************/
5187 SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const
5189 return new XFormTextShadowItem( *this );
5192 /*************************************************************************
5194 |* SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, USHORT nVer) const
5196 |* Beschreibung
5197 |* Ersterstellung 27.06.95
5198 |* Letzte Aenderung 27.06.95
5200 *************************************************************************/
5202 SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5204 return new XFormTextShadowItem(rIn);
5208 /*************************************************************************
5212 \*************************************************************************/
5214 USHORT XFormTextShadowItem::GetValueCount() const
5216 return 3;
5219 /*************************************************************************
5223 \*************************************************************************/
5225 // #FontWork#
5226 sal_Bool XFormTextShadowItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
5228 rVal <<= (sal_Int32)GetValue();
5229 return sal_True;
5232 /*************************************************************************
5236 \*************************************************************************/
5238 // #FontWork#
5239 sal_Bool XFormTextShadowItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
5241 sal_Int32 nValue = 0;
5242 rVal >>= nValue;
5243 SetValue(sal::static_int_cast< USHORT >(nValue));
5245 return sal_True;
5248 // -------------------------------
5249 // class XFormTextShadowColorItem
5250 // -------------------------------
5251 TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
5253 /*************************************************************************
5255 |* XFormTextShadowColorItem::XFormTextShadowColorItem()
5257 |* Beschreibung
5258 |* Ersterstellung 27.06.95
5259 |* Letzte Aenderung 27.06.95
5261 *************************************************************************/
5263 XFormTextShadowColorItem::XFormTextShadowColorItem(INT32 nIndex,
5264 const Color& rTheColor) :
5265 XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor)
5269 /*************************************************************************
5271 |* XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, const Color& rTheColor)
5273 |* Beschreibung
5274 |* Ersterstellung 27.06.95
5275 |* Letzte Aenderung 27.06.95
5277 *************************************************************************/
5279 XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName,
5280 const Color& rTheColor) :
5281 XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
5285 /*************************************************************************
5287 |* XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn)
5289 |* Beschreibung
5290 |* Ersterstellung 27.06.95
5291 |* Letzte Aenderung 27.06.95
5293 *************************************************************************/
5295 XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) :
5296 XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn)
5300 /*************************************************************************
5302 |* XFormTextShadowColorItem::Clone(SfxItemPool* pPool) const
5304 |* Beschreibung
5305 |* Ersterstellung 27.06.95
5306 |* Letzte Aenderung 27.06.95
5308 *************************************************************************/
5310 SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const
5312 return new XFormTextShadowColorItem(*this);
5315 /*************************************************************************
5317 |* SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, USHORT nVer) const
5319 |* Beschreibung
5320 |* Ersterstellung 27.06.95
5321 |* Letzte Aenderung 27.06.95
5323 *************************************************************************/
5325 SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5327 return new XFormTextShadowColorItem(rIn);
5330 //------------------------------
5331 // class XFormTextShadowXValItem
5332 //------------------------------
5333 TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem);
5335 /*************************************************************************
5337 |* XFormTextShadowXValItem::XFormTextShadowXValItem(long)
5339 |* Beschreibung
5340 |* Ersterstellung 28.06.95 ESO
5341 |* Letzte Aenderung 28.06.95 ESO
5343 *************************************************************************/
5345 XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) :
5346 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal)
5350 /*************************************************************************
5352 |* XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn)
5354 |* Beschreibung
5355 |* Ersterstellung 28.06.95 ESO
5356 |* Letzte Aenderung 28.06.95 ESO
5358 *************************************************************************/
5360 XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) :
5361 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn)
5365 /*************************************************************************
5367 |* XFormTextShadowXValItem::Clone(SfxItemPool* pPool) const
5369 |* Beschreibung
5370 |* Ersterstellung 28.06.95 ESO
5371 |* Letzte Aenderung 28.06.95 ESO
5373 *************************************************************************/
5375 SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const
5377 return new XFormTextShadowXValItem(*this);
5380 /*************************************************************************
5382 |* SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, USHORT nVer) const
5384 |* Beschreibung
5385 |* Ersterstellung 28.06.95 ESO
5386 |* Letzte Aenderung 28.06.95 ESO
5388 *************************************************************************/
5390 SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5392 return new XFormTextShadowXValItem(rIn);
5395 //------------------------------
5396 // class XFormTextShadowYValItem
5397 //------------------------------
5398 TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem);
5400 /*************************************************************************
5402 |* XFormTextShadowYValItem::XFormTextShadowYValItem(long)
5404 |* Beschreibung
5405 |* Ersterstellung 28.06.95 ESO
5406 |* Letzte Aenderung 28.06.95 ESO
5408 *************************************************************************/
5410 XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) :
5411 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal)
5415 /*************************************************************************
5417 |* XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn)
5419 |* Beschreibung
5420 |* Ersterstellung 28.06.95 ESO
5421 |* Letzte Aenderung 28.06.95 ESO
5423 *************************************************************************/
5425 XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) :
5426 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn)
5430 /*************************************************************************
5432 |* XFormTextShadowYValItem::Clone(SfxItemPool* pPool) const
5434 |* Beschreibung
5435 |* Ersterstellung 28.06.95 ESO
5436 |* Letzte Aenderung 28.06.95 ESO
5438 *************************************************************************/
5440 SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const
5442 return new XFormTextShadowYValItem(*this);
5445 /*************************************************************************
5447 |* SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, USHORT nVer) const
5449 |* Beschreibung
5450 |* Ersterstellung 28.06.95 ESO
5451 |* Letzte Aenderung 28.06.95 ESO
5453 *************************************************************************/
5455 SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5457 return new XFormTextShadowYValItem(rIn);
5460 //---------------------------
5461 // class XFormTextStdFormItem
5462 //---------------------------
5463 TYPEINIT1_AUTOFACTORY(XFormTextStdFormItem, SfxEnumItem);
5465 /*************************************************************************
5467 |* XFormTextStdFormItem::XFormTextStdFormItem()
5469 |* Beschreibung
5470 |* Ersterstellung 27.06.95
5471 |* Letzte Aenderung 27.06.95
5473 *************************************************************************/
5475 XFormTextStdFormItem::XFormTextStdFormItem(XFormTextStdForm eFormTextStdForm) :
5476 SfxEnumItem(
5477 XATTR_FORMTXTSTDFORM, sal::static_int_cast< USHORT >(eFormTextStdForm))
5481 /*************************************************************************
5483 |* XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn)
5485 |* Beschreibung
5486 |* Ersterstellung 27.06.95
5487 |* Letzte Aenderung 27.06.95
5489 *************************************************************************/
5491 XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn) :
5492 SfxEnumItem(XATTR_FORMTXTSTDFORM, rIn)
5496 /*************************************************************************
5498 |* XFormTextStdFormItem::Clone(SfxItemPool* pPool) const
5500 |* Beschreibung
5501 |* Ersterstellung 27.06.95
5502 |* Letzte Aenderung 27.06.95
5504 *************************************************************************/
5506 SfxPoolItem* XFormTextStdFormItem::Clone(SfxItemPool* /*pPool*/) const
5508 return new XFormTextStdFormItem( *this );
5511 /*************************************************************************
5513 |* SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, USHORT nVer) const
5515 |* Beschreibung
5516 |* Ersterstellung 27.06.95
5517 |* Letzte Aenderung 27.06.95
5519 *************************************************************************/
5521 SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5523 return new XFormTextStdFormItem(rIn);
5527 /*************************************************************************
5531 \*************************************************************************/
5533 USHORT XFormTextStdFormItem::GetValueCount() const
5535 return 3;
5538 /*************************************************************************
5542 \*************************************************************************/
5544 // #FontWork#
5545 sal_Bool XFormTextStdFormItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
5547 rVal <<= (sal_Int32)GetValue();
5548 return sal_True;
5551 /*************************************************************************
5555 \*************************************************************************/
5557 // #FontWork#
5558 sal_Bool XFormTextStdFormItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
5560 sal_Int32 nValue = 0;
5561 rVal >>= nValue;
5562 SetValue(sal::static_int_cast< USHORT >(nValue));
5564 return sal_True;
5567 // --------------------------
5568 // class XFormTextHideFormItem
5569 // --------------------------
5570 TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem);
5572 /*************************************************************************
5574 |* XFormTextHideFormItem::XFormTextHideFormItem()
5576 |* Ersterstellung 27.06.95 ESO
5577 |* Letzte Aenderung 27.06.95 ESO
5579 *************************************************************************/
5581 XFormTextHideFormItem::XFormTextHideFormItem(BOOL bHide) :
5582 SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide)
5586 /*************************************************************************
5588 |* XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn)
5590 |* Ersterstellung 27.06.95 ESO
5591 |* Letzte Aenderung 27.06.95 ESO
5593 *************************************************************************/
5595 XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) :
5596 SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn)
5600 /*************************************************************************
5602 |* XFormTextHideFormItem::Clone(SfxItemPool* pPool) const
5604 |* Ersterstellung 27.06.95 ESO
5605 |* Letzte Aenderung 27.06.95 ESO
5607 *************************************************************************/
5609 SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const
5611 return new XFormTextHideFormItem(*this);
5614 /*************************************************************************
5616 |* SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, USHORT nVer)
5617 |* const
5619 |* Ersterstellung 27.06.95 ESO
5620 |* Letzte Aenderung 27.06.95 ESO
5622 *************************************************************************/
5624 SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, USHORT /*nVer*/) const
5626 return new XFormTextHideFormItem(rIn);
5631 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5632 // SetItems
5633 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5635 TYPEINIT1(XLineAttrSetItem, SfxSetItem);
5637 /*************************************************************************
5639 |* Konstruktoren fuer Linienattribute-SetItem
5641 \************************************************************************/
5643 XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
5644 SfxSetItem( XATTRSET_LINE, pItemSet)
5648 /************************************************************************/
5650 XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
5651 SfxSetItem( XATTRSET_LINE,
5652 new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
5656 /************************************************************************/
5658 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) :
5659 SfxSetItem( rLineAttr )
5663 /************************************************************************/
5665 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr,
5666 SfxItemPool* pItemPool) :
5667 SfxSetItem( rLineAttr, pItemPool )
5671 /*************************************************************************
5673 |* Clone-Funktion
5675 \************************************************************************/
5677 SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
5679 return new XLineAttrSetItem( *this, pPool );
5682 /*************************************************************************
5684 |* SetItem aus Stream erzeugen
5686 \************************************************************************/
5688 SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, USHORT /*nVersion*/) const
5690 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
5691 XATTR_LINE_FIRST, XATTR_LINE_LAST);
5692 pSet2->Load( rStream );
5693 return new XLineAttrSetItem( pSet2 );
5696 /*************************************************************************
5698 |* SetItem in Stream speichern
5700 \************************************************************************/
5702 SvStream& XLineAttrSetItem::Store( SvStream& rStream, USHORT nItemVersion ) const
5704 return SfxSetItem::Store( rStream, nItemVersion );
5708 TYPEINIT1(XFillAttrSetItem, SfxSetItem);
5710 /*************************************************************************
5712 |* Konstruktoren fuer Fuellattribute-SetItem
5714 \************************************************************************/
5716 XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
5717 SfxSetItem( XATTRSET_FILL, pItemSet)
5721 /************************************************************************/
5723 XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
5724 SfxSetItem( XATTRSET_FILL,
5725 new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
5729 /************************************************************************/
5731 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) :
5732 SfxSetItem( rFillAttr )
5736 /************************************************************************/
5738 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr,
5739 SfxItemPool* pItemPool ) :
5740 SfxSetItem( rFillAttr, pItemPool )
5744 /*************************************************************************
5746 |* Clone-Funktion
5748 \************************************************************************/
5750 SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
5752 return new XFillAttrSetItem( *this, pPool );
5755 /*************************************************************************
5757 |* SetItem aus Stream erzeugen
5759 \************************************************************************/
5761 SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, USHORT /*nVersion*/) const
5763 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
5764 XATTR_FILL_FIRST, XATTR_FILL_LAST);
5765 pSet2->Load( rStream );
5766 return new XFillAttrSetItem( pSet2 );
5769 /*************************************************************************
5771 |* SetItem in Stream speichern
5773 \************************************************************************/
5775 SvStream& XFillAttrSetItem::Store( SvStream& rStream, USHORT nItemVersion ) const
5777 return SfxSetItem::Store( rStream, nItemVersion );
5780 // eof