1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*40df464eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*40df464eSAndrew Rist * distributed with this work for additional information
6*40df464eSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*40df464eSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist * with the License. You may obtain a copy of the License at
10*40df464eSAndrew Rist *
11*40df464eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*40df464eSAndrew Rist *
13*40df464eSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist * software distributed under the License is distributed on an
15*40df464eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist * KIND, either express or implied. See the License for the
17*40df464eSAndrew Rist * specific language governing permissions and limitations
18*40df464eSAndrew Rist * under the License.
19*40df464eSAndrew Rist *
20*40df464eSAndrew Rist *************************************************************/
21*40df464eSAndrew Rist
22*40df464eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svl.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <svl/poolitem.hxx>
28cdf0e10cSrcweir #include <tools/stream.hxx>
29cdf0e10cSrcweir
30cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
31cdf0e10cSrcweir
32cdf0e10cSrcweir DBG_NAME(SfxPoolItem)
33cdf0e10cSrcweir DBG_NAME(SfxVoidItem)
34cdf0e10cSrcweir // @@@ DBG_NAME(SfxInvalidItem);
35cdf0e10cSrcweir DBG_NAME(SfxItemHandle)
36cdf0e10cSrcweir
37cdf0e10cSrcweir sal_uInt8 nSfxFlag8Val[8] =
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 1, 2, 4, 8, 16, 32, 64, 128
40cdf0e10cSrcweir };
41cdf0e10cSrcweir
42cdf0e10cSrcweir sal_uInt16 nSfxFlag16Val[16] =
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 1, 2, 4, 8, 16, 32, 64, 128, 256, 512,
45cdf0e10cSrcweir 1024, 2048, 4096, 8192, 16384, 32768
46cdf0e10cSrcweir };
47cdf0e10cSrcweir
48cdf0e10cSrcweir sal_uLong nSfxFlag32Val[32] =
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 0x1L, 0x2L, 0x4L, 0x8L,
51cdf0e10cSrcweir 0x10L, 0x20L, 0x40L, 0x80L,
52cdf0e10cSrcweir 0x100L, 0x200L, 0x400L, 0x800L,
53cdf0e10cSrcweir 0x1000L, 0x2000L, 0x40000L, 0x8000L,
54cdf0e10cSrcweir 0x10000L, 0x20000L, 0x40000L, 0x80000L,
55cdf0e10cSrcweir 0x100000L, 0x200000L, 0x400000L, 0x800000L,
56cdf0e10cSrcweir 0x1000000L, 0x2000000L, 0x4000000L, 0x8000000L,
57cdf0e10cSrcweir 0x10000000L, 0x20000000L, 0x40000000L, 0x80000000L
58cdf0e10cSrcweir };
59cdf0e10cSrcweir
60cdf0e10cSrcweir // RTTI ------------------------------------------------------------------
61cdf0e10cSrcweir
62cdf0e10cSrcweir TYPEINIT0(SfxPoolItem);
63cdf0e10cSrcweir TYPEINIT1(SfxVoidItem, SfxPoolItem);
64cdf0e10cSrcweir // @@@ TYPEINIT1(SfxInvalidItem, SfxPoolItem);
65cdf0e10cSrcweir TYPEINIT1(SfxSetItem, SfxPoolItem);
66cdf0e10cSrcweir // @@@ TYPEINIT1(SfxItemChangedHint, SfxHint);
67cdf0e10cSrcweir
68cdf0e10cSrcweir // ------------------------------------------------------------------------
69cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
70cdf0e10cSrcweir static sal_uLong nItemCount = 0;
71cdf0e10cSrcweir
72cdf0e10cSrcweir const char* pw1 = "Wow! 10.000 items!";
73cdf0e10cSrcweir const char* pw2 = "Wow! 100.000 items!";
74cdf0e10cSrcweir const char* pw3 = "Wow! 1.000.000 items!";
75cdf0e10cSrcweir const char* pw4 = "Wow! 50.000.000 items!";
76cdf0e10cSrcweir const char* pw5 = "Wow! 10.000.000 items!";
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir
IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem)79cdf0e10cSrcweir IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem)
80cdf0e10cSrcweir
81cdf0e10cSrcweir // SfxPoolItem -----------------------------------------------------------
82cdf0e10cSrcweir SfxPoolItem::SfxPoolItem( sal_uInt16 nW )
83cdf0e10cSrcweir : nRefCount( 0 ),
84cdf0e10cSrcweir nWhich( nW )
85cdf0e10cSrcweir , nKind( 0 )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir DBG_CTOR(SfxPoolItem, 0);
88cdf0e10cSrcweir DBG_ASSERT(nW <= SHRT_MAX, "Which Bereich ueberschritten");
89cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
90cdf0e10cSrcweir ++nItemCount;
91cdf0e10cSrcweir if ( pw1 && nItemCount>=10000 )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir DBG_WARNING( pw1 );
94cdf0e10cSrcweir pw1 = NULL;
95cdf0e10cSrcweir }
96cdf0e10cSrcweir if ( pw2 && nItemCount>=100000 )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir DBG_WARNING( pw2 );
99cdf0e10cSrcweir pw2 = NULL;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir if ( pw3 && nItemCount>=1000000 )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir DBG_WARNING( pw3 );
104cdf0e10cSrcweir pw3 = NULL;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir if ( pw4 && nItemCount>=5000000 )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir DBG_WARNING( pw4 );
109cdf0e10cSrcweir pw4 = NULL;
110cdf0e10cSrcweir }
111cdf0e10cSrcweir if ( pw5 && nItemCount>=10000000 )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir DBG_WARNING( pw5 );
114cdf0e10cSrcweir pw5 = NULL;
115cdf0e10cSrcweir }
116cdf0e10cSrcweir #endif
117cdf0e10cSrcweir }
118cdf0e10cSrcweir
119cdf0e10cSrcweir // -----------------------------------------------------------------------
SfxPoolItem(const SfxPoolItem & rCpy)120cdf0e10cSrcweir SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy )
121cdf0e10cSrcweir : nRefCount( 0 ), // wird ja ein neues Object!
122cdf0e10cSrcweir nWhich( rCpy.Which() ) // Funktion rufen wg. ChkThis()
123cdf0e10cSrcweir , nKind( 0 )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir DBG_CTOR(SfxPoolItem, 0);
126cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
127cdf0e10cSrcweir ++nItemCount;
128cdf0e10cSrcweir if ( pw1 && nItemCount>=10000 )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir DBG_WARNING( pw1 );
131cdf0e10cSrcweir pw1 = NULL;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir if ( pw2 && nItemCount>=100000 )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir DBG_WARNING( pw2 );
136cdf0e10cSrcweir pw2 = NULL;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir if ( pw3 && nItemCount>=1000000 )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir DBG_WARNING( pw3 );
141cdf0e10cSrcweir pw3 = NULL;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir if ( pw4 && nItemCount>=5000000 )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir DBG_WARNING( pw4 );
146cdf0e10cSrcweir pw4 = NULL;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir if ( pw5 && nItemCount>=10000000 )
149cdf0e10cSrcweir {
150cdf0e10cSrcweir DBG_WARNING( pw5 );
151cdf0e10cSrcweir pw5 = NULL;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir #endif
154cdf0e10cSrcweir }
155cdf0e10cSrcweir
156cdf0e10cSrcweir // ------------------------------------------------------------------------
~SfxPoolItem()157cdf0e10cSrcweir SfxPoolItem::~SfxPoolItem()
158cdf0e10cSrcweir {
159cdf0e10cSrcweir DBG_DTOR(SfxPoolItem, 0);
160cdf0e10cSrcweir DBG_ASSERT(nRefCount == 0 || nRefCount > SFX_ITEMS_MAXREF, "destroying item in use" );
161cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
162cdf0e10cSrcweir --nItemCount;
163cdf0e10cSrcweir #endif
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir // ------------------------------------------------------------------------
Compare(const SfxPoolItem &) const167cdf0e10cSrcweir int SfxPoolItem::Compare( const SfxPoolItem& ) const
168cdf0e10cSrcweir {
169cdf0e10cSrcweir return 0;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir
172cdf0e10cSrcweir // ------------------------------------------------------------------------
Compare(const SfxPoolItem & rWith,const IntlWrapper &) const173cdf0e10cSrcweir int SfxPoolItem::Compare( const SfxPoolItem& rWith, const IntlWrapper& ) const
174cdf0e10cSrcweir {
175cdf0e10cSrcweir return Compare( rWith );
176cdf0e10cSrcweir }
177cdf0e10cSrcweir
178cdf0e10cSrcweir // ------------------------------------------------------------------------
operator ==(const SfxPoolItem & rCmp) const179cdf0e10cSrcweir int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
180cdf0e10cSrcweir {
181cdf0e10cSrcweir DBG_CHKTHIS(SfxPoolItem, 0);
182cdf0e10cSrcweir return rCmp.Type() == Type();
183cdf0e10cSrcweir }
184cdf0e10cSrcweir
185cdf0e10cSrcweir // -----------------------------------------------------------------------
186cdf0e10cSrcweir #ifndef TF_POOLABLE
187cdf0e10cSrcweir
IsPoolable() const188cdf0e10cSrcweir int SfxPoolItem::IsPoolable() const
189cdf0e10cSrcweir {
190cdf0e10cSrcweir DBG_CHKTHIS(SfxPoolItem, 0);
191cdf0e10cSrcweir return sal_True;
192cdf0e10cSrcweir }
193cdf0e10cSrcweir #endif
194cdf0e10cSrcweir
195cdf0e10cSrcweir // -----------------------------------------------------------------------
Create(SvStream &,sal_uInt16) const196cdf0e10cSrcweir SfxPoolItem* SfxPoolItem::Create(SvStream &, sal_uInt16) const
197cdf0e10cSrcweir {
198cdf0e10cSrcweir DBG_CHKTHIS(SfxPoolItem, 0);
199cdf0e10cSrcweir return Clone(0);
200cdf0e10cSrcweir }
201cdf0e10cSrcweir
202cdf0e10cSrcweir // -----------------------------------------------------------------------
GetVersion(sal_uInt16) const203cdf0e10cSrcweir sal_uInt16 SfxPoolItem::GetVersion( sal_uInt16 ) const
204cdf0e10cSrcweir {
205cdf0e10cSrcweir DBG_CHKTHIS(SfxPoolItem, 0);
206cdf0e10cSrcweir return 0;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
209cdf0e10cSrcweir // -----------------------------------------------------------------------
Store(SvStream & rStream,sal_uInt16) const210cdf0e10cSrcweir SvStream& SfxPoolItem::Store(SvStream &rStream, sal_uInt16 ) const
211cdf0e10cSrcweir {
212cdf0e10cSrcweir DBG_CHKTHIS(SfxPoolItem, 0);
213cdf0e10cSrcweir return rStream;
214cdf0e10cSrcweir }
215cdf0e10cSrcweir
216cdf0e10cSrcweir //============================================================================
217cdf0e10cSrcweir // static
readByteString(SvStream & rStream,UniString & rString)218cdf0e10cSrcweir bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString)
219cdf0e10cSrcweir {
220cdf0e10cSrcweir rStream.ReadByteString(rString);
221cdf0e10cSrcweir return rStream.GetError() == ERRCODE_NONE;
222cdf0e10cSrcweir }
223cdf0e10cSrcweir
224cdf0e10cSrcweir //============================================================================
225cdf0e10cSrcweir // static
writeByteString(SvStream & rStream,UniString const & rString)226cdf0e10cSrcweir void SfxPoolItem::writeByteString(SvStream & rStream,
227cdf0e10cSrcweir UniString const & rString)
228cdf0e10cSrcweir {
229cdf0e10cSrcweir rStream.WriteByteString(rString);
230cdf0e10cSrcweir }
231cdf0e10cSrcweir
232cdf0e10cSrcweir //============================================================================
233cdf0e10cSrcweir // static
readUnicodeString(SvStream & rStream,UniString & rString,bool bUnicode)234cdf0e10cSrcweir bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString,
235cdf0e10cSrcweir bool bUnicode)
236cdf0e10cSrcweir {
237cdf0e10cSrcweir rStream.ReadByteString(rString,
238cdf0e10cSrcweir bUnicode ? RTL_TEXTENCODING_UCS2 :
239cdf0e10cSrcweir rStream.GetStreamCharSet());
240cdf0e10cSrcweir return rStream.GetError() == ERRCODE_NONE;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir
243cdf0e10cSrcweir //============================================================================
244cdf0e10cSrcweir // static
writeUnicodeString(SvStream & rStream,UniString const & rString)245cdf0e10cSrcweir void SfxPoolItem::writeUnicodeString(SvStream & rStream,
246cdf0e10cSrcweir UniString const & rString)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir rStream.WriteByteString(rString, RTL_TEXTENCODING_UCS2);
249cdf0e10cSrcweir }
250cdf0e10cSrcweir
251cdf0e10cSrcweir // ------------------------------------------------------------------------
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString &,const IntlWrapper *) const252cdf0e10cSrcweir SfxItemPresentation SfxPoolItem::GetPresentation
253cdf0e10cSrcweir (
254cdf0e10cSrcweir SfxItemPresentation /*ePresentation*/, // IN: wie formatiert werden soll
255cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/, // IN: Ma\seinheit des SfxPoolItems
256cdf0e10cSrcweir SfxMapUnit /*ePresentationMetric*/, // IN: Wunsch-Ma\einheit der Darstellung
257cdf0e10cSrcweir XubString& /*rText*/, // OUT: textuelle Darstellung
258cdf0e10cSrcweir const IntlWrapper *
259cdf0e10cSrcweir ) const
260cdf0e10cSrcweir
261cdf0e10cSrcweir /* [Beschreibung]
262cdf0e10cSrcweir
263cdf0e10cSrcweir "Uber diese virtuelle Methode kann von den SfxPoolItem-Subklassen
264cdf0e10cSrcweir eine textuelle Datstellung des Wertes erhalten werden. Sie sollte
265cdf0e10cSrcweir von allen UI-relevanten SfxPoolItem-Subklassen "uberladen werden.
266cdf0e10cSrcweir
267cdf0e10cSrcweir Da die Ma\seinheit des Wertes im SfxItemPool nur "uber
268cdf0e10cSrcweir <SfxItemPool::GetMetric(sal_uInt16)const> erfragbar ist, und nicht etwa
269cdf0e10cSrcweir in der SfxPoolItem-Instanz oder -Subklasse verf"ugbar ist, wird die
270cdf0e10cSrcweir eigene Ma\seinheit als 'eCoreMetric' "ubergeben.
271cdf0e10cSrcweir
272cdf0e10cSrcweir Die darzustellende Ma\seinheit wird als 'ePresentationMetric'
273cdf0e10cSrcweir "ubergeben.
274cdf0e10cSrcweir
275cdf0e10cSrcweir
276cdf0e10cSrcweir [R"uckgabewert]
277cdf0e10cSrcweir
278cdf0e10cSrcweir SfxItemPresentation SFX_ITEM_PRESENTATION_NONE
279cdf0e10cSrcweir es konnte keine Text-Darstellung erzeugt werden
280cdf0e10cSrcweir
281cdf0e10cSrcweir SFX_ITEM_PRESENTATION_NAMELESS
282cdf0e10cSrcweir es konnte eine Text-Darstellung (ggf. mit
283cdf0e10cSrcweir Ma\seinheit) erzeugt werden, die jedoch keine
284cdf0e10cSrcweir semantische Bedeutung enth"alt
285cdf0e10cSrcweir
286cdf0e10cSrcweir SFX_ITEM_PRESENTATION_COMPLETE
287cdf0e10cSrcweir es konnte eine komplette Text-Darstellung mit
288cdf0e10cSrcweir semantischer Bedeutung (und ggf. Ma\seinheit)
289cdf0e10cSrcweir erzeugt werden
290cdf0e10cSrcweir
291cdf0e10cSrcweir
292cdf0e10cSrcweir [Beispiele]
293cdf0e10cSrcweir
294cdf0e10cSrcweir pSvxFontItem->GetPresentation( SFX_PRESENTATION_NAMELESS, ... )
295cdf0e10cSrcweir "12pt" mit return SFX_ITEM_PRESENTATION_NAMELESS
296cdf0e10cSrcweir
297cdf0e10cSrcweir pSvxColorItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... )
298cdf0e10cSrcweir "rot" mit return SFX_ITEM_PRESENTATION_NAMELESS
299cdf0e10cSrcweir (das das SvxColorItem nicht wei\s, was f"ur eine Farbe es darstellt,
300cdf0e10cSrcweir kann es keinen Namen angeben, was durch den Returnwert mitgeteilt wird.
301cdf0e10cSrcweir
302cdf0e10cSrcweir pSvxBorderItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... )
303cdf0e10cSrcweir "1cm oberer Rand, 2cm linker Rand, 0,2cm unterer Rand, ..."
304cdf0e10cSrcweir */
305cdf0e10cSrcweir
306cdf0e10cSrcweir {
307cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE;
308cdf0e10cSrcweir }
309cdf0e10cSrcweir
310cdf0e10cSrcweir // SfxVoidItem ------------------------------------------------------------
SfxVoidItem(sal_uInt16 which)311cdf0e10cSrcweir SfxVoidItem::SfxVoidItem( sal_uInt16 which ):
312cdf0e10cSrcweir SfxPoolItem(which)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir DBG_CTOR(SfxVoidItem, 0);
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
317cdf0e10cSrcweir // SfxVoidItem ------------------------------------------------------------
SfxVoidItem(const SfxVoidItem & rCopy)318cdf0e10cSrcweir SfxVoidItem::SfxVoidItem( const SfxVoidItem& rCopy):
319cdf0e10cSrcweir SfxPoolItem(rCopy)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir DBG_CTOR(SfxVoidItem, 0);
322cdf0e10cSrcweir }
323cdf0e10cSrcweir
324cdf0e10cSrcweir // ------------------------------------------------------------------------
operator ==(const SfxPoolItem & rCmp) const325cdf0e10cSrcweir int SfxVoidItem::operator==( const SfxPoolItem&
326cdf0e10cSrcweir #ifdef DBG_UTIL
327cdf0e10cSrcweir rCmp
328cdf0e10cSrcweir #endif
329cdf0e10cSrcweir ) const
330cdf0e10cSrcweir {
331cdf0e10cSrcweir DBG_CHKTHIS(SfxVoidItem, 0);
332cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" );
333cdf0e10cSrcweir return sal_True;
334cdf0e10cSrcweir }
335cdf0e10cSrcweir
336cdf0e10cSrcweir // ------------------------------------------------------------------------
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const337cdf0e10cSrcweir SfxItemPresentation SfxVoidItem::GetPresentation
338cdf0e10cSrcweir (
339cdf0e10cSrcweir SfxItemPresentation /*ePresentation*/,
340cdf0e10cSrcweir SfxMapUnit /*eCoreMetric*/,
341cdf0e10cSrcweir SfxMapUnit /*ePresentationMetric*/,
342cdf0e10cSrcweir XubString& rText,
343cdf0e10cSrcweir const IntlWrapper *
344cdf0e10cSrcweir ) const
345cdf0e10cSrcweir {
346cdf0e10cSrcweir DBG_CHKTHIS(SfxVoidItem, 0);
347cdf0e10cSrcweir rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Void"));
348cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS;
349cdf0e10cSrcweir }
350cdf0e10cSrcweir
351cdf0e10cSrcweir // ------------------------------------------------------------------------
Clone(SfxItemPool *) const352cdf0e10cSrcweir SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const
353cdf0e10cSrcweir {
354cdf0e10cSrcweir DBG_CHKTHIS(SfxVoidItem, 0);
355cdf0e10cSrcweir return new SfxVoidItem(*this);
356cdf0e10cSrcweir }
357cdf0e10cSrcweir
358cdf0e10cSrcweir // SfxInvalidItem ---------------------------------------------------------
359cdf0e10cSrcweir #if 0 /* @@@ NOT USED @@@ */
360cdf0e10cSrcweir SfxInvalidItem::SfxInvalidItem( sal_uInt16 nWhich, const SfxPoolItem &rDefault ):
361cdf0e10cSrcweir SfxPoolItem(nWhich),
362cdf0e10cSrcweir pDefaultItem(&rDefault)
363cdf0e10cSrcweir {
364cdf0e10cSrcweir DBG_CTOR(SfxInvalidItem, 0);
365cdf0e10cSrcweir }
366cdf0e10cSrcweir
367cdf0e10cSrcweir // ------------------------------------------------------------------------
368cdf0e10cSrcweir SfxInvalidItem::SfxInvalidItem( const SfxInvalidItem& rCopy):
369cdf0e10cSrcweir SfxPoolItem(rCopy),
370cdf0e10cSrcweir pDefaultItem(rCopy.pDefaultItem)
371cdf0e10cSrcweir {
372cdf0e10cSrcweir DBG_CTOR(SfxInvalidItem, 0);
373cdf0e10cSrcweir //! pDefaultItem->ReleaseRef?
374cdf0e10cSrcweir }
375cdf0e10cSrcweir
376cdf0e10cSrcweir // ------------------------------------------------------------------------
377cdf0e10cSrcweir SfxInvalidItem::~SfxInvalidItem()
378cdf0e10cSrcweir {
379cdf0e10cSrcweir DBG_DTOR(SfxInvalidItem, 0);
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
382cdf0e10cSrcweir // ------------------------------------------------------------------------
383cdf0e10cSrcweir int SfxInvalidItem::operator==( const SfxPoolItem& rCmp) const
384cdf0e10cSrcweir {
385cdf0e10cSrcweir DBG_CHKTHIS(SfxInvalidItem, 0);
386cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal type" );
387cdf0e10cSrcweir return *pDefaultItem == *((SfxInvalidItem&)rCmp).pDefaultItem;
388cdf0e10cSrcweir }
389cdf0e10cSrcweir
390cdf0e10cSrcweir // ------------------------------------------------------------------------
391cdf0e10cSrcweir SfxItemPresentation SfxInvalidItem::GetPresentation
392cdf0e10cSrcweir (
393cdf0e10cSrcweir SfxItemPresentation ePresentation,
394cdf0e10cSrcweir SfxMapUnit eCoreMetric,
395cdf0e10cSrcweir SfxMapUnit ePresentationMetric,
396cdf0e10cSrcweir XubString& rText,
397cdf0e10cSrcweir const IntlWrapper *
398cdf0e10cSrcweir ) const
399cdf0e10cSrcweir {
400cdf0e10cSrcweir DBG_CHKTHIS(SfxInvalidItem, 0);
401cdf0e10cSrcweir rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Invalid"));
402cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS;
403cdf0e10cSrcweir }
404cdf0e10cSrcweir
405cdf0e10cSrcweir // ------------------------------------------------------------------------
406cdf0e10cSrcweir SfxPoolItem* SfxInvalidItem::Clone(SfxItemPool *) const
407cdf0e10cSrcweir {
408cdf0e10cSrcweir DBG_CHKTHIS(SfxInvalidItem, 0);
409cdf0e10cSrcweir return new SfxInvalidItem(*this);
410cdf0e10cSrcweir }
411cdf0e10cSrcweir
412cdf0e10cSrcweir // ------------------------------------------------------------------------
413cdf0e10cSrcweir SfxPoolItem* SfxInvalidItem::Create(SvStream &, sal_uInt16 nVersion) const
414cdf0e10cSrcweir {
415cdf0e10cSrcweir DBG_CHKTHIS(SfxInvalidItem, 0);
416cdf0e10cSrcweir DBG_ERROR("SfxInvalidItem::Create() ist sinnlos");
417cdf0e10cSrcweir return Clone();
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
420cdf0e10cSrcweir // ------------------------------------------------------------------------
421cdf0e10cSrcweir SvStream& SfxInvalidItem::Store(SvStream &rStream, sal_uInt16 nItemVersion ) const
422cdf0e10cSrcweir {
423cdf0e10cSrcweir DBG_CHKTHIS(SfxInvalidItem, 0);
424cdf0e10cSrcweir DBG_ERROR("SfxInvalidItem::Store() ist sinnlos");
425cdf0e10cSrcweir return rStream;
426cdf0e10cSrcweir }
427cdf0e10cSrcweir #endif /* @@@ NOT USED @@@ */
428cdf0e10cSrcweir
429cdf0e10cSrcweir // SfxItemHandle ----------------------------------------------------------
SfxItemHandle(SfxPoolItem & rItem)430cdf0e10cSrcweir SfxItemHandle::SfxItemHandle(SfxPoolItem &rItem):
431cdf0e10cSrcweir pRef(new sal_uInt16(1)),
432cdf0e10cSrcweir pItem(rItem.Clone(0))
433cdf0e10cSrcweir {
434cdf0e10cSrcweir DBG_CTOR(SfxItemHandle, 0);
435cdf0e10cSrcweir }
436cdf0e10cSrcweir
437cdf0e10cSrcweir // ------------------------------------------------------------------------
SfxItemHandle(const SfxItemHandle & rCopy)438cdf0e10cSrcweir SfxItemHandle::SfxItemHandle(const SfxItemHandle &rCopy):
439cdf0e10cSrcweir pRef(rCopy.pRef),
440cdf0e10cSrcweir pItem(rCopy.pItem)
441cdf0e10cSrcweir {
442cdf0e10cSrcweir DBG_CTOR(SfxItemHandle, 0);
443cdf0e10cSrcweir ++(*pRef);
444cdf0e10cSrcweir }
445cdf0e10cSrcweir
446cdf0e10cSrcweir // ------------------------------------------------------------------------
operator =(const SfxItemHandle & rCopy)447cdf0e10cSrcweir const SfxItemHandle &SfxItemHandle::operator=(const SfxItemHandle &rCopy)
448cdf0e10cSrcweir {
449cdf0e10cSrcweir DBG_CHKTHIS(SfxItemHandle, 0);
450cdf0e10cSrcweir if(&rCopy == this || pItem == rCopy.pItem)
451cdf0e10cSrcweir return *this;
452cdf0e10cSrcweir --(*pRef);
453cdf0e10cSrcweir if(!(*pRef))
454cdf0e10cSrcweir {
455cdf0e10cSrcweir delete pItem;
456cdf0e10cSrcweir pItem = 0;
457cdf0e10cSrcweir }
458cdf0e10cSrcweir pRef = rCopy.pRef;
459cdf0e10cSrcweir ++(*pRef);
460cdf0e10cSrcweir pItem = rCopy.pItem;
461cdf0e10cSrcweir return *this;
462cdf0e10cSrcweir }
463cdf0e10cSrcweir
464cdf0e10cSrcweir // ------------------------------------------------------------------------
~SfxItemHandle()465cdf0e10cSrcweir SfxItemHandle::~SfxItemHandle()
466cdf0e10cSrcweir {
467cdf0e10cSrcweir DBG_DTOR(SfxItemHandle, 0);
468cdf0e10cSrcweir --(*pRef);
469cdf0e10cSrcweir if(!(*pRef)) {
470cdf0e10cSrcweir delete pRef; pRef = 0;
471cdf0e10cSrcweir delete pItem; pItem = 0;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir }
474cdf0e10cSrcweir
475cdf0e10cSrcweir // ------------------------------------------------------------------------
ScaleMetrics(long,long)476cdf0e10cSrcweir int SfxPoolItem::ScaleMetrics( long /*lMult*/, long /*lDiv*/ )
477cdf0e10cSrcweir {
478cdf0e10cSrcweir return 0;
479cdf0e10cSrcweir }
480cdf0e10cSrcweir
481cdf0e10cSrcweir // ------------------------------------------------------------------------
HasMetrics() const482cdf0e10cSrcweir int SfxPoolItem::HasMetrics() const
483cdf0e10cSrcweir {
484cdf0e10cSrcweir return 0;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir
487cdf0e10cSrcweir // -----------------------------------------------------------------------
488cdf0e10cSrcweir #if 0 /* @@@ NOT USED @@@ */
489cdf0e10cSrcweir void SfxPoolItem::GetVersion() const
490cdf0e10cSrcweir {
491cdf0e10cSrcweir DBG_ERROR( "dummy called" );
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
494cdf0e10cSrcweir // -----------------------------------------------------------------------
495cdf0e10cSrcweir void SfxPoolItem::Store(SvStream &rStream) const
496cdf0e10cSrcweir {
497cdf0e10cSrcweir DBG_ERROR( "dummy called" );
498cdf0e10cSrcweir }
499cdf0e10cSrcweir #endif /* @@@ NOT USED @@@ */
500cdf0e10cSrcweir
501cdf0e10cSrcweir // -----------------------------------------------------------------------
502cdf0e10cSrcweir
QueryValue(com::sun::star::uno::Any &,sal_uInt8) const503cdf0e10cSrcweir sal_Bool SfxPoolItem::QueryValue( com::sun::star::uno::Any&, sal_uInt8 ) const
504cdf0e10cSrcweir {
505cdf0e10cSrcweir DBG_ERROR("There is no implementation for QueryValue for this item!");
506cdf0e10cSrcweir return sal_False;
507cdf0e10cSrcweir }
508cdf0e10cSrcweir
509cdf0e10cSrcweir // -----------------------------------------------------------------------
510cdf0e10cSrcweir
PutValue(const com::sun::star::uno::Any &,sal_uInt8)511cdf0e10cSrcweir sal_Bool SfxPoolItem::PutValue( const com::sun::star::uno::Any&, sal_uInt8 )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir DBG_ERROR("There is no implementation for PutValue for this item!");
514cdf0e10cSrcweir return sal_False;
515cdf0e10cSrcweir }
516cdf0e10cSrcweir
~SfxVoidItem()517cdf0e10cSrcweir SfxVoidItem::~SfxVoidItem()
518cdf0e10cSrcweir {
519cdf0e10cSrcweir DBG_DTOR(SfxVoidItem, 0);
520cdf0e10cSrcweir }
521