xref: /aoo41x/main/editeng/source/items/bulitem.cxx (revision 45fd3b9a)
1190118d0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3190118d0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4190118d0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5190118d0SAndrew Rist  * distributed with this work for additional information
6190118d0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7190118d0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8190118d0SAndrew Rist  * "License"); you may not use this file except in compliance
9190118d0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10190118d0SAndrew Rist  *
11190118d0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12190118d0SAndrew Rist  *
13190118d0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14190118d0SAndrew Rist  * software distributed under the License is distributed on an
15190118d0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16190118d0SAndrew Rist  * KIND, either express or implied.  See the License for the
17190118d0SAndrew Rist  * specific language governing permissions and limitations
18190118d0SAndrew Rist  * under the License.
19190118d0SAndrew Rist  *
20190118d0SAndrew Rist  *************************************************************/
21190118d0SAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_editeng.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <tools/stream.hxx>
26cdf0e10cSrcweir #include <vcl/outdev.hxx>
27cdf0e10cSrcweir #define _SVX_BULITEM_CXX
28cdf0e10cSrcweir #include <editeng/bulitem.hxx>
29cdf0e10cSrcweir #include <editeng/editrids.hrc>
30cdf0e10cSrcweir #include <tools/tenccvt.hxx>
31*45fd3b9aSArmin Le Grand #include <vcl/dibtools.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #define BULITEM_VERSION		((sal_uInt16)2)
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // -----------------------------------------------------------------------
36cdf0e10cSrcweir 
37cdf0e10cSrcweir TYPEINIT1(SvxBulletItem,SfxPoolItem);
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // -----------------------------------------------------------------------
40cdf0e10cSrcweir 
StoreFont(SvStream & rStream,const Font & rFont)41cdf0e10cSrcweir void SvxBulletItem::StoreFont( SvStream& rStream, const Font& rFont )
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 	sal_uInt16 nTemp;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 	rStream << rFont.GetColor();
46cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetFamily(); rStream << nTemp;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	// #90477# nTemp = (sal_uInt16)GetStoreCharSet( rFont.GetCharSet(), rStream.GetVersion() );
49cdf0e10cSrcweir 	nTemp = (sal_uInt16)GetSOStoreTextEncoding((rtl_TextEncoding)rFont.GetCharSet(), (sal_uInt16)rStream.GetVersion());
50cdf0e10cSrcweir 	rStream << nTemp;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetPitch(); rStream << nTemp;
53cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetAlign(); rStream << nTemp;
54cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetWeight(); rStream << nTemp;
55cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetUnderline(); rStream << nTemp;
56cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetStrikeout(); rStream << nTemp;
57cdf0e10cSrcweir 	nTemp = (sal_uInt16)rFont.GetItalic(); rStream << nTemp;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	// UNICODE: rStream << rFont.GetName();
60cdf0e10cSrcweir 	rStream.WriteByteString(rFont.GetName());
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	rStream << rFont.IsOutline();
63cdf0e10cSrcweir 	rStream << rFont.IsShadow();
64cdf0e10cSrcweir 	rStream << rFont.IsTransparent();
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir // -----------------------------------------------------------------------
68cdf0e10cSrcweir 
CreateFont(SvStream & rStream,sal_uInt16 nVer)69cdf0e10cSrcweir Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer )
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	Font aFont;
72cdf0e10cSrcweir 	Color aColor;
73cdf0e10cSrcweir 	rStream >> aColor;    aFont.SetColor( aColor );
74cdf0e10cSrcweir 	sal_uInt16 nTemp;
75cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetFamily((FontFamily)nTemp);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	// #90477#
78cdf0e10cSrcweir 	rStream >> nTemp;
79cdf0e10cSrcweir 	nTemp = (sal_uInt16)GetSOLoadTextEncoding((rtl_TextEncoding)nTemp, (sal_uInt16)rStream.GetVersion());
80cdf0e10cSrcweir 	aFont.SetCharSet((rtl_TextEncoding)nTemp);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetPitch((FontPitch)nTemp);
83cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetAlign((FontAlign)nTemp);
84cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetWeight((FontWeight)nTemp);
85cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetUnderline((FontUnderline)nTemp);
86cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetStrikeout((FontStrikeout)nTemp);
87cdf0e10cSrcweir 	rStream >> nTemp; aFont.SetItalic((FontItalic)nTemp);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	// UNICODE: rStream >> aName; aFont.SetName( aName );
90cdf0e10cSrcweir 	String aName;
91cdf0e10cSrcweir 	rStream.ReadByteString(aName);
92cdf0e10cSrcweir 	aFont.SetName( aName );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	if( nVer == 1 )
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		long nHeight, nWidth;
97cdf0e10cSrcweir 		rStream >> nHeight; rStream >> nWidth; Size aSize( nWidth, nHeight );
98cdf0e10cSrcweir 		aFont.SetSize( aSize );
99cdf0e10cSrcweir 	}
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	sal_Bool bTemp;
102cdf0e10cSrcweir 	rStream >> bTemp; aFont.SetOutline( bTemp );
103cdf0e10cSrcweir 	rStream >> bTemp; aFont.SetShadow( bTemp );
104cdf0e10cSrcweir 	rStream >> bTemp; aFont.SetTransparent( bTemp );
105cdf0e10cSrcweir 	return aFont;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // -----------------------------------------------------------------------
110cdf0e10cSrcweir 
SvxBulletItem(sal_uInt16 _nWhich)111cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir 	SetDefaultFont_Impl();
114cdf0e10cSrcweir 	SetDefaults_Impl();
115cdf0e10cSrcweir 	nValidMask = 0xFFFF;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir // -----------------------------------------------------------------------
119cdf0e10cSrcweir 
SvxBulletItem(sal_uInt8 nNewStyle,const Font & rFont,sal_uInt16,sal_uInt16 _nWhich)120cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( sal_uInt8 nNewStyle, const Font& rFont, sal_uInt16 /*nStart*/, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	SetDefaults_Impl();
123cdf0e10cSrcweir 	nStyle = nNewStyle;
124cdf0e10cSrcweir 	aFont  = rFont;
125cdf0e10cSrcweir 	nValidMask = 0xFFFF;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir // -----------------------------------------------------------------------
129cdf0e10cSrcweir 
SvxBulletItem(const Font & rFont,xub_Unicode cSymb,sal_uInt16 _nWhich)130cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( const Font& rFont, xub_Unicode cSymb, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	SetDefaults_Impl();
133cdf0e10cSrcweir 	aFont 	= rFont;
134cdf0e10cSrcweir 	cSymbol = cSymb;
135cdf0e10cSrcweir 	nStyle 	= BS_BULLET;
136cdf0e10cSrcweir 	nValidMask = 0xFFFF;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir // -----------------------------------------------------------------------
140cdf0e10cSrcweir 
SvxBulletItem(const Bitmap & rBmp,sal_uInt16 _nWhich)141cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( const Bitmap& rBmp, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	SetDefaults_Impl();
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     if( !rBmp.IsEmpty() )
146cdf0e10cSrcweir     {
147cdf0e10cSrcweir         pGraphicObject = new GraphicObject( rBmp );
148cdf0e10cSrcweir 	    nStyle = BS_BMP;
149cdf0e10cSrcweir     }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	nValidMask = 0xFFFF;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir // -----------------------------------------------------------------------
155cdf0e10cSrcweir 
SvxBulletItem(const GraphicObject & rGraphicObject,sal_uInt16 _nWhich)156cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( const GraphicObject& rGraphicObject, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 	SetDefaults_Impl();
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     if( ( GRAPHIC_NONE != pGraphicObject->GetType() ) && ( GRAPHIC_DEFAULT != pGraphicObject->GetType() ) )
161cdf0e10cSrcweir     {
162cdf0e10cSrcweir         pGraphicObject = new GraphicObject( rGraphicObject );
163cdf0e10cSrcweir         nStyle = BS_BMP;
164cdf0e10cSrcweir     }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     nValidMask = 0xFFFF;
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir // -----------------------------------------------------------------------
170cdf0e10cSrcweir 
SvxBulletItem(SvStream & rStrm,sal_uInt16 _nWhich)171cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
172cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
173cdf0e10cSrcweir     pGraphicObject( NULL )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir 	rStrm >> nStyle;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	if( nStyle != BS_BMP )
178cdf0e10cSrcweir 		aFont = CreateFont( rStrm, BULITEM_VERSION );
179cdf0e10cSrcweir 	else
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir 		// Sicheres Laden mit Test auf leere Bitmap
182cdf0e10cSrcweir 		Bitmap			aBmp;
183cdf0e10cSrcweir 		const sal_uInt32	nOldPos = rStrm.Tell();
184cdf0e10cSrcweir         // #69345# Errorcode beim Bitmap lesen ignorieren,
185cdf0e10cSrcweir 		// siehe Kommentar #67581# in SvxBulletItem::Store()
186cdf0e10cSrcweir 		sal_Bool bOldError = rStrm.GetError() ? sal_True : sal_False;
187*45fd3b9aSArmin Le Grand         ReadDIB(aBmp, rStrm, true);
188*45fd3b9aSArmin Le Grand 
189*45fd3b9aSArmin Le Grand         if ( !bOldError && rStrm.GetError() )
190cdf0e10cSrcweir 		{
191cdf0e10cSrcweir 			rStrm.ResetError();
192cdf0e10cSrcweir 			// #71493# Keine Warnung: Das BulletItem interessiert seit 5.0 im Dateiformat nicht mehr.
193cdf0e10cSrcweir 			// rStrm.SetError(ERRCODE_CLASS_READ | ERRCODE_SVX_BULLETITEM_NOBULLET | ERRCODE_WARNING_MASK);
194cdf0e10cSrcweir 		}
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 		if( aBmp.IsEmpty() )
197cdf0e10cSrcweir 		{
198cdf0e10cSrcweir 			rStrm.Seek( nOldPos );
199cdf0e10cSrcweir 			nStyle = BS_NONE;
200cdf0e10cSrcweir 		}
201cdf0e10cSrcweir 		else
202cdf0e10cSrcweir             pGraphicObject = new GraphicObject( aBmp );
203cdf0e10cSrcweir 	}
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     rStrm >> nWidth;
206cdf0e10cSrcweir 	rStrm >> nStart;
207cdf0e10cSrcweir 	rStrm >> nJustify;
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	char cTmpSymbol;
210cdf0e10cSrcweir 	rStrm >> cTmpSymbol;
211cdf0e10cSrcweir 	cSymbol = ByteString::ConvertToUnicode( cTmpSymbol, aFont.GetCharSet() );
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	rStrm >> nScale;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	// UNICODE: rStrm >> aPrevText;
216cdf0e10cSrcweir 	rStrm.ReadByteString(aPrevText);
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	// UNICODE: rStrm >> aFollowText;
219cdf0e10cSrcweir 	rStrm.ReadByteString(aFollowText);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	nValidMask = 0xFFFF;
222cdf0e10cSrcweir }
223cdf0e10cSrcweir 
224cdf0e10cSrcweir // -----------------------------------------------------------------------
225cdf0e10cSrcweir 
SvxBulletItem(const SvxBulletItem & rItem)226cdf0e10cSrcweir SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
227cdf0e10cSrcweir {
228cdf0e10cSrcweir 	aFont			= rItem.aFont;
229cdf0e10cSrcweir     pGraphicObject	= ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : NULL );
230cdf0e10cSrcweir 	aPrevText		= rItem.aPrevText;
231cdf0e10cSrcweir 	aFollowText		= rItem.aFollowText;
232cdf0e10cSrcweir 	nStart			= rItem.nStart;
233cdf0e10cSrcweir 	nStyle			= rItem.nStyle;
234cdf0e10cSrcweir 	nWidth			= rItem.nWidth;
235cdf0e10cSrcweir 	nScale			= rItem.nScale;
236cdf0e10cSrcweir 	cSymbol			= rItem.cSymbol;
237cdf0e10cSrcweir 	nJustify		= rItem.nJustify;
238cdf0e10cSrcweir 	nValidMask		= rItem.nValidMask;
239cdf0e10cSrcweir }
240cdf0e10cSrcweir 
241cdf0e10cSrcweir // -----------------------------------------------------------------------
242cdf0e10cSrcweir 
~SvxBulletItem()243cdf0e10cSrcweir SvxBulletItem::~SvxBulletItem()
244cdf0e10cSrcweir {
245cdf0e10cSrcweir     if( pGraphicObject )
246cdf0e10cSrcweir         delete pGraphicObject;
247cdf0e10cSrcweir }
248cdf0e10cSrcweir 
249cdf0e10cSrcweir // -----------------------------------------------------------------------
250cdf0e10cSrcweir 
Clone(SfxItemPool *) const251cdf0e10cSrcweir SfxPoolItem* SvxBulletItem::Clone( SfxItemPool * /*pPool*/ ) const
252cdf0e10cSrcweir {
253cdf0e10cSrcweir 	return new SvxBulletItem( *this );
254cdf0e10cSrcweir }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir // -----------------------------------------------------------------------
257cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const258cdf0e10cSrcweir SfxPoolItem* SvxBulletItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) const
259cdf0e10cSrcweir {
260cdf0e10cSrcweir 	return new SvxBulletItem( rStrm, Which() );
261cdf0e10cSrcweir }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir // -----------------------------------------------------------------------
264cdf0e10cSrcweir 
SetDefaultFont_Impl()265cdf0e10cSrcweir void SvxBulletItem::SetDefaultFont_Impl()
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, 0 );
268cdf0e10cSrcweir 	aFont.SetAlign( ALIGN_BOTTOM);
269cdf0e10cSrcweir 	aFont.SetTransparent( sal_True );
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir // -----------------------------------------------------------------------
273cdf0e10cSrcweir 
SetDefaults_Impl()274cdf0e10cSrcweir void SvxBulletItem::SetDefaults_Impl()
275cdf0e10cSrcweir {
276cdf0e10cSrcweir     pGraphicObject  = NULL;
277cdf0e10cSrcweir 	nWidth		    = 1200;  // 1.2cm
278cdf0e10cSrcweir 	nStart		    = 1;
279cdf0e10cSrcweir 	nStyle		    = BS_123;
280cdf0e10cSrcweir 	nJustify	    = BJ_HLEFT | BJ_VCENTER;
281cdf0e10cSrcweir 	cSymbol		    = sal_Unicode(' ');
282cdf0e10cSrcweir 	nScale 		    = 75;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir // -----------------------------------------------------------------------
286cdf0e10cSrcweir 
GetVersion(sal_uInt16) const287cdf0e10cSrcweir sal_uInt16 SvxBulletItem::GetVersion( sal_uInt16 /*nVersion*/ ) const
288cdf0e10cSrcweir {
289cdf0e10cSrcweir 	return BULITEM_VERSION;
290cdf0e10cSrcweir }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir // -----------------------------------------------------------------------
293cdf0e10cSrcweir 
CopyValidProperties(const SvxBulletItem & rCopyFrom)294cdf0e10cSrcweir void SvxBulletItem::CopyValidProperties( const SvxBulletItem& rCopyFrom )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir     Font _aFont = GetFont();
297cdf0e10cSrcweir 	Font aNewFont = rCopyFrom.GetFont();
298cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_FONTNAME ) )
299cdf0e10cSrcweir 	{
300cdf0e10cSrcweir         _aFont.SetName( aNewFont.GetName() );
301cdf0e10cSrcweir         _aFont.SetFamily( aNewFont.GetFamily() );
302cdf0e10cSrcweir         _aFont.SetStyleName( aNewFont.GetStyleName() );
303cdf0e10cSrcweir 	}
304cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_FONTCOLOR ) )
305cdf0e10cSrcweir         _aFont.SetColor( aNewFont.GetColor() );
306cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_SYMBOL ) )
307cdf0e10cSrcweir 		SetSymbol( rCopyFrom.GetSymbol() );
308cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_BITMAP ) )
309cdf0e10cSrcweir 		SetGraphicObject( rCopyFrom.GetGraphicObject() );
310cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_SCALE ) )
311cdf0e10cSrcweir 		SetScale( rCopyFrom.GetScale() );
312cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_START ) )
313cdf0e10cSrcweir 		SetStart( rCopyFrom.GetStart() );
314cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_STYLE ) )
315cdf0e10cSrcweir 		SetStyle( rCopyFrom.GetStyle() );
316cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_PREVTEXT ) )
317cdf0e10cSrcweir 		SetPrevText( rCopyFrom.GetPrevText() );
318cdf0e10cSrcweir 	if ( rCopyFrom.IsValid( VALID_FOLLOWTEXT ) )
319cdf0e10cSrcweir 		SetFollowText( rCopyFrom.GetFollowText() );
320cdf0e10cSrcweir 
321cdf0e10cSrcweir     SetFont( _aFont );
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 
325cdf0e10cSrcweir // -----------------------------------------------------------------------
326cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rItem) const327cdf0e10cSrcweir int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const
328cdf0e10cSrcweir {
329cdf0e10cSrcweir 	DBG_ASSERT(rItem.ISA(SvxBulletItem),"operator==Types not matching");
330cdf0e10cSrcweir 	const SvxBulletItem& rBullet = (const SvxBulletItem&)rItem;
331cdf0e10cSrcweir 	// ValidMask mitvergleichen, da sonst kein Putten in ein AttrSet moeglich,
332cdf0e10cSrcweir 	// wenn sich das Item nur in der ValidMask von einem existierenden unterscheidet.
333cdf0e10cSrcweir 	if(	nValidMask != rBullet.nValidMask 	||
334cdf0e10cSrcweir 		nStyle != rBullet.nStyle 			||
335cdf0e10cSrcweir 		nScale != rBullet.nScale			||
336cdf0e10cSrcweir 		nJustify != rBullet.nJustify 		||
337cdf0e10cSrcweir 		nWidth != rBullet.nWidth 			||
338cdf0e10cSrcweir 		nStart != rBullet.nStart 			||
339cdf0e10cSrcweir 		cSymbol != rBullet.cSymbol 			||
340cdf0e10cSrcweir 		aPrevText != rBullet.aPrevText 		||
341cdf0e10cSrcweir 		aFollowText != rBullet.aFollowText )
342cdf0e10cSrcweir 			return 0;
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 	if( ( nStyle != BS_BMP ) && ( aFont != rBullet.aFont ) )
345cdf0e10cSrcweir 		return 0;
346cdf0e10cSrcweir 
347cdf0e10cSrcweir     if( nStyle == BS_BMP )
348cdf0e10cSrcweir     {
349cdf0e10cSrcweir         if( ( pGraphicObject && !rBullet.pGraphicObject ) || ( !pGraphicObject && rBullet.pGraphicObject ) )
350cdf0e10cSrcweir             return 0;
351cdf0e10cSrcweir 
352cdf0e10cSrcweir         if( ( pGraphicObject && rBullet.pGraphicObject ) &&
353cdf0e10cSrcweir             ( ( *pGraphicObject != *rBullet.pGraphicObject ) ||
354cdf0e10cSrcweir               ( pGraphicObject->GetPrefSize() != rBullet.pGraphicObject->GetPrefSize() ) ) )
355cdf0e10cSrcweir         {
356cdf0e10cSrcweir             return 0;
357cdf0e10cSrcweir         }
358cdf0e10cSrcweir     }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 	return 1;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
363cdf0e10cSrcweir // -----------------------------------------------------------------------
364cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const365cdf0e10cSrcweir SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
366cdf0e10cSrcweir {
367cdf0e10cSrcweir 	// Korrektur bei leerer Bitmap
368cdf0e10cSrcweir 	if( ( nStyle == BS_BMP ) &&
369cdf0e10cSrcweir         ( !pGraphicObject || ( GRAPHIC_NONE == pGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == pGraphicObject->GetType() ) ) )
370cdf0e10cSrcweir 	{
371cdf0e10cSrcweir         if( pGraphicObject )
372cdf0e10cSrcweir         {
373cdf0e10cSrcweir             delete( const_cast< SvxBulletItem* >( this )->pGraphicObject );
374cdf0e10cSrcweir             const_cast< SvxBulletItem* >( this )->pGraphicObject = NULL;
375cdf0e10cSrcweir         }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir         const_cast< SvxBulletItem* >( this )->nStyle = BS_NONE;
378cdf0e10cSrcweir 	}
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 	rStrm << nStyle;
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 	if( nStyle != BS_BMP )
383cdf0e10cSrcweir 		StoreFont( rStrm, aFont );
384cdf0e10cSrcweir 	else
385cdf0e10cSrcweir 	{
386cdf0e10cSrcweir         sal_uLong _nStart = rStrm.Tell();
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 		// Kleine Vorab-Schaetzung der Groesse...
389cdf0e10cSrcweir 		sal_uInt16 nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1;
390cdf0e10cSrcweir 		const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() );
391cdf0e10cSrcweir 		sal_uLong nBytes = aBmp.GetSizeBytes();
392cdf0e10cSrcweir 		if ( nBytes < sal_uLong(0xFF00*nFac) )
393*45fd3b9aSArmin Le Grand         {
394*45fd3b9aSArmin Le Grand             WriteDIB(aBmp, rStrm, false, true);
395*45fd3b9aSArmin Le Grand         }
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 		sal_uLong nEnd = rStrm.Tell();
398cdf0e10cSrcweir 		// #67581# Item darf mit Overhead nicht mehr als 64K schreiben,
399cdf0e10cSrcweir 		// sonst platzt der SfxMultiRecord
400cdf0e10cSrcweir 		// Dann lieber auf die Bitmap verzichten, ist nur fuer Outliner
401cdf0e10cSrcweir 		// und auch nur fuer <= 5.0 wichtig.
402cdf0e10cSrcweir 		// Beim Einlesen merkt der Stream-Operator der Bitmap, dass dort keine steht.
403cdf0e10cSrcweir 		// Hiermit funktioniert jetzt der Fall das die grosse Bitmap aus einem anderen
404cdf0e10cSrcweir 		// Fileformat entstanden ist, welches keine 64K belegt, aber wenn eine
405cdf0e10cSrcweir 		// Bitmap > 64K verwendet wird, hat das SvxNumBulletItem beim Laden ein Problem,
406cdf0e10cSrcweir 		// stuerzt aber nicht ab.
407cdf0e10cSrcweir 
408cdf0e10cSrcweir         if ( (nEnd-_nStart) > 0xFF00 )
409cdf0e10cSrcweir             rStrm.Seek( _nStart );
410cdf0e10cSrcweir 	}
411cdf0e10cSrcweir 	rStrm << nWidth;
412cdf0e10cSrcweir     rStrm << nStart;
413cdf0e10cSrcweir 	rStrm << nJustify;
414cdf0e10cSrcweir 	rStrm << (char)ByteString::ConvertFromUnicode( cSymbol, aFont.GetCharSet() );
415cdf0e10cSrcweir 	rStrm << nScale;
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 	// UNICODE: rStrm << aPrevText;
418cdf0e10cSrcweir 	rStrm.WriteByteString(aPrevText);
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 	// UNICODE: rStrm << aFollowText;
421cdf0e10cSrcweir 	rStrm.WriteByteString(aFollowText);
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 	return rStrm;
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir //------------------------------------------------------------------------
427cdf0e10cSrcweir 
GetFullText() const428cdf0e10cSrcweir XubString SvxBulletItem::GetFullText() const
429cdf0e10cSrcweir {
430cdf0e10cSrcweir 	XubString aStr( aPrevText );
431cdf0e10cSrcweir 	aStr += cSymbol;
432cdf0e10cSrcweir 	aStr += aFollowText;
433cdf0e10cSrcweir 	return aStr;
434cdf0e10cSrcweir }
435cdf0e10cSrcweir 
436cdf0e10cSrcweir //------------------------------------------------------------------------
437cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const438cdf0e10cSrcweir SfxItemPresentation SvxBulletItem::GetPresentation
439cdf0e10cSrcweir (
440cdf0e10cSrcweir 	SfxItemPresentation ePres,
441cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
442cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
443cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
444cdf0e10cSrcweir )	const
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	SfxItemPresentation eRet = SFX_ITEM_PRESENTATION_NONE;
447cdf0e10cSrcweir 	switch ( ePres )
448cdf0e10cSrcweir 	{
449cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
450cdf0e10cSrcweir 			rText.Erase();
451cdf0e10cSrcweir 			eRet = SFX_ITEM_PRESENTATION_NONE;
452cdf0e10cSrcweir 			break;
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
455cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
456cdf0e10cSrcweir 			rText = GetFullText();
457cdf0e10cSrcweir 			eRet = SFX_ITEM_PRESENTATION_COMPLETE;
458cdf0e10cSrcweir 			break;
459cdf0e10cSrcweir         default: ; //prevent warning
460cdf0e10cSrcweir     }
461cdf0e10cSrcweir 	return eRet;
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir //------------------------------------------------------------------------
465cdf0e10cSrcweir 
GetBitmap() const466cdf0e10cSrcweir Bitmap SvxBulletItem::GetBitmap() const
467cdf0e10cSrcweir {
468cdf0e10cSrcweir     if( pGraphicObject )
469cdf0e10cSrcweir         return pGraphicObject->GetGraphic().GetBitmap();
470cdf0e10cSrcweir     else
471cdf0e10cSrcweir     {
472cdf0e10cSrcweir         const Bitmap aDefaultBitmap;
473cdf0e10cSrcweir         return aDefaultBitmap;
474cdf0e10cSrcweir     }
475cdf0e10cSrcweir }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir //------------------------------------------------------------------------
478cdf0e10cSrcweir 
SetBitmap(const Bitmap & rBmp)479cdf0e10cSrcweir void SvxBulletItem::SetBitmap( const Bitmap& rBmp )
480cdf0e10cSrcweir {
481cdf0e10cSrcweir     if( rBmp.IsEmpty() )
482cdf0e10cSrcweir     {
483cdf0e10cSrcweir         if( pGraphicObject )
484cdf0e10cSrcweir         {
485cdf0e10cSrcweir             delete pGraphicObject;
486cdf0e10cSrcweir             pGraphicObject = NULL;
487cdf0e10cSrcweir         }
488cdf0e10cSrcweir     }
489cdf0e10cSrcweir     else
490cdf0e10cSrcweir     {
491cdf0e10cSrcweir         delete pGraphicObject;
492cdf0e10cSrcweir         pGraphicObject = new GraphicObject( rBmp );
493cdf0e10cSrcweir 
494cdf0e10cSrcweir     }
495cdf0e10cSrcweir }
496cdf0e10cSrcweir 
497cdf0e10cSrcweir //------------------------------------------------------------------------
498cdf0e10cSrcweir 
GetGraphicObject() const499cdf0e10cSrcweir const GraphicObject& SvxBulletItem::GetGraphicObject() const
500cdf0e10cSrcweir {
501cdf0e10cSrcweir     if( pGraphicObject )
502cdf0e10cSrcweir         return *pGraphicObject;
503cdf0e10cSrcweir     else
504cdf0e10cSrcweir     {
505cdf0e10cSrcweir         static const GraphicObject aDefaultObject;
506cdf0e10cSrcweir         return aDefaultObject;
507cdf0e10cSrcweir     }
508cdf0e10cSrcweir }
509cdf0e10cSrcweir 
510cdf0e10cSrcweir //------------------------------------------------------------------------
511cdf0e10cSrcweir 
SetGraphicObject(const GraphicObject & rGraphicObject)512cdf0e10cSrcweir void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir     if( ( GRAPHIC_NONE == rGraphicObject.GetType() ) || ( GRAPHIC_DEFAULT == rGraphicObject.GetType() ) )
515cdf0e10cSrcweir     {
516cdf0e10cSrcweir         if( pGraphicObject )
517cdf0e10cSrcweir         {
518cdf0e10cSrcweir             delete pGraphicObject;
519cdf0e10cSrcweir             pGraphicObject = NULL;
520cdf0e10cSrcweir         }
521cdf0e10cSrcweir     }
522cdf0e10cSrcweir     else
523cdf0e10cSrcweir     {
524cdf0e10cSrcweir         delete pGraphicObject;
525cdf0e10cSrcweir         pGraphicObject = new GraphicObject( rGraphicObject );
526cdf0e10cSrcweir     }
527cdf0e10cSrcweir }
528