bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / xoutdev / xattr.cxx
blobb6875900ca4eb94c3209a1df977e229329f1c070
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
21 #include <com/sun/star/drawing/Hatch.hpp>
22 #include <com/sun/star/drawing/LineStyle.hpp>
23 #include <com/sun/star/drawing/LineDash.hpp>
24 #include <com/sun/star/drawing/DashStyle.hpp>
25 #include <com/sun/star/awt/Point.hpp>
26 #include <com/sun/star/drawing/PointSequence.hpp>
27 #include <com/sun/star/drawing/FillStyle.hpp>
28 #include <com/sun/star/awt/Gradient.hpp>
29 #include <com/sun/star/uno/Sequence.hxx>
30 #include <com/sun/star/beans/PropertyValue.hpp>
31 #include <svl/itempool.hxx>
32 #include <editeng/memberids.hrc>
33 #include <tools/stream.hxx>
35 #include "svx/unoapi.hxx"
36 #include <svl/style.hxx>
38 #include <tools/bigint.hxx>
39 #include <svl/itemset.hxx>
40 #include <svx/dialogs.hrc>
41 #include "svx/svdstr.hrc"
42 #include "svx/xattr.hxx"
43 #include <svx/xtable.hxx>
44 #include <svx/dialmgr.hxx>
45 #include <editeng/itemtype.hxx>
46 #include <svx/xdef.hxx>
47 #include <svx/unomid.hxx>
48 #include <svx/svdmodel.hxx>
49 #include <basegfx/polygon/b2dpolygon.hxx>
50 #include <basegfx/point/b2dpoint.hxx>
51 #include <basegfx/vector/b2dvector.hxx>
52 #include <basegfx/tools/unotools.hxx>
53 #include <vcl/gradient.hxx>
55 #include <stdio.h>
57 using namespace ::rtl;
58 using namespace ::com::sun::star;
60 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
61 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
63 /************************************************************************/
65 #define VCLTOSVCOL( rCol ) (sal_uInt16)((((sal_uInt16)(rCol))<<8)|(rCol))
67 /************************************************************************/
69 TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem);
71 long ScaleMetricValue( long nVal, long nMul, long nDiv )
73 BigInt aVal( nVal );
75 aVal *= nMul;
77 if ( aVal.IsNeg() != ( nDiv < 0 ) )
78 aVal-=nDiv/2; // fuer korrektes Runden
79 else
80 aVal+=nDiv/2; // fuer korrektes Runden
82 aVal/=nDiv;
84 return long( aVal );
87 /*************************************************************************
89 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex)
91 *************************************************************************/
93 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, sal_Int32 nIndex) :
94 SfxStringItem(_nWhich, OUString()),
95 nPalIndex(nIndex)
99 /*************************************************************************
101 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, const String& rName)
103 *************************************************************************/
105 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const XubString& rName) :
106 SfxStringItem(_nWhich, rName),
107 nPalIndex(-1)
111 /*************************************************************************
113 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, SvStream& rIn)
115 *************************************************************************/
117 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, SvStream& rIn) :
118 SfxStringItem(_nWhich, rIn)
120 rIn >> nPalIndex;
123 /*************************************************************************
125 |* NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex)
127 *************************************************************************/
129 NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) :
130 SfxStringItem(rNameOrIndex),
131 nPalIndex(rNameOrIndex.nPalIndex)
135 /*************************************************************************
137 |* int NameOrIndex::operator==(const SfxPoolItem& rItem) const
139 *************************************************************************/
141 int NameOrIndex::operator==(const SfxPoolItem& rItem) const
143 return ( SfxStringItem::operator==(rItem) &&
144 ((const NameOrIndex&) rItem).nPalIndex == nPalIndex );
147 /*************************************************************************
149 |* SfxPoolItem* NameOrIndex::Clone(SfxItemPool* pPool) const
151 *************************************************************************/
153 SfxPoolItem* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const
156 return new NameOrIndex(*this);
159 /*************************************************************************
161 |* SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 nVer) const
163 *************************************************************************/
165 SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
167 return new NameOrIndex(Which(), rIn);
170 /*************************************************************************
172 |* SvStream* NameOrIndex::Store(SvStream& rIn) const
174 *************************************************************************/
176 SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
178 SfxStringItem::Store( rOut, nItemVersion );
179 rOut << nPalIndex;
180 return rOut;
183 /** this static checks if the given NameOrIndex item has a unique name for its value.
184 The returned String is a unique name for an item with this value in both given pools.
185 Argument pPool2 can be null.
186 If returned string equals NameOrIndex->GetName(), the name was already unique.
188 String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults )
190 bool bForceNew = false;
192 OUString aUniqueName = SvxUnogetInternalNameForItem(nWhich, pCheckItem->GetName());
194 // 2. if we have a name check if there is already an item with the
195 // same name in the documents pool with a different line end or start
197 if (!aUniqueName.isEmpty() && pPool1)
199 const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
201 const NameOrIndex *pItem;
202 for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
204 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
206 if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) )
208 // if there is already an item with the same name and the same
209 // value its ok to set it
210 if( !pCompareValueFunc( pItem, pCheckItem ) )
212 // same name but different value, we need a new name for this item
213 aUniqueName = String();
214 bForceNew = true;
216 break;
221 // if we have no name yet, find existing item with same conent or
222 // create a unique name
223 if (aUniqueName.isEmpty())
225 sal_Int32 nUserIndex = 1;
226 const ResId aRes(SVX_RES(nPrefixResId));
227 String aUser( aRes );
228 aUser += sal_Unicode( ' ' );
230 if( pDefaults.get() )
232 const int nCount = pDefaults->Count();
233 int nIndex;
234 for( nIndex = 0; nIndex < nCount; nIndex++ )
236 XPropertyEntry* pEntry = pDefaults->Get( nIndex, 0 );
237 if( pEntry )
239 bool bFound = false;
241 switch( nWhich )
243 case XATTR_FILLBITMAP:
245 const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
246 const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
248 bFound = (rGraphicObjectA == rGraphicObjectB);
249 break;
251 case XATTR_LINEDASH:
252 bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash());
253 break;
254 case XATTR_LINESTART:
255 bFound = (((XLineStartItem*)pCheckItem)->GetLineStartValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
256 break;
257 case XATTR_LINEEND:
258 bFound = (((XLineEndItem*)pCheckItem)->GetLineEndValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
259 break;
260 case XATTR_FILLGRADIENT:
261 bFound = (((XFillGradientItem*)pCheckItem)->GetGradientValue() == ((XGradientEntry*)pEntry)->GetGradient());
262 break;
263 case XATTR_FILLHATCH:
264 bFound = (((XFillHatchItem*)pCheckItem)->GetHatchValue() == ((XHatchEntry*)pEntry)->GetHatch());
265 break;
268 if( bFound )
270 aUniqueName = pEntry->GetName();
271 break;
273 else
275 sal_Int32 nThisIndex = pEntry->GetName().Copy( aUser.Len() ).ToInt32();
276 if( nThisIndex >= nUserIndex )
277 nUserIndex = nThisIndex + 1;
283 if (aUniqueName.isEmpty() && pPool1)
285 const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
286 const NameOrIndex *pItem;
287 for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
289 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
291 if( pItem && pItem->GetName().Len() )
293 if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) )
294 return pItem->GetName();
296 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
298 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
299 if( nThisIndex >= nUserIndex )
300 nUserIndex = nThisIndex + 1;
304 aUniqueName = aUser;
305 aUniqueName += OUString::number( nUserIndex );
309 return aUniqueName;
312 //*************************************************************************
314 // -------------------
315 // class XColorItem
316 // -------------------
317 TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
319 /*************************************************************************
321 |* XColorItem::XColorItem(sal_uInt16 nWhich, sal_Int32 nIndex, const Color& rTheColor)
323 \************************************************************************/
325 XColorItem::XColorItem(sal_uInt16 _nWhich, sal_Int32 nIndex, const Color& rTheColor) :
326 NameOrIndex(_nWhich, nIndex),
327 aColor(rTheColor)
331 /*************************************************************************
333 |* XColorItem::XColorItem(sal_uInt16 nWhich, const String& rName, const Color& rTheColor)
335 \************************************************************************/
337 XColorItem::XColorItem(sal_uInt16 _nWhich, const XubString& rName, const Color& rTheColor) :
338 NameOrIndex(_nWhich, rName),
339 aColor(rTheColor)
343 XColorItem::XColorItem(sal_uInt16 _nWhich, const Color& rTheColor)
344 : NameOrIndex(_nWhich, OUString())
345 , aColor(rTheColor)
349 /*************************************************************************
351 |* XColorItem::XColorItem(const XColorItem& rItem)
353 \************************************************************************/
355 XColorItem::XColorItem(const XColorItem& rItem) :
356 NameOrIndex(rItem),
357 aColor(rItem.aColor)
361 /*************************************************************************
363 |* XColorItem::XColorItem(sal_uInt16 nWhich, SvStream& rIn)
365 \************************************************************************/
367 XColorItem::XColorItem(sal_uInt16 _nWhich, SvStream& rIn) :
368 NameOrIndex(_nWhich, rIn)
370 if (!IsIndex())
372 rIn >> aColor;
376 /*************************************************************************
378 |* XColorItem::Clone(SfxItemPool* pPool) const
380 \************************************************************************/
382 SfxPoolItem* XColorItem::Clone(SfxItemPool* /*pPool*/) const
384 return new XColorItem(*this);
387 /*************************************************************************
389 |* int XColorItem::operator==(const SfxPoolItem& rItem) const
391 \************************************************************************/
393 int XColorItem::operator==(const SfxPoolItem& rItem) const
395 return ( NameOrIndex::operator==(rItem) &&
396 ((const XColorItem&) rItem).aColor == aColor );
399 /*************************************************************************
401 |* SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
403 \************************************************************************/
405 SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
407 return new XColorItem(Which(), rIn);
410 /*************************************************************************
412 |* SfxPoolItem* XColorItem::Store(SvStream& rOut) const
414 \************************************************************************/
416 SvStream& XColorItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
418 NameOrIndex::Store( rOut, nItemVersion );
420 if ( !IsIndex() )
422 rOut << aColor;
425 return rOut;
428 /*************************************************************************
430 |* const XColor& XColorItem::GetColorValue(const XColorList* pTable) const
432 \************************************************************************/
434 const Color& XColorItem::GetColorValue(const XColorList* pTable) const
436 if (!IsIndex())
437 return aColor;
438 else
439 return pTable->GetColor(GetIndex())->GetColor();
443 bool XColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
445 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
446 return true;
449 bool XColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
451 sal_Int32 nValue = 0;
452 rVal >>= nValue;
453 SetColorValue( nValue );
455 return true;
459 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
460 // Linienattribute
461 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
463 //---------------------
464 // class XLineStyleItem
465 //---------------------
466 TYPEINIT1_AUTOFACTORY(XLineStyleItem, SfxEnumItem);
468 /*************************************************************************
470 |* XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle)
472 *************************************************************************/
474 XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) :
475 SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle))
479 /*************************************************************************
481 |* XLineStyleItem::XLineStyleItem(SvStream& rIn)
483 *************************************************************************/
485 XLineStyleItem::XLineStyleItem(SvStream& rIn) :
486 SfxEnumItem(XATTR_LINESTYLE, rIn)
490 /*************************************************************************
492 |* XLineStyleItem::Clone(SfxItemPool* pPool) const
494 *************************************************************************/
496 SfxPoolItem* XLineStyleItem::Clone(SfxItemPool* /*pPool*/) const
498 return new XLineStyleItem( *this );
501 /*************************************************************************
503 |* SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
505 *************************************************************************/
507 SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
509 return new XLineStyleItem(rIn);
512 //------------------------------------------------------------------------
514 SfxItemPresentation XLineStyleItem::GetPresentation
516 SfxItemPresentation ePres,
517 SfxMapUnit /*eCoreUnit*/,
518 SfxMapUnit /*ePresUnit*/,
519 OUString& rText, const IntlWrapper *
520 ) const
522 rText = OUString();
524 switch ( ePres )
526 case SFX_ITEM_PRESENTATION_NONE:
527 return ePres;
528 case SFX_ITEM_PRESENTATION_COMPLETE:
529 case SFX_ITEM_PRESENTATION_NAMELESS:
531 sal_uInt16 nId = 0;
533 switch( (sal_uInt16)GetValue() )
535 case XLINE_NONE:
536 nId = RID_SVXSTR_INVISIBLE;
537 break;
538 case XLINE_SOLID:
539 nId = RID_SVXSTR_SOLID;
540 break;
543 if ( nId )
544 rText = SVX_RESSTR( nId );
545 return ePres;
547 default:
548 return SFX_ITEM_PRESENTATION_NONE;
552 bool XLineStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
554 ::com::sun::star::drawing::LineStyle eLS = (::com::sun::star::drawing::LineStyle)GetValue();
555 rVal <<= eLS;
556 return true;
559 bool XLineStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
561 ::com::sun::star::drawing::LineStyle eLS;
562 if(!(rVal >>= eLS ))
564 // also try an int (for Basic)
565 sal_Int32 nLS = 0;
566 if(!(rVal >>= nLS))
567 return false;
568 eLS = (::com::sun::star::drawing::LineStyle)nLS;
571 SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) );
572 return true;
575 //------------------------------------------------------------------------
577 sal_uInt16 XLineStyleItem::GetValueCount() const
579 return 3;
583 // ------------
584 // class XDash
585 // ------------
586 /*************************************************************************
588 |* XDash::XDash(XDashStyle, sal_uInt16, sal_uIntPtr, sal_uInt16, sal_uIntPtr, sal_uIntPtr)
590 *************************************************************************/
592 XDash::XDash(XDashStyle eTheDash, sal_uInt16 nTheDots, sal_uIntPtr nTheDotLen,
593 sal_uInt16 nTheDashes, sal_uIntPtr nTheDashLen, sal_uIntPtr nTheDistance) :
594 eDash(eTheDash),
595 nDots(nTheDots),
596 nDotLen(nTheDotLen),
597 nDashes(nTheDashes),
598 nDashLen(nTheDashLen),
599 nDistance(nTheDistance)
603 /*************************************************************************
605 |* int XDash::operator==(const SfxPoolItem& rItem) const
607 *************************************************************************/
609 bool XDash::operator==(const XDash& rDash) const
611 return ( eDash == rDash.eDash &&
612 nDots == rDash.nDots &&
613 nDotLen == rDash.nDotLen &&
614 nDashes == rDash.nDashes &&
615 nDashLen == rDash.nDashLen &&
616 nDistance == rDash.nDistance );
619 // XDash is translated into an array of doubles which describe the lengths of the
620 // dashes, dots and empty passages. It returns the complete length of the full DashDot
621 // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
622 static double SMALLEST_DASH_WIDTH(26.95);
623 double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const
625 double fFullDotDashLen(0.0);
626 const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2;
627 rDotDashArray.resize( nNumDotDashArray, 0.0 );
628 sal_uInt16 a;
629 sal_uInt16 nIns(0);
630 double fDashDotDistance = (double)GetDistance();
631 double fSingleDashLen = (double)GetDashLen();
632 double fSingleDotLen = (double)GetDotLen();
634 if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE)
636 if(fLineWidth != 0.0)
638 double fFactor = fLineWidth / 100.0;
640 if(GetDashes())
642 if(GetDashLen())
644 // is a dash
645 fSingleDashLen *= fFactor;
647 else
649 // is a dot
650 fSingleDashLen = fLineWidth;
654 if(GetDots())
656 if(GetDotLen())
658 // is a dash
659 fSingleDotLen *= fFactor;
661 else
663 // is a dot
664 fSingleDotLen = fLineWidth;
668 if(GetDashes() || GetDots())
670 if(GetDistance())
672 fDashDotDistance *= fFactor;
674 else
676 fDashDotDistance = fLineWidth;
680 else
682 if(GetDashes())
684 if(GetDashLen())
686 // is a dash
687 fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0;
689 else
691 // is a dot
692 fSingleDashLen = SMALLEST_DASH_WIDTH;
696 if(GetDots())
698 if(GetDotLen())
700 // is a dash
701 fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0;
703 else
705 // is a dot
706 fSingleDotLen = SMALLEST_DASH_WIDTH;
710 if(GetDashes() || GetDots())
712 if(GetDistance())
714 // dash as distance
715 fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0;
717 else
719 // dot as distance
720 fDashDotDistance = SMALLEST_DASH_WIDTH;
725 else
727 // smallest dot size compare value
728 double fDotCompVal(fLineWidth != 0.0 ? fLineWidth : SMALLEST_DASH_WIDTH);
730 // absolute values
731 if(GetDashes())
733 if(GetDashLen())
735 // is a dash
736 if(fSingleDashLen < SMALLEST_DASH_WIDTH)
738 fSingleDashLen = SMALLEST_DASH_WIDTH;
741 else
743 // is a dot
744 if(fSingleDashLen < fDotCompVal)
746 fSingleDashLen = fDotCompVal;
751 if(GetDots())
753 if(GetDotLen())
755 // is a dash
756 if(fSingleDotLen < SMALLEST_DASH_WIDTH)
758 fSingleDotLen = SMALLEST_DASH_WIDTH;
761 else
763 // is a dot
764 if(fSingleDotLen < fDotCompVal)
766 fSingleDotLen = fDotCompVal;
771 if(GetDashes() || GetDots())
773 if(GetDistance())
775 // dash as distance
776 if(fDashDotDistance < SMALLEST_DASH_WIDTH)
778 fDashDotDistance = SMALLEST_DASH_WIDTH;
781 else
783 // dot as distance
784 if(fDashDotDistance < fDotCompVal)
786 fDashDotDistance = fDotCompVal;
792 for(a=0;a<GetDots();a++)
794 rDotDashArray[nIns++] = fSingleDotLen;
795 fFullDotDashLen += fSingleDotLen;
796 rDotDashArray[nIns++] = fDashDotDistance;
797 fFullDotDashLen += fDashDotDistance;
800 for(a=0;a<GetDashes();a++)
802 rDotDashArray[nIns++] = fSingleDashLen;
803 fFullDotDashLen += fSingleDashLen;
804 rDotDashArray[nIns++] = fDashDotDistance;
805 fFullDotDashLen += fDashDotDistance;
808 return fFullDotDashLen;
811 // -------------------
812 // class XLineDashItem
813 // -------------------
814 TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
816 /*************************************************************************
818 |* XLineDashItem::XLineDashItem(const String& rName, const XDash& rTheDash)
820 *************************************************************************/
822 XLineDashItem::XLineDashItem(const XubString& rName, const XDash& rTheDash) :
823 NameOrIndex(XATTR_LINEDASH, rName),
824 aDash(rTheDash)
828 /*************************************************************************
830 |* XLineDashItem::XLineDashItem(const XLineDashItem& rItem)
832 *************************************************************************/
834 XLineDashItem::XLineDashItem(const XLineDashItem& rItem) :
835 NameOrIndex(rItem),
836 aDash(rItem.aDash)
840 /*************************************************************************
842 |* XLineDashItem::XLineDashItem(SvStream& rIn)
844 *************************************************************************/
846 XLineDashItem::XLineDashItem(SvStream& rIn) :
847 NameOrIndex(XATTR_LINEDASH, rIn)
849 if (!IsIndex())
851 sal_uInt16 nSTemp;
852 sal_uInt32 nLTemp;
853 sal_Int32 nITemp;
855 rIn >> nITemp; aDash.SetDashStyle((XDashStyle)nITemp);
856 rIn >> nSTemp; aDash.SetDots(nSTemp);
857 rIn >> nLTemp; aDash.SetDotLen(nLTemp);
858 rIn >> nSTemp; aDash.SetDashes(nSTemp);
859 rIn >> nLTemp; aDash.SetDashLen(nLTemp);
860 rIn >> nLTemp; aDash.SetDistance(nLTemp);
864 //*************************************************************************
866 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash)
867 : NameOrIndex( XATTR_LINEDASH, -1 ),
868 aDash(rTheDash)
872 /*************************************************************************
874 |* XLineDashItem::Clone(SfxItemPool* pPool) const
876 *************************************************************************/
878 SfxPoolItem* XLineDashItem::Clone(SfxItemPool* /*pPool*/) const
880 return new XLineDashItem(*this);
883 /*************************************************************************
885 |* int XLineDashItem::operator==(const SfxPoolItem& rItem) const
887 *************************************************************************/
889 int XLineDashItem::operator==(const SfxPoolItem& rItem) const
891 return ( NameOrIndex::operator==(rItem) &&
892 aDash == ((const XLineDashItem&) rItem).aDash );
895 /*************************************************************************
897 |* SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 nVer) const
899 *************************************************************************/
901 SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
903 return new XLineDashItem(rIn);
906 /*************************************************************************
908 |* SfxPoolItem* XLineDashItem::Store(SvStream& rOut) const
910 *************************************************************************/
912 SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
914 NameOrIndex::Store( rOut, nItemVersion );
916 if (!IsIndex())
918 rOut << (sal_Int32) aDash.GetDashStyle();
919 rOut << aDash.GetDots();
920 rOut << (sal_uInt32) aDash.GetDotLen();
921 rOut << aDash.GetDashes();
922 rOut << (sal_uInt32) aDash.GetDashLen();
923 rOut << (sal_uInt32) aDash.GetDistance();
926 return rOut;
929 /*************************************************************************
931 |* const XDash& XLineDashItem::GetValue() const
933 *************************************************************************/
935 const XDash& XLineDashItem::GetDashValue() const
937 return aDash;
940 //------------------------------------------------------------------------
942 SfxItemPresentation XLineDashItem::GetPresentation
944 SfxItemPresentation ePres,
945 SfxMapUnit /*eCoreUnit*/,
946 SfxMapUnit /*ePresUnit*/,
947 OUString& rText, const IntlWrapper *
948 ) const
950 switch ( ePres )
952 case SFX_ITEM_PRESENTATION_NONE:
953 rText = OUString();
954 return ePres;
955 case SFX_ITEM_PRESENTATION_NAMELESS:
956 case SFX_ITEM_PRESENTATION_COMPLETE:
957 rText = GetName();
958 return ePres;
959 default:
960 return SFX_ITEM_PRESENTATION_NONE;
964 //------------------------------------------------------------------------
966 bool XLineDashItem::HasMetrics() const
968 return true;
971 //------------------------------------------------------------------------
973 bool XLineDashItem::ScaleMetrics(long nMul, long nDiv)
975 aDash.SetDotLen( ScaleMetricValue( aDash.GetDotLen(), nMul, nDiv ) );
976 aDash.SetDashLen( ScaleMetricValue( aDash.GetDashLen(), nMul, nDiv ) );
977 aDash.SetDistance( ScaleMetricValue( aDash.GetDistance(), nMul, nDiv ) );
978 return true;
981 bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
983 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
984 nMemberId &= ~CONVERT_TWIPS;
986 switch ( nMemberId )
988 case 0:
990 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
992 ::com::sun::star::drawing::LineDash aLineDash;
994 const XDash& rXD = GetDashValue();
995 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
996 aLineDash.Dots = rXD.GetDots();
997 aLineDash.DotLen = rXD.GetDotLen();
998 aLineDash.Dashes = rXD.GetDashes();
999 aLineDash.DashLen = rXD.GetDashLen();
1000 aLineDash.Distance = rXD.GetDistance();
1002 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
1003 aPropSeq[0].Name = OUString( "Name" );
1004 aPropSeq[0].Value = uno::makeAny( aApiName );
1005 aPropSeq[1].Name = OUString( "LineDash" );
1006 aPropSeq[1].Value = uno::makeAny( aLineDash );
1007 rVal = uno::makeAny( aPropSeq );
1008 break;
1011 case MID_NAME:
1013 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
1014 rVal <<= aApiName;
1015 break;
1018 case MID_LINEDASH:
1020 const XDash& rXD = GetDashValue();
1022 ::com::sun::star::drawing::LineDash aLineDash;
1024 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
1025 aLineDash.Dots = rXD.GetDots();
1026 aLineDash.DotLen = rXD.GetDotLen();
1027 aLineDash.Dashes = rXD.GetDashes();
1028 aLineDash.DashLen = rXD.GetDashLen();
1029 aLineDash.Distance = rXD.GetDistance();
1031 rVal <<= aLineDash;
1032 break;
1035 case MID_LINEDASH_STYLE:
1037 const XDash& rXD = GetDashValue();
1038 rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle());
1039 break;
1042 case MID_LINEDASH_DOTS:
1044 const XDash& rXD = GetDashValue();
1045 rVal <<= rXD.GetDots();
1046 break;
1049 case MID_LINEDASH_DOTLEN:
1051 const XDash& rXD = GetDashValue();
1052 rVal <<= rXD.GetDotLen();
1053 break;
1056 case MID_LINEDASH_DASHES:
1058 const XDash& rXD = GetDashValue();
1059 rVal <<= rXD.GetDashes();
1060 break;
1063 case MID_LINEDASH_DASHLEN:
1065 const XDash& rXD = GetDashValue();
1066 rVal <<= rXD.GetDashLen();
1067 break;
1070 case MID_LINEDASH_DISTANCE:
1072 const XDash& rXD = GetDashValue();
1073 rVal <<= rXD.GetDistance();
1074 break;
1077 default: OSL_FAIL("Wrong MemberId!"); return false;
1080 return true;
1083 bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1085 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1086 nMemberId &= ~CONVERT_TWIPS;
1088 switch ( nMemberId )
1090 case 0:
1092 uno::Sequence< beans::PropertyValue > aPropSeq;
1093 ::com::sun::star::drawing::LineDash aLineDash;
1094 OUString aName;
1095 bool bLineDash( false );
1097 if ( rVal >>= aPropSeq )
1099 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
1101 if ( aPropSeq[n].Name.equalsAsciiL( "Name", 4 ))
1102 aPropSeq[n].Value >>= aName;
1103 else if ( aPropSeq[n].Name.equalsAsciiL( "LineDash", 8 ))
1105 if ( aPropSeq[n].Value >>= aLineDash )
1106 bLineDash = true;
1110 SetName( aName );
1111 if ( bLineDash )
1113 XDash aXDash;
1115 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
1116 aXDash.SetDots(aLineDash.Dots);
1117 aXDash.SetDotLen(aLineDash.DotLen);
1118 aXDash.SetDashes(aLineDash.Dashes);
1119 aXDash.SetDashLen(aLineDash.DashLen);
1120 aXDash.SetDistance(aLineDash.Distance);
1122 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1123 aXDash.SetDots(1);
1125 SetDashValue( aXDash );
1128 return true;
1131 return false;
1134 case MID_NAME:
1136 OUString aName;
1137 if (!(rVal >>= aName))
1138 return false;
1139 SetName( aName );
1140 break;
1143 case MID_LINEDASH:
1145 ::com::sun::star::drawing::LineDash aLineDash;
1146 if(!(rVal >>= aLineDash))
1147 return false;
1149 XDash aXDash;
1151 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
1152 aXDash.SetDots(aLineDash.Dots);
1153 aXDash.SetDotLen(aLineDash.DotLen);
1154 aXDash.SetDashes(aLineDash.Dashes);
1155 aXDash.SetDashLen(aLineDash.DashLen);
1156 aXDash.SetDistance(aLineDash.Distance);
1158 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1159 aXDash.SetDots(1);
1161 SetDashValue( aXDash );
1162 break;
1165 case MID_LINEDASH_STYLE:
1167 sal_Int16 nVal = sal_Int16();
1168 if(!(rVal >>= nVal))
1169 return false;
1171 XDash aXDash = GetDashValue();
1172 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(nVal)));
1174 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1175 aXDash.SetDots(1);
1177 SetDashValue( aXDash );
1179 break;
1182 case MID_LINEDASH_DOTS:
1183 case MID_LINEDASH_DASHES:
1185 sal_Int16 nVal = sal_Int16();
1186 if(!(rVal >>= nVal))
1187 return false;
1189 XDash aXDash = GetDashValue();
1190 if ( nMemberId == MID_LINEDASH_DOTS )
1191 aXDash.SetDots( nVal );
1192 else
1193 aXDash.SetDashes( nVal );
1195 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1196 aXDash.SetDots(1);
1198 SetDashValue( aXDash );
1199 break;
1202 case MID_LINEDASH_DOTLEN:
1203 case MID_LINEDASH_DASHLEN:
1204 case MID_LINEDASH_DISTANCE:
1206 sal_Int32 nVal = 0;
1207 if(!(rVal >>= nVal))
1208 return false;
1210 XDash aXDash = GetDashValue();
1211 if ( nMemberId == MID_LINEDASH_DOTLEN )
1212 aXDash.SetDotLen( nVal );
1213 else if ( nMemberId == MID_LINEDASH_DASHLEN )
1214 aXDash.SetDashLen( nVal );
1215 else
1216 aXDash.SetDistance( nVal );
1218 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1219 aXDash.SetDots(1);
1221 SetDashValue( aXDash );
1222 break;
1226 return true;
1229 sal_Bool XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
1231 return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue();
1234 XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const
1236 if( pModel )
1238 const String aUniqueName = NameOrIndex::CheckNamedItem(
1239 this, XATTR_LINEDASH, &pModel->GetItemPool(),
1240 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
1241 XLineDashItem::CompareValueFunc, RID_SVXSTR_DASH11,
1242 pModel->GetPropertyList( XDASH_LIST ) );
1244 // if the given name is not valid, replace it!
1245 if( aUniqueName != GetName() )
1246 return new XLineDashItem( aUniqueName, aDash );
1249 return (XLineDashItem*)this;
1252 // -------------------
1253 // class XLineWidthItem
1254 // -------------------
1255 TYPEINIT1_AUTOFACTORY(XLineWidthItem, SfxMetricItem);
1257 /*************************************************************************
1259 |* XLineWidthItem::XLineWidthItem(long nWidth)
1261 *************************************************************************/
1263 XLineWidthItem::XLineWidthItem(long nWidth) :
1264 SfxMetricItem(XATTR_LINEWIDTH, nWidth)
1268 /*************************************************************************
1270 |* XLineWidthItem::XLineWidthItem(SvStream& rIn)
1272 *************************************************************************/
1274 XLineWidthItem::XLineWidthItem(SvStream& rIn) :
1275 SfxMetricItem(XATTR_LINEWIDTH, rIn)
1279 /*************************************************************************
1281 |* XLineWidthItem::Clone(SfxItemPool* pPool) const
1283 *************************************************************************/
1285 SfxPoolItem* XLineWidthItem::Clone(SfxItemPool* /*pPool*/) const
1287 return new XLineWidthItem(*this);
1290 /*************************************************************************
1292 |* SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1294 *************************************************************************/
1296 SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1298 return new XLineWidthItem(rIn);
1301 //------------------------------------------------------------------------
1303 SfxItemPresentation XLineWidthItem::GetPresentation
1305 SfxItemPresentation ePres,
1306 SfxMapUnit eCoreUnit,
1307 SfxMapUnit ePresUnit,
1308 OUString& rText, const IntlWrapper * pIntl
1309 ) const
1311 switch ( ePres )
1313 case SFX_ITEM_PRESENTATION_NONE:
1314 rText = OUString();
1315 return ePres;
1316 case SFX_ITEM_PRESENTATION_NAMELESS:
1317 case SFX_ITEM_PRESENTATION_COMPLETE:
1318 rText = GetMetricText( (long) GetValue(),
1319 eCoreUnit, ePresUnit, pIntl) +
1320 EE_RESSTR( GetMetricId( ePresUnit) );
1321 return ePres;
1322 default:
1323 return SFX_ITEM_PRESENTATION_NONE;
1327 bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1329 sal_Int32 nValue = GetValue();
1330 if( 0 != (nMemberId&CONVERT_TWIPS) )
1331 nValue = TWIP_TO_MM100(nValue);
1333 rVal <<= nValue;
1334 return true;
1337 bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1339 sal_Int32 nValue = 0;
1340 rVal >>= nValue;
1341 if( 0 != (nMemberId&CONVERT_TWIPS) )
1342 nValue = MM100_TO_TWIP(nValue);
1344 SetValue( nValue );
1345 return true;
1348 // -------------------
1349 // class XLineColorItem
1350 // -------------------
1351 TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
1353 /*************************************************************************
1355 |* XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor)
1357 *************************************************************************/
1359 XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) :
1360 XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
1364 /*************************************************************************
1366 |* XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor)
1368 *************************************************************************/
1370 XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) :
1371 XColorItem(XATTR_LINECOLOR, rName, rTheColor)
1375 /*************************************************************************
1377 |* XLineColorItem::XLineColorItem(SvStream& rIn)
1379 *************************************************************************/
1381 XLineColorItem::XLineColorItem(SvStream& rIn) :
1382 XColorItem(XATTR_LINECOLOR, rIn)
1386 /*************************************************************************
1388 |* XLineColorItem::Clone(SfxItemPool* pPool) const
1390 *************************************************************************/
1392 SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const
1394 return new XLineColorItem(*this);
1397 /*************************************************************************
1399 |* SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1401 *************************************************************************/
1403 SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1405 return new XLineColorItem(rIn);
1408 //------------------------------------------------------------------------
1410 SfxItemPresentation XLineColorItem::GetPresentation
1412 SfxItemPresentation ePres,
1413 SfxMapUnit /*eCoreUnit*/,
1414 SfxMapUnit /*ePresUnit*/,
1415 OUString& rText, const IntlWrapper *
1416 ) const
1418 switch ( ePres )
1420 case SFX_ITEM_PRESENTATION_NONE:
1421 rText = OUString();
1422 return ePres;
1423 case SFX_ITEM_PRESENTATION_NAMELESS:
1424 case SFX_ITEM_PRESENTATION_COMPLETE:
1425 rText = GetName();
1426 return ePres;
1427 default:
1428 return SFX_ITEM_PRESENTATION_NONE;
1432 bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1434 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
1435 return true;
1438 bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1440 sal_Int32 nValue = 0;
1441 if(!(rVal >>= nValue))
1442 return false;
1444 SetColorValue( nValue );
1445 return true;
1448 //////////////////////////////////////////////////////////////////////////////
1449 // tooling for simple spooling B2DPolygon to file and back
1451 namespace
1453 void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut)
1455 const sal_uInt32 nPolygonCount(rPolyPolygon.count());
1456 rOut << nPolygonCount;
1458 for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1460 const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
1461 const sal_uInt32 nPointCount(aCandidate.count());
1462 const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0);
1463 const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0);
1464 rOut << nPointCount;
1465 rOut << bClosed;
1466 rOut << bControlPoints;
1468 for(sal_uInt32 b(0L); b < nPointCount; b++)
1470 const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b));
1471 rOut << aPoint.getX();
1472 rOut << aPoint.getY();
1474 if(bControlPoints)
1476 const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0);
1477 rOut << bEdgeIsCurve;
1479 if(bEdgeIsCurve)
1481 const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b));
1482 rOut << aControlVectorA.getX();
1483 rOut << aControlVectorA.getY();
1485 const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b));
1486 rOut << aControlVectorB.getX();
1487 rOut << aControlVectorB.getY();
1494 basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn)
1496 basegfx::B2DPolyPolygon aRetval;
1497 sal_uInt32 nPolygonCount;
1498 rIn >> nPolygonCount;
1500 for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1502 sal_uInt32 nPointCount;
1503 sal_uInt8 bClosed;
1504 sal_uInt8 bControlPoints;
1506 rIn >> nPointCount;
1507 rIn >> bClosed;
1508 rIn >> bControlPoints;
1510 basegfx::B2DPolygon aCandidate;
1511 aCandidate.setClosed(0 != bClosed);
1513 for(sal_uInt32 b(0L); b < nPointCount; b++)
1515 double fX, fY;
1516 rIn >> fX;
1517 rIn >> fY;
1518 aCandidate.append(basegfx::B2DPoint(fX, fY));
1520 if(0 != bControlPoints)
1522 sal_uInt8 bEdgeIsCurve;
1523 rIn >> bEdgeIsCurve;
1525 if(0 != bEdgeIsCurve)
1527 rIn >> fX;
1528 rIn >> fY;
1529 aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY));
1531 rIn >> fX;
1532 rIn >> fY;
1533 aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY));
1538 aRetval.append(aCandidate);
1541 return aRetval;
1545 //////////////////////////////////////////////////////////////////////////////
1547 // -----------------------
1548 // class XLineStartItem
1549 // -----------------------
1550 TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
1552 /*************************************************************************
1554 |* XLineStartItem::XLineStartItem(sal_Int32 nIndex)
1556 *************************************************************************/
1558 XLineStartItem::XLineStartItem(sal_Int32 nIndex)
1559 : NameOrIndex(XATTR_LINESTART, nIndex)
1563 /*************************************************************************
1565 |* XLineStartItem::XLineStartItem(const XubString& rName,
1566 |* const basegfx::B2DPolyPolygon& rXPolygon)
1568 *************************************************************************/
1570 XLineStartItem::XLineStartItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1571 : NameOrIndex(XATTR_LINESTART, rName),
1572 maPolyPolygon(rPolyPolygon)
1576 /*************************************************************************
1578 |* XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1580 *************************************************************************/
1582 XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1583 : NameOrIndex(rItem),
1584 maPolyPolygon(rItem.maPolyPolygon)
1588 /*************************************************************************
1590 |* XLineStartItem::XLineStartItem(SvStream& rIn)
1592 *************************************************************************/
1594 XLineStartItem::XLineStartItem(SvStream& rIn) :
1595 NameOrIndex(XATTR_LINESTART, rIn)
1597 if (!IsIndex())
1599 maPolyPolygon = streamInB2DPolyPolygon(rIn);
1603 //*************************************************************************
1605 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
1606 : NameOrIndex( XATTR_LINESTART, -1 ),
1607 maPolyPolygon(rPolyPolygon)
1611 /*************************************************************************
1613 |* XLineStartItem::Clone(SfxItemPool* pPool) const
1615 *************************************************************************/
1617 SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const
1619 return new XLineStartItem(*this);
1622 /*************************************************************************
1624 |* int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1626 *************************************************************************/
1628 int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1630 return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon );
1633 /*************************************************************************
1635 |* SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1637 *************************************************************************/
1639 SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1641 return new XLineStartItem(rIn);
1644 /*************************************************************************
1646 |* SfxPoolItem* XLineStartItem::Store(SvStream& rOut) const
1648 *************************************************************************/
1650 SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
1652 NameOrIndex::Store( rOut, nItemVersion );
1654 if (!IsIndex())
1656 streamOutB2DPolyPolygon(maPolyPolygon, rOut);
1659 return rOut;
1662 /*************************************************************************
1664 |* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue() const
1666 *************************************************************************/
1668 basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue() const
1670 //if (!IsIndex())
1671 // return maPolyPolygon;
1672 //else
1673 // return pTable->GetLineEnd(GetIndex())->GetLineEnd();
1674 return maPolyPolygon;
1677 //------------------------------------------------------------------------
1679 SfxItemPresentation XLineStartItem::GetPresentation
1681 SfxItemPresentation ePres,
1682 SfxMapUnit /*eCoreUnit*/,
1683 SfxMapUnit /*ePresUnit*/,
1684 OUString& rText, const IntlWrapper *
1685 ) const
1687 switch ( ePres )
1689 case SFX_ITEM_PRESENTATION_NONE:
1690 rText = OUString();
1691 return ePres;
1692 case SFX_ITEM_PRESENTATION_NAMELESS:
1693 case SFX_ITEM_PRESENTATION_COMPLETE:
1694 rText = GetName();
1695 return ePres;
1696 default:
1697 return SFX_ITEM_PRESENTATION_NONE;
1701 bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1703 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1704 nMemberId &= ~CONVERT_TWIPS;
1705 if( nMemberId == MID_NAME )
1707 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
1708 rVal <<= aApiName;
1710 else
1712 com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
1713 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
1714 rVal <<= aBezier;
1717 return true;
1720 bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1722 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1723 nMemberId &= ~CONVERT_TWIPS;
1724 if( nMemberId == MID_NAME )
1726 return false;
1728 else
1730 maPolyPolygon.clear();
1732 if( rVal.hasValue() && rVal.getValue() )
1734 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
1735 return false;
1737 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
1738 if( pCoords->Coordinates.getLength() > 0 )
1740 maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
1741 // #i72807# close line start/end polygons hard
1742 // maPolyPolygon.setClosed(true);
1747 return true;
1750 /** this function searches in both the models pool and the styles pool for XLineStartItem
1751 and XLineEndItem with the same value or name and returns an item with the value of
1752 this item and a unique name for an item with this value. */
1753 XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
1755 if( pModel )
1757 XLineStartItem* pTempItem = NULL;
1758 const XLineStartItem* pLineStartItem = this;
1760 String aUniqueName( GetName() );
1762 if( !maPolyPolygon.count() )
1764 // if the polygon is empty, check if the name is empty
1765 if( aUniqueName.Len() == 0 )
1766 return (XLineStartItem*)this;
1768 // force empty name for empty polygons
1769 return new XLineStartItem( String(), maPolyPolygon );
1772 if( maPolyPolygon.count() > 1L )
1774 // check if the polygon is closed
1775 if(!maPolyPolygon.isClosed())
1777 // force a closed polygon
1778 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
1779 aNew.setClosed(true);
1780 pTempItem = new XLineStartItem( aUniqueName, aNew );
1781 pLineStartItem = pTempItem;
1785 bool bForceNew = false;
1787 // 2. if we have a name check if there is already an item with the
1788 // same name in the documents pool with a different line end or start
1790 sal_uInt32 nCount, nSurrogate;
1792 const SfxItemPool* pPool1 = &pModel->GetItemPool();
1793 if( aUniqueName.Len() && pPool1 )
1795 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
1797 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
1799 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
1801 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1803 // if there is already an item with the same name and the same
1804 // value its ok to set it
1805 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
1807 // same name but different value, we need a new name for this item
1808 aUniqueName = String();
1809 bForceNew = true;
1811 break;
1815 if( !bForceNew )
1817 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
1819 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
1821 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
1823 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1825 // if there is already an item with the same name and the same
1826 // value its ok to set it
1827 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
1829 // same name but different value, we need a new name for this item
1830 aUniqueName = String();
1831 bForceNew = true;
1833 break;
1839 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
1840 if( aUniqueName.Len() && pPool2)
1842 nCount = pPool2->GetItemCount2( XATTR_LINESTART );
1843 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
1845 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
1847 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1849 // if there is already an item with the same name and the same
1850 // value its ok to set it
1851 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
1853 // same name but different value, we need a new name for this item
1854 aUniqueName = String();
1855 bForceNew = true;
1857 break;
1861 if( !bForceNew )
1863 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
1864 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
1866 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
1868 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1870 // if there is already an item with the same name and the same
1871 // value its ok to set it
1872 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
1874 // same name but different value, we need a new name for this item
1875 aUniqueName = String();
1876 bForceNew = true;
1878 break;
1884 // if we have no name yet, find existing item with same conent or
1885 // create a unique name
1886 if( aUniqueName.Len() == 0 )
1888 bool bFoundExisting = false;
1890 sal_Int32 nUserIndex = 1;
1891 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
1892 const String aUser( aRes );
1894 if( pPool1 )
1896 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
1897 sal_uInt32 nSurrogate2;
1899 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
1901 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
1903 if( pItem && pItem->GetName().Len() )
1905 if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
1907 aUniqueName = pItem->GetName();
1908 bFoundExisting = true;
1909 break;
1912 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
1914 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
1915 if( nThisIndex >= nUserIndex )
1916 nUserIndex = nThisIndex + 1;
1921 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
1922 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
1924 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
1926 if( pItem && pItem->GetName().Len() )
1928 if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
1930 aUniqueName = pItem->GetName();
1931 bFoundExisting = true;
1932 break;
1935 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
1937 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
1938 if( nThisIndex >= nUserIndex )
1939 nUserIndex = nThisIndex + 1;
1945 if( !bFoundExisting )
1947 aUniqueName = aUser;
1948 aUniqueName += sal_Unicode(' ');
1949 aUniqueName += OUString::number( nUserIndex );
1953 // if the given name is not valid, replace it!
1954 if( aUniqueName != GetName() || pTempItem )
1956 if( pTempItem )
1958 pTempItem->SetName( aUniqueName );
1959 return pTempItem;
1961 else
1963 return new XLineStartItem( aUniqueName, maPolyPolygon );
1968 return (XLineStartItem*)this;
1971 // ---------------------
1972 // class XLineEndItem
1973 // ---------------------
1974 TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
1976 /*************************************************************************
1978 |* XLineEndItem::XLineEndItem(sal_Int32 nIndex)
1980 *************************************************************************/
1982 XLineEndItem::XLineEndItem(sal_Int32 nIndex)
1983 : NameOrIndex(XATTR_LINEEND, nIndex)
1987 /*************************************************************************
1989 |* XLineEndItem::XLineEndItem(const XubString& rName,
1990 |* const basegfx::B2DPolyPolygon& rXPolygon)
1992 *************************************************************************/
1994 XLineEndItem::XLineEndItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1995 : NameOrIndex(XATTR_LINEEND, rName),
1996 maPolyPolygon(rPolyPolygon)
2000 /*************************************************************************
2002 |* XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2004 *************************************************************************/
2006 XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2007 : NameOrIndex(rItem),
2008 maPolyPolygon(rItem.maPolyPolygon)
2012 /*************************************************************************
2014 |* XLineEndItem::XLineEndItem(SvStream& rIn)
2016 *************************************************************************/
2018 XLineEndItem::XLineEndItem(SvStream& rIn) :
2019 NameOrIndex(XATTR_LINEEND, rIn)
2021 if (!IsIndex())
2023 maPolyPolygon = streamInB2DPolyPolygon(rIn);
2027 //*************************************************************************
2029 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
2030 : NameOrIndex( XATTR_LINEEND, -1 ),
2031 maPolyPolygon(rPolyPolygon)
2035 /*************************************************************************
2037 |* XLineEndItem::Clone(SfxItemPool* pPool) const
2039 *************************************************************************/
2041 SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const
2043 return new XLineEndItem(*this);
2046 /*************************************************************************
2048 |* int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2050 *************************************************************************/
2052 int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2054 return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon );
2057 /*************************************************************************
2059 |* SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2061 *************************************************************************/
2063 SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2065 return new XLineEndItem(rIn);
2068 /*************************************************************************
2070 |* SfxPoolItem* XLineEndItem::Store(SvStream& rOut) const
2072 *************************************************************************/
2074 SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
2076 NameOrIndex::Store( rOut, nItemVersion );
2078 if (!IsIndex())
2080 streamOutB2DPolyPolygon(maPolyPolygon, rOut);
2083 return rOut;
2086 /*************************************************************************
2088 |* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue() const
2090 *************************************************************************/
2092 basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue() const
2094 //if (!IsIndex())
2095 // return maPolyPolygon;
2096 //else
2097 // return pTable->GetLineEnd(GetIndex())->GetLineEnd();
2098 return maPolyPolygon;
2102 /** this function searches in both the models pool and the styles pool for XLineStartItem
2103 and XLineEndItem with the same value or name and returns an item with the value of
2104 this item and a unique name for an item with this value. */
2105 XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
2107 if( pModel )
2109 XLineEndItem* pTempItem = NULL;
2110 const XLineEndItem* pLineEndItem = this;
2112 String aUniqueName( GetName() );
2114 if( !maPolyPolygon.count() )
2116 // if the polygon is empty, check if the name is empty
2117 if( aUniqueName.Len() == 0 )
2118 return (XLineEndItem*)this;
2120 // force empty name for empty polygons
2121 return new XLineEndItem( String(), maPolyPolygon );
2124 if( maPolyPolygon.count() > 1L )
2126 // check if the polygon is closed
2127 if(!maPolyPolygon.isClosed())
2129 // force a closed polygon
2130 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
2131 aNew.setClosed(true);
2132 pTempItem = new XLineEndItem( aUniqueName, aNew );
2133 pLineEndItem = pTempItem;
2137 bool bForceNew = false;
2139 // 2. if we have a name check if there is already an item with the
2140 // same name in the documents pool with a different line end or start
2142 sal_uInt16 nCount, nSurrogate;
2144 const SfxItemPool* pPool1 = &pModel->GetItemPool();
2145 if( aUniqueName.Len() && pPool1 )
2147 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2149 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2151 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
2153 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2155 // if there is already an item with the same name and the same
2156 // value its ok to set it
2157 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2159 // same name but different value, we need a new name for this item
2160 aUniqueName = String();
2161 bForceNew = true;
2163 break;
2167 if( !bForceNew )
2169 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2171 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2173 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
2175 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2177 // if there is already an item with the same name and the same
2178 // value its ok to set it
2179 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2181 // same name but different value, we need a new name for this item
2182 aUniqueName = String();
2183 bForceNew = true;
2185 break;
2191 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2192 if( aUniqueName.Len() && pPool2)
2194 nCount = pPool2->GetItemCount2( XATTR_LINESTART );
2195 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2197 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
2199 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2201 // if there is already an item with the same name and the same
2202 // value its ok to set it
2203 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2205 // same name but different value, we need a new name for this item
2206 aUniqueName = String();
2207 bForceNew = true;
2209 break;
2213 if( !bForceNew )
2215 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
2216 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2218 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
2220 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2222 // if there is already an item with the same name and the same
2223 // value its ok to set it
2224 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2226 // same name but different value, we need a new name for this item
2227 aUniqueName = String();
2228 bForceNew = true;
2230 break;
2236 // if we have no name yet, find existing item with same conent or
2237 // create a unique name
2238 if( aUniqueName.Len() == 0 )
2240 bool bFoundExisting = false;
2242 sal_Int32 nUserIndex = 1;
2243 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2244 const String aUser( aRes );
2246 if( pPool1 )
2248 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2249 sal_uInt32 nSurrogate2;
2251 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2253 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
2255 if( pItem && pItem->GetName().Len() )
2257 if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
2259 aUniqueName = pItem->GetName();
2260 bFoundExisting = true;
2261 break;
2264 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2266 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2267 if( nThisIndex >= nUserIndex )
2268 nUserIndex = nThisIndex + 1;
2273 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2274 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2276 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
2278 if( pItem && pItem->GetName().Len() )
2280 if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
2282 aUniqueName = pItem->GetName();
2283 bFoundExisting = true;
2284 break;
2287 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2289 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2290 if( nThisIndex >= nUserIndex )
2291 nUserIndex = nThisIndex + 1;
2297 if( !bFoundExisting )
2299 aUniqueName = aUser;
2300 aUniqueName += sal_Unicode(' ');
2301 aUniqueName += OUString::number( nUserIndex );
2305 // if the given name is not valid, replace it!
2306 if( aUniqueName != GetName() || pTempItem )
2308 if( pTempItem )
2310 pTempItem->SetName( aUniqueName );
2311 return pTempItem;
2313 else
2315 return new XLineEndItem( aUniqueName, maPolyPolygon );
2320 return (XLineEndItem*)this;
2324 //------------------------------------------------------------------------
2326 SfxItemPresentation XLineEndItem::GetPresentation
2328 SfxItemPresentation ePres,
2329 SfxMapUnit /*eCoreUnit*/,
2330 SfxMapUnit /*ePresUnit*/,
2331 OUString& rText, const IntlWrapper *
2332 ) const
2334 switch ( ePres )
2336 case SFX_ITEM_PRESENTATION_NONE:
2337 rText = OUString();
2338 return ePres;
2339 case SFX_ITEM_PRESENTATION_NAMELESS:
2340 case SFX_ITEM_PRESENTATION_COMPLETE:
2341 rText = GetName();
2342 return ePres;
2343 default:
2344 return SFX_ITEM_PRESENTATION_NONE;
2348 bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
2350 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2351 nMemberId &= ~CONVERT_TWIPS;
2352 if( nMemberId == MID_NAME )
2354 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
2355 rVal <<= aApiName;
2357 else
2359 com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
2360 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
2361 rVal <<= aBezier;
2363 return true;
2366 bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
2368 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2369 nMemberId &= ~CONVERT_TWIPS;
2370 if( nMemberId == MID_NAME )
2372 return false;
2374 else
2376 maPolyPolygon.clear();
2378 if( rVal.hasValue() && rVal.getValue() )
2380 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
2381 return false;
2383 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
2384 if( pCoords->Coordinates.getLength() > 0 )
2386 maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
2387 // #i72807# close line start/end polygons hard
2388 // maPolyPolygon.setClosed(true);
2393 return true;
2396 // ----------------------------
2397 // class XLineStartWidthItem
2398 // ----------------------------
2399 TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
2401 /*************************************************************************
2403 |* XLineStartWidthItem::XLineStartWidthItem(sal_Int32 nWidth)
2405 *************************************************************************/
2407 XLineStartWidthItem::XLineStartWidthItem(long nWidth) :
2408 SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth)
2412 /*************************************************************************
2414 |* XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn)
2416 *************************************************************************/
2418 XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) :
2419 SfxMetricItem(XATTR_LINESTARTWIDTH, rIn)
2423 /*************************************************************************
2425 |* XLineStartWidthItem::Clone(SfxItemPool* pPool) const
2427 *************************************************************************/
2429 SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const
2431 return new XLineStartWidthItem(*this);
2434 /*************************************************************************
2436 |* SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 nVer)
2437 |* const
2439 *************************************************************************/
2441 SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2443 return new XLineStartWidthItem(rIn);
2446 //------------------------------------------------------------------------
2448 SfxItemPresentation XLineStartWidthItem::GetPresentation
2450 SfxItemPresentation ePres,
2451 SfxMapUnit eCoreUnit,
2452 SfxMapUnit ePresUnit,
2453 OUString& rText, const IntlWrapper * pIntl
2454 ) const
2456 switch ( ePres )
2458 case SFX_ITEM_PRESENTATION_NONE:
2459 rText = OUString();
2460 return ePres;
2461 case SFX_ITEM_PRESENTATION_NAMELESS:
2462 case SFX_ITEM_PRESENTATION_COMPLETE:
2463 rText = GetMetricText( (long) GetValue(),
2464 eCoreUnit, ePresUnit, pIntl) +
2465 EE_RESSTR( GetMetricId( ePresUnit) );
2466 return ePres;
2467 default:
2468 return SFX_ITEM_PRESENTATION_NONE;
2472 bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2474 rVal <<= (sal_Int32)GetValue();
2475 return true;
2478 bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2480 sal_Int32 nValue = 0;
2481 rVal >>= nValue;
2482 SetValue( nValue );
2483 return true;
2488 // --------------------------
2489 // class XLineEndWidthItem
2490 // --------------------------
2491 TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem);
2493 /*************************************************************************
2495 |* XLineEndWidthItem::XLineEndWidthItem(long nWidth)
2497 *************************************************************************/
2499 XLineEndWidthItem::XLineEndWidthItem(long nWidth) :
2500 SfxMetricItem(XATTR_LINEENDWIDTH, nWidth)
2504 /*************************************************************************
2506 |* XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn)
2508 *************************************************************************/
2510 XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) :
2511 SfxMetricItem(XATTR_LINEENDWIDTH, rIn)
2515 /*************************************************************************
2517 |* XLineEndWidthItem::Clone(SfxItemPool* pPool) const
2519 *************************************************************************/
2521 SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const
2523 return new XLineEndWidthItem(*this);
2526 /*************************************************************************
2528 |* SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2530 *************************************************************************/
2532 SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2534 return new XLineEndWidthItem(rIn);
2537 //------------------------------------------------------------------------
2539 SfxItemPresentation XLineEndWidthItem::GetPresentation
2541 SfxItemPresentation ePres,
2542 SfxMapUnit eCoreUnit,
2543 SfxMapUnit ePresUnit,
2544 OUString& rText, const IntlWrapper *pIntl
2545 ) const
2547 switch ( ePres )
2549 case SFX_ITEM_PRESENTATION_NONE:
2550 rText = OUString();
2551 return ePres;
2552 case SFX_ITEM_PRESENTATION_NAMELESS:
2553 case SFX_ITEM_PRESENTATION_COMPLETE:
2554 rText = GetMetricText( (long) GetValue(),
2555 eCoreUnit, ePresUnit, pIntl) +
2556 EE_RESSTR( GetMetricId( ePresUnit) );
2557 return ePres;
2558 default:
2559 return SFX_ITEM_PRESENTATION_NONE;
2563 bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2565 rVal <<= (sal_Int32)GetValue();
2566 return true;
2569 bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2571 sal_Int32 nValue = 0;
2572 rVal >>= nValue;
2573 SetValue( nValue );
2574 return true;
2578 // -----------------------------
2579 // class XLineStartCenterItem
2580 // -----------------------------
2581 TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem);
2583 /*************************************************************************
2585 |* XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter)
2587 *************************************************************************/
2589 XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter) :
2590 SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
2594 /*************************************************************************
2596 |* XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn)
2598 *************************************************************************/
2600 XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) :
2601 SfxBoolItem(XATTR_LINESTARTCENTER, rIn)
2605 /*************************************************************************
2607 |* XLineStartCenterItem::Clone(SfxItemPool* pPool) const
2609 *************************************************************************/
2611 SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const
2613 return new XLineStartCenterItem(*this);
2616 /*************************************************************************
2618 |* SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
2619 |* const
2621 *************************************************************************/
2623 SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2625 return new XLineStartCenterItem(rIn);
2628 //------------------------------------------------------------------------
2630 SfxItemPresentation XLineStartCenterItem::GetPresentation
2632 SfxItemPresentation ePres,
2633 SfxMapUnit /*eCoreUnit*/,
2634 SfxMapUnit /*ePresUnit*/,
2635 OUString& rText, const IntlWrapper *
2636 ) const
2638 switch ( ePres )
2640 case SFX_ITEM_PRESENTATION_NONE:
2641 rText = OUString();
2642 return ePres;
2643 case SFX_ITEM_PRESENTATION_NAMELESS:
2644 case SFX_ITEM_PRESENTATION_COMPLETE:
2645 rText = OUString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
2646 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
2647 return ePres;
2648 default:
2649 return SFX_ITEM_PRESENTATION_NONE;
2653 bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2655 sal_Bool bValue = GetValue();
2656 rVal.setValue( &bValue, ::getCppuBooleanType() );
2657 return true;
2660 bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2662 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
2663 return false;
2665 SetValue( *(sal_Bool*)rVal.getValue() );
2666 return true;
2670 // ---------------------------
2671 // class XLineEndCenterItem
2672 // ---------------------------
2673 TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem);
2675 /*************************************************************************
2677 |* XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter)
2679 *************************************************************************/
2681 XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter) :
2682 SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
2686 /*************************************************************************
2688 |* XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn)
2690 *************************************************************************/
2692 XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) :
2693 SfxBoolItem(XATTR_LINEENDCENTER, rIn)
2697 /*************************************************************************
2699 |* XLineEndCenterItem::Clone(SfxItemPool* pPool) const
2701 *************************************************************************/
2703 SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const
2705 return new XLineEndCenterItem(*this);
2708 /*************************************************************************
2710 |* SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
2711 |* const
2713 *************************************************************************/
2715 SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2717 return new XLineEndCenterItem(rIn);
2720 //------------------------------------------------------------------------
2722 SfxItemPresentation XLineEndCenterItem::GetPresentation
2724 SfxItemPresentation ePres,
2725 SfxMapUnit /*eCoreUnit*/,
2726 SfxMapUnit /*ePresUnit*/,
2727 OUString& rText, const IntlWrapper *
2728 ) const
2730 switch ( ePres )
2732 case SFX_ITEM_PRESENTATION_NONE:
2733 rText = OUString();
2734 return ePres;
2735 case SFX_ITEM_PRESENTATION_NAMELESS:
2736 case SFX_ITEM_PRESENTATION_COMPLETE:
2737 rText = OUString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
2738 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
2739 return ePres;
2740 default:
2741 return SFX_ITEM_PRESENTATION_NONE;
2745 bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2747 sal_Bool bValue = GetValue();
2748 rVal.setValue( &bValue, ::getCppuBooleanType() );
2749 return true;
2752 bool XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2754 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
2755 return false;
2757 SetValue( *(sal_Bool*)rVal.getValue() );
2758 return true;
2762 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2763 // Fuellattribute
2764 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2766 // --------------------
2767 // class XFillStyleItem
2768 // --------------------
2769 TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem);
2771 /*************************************************************************
2773 |* XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle)
2775 *************************************************************************/
2777 XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) :
2778 SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle))
2782 XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle, sal_uInt16 nWhich_) :
2783 SfxEnumItem(nWhich_, sal::static_int_cast< sal_uInt16 >(eFillStyle))
2787 /*************************************************************************
2789 |* XFillStyleItem::XFillStyleItem(SvStream& rIn)
2791 *************************************************************************/
2793 XFillStyleItem::XFillStyleItem(SvStream& rIn) :
2794 SfxEnumItem(XATTR_FILLSTYLE, rIn)
2798 /*************************************************************************
2800 |* XFillStyleItem::Clone(SfxItemPool* pPool) const
2802 *************************************************************************/
2804 SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const
2806 return new XFillStyleItem( *this );
2809 /*************************************************************************
2811 |* SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2813 *************************************************************************/
2815 SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2817 return new XFillStyleItem(rIn);
2820 //------------------------------------------------------------------------
2822 SfxItemPresentation XFillStyleItem::GetPresentation
2824 SfxItemPresentation ePres,
2825 SfxMapUnit /*eCoreUnit*/,
2826 SfxMapUnit /*ePresUnit*/,
2827 OUString& rText, const IntlWrapper *
2828 ) const
2830 rText = OUString();
2832 switch ( ePres )
2834 case SFX_ITEM_PRESENTATION_NONE:
2835 return ePres;
2837 case SFX_ITEM_PRESENTATION_NAMELESS:
2838 case SFX_ITEM_PRESENTATION_COMPLETE:
2840 sal_uInt16 nId = 0;
2842 switch( (sal_uInt16)GetValue() )
2844 case XFILL_NONE:
2845 nId = RID_SVXSTR_INVISIBLE;
2846 break;
2847 case XFILL_SOLID:
2848 nId = RID_SVXSTR_SOLID;
2849 break;
2850 case XFILL_GRADIENT:
2851 nId = RID_SVXSTR_GRADIENT;
2852 break;
2853 case XFILL_HATCH:
2854 nId = RID_SVXSTR_HATCH;
2855 break;
2856 case XFILL_BITMAP:
2857 nId = RID_SVXSTR_BITMAP;
2858 break;
2861 if ( nId )
2862 rText = SVX_RESSTR( nId );
2863 return ePres;
2865 default:
2866 return SFX_ITEM_PRESENTATION_NONE;
2870 //------------------------------------------------------------------------
2872 sal_uInt16 XFillStyleItem::GetValueCount() const
2874 return 5;
2877 // -----------------------------------------------------------------------
2878 bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2880 ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue();
2882 rVal <<= eFS;
2884 return true;
2887 // -----------------------------------------------------------------------
2888 bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2890 ::com::sun::star::drawing::FillStyle eFS;
2891 if(!(rVal >>= eFS))
2893 // also try an int (for Basic)
2894 sal_Int32 nFS = 0;
2895 if(!(rVal >>= nFS))
2896 return false;
2897 eFS = (::com::sun::star::drawing::FillStyle)nFS;
2900 SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) );
2902 return true;
2906 // -------------------
2907 // class XFillColorItem
2908 // -------------------
2909 TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
2911 /*************************************************************************
2913 |* XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor)
2915 *************************************************************************/
2917 XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
2918 XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
2922 /*************************************************************************
2924 |* XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor)
2926 *************************************************************************/
2928 XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) :
2929 XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
2933 /*************************************************************************
2935 |* XFillColorItem::XFillColorItem(SvStream& rIn)
2937 *************************************************************************/
2939 XFillColorItem::XFillColorItem(SvStream& rIn) :
2940 XColorItem(XATTR_FILLCOLOR, rIn)
2944 /*************************************************************************
2946 |* XFillColorItem::Clone(SfxItemPool* pPool) const
2948 *************************************************************************/
2950 SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const
2952 return new XFillColorItem(*this);
2955 /*************************************************************************
2957 |* SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2959 *************************************************************************/
2961 SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2963 return new XFillColorItem(rIn);
2966 //------------------------------------------------------------------------
2968 SfxItemPresentation XFillColorItem::GetPresentation
2970 SfxItemPresentation ePres,
2971 SfxMapUnit /*eCoreUnit*/,
2972 SfxMapUnit /*ePresUnit*/,
2973 OUString& rText, const IntlWrapper *
2974 ) const
2976 switch ( ePres )
2978 case SFX_ITEM_PRESENTATION_NONE:
2979 rText = OUString();
2980 return ePres;
2981 case SFX_ITEM_PRESENTATION_NAMELESS:
2982 case SFX_ITEM_PRESENTATION_COMPLETE:
2983 rText = GetName();
2984 return ePres;
2985 default:
2986 return SFX_ITEM_PRESENTATION_NONE;
2990 // -----------------------------------------------------------------------
2992 bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2994 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
2996 return true;
2999 // -----------------------------------------------------------------------
3001 bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3003 sal_Int32 nValue = 0;
3004 if(!(rVal >>= nValue ))
3005 return false;
3007 SetColorValue( nValue );
3008 return true;
3011 // -----------------------------
3012 // class XSecondaryFillColorItem
3013 // -----------------------------
3014 TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
3016 XSecondaryFillColorItem::XSecondaryFillColorItem(const XubString& rName, const Color& rTheColor) :
3017 XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
3021 XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) :
3022 XColorItem(XATTR_SECONDARYFILLCOLOR, rIn)
3026 SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3028 return new XSecondaryFillColorItem(*this);
3031 SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
3033 if ( nVer >= 2 )
3034 return new XSecondaryFillColorItem( rIn );
3035 else
3036 return new XSecondaryFillColorItem( String(), Color(0,184,255) );
3038 sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
3040 return 2;
3042 SfxItemPresentation XSecondaryFillColorItem::GetPresentation
3044 SfxItemPresentation ePres,
3045 SfxMapUnit /*eCoreUnit*/,
3046 SfxMapUnit /*ePresUnit*/,
3047 OUString& rText, const IntlWrapper *
3048 ) const
3050 switch ( ePres )
3052 case SFX_ITEM_PRESENTATION_NONE:
3053 rText = OUString();
3054 return ePres;
3055 case SFX_ITEM_PRESENTATION_NAMELESS:
3056 case SFX_ITEM_PRESENTATION_COMPLETE:
3057 rText = GetName();
3058 return ePres;
3059 default:
3060 return SFX_ITEM_PRESENTATION_NONE;
3064 // ----------------
3065 // class XGradient
3066 // ----------------
3068 /*************************************************************************
3070 |* XGradient::XGradient()
3072 *************************************************************************/
3074 XGradient::XGradient() :
3075 eStyle( XGRAD_LINEAR ),
3076 aStartColor( Color( COL_BLACK ) ),
3077 aEndColor( Color( COL_WHITE ) ),
3078 nAngle( 0 ),
3079 nBorder( 0 ),
3080 nOfsX( 50 ),
3081 nOfsY( 50 ),
3082 nIntensStart( 100 ),
3083 nIntensEnd( 100 ),
3084 nStepCount( 0 )
3088 /*************************************************************************
3090 |* XGradient::XGradient(XGradientStyle, const Color&, const Color&,
3091 |* long, sal_uInt16, sal_uInt16, sal_uInt16)
3093 *************************************************************************/
3095 XGradient::XGradient(const Color& rStart, const Color& rEnd,
3096 XGradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs,
3097 sal_uInt16 nYOfs, sal_uInt16 nTheBorder,
3098 sal_uInt16 nStartIntens, sal_uInt16 nEndIntens,
3099 sal_uInt16 nSteps) :
3100 eStyle(eTheStyle),
3101 aStartColor(rStart),
3102 aEndColor(rEnd),
3103 nAngle(nTheAngle),
3104 nBorder(nTheBorder),
3105 nOfsX(nXOfs),
3106 nOfsY(nYOfs),
3107 nIntensStart(nStartIntens),
3108 nIntensEnd(nEndIntens),
3109 nStepCount(nSteps)
3113 /*************************************************************************
3115 |* int XGradient::operator==(const SfxPoolItem& rItem) const
3117 *************************************************************************/
3119 bool XGradient::operator==(const XGradient& rGradient) const
3121 return ( eStyle == rGradient.eStyle &&
3122 aStartColor == rGradient.aStartColor &&
3123 aEndColor == rGradient.aEndColor &&
3124 nAngle == rGradient.nAngle &&
3125 nBorder == rGradient.nBorder &&
3126 nOfsX == rGradient.nOfsX &&
3127 nOfsY == rGradient.nOfsY &&
3128 nIntensStart == rGradient.nIntensStart &&
3129 nIntensEnd == rGradient.nIntensEnd &&
3130 nStepCount == rGradient.nStepCount );
3133 Gradient XGradient::VclGradient() const
3135 Gradient aGradient;
3136 aGradient.SetStyle((GradientStyle)eStyle);
3137 aGradient.SetStartColor(aStartColor);
3138 aGradient.SetEndColor(aEndColor);
3139 aGradient.SetAngle(nAngle);
3140 aGradient.SetBorder(nBorder);
3141 aGradient.SetOfsX(nOfsX);
3142 aGradient.SetOfsY(nOfsY);
3143 aGradient.SetStartIntensity(nIntensStart);
3144 aGradient.SetEndIntensity(nIntensEnd);
3145 aGradient.SetSteps(nStepCount);
3146 return aGradient;
3149 // -----------------------
3150 // class XFillGradientItem
3151 // -----------------------
3152 TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
3154 /*************************************************************************
3156 |* XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
3157 |* const XGradient& rTheGradient)
3159 *************************************************************************/
3161 XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
3162 const XGradient& rTheGradient) :
3163 NameOrIndex(XATTR_FILLGRADIENT, nIndex),
3164 aGradient(rTheGradient)
3168 /*************************************************************************
3170 |* XFillGradientItem::XFillGradientItem(const XubString& rName,
3171 |* const XGradient& rTheGradient)
3173 *************************************************************************/
3175 XFillGradientItem::XFillGradientItem(const OUString& rName,
3176 const XGradient& rTheGradient, sal_uInt16 nWhich)
3177 : NameOrIndex(nWhich, rName)
3178 , aGradient(rTheGradient)
3182 /*************************************************************************
3184 |* XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem)
3186 *************************************************************************/
3188 XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) :
3189 NameOrIndex(rItem),
3190 aGradient(rItem.aGradient)
3194 /*************************************************************************
3196 |* XFillGradientItem::XFillGradientItem(SvStream& rIn)
3198 *************************************************************************/
3200 XFillGradientItem::XFillGradientItem(SvStream& rIn, sal_uInt16 nVer) :
3201 NameOrIndex(XATTR_FILLGRADIENT, rIn),
3202 aGradient(COL_BLACK, COL_WHITE)
3204 if (!IsIndex())
3206 sal_uInt16 nUSTemp;
3207 sal_uInt16 nRed;
3208 sal_uInt16 nGreen;
3209 sal_uInt16 nBlue;
3210 sal_Int16 nITemp;
3211 sal_Int32 nLTemp;
3213 rIn >> nITemp; aGradient.SetGradientStyle((XGradientStyle)nITemp);
3214 rIn >> nRed;
3215 rIn >> nGreen;
3216 rIn >> nBlue;
3217 Color aCol;
3218 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3219 aGradient.SetStartColor( aCol );
3221 rIn >> nRed;
3222 rIn >> nGreen;
3223 rIn >> nBlue;
3224 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3225 aGradient.SetEndColor(aCol);
3226 rIn >> nLTemp; aGradient.SetAngle(nLTemp);
3227 rIn >> nUSTemp; aGradient.SetBorder(nUSTemp);
3228 rIn >> nUSTemp; aGradient.SetXOffset(nUSTemp);
3229 rIn >> nUSTemp; aGradient.SetYOffset(nUSTemp);
3230 rIn >> nUSTemp; aGradient.SetStartIntens(nUSTemp);
3231 rIn >> nUSTemp; aGradient.SetEndIntens(nUSTemp);
3233 // bei neueren Versionen wird zusaetzlich
3234 // die Schrittweite mit eingelesen
3235 if (nVer >= 1)
3237 rIn >> nUSTemp; aGradient.SetSteps(nUSTemp);
3242 //*************************************************************************
3244 XFillGradientItem::XFillGradientItem( const XGradient& rTheGradient )
3245 : NameOrIndex( XATTR_FILLGRADIENT, -1 ),
3246 aGradient(rTheGradient)
3250 /*************************************************************************
3252 |* XFillGradientItem::Clone(SfxItemPool* pPool) const
3254 *************************************************************************/
3256 SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const
3258 return new XFillGradientItem(*this);
3261 /*************************************************************************
3263 |* int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3265 *************************************************************************/
3267 int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3269 return ( NameOrIndex::operator==(rItem) &&
3270 aGradient == ((const XFillGradientItem&) rItem).aGradient );
3273 /*************************************************************************
3275 |* SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3277 *************************************************************************/
3279 SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3281 return new XFillGradientItem(rIn, nVer);
3284 /*************************************************************************
3286 |* SfxPoolItem* XFillGradientItem::Store(SvStream& rOut) const
3288 *************************************************************************/
3290 SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
3292 NameOrIndex::Store( rOut, nItemVersion );
3294 if (!IsIndex())
3296 rOut << (sal_Int16)aGradient.GetGradientStyle();
3298 sal_uInt16 nTmp;
3300 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut << nTmp;
3301 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut << nTmp;
3302 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut << nTmp;
3303 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut << nTmp;
3304 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut << nTmp;
3305 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut << nTmp;
3307 rOut << (sal_Int32) aGradient.GetAngle();
3308 rOut << aGradient.GetBorder();
3309 rOut << aGradient.GetXOffset();
3310 rOut << aGradient.GetYOffset();
3311 rOut << aGradient.GetStartIntens();
3312 rOut << aGradient.GetEndIntens();
3313 rOut << aGradient.GetSteps();
3316 return rOut;
3319 /*************************************************************************
3321 |* const XGradient& XFillGradientItem::GetValue(const XGradientList* pTable)
3322 |* const
3324 *************************************************************************/
3326 const XGradient& XFillGradientItem::GetGradientValue() const // GetValue -> GetGradientValue
3328 if (!IsIndex())
3329 return aGradient;
3330 // ToDo: This should fail. We never called this code with a table so this should always
3331 // have failed. Thus, I'm thinking that XFillGradientItem can't be an Index.
3332 return aGradient;
3336 /*************************************************************************
3338 |* sal_uInt16 XFillGradientItem::GetVersion() const
3340 *************************************************************************/
3342 sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
3344 // !!! this version number also represents the version number of superclasses
3345 // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here,
3346 // !!! the superclass is also affected
3347 return 1;
3350 //------------------------------------------------------------------------
3352 SfxItemPresentation XFillGradientItem::GetPresentation
3354 SfxItemPresentation ePres,
3355 SfxMapUnit /*eCoreUnit*/,
3356 SfxMapUnit /*ePresUnit*/,
3357 OUString& rText, const IntlWrapper *
3358 ) const
3360 switch ( ePres )
3362 case SFX_ITEM_PRESENTATION_NONE:
3363 rText = OUString();
3364 return ePres;
3365 case SFX_ITEM_PRESENTATION_NAMELESS:
3366 case SFX_ITEM_PRESENTATION_COMPLETE:
3367 rText = GetName();
3368 return ePres;
3369 default:
3370 return SFX_ITEM_PRESENTATION_NONE;
3374 // -----------------------------------------------------------------------
3375 bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
3377 //sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3378 nMemberId &= ~CONVERT_TWIPS;
3379 switch ( nMemberId )
3381 case 0:
3383 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
3385 ::com::sun::star::awt::Gradient aGradient2;
3387 const XGradient& aXGradient = GetGradientValue();
3388 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3389 aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
3390 aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
3391 aGradient2.Angle = (short)aXGradient.GetAngle();
3392 aGradient2.Border = aXGradient.GetBorder();
3393 aGradient2.XOffset = aXGradient.GetXOffset();
3394 aGradient2.YOffset = aXGradient.GetYOffset();
3395 aGradient2.StartIntensity = aXGradient.GetStartIntens();
3396 aGradient2.EndIntensity = aXGradient.GetEndIntens();
3397 aGradient2.StepCount = aXGradient.GetSteps();
3399 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
3400 aPropSeq[0].Name = OUString( "Name" );
3401 aPropSeq[0].Value = uno::makeAny( aApiName );
3402 aPropSeq[1].Name = OUString( "FillGradient" );
3403 aPropSeq[1].Value = uno::makeAny( aGradient2 );
3404 rVal = uno::makeAny( aPropSeq );
3405 break;
3408 case MID_FILLGRADIENT:
3410 const XGradient& aXGradient = GetGradientValue();
3411 ::com::sun::star::awt::Gradient aGradient2;
3413 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3414 aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
3415 aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
3416 aGradient2.Angle = (short)aXGradient.GetAngle();
3417 aGradient2.Border = aXGradient.GetBorder();
3418 aGradient2.XOffset = aXGradient.GetXOffset();
3419 aGradient2.YOffset = aXGradient.GetYOffset();
3420 aGradient2.StartIntensity = aXGradient.GetStartIntens();
3421 aGradient2.EndIntensity = aXGradient.GetEndIntens();
3422 aGradient2.StepCount = aXGradient.GetSteps();
3424 rVal <<= aGradient2;
3425 break;
3428 case MID_NAME:
3430 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
3431 rVal <<= aApiName;
3432 break;
3435 case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break;
3436 case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break;
3437 case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break;
3438 case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break;
3439 case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
3440 case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
3441 case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
3442 case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break;
3443 case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
3444 case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
3446 default: OSL_FAIL("Wrong MemberId!"); return false;
3449 return true;
3452 // -----------------------------------------------------------------------
3453 bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
3455 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3456 nMemberId &= ~CONVERT_TWIPS;
3458 switch ( nMemberId )
3460 case 0:
3462 uno::Sequence< beans::PropertyValue > aPropSeq;
3463 ::com::sun::star::awt::Gradient aGradient2;
3464 OUString aName;
3465 bool bGradient( false );
3467 if ( rVal >>= aPropSeq )
3469 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
3471 if ( aPropSeq[n].Name == "Name" )
3472 aPropSeq[n].Value >>= aName;
3473 else if ( aPropSeq[n].Name == "FillGradient" )
3475 if ( aPropSeq[n].Value >>= aGradient2 )
3476 bGradient = true;
3480 SetName( aName );
3481 if ( bGradient )
3483 XGradient aXGradient;
3485 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3486 aXGradient.SetStartColor( aGradient2.StartColor );
3487 aXGradient.SetEndColor( aGradient2.EndColor );
3488 aXGradient.SetAngle( aGradient2.Angle );
3489 aXGradient.SetBorder( aGradient2.Border );
3490 aXGradient.SetXOffset( aGradient2.XOffset );
3491 aXGradient.SetYOffset( aGradient2.YOffset );
3492 aXGradient.SetStartIntens( aGradient2.StartIntensity );
3493 aXGradient.SetEndIntens( aGradient2.EndIntensity );
3494 aXGradient.SetSteps( aGradient2.StepCount );
3496 SetGradientValue( aXGradient );
3499 return true;
3502 return false;
3505 case MID_NAME:
3507 OUString aName;
3508 if (!(rVal >>= aName ))
3509 return false;
3510 SetName( aName );
3511 break;
3514 case MID_FILLGRADIENT:
3516 ::com::sun::star::awt::Gradient aGradient2;
3517 if(!(rVal >>= aGradient2))
3518 return false;
3520 XGradient aXGradient;
3522 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3523 aXGradient.SetStartColor( aGradient2.StartColor );
3524 aXGradient.SetEndColor( aGradient2.EndColor );
3525 aXGradient.SetAngle( aGradient2.Angle );
3526 aXGradient.SetBorder( aGradient2.Border );
3527 aXGradient.SetXOffset( aGradient2.XOffset );
3528 aXGradient.SetYOffset( aGradient2.YOffset );
3529 aXGradient.SetStartIntens( aGradient2.StartIntensity );
3530 aXGradient.SetEndIntens( aGradient2.EndIntensity );
3531 aXGradient.SetSteps( aGradient2.StepCount );
3533 SetGradientValue( aXGradient );
3534 break;
3537 case MID_GRADIENT_STARTCOLOR:
3538 case MID_GRADIENT_ENDCOLOR:
3540 sal_Int32 nVal = 0;
3541 if(!(rVal >>= nVal ))
3542 return false;
3544 XGradient aXGradient = GetGradientValue();
3546 if ( nMemberId == MID_GRADIENT_STARTCOLOR )
3547 aXGradient.SetStartColor( nVal );
3548 else
3549 aXGradient.SetEndColor( nVal );
3550 SetGradientValue( aXGradient );
3551 break;
3554 case MID_GRADIENT_STYLE:
3555 case MID_GRADIENT_ANGLE:
3556 case MID_GRADIENT_BORDER:
3557 case MID_GRADIENT_STARTINTENSITY:
3558 case MID_GRADIENT_ENDINTENSITY:
3559 case MID_GRADIENT_STEPCOUNT:
3560 case MID_GRADIENT_XOFFSET:
3561 case MID_GRADIENT_YOFFSET:
3563 sal_Int16 nVal = sal_Int16();
3564 if(!(rVal >>= nVal ))
3565 return false;
3567 XGradient aXGradient = GetGradientValue();
3569 switch ( nMemberId )
3571 case MID_GRADIENT_STYLE:
3572 aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break;
3573 case MID_GRADIENT_ANGLE:
3574 aXGradient.SetAngle( nVal ); break;
3575 case MID_GRADIENT_BORDER:
3576 aXGradient.SetBorder( nVal ); break;
3577 case MID_GRADIENT_STARTINTENSITY:
3578 aXGradient.SetStartIntens( nVal ); break;
3579 case MID_GRADIENT_ENDINTENSITY:
3580 aXGradient.SetEndIntens( nVal ); break;
3581 case MID_GRADIENT_STEPCOUNT:
3582 aXGradient.SetSteps( nVal ); break;
3583 case MID_GRADIENT_XOFFSET:
3584 aXGradient.SetXOffset( nVal ); break;
3585 case MID_GRADIENT_YOFFSET:
3586 aXGradient.SetYOffset( nVal ); break;
3589 SetGradientValue( aXGradient );
3590 break;
3594 return true;
3597 sal_Bool XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
3599 return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue();
3602 XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
3604 if( pModel )
3606 const String aUniqueName = NameOrIndex::CheckNamedItem(
3607 this, Which(), &pModel->GetItemPool(),
3608 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
3609 XFillGradientItem::CompareValueFunc, RID_SVXSTR_GRADIENT,
3610 pModel->GetPropertyList( XGRADIENT_LIST ) );
3612 // if the given name is not valid, replace it!
3613 if( aUniqueName != GetName() )
3614 return new XFillGradientItem( aUniqueName, aGradient, Which() );
3617 return (XFillGradientItem*)this;
3620 // ----------------------------------
3621 // class XFillFloatTransparenceItem -
3622 // ----------------------------------
3624 TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem );
3626 // -----------------------------------------------------------------------------
3628 XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
3629 bEnabled( sal_False )
3631 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
3634 //------------------------------------------------------------------------
3636 XFillFloatTransparenceItem::XFillFloatTransparenceItem(const XubString& rName, const XGradient& rGradient, sal_Bool bEnable ) :
3637 XFillGradientItem ( rName, rGradient ),
3638 bEnabled ( bEnable )
3640 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
3643 //------------------------------------------------------------------------
3645 XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) :
3646 XFillGradientItem ( rItem ),
3647 bEnabled ( rItem.bEnabled )
3649 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
3652 //*************************************************************************
3654 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, sal_Bool bEnable )
3655 : XFillGradientItem ( -1, rTheGradient ),
3656 bEnabled ( bEnable )
3658 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
3661 //------------------------------------------------------------------------
3663 int XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const
3665 return ( NameOrIndex::operator==(rItem) ) &&
3666 ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) &&
3667 ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled );
3670 //------------------------------------------------------------------------
3672 SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
3674 return new XFillFloatTransparenceItem( *this );
3677 //------------------------------------------------------------------------
3679 sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const
3681 // !!! if version number of this object must be increased, please !!!
3682 // !!! increase version number of base class XFillGradientItem !!!
3683 return XFillGradientItem::GetVersion( nFileFormatVersion );
3686 //------------------------------------------------------------------------
3688 bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
3690 return XFillGradientItem::QueryValue( rVal, nMemberId );
3693 //------------------------------------------------------------------------
3695 bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
3697 return XFillGradientItem::PutValue( rVal, nMemberId );
3700 //------------------------------------------------------------------------
3702 SfxItemPresentation XFillFloatTransparenceItem::GetPresentation( SfxItemPresentation ePres,
3703 SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit,
3704 OUString& rText,
3705 const IntlWrapper * pIntlWrapper ) const
3707 return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper );
3710 sal_Bool XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
3712 return ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() &&
3713 ((XFillFloatTransparenceItem*)p1)->GetGradientValue() == ((XFillFloatTransparenceItem*)p2)->GetGradientValue();
3716 XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
3718 // #85953# unique name only necessary when enabled
3719 if(IsEnabled())
3721 if( pModel )
3723 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
3724 XATTR_FILLFLOATTRANSPARENCE,
3725 &pModel->GetItemPool(),
3726 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
3727 XFillFloatTransparenceItem::CompareValueFunc,
3728 RID_SVXSTR_TRASNGR0,
3729 XPropertyListRef() );
3731 // if the given name is not valid, replace it!
3732 if( aUniqueName != GetName() )
3734 return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), sal_True );
3738 else
3740 // #85953# if disabled, force name to empty string
3741 if(GetName().Len())
3743 return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False);
3747 return (XFillFloatTransparenceItem*)this;
3750 // -------------
3751 // class XHatch
3752 // -------------
3754 /*************************************************************************
3756 |* XHatch::XHatch(XHatchStyle, const Color&, long, long)
3758 *************************************************************************/
3760 XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance,
3761 long nTheAngle) :
3762 eStyle(eTheStyle),
3763 aColor(rCol),
3764 nDistance(nTheDistance),
3765 nAngle(nTheAngle)
3769 /*************************************************************************
3771 |* int XHatch::operator==(const SfxPoolItem& rItem) const
3773 *************************************************************************/
3775 bool XHatch::operator==(const XHatch& rHatch) const
3777 return ( eStyle == rHatch.eStyle &&
3778 aColor == rHatch.aColor &&
3779 nDistance == rHatch.nDistance &&
3780 nAngle == rHatch.nAngle );
3784 // -----------------------
3785 // class XFillHatchItem
3786 // -----------------------
3787 TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
3789 /*************************************************************************
3791 |* XFillHatchItem::XFillHatchItem(const XubString& rName,
3792 |* const XHatch& rTheHatch)
3794 *************************************************************************/
3796 XFillHatchItem::XFillHatchItem(const XubString& rName,
3797 const XHatch& rTheHatch) :
3798 NameOrIndex(XATTR_FILLHATCH, rName),
3799 aHatch(rTheHatch)
3803 /*************************************************************************
3805 |* XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem)
3807 *************************************************************************/
3809 XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) :
3810 NameOrIndex(rItem),
3811 aHatch(rItem.aHatch)
3815 /*************************************************************************
3817 |* XFillHatchItem::XFillHatchItem(SvStream& rIn)
3819 *************************************************************************/
3821 XFillHatchItem::XFillHatchItem(SvStream& rIn) :
3822 NameOrIndex(XATTR_FILLHATCH, rIn),
3823 aHatch(COL_BLACK)
3825 if (!IsIndex())
3827 sal_uInt16 nRed;
3828 sal_uInt16 nGreen;
3829 sal_uInt16 nBlue;
3830 sal_Int16 nITemp;
3831 sal_Int32 nLTemp;
3833 rIn >> nITemp; aHatch.SetHatchStyle((XHatchStyle)nITemp);
3834 rIn >> nRed;
3835 rIn >> nGreen;
3836 rIn >> nBlue;
3838 Color aCol;
3839 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3840 aHatch.SetColor(aCol);
3841 rIn >> nLTemp; aHatch.SetDistance(nLTemp);
3842 rIn >> nLTemp; aHatch.SetAngle(nLTemp);
3846 //*************************************************************************
3848 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch)
3849 : NameOrIndex( XATTR_FILLHATCH, -1 ),
3850 aHatch(rTheHatch)
3854 /*************************************************************************
3856 |* XFillHatchItem::Clone(SfxItemPool* pPool) const
3858 *************************************************************************/
3860 SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const
3862 return new XFillHatchItem(*this);
3865 /*************************************************************************
3867 |* int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
3869 *************************************************************************/
3871 int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
3873 return ( NameOrIndex::operator==(rItem) &&
3874 aHatch == ((const XFillHatchItem&) rItem).aHatch );
3877 /*************************************************************************
3879 |* SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3881 *************************************************************************/
3883 SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3885 return new XFillHatchItem(rIn);
3888 /*************************************************************************
3890 |* SfxPoolItem* XFillHatchItem::Store(SvStream& rOut) const
3892 *************************************************************************/
3894 SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
3896 NameOrIndex::Store( rOut, nItemVersion );
3898 if (!IsIndex())
3900 rOut << (sal_Int16)aHatch.GetHatchStyle();
3902 sal_uInt16 nTmp;
3903 nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut << nTmp;
3904 nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut << nTmp;
3905 nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut << nTmp;
3907 rOut << (sal_Int32) aHatch.GetDistance();
3908 rOut << (sal_Int32) aHatch.GetAngle();
3911 return rOut;
3914 /*************************************************************************
3916 |* const XHatch& XFillHatchItem::GetValue(const XHatchList* pTable) const
3918 *************************************************************************/
3920 const XHatch& XFillHatchItem::GetHatchValue() const // GetValue -> GetHatchValue
3922 //if (!IsIndex())
3923 // return aHatch;
3924 //else
3925 // return pTable->GetHatch(GetIndex())->GetHatch();
3926 return aHatch;
3929 //------------------------------------------------------------------------
3931 SfxItemPresentation XFillHatchItem::GetPresentation
3933 SfxItemPresentation ePres,
3934 SfxMapUnit /*eCoreUnit*/,
3935 SfxMapUnit /*ePresUnit*/,
3936 OUString& rText, const IntlWrapper *
3937 ) const
3939 switch ( ePres )
3941 case SFX_ITEM_PRESENTATION_NONE:
3942 rText = OUString();
3943 return ePres;
3944 case SFX_ITEM_PRESENTATION_NAMELESS:
3945 case SFX_ITEM_PRESENTATION_COMPLETE:
3946 rText = GetName();
3947 return ePres;
3948 default:
3949 return SFX_ITEM_PRESENTATION_NONE;
3953 //------------------------------------------------------------------------
3955 bool XFillHatchItem::HasMetrics() const
3957 return true;
3960 //------------------------------------------------------------------------
3962 bool XFillHatchItem::ScaleMetrics(long nMul, long nDiv)
3964 aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) );
3965 return true;
3968 // -----------------------------------------------------------------------
3969 bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
3971 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3972 nMemberId &= ~CONVERT_TWIPS;
3974 switch ( nMemberId )
3976 case 0:
3978 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
3980 ::com::sun::star::drawing::Hatch aUnoHatch;
3982 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
3983 aUnoHatch.Color = aHatch.GetColor().GetColor();
3984 aUnoHatch.Distance = aHatch.GetDistance();
3985 aUnoHatch.Angle = aHatch.GetAngle();
3987 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
3988 aPropSeq[0].Name = OUString( "Name" );
3989 aPropSeq[0].Value = uno::makeAny( aApiName );
3990 aPropSeq[1].Name = OUString( "FillHatch" );
3991 aPropSeq[1].Value = uno::makeAny( aUnoHatch );
3992 rVal = uno::makeAny( aPropSeq );
3993 break;
3996 case MID_FILLHATCH:
3998 ::com::sun::star::drawing::Hatch aUnoHatch;
4000 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4001 aUnoHatch.Color = aHatch.GetColor().GetColor();
4002 aUnoHatch.Distance = aHatch.GetDistance();
4003 aUnoHatch.Angle = aHatch.GetAngle();
4004 rVal <<= aUnoHatch;
4005 break;
4008 case MID_NAME:
4010 OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
4011 rVal <<= aApiName;
4012 break;
4015 case MID_HATCH_STYLE:
4016 rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break;
4017 case MID_HATCH_COLOR:
4018 rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break;
4019 case MID_HATCH_DISTANCE:
4020 rVal <<= aHatch.GetDistance(); break;
4021 case MID_HATCH_ANGLE:
4022 rVal <<= aHatch.GetAngle(); break;
4024 default: OSL_FAIL("Wrong MemberId!"); return false;
4027 return true;
4030 // -----------------------------------------------------------------------
4031 bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
4033 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4034 nMemberId &= ~CONVERT_TWIPS;
4036 switch ( nMemberId )
4038 case 0:
4040 uno::Sequence< beans::PropertyValue > aPropSeq;
4041 ::com::sun::star::drawing::Hatch aUnoHatch;
4042 OUString aName;
4043 bool bHatch( false );
4045 if ( rVal >>= aPropSeq )
4047 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
4049 if ( aPropSeq[n].Name == "Name" )
4050 aPropSeq[n].Value >>= aName;
4051 else if ( aPropSeq[n].Name == "FillHatch" )
4053 if ( aPropSeq[n].Value >>= aUnoHatch )
4054 bHatch = true;
4058 SetName( aName );
4059 if ( bHatch )
4061 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4062 aHatch.SetColor( aUnoHatch.Color );
4063 aHatch.SetDistance( aUnoHatch.Distance );
4064 aHatch.SetAngle( aUnoHatch.Angle );
4067 return true;
4070 return false;
4073 case MID_FILLHATCH:
4075 ::com::sun::star::drawing::Hatch aUnoHatch;
4076 if(!(rVal >>= aUnoHatch))
4077 return false;
4079 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4080 aHatch.SetColor( aUnoHatch.Color );
4081 aHatch.SetDistance( aUnoHatch.Distance );
4082 aHatch.SetAngle( aUnoHatch.Angle );
4083 break;
4086 case MID_NAME:
4088 OUString aName;
4089 if (!(rVal >>= aName ))
4090 return false;
4091 SetName( aName );
4092 break;
4095 case MID_HATCH_STYLE:
4097 sal_Int16 nVal = sal_Int16();
4098 if (!(rVal >>= nVal ))
4099 return false;
4100 aHatch.SetHatchStyle( (XHatchStyle)nVal );
4101 break;
4104 case MID_HATCH_COLOR:
4105 case MID_HATCH_DISTANCE:
4106 case MID_HATCH_ANGLE:
4108 sal_Int32 nVal = 0;
4109 if (!(rVal >>= nVal ))
4110 return false;
4112 if ( nMemberId == MID_HATCH_COLOR )
4113 aHatch.SetColor( nVal );
4114 else if ( nMemberId == MID_HATCH_DISTANCE )
4115 aHatch.SetDistance( nVal );
4116 else
4117 aHatch.SetAngle( nVal );
4118 break;
4121 default: OSL_FAIL("Wrong MemberId!"); return false;
4124 return true;
4127 sal_Bool XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4129 return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue();
4132 XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
4134 if( pModel )
4136 const String aUniqueName = NameOrIndex::CheckNamedItem(
4137 this, XATTR_FILLHATCH, &pModel->GetItemPool(),
4138 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4139 XFillHatchItem::CompareValueFunc, RID_SVXSTR_HATCH10,
4140 pModel->GetPropertyList( XHATCH_LIST ) );
4142 // if the given name is not valid, replace it!
4143 if( aUniqueName != GetName() )
4144 return new XFillHatchItem( aUniqueName, aHatch );
4147 return (XFillHatchItem*)this;
4150 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4151 // FormText-Attribute
4152 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4154 //-------------------------
4155 // class XFormTextStyleItem
4156 //-------------------------
4157 TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem);
4159 /*************************************************************************
4161 |* XFormTextStyleItem::XFormTextStyleItem()
4163 *************************************************************************/
4165 XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
4166 SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle))
4170 /*************************************************************************
4172 |* XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn)
4174 *************************************************************************/
4176 XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) :
4177 SfxEnumItem(XATTR_FORMTXTSTYLE, rIn)
4181 /*************************************************************************
4183 |* XFormTextStyleItem::Clone(SfxItemPool* pPool) const
4185 *************************************************************************/
4187 SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const
4189 return new XFormTextStyleItem( *this );
4192 /*************************************************************************
4194 |* SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4196 *************************************************************************/
4198 SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4200 return new XFormTextStyleItem(rIn);
4203 sal_uInt16 XFormTextStyleItem::GetValueCount() const
4205 return 5;
4208 // #FontWork#
4209 bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4211 rVal <<= (sal_Int32)GetValue();
4212 return true;
4215 // #FontWork#
4216 bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4218 sal_Int32 nValue = 0;
4219 rVal >>= nValue;
4220 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4222 return true;
4225 //-------------------------
4226 // class XFormTextAdjustItem
4227 //-------------------------
4228 TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem);
4230 /*************************************************************************
4232 |* XFormTextAdjustItem::XFormTextAdjustItem()
4234 *************************************************************************/
4236 XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
4237 SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust))
4241 /*************************************************************************
4243 |* XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn)
4245 *************************************************************************/
4247 XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) :
4248 SfxEnumItem(XATTR_FORMTXTADJUST, rIn)
4252 /*************************************************************************
4254 |* XFormTextAdjustItem::Clone(SfxItemPool* pPool) const
4256 *************************************************************************/
4258 SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const
4260 return new XFormTextAdjustItem( *this );
4263 /*************************************************************************
4265 |* SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4267 *************************************************************************/
4269 SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4271 return new XFormTextAdjustItem(rIn);
4274 sal_uInt16 XFormTextAdjustItem::GetValueCount() const
4276 return 4;
4279 // #FontWork#
4280 bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4282 rVal <<= (sal_Int32)GetValue();
4283 return true;
4286 // #FontWork#
4287 bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4289 sal_Int32 nValue = 0;
4290 rVal >>= nValue;
4291 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4293 return true;
4296 //----------------------------
4297 // class XFormTextDistanceItem
4298 //----------------------------
4299 TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem);
4301 /*************************************************************************
4303 |* XFormTextDistanceItem::XFormTextDistanceItem()
4305 *************************************************************************/
4307 XFormTextDistanceItem::XFormTextDistanceItem(long nDist) :
4308 SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist)
4312 /*************************************************************************
4314 |* XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn)
4316 *************************************************************************/
4318 XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) :
4319 SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn)
4323 /*************************************************************************
4325 |* XFormTextDistanceItem::Clone(SfxItemPool* pPool) const
4327 *************************************************************************/
4329 SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const
4331 return new XFormTextDistanceItem(*this);
4334 /*************************************************************************
4336 |* SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4338 *************************************************************************/
4340 SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4342 return new XFormTextDistanceItem(rIn);
4345 //-------------------------
4346 // class XFormTextStartItem
4347 //-------------------------
4348 TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem);
4350 /*************************************************************************
4352 |* XFormTextStartItem::XFormTextStartItem(long nStart)
4354 *************************************************************************/
4356 XFormTextStartItem::XFormTextStartItem(long nStart) :
4357 SfxMetricItem(XATTR_FORMTXTSTART, nStart)
4361 /*************************************************************************
4363 |* XFormTextStartItem::XFormTextStartItem(SvStream& rIn)
4365 *************************************************************************/
4367 XFormTextStartItem::XFormTextStartItem(SvStream& rIn) :
4368 SfxMetricItem(XATTR_FORMTXTSTART, rIn)
4372 /*************************************************************************
4374 |* XFormTextStartItem::Clone(SfxItemPool* pPool) const
4376 *************************************************************************/
4378 SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const
4380 return new XFormTextStartItem(*this);
4383 /*************************************************************************
4385 |* SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4387 *************************************************************************/
4389 SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4391 return new XFormTextStartItem(rIn);
4394 // -------------------------
4395 // class XFormTextMirrorItem
4396 // -------------------------
4397 TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem);
4399 /*************************************************************************
4401 |* XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror)
4403 *************************************************************************/
4405 XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror) :
4406 SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror)
4410 /*************************************************************************
4412 |* XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn)
4414 *************************************************************************/
4416 XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) :
4417 SfxBoolItem(XATTR_FORMTXTMIRROR, rIn)
4421 /*************************************************************************
4423 |* XFormTextMirrorItem::Clone(SfxItemPool* pPool) const
4425 *************************************************************************/
4427 SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const
4429 return new XFormTextMirrorItem(*this);
4432 /*************************************************************************
4434 |* SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 nVer)
4435 |* const
4437 *************************************************************************/
4439 SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4441 return new XFormTextMirrorItem(rIn);
4445 // --------------------------
4446 // class XFormTextOutlineItem
4447 // --------------------------
4448 TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem);
4450 /*************************************************************************
4452 |* XFormTextOutlineItem::XFormTextOutlineItem()
4454 *************************************************************************/
4456 XFormTextOutlineItem::XFormTextOutlineItem(sal_Bool bOutline) :
4457 SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline)
4461 /*************************************************************************
4463 |* XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn)
4465 *************************************************************************/
4467 XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) :
4468 SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn)
4472 /*************************************************************************
4474 |* XFormTextOutlineItem::Clone(SfxItemPool* pPool) const
4476 *************************************************************************/
4478 SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const
4480 return new XFormTextOutlineItem(*this);
4483 /*************************************************************************
4485 |* SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 nVer)
4486 |* const
4488 *************************************************************************/
4490 SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4492 return new XFormTextOutlineItem(rIn);
4495 //--------------------------
4496 // class XFormTextShadowItem
4497 //--------------------------
4498 TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem);
4500 /*************************************************************************
4502 |* XFormTextShadowItem::XFormTextShadowItem()
4504 *************************************************************************/
4506 XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
4507 SfxEnumItem(
4508 XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow))
4512 /*************************************************************************
4514 |* XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn)
4516 *************************************************************************/
4518 XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) :
4519 SfxEnumItem(XATTR_FORMTXTSHADOW, rIn)
4523 /*************************************************************************
4525 |* XFormTextShadowItem::Clone(SfxItemPool* pPool) const
4527 *************************************************************************/
4529 SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const
4531 return new XFormTextShadowItem( *this );
4534 /*************************************************************************
4536 |* SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4538 *************************************************************************/
4540 SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4542 return new XFormTextShadowItem(rIn);
4545 sal_uInt16 XFormTextShadowItem::GetValueCount() const
4547 return 3;
4550 // #FontWork#
4551 bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4553 rVal <<= (sal_Int32)GetValue();
4554 return true;
4557 // #FontWork#
4558 bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4560 sal_Int32 nValue = 0;
4561 rVal >>= nValue;
4562 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4564 return true;
4567 // -------------------------------
4568 // class XFormTextShadowColorItem
4569 // -------------------------------
4570 TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
4572 /*************************************************************************
4574 |* XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, const Color& rTheColor)
4576 *************************************************************************/
4578 XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName,
4579 const Color& rTheColor) :
4580 XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
4584 /*************************************************************************
4586 |* XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn)
4588 *************************************************************************/
4590 XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) :
4591 XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn)
4595 /*************************************************************************
4597 |* XFormTextShadowColorItem::Clone(SfxItemPool* pPool) const
4599 *************************************************************************/
4601 SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const
4603 return new XFormTextShadowColorItem(*this);
4606 /*************************************************************************
4608 |* SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4610 *************************************************************************/
4612 SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4614 return new XFormTextShadowColorItem(rIn);
4617 //------------------------------
4618 // class XFormTextShadowXValItem
4619 //------------------------------
4620 TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem);
4622 /*************************************************************************
4624 |* XFormTextShadowXValItem::XFormTextShadowXValItem(long)
4626 *************************************************************************/
4628 XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) :
4629 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal)
4633 /*************************************************************************
4635 |* XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn)
4637 *************************************************************************/
4639 XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) :
4640 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn)
4644 /*************************************************************************
4646 |* XFormTextShadowXValItem::Clone(SfxItemPool* pPool) const
4648 *************************************************************************/
4650 SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const
4652 return new XFormTextShadowXValItem(*this);
4655 /*************************************************************************
4657 |* SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4659 *************************************************************************/
4661 SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4663 return new XFormTextShadowXValItem(rIn);
4666 //------------------------------
4667 // class XFormTextShadowYValItem
4668 //------------------------------
4669 TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem);
4671 /*************************************************************************
4673 |* XFormTextShadowYValItem::XFormTextShadowYValItem(long)
4675 *************************************************************************/
4677 XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) :
4678 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal)
4682 /*************************************************************************
4684 |* XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn)
4686 *************************************************************************/
4688 XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) :
4689 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn)
4693 /*************************************************************************
4695 |* XFormTextShadowYValItem::Clone(SfxItemPool* pPool) const
4697 *************************************************************************/
4699 SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const
4701 return new XFormTextShadowYValItem(*this);
4704 /*************************************************************************
4706 |* SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4708 *************************************************************************/
4710 SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4712 return new XFormTextShadowYValItem(rIn);
4715 //---------------------------
4716 // class XFormTextStdFormItem
4717 //---------------------------
4718 TYPEINIT1_AUTOFACTORY(XFormTextStdFormItem, SfxEnumItem);
4720 /*************************************************************************
4722 |* XFormTextStdFormItem::XFormTextStdFormItem()
4724 *************************************************************************/
4726 XFormTextStdFormItem::XFormTextStdFormItem(XFormTextStdForm eFormTextStdForm) :
4727 SfxEnumItem(
4728 XATTR_FORMTXTSTDFORM, sal::static_int_cast< sal_uInt16 >(eFormTextStdForm))
4732 /*************************************************************************
4734 |* XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn)
4736 *************************************************************************/
4738 XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn) :
4739 SfxEnumItem(XATTR_FORMTXTSTDFORM, rIn)
4743 /*************************************************************************
4745 |* XFormTextStdFormItem::Clone(SfxItemPool* pPool) const
4747 *************************************************************************/
4749 SfxPoolItem* XFormTextStdFormItem::Clone(SfxItemPool* /*pPool*/) const
4751 return new XFormTextStdFormItem( *this );
4754 /*************************************************************************
4756 |* SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4758 *************************************************************************/
4760 SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4762 return new XFormTextStdFormItem(rIn);
4765 sal_uInt16 XFormTextStdFormItem::GetValueCount() const
4767 return 3;
4770 // #FontWork#
4771 bool XFormTextStdFormItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4773 rVal <<= (sal_Int32)GetValue();
4774 return true;
4777 // #FontWork#
4778 bool XFormTextStdFormItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4780 sal_Int32 nValue = 0;
4781 rVal >>= nValue;
4782 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4784 return true;
4787 // --------------------------
4788 // class XFormTextHideFormItem
4789 // --------------------------
4790 TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem);
4792 /*************************************************************************
4794 |* XFormTextHideFormItem::XFormTextHideFormItem()
4796 *************************************************************************/
4798 XFormTextHideFormItem::XFormTextHideFormItem(sal_Bool bHide) :
4799 SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide)
4803 /*************************************************************************
4805 |* XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn)
4807 *************************************************************************/
4809 XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) :
4810 SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn)
4814 /*************************************************************************
4816 |* XFormTextHideFormItem::Clone(SfxItemPool* pPool) const
4818 *************************************************************************/
4820 SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const
4822 return new XFormTextHideFormItem(*this);
4825 /*************************************************************************
4827 |* SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 nVer)
4828 |* const
4830 *************************************************************************/
4832 SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4834 return new XFormTextHideFormItem(rIn);
4839 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4840 // SetItems
4841 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4843 TYPEINIT1(XLineAttrSetItem, SfxSetItem);
4845 /*************************************************************************
4847 |* Konstruktoren fuer Linienattribute-SetItem
4849 \************************************************************************/
4851 XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
4852 SfxSetItem( XATTRSET_LINE, pItemSet)
4856 /************************************************************************/
4858 XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
4859 SfxSetItem( XATTRSET_LINE,
4860 new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
4864 /************************************************************************/
4866 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) :
4867 SfxSetItem( rLineAttr )
4871 /************************************************************************/
4873 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr,
4874 SfxItemPool* pItemPool) :
4875 SfxSetItem( rLineAttr, pItemPool )
4879 /*************************************************************************
4881 |* Clone-Funktion
4883 \************************************************************************/
4885 SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
4887 return new XLineAttrSetItem( *this, pPool );
4890 /*************************************************************************
4892 |* SetItem aus Stream erzeugen
4894 \************************************************************************/
4896 SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
4898 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
4899 XATTR_LINE_FIRST, XATTR_LINE_LAST);
4900 pSet2->Load( rStream );
4901 return new XLineAttrSetItem( pSet2 );
4904 /*************************************************************************
4906 |* SetItem in Stream speichern
4908 \************************************************************************/
4910 SvStream& XLineAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
4912 return SfxSetItem::Store( rStream, nItemVersion );
4916 TYPEINIT1(XFillAttrSetItem, SfxSetItem);
4918 /*************************************************************************
4920 |* Konstruktoren fuer Fuellattribute-SetItem
4922 \************************************************************************/
4924 XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
4925 SfxSetItem( XATTRSET_FILL, pItemSet)
4929 /************************************************************************/
4931 XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
4932 SfxSetItem( XATTRSET_FILL,
4933 new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
4937 /************************************************************************/
4939 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) :
4940 SfxSetItem( rFillAttr )
4944 /************************************************************************/
4946 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr,
4947 SfxItemPool* pItemPool ) :
4948 SfxSetItem( rFillAttr, pItemPool )
4952 /*************************************************************************
4954 |* Clone-Funktion
4956 \************************************************************************/
4958 SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
4960 return new XFillAttrSetItem( *this, pPool );
4963 /*************************************************************************
4965 |* SetItem aus Stream erzeugen
4967 \************************************************************************/
4969 SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
4971 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
4972 XATTR_FILL_FIRST, XATTR_FILL_LAST);
4973 pSet2->Load( rStream );
4974 return new XFillAttrSetItem( pSet2 );
4977 /*************************************************************************
4979 |* SetItem in Stream speichern
4981 \************************************************************************/
4983 SvStream& XFillAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
4985 return SfxSetItem::Store( rStream, nItemVersion );
4988 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */