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/svxids.hrc>
21 #include <svx/drawitem.hxx>
22 #include <svx/xtable.hxx>
24 using namespace ::com::sun::star
;
26 TYPEINIT1_FACTORY( SvxColorListItem
, SfxPoolItem
, new SvxColorListItem
);
27 TYPEINIT1_FACTORY( SvxGradientListItem
, SfxPoolItem
, new SvxGradientListItem
);
28 TYPEINIT1_FACTORY( SvxHatchListItem
, SfxPoolItem
, new SvxHatchListItem
);
29 TYPEINIT1_FACTORY( SvxBitmapListItem
, SfxPoolItem
, new SvxBitmapListItem
);
30 TYPEINIT1_FACTORY( SvxDashListItem
, SfxPoolItem
, new SvxDashListItem
);
31 TYPEINIT1_FACTORY( SvxLineEndListItem
, SfxPoolItem
, new SvxLineEndListItem
);
33 SvxColorListItem::SvxColorListItem()
38 SvxColorListItem::SvxColorListItem( XColorListRef pTable
, sal_uInt16 nW
) :
45 SvxColorListItem::SvxColorListItem( const SvxColorListItem
& rItem
) :
47 pColorList( rItem
.pColorList
)
51 bool SvxColorListItem::GetPresentation
53 SfxItemPresentation
/*ePres*/,
54 SfxMapUnit
/*eCoreUnit*/,
55 SfxMapUnit
/*ePresUnit*/,
56 OUString
& rText
, const IntlWrapper
*
63 bool SvxColorListItem::operator==( const SfxPoolItem
& rItem
) const
65 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
66 return static_cast<const SvxColorListItem
&>(rItem
).pColorList
== pColorList
;
69 SfxPoolItem
* SvxColorListItem::Clone( SfxItemPool
* ) const
71 return new SvxColorListItem( *this );
75 // Should be a template class but ...
76 #define QUERY_PUT_IMPL(svtype, xtype) \
77 bool svtype::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const \
79 rVal = uno::makeAny( uno::Reference< uno::XWeak >( p##xtype.get() ) ); \
83 bool svtype::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) \
85 uno::Reference< uno::XWeak > xRef; \
86 if( rVal >>= xRef ) { \
87 p##xtype = X##xtype##Ref(dynamic_cast<X##xtype *>(xRef.get())); \
93 QUERY_PUT_IMPL( SvxColorListItem
, ColorList
)
95 SvxGradientListItem::SvxGradientListItem()
99 SvxGradientListItem::SvxGradientListItem( XGradientListRef pList
, sal_uInt16 nW
) :
101 pGradientList( pList
)
106 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem
& rItem
) :
107 SfxPoolItem( rItem
),
108 pGradientList( rItem
.pGradientList
)
114 bool SvxGradientListItem::GetPresentation
116 SfxItemPresentation
/*ePres*/,
117 SfxMapUnit
/*eCoreUnit*/,
118 SfxMapUnit
/*ePresUnit*/,
119 OUString
& rText
, const IntlWrapper
*
127 bool SvxGradientListItem::operator==( const SfxPoolItem
& rItem
) const
129 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
130 return static_cast<const SvxGradientListItem
&>(rItem
).pGradientList
== pGradientList
;
134 SfxPoolItem
* SvxGradientListItem::Clone( SfxItemPool
* ) const
136 return new SvxGradientListItem( *this );
140 QUERY_PUT_IMPL( SvxGradientListItem
, GradientList
)
142 SvxHatchListItem::SvxHatchListItem()
147 SvxHatchListItem::SvxHatchListItem( XHatchListRef pList
, sal_uInt16 nW
) :
154 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem
& rItem
) :
155 SfxPoolItem( rItem
),
156 pHatchList( rItem
.pHatchList
)
162 bool SvxHatchListItem::GetPresentation
164 SfxItemPresentation
/*ePres*/,
165 SfxMapUnit
/*eCoreUnit*/,
166 SfxMapUnit
/*ePresUnit*/,
167 OUString
& rText
, const IntlWrapper
*
175 bool SvxHatchListItem::operator==( const SfxPoolItem
& rItem
) const
177 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
178 return static_cast<const SvxHatchListItem
&>(rItem
).pHatchList
== pHatchList
;
182 SfxPoolItem
* SvxHatchListItem::Clone( SfxItemPool
* ) const
184 return new SvxHatchListItem( *this );
187 QUERY_PUT_IMPL( SvxHatchListItem
, HatchList
)
189 SvxBitmapListItem::SvxBitmapListItem()
193 SvxBitmapListItem::SvxBitmapListItem( XBitmapListRef pList
, sal_uInt16 nW
) :
199 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem
& rItem
) :
200 SfxPoolItem( rItem
),
201 pBitmapList( rItem
.pBitmapList
)
205 bool SvxBitmapListItem::GetPresentation
207 SfxItemPresentation
/*ePres*/,
208 SfxMapUnit
/*eCoreUnit*/,
209 SfxMapUnit
/*ePresUnit*/,
210 OUString
& rText
, const IntlWrapper
*
217 bool SvxBitmapListItem::operator==( const SfxPoolItem
& rItem
) const
219 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
220 return static_cast<const SvxBitmapListItem
&>(rItem
).pBitmapList
== pBitmapList
;
223 SfxPoolItem
* SvxBitmapListItem::Clone( SfxItemPool
* ) const
225 return new SvxBitmapListItem( *this );
228 QUERY_PUT_IMPL( SvxBitmapListItem
, BitmapList
)
230 SvxDashListItem::SvxDashListItem() :
235 SvxDashListItem::SvxDashListItem( XDashListRef pList
, sal_uInt16 nW
) :
241 SvxDashListItem::SvxDashListItem( const SvxDashListItem
& rItem
) :
242 SfxPoolItem( rItem
),
243 pDashList( rItem
.pDashList
)
247 bool SvxDashListItem::GetPresentation
249 SfxItemPresentation
/*ePres*/,
250 SfxMapUnit
/*eCoreUnit*/,
251 SfxMapUnit
/*ePresUnit*/,
252 OUString
& rText
, const IntlWrapper
*
259 bool SvxDashListItem::operator==( const SfxPoolItem
& rItem
) const
261 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
262 return static_cast<const SvxDashListItem
&>(rItem
).pDashList
== pDashList
;
265 SfxPoolItem
* SvxDashListItem::Clone( SfxItemPool
* ) const
267 return new SvxDashListItem( *this );
270 QUERY_PUT_IMPL( SvxDashListItem
, DashList
)
272 SvxLineEndListItem::SvxLineEndListItem()
276 SvxLineEndListItem::SvxLineEndListItem( XLineEndListRef pList
, sal_uInt16 nW
) :
278 pLineEndList( pList
)
282 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem
& rItem
) :
283 SfxPoolItem( rItem
),
284 pLineEndList( rItem
.pLineEndList
)
288 bool SvxLineEndListItem::GetPresentation
290 SfxItemPresentation
/*ePres*/,
291 SfxMapUnit
/*eCoreUnit*/,
292 SfxMapUnit
/*ePresUnit*/,
293 OUString
& rText
, const IntlWrapper
*
300 bool SvxLineEndListItem::operator==( const SfxPoolItem
& rItem
) const
302 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
303 return static_cast<const SvxLineEndListItem
&>(rItem
).pLineEndList
== pLineEndList
;
306 SfxPoolItem
* SvxLineEndListItem::Clone( SfxItemPool
* ) const
308 return new SvxLineEndListItem( *this );
311 QUERY_PUT_IMPL( SvxLineEndListItem
, LineEndList
)
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */