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 //==================================================================
37 //==================================================================
39 SvxColorListItem::SvxColorListItem()
44 SvxColorListItem::SvxColorListItem( XColorListRef pTable
, sal_uInt16 nW
) :
51 SvxColorListItem::SvxColorListItem( const SvxColorListItem
& rItem
) :
53 pColorList( rItem
.pColorList
)
57 SfxItemPresentation
SvxColorListItem::GetPresentation
59 SfxItemPresentation
/*ePres*/,
60 SfxMapUnit
/*eCoreUnit*/,
61 SfxMapUnit
/*ePresUnit*/,
62 OUString
& rText
, const IntlWrapper
*
66 return SFX_ITEM_PRESENTATION_NONE
;
69 int SvxColorListItem::operator==( const SfxPoolItem
& rItem
) const
71 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
72 return ( ( SvxColorListItem
& ) rItem
).pColorList
== pColorList
;
75 SfxPoolItem
* SvxColorListItem::Clone( SfxItemPool
* ) const
77 return new SvxColorListItem( *this );
81 // Should be a template class but ...
82 #define QUERY_PUT_IMPL(svtype, xtype) \
83 bool svtype::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const \
85 rVal = uno::makeAny( uno::Reference< uno::XWeak >( p##xtype.get() ) ); \
89 bool svtype::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) \
91 uno::Reference< uno::XWeak > xRef; \
92 if( rVal >>= xRef ) { \
93 p##xtype = X##xtype##Ref(dynamic_cast<X##xtype *>(xRef.get())); \
99 QUERY_PUT_IMPL( SvxColorListItem
, ColorList
)
101 //==================================================================
103 // SvxGradientListItem
105 //==================================================================
107 SvxGradientListItem::SvxGradientListItem()
111 SvxGradientListItem::SvxGradientListItem( XGradientListRef pList
, sal_uInt16 nW
) :
113 pGradientList( pList
)
118 SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem
& rItem
) :
119 SfxPoolItem( rItem
),
120 pGradientList( rItem
.pGradientList
)
124 //------------------------------------------------------------------------
126 SfxItemPresentation
SvxGradientListItem::GetPresentation
128 SfxItemPresentation
/*ePres*/,
129 SfxMapUnit
/*eCoreUnit*/,
130 SfxMapUnit
/*ePresUnit*/,
131 OUString
& rText
, const IntlWrapper
*
135 return SFX_ITEM_PRESENTATION_NONE
;
139 int SvxGradientListItem::operator==( const SfxPoolItem
& rItem
) const
141 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
142 return ( ( SvxGradientListItem
& ) rItem
).pGradientList
== pGradientList
;
146 SfxPoolItem
* SvxGradientListItem::Clone( SfxItemPool
* ) const
148 return new SvxGradientListItem( *this );
152 QUERY_PUT_IMPL( SvxGradientListItem
, GradientList
)
154 //==================================================================
158 //==================================================================
160 SvxHatchListItem::SvxHatchListItem()
165 SvxHatchListItem::SvxHatchListItem( XHatchListRef pList
, sal_uInt16 nW
) :
172 SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem
& rItem
) :
173 SfxPoolItem( rItem
),
174 pHatchList( rItem
.pHatchList
)
178 //------------------------------------------------------------------------
180 SfxItemPresentation
SvxHatchListItem::GetPresentation
182 SfxItemPresentation
/*ePres*/,
183 SfxMapUnit
/*eCoreUnit*/,
184 SfxMapUnit
/*ePresUnit*/,
185 OUString
& rText
, const IntlWrapper
*
189 return SFX_ITEM_PRESENTATION_NONE
;
193 int SvxHatchListItem::operator==( const SfxPoolItem
& rItem
) const
195 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
196 return ( ( SvxHatchListItem
& ) rItem
).pHatchList
== pHatchList
;
200 SfxPoolItem
* SvxHatchListItem::Clone( SfxItemPool
* ) const
202 return new SvxHatchListItem( *this );
205 QUERY_PUT_IMPL( SvxHatchListItem
, HatchList
)
208 //==================================================================
212 //==================================================================
214 SvxBitmapListItem::SvxBitmapListItem()
218 SvxBitmapListItem::SvxBitmapListItem( XBitmapListRef pList
, sal_uInt16 nW
) :
224 SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem
& rItem
) :
225 SfxPoolItem( rItem
),
226 pBitmapList( rItem
.pBitmapList
)
230 SfxItemPresentation
SvxBitmapListItem::GetPresentation
232 SfxItemPresentation
/*ePres*/,
233 SfxMapUnit
/*eCoreUnit*/,
234 SfxMapUnit
/*ePresUnit*/,
235 OUString
& rText
, const IntlWrapper
*
239 return SFX_ITEM_PRESENTATION_NONE
;
242 int SvxBitmapListItem::operator==( const SfxPoolItem
& rItem
) const
244 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
245 return ( ( SvxBitmapListItem
& ) rItem
).pBitmapList
== pBitmapList
;
248 SfxPoolItem
* SvxBitmapListItem::Clone( SfxItemPool
* ) const
250 return new SvxBitmapListItem( *this );
253 QUERY_PUT_IMPL( SvxBitmapListItem
, BitmapList
)
255 //==================================================================
259 //==================================================================
261 SvxDashListItem::SvxDashListItem() :
266 SvxDashListItem::SvxDashListItem( XDashListRef pList
, sal_uInt16 nW
) :
272 SvxDashListItem::SvxDashListItem( const SvxDashListItem
& rItem
) :
273 SfxPoolItem( rItem
),
274 pDashList( rItem
.pDashList
)
278 SfxItemPresentation
SvxDashListItem::GetPresentation
280 SfxItemPresentation
/*ePres*/,
281 SfxMapUnit
/*eCoreUnit*/,
282 SfxMapUnit
/*ePresUnit*/,
283 OUString
& rText
, const IntlWrapper
*
287 return SFX_ITEM_PRESENTATION_NONE
;
290 int SvxDashListItem::operator==( const SfxPoolItem
& rItem
) const
292 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
293 return ( ( SvxDashListItem
& ) rItem
).pDashList
== pDashList
;
296 SfxPoolItem
* SvxDashListItem::Clone( SfxItemPool
* ) const
298 return new SvxDashListItem( *this );
301 QUERY_PUT_IMPL( SvxDashListItem
, DashList
)
303 //==================================================================
305 // SvxLineEndListItem
307 //==================================================================
309 SvxLineEndListItem::SvxLineEndListItem()
313 SvxLineEndListItem::SvxLineEndListItem( XLineEndListRef pList
, sal_uInt16 nW
) :
315 pLineEndList( pList
)
319 SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem
& rItem
) :
320 SfxPoolItem( rItem
),
321 pLineEndList( rItem
.pLineEndList
)
325 SfxItemPresentation
SvxLineEndListItem::GetPresentation
327 SfxItemPresentation
/*ePres*/,
328 SfxMapUnit
/*eCoreUnit*/,
329 SfxMapUnit
/*ePresUnit*/,
330 OUString
& rText
, const IntlWrapper
*
334 return SFX_ITEM_PRESENTATION_NONE
;
337 int SvxLineEndListItem::operator==( const SfxPoolItem
& rItem
) const
339 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
340 return ( ( SvxLineEndListItem
& ) rItem
).pLineEndList
== pLineEndList
;
343 SfxPoolItem
* SvxLineEndListItem::Clone( SfxItemPool
* ) const
345 return new SvxLineEndListItem( *this );
348 QUERY_PUT_IMPL( SvxLineEndListItem
, LineEndList
)
351 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */