1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drawitem.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // include ---------------------------------------------------------------
36 #include <svx/svxids.hrc>
39 #include "drawitem.hxx"
40 #include <svx/xtable.hxx>
42 using namespace ::com::sun::star
;
44 // -----------------------------------------------------------------------
46 TYPEINIT1_FACTORY( SvxColorTableItem
, SfxPoolItem
, new SvxColorTableItem
);
47 TYPEINIT1_FACTORY( SvxGradientListItem
, SfxPoolItem
, new SvxGradientListItem
);
48 TYPEINIT1_FACTORY( SvxHatchListItem
, SfxPoolItem
, new SvxHatchListItem
);
49 TYPEINIT1_FACTORY( SvxBitmapListItem
, SfxPoolItem
, new SvxBitmapListItem
);
50 TYPEINIT1_FACTORY( SvxDashListItem
, SfxPoolItem
, new SvxDashListItem
);
51 TYPEINIT1_FACTORY( SvxLineEndListItem
, SfxPoolItem
, new SvxLineEndListItem
);
53 //==================================================================
57 //==================================================================
59 SvxColorTableItem::SvxColorTableItem()
63 // -----------------------------------------------------------------------
65 SvxColorTableItem::SvxColorTableItem( XColorTable
* pTable
, sal_uInt16 nW
) :
71 // -----------------------------------------------------------------------
73 SvxColorTableItem::SvxColorTableItem( const SvxColorTableItem
& rItem
) :
75 pColorTable( rItem
.pColorTable
)
79 //------------------------------------------------------------------------
81 SfxItemPresentation
SvxColorTableItem::GetPresentation
83 SfxItemPresentation
/*ePres*/,
84 SfxMapUnit
/*eCoreUnit*/,
85 SfxMapUnit
/*ePresUnit*/,
86 XubString
& rText
, const IntlWrapper
*
90 return SFX_ITEM_PRESENTATION_NONE
;
93 // -----------------------------------------------------------------------
95 int SvxColorTableItem::operator==( const SfxPoolItem
& rItem
) const
97 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
98 return ( ( SvxColorTableItem
& ) rItem
).pColorTable
== pColorTable
;
101 // -----------------------------------------------------------------------
103 SfxPoolItem
* SvxColorTableItem::Clone( SfxItemPool
* ) const
105 return new SvxColorTableItem( *this );
108 // -----------------------------------------------------------------------
110 sal_Bool
SvxColorTableItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
112 // This is only a quick helper to have UI support for these list items. Don't use
113 // this method to query for a valid UNO representation.
114 // Please ask CD if you want to change this.
115 sal_Int64 aValue
= sal_Int64( (ULONG
)pColorTable
);
116 rVal
= uno::makeAny( aValue
);
120 // -----------------------------------------------------------------------
122 sal_Bool
SvxColorTableItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ )
124 // This is only a quick helper to have UI support for these list items. Don't use
125 // this method to query for a valid UNO representation.
126 // Please ask CD if you want to change this.
127 sal_Int64 aValue
= 0;
128 if ( rVal
>>= aValue
)
130 pColorTable
= (XColorTable
*)(ULONG
)aValue
;
137 //==================================================================
139 // SvxGradientListItem
141 //==================================================================
143 SvxGradientListItem::SvxGradientListItem()
147 // -----------------------------------------------------------------------
149 SvxGradientListItem::SvxGradientListItem( XGradientList
* pList
, sal_uInt16 nW
) :
151 pGradientList( pList
)
155 // -----------------------------------------------------------------------
157 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem
& rItem
) :
158 SfxPoolItem( rItem
),
159 pGradientList( rItem
.pGradientList
)
163 //------------------------------------------------------------------------
165 SfxItemPresentation
SvxGradientListItem::GetPresentation
167 SfxItemPresentation
/*ePres*/,
168 SfxMapUnit
/*eCoreUnit*/,
169 SfxMapUnit
/*ePresUnit*/,
170 XubString
& rText
, const IntlWrapper
*
174 return SFX_ITEM_PRESENTATION_NONE
;
177 // -----------------------------------------------------------------------
179 int SvxGradientListItem::operator==( const SfxPoolItem
& rItem
) const
181 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
182 return ( ( SvxGradientListItem
& ) rItem
).pGradientList
== pGradientList
;
185 // -----------------------------------------------------------------------
187 SfxPoolItem
* SvxGradientListItem::Clone( SfxItemPool
* ) const
189 return new SvxGradientListItem( *this );
192 // -----------------------------------------------------------------------
194 sal_Bool
SvxGradientListItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
196 // This is only a quick helper to have UI support for these list items. Don't use
197 // this method to query for a valid UNO representation.
198 // Please ask CD if you want to change this.
199 sal_Int64 aValue
= sal_Int64( (ULONG
)pGradientList
);
200 rVal
= uno::makeAny( aValue
);
204 // -----------------------------------------------------------------------
206 sal_Bool
SvxGradientListItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ )
208 // This is only a quick helper to have UI support for these list items. Don't use
209 // this method to query for a valid UNO representation.
210 // Please ask CD if you want to change this.
211 sal_Int64 aValue
= 0;
212 if ( rVal
>>= aValue
)
214 pGradientList
= (XGradientList
*)(ULONG
)aValue
;
221 //==================================================================
225 //==================================================================
227 SvxHatchListItem::SvxHatchListItem()
231 // -----------------------------------------------------------------------
233 SvxHatchListItem::SvxHatchListItem( XHatchList
* pList
, sal_uInt16 nW
) :
239 // -----------------------------------------------------------------------
241 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem
& rItem
) :
242 SfxPoolItem( rItem
),
243 pHatchList( rItem
.pHatchList
)
247 //------------------------------------------------------------------------
249 SfxItemPresentation
SvxHatchListItem::GetPresentation
251 SfxItemPresentation
/*ePres*/,
252 SfxMapUnit
/*eCoreUnit*/,
253 SfxMapUnit
/*ePresUnit*/,
254 XubString
& rText
, const IntlWrapper
*
258 return SFX_ITEM_PRESENTATION_NONE
;
261 // -----------------------------------------------------------------------
263 int SvxHatchListItem::operator==( const SfxPoolItem
& rItem
) const
265 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
266 return ( ( SvxHatchListItem
& ) rItem
).pHatchList
== pHatchList
;
269 // -----------------------------------------------------------------------
271 SfxPoolItem
* SvxHatchListItem::Clone( SfxItemPool
* ) const
273 return new SvxHatchListItem( *this );
276 // -----------------------------------------------------------------------
278 sal_Bool
SvxHatchListItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
280 // This is only a quick helper to have UI support for these list items. Don't use
281 // this method to query for a valid UNO representation.
282 // Please ask CD if you want to change this.
283 sal_Int64 aValue
= sal_Int64( (ULONG
)pHatchList
);
284 rVal
= uno::makeAny( aValue
);
288 // -----------------------------------------------------------------------
290 sal_Bool
SvxHatchListItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ )
292 // This is only a quick helper to have UI support for these list items. Don't use
293 // this method to query for a valid UNO representation.
294 // Please ask CD if you want to change this.
295 sal_Int64 aValue
= 0;
296 if ( rVal
>>= aValue
)
298 pHatchList
= (XHatchList
*)(ULONG
)aValue
;
305 //==================================================================
309 //==================================================================
311 SvxBitmapListItem::SvxBitmapListItem()
315 // -----------------------------------------------------------------------
317 SvxBitmapListItem::SvxBitmapListItem( XBitmapList
* pList
, sal_uInt16 nW
) :
323 // -----------------------------------------------------------------------
325 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem
& rItem
) :
326 SfxPoolItem( rItem
),
327 pBitmapList( rItem
.pBitmapList
)
331 //------------------------------------------------------------------------
333 SfxItemPresentation
SvxBitmapListItem::GetPresentation
335 SfxItemPresentation
/*ePres*/,
336 SfxMapUnit
/*eCoreUnit*/,
337 SfxMapUnit
/*ePresUnit*/,
338 XubString
& rText
, const IntlWrapper
*
342 return SFX_ITEM_PRESENTATION_NONE
;
345 // -----------------------------------------------------------------------
347 int SvxBitmapListItem::operator==( const SfxPoolItem
& rItem
) const
349 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
350 return ( ( SvxBitmapListItem
& ) rItem
).pBitmapList
== pBitmapList
;
353 // -----------------------------------------------------------------------
355 SfxPoolItem
* SvxBitmapListItem::Clone( SfxItemPool
* ) const
357 return new SvxBitmapListItem( *this );
360 // -----------------------------------------------------------------------
362 sal_Bool
SvxBitmapListItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
364 // This is only a quick helper to have UI support for these list items. Don't use
365 // this method to query for a valid UNO representation.
366 // Please ask CD if you want to change this.
367 sal_Int64 aValue
= sal_Int64( (ULONG
)pBitmapList
);
368 rVal
= uno::makeAny( aValue
);
372 // -----------------------------------------------------------------------
374 sal_Bool
SvxBitmapListItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ )
376 // This is only a quick helper to have UI support for these list items. Don't use
377 // this method to query for a valid UNO representation.
378 // Please ask CD if you want to change this.
379 sal_Int64 aValue
= 0;
380 if ( rVal
>>= aValue
)
382 pBitmapList
= (XBitmapList
*)(ULONG
)aValue
;
390 //==================================================================
394 //==================================================================
396 SvxDashListItem::SvxDashListItem() :
401 // -----------------------------------------------------------------------
403 SvxDashListItem::SvxDashListItem( XDashList
* pList
, sal_uInt16 nW
) :
409 // -----------------------------------------------------------------------
411 SvxDashListItem::SvxDashListItem( const SvxDashListItem
& rItem
) :
412 SfxPoolItem( rItem
),
413 pDashList( rItem
.pDashList
)
417 //------------------------------------------------------------------------
419 SfxItemPresentation
SvxDashListItem::GetPresentation
421 SfxItemPresentation
/*ePres*/,
422 SfxMapUnit
/*eCoreUnit*/,
423 SfxMapUnit
/*ePresUnit*/,
424 XubString
& rText
, const IntlWrapper
*
428 return SFX_ITEM_PRESENTATION_NONE
;
431 // -----------------------------------------------------------------------
433 int SvxDashListItem::operator==( const SfxPoolItem
& rItem
) const
435 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
436 return ( ( SvxDashListItem
& ) rItem
).pDashList
== pDashList
;
439 // -----------------------------------------------------------------------
441 SfxPoolItem
* SvxDashListItem::Clone( SfxItemPool
* ) const
443 return new SvxDashListItem( *this );
446 // -----------------------------------------------------------------------
448 sal_Bool
SvxDashListItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
450 // This is only a quick helper to have UI support for these list items. Don't use
451 // this method to query for a valid UNO representation.
452 sal_Int64 aValue
= sal_Int64( (ULONG
)pDashList
);
453 rVal
= uno::makeAny( aValue
);
457 // -----------------------------------------------------------------------
459 sal_Bool
SvxDashListItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ )
461 // This is only a quick helper to have UI support for these list items. Don't use
462 // this method to query for a valid UNO representation.
463 sal_Int64 aValue
= 0;
464 if ( rVal
>>= aValue
)
466 pDashList
= (XDashList
*)(ULONG
)aValue
;
473 // -----------------------------------------------------------------------
475 void SvxDashListItem::SetDashList( XDashList
* pList
)
480 //==================================================================
482 // SvxLineEndListItem
484 //==================================================================
486 SvxLineEndListItem::SvxLineEndListItem()
490 // -----------------------------------------------------------------------
492 SvxLineEndListItem::SvxLineEndListItem( XLineEndList
* pList
, sal_uInt16 nW
) :
494 pLineEndList( pList
)
498 // -----------------------------------------------------------------------
500 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem
& rItem
) :
501 SfxPoolItem( rItem
),
502 pLineEndList( rItem
.pLineEndList
)
506 //------------------------------------------------------------------------
508 SfxItemPresentation
SvxLineEndListItem::GetPresentation
510 SfxItemPresentation
/*ePres*/,
511 SfxMapUnit
/*eCoreUnit*/,
512 SfxMapUnit
/*ePresUnit*/,
513 XubString
& rText
, const IntlWrapper
*
517 return SFX_ITEM_PRESENTATION_NONE
;
520 // -----------------------------------------------------------------------
522 int SvxLineEndListItem::operator==( const SfxPoolItem
& rItem
) const
524 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
525 return ( ( SvxLineEndListItem
& ) rItem
).pLineEndList
== pLineEndList
;
528 // -----------------------------------------------------------------------
530 SfxPoolItem
* SvxLineEndListItem::Clone( SfxItemPool
* ) const
532 return new SvxLineEndListItem( *this );
535 // -----------------------------------------------------------------------
537 sal_Bool
SvxLineEndListItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
539 // This is only a quick helper to have UI support for these list items. Don't use
540 // this method to query for a valid UNO representation.
541 sal_Int64 aValue
= sal_Int64( (ULONG
)pLineEndList
);
542 rVal
= uno::makeAny( aValue
);
546 // -----------------------------------------------------------------------
548 sal_Bool
SvxLineEndListItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ )
550 // This is only a quick helper to have UI support for these list items. Don't use
551 // this method to query for a valid UNO representation.
552 sal_Int64 aValue
= 0;
553 if ( rVal
>>= aValue
)
555 pLineEndList
= (XLineEndList
*)(ULONG
)aValue
;