xref: /aoo42x/main/svx/source/items/drawitem.cxx (revision f6e50924)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 // include ---------------------------------------------------------------
28 
29 #include <svx/svxids.hrc>
30 
31 
32 #include "svx/drawitem.hxx"
33 #include <svx/xtable.hxx>
34 
35 using namespace ::com::sun::star;
36 
37 // -----------------------------------------------------------------------
38 
39 TYPEINIT1_FACTORY( SvxColorTableItem, SfxPoolItem , new  SvxColorTableItem);
40 TYPEINIT1_FACTORY( SvxGradientListItem, SfxPoolItem , new  SvxGradientListItem);
41 TYPEINIT1_FACTORY( SvxHatchListItem, SfxPoolItem , new  SvxHatchListItem);
42 TYPEINIT1_FACTORY( SvxBitmapListItem, SfxPoolItem , new  SvxBitmapListItem);
43 TYPEINIT1_FACTORY( SvxDashListItem, SfxPoolItem , new  SvxDashListItem);
44 TYPEINIT1_FACTORY( SvxLineEndListItem, SfxPoolItem , new  SvxLineEndListItem);
45 
46 //==================================================================
47 //
48 //	SvxColorTableItem
49 //
50 //==================================================================
51 
52 SvxColorTableItem::SvxColorTableItem()
53 {
54 }
55 
56 // -----------------------------------------------------------------------
57 
58 SvxColorTableItem::SvxColorTableItem( XColorTable* pTable, sal_uInt16 nW ) :
59 	SfxPoolItem( nW ),
60 	pColorTable( pTable )
61 {
62 }
63 
64 // -----------------------------------------------------------------------
65 
66 SvxColorTableItem::SvxColorTableItem( const SvxColorTableItem& rItem ) :
67 	SfxPoolItem( rItem ),
68 	pColorTable( rItem.pColorTable )
69 {
70 }
71 
72 //------------------------------------------------------------------------
73 
74 SfxItemPresentation SvxColorTableItem::GetPresentation
75 (
76     SfxItemPresentation /*ePres*/,
77     SfxMapUnit          /*eCoreUnit*/,
78     SfxMapUnit          /*ePresUnit*/,
79     XubString&          rText, const IntlWrapper *
80 )	const
81 {
82 	rText.Erase();
83 	return SFX_ITEM_PRESENTATION_NONE;
84 }
85 
86 // -----------------------------------------------------------------------
87 
88 int SvxColorTableItem::operator==( const SfxPoolItem& rItem ) const
89 {
90 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
91 	return ( ( SvxColorTableItem& ) rItem).pColorTable == pColorTable;
92 }
93 
94 // -----------------------------------------------------------------------
95 
96 SfxPoolItem* SvxColorTableItem::Clone( SfxItemPool * ) const
97 {
98 	return new SvxColorTableItem( *this );
99 }
100 
101 // -----------------------------------------------------------------------
102 
103 sal_Bool SvxColorTableItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
104 {
105     // This is only a quick helper to have UI support for these list items. Don't use
106     // this method to query for a valid UNO representation.
107     // Please ask CD if you want to change this.
108     sal_Int64 aValue = sal_Int64( (sal_uLong)pColorTable );
109     rVal = uno::makeAny( aValue );
110     return sal_True;
111 }
112 
113 // -----------------------------------------------------------------------
114 
115 sal_Bool SvxColorTableItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
116 {
117     // This is only a quick helper to have UI support for these list items. Don't use
118     // this method to query for a valid UNO representation.
119     // Please ask CD if you want to change this.
120     sal_Int64 aValue = 0;
121     if ( rVal >>= aValue )
122     {
123         pColorTable = (XColorTable *)(sal_uLong)aValue;
124         return sal_True;
125     }
126 
127     return sal_False;
128 }
129 
130 //==================================================================
131 //
132 //	SvxGradientListItem
133 //
134 //==================================================================
135 
136 SvxGradientListItem::SvxGradientListItem()
137 {
138 }
139 
140 // -----------------------------------------------------------------------
141 
142 SvxGradientListItem::SvxGradientListItem( XGradientList* pList, sal_uInt16 nW ) :
143 	SfxPoolItem( nW ),
144 	pGradientList( pList )
145 {
146 }
147 
148 // -----------------------------------------------------------------------
149 
150 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem& rItem ) :
151 	SfxPoolItem( rItem ),
152 	pGradientList( rItem.pGradientList )
153 {
154 }
155 
156 //------------------------------------------------------------------------
157 
158 SfxItemPresentation SvxGradientListItem::GetPresentation
159 (
160     SfxItemPresentation /*ePres*/,
161     SfxMapUnit          /*eCoreUnit*/,
162     SfxMapUnit          /*ePresUnit*/,
163     XubString&          rText, const IntlWrapper *
164 )	const
165 {
166 	rText.Erase();
167 	return SFX_ITEM_PRESENTATION_NONE;
168 }
169 
170 // -----------------------------------------------------------------------
171 
172 int SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const
173 {
174 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
175 	return ( ( SvxGradientListItem& ) rItem).pGradientList == pGradientList;
176 }
177 
178 // -----------------------------------------------------------------------
179 
180 SfxPoolItem* SvxGradientListItem::Clone( SfxItemPool * ) const
181 {
182 	return new SvxGradientListItem( *this );
183 }
184 
185 // -----------------------------------------------------------------------
186 
187 sal_Bool SvxGradientListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
188 {
189     // This is only a quick helper to have UI support for these list items. Don't use
190     // this method to query for a valid UNO representation.
191     // Please ask CD if you want to change this.
192     sal_Int64 aValue = sal_Int64( (sal_uLong)pGradientList );
193     rVal = uno::makeAny( aValue );
194     return sal_True;
195 }
196 
197 // -----------------------------------------------------------------------
198 
199 sal_Bool SvxGradientListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
200 {
201     // This is only a quick helper to have UI support for these list items. Don't use
202     // this method to query for a valid UNO representation.
203     // Please ask CD if you want to change this.
204     sal_Int64 aValue = 0;
205     if ( rVal >>= aValue )
206     {
207         pGradientList = (XGradientList *)(sal_uLong)aValue;
208         return sal_True;
209     }
210 
211     return sal_False;
212 }
213 
214 //==================================================================
215 //
216 //	SvxHatchListItem
217 //
218 //==================================================================
219 
220 SvxHatchListItem::SvxHatchListItem()
221 {
222 }
223 
224 // -----------------------------------------------------------------------
225 
226 SvxHatchListItem::SvxHatchListItem( XHatchList* pList, sal_uInt16 nW ) :
227 	SfxPoolItem( nW ),
228 	pHatchList( pList )
229 {
230 }
231 
232 // -----------------------------------------------------------------------
233 
234 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem& rItem ) :
235 	SfxPoolItem( rItem ),
236 	pHatchList( rItem.pHatchList )
237 {
238 }
239 
240 //------------------------------------------------------------------------
241 
242 SfxItemPresentation SvxHatchListItem::GetPresentation
243 (
244     SfxItemPresentation /*ePres*/,
245     SfxMapUnit          /*eCoreUnit*/,
246     SfxMapUnit          /*ePresUnit*/,
247     XubString&          rText, const IntlWrapper *
248 )	const
249 {
250 	rText.Erase();
251 	return SFX_ITEM_PRESENTATION_NONE;
252 }
253 
254 // -----------------------------------------------------------------------
255 
256 int SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const
257 {
258 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
259 	return ( ( SvxHatchListItem& ) rItem).pHatchList == pHatchList;
260 }
261 
262 // -----------------------------------------------------------------------
263 
264 SfxPoolItem* SvxHatchListItem::Clone( SfxItemPool * ) const
265 {
266 	return new SvxHatchListItem( *this );
267 }
268 
269 // -----------------------------------------------------------------------
270 
271 sal_Bool SvxHatchListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
272 {
273     // This is only a quick helper to have UI support for these list items. Don't use
274     // this method to query for a valid UNO representation.
275     // Please ask CD if you want to change this.
276     sal_Int64 aValue = sal_Int64( (sal_uLong)pHatchList );
277     rVal = uno::makeAny( aValue );
278     return sal_True;
279 }
280 
281 // -----------------------------------------------------------------------
282 
283 sal_Bool SvxHatchListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
284 {
285     // This is only a quick helper to have UI support for these list items. Don't use
286     // this method to query for a valid UNO representation.
287     // Please ask CD if you want to change this.
288     sal_Int64 aValue = 0;
289     if ( rVal >>= aValue )
290     {
291         pHatchList = (XHatchList *)(sal_uLong)aValue;
292         return sal_True;
293     }
294 
295     return sal_False;
296 }
297 
298 //==================================================================
299 //
300 //	SvxBitmapListItem
301 //
302 //==================================================================
303 
304 SvxBitmapListItem::SvxBitmapListItem()
305 {
306 }
307 
308 // -----------------------------------------------------------------------
309 
310 SvxBitmapListItem::SvxBitmapListItem( XBitmapList* pList, sal_uInt16 nW ) :
311 	SfxPoolItem( nW ),
312 	pBitmapList( pList )
313 {
314 }
315 
316 // -----------------------------------------------------------------------
317 
318 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem& rItem ) :
319 	SfxPoolItem( rItem ),
320 	pBitmapList( rItem.pBitmapList )
321 {
322 }
323 
324 //------------------------------------------------------------------------
325 
326 SfxItemPresentation SvxBitmapListItem::GetPresentation
327 (
328     SfxItemPresentation /*ePres*/,
329     SfxMapUnit          /*eCoreUnit*/,
330     SfxMapUnit          /*ePresUnit*/,
331     XubString&          rText, const IntlWrapper *
332 )	const
333 {
334 	rText.Erase();
335 	return SFX_ITEM_PRESENTATION_NONE;
336 }
337 
338 // -----------------------------------------------------------------------
339 
340 int SvxBitmapListItem::operator==( const SfxPoolItem& rItem ) const
341 {
342 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
343 	return ( ( SvxBitmapListItem& ) rItem).pBitmapList == pBitmapList;
344 }
345 
346 // -----------------------------------------------------------------------
347 
348 SfxPoolItem* SvxBitmapListItem::Clone( SfxItemPool * ) const
349 {
350 	return new SvxBitmapListItem( *this );
351 }
352 
353 // -----------------------------------------------------------------------
354 
355 sal_Bool SvxBitmapListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
356 {
357     // This is only a quick helper to have UI support for these list items. Don't use
358     // this method to query for a valid UNO representation.
359     // Please ask CD if you want to change this.
360     sal_Int64 aValue = sal_Int64( (sal_uLong)pBitmapList );
361     rVal = uno::makeAny( aValue );
362     return sal_True;
363 }
364 
365 // -----------------------------------------------------------------------
366 
367 sal_Bool SvxBitmapListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
368 {
369     // This is only a quick helper to have UI support for these list items. Don't use
370     // this method to query for a valid UNO representation.
371     // Please ask CD if you want to change this.
372     sal_Int64 aValue = 0;
373     if ( rVal >>= aValue )
374     {
375         pBitmapList = (XBitmapList *)(sal_uLong)aValue;
376         return sal_True;
377     }
378 
379     return sal_False;
380 }
381 
382 
383 //==================================================================
384 //
385 //	SvxDashListItem
386 //
387 //==================================================================
388 
389 SvxDashListItem::SvxDashListItem() :
390     pDashList( 0 )
391 {
392 }
393 
394 // -----------------------------------------------------------------------
395 
396 SvxDashListItem::SvxDashListItem( XDashList* pList, sal_uInt16 nW ) :
397 	SfxPoolItem( nW ),
398 	pDashList( pList )
399 {
400 }
401 
402 // -----------------------------------------------------------------------
403 
404 SvxDashListItem::SvxDashListItem( const SvxDashListItem& rItem ) :
405 	SfxPoolItem( rItem ),
406 	pDashList( rItem.pDashList )
407 {
408 }
409 
410 //------------------------------------------------------------------------
411 
412 SfxItemPresentation SvxDashListItem::GetPresentation
413 (
414     SfxItemPresentation /*ePres*/,
415     SfxMapUnit          /*eCoreUnit*/,
416     SfxMapUnit          /*ePresUnit*/,
417     XubString&          rText, const IntlWrapper *
418 )	const
419 {
420 	rText.Erase();
421 	return SFX_ITEM_PRESENTATION_NONE;
422 }
423 
424 // -----------------------------------------------------------------------
425 
426 int SvxDashListItem::operator==( const SfxPoolItem& rItem ) const
427 {
428 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
429 	return ( ( SvxDashListItem& ) rItem).pDashList == pDashList;
430 }
431 
432 // -----------------------------------------------------------------------
433 
434 SfxPoolItem* SvxDashListItem::Clone( SfxItemPool * ) const
435 {
436 	return new SvxDashListItem( *this );
437 }
438 
439 // -----------------------------------------------------------------------
440 
441 sal_Bool SvxDashListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
442 {
443     // This is only a quick helper to have UI support for these list items. Don't use
444     // this method to query for a valid UNO representation.
445     sal_Int64 aValue = sal_Int64( (sal_uLong)pDashList );
446     rVal = uno::makeAny( aValue );
447     return sal_True;
448 }
449 
450 // -----------------------------------------------------------------------
451 
452 sal_Bool SvxDashListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
453 {
454     // This is only a quick helper to have UI support for these list items. Don't use
455     // this method to query for a valid UNO representation.
456     sal_Int64 aValue = 0;
457     if ( rVal >>= aValue )
458     {
459         pDashList = (XDashList *)(sal_uLong)aValue;
460         return sal_True;
461     }
462 
463     return sal_False;
464 }
465 
466 // -----------------------------------------------------------------------
467 
468 void SvxDashListItem::SetDashList( XDashList* pList )
469 {
470     pDashList = pList;
471 }
472 
473 //==================================================================
474 //
475 //	SvxLineEndListItem
476 //
477 //==================================================================
478 
479 SvxLineEndListItem::SvxLineEndListItem()
480 {
481 }
482 
483 // -----------------------------------------------------------------------
484 
485 SvxLineEndListItem::SvxLineEndListItem( XLineEndList* pList, sal_uInt16 nW ) :
486 	SfxPoolItem( nW ),
487 	pLineEndList( pList )
488 {
489 }
490 
491 // -----------------------------------------------------------------------
492 
493 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem& rItem ) :
494 	SfxPoolItem( rItem ),
495 	pLineEndList( rItem.pLineEndList )
496 {
497 }
498 
499 //------------------------------------------------------------------------
500 
501 SfxItemPresentation SvxLineEndListItem::GetPresentation
502 (
503     SfxItemPresentation /*ePres*/,
504     SfxMapUnit          /*eCoreUnit*/,
505     SfxMapUnit          /*ePresUnit*/,
506     XubString&          rText, const IntlWrapper *
507 )	const
508 {
509 	rText.Erase();
510 	return SFX_ITEM_PRESENTATION_NONE;
511 }
512 
513 // -----------------------------------------------------------------------
514 
515 int SvxLineEndListItem::operator==( const SfxPoolItem& rItem ) const
516 {
517 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
518 	return ( ( SvxLineEndListItem& ) rItem).pLineEndList == pLineEndList;
519 }
520 
521 // -----------------------------------------------------------------------
522 
523 SfxPoolItem* SvxLineEndListItem::Clone( SfxItemPool * ) const
524 {
525 	return new SvxLineEndListItem( *this );
526 }
527 
528 // -----------------------------------------------------------------------
529 
530 sal_Bool SvxLineEndListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
531 {
532     // This is only a quick helper to have UI support for these list items. Don't use
533     // this method to query for a valid UNO representation.
534     sal_Int64 aValue = sal_Int64( (sal_uLong)pLineEndList );
535     rVal = uno::makeAny( aValue );
536     return sal_True;
537 }
538 
539 // -----------------------------------------------------------------------
540 
541 sal_Bool SvxLineEndListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
542 {
543     // This is only a quick helper to have UI support for these list items. Don't use
544     // this method to query for a valid UNO representation.
545     sal_Int64 aValue = 0;
546     if ( rVal >>= aValue )
547     {
548         pLineEndList = (XLineEndList *)(sal_uLong)aValue;
549         return sal_True;
550     }
551 
552     return sal_False;
553 }
554