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
SvxColorTableItem()52 SvxColorTableItem::SvxColorTableItem()
53 {
54 }
55
56 // -----------------------------------------------------------------------
57
SvxColorTableItem(XColorListSharedPtr aTable,sal_uInt16 nW)58 SvxColorTableItem::SvxColorTableItem( XColorListSharedPtr aTable, sal_uInt16 nW ) :
59 SfxPoolItem( nW ),
60 maColorTable( aTable )
61 {
62 }
63
64 // -----------------------------------------------------------------------
65
SvxColorTableItem(const SvxColorTableItem & rItem)66 SvxColorTableItem::SvxColorTableItem( const SvxColorTableItem& rItem ) :
67 SfxPoolItem( rItem ),
68 maColorTable( rItem.maColorTable )
69 {
70 }
71
72 //------------------------------------------------------------------------
73
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const74 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
operator ==(const SfxPoolItem & rItem) const88 int SvxColorTableItem::operator==( const SfxPoolItem& rItem ) const
89 {
90 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
91 return static_cast< const SvxColorTableItem& >(rItem).maColorTable == maColorTable;
92 }
93
94 // -----------------------------------------------------------------------
95
Clone(SfxItemPool *) const96 SfxPoolItem* SvxColorTableItem::Clone( SfxItemPool * ) const
97 {
98 return new SvxColorTableItem( *this );
99 }
100
101 // -----------------------------------------------------------------------
102
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const103 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)&maColorTable);
109 rVal = uno::makeAny( aValue );
110 return sal_True;
111 }
112
113 // -----------------------------------------------------------------------
114
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)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 if(aValue)
124 maColorTable = *((XColorListSharedPtr*)(sal_uLong)aValue);
125 return sal_True;
126 }
127
128 return sal_False;
129 }
130
131 //==================================================================
132 //
133 // SvxGradientListItem
134 //
135 //==================================================================
136
SvxGradientListItem()137 SvxGradientListItem::SvxGradientListItem()
138 {
139 }
140
141 // -----------------------------------------------------------------------
142
SvxGradientListItem(XGradientListSharedPtr aList,sal_uInt16 nW)143 SvxGradientListItem::SvxGradientListItem( XGradientListSharedPtr aList, sal_uInt16 nW ) :
144 SfxPoolItem( nW ),
145 maGradientList( aList )
146 {
147 }
148
149 // -----------------------------------------------------------------------
150
SvxGradientListItem(const SvxGradientListItem & rItem)151 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem& rItem ) :
152 SfxPoolItem( rItem ),
153 maGradientList( rItem.maGradientList )
154 {
155 }
156
157 //------------------------------------------------------------------------
158
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const159 SfxItemPresentation SvxGradientListItem::GetPresentation
160 (
161 SfxItemPresentation /*ePres*/,
162 SfxMapUnit /*eCoreUnit*/,
163 SfxMapUnit /*ePresUnit*/,
164 XubString& rText, const IntlWrapper *
165 ) const
166 {
167 rText.Erase();
168 return SFX_ITEM_PRESENTATION_NONE;
169 }
170
171 // -----------------------------------------------------------------------
172
operator ==(const SfxPoolItem & rItem) const173 int SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const
174 {
175 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
176 return static_cast< const SvxGradientListItem& >(rItem).maGradientList == maGradientList;
177 }
178
179 // -----------------------------------------------------------------------
180
Clone(SfxItemPool *) const181 SfxPoolItem* SvxGradientListItem::Clone( SfxItemPool * ) const
182 {
183 return new SvxGradientListItem( *this );
184 }
185
186 // -----------------------------------------------------------------------
187
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const188 sal_Bool SvxGradientListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
189 {
190 // This is only a quick helper to have UI support for these list items. Don't use
191 // this method to query for a valid UNO representation.
192 // Please ask CD if you want to change this.
193 sal_Int64 aValue = sal_Int64((sal_uLong)&maGradientList);
194 rVal = uno::makeAny( aValue );
195 return sal_True;
196 }
197
198 // -----------------------------------------------------------------------
199
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)200 sal_Bool SvxGradientListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
201 {
202 // This is only a quick helper to have UI support for these list items. Don't use
203 // this method to query for a valid UNO representation.
204 // Please ask CD if you want to change this.
205 sal_Int64 aValue = 0;
206 if ( rVal >>= aValue )
207 {
208 if(aValue)
209 maGradientList = *((XGradientListSharedPtr*)(sal_uLong)aValue);
210 return sal_True;
211 }
212
213 return sal_False;
214 }
215
216 //==================================================================
217 //
218 // SvxHatchListItem
219 //
220 //==================================================================
221
SvxHatchListItem()222 SvxHatchListItem::SvxHatchListItem()
223 {
224 }
225
226 // -----------------------------------------------------------------------
227
SvxHatchListItem(XHatchListSharedPtr aList,sal_uInt16 nW)228 SvxHatchListItem::SvxHatchListItem( XHatchListSharedPtr aList, sal_uInt16 nW ) :
229 SfxPoolItem( nW ),
230 maHatchList( aList )
231 {
232 }
233
234 // -----------------------------------------------------------------------
235
SvxHatchListItem(const SvxHatchListItem & rItem)236 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem& rItem ) :
237 SfxPoolItem( rItem ),
238 maHatchList( rItem.maHatchList )
239 {
240 }
241
242 //------------------------------------------------------------------------
243
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const244 SfxItemPresentation SvxHatchListItem::GetPresentation
245 (
246 SfxItemPresentation /*ePres*/,
247 SfxMapUnit /*eCoreUnit*/,
248 SfxMapUnit /*ePresUnit*/,
249 XubString& rText, const IntlWrapper *
250 ) const
251 {
252 rText.Erase();
253 return SFX_ITEM_PRESENTATION_NONE;
254 }
255
256 // -----------------------------------------------------------------------
257
operator ==(const SfxPoolItem & rItem) const258 int SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const
259 {
260 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
261 return static_cast< const SvxHatchListItem& >(rItem).maHatchList == maHatchList;
262 }
263
264 // -----------------------------------------------------------------------
265
Clone(SfxItemPool *) const266 SfxPoolItem* SvxHatchListItem::Clone( SfxItemPool * ) const
267 {
268 return new SvxHatchListItem( *this );
269 }
270
271 // -----------------------------------------------------------------------
272
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const273 sal_Bool SvxHatchListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
274 {
275 // This is only a quick helper to have UI support for these list items. Don't use
276 // this method to query for a valid UNO representation.
277 // Please ask CD if you want to change this.
278 sal_Int64 aValue = sal_Int64((sal_uLong)&maHatchList );
279 rVal = uno::makeAny( aValue );
280 return sal_True;
281 }
282
283 // -----------------------------------------------------------------------
284
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)285 sal_Bool SvxHatchListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
286 {
287 // This is only a quick helper to have UI support for these list items. Don't use
288 // this method to query for a valid UNO representation.
289 // Please ask CD if you want to change this.
290 sal_Int64 aValue = 0;
291 if ( rVal >>= aValue )
292 {
293 if(aValue)
294 maHatchList = *((XHatchListSharedPtr*)(sal_uLong)aValue);
295 return sal_True;
296 }
297
298 return sal_False;
299 }
300
301 //==================================================================
302 //
303 // SvxBitmapListItem
304 //
305 //==================================================================
306
SvxBitmapListItem()307 SvxBitmapListItem::SvxBitmapListItem()
308 {
309 }
310
311 // -----------------------------------------------------------------------
312
SvxBitmapListItem(XBitmapListSharedPtr aList,sal_uInt16 nW)313 SvxBitmapListItem::SvxBitmapListItem( XBitmapListSharedPtr aList, sal_uInt16 nW ) :
314 SfxPoolItem( nW ),
315 maBitmapList( aList )
316 {
317 }
318
319 // -----------------------------------------------------------------------
320
SvxBitmapListItem(const SvxBitmapListItem & rItem)321 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem& rItem ) :
322 SfxPoolItem( rItem ),
323 maBitmapList( rItem.maBitmapList )
324 {
325 }
326
327 //------------------------------------------------------------------------
328
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const329 SfxItemPresentation SvxBitmapListItem::GetPresentation
330 (
331 SfxItemPresentation /*ePres*/,
332 SfxMapUnit /*eCoreUnit*/,
333 SfxMapUnit /*ePresUnit*/,
334 XubString& rText, const IntlWrapper *
335 ) const
336 {
337 rText.Erase();
338 return SFX_ITEM_PRESENTATION_NONE;
339 }
340
341 // -----------------------------------------------------------------------
342
operator ==(const SfxPoolItem & rItem) const343 int SvxBitmapListItem::operator==( const SfxPoolItem& rItem ) const
344 {
345 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
346 return static_cast< const SvxBitmapListItem& >(rItem).maBitmapList == maBitmapList;
347 }
348
349 // -----------------------------------------------------------------------
350
Clone(SfxItemPool *) const351 SfxPoolItem* SvxBitmapListItem::Clone( SfxItemPool * ) const
352 {
353 return new SvxBitmapListItem( *this );
354 }
355
356 // -----------------------------------------------------------------------
357
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const358 sal_Bool SvxBitmapListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
359 {
360 // This is only a quick helper to have UI support for these list items. Don't use
361 // this method to query for a valid UNO representation.
362 // Please ask CD if you want to change this.
363 sal_Int64 aValue = sal_Int64((sal_uLong)&maBitmapList );
364 rVal = uno::makeAny( aValue );
365 return sal_True;
366 }
367
368 // -----------------------------------------------------------------------
369
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)370 sal_Bool SvxBitmapListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
371 {
372 // This is only a quick helper to have UI support for these list items. Don't use
373 // this method to query for a valid UNO representation.
374 // Please ask CD if you want to change this.
375 sal_Int64 aValue = 0;
376 if ( rVal >>= aValue )
377 {
378 if(aValue)
379 maBitmapList = *((XBitmapListSharedPtr*)(sal_uLong)aValue);
380 return sal_True;
381 }
382
383 return sal_False;
384 }
385
386
387 //==================================================================
388 //
389 // SvxDashListItem
390 //
391 //==================================================================
392
SvxDashListItem()393 SvxDashListItem::SvxDashListItem() :
394 maDashList()
395 {
396 }
397
398 // -----------------------------------------------------------------------
399
SvxDashListItem(XDashListSharedPtr aList,sal_uInt16 nW)400 SvxDashListItem::SvxDashListItem( XDashListSharedPtr aList, sal_uInt16 nW ) :
401 SfxPoolItem( nW ),
402 maDashList( aList )
403 {
404 }
405
406 // -----------------------------------------------------------------------
407
SvxDashListItem(const SvxDashListItem & rItem)408 SvxDashListItem::SvxDashListItem( const SvxDashListItem& rItem ) :
409 SfxPoolItem( rItem ),
410 maDashList( rItem.maDashList )
411 {
412 }
413
414 //------------------------------------------------------------------------
415
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const416 SfxItemPresentation SvxDashListItem::GetPresentation
417 (
418 SfxItemPresentation /*ePres*/,
419 SfxMapUnit /*eCoreUnit*/,
420 SfxMapUnit /*ePresUnit*/,
421 XubString& rText, const IntlWrapper *
422 ) const
423 {
424 rText.Erase();
425 return SFX_ITEM_PRESENTATION_NONE;
426 }
427
428 // -----------------------------------------------------------------------
429
operator ==(const SfxPoolItem & rItem) const430 int SvxDashListItem::operator==( const SfxPoolItem& rItem ) const
431 {
432 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
433 return static_cast< const SvxDashListItem& >(rItem).maDashList == maDashList;
434 }
435
436 // -----------------------------------------------------------------------
437
Clone(SfxItemPool *) const438 SfxPoolItem* SvxDashListItem::Clone( SfxItemPool * ) const
439 {
440 return new SvxDashListItem( *this );
441 }
442
443 // -----------------------------------------------------------------------
444
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const445 sal_Bool SvxDashListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
446 {
447 // This is only a quick helper to have UI support for these list items. Don't use
448 // this method to query for a valid UNO representation.
449 sal_Int64 aValue = sal_Int64((sal_uLong)&maDashList );
450 rVal = uno::makeAny( aValue );
451 return sal_True;
452 }
453
454 // -----------------------------------------------------------------------
455
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)456 sal_Bool SvxDashListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
457 {
458 // This is only a quick helper to have UI support for these list items. Don't use
459 // this method to query for a valid UNO representation.
460 sal_Int64 aValue = 0;
461 if ( rVal >>= aValue )
462 {
463 if(aValue)
464 maDashList = *((XDashListSharedPtr*)(sal_uLong)aValue);
465 return sal_True;
466 }
467
468 return sal_False;
469 }
470
471 //==================================================================
472 //
473 // SvxLineEndListItem
474 //
475 //==================================================================
476
SvxLineEndListItem()477 SvxLineEndListItem::SvxLineEndListItem()
478 {
479 }
480
481 // -----------------------------------------------------------------------
482
SvxLineEndListItem(XLineEndListSharedPtr aList,sal_uInt16 nW)483 SvxLineEndListItem::SvxLineEndListItem( XLineEndListSharedPtr aList, sal_uInt16 nW ) :
484 SfxPoolItem( nW ),
485 maLineEndList( aList )
486 {
487 }
488
489 // -----------------------------------------------------------------------
490
SvxLineEndListItem(const SvxLineEndListItem & rItem)491 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem& rItem ) :
492 SfxPoolItem( rItem ),
493 maLineEndList( rItem.maLineEndList )
494 {
495 }
496
497 //------------------------------------------------------------------------
498
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const499 SfxItemPresentation SvxLineEndListItem::GetPresentation
500 (
501 SfxItemPresentation /*ePres*/,
502 SfxMapUnit /*eCoreUnit*/,
503 SfxMapUnit /*ePresUnit*/,
504 XubString& rText, const IntlWrapper *
505 ) const
506 {
507 rText.Erase();
508 return SFX_ITEM_PRESENTATION_NONE;
509 }
510
511 // -----------------------------------------------------------------------
512
operator ==(const SfxPoolItem & rItem) const513 int SvxLineEndListItem::operator==( const SfxPoolItem& rItem ) const
514 {
515 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
516 return static_cast< const SvxLineEndListItem& >(rItem).maLineEndList == maLineEndList;
517 }
518
519 // -----------------------------------------------------------------------
520
Clone(SfxItemPool *) const521 SfxPoolItem* SvxLineEndListItem::Clone( SfxItemPool * ) const
522 {
523 return new SvxLineEndListItem( *this );
524 }
525
526 // -----------------------------------------------------------------------
527
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const528 sal_Bool SvxLineEndListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
529 {
530 // This is only a quick helper to have UI support for these list items. Don't use
531 // this method to query for a valid UNO representation.
532 sal_Int64 aValue = sal_Int64( (sal_uLong)&maLineEndList );
533 rVal = uno::makeAny( aValue );
534 return sal_True;
535 }
536
537 // -----------------------------------------------------------------------
538
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)539 sal_Bool SvxLineEndListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
540 {
541 // This is only a quick helper to have UI support for these list items. Don't use
542 // this method to query for a valid UNO representation.
543 sal_Int64 aValue = 0;
544 if ( rVal >>= aValue )
545 {
546 if(aValue)
547 maLineEndList = *((XLineEndListSharedPtr*)(sal_uLong)aValue);
548 return sal_True;
549 }
550
551 return sal_False;
552 }
553
554 // eof
555