Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / svx / source / items / drawitem.cxx
blobda37496955b8e14d3c9accce55082a1d4e72f0df
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 <svx/drawitem.hxx>
21 #include <svx/xtable.hxx>
23 using namespace ::com::sun::star;
26 SfxPoolItem* SvxColorListItem::CreateDefault() { return new SvxColorListItem ;}
27 SfxPoolItem* SvxGradientListItem::CreateDefault() { return new SvxGradientListItem ;}
28 SfxPoolItem* SvxHatchListItem::CreateDefault() { return new SvxHatchListItem ;}
29 SfxPoolItem* SvxBitmapListItem::CreateDefault() { return new SvxBitmapListItem ;}
30 SfxPoolItem* SvxPatternListItem::CreateDefault() { return new SvxPatternListItem ;}
31 SfxPoolItem* SvxDashListItem::CreateDefault() { return new SvxDashListItem ;}
32 SfxPoolItem* SvxLineEndListItem::CreateDefault() { return new SvxLineEndListItem ;}
34 SvxColorListItem::SvxColorListItem()
39 SvxColorListItem::SvxColorListItem( XColorListRef const & pTable, sal_uInt16 nW ) :
40 SfxPoolItem( nW ),
41 pColorList( pTable )
46 SvxColorListItem::SvxColorListItem( const SvxColorListItem& rItem ) :
47 SfxPoolItem( rItem ),
48 pColorList( rItem.pColorList )
52 bool SvxColorListItem::GetPresentation
54 SfxItemPresentation /*ePres*/,
55 MapUnit /*eCoreUnit*/,
56 MapUnit /*ePresUnit*/,
57 OUString& rText, const IntlWrapper&
58 ) const
60 rText.clear();
61 return false;
64 bool SvxColorListItem::operator==( const SfxPoolItem& rItem ) const
66 assert(SfxPoolItem::operator==(rItem));
67 return static_cast<const SvxColorListItem&>(rItem).pColorList == pColorList;
70 SvxColorListItem* SvxColorListItem::Clone( SfxItemPool * ) const
72 return new SvxColorListItem( *this );
75 // Should be a template class but ...
76 #define QUERY_PUT_IMPL(svtype, xtype) \
77 bool svtype::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const \
78 { \
79 rVal <<= uno::Reference< uno::XWeak >( p##xtype.get() ); \
80 return true; \
81 } \
83 bool svtype::PutValue( const css::uno::Any& rVal, sal_uInt8 ) \
84 { \
85 uno::Reference< uno::XWeak > xRef; \
86 if( rVal >>= xRef ) { \
87 p##xtype = X##xtype##Ref(dynamic_cast<X##xtype *>(xRef.get())); \
88 return true; \
89 } \
90 return false; \
93 QUERY_PUT_IMPL( SvxColorListItem, ColorList )
95 SvxGradientListItem::SvxGradientListItem()
99 SvxGradientListItem::SvxGradientListItem( XGradientListRef const & pList, sal_uInt16 nW ) :
100 SfxPoolItem( nW ),
101 pGradientList( pList )
106 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem& rItem ) :
107 SfxPoolItem( rItem ),
108 pGradientList( rItem.pGradientList )
113 bool SvxGradientListItem::GetPresentation
115 SfxItemPresentation /*ePres*/,
116 MapUnit /*eCoreUnit*/,
117 MapUnit /*ePresUnit*/,
118 OUString& rText, const IntlWrapper&
119 ) const
121 rText.clear();
122 return false;
126 bool SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const
128 assert(SfxPoolItem::operator==(rItem));
129 return static_cast<const SvxGradientListItem&>(rItem).pGradientList == pGradientList;
132 SvxGradientListItem* SvxGradientListItem::Clone( SfxItemPool * ) const
134 return new SvxGradientListItem( *this );
137 QUERY_PUT_IMPL( SvxGradientListItem, GradientList )
139 SvxHatchListItem::SvxHatchListItem()
144 SvxHatchListItem::SvxHatchListItem( XHatchListRef const & pList, sal_uInt16 nW ) :
145 SfxPoolItem( nW ),
146 pHatchList( pList )
151 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem& rItem ) :
152 SfxPoolItem( rItem ),
153 pHatchList( rItem.pHatchList )
158 bool SvxHatchListItem::GetPresentation
160 SfxItemPresentation /*ePres*/,
161 MapUnit /*eCoreUnit*/,
162 MapUnit /*ePresUnit*/,
163 OUString& rText, const IntlWrapper&
164 ) const
166 rText.clear();
167 return false;
171 bool SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const
173 assert(SfxPoolItem::operator==(rItem));
174 return static_cast<const SvxHatchListItem&>(rItem).pHatchList == pHatchList;
177 SvxHatchListItem* SvxHatchListItem::Clone( SfxItemPool * ) const
179 return new SvxHatchListItem( *this );
182 QUERY_PUT_IMPL( SvxHatchListItem, HatchList )
184 SvxBitmapListItem::SvxBitmapListItem()
188 SvxBitmapListItem::SvxBitmapListItem( XBitmapListRef const & pList, sal_uInt16 nW ) :
189 SfxPoolItem( nW ),
190 pBitmapList( pList )
194 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem& rItem ) :
195 SfxPoolItem( rItem ),
196 pBitmapList( rItem.pBitmapList )
200 bool SvxBitmapListItem::GetPresentation
202 SfxItemPresentation /*ePres*/,
203 MapUnit /*eCoreUnit*/,
204 MapUnit /*ePresUnit*/,
205 OUString& rText, const IntlWrapper&
206 ) const
208 rText.clear();
209 return false;
212 bool SvxBitmapListItem::operator==( const SfxPoolItem& rItem ) const
214 assert(SfxPoolItem::operator==(rItem));
215 return static_cast<const SvxBitmapListItem&>(rItem).pBitmapList == pBitmapList;
218 SvxBitmapListItem* SvxBitmapListItem::Clone( SfxItemPool * ) const
220 return new SvxBitmapListItem( *this );
223 QUERY_PUT_IMPL( SvxBitmapListItem, BitmapList )
225 SvxPatternListItem::SvxPatternListItem()
229 SvxPatternListItem::SvxPatternListItem( XPatternListRef const & pList, sal_uInt16 nW ) :
230 SfxPoolItem( nW ),
231 pPatternList( pList )
235 SvxPatternListItem::SvxPatternListItem( const SvxPatternListItem& rItem ) :
236 SfxPoolItem( rItem ),
237 pPatternList( rItem.pPatternList )
241 bool SvxPatternListItem::GetPresentation
243 SfxItemPresentation /*ePres*/,
244 MapUnit /*eCoreUnit*/,
245 MapUnit /*ePresUnit*/,
246 OUString& rText, const IntlWrapper&
247 ) const
249 rText.clear();
250 return false;
253 bool SvxPatternListItem::operator==( const SfxPoolItem& rItem ) const
255 assert(SfxPoolItem::operator==(rItem));
256 return static_cast<const SvxPatternListItem&>(rItem).pPatternList == pPatternList;
259 SvxPatternListItem* SvxPatternListItem::Clone( SfxItemPool * ) const
261 return new SvxPatternListItem( *this );
264 QUERY_PUT_IMPL( SvxPatternListItem, PatternList )
266 SvxDashListItem::SvxDashListItem()
270 SvxDashListItem::SvxDashListItem( XDashListRef const & pList, sal_uInt16 nW ) :
271 SfxPoolItem( nW ),
272 pDashList( pList )
276 SvxDashListItem::SvxDashListItem( const SvxDashListItem& rItem ) :
277 SfxPoolItem( rItem ),
278 pDashList( rItem.pDashList )
282 bool SvxDashListItem::GetPresentation
284 SfxItemPresentation /*ePres*/,
285 MapUnit /*eCoreUnit*/,
286 MapUnit /*ePresUnit*/,
287 OUString& rText, const IntlWrapper&
288 ) const
290 rText.clear();
291 return false;
294 bool SvxDashListItem::operator==( const SfxPoolItem& rItem ) const
296 assert(SfxPoolItem::operator==(rItem));
297 return static_cast<const SvxDashListItem&>(rItem).pDashList == pDashList;
300 SvxDashListItem* SvxDashListItem::Clone( SfxItemPool * ) const
302 return new SvxDashListItem( *this );
305 QUERY_PUT_IMPL( SvxDashListItem, DashList )
307 SvxLineEndListItem::SvxLineEndListItem()
311 SvxLineEndListItem::SvxLineEndListItem( XLineEndListRef const & pList, sal_uInt16 nW ) :
312 SfxPoolItem( nW ),
313 pLineEndList( pList )
317 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem& rItem ) :
318 SfxPoolItem( rItem ),
319 pLineEndList( rItem.pLineEndList )
323 bool SvxLineEndListItem::GetPresentation
325 SfxItemPresentation /*ePres*/,
326 MapUnit /*eCoreUnit*/,
327 MapUnit /*ePresUnit*/,
328 OUString& rText, const IntlWrapper&
329 ) const
331 rText.clear();
332 return false;
335 bool SvxLineEndListItem::operator==( const SfxPoolItem& rItem ) const
337 assert(SfxPoolItem::operator==(rItem));
338 return static_cast<const SvxLineEndListItem&>(rItem).pLineEndList == pLineEndList;
341 SvxLineEndListItem* SvxLineEndListItem::Clone( SfxItemPool * ) const
343 return new SvxLineEndListItem( *this );
346 QUERY_PUT_IMPL( SvxLineEndListItem, LineEndList )
349 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */