1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
24 using namespace ::com::sun::star
;
27 SfxPoolItem
* SvxColorListItem::CreateDefault() { return new SvxColorListItem
;}
28 SfxPoolItem
* SvxGradientListItem::CreateDefault() { return new SvxGradientListItem
;}
29 SfxPoolItem
* SvxHatchListItem::CreateDefault() { return new SvxHatchListItem
;}
30 SfxPoolItem
* SvxBitmapListItem::CreateDefault() { return new SvxBitmapListItem
;}
31 SfxPoolItem
* SvxPatternListItem::CreateDefault() { return new SvxPatternListItem
;}
32 SfxPoolItem
* SvxDashListItem::CreateDefault() { return new SvxDashListItem
;}
33 SfxPoolItem
* SvxLineEndListItem::CreateDefault() { return new SvxLineEndListItem
;}
35 SvxColorListItem::SvxColorListItem()
40 SvxColorListItem::SvxColorListItem( XColorListRef pTable
, TypedWhichId
<SvxColorListItem
> nW
) :
42 pColorList(std::move( pTable
))
47 SvxColorListItem::SvxColorListItem( const SvxColorListItem
& rItem
) :
49 pColorList( rItem
.pColorList
)
53 bool SvxColorListItem::GetPresentation
55 SfxItemPresentation
/*ePres*/,
56 MapUnit
/*eCoreUnit*/,
57 MapUnit
/*ePresUnit*/,
58 OUString
& rText
, const IntlWrapper
&
65 bool SvxColorListItem::operator==( const SfxPoolItem
& rItem
) const
67 assert(SfxPoolItem::operator==(rItem
));
68 return static_cast<const SvxColorListItem
&>(rItem
).pColorList
== pColorList
;
71 SvxColorListItem
* SvxColorListItem::Clone( SfxItemPool
* ) const
73 return new SvxColorListItem( *this );
76 // Should be a template class but ...
77 #define QUERY_PUT_IMPL(svtype, xtype) \
78 bool svtype::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const \
80 rVal <<= uno::Reference< uno::XWeak >( p##xtype ); \
84 bool svtype::PutValue( const css::uno::Any& rVal, sal_uInt8 ) \
86 uno::Reference< uno::XWeak > xRef; \
87 if( rVal >>= xRef ) { \
88 p##xtype = X##xtype##Ref(dynamic_cast<X##xtype *>(xRef.get())); \
94 QUERY_PUT_IMPL( SvxColorListItem
, ColorList
)
96 SvxGradientListItem::SvxGradientListItem()
100 SvxGradientListItem::SvxGradientListItem( XGradientListRef pList
, TypedWhichId
<SvxGradientListItem
> nW
) :
102 pGradientList(std::move( pList
))
107 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem
& rItem
) :
108 SfxPoolItem( rItem
),
109 pGradientList( rItem
.pGradientList
)
114 bool SvxGradientListItem::GetPresentation
116 SfxItemPresentation
/*ePres*/,
117 MapUnit
/*eCoreUnit*/,
118 MapUnit
/*ePresUnit*/,
119 OUString
& rText
, const IntlWrapper
&
127 bool SvxGradientListItem::operator==( const SfxPoolItem
& rItem
) const
129 assert(SfxPoolItem::operator==(rItem
));
130 return static_cast<const SvxGradientListItem
&>(rItem
).pGradientList
== pGradientList
;
133 SvxGradientListItem
* SvxGradientListItem::Clone( SfxItemPool
* ) const
135 return new SvxGradientListItem( *this );
138 QUERY_PUT_IMPL( SvxGradientListItem
, GradientList
)
140 SvxHatchListItem::SvxHatchListItem()
145 SvxHatchListItem::SvxHatchListItem( XHatchListRef pList
, TypedWhichId
<SvxHatchListItem
> nW
) :
147 pHatchList(std::move( pList
))
152 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem
& rItem
) :
153 SfxPoolItem( rItem
),
154 pHatchList( rItem
.pHatchList
)
159 bool SvxHatchListItem::GetPresentation
161 SfxItemPresentation
/*ePres*/,
162 MapUnit
/*eCoreUnit*/,
163 MapUnit
/*ePresUnit*/,
164 OUString
& rText
, const IntlWrapper
&
172 bool SvxHatchListItem::operator==( const SfxPoolItem
& rItem
) const
174 assert(SfxPoolItem::operator==(rItem
));
175 return static_cast<const SvxHatchListItem
&>(rItem
).pHatchList
== pHatchList
;
178 SvxHatchListItem
* SvxHatchListItem::Clone( SfxItemPool
* ) const
180 return new SvxHatchListItem( *this );
183 QUERY_PUT_IMPL( SvxHatchListItem
, HatchList
)
185 SvxBitmapListItem::SvxBitmapListItem()
189 SvxBitmapListItem::SvxBitmapListItem( XBitmapListRef pList
, TypedWhichId
<SvxBitmapListItem
> nW
) :
191 pBitmapList(std::move( pList
))
195 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem
& rItem
) :
196 SfxPoolItem( rItem
),
197 pBitmapList( rItem
.pBitmapList
)
201 bool SvxBitmapListItem::GetPresentation
203 SfxItemPresentation
/*ePres*/,
204 MapUnit
/*eCoreUnit*/,
205 MapUnit
/*ePresUnit*/,
206 OUString
& rText
, const IntlWrapper
&
213 bool SvxBitmapListItem::operator==( const SfxPoolItem
& rItem
) const
215 assert(SfxPoolItem::operator==(rItem
));
216 return static_cast<const SvxBitmapListItem
&>(rItem
).pBitmapList
== pBitmapList
;
219 SvxBitmapListItem
* SvxBitmapListItem::Clone( SfxItemPool
* ) const
221 return new SvxBitmapListItem( *this );
224 QUERY_PUT_IMPL( SvxBitmapListItem
, BitmapList
)
226 SvxPatternListItem::SvxPatternListItem()
230 SvxPatternListItem::SvxPatternListItem( XPatternListRef pList
, TypedWhichId
<SvxPatternListItem
> nW
) :
232 pPatternList(std::move( pList
))
236 SvxPatternListItem::SvxPatternListItem( const SvxPatternListItem
& rItem
) :
237 SfxPoolItem( rItem
),
238 pPatternList( rItem
.pPatternList
)
242 bool SvxPatternListItem::GetPresentation
244 SfxItemPresentation
/*ePres*/,
245 MapUnit
/*eCoreUnit*/,
246 MapUnit
/*ePresUnit*/,
247 OUString
& rText
, const IntlWrapper
&
254 bool SvxPatternListItem::operator==( const SfxPoolItem
& rItem
) const
256 assert(SfxPoolItem::operator==(rItem
));
257 return static_cast<const SvxPatternListItem
&>(rItem
).pPatternList
== pPatternList
;
260 SvxPatternListItem
* SvxPatternListItem::Clone( SfxItemPool
* ) const
262 return new SvxPatternListItem( *this );
265 QUERY_PUT_IMPL( SvxPatternListItem
, PatternList
)
267 SvxDashListItem::SvxDashListItem()
271 SvxDashListItem::SvxDashListItem( XDashListRef pList
, TypedWhichId
<SvxDashListItem
> nW
) :
273 pDashList(std::move( pList
))
277 SvxDashListItem::SvxDashListItem( const SvxDashListItem
& rItem
) :
278 SfxPoolItem( rItem
),
279 pDashList( rItem
.pDashList
)
283 bool SvxDashListItem::GetPresentation
285 SfxItemPresentation
/*ePres*/,
286 MapUnit
/*eCoreUnit*/,
287 MapUnit
/*ePresUnit*/,
288 OUString
& rText
, const IntlWrapper
&
295 bool SvxDashListItem::operator==( const SfxPoolItem
& rItem
) const
297 assert(SfxPoolItem::operator==(rItem
));
298 return static_cast<const SvxDashListItem
&>(rItem
).pDashList
== pDashList
;
301 SvxDashListItem
* SvxDashListItem::Clone( SfxItemPool
* ) const
303 return new SvxDashListItem( *this );
306 QUERY_PUT_IMPL( SvxDashListItem
, DashList
)
308 SvxLineEndListItem::SvxLineEndListItem()
312 SvxLineEndListItem::SvxLineEndListItem( XLineEndListRef pList
, TypedWhichId
<SvxLineEndListItem
> nW
) :
314 pLineEndList(std::move( pList
))
318 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem
& rItem
) :
319 SfxPoolItem( rItem
),
320 pLineEndList( rItem
.pLineEndList
)
324 bool SvxLineEndListItem::GetPresentation
326 SfxItemPresentation
/*ePres*/,
327 MapUnit
/*eCoreUnit*/,
328 MapUnit
/*ePresUnit*/,
329 OUString
& rText
, const IntlWrapper
&
336 bool SvxLineEndListItem::operator==( const SfxPoolItem
& rItem
) const
338 assert(SfxPoolItem::operator==(rItem
));
339 return static_cast<const SvxLineEndListItem
&>(rItem
).pLineEndList
== pLineEndList
;
342 SvxLineEndListItem
* SvxLineEndListItem::Clone( SfxItemPool
* ) const
344 return new SvxLineEndListItem( *this );
347 QUERY_PUT_IMPL( SvxLineEndListItem
, LineEndList
)
350 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */