xref: /AOO41X/main/editeng/source/items/frmitems.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_editeng.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // include ---------------------------------------------------------------
32*cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/script/XTypeConverter.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/table/CellVertJustify.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/table/ShadowLocation.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/table/TableBorder.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/table/ShadowFormat.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/table/CellRangeAddress.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/table/CellContentType.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/table/TableOrientation.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/table/CellHoriJustify.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/util/SortField.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/util/SortFieldType.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/table/CellOrientation.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/table/CellAddress.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/style/PageStyleLayout.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/style/BreakType.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/style/GraphicLocation.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/awt/Selection.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/text/WritingMode2.hpp>
54*cdf0e10cSrcweir #include <com/sun/star/frame/status/UpperLowerMarginScale.hpp>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx>
57*cdf0e10cSrcweir #include <limits.h>
58*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
59*cdf0e10cSrcweir #include <svtools/grfmgr.hxx>
60*cdf0e10cSrcweir #include <tools/urlobj.hxx>
61*cdf0e10cSrcweir #include <comphelper/types.hxx>
62*cdf0e10cSrcweir #include <svl/memberid.hrc>
63*cdf0e10cSrcweir #include <svtools/wallitem.hxx>
64*cdf0e10cSrcweir #include <svl/cntwall.hxx>
65*cdf0e10cSrcweir #include <rtl/ustring.hxx>
66*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
67*cdf0e10cSrcweir #include <svtools/filter.hxx>
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir #define GLOBALOVERFLOW3
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir #define _SVX_FRMITEMS_CXX
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir #include <editeng/editids.hrc>
74*cdf0e10cSrcweir #include <editeng/editrids.hrc>
75*cdf0e10cSrcweir #include <editeng/pbinitem.hxx>
76*cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
77*cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
78*cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
79*cdf0e10cSrcweir #include <editeng/prntitem.hxx>
80*cdf0e10cSrcweir #include <editeng/opaqitem.hxx>
81*cdf0e10cSrcweir #include <editeng/protitem.hxx>
82*cdf0e10cSrcweir #include <editeng/shaditem.hxx>
83*cdf0e10cSrcweir #include <editeng/boxitem.hxx>
84*cdf0e10cSrcweir #include <editeng/brkitem.hxx>
85*cdf0e10cSrcweir #include <editeng/keepitem.hxx>
86*cdf0e10cSrcweir #include <editeng/bolnitem.hxx>
87*cdf0e10cSrcweir #include <editeng/brshitem.hxx>
88*cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
89*cdf0e10cSrcweir #include <editeng/itemtype.hxx>
90*cdf0e10cSrcweir #include <editeng/eerdll.hxx>
91*cdf0e10cSrcweir #include <editeng/unoprnms.hxx>
92*cdf0e10cSrcweir #include <editeng/memberids.hrc>
93*cdf0e10cSrcweir #include <editeng/editerr.hxx>
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir using namespace ::rtl;
96*cdf0e10cSrcweir using namespace ::com::sun::star;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir // Konvertierung fuer UNO
100*cdf0e10cSrcweir #define TWIP_TO_MM100(TWIP) 	((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
101*cdf0e10cSrcweir #define MM100_TO_TWIP(MM100)	((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
102*cdf0e10cSrcweir #define TWIP_TO_MM100_UNSIGNED(TWIP)     ((((TWIP)*127L+36L)/72L))
103*cdf0e10cSrcweir #define MM100_TO_TWIP_UNSIGNED(MM100)    ((((MM100)*72L+63L)/127L))
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir inline void SetValueProp( XubString& rStr, const sal_uInt16 nValue,
109*cdf0e10cSrcweir 						  const sal_uInt16 nProp )
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir 	if( 100 == nProp )
112*cdf0e10cSrcweir 		rStr += String::CreateFromInt32( nValue );
113*cdf0e10cSrcweir 	else
114*cdf0e10cSrcweir 		( rStr += String::CreateFromInt32( nProp )) += sal_Unicode('%');
115*cdf0e10cSrcweir }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir inline void SetValueProp( XubString& rStr, const short nValue,
118*cdf0e10cSrcweir 						  const sal_uInt16 nProp )
119*cdf0e10cSrcweir {
120*cdf0e10cSrcweir 	if( 100 == nProp )
121*cdf0e10cSrcweir 		rStr += String::CreateFromInt32( nValue );
122*cdf0e10cSrcweir 	else
123*cdf0e10cSrcweir 		( rStr += String::CreateFromInt32( nProp )) += sal_Unicode('%');
124*cdf0e10cSrcweir }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir // -----------------------------------------------------------------------
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxPaperBinItem, SfxByteItem, new SvxPaperBinItem(0));
129*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxSizeItem, SfxPoolItem, new SvxSizeItem(0));
130*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxLRSpaceItem, SfxPoolItem, new SvxLRSpaceItem(0));
131*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxULSpaceItem, SfxPoolItem, new SvxULSpaceItem(0));
132*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxPrintItem, SfxBoolItem, new SvxPrintItem(0));
133*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxOpaqueItem, SfxBoolItem, new SvxOpaqueItem(0));
134*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxProtectItem, SfxPoolItem, new SvxProtectItem(0));
135*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxBrushItem, SfxPoolItem, new SvxBrushItem(0));
136*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxShadowItem, SfxPoolItem, new SvxShadowItem(0));
137*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxBoxItem, SfxPoolItem, new SvxBoxItem(0));
138*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxBoxInfoItem, SfxPoolItem, new SvxBoxInfoItem(0));
139*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFmtBreakItem, SfxEnumItem, new SvxFmtBreakItem(SVX_BREAK_NONE, 0));
140*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFmtKeepItem, SfxBoolItem, new SvxFmtKeepItem(sal_False, 0));
141*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxLineItem, SfxPoolItem, new SvxLineItem(0));
142*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFrameDirectionItem, SfxUInt16Item, new SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, 0));
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir // class SvxPaperBinItem ------------------------------------------------
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir SfxPoolItem* SvxPaperBinItem::Clone( SfxItemPool* ) const
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir 	return new SvxPaperBinItem( *this );
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir // -----------------------------------------------------------------------
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir SvStream& SvxPaperBinItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir 	rStrm << GetValue();
157*cdf0e10cSrcweir 	return rStrm;
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir // -----------------------------------------------------------------------
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir SfxPoolItem* SvxPaperBinItem::Create( SvStream& rStrm, sal_uInt16 ) const
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir 	sal_Int8 nBin;
165*cdf0e10cSrcweir 	rStrm >> nBin;
166*cdf0e10cSrcweir 	return new SvxPaperBinItem( Which(), nBin );
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir // -----------------------------------------------------------------------
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir SfxItemPresentation SvxPaperBinItem::GetPresentation
172*cdf0e10cSrcweir (
173*cdf0e10cSrcweir 	SfxItemPresentation ePres,
174*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
175*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
176*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
177*cdf0e10cSrcweir )	const
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir 	switch ( ePres )
180*cdf0e10cSrcweir 	{
181*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
182*cdf0e10cSrcweir 			rText.Erase();
183*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
186*cdf0e10cSrcweir 			rText = String::CreateFromInt32( GetValue() );
187*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NAMELESS;
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
190*cdf0e10cSrcweir         {
191*cdf0e10cSrcweir             sal_uInt8 nValue = GetValue();
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 			if ( PAPERBIN_PRINTER_SETTINGS == nValue )
194*cdf0e10cSrcweir 				rText = EE_RESSTR(RID_SVXSTR_PAPERBIN_SETTINGS);
195*cdf0e10cSrcweir 			else
196*cdf0e10cSrcweir 			{
197*cdf0e10cSrcweir 				rText = EE_RESSTR(RID_SVXSTR_PAPERBIN);
198*cdf0e10cSrcweir 				rText += sal_Unicode(' ');
199*cdf0e10cSrcweir 				rText += String::CreateFromInt32( nValue );
200*cdf0e10cSrcweir 			}
201*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
202*cdf0e10cSrcweir         }
203*cdf0e10cSrcweir         //no break necessary
204*cdf0e10cSrcweir         default: ;//prevent warning
205*cdf0e10cSrcweir     }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir // class SvxSizeItem -----------------------------------------------------
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) :
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	SfxPoolItem( nId ),
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 	aSize( rSize )
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir // -----------------------------------------------------------------------
221*cdf0e10cSrcweir sal_Bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
222*cdf0e10cSrcweir {
223*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
224*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 	awt::Size aTmp(aSize.Width(), aSize.Height());
227*cdf0e10cSrcweir     if( bConvert )
228*cdf0e10cSrcweir 	{
229*cdf0e10cSrcweir 		aTmp.Height = TWIP_TO_MM100(aTmp.Height);
230*cdf0e10cSrcweir 		aTmp.Width = TWIP_TO_MM100(aTmp.Width);
231*cdf0e10cSrcweir 	}
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir     switch( nMemberId )
234*cdf0e10cSrcweir 	{
235*cdf0e10cSrcweir 		case MID_SIZE_SIZE:  rVal <<= aTmp;	break;
236*cdf0e10cSrcweir 		case MID_SIZE_WIDTH: rVal <<= aTmp.Width; break;
237*cdf0e10cSrcweir 		case MID_SIZE_HEIGHT: rVal <<= aTmp.Height;  break;
238*cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
239*cdf0e10cSrcweir 	}
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 	return sal_True;
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir // -----------------------------------------------------------------------
244*cdf0e10cSrcweir sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
247*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir     switch( nMemberId )
250*cdf0e10cSrcweir 	{
251*cdf0e10cSrcweir 		case MID_SIZE_SIZE:
252*cdf0e10cSrcweir 		{
253*cdf0e10cSrcweir 			awt::Size aTmp;
254*cdf0e10cSrcweir 			if( rVal >>= aTmp )
255*cdf0e10cSrcweir 			{
256*cdf0e10cSrcweir 				if(bConvert)
257*cdf0e10cSrcweir 				{
258*cdf0e10cSrcweir 					aTmp.Height = MM100_TO_TWIP(aTmp.Height);
259*cdf0e10cSrcweir 					aTmp.Width = MM100_TO_TWIP(aTmp.Width);
260*cdf0e10cSrcweir 				}
261*cdf0e10cSrcweir 				aSize = Size( aTmp.Width, aTmp.Height );
262*cdf0e10cSrcweir 			}
263*cdf0e10cSrcweir 			else
264*cdf0e10cSrcweir 			{
265*cdf0e10cSrcweir 				return sal_False;
266*cdf0e10cSrcweir 			}
267*cdf0e10cSrcweir 		}
268*cdf0e10cSrcweir 		break;
269*cdf0e10cSrcweir 		case MID_SIZE_WIDTH:
270*cdf0e10cSrcweir 		{
271*cdf0e10cSrcweir 			sal_Int32 nVal = 0;
272*cdf0e10cSrcweir 			if(!(rVal >>= nVal ))
273*cdf0e10cSrcweir 				return sal_False;
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 			aSize.Width() = bConvert ? MM100_TO_TWIP(nVal) : nVal;
276*cdf0e10cSrcweir 		}
277*cdf0e10cSrcweir 		break;
278*cdf0e10cSrcweir 		case MID_SIZE_HEIGHT:
279*cdf0e10cSrcweir 		{
280*cdf0e10cSrcweir 			sal_Int32 nVal = 0;
281*cdf0e10cSrcweir 			if(!(rVal >>= nVal))
282*cdf0e10cSrcweir 				return sal_True;
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 			aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal;
285*cdf0e10cSrcweir 		}
286*cdf0e10cSrcweir 		break;
287*cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!");
288*cdf0e10cSrcweir 			return sal_False;
289*cdf0e10cSrcweir 	}
290*cdf0e10cSrcweir 	return sal_True;
291*cdf0e10cSrcweir }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir // -----------------------------------------------------------------------
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) :
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 	SfxPoolItem( nId )
298*cdf0e10cSrcweir {
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir // -----------------------------------------------------------------------
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir int SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const
304*cdf0e10cSrcweir {
305*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 	return ( aSize == ( (SvxSizeItem&)rAttr ).GetSize() );
308*cdf0e10cSrcweir }
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir // -----------------------------------------------------------------------
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir SfxPoolItem* SvxSizeItem::Clone( SfxItemPool* ) const
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir 	return new SvxSizeItem( *this );
315*cdf0e10cSrcweir }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir //------------------------------------------------------------------------
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir SfxItemPresentation SvxSizeItem::GetPresentation
320*cdf0e10cSrcweir (
321*cdf0e10cSrcweir 	SfxItemPresentation ePres,
322*cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
323*cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
324*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *pIntl
325*cdf0e10cSrcweir )	const
326*cdf0e10cSrcweir {
327*cdf0e10cSrcweir #ifndef SVX_LIGHT
328*cdf0e10cSrcweir 	switch ( ePres )
329*cdf0e10cSrcweir 	{
330*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
331*cdf0e10cSrcweir 			rText.Erase();
332*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
335*cdf0e10cSrcweir             rText = GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, pIntl );
336*cdf0e10cSrcweir 			rText += cpDelim;
337*cdf0e10cSrcweir             rText += GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, pIntl );
338*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NAMELESS;
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
341*cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_SIZE_WIDTH);
342*cdf0e10cSrcweir             rText += GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, pIntl );
343*cdf0e10cSrcweir 			rText += EE_RESSTR(GetMetricId(ePresUnit));
344*cdf0e10cSrcweir 			rText += cpDelim;
345*cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_SIZE_HEIGHT);
346*cdf0e10cSrcweir             rText += GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, pIntl );
347*cdf0e10cSrcweir 			rText += EE_RESSTR(GetMetricId(ePresUnit));
348*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
349*cdf0e10cSrcweir         //no break necessary
350*cdf0e10cSrcweir         default: ;//prevent warning
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	}
353*cdf0e10cSrcweir #endif // !SVX_LIGHT
354*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
355*cdf0e10cSrcweir }
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir // -----------------------------------------------------------------------
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir SvStream& SvxSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
360*cdf0e10cSrcweir {
361*cdf0e10cSrcweir 	rStrm << aSize.Width();
362*cdf0e10cSrcweir 	rStrm << aSize.Height();
363*cdf0e10cSrcweir 	return rStrm;
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir // -----------------------------------------------------------------------
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir int SvxSizeItem::ScaleMetrics( long nMult, long nDiv )
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir 	aSize.Width() = Scale( aSize.Width(), nMult, nDiv );
371*cdf0e10cSrcweir 	aSize.Height() = Scale( aSize.Height(), nMult, nDiv );
372*cdf0e10cSrcweir 	return 1;
373*cdf0e10cSrcweir }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir // -----------------------------------------------------------------------
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir int SvxSizeItem::HasMetrics() const
378*cdf0e10cSrcweir {
379*cdf0e10cSrcweir 	return 1;
380*cdf0e10cSrcweir }
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir // -----------------------------------------------------------------------
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const
386*cdf0e10cSrcweir {
387*cdf0e10cSrcweir 	long nWidth, nHeight;
388*cdf0e10cSrcweir 	rStrm >> nWidth >> nHeight;
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 	SvxSizeItem* pAttr = new SvxSizeItem( Which() );
391*cdf0e10cSrcweir 	pAttr->SetSize(Size(nWidth, nHeight));
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 	return pAttr;
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir // class SvxLRSpaceItem --------------------------------------------------
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) :
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir 	SfxPoolItem( nId ),
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir     nFirstLineOfst  ( 0 ),
403*cdf0e10cSrcweir     nTxtLeft        ( 0 ),
404*cdf0e10cSrcweir     nLeftMargin     ( 0 ),
405*cdf0e10cSrcweir     nRightMargin    ( 0 ),
406*cdf0e10cSrcweir     nPropFirstLineOfst( 100 ),
407*cdf0e10cSrcweir     nPropLeftMargin( 100 ),
408*cdf0e10cSrcweir     nPropRightMargin( 100 ),
409*cdf0e10cSrcweir     bAutoFirst      ( 0 )
410*cdf0e10cSrcweir {
411*cdf0e10cSrcweir }
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir // -----------------------------------------------------------------------
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir SvxLRSpaceItem::SvxLRSpaceItem( const long nLeft, const long nRight,
416*cdf0e10cSrcweir 								const long nTLeft, const short nOfset,
417*cdf0e10cSrcweir 								const sal_uInt16 nId ) :
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir 	SfxPoolItem( nId ),
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir     nFirstLineOfst  ( nOfset ),
422*cdf0e10cSrcweir 	nTxtLeft		( nTLeft ),
423*cdf0e10cSrcweir     nLeftMargin     ( nLeft ),
424*cdf0e10cSrcweir     nRightMargin    ( nRight ),
425*cdf0e10cSrcweir     nPropFirstLineOfst( 100 ),
426*cdf0e10cSrcweir     nPropLeftMargin( 100 ),
427*cdf0e10cSrcweir     nPropRightMargin( 100 ),
428*cdf0e10cSrcweir     bAutoFirst      ( 0 )
429*cdf0e10cSrcweir {
430*cdf0e10cSrcweir }
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir // -----------------------------------------------------------------------
433*cdf0e10cSrcweir sal_Bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir 	sal_Bool bRet = sal_True;
436*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
437*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
438*cdf0e10cSrcweir 	switch( nMemberId )
439*cdf0e10cSrcweir 	{
440*cdf0e10cSrcweir 		//	jetzt alles signed
441*cdf0e10cSrcweir 		case MID_L_MARGIN:
442*cdf0e10cSrcweir 			rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin);
443*cdf0e10cSrcweir 			break;
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir 		case MID_TXT_LMARGIN :
446*cdf0e10cSrcweir 			rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nTxtLeft) : nTxtLeft);
447*cdf0e10cSrcweir 		break;
448*cdf0e10cSrcweir 		case MID_R_MARGIN:
449*cdf0e10cSrcweir 			rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin);
450*cdf0e10cSrcweir 			break;
451*cdf0e10cSrcweir 		case MID_L_REL_MARGIN:
452*cdf0e10cSrcweir 			rVal <<= (sal_Int16)nPropLeftMargin;
453*cdf0e10cSrcweir 		break;
454*cdf0e10cSrcweir 		case MID_R_REL_MARGIN:
455*cdf0e10cSrcweir 			rVal <<= (sal_Int16)nPropRightMargin;
456*cdf0e10cSrcweir 		break;
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir 		case MID_FIRST_LINE_INDENT:
459*cdf0e10cSrcweir 			rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nFirstLineOfst) : nFirstLineOfst);
460*cdf0e10cSrcweir 			break;
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir 		case MID_FIRST_LINE_REL_INDENT:
463*cdf0e10cSrcweir 			rVal <<= (sal_Int16)(nPropFirstLineOfst);
464*cdf0e10cSrcweir 			break;
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 		case MID_FIRST_AUTO:
467*cdf0e10cSrcweir 			rVal = Bool2Any(IsAutoFirst());
468*cdf0e10cSrcweir 			break;
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir 		default:
471*cdf0e10cSrcweir 			bRet = sal_False;
472*cdf0e10cSrcweir 			DBG_ERROR("unknown MemberId");
473*cdf0e10cSrcweir 	}
474*cdf0e10cSrcweir 	return bRet;
475*cdf0e10cSrcweir }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir // -----------------------------------------------------------------------
478*cdf0e10cSrcweir sal_Bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
479*cdf0e10cSrcweir {
480*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
481*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
482*cdf0e10cSrcweir 	sal_Int32 nVal = 0;
483*cdf0e10cSrcweir 	if( nMemberId != MID_FIRST_AUTO &&
484*cdf0e10cSrcweir 			nMemberId != MID_L_REL_MARGIN && nMemberId != MID_R_REL_MARGIN)
485*cdf0e10cSrcweir 		if(!(rVal >>= nVal))
486*cdf0e10cSrcweir 			return sal_False;
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 	switch( nMemberId )
489*cdf0e10cSrcweir 	{
490*cdf0e10cSrcweir 		case MID_L_MARGIN:
491*cdf0e10cSrcweir 			SetLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal);
492*cdf0e10cSrcweir 			break;
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 		case MID_TXT_LMARGIN :
495*cdf0e10cSrcweir 			SetTxtLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal);
496*cdf0e10cSrcweir 		break;
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir 		case MID_R_MARGIN:
499*cdf0e10cSrcweir 			SetRight((sal_Int32)	bConvert ? MM100_TO_TWIP(nVal) : nVal);
500*cdf0e10cSrcweir 			break;
501*cdf0e10cSrcweir 		case MID_L_REL_MARGIN:
502*cdf0e10cSrcweir 		case MID_R_REL_MARGIN:
503*cdf0e10cSrcweir 		{
504*cdf0e10cSrcweir 			sal_Int32 nRel = 0;
505*cdf0e10cSrcweir             if((rVal >>= nRel) && nRel >= 0 && nRel < USHRT_MAX)
506*cdf0e10cSrcweir 			{
507*cdf0e10cSrcweir 				if(MID_L_REL_MARGIN== nMemberId)
508*cdf0e10cSrcweir                     nPropLeftMargin = (sal_uInt16)nRel;
509*cdf0e10cSrcweir 				else
510*cdf0e10cSrcweir                     nPropRightMargin = (sal_uInt16)nRel;
511*cdf0e10cSrcweir 			}
512*cdf0e10cSrcweir 			else
513*cdf0e10cSrcweir 				return sal_False;
514*cdf0e10cSrcweir 		}
515*cdf0e10cSrcweir 		break;
516*cdf0e10cSrcweir 		case MID_FIRST_LINE_INDENT	   :
517*cdf0e10cSrcweir             SetTxtFirstLineOfst((short)(bConvert ?  MM100_TO_TWIP(nVal) : nVal));
518*cdf0e10cSrcweir 			break;
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 		case MID_FIRST_LINE_REL_INDENT:
521*cdf0e10cSrcweir 			SetPropTxtFirstLineOfst	( (sal_uInt16)nVal );
522*cdf0e10cSrcweir 			break;
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 		case MID_FIRST_AUTO:
525*cdf0e10cSrcweir 			SetAutoFirst( Any2Bool(rVal) );
526*cdf0e10cSrcweir 			break;
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 		default:
529*cdf0e10cSrcweir 			DBG_ERROR("unknown MemberId");
530*cdf0e10cSrcweir 			return sal_False;
531*cdf0e10cSrcweir 	}
532*cdf0e10cSrcweir 	return sal_True;
533*cdf0e10cSrcweir }
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir // -----------------------------------------------------------------------
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir // nLeftMargin und nTxtLeft anpassen.
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir void SvxLRSpaceItem::AdjustLeft()
540*cdf0e10cSrcweir {
541*cdf0e10cSrcweir 	if ( 0 > nFirstLineOfst )
542*cdf0e10cSrcweir 		nLeftMargin = nTxtLeft + nFirstLineOfst;
543*cdf0e10cSrcweir 	else
544*cdf0e10cSrcweir 		nLeftMargin = nTxtLeft;
545*cdf0e10cSrcweir }
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir // -----------------------------------------------------------------------
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir int SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
550*cdf0e10cSrcweir {
551*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir 	return (
554*cdf0e10cSrcweir 		nLeftMargin == ((SvxLRSpaceItem&)rAttr).GetLeft()  &&
555*cdf0e10cSrcweir 		nRightMargin == ((SvxLRSpaceItem&)rAttr).GetRight() &&
556*cdf0e10cSrcweir 		nFirstLineOfst == ((SvxLRSpaceItem&)rAttr).GetTxtFirstLineOfst() &&
557*cdf0e10cSrcweir 		nPropLeftMargin == ((SvxLRSpaceItem&)rAttr).GetPropLeft()  &&
558*cdf0e10cSrcweir 		nPropRightMargin == ((SvxLRSpaceItem&)rAttr).GetPropRight() &&
559*cdf0e10cSrcweir 		nPropFirstLineOfst == ((SvxLRSpaceItem&)rAttr).GetPropTxtFirstLineOfst() &&
560*cdf0e10cSrcweir 		bAutoFirst == ((SvxLRSpaceItem&)rAttr).IsAutoFirst() );
561*cdf0e10cSrcweir }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir // -----------------------------------------------------------------------
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir SfxPoolItem* SvxLRSpaceItem::Clone( SfxItemPool* ) const
566*cdf0e10cSrcweir {
567*cdf0e10cSrcweir 	return new SvxLRSpaceItem( *this );
568*cdf0e10cSrcweir }
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir //------------------------------------------------------------------------
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir SfxItemPresentation SvxLRSpaceItem::GetPresentation
573*cdf0e10cSrcweir (
574*cdf0e10cSrcweir 	SfxItemPresentation ePres,
575*cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
576*cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
577*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper* pIntl
578*cdf0e10cSrcweir )	const
579*cdf0e10cSrcweir {
580*cdf0e10cSrcweir #ifndef SVX_LIGHT
581*cdf0e10cSrcweir 	switch ( ePres )
582*cdf0e10cSrcweir 	{
583*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
584*cdf0e10cSrcweir 			rText.Erase();
585*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
586*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
587*cdf0e10cSrcweir 		{
588*cdf0e10cSrcweir 			if ( 100 != nPropLeftMargin )
589*cdf0e10cSrcweir 				( rText = String::CreateFromInt32( nPropLeftMargin )) += sal_Unicode('%');
590*cdf0e10cSrcweir 			else
591*cdf0e10cSrcweir 				rText = GetMetricText( (long)nLeftMargin,
592*cdf0e10cSrcweir                                        eCoreUnit, ePresUnit, pIntl );
593*cdf0e10cSrcweir 			rText += cpDelim;
594*cdf0e10cSrcweir 			if ( 100 != nPropFirstLineOfst )
595*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nPropFirstLineOfst )) += sal_Unicode('%');
596*cdf0e10cSrcweir 			else
597*cdf0e10cSrcweir 				rText += GetMetricText( (long)nFirstLineOfst,
598*cdf0e10cSrcweir                                         eCoreUnit, ePresUnit, pIntl );
599*cdf0e10cSrcweir 			rText += cpDelim;
600*cdf0e10cSrcweir 			if ( 100 != nRightMargin )
601*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nRightMargin )) += sal_Unicode('%');
602*cdf0e10cSrcweir 			else
603*cdf0e10cSrcweir 				rText += GetMetricText( (long)nRightMargin,
604*cdf0e10cSrcweir                                         eCoreUnit, ePresUnit, pIntl );
605*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NAMELESS;
606*cdf0e10cSrcweir 		}
607*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
608*cdf0e10cSrcweir 		{
609*cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_LRSPACE_LEFT);
610*cdf0e10cSrcweir 			if ( 100 != nPropLeftMargin )
611*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nPropLeftMargin )) += sal_Unicode('%');
612*cdf0e10cSrcweir 			else
613*cdf0e10cSrcweir 			{
614*cdf0e10cSrcweir 				rText += GetMetricText( (long)nLeftMargin,
615*cdf0e10cSrcweir                                        eCoreUnit, ePresUnit, pIntl );
616*cdf0e10cSrcweir 				rText += EE_RESSTR(GetMetricId(ePresUnit));
617*cdf0e10cSrcweir 			}
618*cdf0e10cSrcweir 			rText += cpDelim;
619*cdf0e10cSrcweir 			if ( 100 != nPropFirstLineOfst || nFirstLineOfst )
620*cdf0e10cSrcweir 			{
621*cdf0e10cSrcweir 				rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_FLINE);
622*cdf0e10cSrcweir 				if ( 100 != nPropFirstLineOfst )
623*cdf0e10cSrcweir 					( rText += String::CreateFromInt32( nPropFirstLineOfst ))
624*cdf0e10cSrcweir 						    += sal_Unicode('%');
625*cdf0e10cSrcweir 				else
626*cdf0e10cSrcweir 				{
627*cdf0e10cSrcweir 					rText += GetMetricText( (long)nFirstLineOfst,
628*cdf0e10cSrcweir                                             eCoreUnit, ePresUnit, pIntl );
629*cdf0e10cSrcweir 					rText += EE_RESSTR(GetMetricId(ePresUnit));
630*cdf0e10cSrcweir 				}
631*cdf0e10cSrcweir 				rText += cpDelim;
632*cdf0e10cSrcweir 			}
633*cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT);
634*cdf0e10cSrcweir 			if ( 100 != nPropRightMargin )
635*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nPropRightMargin )) += sal_Unicode('%');
636*cdf0e10cSrcweir 			else
637*cdf0e10cSrcweir 			{
638*cdf0e10cSrcweir 				rText += GetMetricText( (long)nRightMargin,
639*cdf0e10cSrcweir                                         eCoreUnit, ePresUnit, pIntl );
640*cdf0e10cSrcweir 				rText += EE_RESSTR(GetMetricId(ePresUnit));
641*cdf0e10cSrcweir 			}
642*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
643*cdf0e10cSrcweir 		}
644*cdf0e10cSrcweir         default: ;//prevent warning
645*cdf0e10cSrcweir     }
646*cdf0e10cSrcweir #endif // !SVX_LIGHT
647*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir // -----------------------------------------------------------------------
651*cdf0e10cSrcweir 
652*cdf0e10cSrcweir // MT: BulletFI: Vor 501 wurde im Outliner das Bullet nicht auf der Position des
653*cdf0e10cSrcweir // FI positioniert, deshalb muss in aelteren Dokumenten der FI auf 0 stehen.
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir #define BULLETLR_MARKER	0x599401FE
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir SvStream& SvxLRSpaceItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
658*cdf0e10cSrcweir {
659*cdf0e10cSrcweir 	short nSaveFI = nFirstLineOfst;
660*cdf0e10cSrcweir 	((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( 0 );	// nLeftMargin wird mitmanipuliert, siehe Create()
661*cdf0e10cSrcweir 
662*cdf0e10cSrcweir 	sal_uInt16 nMargin = 0;
663*cdf0e10cSrcweir 	if( nLeftMargin > 0 )
664*cdf0e10cSrcweir 		nMargin = sal_uInt16( nLeftMargin );
665*cdf0e10cSrcweir 	rStrm << nMargin;
666*cdf0e10cSrcweir 	rStrm << nPropLeftMargin;
667*cdf0e10cSrcweir 	if( nRightMargin > 0 )
668*cdf0e10cSrcweir 		nMargin = sal_uInt16( nRightMargin );
669*cdf0e10cSrcweir 	else
670*cdf0e10cSrcweir 		nMargin = 0;
671*cdf0e10cSrcweir 	rStrm << nMargin;
672*cdf0e10cSrcweir 	rStrm << nPropRightMargin;
673*cdf0e10cSrcweir 	rStrm << nFirstLineOfst;
674*cdf0e10cSrcweir 	rStrm << nPropFirstLineOfst;
675*cdf0e10cSrcweir 	if( nTxtLeft > 0 )
676*cdf0e10cSrcweir 		nMargin = sal_uInt16( nTxtLeft );
677*cdf0e10cSrcweir 	else
678*cdf0e10cSrcweir 		nMargin = 0;
679*cdf0e10cSrcweir 	rStrm << nMargin;
680*cdf0e10cSrcweir 	if( nItemVersion >= LRSPACE_AUTOFIRST_VERSION )
681*cdf0e10cSrcweir 	{
682*cdf0e10cSrcweir 		sal_Int8 nAutoFirst = bAutoFirst ? 1 : 0;
683*cdf0e10cSrcweir 		if( nItemVersion >= LRSPACE_NEGATIVE_VERSION &&
684*cdf0e10cSrcweir 			( nLeftMargin < 0 || nRightMargin < 0 || nTxtLeft < 0 ) )
685*cdf0e10cSrcweir 			nAutoFirst |= 0x80;
686*cdf0e10cSrcweir 		rStrm << nAutoFirst;
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir 		// Ab 6.0 keine Magicnumber schreiben...
689*cdf0e10cSrcweir 		DBG_ASSERT( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_50, "MT: Fileformat SvxLRSpaceItem aendern!" );
690*cdf0e10cSrcweir 		rStrm << (sal_uInt32) BULLETLR_MARKER;
691*cdf0e10cSrcweir 		rStrm << nSaveFI;
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir         if( 0x80 & nAutoFirst )
694*cdf0e10cSrcweir 		{
695*cdf0e10cSrcweir 			rStrm << nLeftMargin;
696*cdf0e10cSrcweir 			rStrm << nRightMargin;
697*cdf0e10cSrcweir 		}
698*cdf0e10cSrcweir 	}
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir 	((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( nSaveFI );
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir 	return rStrm;
703*cdf0e10cSrcweir }
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir // -----------------------------------------------------------------------
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir SfxPoolItem* SvxLRSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
708*cdf0e10cSrcweir {
709*cdf0e10cSrcweir 	sal_uInt16 left, prpleft, right, prpright, prpfirstline, txtleft;
710*cdf0e10cSrcweir 	short firstline;
711*cdf0e10cSrcweir 	sal_Int8 autofirst = 0;
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir 	if ( nVersion >= LRSPACE_AUTOFIRST_VERSION )
714*cdf0e10cSrcweir 	{
715*cdf0e10cSrcweir 		rStrm >> left >> prpleft >> right >> prpright >> firstline >>
716*cdf0e10cSrcweir 				 prpfirstline >> txtleft >> autofirst;
717*cdf0e10cSrcweir 
718*cdf0e10cSrcweir 		sal_uInt32 nPos = rStrm.Tell();
719*cdf0e10cSrcweir 		sal_uInt32 nMarker;
720*cdf0e10cSrcweir 		rStrm >> nMarker;
721*cdf0e10cSrcweir 		if ( nMarker == BULLETLR_MARKER )
722*cdf0e10cSrcweir 		{
723*cdf0e10cSrcweir 			rStrm >> firstline;
724*cdf0e10cSrcweir 			if ( firstline < 0 )
725*cdf0e10cSrcweir 				left = left + static_cast<sal_uInt16>(firstline);	// s.u.: txtleft = ...
726*cdf0e10cSrcweir 		}
727*cdf0e10cSrcweir 		else
728*cdf0e10cSrcweir 			rStrm.Seek( nPos );
729*cdf0e10cSrcweir 	}
730*cdf0e10cSrcweir 	else if ( nVersion == LRSPACE_TXTLEFT_VERSION )
731*cdf0e10cSrcweir 	{
732*cdf0e10cSrcweir 		rStrm >> left >> prpleft >> right >> prpright >> firstline >>
733*cdf0e10cSrcweir 				 prpfirstline >> txtleft;
734*cdf0e10cSrcweir 	}
735*cdf0e10cSrcweir 	else if ( nVersion == LRSPACE_16_VERSION )
736*cdf0e10cSrcweir 	{
737*cdf0e10cSrcweir 		rStrm >> left >> prpleft >> right >> prpright >> firstline >>
738*cdf0e10cSrcweir 				 prpfirstline;
739*cdf0e10cSrcweir 	}
740*cdf0e10cSrcweir 	else
741*cdf0e10cSrcweir 	{
742*cdf0e10cSrcweir 		sal_Int8 nL, nR, nFL;
743*cdf0e10cSrcweir 		rStrm >> left >> nL >> right >> nR >> firstline >> nFL;
744*cdf0e10cSrcweir 		prpleft = (sal_uInt16)nL;
745*cdf0e10cSrcweir 		prpright = (sal_uInt16)nR;
746*cdf0e10cSrcweir 		prpfirstline = (sal_uInt16)nFL;
747*cdf0e10cSrcweir 	}
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir 	txtleft = firstline >= 0 ? left : left - firstline;
750*cdf0e10cSrcweir 	SvxLRSpaceItem* pAttr = new SvxLRSpaceItem( Which() );
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir 	pAttr->nLeftMargin = left;
753*cdf0e10cSrcweir 	pAttr->nPropLeftMargin = prpleft;
754*cdf0e10cSrcweir 	pAttr->nRightMargin = right;
755*cdf0e10cSrcweir 	pAttr->nPropRightMargin = prpright;
756*cdf0e10cSrcweir 	pAttr->nFirstLineOfst = firstline;
757*cdf0e10cSrcweir 	pAttr->nPropFirstLineOfst = prpfirstline;
758*cdf0e10cSrcweir 	pAttr->nTxtLeft = txtleft;
759*cdf0e10cSrcweir 	pAttr->bAutoFirst = autofirst & 0x01;
760*cdf0e10cSrcweir 	if( nVersion >= LRSPACE_NEGATIVE_VERSION && ( autofirst & 0x80 ) )
761*cdf0e10cSrcweir 	{
762*cdf0e10cSrcweir 		sal_Int32 nMargin;
763*cdf0e10cSrcweir 		rStrm >> nMargin;
764*cdf0e10cSrcweir 		pAttr->nLeftMargin = nMargin;
765*cdf0e10cSrcweir 		pAttr->nTxtLeft = firstline >= 0 ? nMargin : nMargin - firstline;
766*cdf0e10cSrcweir 		rStrm >> nMargin;
767*cdf0e10cSrcweir 		pAttr->nRightMargin = nMargin;
768*cdf0e10cSrcweir 	}
769*cdf0e10cSrcweir 	return pAttr;
770*cdf0e10cSrcweir }
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir // -----------------------------------------------------------------------
773*cdf0e10cSrcweir 
774*cdf0e10cSrcweir sal_uInt16 SvxLRSpaceItem::GetVersion( sal_uInt16 nFileVersion ) const
775*cdf0e10cSrcweir {
776*cdf0e10cSrcweir 	return (nFileVersion == SOFFICE_FILEFORMAT_31)
777*cdf0e10cSrcweir 			   ? LRSPACE_TXTLEFT_VERSION
778*cdf0e10cSrcweir 			   : LRSPACE_NEGATIVE_VERSION;
779*cdf0e10cSrcweir }
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir // -----------------------------------------------------------------------
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir int SvxLRSpaceItem::ScaleMetrics( long nMult, long nDiv )
784*cdf0e10cSrcweir {
785*cdf0e10cSrcweir 	nFirstLineOfst = (short)Scale( nFirstLineOfst, nMult, nDiv );
786*cdf0e10cSrcweir 	nTxtLeft = Scale( nTxtLeft, nMult, nDiv );
787*cdf0e10cSrcweir 	nLeftMargin = Scale( nLeftMargin, nMult, nDiv );
788*cdf0e10cSrcweir 	nRightMargin = Scale( nRightMargin, nMult, nDiv );
789*cdf0e10cSrcweir 	return 1;
790*cdf0e10cSrcweir }
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir // -----------------------------------------------------------------------
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir int SvxLRSpaceItem::HasMetrics() const
795*cdf0e10cSrcweir {
796*cdf0e10cSrcweir 	return 1;
797*cdf0e10cSrcweir }
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir // class SvxULSpaceItem --------------------------------------------------
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId ) :
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir 	SfxPoolItem( nId ),
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir     nUpper( 0 ),
806*cdf0e10cSrcweir     nLower( 0 ),
807*cdf0e10cSrcweir     nPropUpper( 100 ),
808*cdf0e10cSrcweir     nPropLower( 100 )
809*cdf0e10cSrcweir {
810*cdf0e10cSrcweir }
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir // -----------------------------------------------------------------------
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
815*cdf0e10cSrcweir 								const sal_uInt16 nId ) :
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir 	SfxPoolItem( nId ),
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir     nUpper( nUp  ),
820*cdf0e10cSrcweir     nLower( nLow ),
821*cdf0e10cSrcweir     nPropUpper( 100 ),
822*cdf0e10cSrcweir     nPropLower( 100 )
823*cdf0e10cSrcweir {
824*cdf0e10cSrcweir }
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir // -----------------------------------------------------------------------
827*cdf0e10cSrcweir sal_Bool    SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
828*cdf0e10cSrcweir {
829*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
830*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
831*cdf0e10cSrcweir 	switch( nMemberId )
832*cdf0e10cSrcweir 	{
833*cdf0e10cSrcweir 		//	jetzt alles signed
834*cdf0e10cSrcweir         case 0:
835*cdf0e10cSrcweir         {
836*cdf0e10cSrcweir             ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale;
837*cdf0e10cSrcweir             aUpperLowerMarginScale.Upper = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper);
838*cdf0e10cSrcweir             aUpperLowerMarginScale.Lower = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nPropUpper);
839*cdf0e10cSrcweir             aUpperLowerMarginScale.ScaleUpper = (sal_Int16)nPropUpper;
840*cdf0e10cSrcweir             aUpperLowerMarginScale.ScaleLower = (sal_Int16)nPropLower;
841*cdf0e10cSrcweir             rVal <<= aUpperLowerMarginScale;
842*cdf0e10cSrcweir             break;
843*cdf0e10cSrcweir         }
844*cdf0e10cSrcweir         case MID_UP_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); break;
845*cdf0e10cSrcweir         case MID_LO_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nLower); break;
846*cdf0e10cSrcweir 		case MID_UP_REL_MARGIN: rVal <<= (sal_Int16) nPropUpper; break;
847*cdf0e10cSrcweir 		case MID_LO_REL_MARGIN: rVal <<= (sal_Int16) nPropLower; break;
848*cdf0e10cSrcweir 	}
849*cdf0e10cSrcweir 	return sal_True;
850*cdf0e10cSrcweir }
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir // -----------------------------------------------------------------------
853*cdf0e10cSrcweir sal_Bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
854*cdf0e10cSrcweir {
855*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
856*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
857*cdf0e10cSrcweir 	sal_Int32 nVal = 0;
858*cdf0e10cSrcweir 	switch( nMemberId )
859*cdf0e10cSrcweir 	{
860*cdf0e10cSrcweir         case 0:
861*cdf0e10cSrcweir         {
862*cdf0e10cSrcweir             ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale;
863*cdf0e10cSrcweir             if ( !(rVal >>= aUpperLowerMarginScale ))
864*cdf0e10cSrcweir                 return sal_False;
865*cdf0e10cSrcweir             {
866*cdf0e10cSrcweir                 SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper));
867*cdf0e10cSrcweir                 SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower));
868*cdf0e10cSrcweir 			    if( aUpperLowerMarginScale.ScaleUpper > 1 )
869*cdf0e10cSrcweir 					nPropUpper = aUpperLowerMarginScale.ScaleUpper;
870*cdf0e10cSrcweir 			    if( aUpperLowerMarginScale.ScaleLower > 1 )
871*cdf0e10cSrcweir 					nPropUpper = aUpperLowerMarginScale.ScaleLower;
872*cdf0e10cSrcweir             }
873*cdf0e10cSrcweir         }
874*cdf0e10cSrcweir 
875*cdf0e10cSrcweir         case MID_UP_MARGIN :
876*cdf0e10cSrcweir 			if(!(rVal >>= nVal) || nVal < 0)
877*cdf0e10cSrcweir 				return sal_False;
878*cdf0e10cSrcweir 			SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal));
879*cdf0e10cSrcweir 			break;
880*cdf0e10cSrcweir 		case MID_LO_MARGIN :
881*cdf0e10cSrcweir 			if(!(rVal >>= nVal) || nVal < 0)
882*cdf0e10cSrcweir 				return sal_False;
883*cdf0e10cSrcweir 			SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal));
884*cdf0e10cSrcweir 			break;
885*cdf0e10cSrcweir 		case MID_UP_REL_MARGIN:
886*cdf0e10cSrcweir 		case MID_LO_REL_MARGIN:
887*cdf0e10cSrcweir 		{
888*cdf0e10cSrcweir 			sal_Int32 nRel = 0;
889*cdf0e10cSrcweir 			if((rVal >>= nRel) && nRel > 1 )
890*cdf0e10cSrcweir 			{
891*cdf0e10cSrcweir 				if(MID_UP_REL_MARGIN == nMemberId)
892*cdf0e10cSrcweir 					nPropUpper = (sal_uInt16)nRel;
893*cdf0e10cSrcweir 				else
894*cdf0e10cSrcweir 					nPropLower = (sal_uInt16)nRel;
895*cdf0e10cSrcweir 			}
896*cdf0e10cSrcweir 			else
897*cdf0e10cSrcweir 				return sal_False;
898*cdf0e10cSrcweir 		}
899*cdf0e10cSrcweir 		break;
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir 		default:
903*cdf0e10cSrcweir 			DBG_ERROR("unknown MemberId");
904*cdf0e10cSrcweir 			return sal_False;
905*cdf0e10cSrcweir 	}
906*cdf0e10cSrcweir 	return sal_True;
907*cdf0e10cSrcweir }
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir // -----------------------------------------------------------------------
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir int SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const
912*cdf0e10cSrcweir {
913*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir 	return ( nUpper == ( (SvxULSpaceItem&)rAttr ).nUpper &&
916*cdf0e10cSrcweir 			 nLower == ( (SvxULSpaceItem&)rAttr ).nLower &&
917*cdf0e10cSrcweir 			 nPropUpper == ( (SvxULSpaceItem&)rAttr ).nPropUpper &&
918*cdf0e10cSrcweir 			 nPropLower == ( (SvxULSpaceItem&)rAttr ).nPropLower );
919*cdf0e10cSrcweir }
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir // -----------------------------------------------------------------------
922*cdf0e10cSrcweir 
923*cdf0e10cSrcweir SfxPoolItem* SvxULSpaceItem::Clone( SfxItemPool* ) const
924*cdf0e10cSrcweir {
925*cdf0e10cSrcweir 	return new SvxULSpaceItem( *this );
926*cdf0e10cSrcweir }
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir //------------------------------------------------------------------------
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir SfxItemPresentation SvxULSpaceItem::GetPresentation
931*cdf0e10cSrcweir (
932*cdf0e10cSrcweir 	SfxItemPresentation ePres,
933*cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
934*cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
935*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *pIntl
936*cdf0e10cSrcweir )	const
937*cdf0e10cSrcweir {
938*cdf0e10cSrcweir #ifndef SVX_LIGHT
939*cdf0e10cSrcweir 	switch ( ePres )
940*cdf0e10cSrcweir 	{
941*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
942*cdf0e10cSrcweir 			rText.Erase();
943*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
944*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
945*cdf0e10cSrcweir 		{
946*cdf0e10cSrcweir 			if ( 100 != nPropUpper )
947*cdf0e10cSrcweir 				( rText = String::CreateFromInt32( nPropUpper )) += sal_Unicode('%');
948*cdf0e10cSrcweir 			else
949*cdf0e10cSrcweir                 rText = GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl );
950*cdf0e10cSrcweir 			rText += cpDelim;
951*cdf0e10cSrcweir 			if ( 100 != nPropLower )
952*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nPropLower )) += sal_Unicode('%');
953*cdf0e10cSrcweir 			else
954*cdf0e10cSrcweir                 rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl );
955*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NAMELESS;
956*cdf0e10cSrcweir 		}
957*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
958*cdf0e10cSrcweir 		{
959*cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_ULSPACE_UPPER);
960*cdf0e10cSrcweir 			if ( 100 != nPropUpper )
961*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nPropUpper )) += sal_Unicode('%');
962*cdf0e10cSrcweir 			else
963*cdf0e10cSrcweir 			{
964*cdf0e10cSrcweir                 rText += GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl );
965*cdf0e10cSrcweir 				rText += EE_RESSTR(GetMetricId(ePresUnit));
966*cdf0e10cSrcweir 			}
967*cdf0e10cSrcweir 			rText += cpDelim;
968*cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_ULSPACE_LOWER);
969*cdf0e10cSrcweir 			if ( 100 != nPropLower )
970*cdf0e10cSrcweir 				( rText += String::CreateFromInt32( nPropLower )) += sal_Unicode('%');
971*cdf0e10cSrcweir 			else
972*cdf0e10cSrcweir 			{
973*cdf0e10cSrcweir                 rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl );
974*cdf0e10cSrcweir 				rText += EE_RESSTR(GetMetricId(ePresUnit));
975*cdf0e10cSrcweir 			}
976*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
977*cdf0e10cSrcweir 		}
978*cdf0e10cSrcweir         default: ;//prevent warning
979*cdf0e10cSrcweir     }
980*cdf0e10cSrcweir #endif
981*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
982*cdf0e10cSrcweir }
983*cdf0e10cSrcweir 
984*cdf0e10cSrcweir // -----------------------------------------------------------------------
985*cdf0e10cSrcweir 
986*cdf0e10cSrcweir SvStream& SvxULSpaceItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
987*cdf0e10cSrcweir {
988*cdf0e10cSrcweir 	rStrm << GetUpper()
989*cdf0e10cSrcweir 		  << GetPropUpper()
990*cdf0e10cSrcweir 		  << GetLower()
991*cdf0e10cSrcweir 		  << GetPropLower();
992*cdf0e10cSrcweir 	return rStrm;
993*cdf0e10cSrcweir }
994*cdf0e10cSrcweir 
995*cdf0e10cSrcweir // -----------------------------------------------------------------------
996*cdf0e10cSrcweir 
997*cdf0e10cSrcweir SfxPoolItem* SvxULSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
998*cdf0e10cSrcweir {
999*cdf0e10cSrcweir 	sal_uInt16 upper, lower, nPL = 0, nPU = 0;
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir 	if ( nVersion == ULSPACE_16_VERSION )
1002*cdf0e10cSrcweir 		rStrm >> upper >> nPU >> lower >> nPL;
1003*cdf0e10cSrcweir 	else
1004*cdf0e10cSrcweir 	{
1005*cdf0e10cSrcweir 		sal_Int8 nU, nL;
1006*cdf0e10cSrcweir 		rStrm >> upper >> nU >> lower >> nL;
1007*cdf0e10cSrcweir 		nPL = (sal_uInt16)nL;
1008*cdf0e10cSrcweir 		nPU = (sal_uInt16)nU;
1009*cdf0e10cSrcweir 	}
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir 	SvxULSpaceItem* pAttr = new SvxULSpaceItem( Which() );
1012*cdf0e10cSrcweir 	pAttr->SetUpperValue( upper );
1013*cdf0e10cSrcweir 	pAttr->SetLowerValue( lower );
1014*cdf0e10cSrcweir 	pAttr->SetPropUpper( nPU );
1015*cdf0e10cSrcweir 	pAttr->SetPropLower( nPL );
1016*cdf0e10cSrcweir 	return pAttr;
1017*cdf0e10cSrcweir }
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir // -----------------------------------------------------------------------
1020*cdf0e10cSrcweir 
1021*cdf0e10cSrcweir sal_uInt16 SvxULSpaceItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
1022*cdf0e10cSrcweir {
1023*cdf0e10cSrcweir 	return ULSPACE_16_VERSION;
1024*cdf0e10cSrcweir }
1025*cdf0e10cSrcweir 
1026*cdf0e10cSrcweir // -----------------------------------------------------------------------
1027*cdf0e10cSrcweir 
1028*cdf0e10cSrcweir int SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv )
1029*cdf0e10cSrcweir {
1030*cdf0e10cSrcweir 	nUpper = (sal_uInt16)Scale( nUpper, nMult, nDiv );
1031*cdf0e10cSrcweir 	nLower = (sal_uInt16)Scale( nLower, nMult, nDiv );
1032*cdf0e10cSrcweir 	return 1;
1033*cdf0e10cSrcweir }
1034*cdf0e10cSrcweir 
1035*cdf0e10cSrcweir // -----------------------------------------------------------------------
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir int SvxULSpaceItem::HasMetrics() const
1038*cdf0e10cSrcweir {
1039*cdf0e10cSrcweir 	return 1;
1040*cdf0e10cSrcweir }
1041*cdf0e10cSrcweir 
1042*cdf0e10cSrcweir 
1043*cdf0e10cSrcweir // class SvxPrintItem ----------------------------------------------------
1044*cdf0e10cSrcweir 
1045*cdf0e10cSrcweir SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const
1046*cdf0e10cSrcweir {
1047*cdf0e10cSrcweir 	return new SvxPrintItem( *this );
1048*cdf0e10cSrcweir }
1049*cdf0e10cSrcweir 
1050*cdf0e10cSrcweir // -----------------------------------------------------------------------
1051*cdf0e10cSrcweir 
1052*cdf0e10cSrcweir SvStream& SvxPrintItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1053*cdf0e10cSrcweir {
1054*cdf0e10cSrcweir 	rStrm << (sal_Int8)GetValue();
1055*cdf0e10cSrcweir 	return rStrm;
1056*cdf0e10cSrcweir }
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir // -----------------------------------------------------------------------
1059*cdf0e10cSrcweir 
1060*cdf0e10cSrcweir SfxPoolItem* SvxPrintItem::Create( SvStream& rStrm, sal_uInt16 ) const
1061*cdf0e10cSrcweir {
1062*cdf0e10cSrcweir 	sal_Int8 bIsPrint;
1063*cdf0e10cSrcweir 	rStrm >> bIsPrint;
1064*cdf0e10cSrcweir 	return new SvxPrintItem( Which(), sal_Bool( bIsPrint != 0 ) );
1065*cdf0e10cSrcweir }
1066*cdf0e10cSrcweir 
1067*cdf0e10cSrcweir //------------------------------------------------------------------------
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir SfxItemPresentation SvxPrintItem::GetPresentation
1070*cdf0e10cSrcweir (
1071*cdf0e10cSrcweir 	SfxItemPresentation ePres,
1072*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
1073*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
1074*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
1075*cdf0e10cSrcweir )	const
1076*cdf0e10cSrcweir {
1077*cdf0e10cSrcweir #ifndef SVX_LIGHT
1078*cdf0e10cSrcweir 	switch ( ePres )
1079*cdf0e10cSrcweir 	{
1080*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
1081*cdf0e10cSrcweir 			rText.Erase();
1082*cdf0e10cSrcweir 			return ePres;
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
1085*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
1086*cdf0e10cSrcweir 		{
1087*cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_PRINT_FALSE;
1088*cdf0e10cSrcweir 
1089*cdf0e10cSrcweir 			if ( GetValue() )
1090*cdf0e10cSrcweir 				nId = RID_SVXITEMS_PRINT_TRUE;
1091*cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
1092*cdf0e10cSrcweir 			return ePres;
1093*cdf0e10cSrcweir 		}
1094*cdf0e10cSrcweir         default: ;//prevent warning
1095*cdf0e10cSrcweir     }
1096*cdf0e10cSrcweir #endif // !SVX_LIGHT
1097*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1098*cdf0e10cSrcweir }
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir // class SvxOpaqueItem ---------------------------------------------------
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir SfxPoolItem* SvxOpaqueItem::Clone( SfxItemPool* ) const
1103*cdf0e10cSrcweir {
1104*cdf0e10cSrcweir 	return new SvxOpaqueItem( *this );
1105*cdf0e10cSrcweir }
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir // -----------------------------------------------------------------------
1108*cdf0e10cSrcweir 
1109*cdf0e10cSrcweir SvStream& SvxOpaqueItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1110*cdf0e10cSrcweir {
1111*cdf0e10cSrcweir 	rStrm << (sal_Int8)GetValue();
1112*cdf0e10cSrcweir 	return rStrm;
1113*cdf0e10cSrcweir }
1114*cdf0e10cSrcweir 
1115*cdf0e10cSrcweir // -----------------------------------------------------------------------
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir SfxPoolItem* SvxOpaqueItem::Create( SvStream& rStrm, sal_uInt16 ) const
1118*cdf0e10cSrcweir {
1119*cdf0e10cSrcweir 	sal_Int8 bIsOpaque;
1120*cdf0e10cSrcweir 	rStrm >> bIsOpaque;
1121*cdf0e10cSrcweir 	return new SvxOpaqueItem( Which(), sal_Bool( bIsOpaque != 0 ) );
1122*cdf0e10cSrcweir }
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir //------------------------------------------------------------------------
1125*cdf0e10cSrcweir 
1126*cdf0e10cSrcweir SfxItemPresentation SvxOpaqueItem::GetPresentation
1127*cdf0e10cSrcweir (
1128*cdf0e10cSrcweir 	SfxItemPresentation ePres,
1129*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
1130*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
1131*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
1132*cdf0e10cSrcweir )	const
1133*cdf0e10cSrcweir {
1134*cdf0e10cSrcweir #ifndef SVX_LIGHT
1135*cdf0e10cSrcweir 	switch ( ePres )
1136*cdf0e10cSrcweir 	{
1137*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
1138*cdf0e10cSrcweir 			rText.Erase();
1139*cdf0e10cSrcweir 			return ePres;
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
1142*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
1143*cdf0e10cSrcweir 		{
1144*cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_OPAQUE_FALSE;
1145*cdf0e10cSrcweir 
1146*cdf0e10cSrcweir 			if ( GetValue() )
1147*cdf0e10cSrcweir 				nId = RID_SVXITEMS_OPAQUE_TRUE;
1148*cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
1149*cdf0e10cSrcweir 			return ePres;
1150*cdf0e10cSrcweir 		}
1151*cdf0e10cSrcweir         default: ;//prevent warning
1152*cdf0e10cSrcweir     }
1153*cdf0e10cSrcweir #endif // !SVX_LIGHT
1154*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1155*cdf0e10cSrcweir }
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir // class SvxProtectItem --------------------------------------------------
1158*cdf0e10cSrcweir 
1159*cdf0e10cSrcweir int SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const
1160*cdf0e10cSrcweir {
1161*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
1162*cdf0e10cSrcweir 
1163*cdf0e10cSrcweir 	return ( bCntnt == ( (SvxProtectItem&)rAttr ).bCntnt &&
1164*cdf0e10cSrcweir 			 bSize  == ( (SvxProtectItem&)rAttr ).bSize  &&
1165*cdf0e10cSrcweir 			 bPos   == ( (SvxProtectItem&)rAttr ).bPos );
1166*cdf0e10cSrcweir }
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir /*-----------------16.03.98 12:42-------------------
1169*cdf0e10cSrcweir --------------------------------------------------*/
1170*cdf0e10cSrcweir sal_Bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1171*cdf0e10cSrcweir {
1172*cdf0e10cSrcweir //  sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1173*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1174*cdf0e10cSrcweir 	sal_Bool bValue;
1175*cdf0e10cSrcweir 	switch(nMemberId)
1176*cdf0e10cSrcweir 	{
1177*cdf0e10cSrcweir 		case MID_PROTECT_CONTENT :	bValue = bCntnt; break;
1178*cdf0e10cSrcweir 		case MID_PROTECT_SIZE    :  bValue = bSize; break;
1179*cdf0e10cSrcweir 		case MID_PROTECT_POSITION:  bValue = bPos; break;
1180*cdf0e10cSrcweir 		default:
1181*cdf0e10cSrcweir 			DBG_ERROR("falsche MemberId");
1182*cdf0e10cSrcweir 			return sal_False;
1183*cdf0e10cSrcweir 	}
1184*cdf0e10cSrcweir 
1185*cdf0e10cSrcweir 	rVal = Bool2Any( bValue );
1186*cdf0e10cSrcweir 	return sal_True;
1187*cdf0e10cSrcweir }
1188*cdf0e10cSrcweir /*-----------------16.03.98 12:42-------------------
1189*cdf0e10cSrcweir 
1190*cdf0e10cSrcweir --------------------------------------------------*/
1191*cdf0e10cSrcweir sal_Bool	SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1192*cdf0e10cSrcweir {
1193*cdf0e10cSrcweir //  sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1194*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1195*cdf0e10cSrcweir 	sal_Bool bVal( Any2Bool(rVal) );
1196*cdf0e10cSrcweir 	switch(nMemberId)
1197*cdf0e10cSrcweir 	{
1198*cdf0e10cSrcweir 		case MID_PROTECT_CONTENT :	bCntnt = bVal;	break;
1199*cdf0e10cSrcweir 		case MID_PROTECT_SIZE    :  bSize  = bVal;	break;
1200*cdf0e10cSrcweir 		case MID_PROTECT_POSITION:  bPos   = bVal;	break;
1201*cdf0e10cSrcweir 		default:
1202*cdf0e10cSrcweir 			DBG_ERROR("falsche MemberId");
1203*cdf0e10cSrcweir 			return sal_False;
1204*cdf0e10cSrcweir 	}
1205*cdf0e10cSrcweir 	return sal_True;
1206*cdf0e10cSrcweir }
1207*cdf0e10cSrcweir 
1208*cdf0e10cSrcweir // -----------------------------------------------------------------------
1209*cdf0e10cSrcweir 
1210*cdf0e10cSrcweir SfxPoolItem* SvxProtectItem::Clone( SfxItemPool* ) const
1211*cdf0e10cSrcweir {
1212*cdf0e10cSrcweir 	return new SvxProtectItem( *this );
1213*cdf0e10cSrcweir }
1214*cdf0e10cSrcweir 
1215*cdf0e10cSrcweir //------------------------------------------------------------------------
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir SfxItemPresentation SvxProtectItem::GetPresentation
1218*cdf0e10cSrcweir (
1219*cdf0e10cSrcweir 	SfxItemPresentation ePres,
1220*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
1221*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
1222*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
1223*cdf0e10cSrcweir )   const
1224*cdf0e10cSrcweir {
1225*cdf0e10cSrcweir #ifndef SVX_LIGHT
1226*cdf0e10cSrcweir 	switch ( ePres )
1227*cdf0e10cSrcweir 	{
1228*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
1229*cdf0e10cSrcweir 			rText.Erase();
1230*cdf0e10cSrcweir 			return ePres;
1231*cdf0e10cSrcweir 
1232*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
1233*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
1234*cdf0e10cSrcweir 		{
1235*cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_PROT_CONTENT_FALSE;
1236*cdf0e10cSrcweir 
1237*cdf0e10cSrcweir 			if ( bCntnt )
1238*cdf0e10cSrcweir 				nId = RID_SVXITEMS_PROT_CONTENT_TRUE;
1239*cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
1240*cdf0e10cSrcweir 			rText += cpDelim;
1241*cdf0e10cSrcweir 			nId = RID_SVXITEMS_PROT_SIZE_FALSE;
1242*cdf0e10cSrcweir 
1243*cdf0e10cSrcweir 			if ( bSize )
1244*cdf0e10cSrcweir 				nId = RID_SVXITEMS_PROT_SIZE_TRUE;
1245*cdf0e10cSrcweir 			rText += EE_RESSTR(nId);
1246*cdf0e10cSrcweir 			rText += cpDelim;
1247*cdf0e10cSrcweir 			nId = RID_SVXITEMS_PROT_POS_FALSE;
1248*cdf0e10cSrcweir 
1249*cdf0e10cSrcweir 			if ( bPos )
1250*cdf0e10cSrcweir 				nId = RID_SVXITEMS_PROT_POS_TRUE;
1251*cdf0e10cSrcweir 			rText += EE_RESSTR(nId);
1252*cdf0e10cSrcweir 			return ePres;
1253*cdf0e10cSrcweir 		}
1254*cdf0e10cSrcweir         default: ;//prevent warning
1255*cdf0e10cSrcweir     }
1256*cdf0e10cSrcweir #endif // !SVX_LIGHT
1257*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1258*cdf0e10cSrcweir }
1259*cdf0e10cSrcweir 
1260*cdf0e10cSrcweir // -----------------------------------------------------------------------
1261*cdf0e10cSrcweir 
1262*cdf0e10cSrcweir SvStream& SvxProtectItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1263*cdf0e10cSrcweir {
1264*cdf0e10cSrcweir 	sal_Int8 cProt = 0;
1265*cdf0e10cSrcweir 	if( IsPosProtected() )   cProt |= 0x01;
1266*cdf0e10cSrcweir 	if( IsSizeProtected() )  cProt |= 0x02;
1267*cdf0e10cSrcweir 	if( IsCntntProtected() ) cProt |= 0x04;
1268*cdf0e10cSrcweir 	rStrm << (sal_Int8) cProt;
1269*cdf0e10cSrcweir 	return rStrm;
1270*cdf0e10cSrcweir }
1271*cdf0e10cSrcweir 
1272*cdf0e10cSrcweir // -----------------------------------------------------------------------
1273*cdf0e10cSrcweir 
1274*cdf0e10cSrcweir SfxPoolItem* SvxProtectItem::Create( SvStream& rStrm, sal_uInt16 ) const
1275*cdf0e10cSrcweir {
1276*cdf0e10cSrcweir 	sal_Int8 cFlags;
1277*cdf0e10cSrcweir 	rStrm >> cFlags;
1278*cdf0e10cSrcweir 	SvxProtectItem* pAttr = new SvxProtectItem( Which() );
1279*cdf0e10cSrcweir 	pAttr->SetPosProtect( sal_Bool( ( cFlags & 0x01 ) != 0 ) );
1280*cdf0e10cSrcweir 	pAttr->SetSizeProtect( sal_Bool(  ( cFlags & 0x02 ) != 0 ) );
1281*cdf0e10cSrcweir 	pAttr->SetCntntProtect( sal_Bool(  ( cFlags & 0x04 ) != 0 ) );
1282*cdf0e10cSrcweir 	return pAttr;
1283*cdf0e10cSrcweir }
1284*cdf0e10cSrcweir 
1285*cdf0e10cSrcweir // class SvxShadowItem ---------------------------------------------------
1286*cdf0e10cSrcweir 
1287*cdf0e10cSrcweir SvxShadowItem::SvxShadowItem( const sal_uInt16 nId,
1288*cdf0e10cSrcweir 				 const Color *pColor, const sal_uInt16 nW,
1289*cdf0e10cSrcweir 				 const SvxShadowLocation eLoc ) :
1290*cdf0e10cSrcweir 	SfxEnumItemInterface( nId ),
1291*cdf0e10cSrcweir 	aShadowColor(COL_GRAY),
1292*cdf0e10cSrcweir 	nWidth		( nW ),
1293*cdf0e10cSrcweir 	eLocation	( eLoc )
1294*cdf0e10cSrcweir {
1295*cdf0e10cSrcweir 	if ( pColor )
1296*cdf0e10cSrcweir 		aShadowColor = *pColor;
1297*cdf0e10cSrcweir }
1298*cdf0e10cSrcweir 
1299*cdf0e10cSrcweir // -----------------------------------------------------------------------
1300*cdf0e10cSrcweir sal_Bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1301*cdf0e10cSrcweir {
1302*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1303*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1304*cdf0e10cSrcweir 
1305*cdf0e10cSrcweir 	table::ShadowFormat aShadow;
1306*cdf0e10cSrcweir 	table::ShadowLocation eSet = table::ShadowLocation_NONE;
1307*cdf0e10cSrcweir 	switch( eLocation )
1308*cdf0e10cSrcweir 	{
1309*cdf0e10cSrcweir 		case SVX_SHADOW_TOPLEFT    : eSet = table::ShadowLocation_TOP_LEFT    ; break;
1310*cdf0e10cSrcweir 		case SVX_SHADOW_TOPRIGHT   : eSet = table::ShadowLocation_TOP_RIGHT   ; break;
1311*cdf0e10cSrcweir 		case SVX_SHADOW_BOTTOMLEFT : eSet = table::ShadowLocation_BOTTOM_LEFT ; break;
1312*cdf0e10cSrcweir 		case SVX_SHADOW_BOTTOMRIGHT: eSet = table::ShadowLocation_BOTTOM_RIGHT; break;
1313*cdf0e10cSrcweir         default: ;//prevent warning
1314*cdf0e10cSrcweir     }
1315*cdf0e10cSrcweir 	aShadow.Location = eSet;
1316*cdf0e10cSrcweir     aShadow.ShadowWidth =   bConvert ? TWIP_TO_MM100_UNSIGNED(nWidth) : nWidth;
1317*cdf0e10cSrcweir 	aShadow.IsTransparent = aShadowColor.GetTransparency() > 0;
1318*cdf0e10cSrcweir 	aShadow.Color = aShadowColor.GetRGBColor();
1319*cdf0e10cSrcweir 
1320*cdf0e10cSrcweir     switch ( nMemberId )
1321*cdf0e10cSrcweir     {
1322*cdf0e10cSrcweir         case MID_LOCATION: rVal <<= aShadow.Location; break;
1323*cdf0e10cSrcweir         case MID_WIDTH: rVal <<= aShadow.ShadowWidth; break;
1324*cdf0e10cSrcweir         case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break;
1325*cdf0e10cSrcweir         case MID_BG_COLOR: rVal <<= aShadow.Color; break;
1326*cdf0e10cSrcweir         case 0: rVal <<= aShadow; break;
1327*cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
1328*cdf0e10cSrcweir     }
1329*cdf0e10cSrcweir 
1330*cdf0e10cSrcweir 	return sal_True;
1331*cdf0e10cSrcweir }
1332*cdf0e10cSrcweir // -----------------------------------------------------------------------
1333*cdf0e10cSrcweir sal_Bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1334*cdf0e10cSrcweir {
1335*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1336*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir     table::ShadowFormat aShadow;
1339*cdf0e10cSrcweir     uno::Any aAny;
1340*cdf0e10cSrcweir     sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow );
1341*cdf0e10cSrcweir     switch ( nMemberId )
1342*cdf0e10cSrcweir     {
1343*cdf0e10cSrcweir         case MID_LOCATION:
1344*cdf0e10cSrcweir 		{
1345*cdf0e10cSrcweir 			bRet = (rVal >>= aShadow.Location);
1346*cdf0e10cSrcweir 			if ( !bRet )
1347*cdf0e10cSrcweir 			{
1348*cdf0e10cSrcweir 				sal_Int16 nVal = 0;
1349*cdf0e10cSrcweir 				bRet = (rVal >>= nVal);
1350*cdf0e10cSrcweir 				aShadow.Location = (table::ShadowLocation) nVal;
1351*cdf0e10cSrcweir 			}
1352*cdf0e10cSrcweir 
1353*cdf0e10cSrcweir 			break;
1354*cdf0e10cSrcweir 		}
1355*cdf0e10cSrcweir 
1356*cdf0e10cSrcweir         case MID_WIDTH: rVal >>= aShadow.ShadowWidth; break;
1357*cdf0e10cSrcweir         case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break;
1358*cdf0e10cSrcweir         case MID_BG_COLOR: rVal >>= aShadow.Color; break;
1359*cdf0e10cSrcweir         case 0: rVal >>= aShadow; break;
1360*cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
1361*cdf0e10cSrcweir     }
1362*cdf0e10cSrcweir 
1363*cdf0e10cSrcweir     if ( bRet )
1364*cdf0e10cSrcweir     {
1365*cdf0e10cSrcweir //      SvxShadowLocation eSet = SVX_SHADOW_NONE;
1366*cdf0e10cSrcweir 		switch( aShadow.Location )
1367*cdf0e10cSrcweir 		{
1368*cdf0e10cSrcweir 			case table::ShadowLocation_TOP_LEFT    : eLocation = SVX_SHADOW_TOPLEFT; break;
1369*cdf0e10cSrcweir 			case table::ShadowLocation_TOP_RIGHT   : eLocation = SVX_SHADOW_TOPRIGHT; break;
1370*cdf0e10cSrcweir 			case table::ShadowLocation_BOTTOM_LEFT : eLocation = SVX_SHADOW_BOTTOMLEFT ; break;
1371*cdf0e10cSrcweir 			case table::ShadowLocation_BOTTOM_RIGHT: eLocation = SVX_SHADOW_BOTTOMRIGHT; break;
1372*cdf0e10cSrcweir             default: ;//prevent warning
1373*cdf0e10cSrcweir         }
1374*cdf0e10cSrcweir 
1375*cdf0e10cSrcweir         nWidth = bConvert ? MM100_TO_TWIP(aShadow.ShadowWidth) : aShadow.ShadowWidth;
1376*cdf0e10cSrcweir 		Color aSet(aShadow.Color);
1377*cdf0e10cSrcweir 		aSet.SetTransparency(aShadow.IsTransparent ? 0xff : 0);
1378*cdf0e10cSrcweir 		aShadowColor = aSet;
1379*cdf0e10cSrcweir 	}
1380*cdf0e10cSrcweir 
1381*cdf0e10cSrcweir     return bRet;
1382*cdf0e10cSrcweir }
1383*cdf0e10cSrcweir 
1384*cdf0e10cSrcweir // -----------------------------------------------------------------------
1385*cdf0e10cSrcweir 
1386*cdf0e10cSrcweir int SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const
1387*cdf0e10cSrcweir {
1388*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
1389*cdf0e10cSrcweir 
1390*cdf0e10cSrcweir 	return ( ( aShadowColor == ( (SvxShadowItem&)rAttr ).aShadowColor ) &&
1391*cdf0e10cSrcweir 			 ( nWidth    == ( (SvxShadowItem&)rAttr ).GetWidth() ) &&
1392*cdf0e10cSrcweir 			 ( eLocation == ( (SvxShadowItem&)rAttr ).GetLocation() ) );
1393*cdf0e10cSrcweir }
1394*cdf0e10cSrcweir 
1395*cdf0e10cSrcweir // -----------------------------------------------------------------------
1396*cdf0e10cSrcweir 
1397*cdf0e10cSrcweir SfxPoolItem* SvxShadowItem::Clone( SfxItemPool* ) const
1398*cdf0e10cSrcweir {
1399*cdf0e10cSrcweir 	return new SvxShadowItem( *this );
1400*cdf0e10cSrcweir }
1401*cdf0e10cSrcweir 
1402*cdf0e10cSrcweir // -----------------------------------------------------------------------
1403*cdf0e10cSrcweir 
1404*cdf0e10cSrcweir sal_uInt16 SvxShadowItem::CalcShadowSpace( sal_uInt16 nShadow ) const
1405*cdf0e10cSrcweir {
1406*cdf0e10cSrcweir 	sal_uInt16 nSpace = 0;
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir 	switch ( nShadow )
1409*cdf0e10cSrcweir 	{
1410*cdf0e10cSrcweir 		case SHADOW_TOP:
1411*cdf0e10cSrcweir 			if ( eLocation == SVX_SHADOW_TOPLEFT ||
1412*cdf0e10cSrcweir 				 eLocation == SVX_SHADOW_TOPRIGHT  )
1413*cdf0e10cSrcweir 				nSpace = nWidth;
1414*cdf0e10cSrcweir 			break;
1415*cdf0e10cSrcweir 
1416*cdf0e10cSrcweir 		case SHADOW_BOTTOM:
1417*cdf0e10cSrcweir 			if ( eLocation == SVX_SHADOW_BOTTOMLEFT ||
1418*cdf0e10cSrcweir 				 eLocation == SVX_SHADOW_BOTTOMRIGHT  )
1419*cdf0e10cSrcweir 				nSpace = nWidth;
1420*cdf0e10cSrcweir 			break;
1421*cdf0e10cSrcweir 
1422*cdf0e10cSrcweir 		case SHADOW_LEFT:
1423*cdf0e10cSrcweir 			if ( eLocation == SVX_SHADOW_TOPLEFT ||
1424*cdf0e10cSrcweir 				 eLocation == SVX_SHADOW_BOTTOMLEFT )
1425*cdf0e10cSrcweir 				nSpace = nWidth;
1426*cdf0e10cSrcweir 			break;
1427*cdf0e10cSrcweir 
1428*cdf0e10cSrcweir 		case SHADOW_RIGHT:
1429*cdf0e10cSrcweir 			if ( eLocation == SVX_SHADOW_TOPRIGHT ||
1430*cdf0e10cSrcweir 				 eLocation == SVX_SHADOW_BOTTOMRIGHT )
1431*cdf0e10cSrcweir 				nSpace = nWidth;
1432*cdf0e10cSrcweir 			break;
1433*cdf0e10cSrcweir 
1434*cdf0e10cSrcweir 		default:
1435*cdf0e10cSrcweir 			DBG_ERROR( "wrong shadow" );
1436*cdf0e10cSrcweir 	}
1437*cdf0e10cSrcweir 	return nSpace;
1438*cdf0e10cSrcweir }
1439*cdf0e10cSrcweir 
1440*cdf0e10cSrcweir //------------------------------------------------------------------------
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir SfxItemPresentation SvxShadowItem::GetPresentation
1443*cdf0e10cSrcweir (
1444*cdf0e10cSrcweir 	SfxItemPresentation ePres,
1445*cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
1446*cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
1447*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *pIntl
1448*cdf0e10cSrcweir )	const
1449*cdf0e10cSrcweir {
1450*cdf0e10cSrcweir #ifndef SVX_LIGHT
1451*cdf0e10cSrcweir 	switch ( ePres )
1452*cdf0e10cSrcweir 	{
1453*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
1454*cdf0e10cSrcweir 			rText.Erase();
1455*cdf0e10cSrcweir 			return ePres;
1456*cdf0e10cSrcweir 
1457*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
1458*cdf0e10cSrcweir 		{
1459*cdf0e10cSrcweir 			rText = ::GetColorString( aShadowColor );
1460*cdf0e10cSrcweir 			rText += cpDelim;
1461*cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE;
1462*cdf0e10cSrcweir 
1463*cdf0e10cSrcweir 			if ( aShadowColor.GetTransparency() )
1464*cdf0e10cSrcweir 				nId = RID_SVXITEMS_TRANSPARENT_TRUE;
1465*cdf0e10cSrcweir 			rText += EE_RESSTR(nId);
1466*cdf0e10cSrcweir 			rText += cpDelim;
1467*cdf0e10cSrcweir             rText += GetMetricText( (long)nWidth, eCoreUnit, ePresUnit, pIntl );
1468*cdf0e10cSrcweir 			rText += cpDelim;
1469*cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation);
1470*cdf0e10cSrcweir 			return ePres;
1471*cdf0e10cSrcweir 		}
1472*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
1473*cdf0e10cSrcweir 		{
1474*cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_SHADOW_COMPLETE);
1475*cdf0e10cSrcweir 			rText += ::GetColorString( aShadowColor );
1476*cdf0e10cSrcweir 			rText += cpDelim;
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE;
1479*cdf0e10cSrcweir 			if ( aShadowColor.GetTransparency() )
1480*cdf0e10cSrcweir 				nId = RID_SVXITEMS_TRANSPARENT_TRUE;
1481*cdf0e10cSrcweir 			rText += EE_RESSTR(nId);
1482*cdf0e10cSrcweir 			rText += cpDelim;
1483*cdf0e10cSrcweir             rText += GetMetricText( (long)nWidth, eCoreUnit, ePresUnit, pIntl );
1484*cdf0e10cSrcweir 			rText += EE_RESSTR(GetMetricId(ePresUnit));
1485*cdf0e10cSrcweir 			rText += cpDelim;
1486*cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation);
1487*cdf0e10cSrcweir 			return ePres;
1488*cdf0e10cSrcweir 		}
1489*cdf0e10cSrcweir         default: ;//prevent warning
1490*cdf0e10cSrcweir     }
1491*cdf0e10cSrcweir #endif
1492*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1493*cdf0e10cSrcweir }
1494*cdf0e10cSrcweir 
1495*cdf0e10cSrcweir // -----------------------------------------------------------------------
1496*cdf0e10cSrcweir 
1497*cdf0e10cSrcweir SvStream& SvxShadowItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1498*cdf0e10cSrcweir {
1499*cdf0e10cSrcweir 	rStrm << (sal_Int8) GetLocation()
1500*cdf0e10cSrcweir 		  << (sal_uInt16) GetWidth()
1501*cdf0e10cSrcweir 		  << (sal_Bool)(aShadowColor.GetTransparency() > 0)
1502*cdf0e10cSrcweir 		  << GetColor()
1503*cdf0e10cSrcweir 		  << GetColor()
1504*cdf0e10cSrcweir 		  << (sal_Int8)(aShadowColor.GetTransparency() > 0 ? 0 : 1); //BRUSH_NULL : BRUSH_SOLID
1505*cdf0e10cSrcweir 	return rStrm;
1506*cdf0e10cSrcweir }
1507*cdf0e10cSrcweir 
1508*cdf0e10cSrcweir // -----------------------------------------------------------------------
1509*cdf0e10cSrcweir 
1510*cdf0e10cSrcweir int SvxShadowItem::ScaleMetrics( long nMult, long nDiv )
1511*cdf0e10cSrcweir {
1512*cdf0e10cSrcweir 	nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv );
1513*cdf0e10cSrcweir 	return 1;
1514*cdf0e10cSrcweir }
1515*cdf0e10cSrcweir 
1516*cdf0e10cSrcweir // -----------------------------------------------------------------------
1517*cdf0e10cSrcweir 
1518*cdf0e10cSrcweir int SvxShadowItem::HasMetrics() const
1519*cdf0e10cSrcweir {
1520*cdf0e10cSrcweir 	return 1;
1521*cdf0e10cSrcweir }
1522*cdf0e10cSrcweir 
1523*cdf0e10cSrcweir // -----------------------------------------------------------------------
1524*cdf0e10cSrcweir 
1525*cdf0e10cSrcweir SfxPoolItem* SvxShadowItem::Create( SvStream& rStrm, sal_uInt16 ) const
1526*cdf0e10cSrcweir {
1527*cdf0e10cSrcweir 	sal_Int8 cLoc;
1528*cdf0e10cSrcweir     sal_uInt16 _nWidth;
1529*cdf0e10cSrcweir 	sal_Bool bTrans;
1530*cdf0e10cSrcweir 	Color aColor;
1531*cdf0e10cSrcweir 	Color aFillColor;
1532*cdf0e10cSrcweir 	sal_Int8 nStyle;
1533*cdf0e10cSrcweir     rStrm >> cLoc >> _nWidth
1534*cdf0e10cSrcweir 		  >> bTrans >> aColor >> aFillColor >> nStyle;
1535*cdf0e10cSrcweir 	aColor.SetTransparency(bTrans ? 0xff : 0);
1536*cdf0e10cSrcweir     return new SvxShadowItem( Which(), &aColor, _nWidth, (SvxShadowLocation)cLoc );
1537*cdf0e10cSrcweir }
1538*cdf0e10cSrcweir 
1539*cdf0e10cSrcweir // -----------------------------------------------------------------------
1540*cdf0e10cSrcweir 
1541*cdf0e10cSrcweir sal_uInt16 SvxShadowItem::GetValueCount() const
1542*cdf0e10cSrcweir {
1543*cdf0e10cSrcweir 	return SVX_SHADOW_END;	// SVX_SHADOW_BOTTOMRIGHT + 1
1544*cdf0e10cSrcweir }
1545*cdf0e10cSrcweir 
1546*cdf0e10cSrcweir // -----------------------------------------------------------------------
1547*cdf0e10cSrcweir 
1548*cdf0e10cSrcweir XubString SvxShadowItem::GetValueTextByPos( sal_uInt16 nPos ) const
1549*cdf0e10cSrcweir {
1550*cdf0e10cSrcweir 	DBG_ASSERT( nPos < SVX_SHADOW_END, "enum overflow!" );
1551*cdf0e10cSrcweir 	return XubString( EditResId( RID_SVXITEMS_SHADOW_BEGIN + nPos ) );
1552*cdf0e10cSrcweir }
1553*cdf0e10cSrcweir 
1554*cdf0e10cSrcweir // -----------------------------------------------------------------------
1555*cdf0e10cSrcweir 
1556*cdf0e10cSrcweir sal_uInt16 SvxShadowItem::GetEnumValue() const
1557*cdf0e10cSrcweir {
1558*cdf0e10cSrcweir 	return (sal_uInt16)GetLocation();
1559*cdf0e10cSrcweir }
1560*cdf0e10cSrcweir 
1561*cdf0e10cSrcweir // -----------------------------------------------------------------------
1562*cdf0e10cSrcweir 
1563*cdf0e10cSrcweir void SvxShadowItem::SetEnumValue( sal_uInt16 nVal )
1564*cdf0e10cSrcweir {
1565*cdf0e10cSrcweir 	SetLocation( (const SvxShadowLocation)nVal );
1566*cdf0e10cSrcweir }
1567*cdf0e10cSrcweir 
1568*cdf0e10cSrcweir // class SvxBorderLine  --------------------------------------------------
1569*cdf0e10cSrcweir 
1570*cdf0e10cSrcweir SvxBorderLine::SvxBorderLine( const Color *pCol, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist )
1571*cdf0e10cSrcweir : nOutWidth( nOut )
1572*cdf0e10cSrcweir , nInWidth ( nIn )
1573*cdf0e10cSrcweir , nDistance( nDist )
1574*cdf0e10cSrcweir {
1575*cdf0e10cSrcweir 	if ( pCol )
1576*cdf0e10cSrcweir 		aColor = *pCol;
1577*cdf0e10cSrcweir }
1578*cdf0e10cSrcweir 
1579*cdf0e10cSrcweir // -----------------------------------------------------------------------
1580*cdf0e10cSrcweir 
1581*cdf0e10cSrcweir SvxBorderLine::SvxBorderLine( const SvxBorderLine& r )
1582*cdf0e10cSrcweir {
1583*cdf0e10cSrcweir 	*this = r;
1584*cdf0e10cSrcweir }
1585*cdf0e10cSrcweir 
1586*cdf0e10cSrcweir // -----------------------------------------------------------------------
1587*cdf0e10cSrcweir 
1588*cdf0e10cSrcweir SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r )
1589*cdf0e10cSrcweir {
1590*cdf0e10cSrcweir 	aColor = r.aColor;
1591*cdf0e10cSrcweir 	nOutWidth = r.nOutWidth;
1592*cdf0e10cSrcweir 	nInWidth = r.nInWidth;
1593*cdf0e10cSrcweir 	nDistance = r.nDistance;
1594*cdf0e10cSrcweir 	return *this;
1595*cdf0e10cSrcweir }
1596*cdf0e10cSrcweir 
1597*cdf0e10cSrcweir // -----------------------------------------------------------------------
1598*cdf0e10cSrcweir 
1599*cdf0e10cSrcweir void SvxBorderLine::ScaleMetrics( long nMult, long nDiv )
1600*cdf0e10cSrcweir {
1601*cdf0e10cSrcweir 	nOutWidth = (sal_uInt16)Scale( nOutWidth, nMult, nDiv );
1602*cdf0e10cSrcweir 	nInWidth = (sal_uInt16)Scale( nInWidth, nMult, nDiv );
1603*cdf0e10cSrcweir 	nDistance = (sal_uInt16)Scale( nDistance, nMult, nDiv );
1604*cdf0e10cSrcweir }
1605*cdf0e10cSrcweir 
1606*cdf0e10cSrcweir // -----------------------------------------------------------------------
1607*cdf0e10cSrcweir 
1608*cdf0e10cSrcweir sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const
1609*cdf0e10cSrcweir {
1610*cdf0e10cSrcweir 	return ( ( aColor    == rCmp.GetColor() ) 	 &&
1611*cdf0e10cSrcweir 			 ( nInWidth  == rCmp.GetInWidth() )  &&
1612*cdf0e10cSrcweir 			 ( nOutWidth == rCmp.GetOutWidth() ) &&
1613*cdf0e10cSrcweir 			 ( nDistance == rCmp.GetDistance() ) );
1614*cdf0e10cSrcweir }
1615*cdf0e10cSrcweir 
1616*cdf0e10cSrcweir // -----------------------------------------------------------------------
1617*cdf0e10cSrcweir 
1618*cdf0e10cSrcweir XubString SvxBorderLine::GetValueString( SfxMapUnit eSrcUnit,
1619*cdf0e10cSrcweir 									  SfxMapUnit eDestUnit,
1620*cdf0e10cSrcweir                                       const IntlWrapper* pIntl,
1621*cdf0e10cSrcweir 									  sal_Bool bMetricStr) const
1622*cdf0e10cSrcweir {
1623*cdf0e10cSrcweir #ifndef SVX_LIGHT
1624*cdf0e10cSrcweir 	sal_uInt16 nResId = 0;
1625*cdf0e10cSrcweir 
1626*cdf0e10cSrcweir 	if ( 0 == nDistance )
1627*cdf0e10cSrcweir 	{
1628*cdf0e10cSrcweir 		// einfach Linie
1629*cdf0e10cSrcweir 		if ( DEF_LINE_WIDTH_0 == nOutWidth )
1630*cdf0e10cSrcweir 			nResId = RID_SINGLE_LINE0;
1631*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_1 == nOutWidth )
1632*cdf0e10cSrcweir 			nResId = RID_SINGLE_LINE1;
1633*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_2 == nOutWidth )
1634*cdf0e10cSrcweir 			nResId = RID_SINGLE_LINE2;
1635*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_3 == nOutWidth )
1636*cdf0e10cSrcweir 			nResId = RID_SINGLE_LINE3;
1637*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_4 == nOutWidth )
1638*cdf0e10cSrcweir 			nResId = RID_SINGLE_LINE4;
1639*cdf0e10cSrcweir 	}
1640*cdf0e10cSrcweir 	else if ( DEF_LINE_WIDTH_1 == nDistance )
1641*cdf0e10cSrcweir 	{
1642*cdf0e10cSrcweir 		// doppelte Linie, kleiner Abstand
1643*cdf0e10cSrcweir 		if ( DEF_LINE_WIDTH_0 == nOutWidth && DEF_LINE_WIDTH_0 == nInWidth )
1644*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE0;
1645*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_1 == nOutWidth &&
1646*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_1 == nInWidth )
1647*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE2;
1648*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_1 == nOutWidth &&
1649*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_2 == nInWidth )
1650*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE8;
1651*cdf0e10cSrcweir 	}
1652*cdf0e10cSrcweir 	else if ( DEF_LINE_WIDTH_2 == nDistance )
1653*cdf0e10cSrcweir 	{
1654*cdf0e10cSrcweir 		// doppelte Linie, gro\ser Abstand
1655*cdf0e10cSrcweir 		if ( DEF_LINE_WIDTH_0 == nOutWidth && DEF_LINE_WIDTH_0 == nInWidth )
1656*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE1;
1657*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_2 == nOutWidth &&
1658*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_2 == nInWidth )
1659*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE3;
1660*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_1 == nOutWidth &&
1661*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_0 == nInWidth )
1662*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE4;
1663*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_2 == nOutWidth &&
1664*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_0 == nInWidth )
1665*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE5;
1666*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_3 == nOutWidth &&
1667*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_0 == nInWidth )
1668*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE6;
1669*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_2 == nOutWidth &&
1670*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_1 == nInWidth )
1671*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE7;
1672*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_3 == nOutWidth &&
1673*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_2 == nInWidth )
1674*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE9;
1675*cdf0e10cSrcweir 		else if ( DEF_LINE_WIDTH_2 == nOutWidth &&
1676*cdf0e10cSrcweir 				  DEF_LINE_WIDTH_3 == nInWidth )
1677*cdf0e10cSrcweir 			nResId = RID_DOUBLE_LINE10;
1678*cdf0e10cSrcweir 	}
1679*cdf0e10cSrcweir 	String aStr;
1680*cdf0e10cSrcweir 	aStr += sal_Unicode('(');
1681*cdf0e10cSrcweir 	aStr += ::GetColorString( aColor );
1682*cdf0e10cSrcweir 	aStr += cpDelim;
1683*cdf0e10cSrcweir 
1684*cdf0e10cSrcweir 	if ( nResId )
1685*cdf0e10cSrcweir 		aStr += EE_RESSTR(nResId);
1686*cdf0e10cSrcweir 	else
1687*cdf0e10cSrcweir 	{
1688*cdf0e10cSrcweir 		String sMetric = EE_RESSTR(GetMetricId( eDestUnit ));
1689*cdf0e10cSrcweir         aStr += GetMetricText( (long)nInWidth, eSrcUnit, eDestUnit, pIntl );
1690*cdf0e10cSrcweir 		if ( bMetricStr )
1691*cdf0e10cSrcweir 			aStr += sMetric;
1692*cdf0e10cSrcweir 		aStr += cpDelim;
1693*cdf0e10cSrcweir         aStr += GetMetricText( (long)nOutWidth, eSrcUnit, eDestUnit, pIntl );
1694*cdf0e10cSrcweir 		if ( bMetricStr )
1695*cdf0e10cSrcweir 			aStr += sMetric;
1696*cdf0e10cSrcweir 		aStr += cpDelim;
1697*cdf0e10cSrcweir         aStr += GetMetricText( (long)nDistance, eSrcUnit, eDestUnit, pIntl );
1698*cdf0e10cSrcweir 		if ( bMetricStr )
1699*cdf0e10cSrcweir 			aStr += sMetric;
1700*cdf0e10cSrcweir 	}
1701*cdf0e10cSrcweir 	aStr += sal_Unicode(')');
1702*cdf0e10cSrcweir 	return aStr;
1703*cdf0e10cSrcweir #else
1704*cdf0e10cSrcweir 	return UniString();
1705*cdf0e10cSrcweir #endif
1706*cdf0e10cSrcweir }
1707*cdf0e10cSrcweir 
1708*cdf0e10cSrcweir bool SvxBorderLine::HasPriority( const SvxBorderLine& rOtherLine ) const
1709*cdf0e10cSrcweir {
1710*cdf0e10cSrcweir 	const sal_uInt16 nThisSize = GetOutWidth() + GetDistance() + GetInWidth();
1711*cdf0e10cSrcweir 	const sal_uInt16 nOtherSize = rOtherLine.GetOutWidth() + rOtherLine.GetDistance() + rOtherLine.GetInWidth();
1712*cdf0e10cSrcweir 
1713*cdf0e10cSrcweir 	if (nThisSize > nOtherSize)
1714*cdf0e10cSrcweir 	{
1715*cdf0e10cSrcweir 		return true;
1716*cdf0e10cSrcweir 	}
1717*cdf0e10cSrcweir 	else if (nThisSize < nOtherSize)
1718*cdf0e10cSrcweir 	{
1719*cdf0e10cSrcweir 		return false;
1720*cdf0e10cSrcweir 	}
1721*cdf0e10cSrcweir 	else
1722*cdf0e10cSrcweir 	{
1723*cdf0e10cSrcweir 		if ( rOtherLine.GetInWidth() && !GetInWidth() )
1724*cdf0e10cSrcweir 		{
1725*cdf0e10cSrcweir 			return true;
1726*cdf0e10cSrcweir 		}
1727*cdf0e10cSrcweir 		else if ( GetInWidth() && !rOtherLine.GetInWidth() )
1728*cdf0e10cSrcweir 		{
1729*cdf0e10cSrcweir 			return false;
1730*cdf0e10cSrcweir 		}
1731*cdf0e10cSrcweir 		else
1732*cdf0e10cSrcweir 		{
1733*cdf0e10cSrcweir 			return false;
1734*cdf0e10cSrcweir 		}
1735*cdf0e10cSrcweir 	}
1736*cdf0e10cSrcweir }
1737*cdf0e10cSrcweir 
1738*cdf0e10cSrcweir // class SvxBoxItem ------------------------------------------------------
1739*cdf0e10cSrcweir 
1740*cdf0e10cSrcweir SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) :
1741*cdf0e10cSrcweir 
1742*cdf0e10cSrcweir 	SfxPoolItem	( rCpy ),
1743*cdf0e10cSrcweir 	nTopDist	( rCpy.nTopDist ),
1744*cdf0e10cSrcweir 	nBottomDist	( rCpy.nBottomDist ),
1745*cdf0e10cSrcweir 	nLeftDist	( rCpy.nLeftDist ),
1746*cdf0e10cSrcweir 	nRightDist	( rCpy.nRightDist )
1747*cdf0e10cSrcweir 
1748*cdf0e10cSrcweir {
1749*cdf0e10cSrcweir 	pTop 	= rCpy.GetTop() 	? new SvxBorderLine( *rCpy.GetTop() ) 	 : 0;
1750*cdf0e10cSrcweir 	pBottom = rCpy.GetBottom()	? new SvxBorderLine( *rCpy.GetBottom() ) : 0;
1751*cdf0e10cSrcweir 	pLeft 	= rCpy.GetLeft() 	? new SvxBorderLine( *rCpy.GetLeft() ) 	 : 0;
1752*cdf0e10cSrcweir 	pRight 	= rCpy.GetRight() 	? new SvxBorderLine( *rCpy.GetRight() )  : 0;
1753*cdf0e10cSrcweir }
1754*cdf0e10cSrcweir 
1755*cdf0e10cSrcweir // -----------------------------------------------------------------------
1756*cdf0e10cSrcweir 
1757*cdf0e10cSrcweir SvxBoxItem::SvxBoxItem( const sal_uInt16 nId ) :
1758*cdf0e10cSrcweir 	SfxPoolItem( nId ),
1759*cdf0e10cSrcweir 
1760*cdf0e10cSrcweir 	pTop		( 0 ),
1761*cdf0e10cSrcweir 	pBottom		( 0 ),
1762*cdf0e10cSrcweir 	pLeft		( 0 ),
1763*cdf0e10cSrcweir 	pRight		( 0 ),
1764*cdf0e10cSrcweir 	nTopDist	( 0 ),
1765*cdf0e10cSrcweir 	nBottomDist	( 0 ),
1766*cdf0e10cSrcweir 	nLeftDist	( 0 ),
1767*cdf0e10cSrcweir 	nRightDist	( 0 )
1768*cdf0e10cSrcweir 
1769*cdf0e10cSrcweir {
1770*cdf0e10cSrcweir }
1771*cdf0e10cSrcweir 
1772*cdf0e10cSrcweir // -----------------------------------------------------------------------
1773*cdf0e10cSrcweir 
1774*cdf0e10cSrcweir SvxBoxItem::~SvxBoxItem()
1775*cdf0e10cSrcweir {
1776*cdf0e10cSrcweir 	delete pTop;
1777*cdf0e10cSrcweir 	delete pBottom;
1778*cdf0e10cSrcweir 	delete pLeft;
1779*cdf0e10cSrcweir 	delete pRight;
1780*cdf0e10cSrcweir }
1781*cdf0e10cSrcweir 
1782*cdf0e10cSrcweir // -----------------------------------------------------------------------
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox )
1785*cdf0e10cSrcweir {
1786*cdf0e10cSrcweir 	nTopDist = rBox.nTopDist;
1787*cdf0e10cSrcweir 	nBottomDist = rBox.nBottomDist;
1788*cdf0e10cSrcweir 	nLeftDist = rBox.nLeftDist;
1789*cdf0e10cSrcweir 	nRightDist = rBox.nRightDist;
1790*cdf0e10cSrcweir 	SetLine( rBox.GetTop(), BOX_LINE_TOP );
1791*cdf0e10cSrcweir 	SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM );
1792*cdf0e10cSrcweir 	SetLine( rBox.GetLeft(), BOX_LINE_LEFT );
1793*cdf0e10cSrcweir 	SetLine( rBox.GetRight(), BOX_LINE_RIGHT );
1794*cdf0e10cSrcweir 	return *this;
1795*cdf0e10cSrcweir }
1796*cdf0e10cSrcweir 
1797*cdf0e10cSrcweir // -----------------------------------------------------------------------
1798*cdf0e10cSrcweir 
1799*cdf0e10cSrcweir inline sal_Bool CmpBrdLn( const SvxBorderLine* pBrd1, const SvxBorderLine* pBrd2 )
1800*cdf0e10cSrcweir {
1801*cdf0e10cSrcweir 	sal_Bool bRet;
1802*cdf0e10cSrcweir 	if( 0 != pBrd1 ?  0 == pBrd2 : 0 != pBrd2 )
1803*cdf0e10cSrcweir 		bRet = sal_False;
1804*cdf0e10cSrcweir 	else
1805*cdf0e10cSrcweir 		if( !pBrd1 )
1806*cdf0e10cSrcweir 			bRet = sal_True;
1807*cdf0e10cSrcweir 		else
1808*cdf0e10cSrcweir 			bRet = (*pBrd1 == *pBrd2);
1809*cdf0e10cSrcweir 	return bRet;
1810*cdf0e10cSrcweir }
1811*cdf0e10cSrcweir 
1812*cdf0e10cSrcweir // -----------------------------------------------------------------------
1813*cdf0e10cSrcweir 
1814*cdf0e10cSrcweir int SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const
1815*cdf0e10cSrcweir {
1816*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
1817*cdf0e10cSrcweir 
1818*cdf0e10cSrcweir 	return (
1819*cdf0e10cSrcweir 		( nTopDist == ( (SvxBoxItem&)rAttr ).nTopDist )	&&
1820*cdf0e10cSrcweir 		( nBottomDist == ( (SvxBoxItem&)rAttr ).nBottomDist )	&&
1821*cdf0e10cSrcweir 		( nLeftDist == ( (SvxBoxItem&)rAttr ).nLeftDist )	&&
1822*cdf0e10cSrcweir 		( nRightDist == ( (SvxBoxItem&)rAttr ).nRightDist )	&&
1823*cdf0e10cSrcweir 		CmpBrdLn( pTop, ( (SvxBoxItem&)rAttr ).GetTop() )			&&
1824*cdf0e10cSrcweir 		CmpBrdLn( pBottom, ( (SvxBoxItem&)rAttr ).GetBottom() )		&&
1825*cdf0e10cSrcweir 		CmpBrdLn( pLeft, ( (SvxBoxItem&)rAttr ).GetLeft() )			&&
1826*cdf0e10cSrcweir 		CmpBrdLn( pRight, ( (SvxBoxItem&)rAttr ).GetRight() ) );
1827*cdf0e10cSrcweir }
1828*cdf0e10cSrcweir 
1829*cdf0e10cSrcweir // -----------------------------------------------------------------------
1830*cdf0e10cSrcweir table::BorderLine SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert)
1831*cdf0e10cSrcweir {
1832*cdf0e10cSrcweir 	table::BorderLine aLine;
1833*cdf0e10cSrcweir 	if(pLine)
1834*cdf0e10cSrcweir 	{
1835*cdf0e10cSrcweir 		aLine.Color			 = pLine->GetColor().GetColor() ;
1836*cdf0e10cSrcweir         aLine.InnerLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetInWidth() ): pLine->GetInWidth() );
1837*cdf0e10cSrcweir         aLine.OuterLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetOutWidth()): pLine->GetOutWidth() );
1838*cdf0e10cSrcweir         aLine.LineDistance   = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetDistance()): pLine->GetDistance() );
1839*cdf0e10cSrcweir 	}
1840*cdf0e10cSrcweir 	else
1841*cdf0e10cSrcweir 		aLine.Color			 = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance	 = 0;
1842*cdf0e10cSrcweir 	return aLine;
1843*cdf0e10cSrcweir }
1844*cdf0e10cSrcweir // -----------------------------------------------------------------------
1845*cdf0e10cSrcweir sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId  ) const
1846*cdf0e10cSrcweir {
1847*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1848*cdf0e10cSrcweir 	table::BorderLine aRetLine;
1849*cdf0e10cSrcweir 	sal_uInt16 nDist = 0;
1850*cdf0e10cSrcweir 	sal_Bool bDistMember = sal_False;
1851*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1852*cdf0e10cSrcweir     sal_Bool bSerialize = sal_False;
1853*cdf0e10cSrcweir 	switch(nMemberId)
1854*cdf0e10cSrcweir 	{
1855*cdf0e10cSrcweir         case 0:
1856*cdf0e10cSrcweir         {
1857*cdf0e10cSrcweir             // 4 Borders and 5 distances
1858*cdf0e10cSrcweir             uno::Sequence< uno::Any > aSeq( 9 );
1859*cdf0e10cSrcweir             aSeq[0] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetLeft(), bConvert) );
1860*cdf0e10cSrcweir             aSeq[1] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetRight(), bConvert) );
1861*cdf0e10cSrcweir             aSeq[2] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetBottom(), bConvert) );
1862*cdf0e10cSrcweir             aSeq[3] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetTop(), bConvert) );
1863*cdf0e10cSrcweir             aSeq[4] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( GetDistance()) : GetDistance()));
1864*cdf0e10cSrcweir             aSeq[5] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nTopDist ) : nTopDist ));
1865*cdf0e10cSrcweir             aSeq[6] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nBottomDist ) : nBottomDist ));
1866*cdf0e10cSrcweir             aSeq[7] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nLeftDist ) : nLeftDist ));
1867*cdf0e10cSrcweir             aSeq[8] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nRightDist ) : nRightDist ));
1868*cdf0e10cSrcweir             rVal = uno::makeAny( aSeq );
1869*cdf0e10cSrcweir             return sal_True;
1870*cdf0e10cSrcweir         }
1871*cdf0e10cSrcweir         case MID_LEFT_BORDER:
1872*cdf0e10cSrcweir             bSerialize = sal_True;      // intentionally no break!
1873*cdf0e10cSrcweir 		case LEFT_BORDER:
1874*cdf0e10cSrcweir 			aRetLine = SvxBoxItem::SvxLineToLine(GetLeft(), bConvert);
1875*cdf0e10cSrcweir 			break;
1876*cdf0e10cSrcweir         case MID_RIGHT_BORDER:
1877*cdf0e10cSrcweir             bSerialize = sal_True;      // intentionally no break!
1878*cdf0e10cSrcweir 		case RIGHT_BORDER:
1879*cdf0e10cSrcweir 			aRetLine = SvxBoxItem::SvxLineToLine(GetRight(), bConvert);
1880*cdf0e10cSrcweir 			break;
1881*cdf0e10cSrcweir         case MID_BOTTOM_BORDER:
1882*cdf0e10cSrcweir             bSerialize = sal_True;      // intentionally no break!
1883*cdf0e10cSrcweir 		case BOTTOM_BORDER:
1884*cdf0e10cSrcweir 			aRetLine = SvxBoxItem::SvxLineToLine(GetBottom(), bConvert);
1885*cdf0e10cSrcweir 			break;
1886*cdf0e10cSrcweir         case MID_TOP_BORDER:
1887*cdf0e10cSrcweir             bSerialize = sal_True;      // intentionally no break!
1888*cdf0e10cSrcweir 		case TOP_BORDER:
1889*cdf0e10cSrcweir 			aRetLine = SvxBoxItem::SvxLineToLine(GetTop(), bConvert);
1890*cdf0e10cSrcweir 			break;
1891*cdf0e10cSrcweir 		case BORDER_DISTANCE:
1892*cdf0e10cSrcweir 			nDist = GetDistance();
1893*cdf0e10cSrcweir 			bDistMember = sal_True;
1894*cdf0e10cSrcweir 			break;
1895*cdf0e10cSrcweir 		case TOP_BORDER_DISTANCE:
1896*cdf0e10cSrcweir 			nDist = nTopDist;
1897*cdf0e10cSrcweir 			bDistMember = sal_True;
1898*cdf0e10cSrcweir 			break;
1899*cdf0e10cSrcweir 		case BOTTOM_BORDER_DISTANCE:
1900*cdf0e10cSrcweir 			nDist = nBottomDist;
1901*cdf0e10cSrcweir 			bDistMember = sal_True;
1902*cdf0e10cSrcweir 			break;
1903*cdf0e10cSrcweir 		case LEFT_BORDER_DISTANCE:
1904*cdf0e10cSrcweir 			nDist = nLeftDist;
1905*cdf0e10cSrcweir 			bDistMember = sal_True;
1906*cdf0e10cSrcweir 			break;
1907*cdf0e10cSrcweir 		case RIGHT_BORDER_DISTANCE:
1908*cdf0e10cSrcweir 			nDist = nRightDist;
1909*cdf0e10cSrcweir 			bDistMember = sal_True;
1910*cdf0e10cSrcweir 			break;
1911*cdf0e10cSrcweir 	}
1912*cdf0e10cSrcweir 
1913*cdf0e10cSrcweir 	if( bDistMember )
1914*cdf0e10cSrcweir         rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nDist) : nDist);
1915*cdf0e10cSrcweir 	else
1916*cdf0e10cSrcweir     {
1917*cdf0e10cSrcweir /*
1918*cdf0e10cSrcweir         if ( bSerialize )
1919*cdf0e10cSrcweir         {
1920*cdf0e10cSrcweir             ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4);
1921*cdf0e10cSrcweir             aSeq[0] <<= aRetLine.Color;
1922*cdf0e10cSrcweir             aSeq[1] <<= aRetLine.InnerLineWidth;
1923*cdf0e10cSrcweir             aSeq[2] <<= aRetLine.OuterLineWidth;
1924*cdf0e10cSrcweir             aSeq[3] <<= aRetLine.LineDistance;
1925*cdf0e10cSrcweir             rVal <<= aSeq;
1926*cdf0e10cSrcweir         }
1927*cdf0e10cSrcweir         else
1928*cdf0e10cSrcweir */
1929*cdf0e10cSrcweir             rVal <<= aRetLine;
1930*cdf0e10cSrcweir     }
1931*cdf0e10cSrcweir 
1932*cdf0e10cSrcweir 	return sal_True;
1933*cdf0e10cSrcweir }
1934*cdf0e10cSrcweir 
1935*cdf0e10cSrcweir // -----------------------------------------------------------------------
1936*cdf0e10cSrcweir sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert)
1937*cdf0e10cSrcweir {
1938*cdf0e10cSrcweir 	rSvxLine.SetColor(   Color(rLine.Color));
1939*cdf0e10cSrcweir 	rSvxLine.SetInWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth  ));
1940*cdf0e10cSrcweir 	rSvxLine.SetOutWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth  ));
1941*cdf0e10cSrcweir 	rSvxLine.SetDistance( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance	)  : rLine.LineDistance	 ));
1942*cdf0e10cSrcweir 	sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0;
1943*cdf0e10cSrcweir 	return bRet;
1944*cdf0e10cSrcweir }
1945*cdf0e10cSrcweir 
1946*cdf0e10cSrcweir // -----------------------------------------------------------------------
1947*cdf0e10cSrcweir 
1948*cdf0e10cSrcweir sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1949*cdf0e10cSrcweir {
1950*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1951*cdf0e10cSrcweir 	sal_uInt16 nLine = BOX_LINE_TOP;
1952*cdf0e10cSrcweir 	sal_Bool bDistMember = sal_False;
1953*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1954*cdf0e10cSrcweir 	switch(nMemberId)
1955*cdf0e10cSrcweir 	{
1956*cdf0e10cSrcweir         case 0:
1957*cdf0e10cSrcweir         {
1958*cdf0e10cSrcweir             uno::Sequence< uno::Any > aSeq;
1959*cdf0e10cSrcweir             if (( rVal >>= aSeq ) && ( aSeq.getLength() == 9 ))
1960*cdf0e10cSrcweir             {
1961*cdf0e10cSrcweir                 // 4 Borders and 5 distances
1962*cdf0e10cSrcweir 		        sal_Int32 nDist = 0;
1963*cdf0e10cSrcweir 		        SvxBorderLine aLine;
1964*cdf0e10cSrcweir                 table::BorderLine aBorderLine;
1965*cdf0e10cSrcweir                 if ( aSeq[0] >>= aBorderLine )
1966*cdf0e10cSrcweir                 {
1967*cdf0e10cSrcweir                     sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
1968*cdf0e10cSrcweir 		            SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT );
1969*cdf0e10cSrcweir                 }
1970*cdf0e10cSrcweir                 else
1971*cdf0e10cSrcweir                     return sal_False;
1972*cdf0e10cSrcweir 
1973*cdf0e10cSrcweir                 if ( aSeq[1] >>= aBorderLine )
1974*cdf0e10cSrcweir                 {
1975*cdf0e10cSrcweir                     sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
1976*cdf0e10cSrcweir 		            SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT );
1977*cdf0e10cSrcweir                 }
1978*cdf0e10cSrcweir                 else
1979*cdf0e10cSrcweir                     return sal_False;
1980*cdf0e10cSrcweir 
1981*cdf0e10cSrcweir                 if ( aSeq[2] >>= aBorderLine )
1982*cdf0e10cSrcweir                 {
1983*cdf0e10cSrcweir                     sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
1984*cdf0e10cSrcweir 		            SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM );
1985*cdf0e10cSrcweir                 }
1986*cdf0e10cSrcweir                 else
1987*cdf0e10cSrcweir                     return sal_False;
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir                 if ( aSeq[3] >>= aBorderLine )
1990*cdf0e10cSrcweir                 {
1991*cdf0e10cSrcweir                     sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
1992*cdf0e10cSrcweir 		            SetLine(bSet ? &aLine : 0, BOX_LINE_TOP );
1993*cdf0e10cSrcweir                 }
1994*cdf0e10cSrcweir                 else
1995*cdf0e10cSrcweir                     return sal_False;
1996*cdf0e10cSrcweir 
1997*cdf0e10cSrcweir                 sal_uInt16 nLines[4] = { BOX_LINE_TOP, BOX_LINE_BOTTOM, BOX_LINE_LEFT, BOX_LINE_RIGHT };
1998*cdf0e10cSrcweir                 for ( sal_Int32 n = 4; n < 9; n++ )
1999*cdf0e10cSrcweir                 {
2000*cdf0e10cSrcweir                     if ( aSeq[n] >>= nDist )
2001*cdf0e10cSrcweir                     {
2002*cdf0e10cSrcweir 			            if( bConvert )
2003*cdf0e10cSrcweir 				            nDist = MM100_TO_TWIP(nDist);
2004*cdf0e10cSrcweir 				        if ( n == 4 )
2005*cdf0e10cSrcweir                             SetDistance( sal_uInt16( nDist ));
2006*cdf0e10cSrcweir                         else
2007*cdf0e10cSrcweir                             SetDistance( sal_uInt16( nDist ), nLines[n-5] );
2008*cdf0e10cSrcweir                     }
2009*cdf0e10cSrcweir                     else
2010*cdf0e10cSrcweir                         return sal_False;
2011*cdf0e10cSrcweir                 }
2012*cdf0e10cSrcweir 
2013*cdf0e10cSrcweir                 return sal_True;
2014*cdf0e10cSrcweir             }
2015*cdf0e10cSrcweir             else
2016*cdf0e10cSrcweir                 return sal_False;
2017*cdf0e10cSrcweir         }
2018*cdf0e10cSrcweir         case LEFT_BORDER_DISTANCE:
2019*cdf0e10cSrcweir 			bDistMember = sal_True;
2020*cdf0e10cSrcweir 		case LEFT_BORDER:
2021*cdf0e10cSrcweir         case MID_LEFT_BORDER:
2022*cdf0e10cSrcweir 			nLine = BOX_LINE_LEFT;
2023*cdf0e10cSrcweir 			break;
2024*cdf0e10cSrcweir 		case RIGHT_BORDER_DISTANCE:
2025*cdf0e10cSrcweir 			bDistMember = sal_True;
2026*cdf0e10cSrcweir 		case RIGHT_BORDER:
2027*cdf0e10cSrcweir         case MID_RIGHT_BORDER:
2028*cdf0e10cSrcweir 			nLine = BOX_LINE_RIGHT;
2029*cdf0e10cSrcweir 			break;
2030*cdf0e10cSrcweir 		case BOTTOM_BORDER_DISTANCE:
2031*cdf0e10cSrcweir 			bDistMember = sal_True;
2032*cdf0e10cSrcweir 		case BOTTOM_BORDER:
2033*cdf0e10cSrcweir         case MID_BOTTOM_BORDER:
2034*cdf0e10cSrcweir 			nLine = BOX_LINE_BOTTOM;
2035*cdf0e10cSrcweir 			break;
2036*cdf0e10cSrcweir 		case TOP_BORDER_DISTANCE:
2037*cdf0e10cSrcweir 			bDistMember = sal_True;
2038*cdf0e10cSrcweir 		case TOP_BORDER:
2039*cdf0e10cSrcweir         case MID_TOP_BORDER:
2040*cdf0e10cSrcweir 			nLine = BOX_LINE_TOP;
2041*cdf0e10cSrcweir 			break;
2042*cdf0e10cSrcweir 	}
2043*cdf0e10cSrcweir 
2044*cdf0e10cSrcweir 	if( bDistMember || nMemberId == BORDER_DISTANCE )
2045*cdf0e10cSrcweir 	{
2046*cdf0e10cSrcweir 		sal_Int32 nDist = 0;
2047*cdf0e10cSrcweir 		if(!(rVal >>= nDist))
2048*cdf0e10cSrcweir 			return sal_False;
2049*cdf0e10cSrcweir 
2050*cdf0e10cSrcweir 		if(nDist >= 0)
2051*cdf0e10cSrcweir 		{
2052*cdf0e10cSrcweir 			if( bConvert )
2053*cdf0e10cSrcweir 				nDist = MM100_TO_TWIP(nDist);
2054*cdf0e10cSrcweir 			if( nMemberId == BORDER_DISTANCE )
2055*cdf0e10cSrcweir 				SetDistance( sal_uInt16( nDist ));
2056*cdf0e10cSrcweir 			else
2057*cdf0e10cSrcweir 				SetDistance( sal_uInt16( nDist ), nLine );
2058*cdf0e10cSrcweir 		}
2059*cdf0e10cSrcweir 	}
2060*cdf0e10cSrcweir 	else
2061*cdf0e10cSrcweir 	{
2062*cdf0e10cSrcweir 		SvxBorderLine aLine;
2063*cdf0e10cSrcweir         if( !rVal.hasValue() )
2064*cdf0e10cSrcweir 			return sal_False;
2065*cdf0e10cSrcweir 
2066*cdf0e10cSrcweir         table::BorderLine aBorderLine;
2067*cdf0e10cSrcweir         if( rVal >>= aBorderLine )
2068*cdf0e10cSrcweir         {
2069*cdf0e10cSrcweir             // usual struct
2070*cdf0e10cSrcweir         }
2071*cdf0e10cSrcweir         else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
2072*cdf0e10cSrcweir         {
2073*cdf0e10cSrcweir             // serialization for basic macro recording
2074*cdf0e10cSrcweir             uno::Reference < script::XTypeConverter > xConverter
2075*cdf0e10cSrcweir                     ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
2076*cdf0e10cSrcweir                     uno::UNO_QUERY );
2077*cdf0e10cSrcweir             uno::Sequence < uno::Any > aSeq;
2078*cdf0e10cSrcweir             uno::Any aNew;
2079*cdf0e10cSrcweir             try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); }
2080*cdf0e10cSrcweir             catch (uno::Exception&) {}
2081*cdf0e10cSrcweir 
2082*cdf0e10cSrcweir             aNew >>= aSeq;
2083*cdf0e10cSrcweir             if ( aSeq.getLength() == 4 )
2084*cdf0e10cSrcweir             {
2085*cdf0e10cSrcweir                 sal_Int32 nVal = 0;
2086*cdf0e10cSrcweir                 if ( aSeq[0] >>= nVal )
2087*cdf0e10cSrcweir                     aBorderLine.Color = nVal;
2088*cdf0e10cSrcweir                 if ( aSeq[1] >>= nVal )
2089*cdf0e10cSrcweir                     aBorderLine.InnerLineWidth = (sal_Int16) nVal;
2090*cdf0e10cSrcweir                 if ( aSeq[2] >>= nVal )
2091*cdf0e10cSrcweir                     aBorderLine.OuterLineWidth = (sal_Int16) nVal;
2092*cdf0e10cSrcweir                 if ( aSeq[3] >>= nVal )
2093*cdf0e10cSrcweir                     aBorderLine.LineDistance = (sal_Int16) nVal;
2094*cdf0e10cSrcweir             }
2095*cdf0e10cSrcweir             else
2096*cdf0e10cSrcweir                 return sal_False;
2097*cdf0e10cSrcweir         }
2098*cdf0e10cSrcweir         else
2099*cdf0e10cSrcweir             return sal_False;
2100*cdf0e10cSrcweir 
2101*cdf0e10cSrcweir         sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
2102*cdf0e10cSrcweir 		SetLine(bSet ? &aLine : 0, nLine);
2103*cdf0e10cSrcweir 	}
2104*cdf0e10cSrcweir 
2105*cdf0e10cSrcweir 	return sal_True;
2106*cdf0e10cSrcweir }
2107*cdf0e10cSrcweir 
2108*cdf0e10cSrcweir // -----------------------------------------------------------------------
2109*cdf0e10cSrcweir 
2110*cdf0e10cSrcweir SfxPoolItem* SvxBoxItem::Clone( SfxItemPool* ) const
2111*cdf0e10cSrcweir {
2112*cdf0e10cSrcweir 	return new SvxBoxItem( *this );
2113*cdf0e10cSrcweir }
2114*cdf0e10cSrcweir 
2115*cdf0e10cSrcweir //------------------------------------------------------------------------
2116*cdf0e10cSrcweir 
2117*cdf0e10cSrcweir SfxItemPresentation SvxBoxItem::GetPresentation
2118*cdf0e10cSrcweir (
2119*cdf0e10cSrcweir 	SfxItemPresentation ePres,
2120*cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
2121*cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
2122*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *pIntl
2123*cdf0e10cSrcweir )	const
2124*cdf0e10cSrcweir {
2125*cdf0e10cSrcweir #ifndef SVX_LIGHT
2126*cdf0e10cSrcweir 	switch ( ePres )
2127*cdf0e10cSrcweir 	{
2128*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
2129*cdf0e10cSrcweir 			rText.Erase();
2130*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
2131*cdf0e10cSrcweir 
2132*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
2133*cdf0e10cSrcweir 		{
2134*cdf0e10cSrcweir 			rText.Erase();
2135*cdf0e10cSrcweir 
2136*cdf0e10cSrcweir 			if ( pTop )
2137*cdf0e10cSrcweir 			{
2138*cdf0e10cSrcweir                 rText = pTop->GetValueString( eCoreUnit, ePresUnit, pIntl );
2139*cdf0e10cSrcweir 				rText += cpDelim;
2140*cdf0e10cSrcweir 			}
2141*cdf0e10cSrcweir 			if( !(pTop && pBottom && pLeft && pRight &&
2142*cdf0e10cSrcweir 				  *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight) )
2143*cdf0e10cSrcweir 			{
2144*cdf0e10cSrcweir 				if ( pBottom )
2145*cdf0e10cSrcweir 				{
2146*cdf0e10cSrcweir                     rText += pBottom->GetValueString( eCoreUnit, ePresUnit, pIntl );
2147*cdf0e10cSrcweir 					rText += cpDelim;
2148*cdf0e10cSrcweir 				}
2149*cdf0e10cSrcweir 				if ( pLeft )
2150*cdf0e10cSrcweir 				{
2151*cdf0e10cSrcweir                     rText += pLeft->GetValueString( eCoreUnit, ePresUnit, pIntl );
2152*cdf0e10cSrcweir 					rText += cpDelim;
2153*cdf0e10cSrcweir 				}
2154*cdf0e10cSrcweir 				if ( pRight )
2155*cdf0e10cSrcweir 				{
2156*cdf0e10cSrcweir                     rText += pRight->GetValueString( eCoreUnit, ePresUnit, pIntl );
2157*cdf0e10cSrcweir 					rText += cpDelim;
2158*cdf0e10cSrcweir 				}
2159*cdf0e10cSrcweir 			}
2160*cdf0e10cSrcweir             rText += GetMetricText( (long)nTopDist, eCoreUnit, ePresUnit, pIntl );
2161*cdf0e10cSrcweir 			if( nTopDist != nBottomDist || nTopDist != nLeftDist ||
2162*cdf0e10cSrcweir 				nTopDist != nRightDist )
2163*cdf0e10cSrcweir 			{
2164*cdf0e10cSrcweir 				(((((rText += cpDelim)
2165*cdf0e10cSrcweir 					  += GetMetricText( (long)nBottomDist, eCoreUnit,
2166*cdf0e10cSrcweir                                         ePresUnit, pIntl ))
2167*cdf0e10cSrcweir 					  += cpDelim)
2168*cdf0e10cSrcweir                       += GetMetricText( (long)nLeftDist, eCoreUnit, ePresUnit, pIntl ))
2169*cdf0e10cSrcweir 					  += cpDelim)
2170*cdf0e10cSrcweir 					  += GetMetricText( (long)nRightDist, eCoreUnit,
2171*cdf0e10cSrcweir                                         ePresUnit, pIntl );
2172*cdf0e10cSrcweir 			}
2173*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NAMELESS;
2174*cdf0e10cSrcweir 		}
2175*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
2176*cdf0e10cSrcweir 		{
2177*cdf0e10cSrcweir 			if( !(pTop || pBottom || pLeft || pRight) )
2178*cdf0e10cSrcweir 			{
2179*cdf0e10cSrcweir 				rText = EE_RESSTR(RID_SVXITEMS_BORDER_NONE);
2180*cdf0e10cSrcweir 				rText += cpDelim;
2181*cdf0e10cSrcweir 			}
2182*cdf0e10cSrcweir 			else
2183*cdf0e10cSrcweir 			{
2184*cdf0e10cSrcweir 				rText = EE_RESSTR(RID_SVXITEMS_BORDER_COMPLETE);
2185*cdf0e10cSrcweir 				if( pTop && pBottom && pLeft && pRight &&
2186*cdf0e10cSrcweir 					*pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight )
2187*cdf0e10cSrcweir 				{
2188*cdf0e10cSrcweir                     rText += pTop->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
2189*cdf0e10cSrcweir 					rText += cpDelim;
2190*cdf0e10cSrcweir 				}
2191*cdf0e10cSrcweir 				else
2192*cdf0e10cSrcweir 				{
2193*cdf0e10cSrcweir 					if ( pTop )
2194*cdf0e10cSrcweir 					{
2195*cdf0e10cSrcweir 						rText += EE_RESSTR(RID_SVXITEMS_BORDER_TOP);
2196*cdf0e10cSrcweir                         rText += pTop->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
2197*cdf0e10cSrcweir 						rText += cpDelim;
2198*cdf0e10cSrcweir 					}
2199*cdf0e10cSrcweir 					if ( pBottom )
2200*cdf0e10cSrcweir 					{
2201*cdf0e10cSrcweir 						rText += EE_RESSTR(RID_SVXITEMS_BORDER_BOTTOM);
2202*cdf0e10cSrcweir                         rText += pBottom->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
2203*cdf0e10cSrcweir 						rText += cpDelim;
2204*cdf0e10cSrcweir 					}
2205*cdf0e10cSrcweir 					if ( pLeft )
2206*cdf0e10cSrcweir 					{
2207*cdf0e10cSrcweir 						rText += EE_RESSTR(RID_SVXITEMS_BORDER_LEFT);
2208*cdf0e10cSrcweir                         rText += pLeft->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
2209*cdf0e10cSrcweir 						rText += cpDelim;
2210*cdf0e10cSrcweir 					}
2211*cdf0e10cSrcweir 					if ( pRight )
2212*cdf0e10cSrcweir 					{
2213*cdf0e10cSrcweir 						rText += EE_RESSTR(RID_SVXITEMS_BORDER_RIGHT);
2214*cdf0e10cSrcweir                         rText += pRight->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
2215*cdf0e10cSrcweir 						rText += cpDelim;
2216*cdf0e10cSrcweir 					}
2217*cdf0e10cSrcweir 				}
2218*cdf0e10cSrcweir 			}
2219*cdf0e10cSrcweir 
2220*cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_BORDER_DISTANCE);
2221*cdf0e10cSrcweir 			if( nTopDist == nBottomDist && nTopDist == nLeftDist &&
2222*cdf0e10cSrcweir 				nTopDist == nRightDist )
2223*cdf0e10cSrcweir 			{
2224*cdf0e10cSrcweir 				rText += GetMetricText( (long)nTopDist, eCoreUnit,
2225*cdf0e10cSrcweir                                             ePresUnit, pIntl );
2226*cdf0e10cSrcweir 				rText += EE_RESSTR(GetMetricId(ePresUnit));
2227*cdf0e10cSrcweir 			}
2228*cdf0e10cSrcweir 			else
2229*cdf0e10cSrcweir 			{
2230*cdf0e10cSrcweir 				(((rText += EE_RESSTR(RID_SVXITEMS_BORDER_TOP))
2231*cdf0e10cSrcweir 					  += GetMetricText( (long)nTopDist, eCoreUnit,
2232*cdf0e10cSrcweir                                         ePresUnit, pIntl ))
2233*cdf0e10cSrcweir 					  += EE_RESSTR(GetMetricId(ePresUnit)))
2234*cdf0e10cSrcweir 					  += cpDelim;
2235*cdf0e10cSrcweir 				(((rText += EE_RESSTR(RID_SVXITEMS_BORDER_BOTTOM))
2236*cdf0e10cSrcweir 					  += GetMetricText( (long)nBottomDist, eCoreUnit,
2237*cdf0e10cSrcweir                                         ePresUnit, pIntl ))
2238*cdf0e10cSrcweir 					  += EE_RESSTR(GetMetricId(ePresUnit)))
2239*cdf0e10cSrcweir 					  += cpDelim;
2240*cdf0e10cSrcweir 				(((rText += EE_RESSTR(RID_SVXITEMS_BORDER_LEFT))
2241*cdf0e10cSrcweir 					  += GetMetricText( (long)nLeftDist, eCoreUnit,
2242*cdf0e10cSrcweir                                         ePresUnit, pIntl ))
2243*cdf0e10cSrcweir 					  += EE_RESSTR(GetMetricId(ePresUnit)))
2244*cdf0e10cSrcweir 					  += cpDelim;
2245*cdf0e10cSrcweir 				((rText += EE_RESSTR(RID_SVXITEMS_BORDER_RIGHT))
2246*cdf0e10cSrcweir 					  += GetMetricText( (long)nRightDist, eCoreUnit,
2247*cdf0e10cSrcweir                                         ePresUnit, pIntl ))
2248*cdf0e10cSrcweir 					  += EE_RESSTR(GetMetricId(ePresUnit));
2249*cdf0e10cSrcweir 			}
2250*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
2251*cdf0e10cSrcweir 		}
2252*cdf0e10cSrcweir         default: ;//prevent warning
2253*cdf0e10cSrcweir     }
2254*cdf0e10cSrcweir #endif // !SVX_LIGHT
2255*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
2256*cdf0e10cSrcweir }
2257*cdf0e10cSrcweir 
2258*cdf0e10cSrcweir // -----------------------------------------------------------------------
2259*cdf0e10cSrcweir 
2260*cdf0e10cSrcweir SvStream& SvxBoxItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
2261*cdf0e10cSrcweir {
2262*cdf0e10cSrcweir 	rStrm << (sal_uInt16) GetDistance();
2263*cdf0e10cSrcweir 	const SvxBorderLine* pLine[ 4 ]; 	// top, left, right, bottom
2264*cdf0e10cSrcweir 	pLine[ 0 ] = GetTop();
2265*cdf0e10cSrcweir 	pLine[ 1 ] = GetLeft();
2266*cdf0e10cSrcweir 	pLine[ 2 ] = GetRight();
2267*cdf0e10cSrcweir 	pLine[ 3 ] = GetBottom();
2268*cdf0e10cSrcweir 
2269*cdf0e10cSrcweir 	for( int i = 0; i < 4; i++ )
2270*cdf0e10cSrcweir 	{
2271*cdf0e10cSrcweir 		const SvxBorderLine* l = pLine[ i ];
2272*cdf0e10cSrcweir 		if( l )
2273*cdf0e10cSrcweir 		{
2274*cdf0e10cSrcweir 			rStrm << (sal_Int8) i
2275*cdf0e10cSrcweir 				  << l->GetColor()
2276*cdf0e10cSrcweir 				  << (sal_uInt16) l->GetOutWidth()
2277*cdf0e10cSrcweir 				  << (sal_uInt16) l->GetInWidth()
2278*cdf0e10cSrcweir 				  << (sal_uInt16) l->GetDistance();
2279*cdf0e10cSrcweir 		}
2280*cdf0e10cSrcweir 	}
2281*cdf0e10cSrcweir 	sal_Int8 cLine = 4;
2282*cdf0e10cSrcweir 	if( nItemVersion >= BOX_4DISTS_VERSION &&
2283*cdf0e10cSrcweir 		!(nTopDist == nLeftDist &&
2284*cdf0e10cSrcweir 		  nTopDist == nRightDist &&
2285*cdf0e10cSrcweir 		  nTopDist == nBottomDist) )
2286*cdf0e10cSrcweir 	{
2287*cdf0e10cSrcweir 		cLine |= 0x10;
2288*cdf0e10cSrcweir 	}
2289*cdf0e10cSrcweir 
2290*cdf0e10cSrcweir 	rStrm << cLine;
2291*cdf0e10cSrcweir 
2292*cdf0e10cSrcweir 	if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 )
2293*cdf0e10cSrcweir 	{
2294*cdf0e10cSrcweir 		rStrm << (sal_uInt16)nTopDist
2295*cdf0e10cSrcweir 			  << (sal_uInt16)nLeftDist
2296*cdf0e10cSrcweir 			  << (sal_uInt16)nRightDist
2297*cdf0e10cSrcweir 			  << (sal_uInt16)nBottomDist;
2298*cdf0e10cSrcweir 	}
2299*cdf0e10cSrcweir 
2300*cdf0e10cSrcweir 	return rStrm;
2301*cdf0e10cSrcweir }
2302*cdf0e10cSrcweir 
2303*cdf0e10cSrcweir // -----------------------------------------------------------------------
2304*cdf0e10cSrcweir 
2305*cdf0e10cSrcweir sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const
2306*cdf0e10cSrcweir {
2307*cdf0e10cSrcweir 	DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
2308*cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_40==nFFVer ||
2309*cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_50==nFFVer,
2310*cdf0e10cSrcweir 			"SvxBoxItem: Gibt es ein neues Fileformat?" );
2311*cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_31==nFFVer ||
2312*cdf0e10cSrcweir 		   SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_4DISTS_VERSION;
2313*cdf0e10cSrcweir }
2314*cdf0e10cSrcweir 
2315*cdf0e10cSrcweir // -----------------------------------------------------------------------
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir int SvxBoxItem::ScaleMetrics( long nMult, long nDiv )
2318*cdf0e10cSrcweir {
2319*cdf0e10cSrcweir 	if ( pTop )		pTop->ScaleMetrics( nMult, nDiv );
2320*cdf0e10cSrcweir 	if ( pBottom )	pBottom->ScaleMetrics( nMult, nDiv );
2321*cdf0e10cSrcweir 	if ( pLeft )	pLeft->ScaleMetrics( nMult, nDiv );
2322*cdf0e10cSrcweir 	if ( pRight )	pBottom->ScaleMetrics( nMult, nDiv );
2323*cdf0e10cSrcweir 	nTopDist = (sal_uInt16)Scale( nTopDist, nMult, nDiv );
2324*cdf0e10cSrcweir 	nBottomDist = (sal_uInt16)Scale( nBottomDist, nMult, nDiv );
2325*cdf0e10cSrcweir 	nLeftDist = (sal_uInt16)Scale( nLeftDist, nMult, nDiv );
2326*cdf0e10cSrcweir 	nRightDist = (sal_uInt16)Scale( nRightDist, nMult, nDiv );
2327*cdf0e10cSrcweir 	return 1;
2328*cdf0e10cSrcweir }
2329*cdf0e10cSrcweir 
2330*cdf0e10cSrcweir // -----------------------------------------------------------------------
2331*cdf0e10cSrcweir 
2332*cdf0e10cSrcweir int SvxBoxItem::HasMetrics() const
2333*cdf0e10cSrcweir {
2334*cdf0e10cSrcweir 	return 1;
2335*cdf0e10cSrcweir }
2336*cdf0e10cSrcweir 
2337*cdf0e10cSrcweir // -----------------------------------------------------------------------
2338*cdf0e10cSrcweir 
2339*cdf0e10cSrcweir SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const
2340*cdf0e10cSrcweir {
2341*cdf0e10cSrcweir 	sal_uInt16 nDistance;
2342*cdf0e10cSrcweir 	rStrm >> nDistance;
2343*cdf0e10cSrcweir 	SvxBoxItem* pAttr = new SvxBoxItem( Which() );
2344*cdf0e10cSrcweir 
2345*cdf0e10cSrcweir 	sal_uInt16 aLineMap[4] = { BOX_LINE_TOP, BOX_LINE_LEFT,
2346*cdf0e10cSrcweir 						   BOX_LINE_RIGHT, BOX_LINE_BOTTOM };
2347*cdf0e10cSrcweir 
2348*cdf0e10cSrcweir 	sal_Int8 cLine;
2349*cdf0e10cSrcweir 	while( sal_True )
2350*cdf0e10cSrcweir 	{
2351*cdf0e10cSrcweir 		rStrm >> cLine;
2352*cdf0e10cSrcweir 
2353*cdf0e10cSrcweir 		if( cLine > 3 )
2354*cdf0e10cSrcweir 			break;
2355*cdf0e10cSrcweir         sal_uInt16 nOutline, nInline, _nDistance;
2356*cdf0e10cSrcweir 		Color aColor;
2357*cdf0e10cSrcweir         rStrm >> aColor >> nOutline >> nInline >> _nDistance;
2358*cdf0e10cSrcweir         SvxBorderLine aBorder( &aColor, nOutline, nInline, _nDistance );
2359*cdf0e10cSrcweir 
2360*cdf0e10cSrcweir 		pAttr->SetLine( &aBorder, aLineMap[cLine] );
2361*cdf0e10cSrcweir 	}
2362*cdf0e10cSrcweir 
2363*cdf0e10cSrcweir 	if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 )
2364*cdf0e10cSrcweir 	{
2365*cdf0e10cSrcweir 		for( sal_uInt16 i=0; i < 4; i++ )
2366*cdf0e10cSrcweir 		{
2367*cdf0e10cSrcweir 			sal_uInt16 nDist;
2368*cdf0e10cSrcweir 			rStrm >> nDist;
2369*cdf0e10cSrcweir 			pAttr->SetDistance( nDist, aLineMap[i] );
2370*cdf0e10cSrcweir 		}
2371*cdf0e10cSrcweir 	}
2372*cdf0e10cSrcweir 	else
2373*cdf0e10cSrcweir 	{
2374*cdf0e10cSrcweir 		pAttr->SetDistance( nDistance );
2375*cdf0e10cSrcweir 	}
2376*cdf0e10cSrcweir 
2377*cdf0e10cSrcweir 	return pAttr;
2378*cdf0e10cSrcweir }
2379*cdf0e10cSrcweir 
2380*cdf0e10cSrcweir // -----------------------------------------------------------------------
2381*cdf0e10cSrcweir 
2382*cdf0e10cSrcweir const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const
2383*cdf0e10cSrcweir {
2384*cdf0e10cSrcweir 	const SvxBorderLine *pRet = 0;
2385*cdf0e10cSrcweir 
2386*cdf0e10cSrcweir 	switch ( nLine )
2387*cdf0e10cSrcweir 	{
2388*cdf0e10cSrcweir 		case BOX_LINE_TOP:
2389*cdf0e10cSrcweir 			pRet = pTop;
2390*cdf0e10cSrcweir 			break;
2391*cdf0e10cSrcweir 		case BOX_LINE_BOTTOM:
2392*cdf0e10cSrcweir 			pRet = pBottom;
2393*cdf0e10cSrcweir 			break;
2394*cdf0e10cSrcweir 		case BOX_LINE_LEFT:
2395*cdf0e10cSrcweir 			pRet = pLeft;
2396*cdf0e10cSrcweir 			break;
2397*cdf0e10cSrcweir 		case BOX_LINE_RIGHT:
2398*cdf0e10cSrcweir 			pRet = pRight;
2399*cdf0e10cSrcweir 			break;
2400*cdf0e10cSrcweir 		default:
2401*cdf0e10cSrcweir 			DBG_ERROR( "wrong line" );
2402*cdf0e10cSrcweir 			break;
2403*cdf0e10cSrcweir 	}
2404*cdf0e10cSrcweir 
2405*cdf0e10cSrcweir 	return pRet;
2406*cdf0e10cSrcweir }
2407*cdf0e10cSrcweir 
2408*cdf0e10cSrcweir // -----------------------------------------------------------------------
2409*cdf0e10cSrcweir 
2410*cdf0e10cSrcweir void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
2411*cdf0e10cSrcweir {
2412*cdf0e10cSrcweir 	SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0;
2413*cdf0e10cSrcweir 
2414*cdf0e10cSrcweir 	switch ( nLine )
2415*cdf0e10cSrcweir 	{
2416*cdf0e10cSrcweir 		case BOX_LINE_TOP:
2417*cdf0e10cSrcweir 			delete pTop;
2418*cdf0e10cSrcweir 			pTop = pTmp;
2419*cdf0e10cSrcweir 			break;
2420*cdf0e10cSrcweir 		case BOX_LINE_BOTTOM:
2421*cdf0e10cSrcweir 			delete pBottom;
2422*cdf0e10cSrcweir 			pBottom = pTmp;
2423*cdf0e10cSrcweir 			break;
2424*cdf0e10cSrcweir 		case BOX_LINE_LEFT:
2425*cdf0e10cSrcweir 			delete pLeft;
2426*cdf0e10cSrcweir 			pLeft = pTmp;
2427*cdf0e10cSrcweir 			break;
2428*cdf0e10cSrcweir 		case BOX_LINE_RIGHT:
2429*cdf0e10cSrcweir 			delete pRight;
2430*cdf0e10cSrcweir 			pRight = pTmp;
2431*cdf0e10cSrcweir 			break;
2432*cdf0e10cSrcweir 		default:
2433*cdf0e10cSrcweir 			DBG_ERROR( "wrong line" );
2434*cdf0e10cSrcweir 	}
2435*cdf0e10cSrcweir }
2436*cdf0e10cSrcweir 
2437*cdf0e10cSrcweir // -----------------------------------------------------------------------
2438*cdf0e10cSrcweir 
2439*cdf0e10cSrcweir sal_uInt16 SvxBoxItem::GetDistance() const
2440*cdf0e10cSrcweir {
2441*cdf0e10cSrcweir 	// The smallest distance that is not 0 will be returned.
2442*cdf0e10cSrcweir 	sal_uInt16 nDist = nTopDist;
2443*cdf0e10cSrcweir 	if( nBottomDist && (!nDist || nBottomDist < nDist) )
2444*cdf0e10cSrcweir 		nDist = nBottomDist;
2445*cdf0e10cSrcweir 	if( nLeftDist && (!nDist || nLeftDist < nDist) )
2446*cdf0e10cSrcweir 		nDist = nLeftDist;
2447*cdf0e10cSrcweir 	if( nRightDist && (!nDist || nRightDist < nDist) )
2448*cdf0e10cSrcweir 		nDist = nRightDist;
2449*cdf0e10cSrcweir 
2450*cdf0e10cSrcweir 	return nDist;
2451*cdf0e10cSrcweir }
2452*cdf0e10cSrcweir 
2453*cdf0e10cSrcweir // -----------------------------------------------------------------------
2454*cdf0e10cSrcweir 
2455*cdf0e10cSrcweir sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const
2456*cdf0e10cSrcweir {
2457*cdf0e10cSrcweir 	sal_uInt16 nDist = 0;
2458*cdf0e10cSrcweir 	switch ( nLine )
2459*cdf0e10cSrcweir 	{
2460*cdf0e10cSrcweir 		case BOX_LINE_TOP:
2461*cdf0e10cSrcweir 			nDist = nTopDist;
2462*cdf0e10cSrcweir 			break;
2463*cdf0e10cSrcweir 		case BOX_LINE_BOTTOM:
2464*cdf0e10cSrcweir 			nDist = nBottomDist;
2465*cdf0e10cSrcweir 			break;
2466*cdf0e10cSrcweir 		case BOX_LINE_LEFT:
2467*cdf0e10cSrcweir 			nDist = nLeftDist;
2468*cdf0e10cSrcweir 			break;
2469*cdf0e10cSrcweir 		case BOX_LINE_RIGHT:
2470*cdf0e10cSrcweir 			nDist = nRightDist;
2471*cdf0e10cSrcweir 			break;
2472*cdf0e10cSrcweir 		default:
2473*cdf0e10cSrcweir 			DBG_ERROR( "wrong line" );
2474*cdf0e10cSrcweir 	}
2475*cdf0e10cSrcweir 
2476*cdf0e10cSrcweir 	return nDist;
2477*cdf0e10cSrcweir }
2478*cdf0e10cSrcweir 
2479*cdf0e10cSrcweir // -----------------------------------------------------------------------
2480*cdf0e10cSrcweir 
2481*cdf0e10cSrcweir void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine )
2482*cdf0e10cSrcweir {
2483*cdf0e10cSrcweir 	switch ( nLine )
2484*cdf0e10cSrcweir 	{
2485*cdf0e10cSrcweir 		case BOX_LINE_TOP:
2486*cdf0e10cSrcweir 			nTopDist = nNew;
2487*cdf0e10cSrcweir 			break;
2488*cdf0e10cSrcweir 		case BOX_LINE_BOTTOM:
2489*cdf0e10cSrcweir 			nBottomDist = nNew;
2490*cdf0e10cSrcweir 			break;
2491*cdf0e10cSrcweir 		case BOX_LINE_LEFT:
2492*cdf0e10cSrcweir 			nLeftDist = nNew;
2493*cdf0e10cSrcweir 			break;
2494*cdf0e10cSrcweir 		case BOX_LINE_RIGHT:
2495*cdf0e10cSrcweir 			nRightDist = nNew;
2496*cdf0e10cSrcweir 			break;
2497*cdf0e10cSrcweir 		default:
2498*cdf0e10cSrcweir 			DBG_ERROR( "wrong line" );
2499*cdf0e10cSrcweir 	}
2500*cdf0e10cSrcweir }
2501*cdf0e10cSrcweir 
2502*cdf0e10cSrcweir // -----------------------------------------------------------------------
2503*cdf0e10cSrcweir 
2504*cdf0e10cSrcweir sal_uInt16 SvxBoxItem::CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine ) const
2505*cdf0e10cSrcweir {
2506*cdf0e10cSrcweir 	SvxBorderLine* pTmp = 0;
2507*cdf0e10cSrcweir 	sal_uInt16 nDist = 0;
2508*cdf0e10cSrcweir 	switch ( nLine )
2509*cdf0e10cSrcweir 	{
2510*cdf0e10cSrcweir 	case BOX_LINE_TOP:
2511*cdf0e10cSrcweir 		pTmp = pTop;
2512*cdf0e10cSrcweir 		nDist = nTopDist;
2513*cdf0e10cSrcweir 		break;
2514*cdf0e10cSrcweir 	case BOX_LINE_BOTTOM:
2515*cdf0e10cSrcweir 		pTmp = pBottom;
2516*cdf0e10cSrcweir 		nDist = nBottomDist;
2517*cdf0e10cSrcweir 		break;
2518*cdf0e10cSrcweir 	case BOX_LINE_LEFT:
2519*cdf0e10cSrcweir 		pTmp = pLeft;
2520*cdf0e10cSrcweir 		nDist = nLeftDist;
2521*cdf0e10cSrcweir 		break;
2522*cdf0e10cSrcweir 	case BOX_LINE_RIGHT:
2523*cdf0e10cSrcweir 		pTmp = pRight;
2524*cdf0e10cSrcweir 		nDist = nRightDist;
2525*cdf0e10cSrcweir 		break;
2526*cdf0e10cSrcweir 	default:
2527*cdf0e10cSrcweir 		DBG_ERROR( "wrong line" );
2528*cdf0e10cSrcweir 	}
2529*cdf0e10cSrcweir 
2530*cdf0e10cSrcweir 	if( pTmp )
2531*cdf0e10cSrcweir 	{
2532*cdf0e10cSrcweir 		nDist = nDist + (sal_uInt16)(pTmp->GetOutWidth()) + (sal_uInt16)(pTmp->GetInWidth()) + (sal_uInt16)(pTmp->GetDistance());
2533*cdf0e10cSrcweir 	}
2534*cdf0e10cSrcweir 	else if( !bIgnoreLine )
2535*cdf0e10cSrcweir 		nDist = 0;
2536*cdf0e10cSrcweir 	return nDist;
2537*cdf0e10cSrcweir }
2538*cdf0e10cSrcweir 
2539*cdf0e10cSrcweir // class SvxBoxInfoItem --------------------------------------------------
2540*cdf0e10cSrcweir 
2541*cdf0e10cSrcweir SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) :
2542*cdf0e10cSrcweir 	SfxPoolItem( nId ),
2543*cdf0e10cSrcweir 	pHori	( 0 ),
2544*cdf0e10cSrcweir 	pVert	( 0 ),
2545*cdf0e10cSrcweir     mbEnableHor( false ),
2546*cdf0e10cSrcweir     mbEnableVer( false ),
2547*cdf0e10cSrcweir     nDefDist( 0 )
2548*cdf0e10cSrcweir {
2549*cdf0e10cSrcweir     bDist = bMinDist = sal_False;
2550*cdf0e10cSrcweir 	ResetFlags();
2551*cdf0e10cSrcweir }
2552*cdf0e10cSrcweir 
2553*cdf0e10cSrcweir // -----------------------------------------------------------------------
2554*cdf0e10cSrcweir 
2555*cdf0e10cSrcweir SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) :
2556*cdf0e10cSrcweir     SfxPoolItem( rCpy ),
2557*cdf0e10cSrcweir     mbEnableHor( rCpy.mbEnableHor ),
2558*cdf0e10cSrcweir     mbEnableVer( rCpy.mbEnableVer )
2559*cdf0e10cSrcweir {
2560*cdf0e10cSrcweir 	pHori 		= rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 0;
2561*cdf0e10cSrcweir 	pVert 		= rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 0;
2562*cdf0e10cSrcweir 	bDist    	= rCpy.IsDist();
2563*cdf0e10cSrcweir 	bMinDist 	= rCpy.IsMinDist();
2564*cdf0e10cSrcweir 	nValidFlags = rCpy.nValidFlags;
2565*cdf0e10cSrcweir 	nDefDist 	= rCpy.GetDefDist();
2566*cdf0e10cSrcweir }
2567*cdf0e10cSrcweir 
2568*cdf0e10cSrcweir // -----------------------------------------------------------------------
2569*cdf0e10cSrcweir 
2570*cdf0e10cSrcweir SvxBoxInfoItem::~SvxBoxInfoItem()
2571*cdf0e10cSrcweir {
2572*cdf0e10cSrcweir 	delete pHori;
2573*cdf0e10cSrcweir 	delete pVert;
2574*cdf0e10cSrcweir }
2575*cdf0e10cSrcweir 
2576*cdf0e10cSrcweir // -----------------------------------------------------------------------
2577*cdf0e10cSrcweir 
2578*cdf0e10cSrcweir SvxBoxInfoItem &SvxBoxInfoItem::operator=( const SvxBoxInfoItem& rCpy )
2579*cdf0e10cSrcweir {
2580*cdf0e10cSrcweir 	delete pHori;
2581*cdf0e10cSrcweir 	delete pVert;
2582*cdf0e10cSrcweir 	pHori 		= rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 0;
2583*cdf0e10cSrcweir 	pVert 		= rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 0;
2584*cdf0e10cSrcweir     mbEnableHor = rCpy.mbEnableHor;
2585*cdf0e10cSrcweir     mbEnableVer = rCpy.mbEnableVer;
2586*cdf0e10cSrcweir 	bDist    	= rCpy.IsDist();
2587*cdf0e10cSrcweir 	bMinDist 	= rCpy.IsMinDist();
2588*cdf0e10cSrcweir 	nValidFlags = rCpy.nValidFlags;
2589*cdf0e10cSrcweir 	nDefDist 	= rCpy.GetDefDist();
2590*cdf0e10cSrcweir 	return *this;
2591*cdf0e10cSrcweir }
2592*cdf0e10cSrcweir 
2593*cdf0e10cSrcweir // -----------------------------------------------------------------------
2594*cdf0e10cSrcweir 
2595*cdf0e10cSrcweir int SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const
2596*cdf0e10cSrcweir {
2597*cdf0e10cSrcweir 	SvxBoxInfoItem& rBoxInfo = (SvxBoxInfoItem&)rAttr;
2598*cdf0e10cSrcweir 
2599*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
2600*cdf0e10cSrcweir 
2601*cdf0e10cSrcweir     return (   mbEnableHor               == rBoxInfo.mbEnableHor
2602*cdf0e10cSrcweir             && mbEnableVer               == rBoxInfo.mbEnableVer
2603*cdf0e10cSrcweir 			&& bDist			 		 == rBoxInfo.IsDist()
2604*cdf0e10cSrcweir 			&& bMinDist 		 		 == rBoxInfo.IsMinDist()
2605*cdf0e10cSrcweir 			&& nValidFlags				 == rBoxInfo.nValidFlags
2606*cdf0e10cSrcweir 			&& nDefDist 		 		 == rBoxInfo.GetDefDist()
2607*cdf0e10cSrcweir 			&& CmpBrdLn( pHori, rBoxInfo.GetHori() )
2608*cdf0e10cSrcweir 			&& CmpBrdLn( pVert, rBoxInfo.GetVert() )
2609*cdf0e10cSrcweir 		   );
2610*cdf0e10cSrcweir }
2611*cdf0e10cSrcweir 
2612*cdf0e10cSrcweir // -----------------------------------------------------------------------
2613*cdf0e10cSrcweir 
2614*cdf0e10cSrcweir void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
2615*cdf0e10cSrcweir {
2616*cdf0e10cSrcweir 	SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0;
2617*cdf0e10cSrcweir 
2618*cdf0e10cSrcweir 	if ( BOXINFO_LINE_HORI == nLine )
2619*cdf0e10cSrcweir 	{
2620*cdf0e10cSrcweir 		delete pHori;
2621*cdf0e10cSrcweir 		pHori = pTmp;
2622*cdf0e10cSrcweir 	}
2623*cdf0e10cSrcweir 	else if ( BOXINFO_LINE_VERT == nLine )
2624*cdf0e10cSrcweir 	{
2625*cdf0e10cSrcweir 		delete pVert;
2626*cdf0e10cSrcweir 		pVert = pTmp;
2627*cdf0e10cSrcweir 	}
2628*cdf0e10cSrcweir 	else
2629*cdf0e10cSrcweir 	{
2630*cdf0e10cSrcweir 		DBG_ERROR( "wrong line" );
2631*cdf0e10cSrcweir 	}
2632*cdf0e10cSrcweir }
2633*cdf0e10cSrcweir 
2634*cdf0e10cSrcweir 
2635*cdf0e10cSrcweir // -----------------------------------------------------------------------
2636*cdf0e10cSrcweir 
2637*cdf0e10cSrcweir SfxPoolItem* SvxBoxInfoItem::Clone( SfxItemPool* ) const
2638*cdf0e10cSrcweir {
2639*cdf0e10cSrcweir 	return new SvxBoxInfoItem( *this );
2640*cdf0e10cSrcweir }
2641*cdf0e10cSrcweir 
2642*cdf0e10cSrcweir //------------------------------------------------------------------------
2643*cdf0e10cSrcweir 
2644*cdf0e10cSrcweir SfxItemPresentation SvxBoxInfoItem::GetPresentation
2645*cdf0e10cSrcweir (
2646*cdf0e10cSrcweir     SfxItemPresentation /*ePres*/,
2647*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
2648*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
2649*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
2650*cdf0e10cSrcweir )   const
2651*cdf0e10cSrcweir {
2652*cdf0e10cSrcweir #ifndef SVX_LIGHT
2653*cdf0e10cSrcweir /*!!!
2654*cdf0e10cSrcweir 	ResMgr* pMgr = DIALOG_MGR();
2655*cdf0e10cSrcweir 	if ( pHori )
2656*cdf0e10cSrcweir 	{
2657*cdf0e10cSrcweir 		rText += pHori->GetValueString();
2658*cdf0e10cSrcweir 		rText += cpDelim;
2659*cdf0e10cSrcweir 	}
2660*cdf0e10cSrcweir 	if ( pVert )
2661*cdf0e10cSrcweir 	{
2662*cdf0e10cSrcweir 		rText += pVert->GetValueString();
2663*cdf0e10cSrcweir 		rText += cpDelim;
2664*cdf0e10cSrcweir 	}
2665*cdf0e10cSrcweir 	if ( bTable )
2666*cdf0e10cSrcweir 		rText += String( ResId( RID_SVXITEMS_BOXINF_TABLE_TRUE, pMgr ) );
2667*cdf0e10cSrcweir 	else
2668*cdf0e10cSrcweir 		rText += String( ResId( RID_SVXITEMS_BOXINF_TABLE_FALSE, pMgr ) );
2669*cdf0e10cSrcweir 	rText += cpDelim;
2670*cdf0e10cSrcweir 	if ( bDist )
2671*cdf0e10cSrcweir 		rText += String( ResId( RID_SVXITEMS_BOXINF_DIST_TRUE, pMgr ) );
2672*cdf0e10cSrcweir 	else
2673*cdf0e10cSrcweir 		rText += String( ResId( RID_SVXITEMS_BOXINF_DIST_FALSE, pMgr ) );
2674*cdf0e10cSrcweir 	rText += cpDelim;
2675*cdf0e10cSrcweir 	if ( bMinDist )
2676*cdf0e10cSrcweir 		rText += String( ResId( RID_SVXITEMS_BOXINF_MDIST_TRUE, pMgr ) );
2677*cdf0e10cSrcweir 	else
2678*cdf0e10cSrcweir 		rText += String( ResId( RID_SVXITEMS_BOXINF_MDIST_FALSE, pMgr ) );
2679*cdf0e10cSrcweir 	rText += cpDelim;
2680*cdf0e10cSrcweir 	rText += nDefDist;
2681*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NAMELESS;
2682*cdf0e10cSrcweir */
2683*cdf0e10cSrcweir 	rText.Erase();
2684*cdf0e10cSrcweir #endif // !SVX_LIGHT
2685*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
2686*cdf0e10cSrcweir }
2687*cdf0e10cSrcweir 
2688*cdf0e10cSrcweir // -----------------------------------------------------------------------
2689*cdf0e10cSrcweir 
2690*cdf0e10cSrcweir SvStream& SvxBoxInfoItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2691*cdf0e10cSrcweir {
2692*cdf0e10cSrcweir 	sal_Int8 cFlags = 0;
2693*cdf0e10cSrcweir 
2694*cdf0e10cSrcweir 	if ( IsTable() )
2695*cdf0e10cSrcweir 		cFlags |= 0x01;
2696*cdf0e10cSrcweir 	if ( IsDist() )
2697*cdf0e10cSrcweir 		cFlags |= 0x02;
2698*cdf0e10cSrcweir 	if ( IsMinDist() )
2699*cdf0e10cSrcweir 		cFlags |= 0x04;
2700*cdf0e10cSrcweir 	rStrm << (sal_Int8)   cFlags
2701*cdf0e10cSrcweir 		  << (sal_uInt16) GetDefDist();
2702*cdf0e10cSrcweir 	const SvxBorderLine* pLine[ 2 ];
2703*cdf0e10cSrcweir 	pLine[ 0 ] = GetHori();
2704*cdf0e10cSrcweir 	pLine[ 1 ] = GetVert();
2705*cdf0e10cSrcweir 
2706*cdf0e10cSrcweir 	for( int i = 0; i < 2; i++ )
2707*cdf0e10cSrcweir 	{
2708*cdf0e10cSrcweir 		const SvxBorderLine* l = pLine[ i ];
2709*cdf0e10cSrcweir 		if( l )
2710*cdf0e10cSrcweir 		{
2711*cdf0e10cSrcweir 			rStrm << (char) i
2712*cdf0e10cSrcweir 				  << l->GetColor()
2713*cdf0e10cSrcweir 				  << (short) l->GetOutWidth()
2714*cdf0e10cSrcweir 				  << (short) l->GetInWidth()
2715*cdf0e10cSrcweir 				  << (short) l->GetDistance();
2716*cdf0e10cSrcweir 		}
2717*cdf0e10cSrcweir 	}
2718*cdf0e10cSrcweir 	rStrm << (char) 2;
2719*cdf0e10cSrcweir 	return rStrm;
2720*cdf0e10cSrcweir }
2721*cdf0e10cSrcweir 
2722*cdf0e10cSrcweir // -----------------------------------------------------------------------
2723*cdf0e10cSrcweir 
2724*cdf0e10cSrcweir int SvxBoxInfoItem::ScaleMetrics( long nMult, long nDiv )
2725*cdf0e10cSrcweir {
2726*cdf0e10cSrcweir 	if ( pHori ) pHori->ScaleMetrics( nMult, nDiv );
2727*cdf0e10cSrcweir 	if ( pVert ) pVert->ScaleMetrics( nMult, nDiv );
2728*cdf0e10cSrcweir 	nDefDist = (sal_uInt16)Scale( nDefDist, nMult, nDiv );
2729*cdf0e10cSrcweir 	return 1;
2730*cdf0e10cSrcweir }
2731*cdf0e10cSrcweir 
2732*cdf0e10cSrcweir // -----------------------------------------------------------------------
2733*cdf0e10cSrcweir 
2734*cdf0e10cSrcweir int SvxBoxInfoItem::HasMetrics() const
2735*cdf0e10cSrcweir {
2736*cdf0e10cSrcweir 	return 1;
2737*cdf0e10cSrcweir }
2738*cdf0e10cSrcweir 
2739*cdf0e10cSrcweir // -----------------------------------------------------------------------
2740*cdf0e10cSrcweir 
2741*cdf0e10cSrcweir SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const
2742*cdf0e10cSrcweir {
2743*cdf0e10cSrcweir 	sal_Int8 cFlags;
2744*cdf0e10cSrcweir     sal_uInt16 _nDefDist;
2745*cdf0e10cSrcweir     rStrm >> cFlags >> _nDefDist;
2746*cdf0e10cSrcweir 
2747*cdf0e10cSrcweir 	SvxBoxInfoItem* pAttr = new SvxBoxInfoItem( Which() );
2748*cdf0e10cSrcweir 
2749*cdf0e10cSrcweir 	pAttr->SetTable  ( ( cFlags & 0x01 ) != 0 );
2750*cdf0e10cSrcweir 	pAttr->SetDist   ( ( cFlags & 0x02 ) != 0 );
2751*cdf0e10cSrcweir 	pAttr->SetMinDist( ( cFlags & 0x04 ) != 0 );
2752*cdf0e10cSrcweir     pAttr->SetDefDist( _nDefDist );
2753*cdf0e10cSrcweir 
2754*cdf0e10cSrcweir 	while( sal_True )
2755*cdf0e10cSrcweir 	{
2756*cdf0e10cSrcweir 		sal_Int8 cLine;
2757*cdf0e10cSrcweir 		rStrm >> cLine;
2758*cdf0e10cSrcweir 
2759*cdf0e10cSrcweir 		if( cLine > 1 )
2760*cdf0e10cSrcweir 			break;
2761*cdf0e10cSrcweir 		short nOutline, nInline, nDistance;
2762*cdf0e10cSrcweir 		Color aColor;
2763*cdf0e10cSrcweir 		rStrm >> aColor >> nOutline >> nInline >> nDistance;
2764*cdf0e10cSrcweir 		SvxBorderLine aBorder( &aColor, nOutline, nInline, nDistance );
2765*cdf0e10cSrcweir 
2766*cdf0e10cSrcweir 		switch( cLine )
2767*cdf0e10cSrcweir 		{
2768*cdf0e10cSrcweir 			case 0: pAttr->SetLine( &aBorder, BOXINFO_LINE_HORI ); break;
2769*cdf0e10cSrcweir 			case 1: pAttr->SetLine( &aBorder, BOXINFO_LINE_VERT ); break;
2770*cdf0e10cSrcweir 		}
2771*cdf0e10cSrcweir 	}
2772*cdf0e10cSrcweir 	return pAttr;
2773*cdf0e10cSrcweir }
2774*cdf0e10cSrcweir 
2775*cdf0e10cSrcweir // -----------------------------------------------------------------------
2776*cdf0e10cSrcweir 
2777*cdf0e10cSrcweir void SvxBoxInfoItem::ResetFlags()
2778*cdf0e10cSrcweir {
2779*cdf0e10cSrcweir 	nValidFlags = 0x7F;	// alles g"ultig au/ser Disable
2780*cdf0e10cSrcweir }
2781*cdf0e10cSrcweir 
2782*cdf0e10cSrcweir sal_Bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId  ) const
2783*cdf0e10cSrcweir {
2784*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2785*cdf0e10cSrcweir 	table::BorderLine aRetLine;
2786*cdf0e10cSrcweir     sal_Int16 nVal=0;
2787*cdf0e10cSrcweir     sal_Bool bIntMember = sal_False;
2788*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
2789*cdf0e10cSrcweir     sal_Bool bSerialize = sal_False;
2790*cdf0e10cSrcweir 	switch(nMemberId)
2791*cdf0e10cSrcweir 	{
2792*cdf0e10cSrcweir         case 0:
2793*cdf0e10cSrcweir         {
2794*cdf0e10cSrcweir             // 2 BorderLines, flags, valid flags and distance
2795*cdf0e10cSrcweir             ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 5 );
2796*cdf0e10cSrcweir             aSeq[0] = ::com::sun::star::uno::makeAny( SvxBoxItem::SvxLineToLine( pHori, bConvert) );
2797*cdf0e10cSrcweir             aSeq[1] = ::com::sun::star::uno::makeAny( SvxBoxItem::SvxLineToLine( pVert, bConvert) );
2798*cdf0e10cSrcweir             if ( IsTable() )
2799*cdf0e10cSrcweir                 nVal |= 0x01;
2800*cdf0e10cSrcweir             if ( IsDist() )
2801*cdf0e10cSrcweir                 nVal |= 0x02;
2802*cdf0e10cSrcweir             if ( IsMinDist() )
2803*cdf0e10cSrcweir                 nVal |= 0x04;
2804*cdf0e10cSrcweir             aSeq[2] = ::com::sun::star::uno::makeAny( nVal );
2805*cdf0e10cSrcweir             nVal = nValidFlags;
2806*cdf0e10cSrcweir             aSeq[3] = ::com::sun::star::uno::makeAny( nVal );
2807*cdf0e10cSrcweir             aSeq[4] = ::com::sun::star::uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()) );
2808*cdf0e10cSrcweir             rVal = ::com::sun::star::uno::makeAny( aSeq );
2809*cdf0e10cSrcweir             return sal_True;
2810*cdf0e10cSrcweir         }
2811*cdf0e10cSrcweir 
2812*cdf0e10cSrcweir         case MID_HORIZONTAL:
2813*cdf0e10cSrcweir             bSerialize = sal_True;
2814*cdf0e10cSrcweir             aRetLine = SvxBoxItem::SvxLineToLine( pHori, bConvert);
2815*cdf0e10cSrcweir 			break;
2816*cdf0e10cSrcweir         case MID_VERTICAL:
2817*cdf0e10cSrcweir             bSerialize = sal_True;
2818*cdf0e10cSrcweir             aRetLine = SvxBoxItem::SvxLineToLine( pVert, bConvert);
2819*cdf0e10cSrcweir 			break;
2820*cdf0e10cSrcweir         case MID_FLAGS:
2821*cdf0e10cSrcweir             bIntMember = sal_True;
2822*cdf0e10cSrcweir             if ( IsTable() )
2823*cdf0e10cSrcweir                 nVal |= 0x01;
2824*cdf0e10cSrcweir             if ( IsDist() )
2825*cdf0e10cSrcweir                 nVal |= 0x02;
2826*cdf0e10cSrcweir             if ( IsMinDist() )
2827*cdf0e10cSrcweir                 nVal |= 0x04;
2828*cdf0e10cSrcweir             rVal <<= nVal;
2829*cdf0e10cSrcweir             break;
2830*cdf0e10cSrcweir         case MID_VALIDFLAGS:
2831*cdf0e10cSrcweir             bIntMember = sal_True;
2832*cdf0e10cSrcweir             nVal = nValidFlags;
2833*cdf0e10cSrcweir             rVal <<= nVal;
2834*cdf0e10cSrcweir             break;
2835*cdf0e10cSrcweir         case MID_DISTANCE:
2836*cdf0e10cSrcweir             bIntMember = sal_True;
2837*cdf0e10cSrcweir             rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist());
2838*cdf0e10cSrcweir             break;
2839*cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
2840*cdf0e10cSrcweir 	}
2841*cdf0e10cSrcweir 
2842*cdf0e10cSrcweir     if( !bIntMember )
2843*cdf0e10cSrcweir     {
2844*cdf0e10cSrcweir /*
2845*cdf0e10cSrcweir         if ( bSerialize )
2846*cdf0e10cSrcweir         {
2847*cdf0e10cSrcweir             ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4);
2848*cdf0e10cSrcweir             aSeq[0] <<= aRetLine.Color;
2849*cdf0e10cSrcweir             aSeq[1] <<= aRetLine.InnerLineWidth;
2850*cdf0e10cSrcweir             aSeq[2] <<= aRetLine.OuterLineWidth;
2851*cdf0e10cSrcweir             aSeq[3] <<= aRetLine.LineDistance;
2852*cdf0e10cSrcweir             rVal <<= aSeq;
2853*cdf0e10cSrcweir         }
2854*cdf0e10cSrcweir         else
2855*cdf0e10cSrcweir  */
2856*cdf0e10cSrcweir             rVal <<= aRetLine;
2857*cdf0e10cSrcweir     }
2858*cdf0e10cSrcweir 
2859*cdf0e10cSrcweir 	return sal_True;
2860*cdf0e10cSrcweir }
2861*cdf0e10cSrcweir 
2862*cdf0e10cSrcweir // -----------------------------------------------------------------------
2863*cdf0e10cSrcweir 
2864*cdf0e10cSrcweir sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2865*cdf0e10cSrcweir {
2866*cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2867*cdf0e10cSrcweir //  sal_uInt16 nLine = BOX_LINE_TOP;
2868*cdf0e10cSrcweir //  sal_Bool bDistMember = sal_False;
2869*cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
2870*cdf0e10cSrcweir     sal_Bool bRet;
2871*cdf0e10cSrcweir 	switch(nMemberId)
2872*cdf0e10cSrcweir 	{
2873*cdf0e10cSrcweir         case 0:
2874*cdf0e10cSrcweir         {
2875*cdf0e10cSrcweir             ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
2876*cdf0e10cSrcweir             if (( rVal >>= aSeq ) && ( aSeq.getLength() == 5 ))
2877*cdf0e10cSrcweir             {
2878*cdf0e10cSrcweir                 // 2 BorderLines, flags, valid flags and distance
2879*cdf0e10cSrcweir                 table::BorderLine aBorderLine;
2880*cdf0e10cSrcweir                 SvxBorderLine aLine;
2881*cdf0e10cSrcweir                 sal_Int16 nFlags( 0 );
2882*cdf0e10cSrcweir                 sal_Int32 nVal( 0 );
2883*cdf0e10cSrcweir                 if ( aSeq[0] >>= aBorderLine )
2884*cdf0e10cSrcweir                 {
2885*cdf0e10cSrcweir                     sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
2886*cdf0e10cSrcweir                     if ( bSet )
2887*cdf0e10cSrcweir                         SetLine( &aLine, BOXINFO_LINE_HORI );
2888*cdf0e10cSrcweir                 }
2889*cdf0e10cSrcweir                 else
2890*cdf0e10cSrcweir                     return sal_False;
2891*cdf0e10cSrcweir                 if ( aSeq[1] >>= aBorderLine )
2892*cdf0e10cSrcweir                 {
2893*cdf0e10cSrcweir                     sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
2894*cdf0e10cSrcweir                     if ( bSet )
2895*cdf0e10cSrcweir                         SetLine( &aLine, BOXINFO_LINE_VERT );
2896*cdf0e10cSrcweir                 }
2897*cdf0e10cSrcweir                 else
2898*cdf0e10cSrcweir                     return sal_False;
2899*cdf0e10cSrcweir                 if ( aSeq[2] >>= nFlags )
2900*cdf0e10cSrcweir                 {
2901*cdf0e10cSrcweir                     SetTable  ( ( nFlags & 0x01 ) != 0 );
2902*cdf0e10cSrcweir                     SetDist   ( ( nFlags & 0x02 ) != 0 );
2903*cdf0e10cSrcweir                     SetMinDist( ( nFlags & 0x04 ) != 0 );
2904*cdf0e10cSrcweir                 }
2905*cdf0e10cSrcweir                 else
2906*cdf0e10cSrcweir                     return sal_False;
2907*cdf0e10cSrcweir                 if ( aSeq[3] >>= nFlags )
2908*cdf0e10cSrcweir                     nValidFlags = (sal_uInt8)nFlags;
2909*cdf0e10cSrcweir                 else
2910*cdf0e10cSrcweir                     return sal_False;
2911*cdf0e10cSrcweir                 if (( aSeq[4] >>= nVal ) && ( nVal >= 0 ))
2912*cdf0e10cSrcweir                 {
2913*cdf0e10cSrcweir                     if( bConvert )
2914*cdf0e10cSrcweir                         nVal = MM100_TO_TWIP(nVal);
2915*cdf0e10cSrcweir                     SetDefDist( (sal_uInt16)nVal );
2916*cdf0e10cSrcweir                 }
2917*cdf0e10cSrcweir             }
2918*cdf0e10cSrcweir             return sal_True;
2919*cdf0e10cSrcweir         }
2920*cdf0e10cSrcweir 
2921*cdf0e10cSrcweir         case MID_HORIZONTAL:
2922*cdf0e10cSrcweir         case MID_VERTICAL:
2923*cdf0e10cSrcweir         {
2924*cdf0e10cSrcweir             if( !rVal.hasValue() )
2925*cdf0e10cSrcweir                 return sal_False;
2926*cdf0e10cSrcweir 
2927*cdf0e10cSrcweir             table::BorderLine aBorderLine;
2928*cdf0e10cSrcweir             if( rVal >>= aBorderLine )
2929*cdf0e10cSrcweir             {
2930*cdf0e10cSrcweir                 // usual struct
2931*cdf0e10cSrcweir             }
2932*cdf0e10cSrcweir             else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
2933*cdf0e10cSrcweir             {
2934*cdf0e10cSrcweir                 // serialization for basic macro recording
2935*cdf0e10cSrcweir                 uno::Reference < script::XTypeConverter > xConverter
2936*cdf0e10cSrcweir                         ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
2937*cdf0e10cSrcweir                         uno::UNO_QUERY );
2938*cdf0e10cSrcweir                 uno::Any aNew;
2939*cdf0e10cSrcweir                 uno::Sequence < uno::Any > aSeq;
2940*cdf0e10cSrcweir                 try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); }
2941*cdf0e10cSrcweir                 catch (uno::Exception&) {}
2942*cdf0e10cSrcweir 
2943*cdf0e10cSrcweir                 if( (aNew >>= aSeq) && aSeq.getLength() == 4 )
2944*cdf0e10cSrcweir                 {
2945*cdf0e10cSrcweir                     sal_Int32 nVal = 0;
2946*cdf0e10cSrcweir                     if ( aSeq[0] >>= nVal )
2947*cdf0e10cSrcweir                         aBorderLine.Color = nVal;
2948*cdf0e10cSrcweir                     if ( aSeq[1] >>= nVal )
2949*cdf0e10cSrcweir                         aBorderLine.InnerLineWidth = (sal_Int16) nVal;
2950*cdf0e10cSrcweir                     if ( aSeq[2] >>= nVal )
2951*cdf0e10cSrcweir                         aBorderLine.OuterLineWidth = (sal_Int16) nVal;
2952*cdf0e10cSrcweir                     if ( aSeq[3] >>= nVal )
2953*cdf0e10cSrcweir                         aBorderLine.LineDistance = (sal_Int16) nVal;
2954*cdf0e10cSrcweir                 }
2955*cdf0e10cSrcweir                 else
2956*cdf0e10cSrcweir                     return sal_False;
2957*cdf0e10cSrcweir             }
2958*cdf0e10cSrcweir             else if (rVal.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int16 >*)0) )
2959*cdf0e10cSrcweir             {
2960*cdf0e10cSrcweir                 // serialization for basic macro recording
2961*cdf0e10cSrcweir                 ::com::sun::star::uno::Sequence < sal_Int16 > aSeq;
2962*cdf0e10cSrcweir                 rVal >>= aSeq;
2963*cdf0e10cSrcweir                 if ( aSeq.getLength() == 4 )
2964*cdf0e10cSrcweir                 {
2965*cdf0e10cSrcweir                     aBorderLine.Color = aSeq[0];
2966*cdf0e10cSrcweir                     aBorderLine.InnerLineWidth = aSeq[1];
2967*cdf0e10cSrcweir                     aBorderLine.OuterLineWidth = aSeq[2];
2968*cdf0e10cSrcweir                     aBorderLine.LineDistance = aSeq[3];
2969*cdf0e10cSrcweir                 }
2970*cdf0e10cSrcweir                 else
2971*cdf0e10cSrcweir                     return sal_False;
2972*cdf0e10cSrcweir             }
2973*cdf0e10cSrcweir             else
2974*cdf0e10cSrcweir                 return sal_False;
2975*cdf0e10cSrcweir 
2976*cdf0e10cSrcweir             SvxBorderLine aLine;
2977*cdf0e10cSrcweir             sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
2978*cdf0e10cSrcweir             if ( bSet )
2979*cdf0e10cSrcweir                 SetLine( &aLine, nMemberId == MID_HORIZONTAL ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT );
2980*cdf0e10cSrcweir             break;
2981*cdf0e10cSrcweir         }
2982*cdf0e10cSrcweir         case MID_FLAGS:
2983*cdf0e10cSrcweir         {
2984*cdf0e10cSrcweir             sal_Int16 nFlags = sal_Int16();
2985*cdf0e10cSrcweir             bRet = (rVal >>= nFlags);
2986*cdf0e10cSrcweir             if ( bRet )
2987*cdf0e10cSrcweir             {
2988*cdf0e10cSrcweir                 SetTable  ( ( nFlags & 0x01 ) != 0 );
2989*cdf0e10cSrcweir                 SetDist   ( ( nFlags & 0x02 ) != 0 );
2990*cdf0e10cSrcweir                 SetMinDist( ( nFlags & 0x04 ) != 0 );
2991*cdf0e10cSrcweir             }
2992*cdf0e10cSrcweir 
2993*cdf0e10cSrcweir             break;
2994*cdf0e10cSrcweir         }
2995*cdf0e10cSrcweir         case MID_VALIDFLAGS:
2996*cdf0e10cSrcweir         {
2997*cdf0e10cSrcweir             sal_Int16 nFlags = sal_Int16();
2998*cdf0e10cSrcweir             bRet = (rVal >>= nFlags);
2999*cdf0e10cSrcweir             if ( bRet )
3000*cdf0e10cSrcweir                 nValidFlags = (sal_uInt8)nFlags;
3001*cdf0e10cSrcweir             break;
3002*cdf0e10cSrcweir         }
3003*cdf0e10cSrcweir         case MID_DISTANCE:
3004*cdf0e10cSrcweir         {
3005*cdf0e10cSrcweir             sal_Int32 nVal = 0;
3006*cdf0e10cSrcweir             bRet = (rVal >>= nVal);
3007*cdf0e10cSrcweir             if ( bRet && nVal>=0 )
3008*cdf0e10cSrcweir             {
3009*cdf0e10cSrcweir                 if( bConvert )
3010*cdf0e10cSrcweir                     nVal = MM100_TO_TWIP(nVal);
3011*cdf0e10cSrcweir                 SetDefDist( (sal_uInt16)nVal );
3012*cdf0e10cSrcweir             }
3013*cdf0e10cSrcweir             break;
3014*cdf0e10cSrcweir         }
3015*cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
3016*cdf0e10cSrcweir 	}
3017*cdf0e10cSrcweir 
3018*cdf0e10cSrcweir 	return sal_True;
3019*cdf0e10cSrcweir }
3020*cdf0e10cSrcweir 
3021*cdf0e10cSrcweir // class SvxFmtBreakItem -------------------------------------------------
3022*cdf0e10cSrcweir 
3023*cdf0e10cSrcweir int SvxFmtBreakItem::operator==( const SfxPoolItem& rAttr ) const
3024*cdf0e10cSrcweir {
3025*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "unequal types" );
3026*cdf0e10cSrcweir 
3027*cdf0e10cSrcweir 	return GetValue() == ( (SvxFmtBreakItem&)rAttr ).GetValue();
3028*cdf0e10cSrcweir }
3029*cdf0e10cSrcweir 
3030*cdf0e10cSrcweir //------------------------------------------------------------------------
3031*cdf0e10cSrcweir 
3032*cdf0e10cSrcweir SfxItemPresentation SvxFmtBreakItem::GetPresentation
3033*cdf0e10cSrcweir (
3034*cdf0e10cSrcweir 	SfxItemPresentation ePres,
3035*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
3036*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
3037*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
3038*cdf0e10cSrcweir )   const
3039*cdf0e10cSrcweir {
3040*cdf0e10cSrcweir #ifndef SVX_LIGHT
3041*cdf0e10cSrcweir 	switch ( ePres )
3042*cdf0e10cSrcweir 	{
3043*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
3044*cdf0e10cSrcweir 			rText.Erase();
3045*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
3046*cdf0e10cSrcweir 
3047*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
3048*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
3049*cdf0e10cSrcweir 			rText = GetValueTextByPos( GetValue() );
3050*cdf0e10cSrcweir 			return ePres;
3051*cdf0e10cSrcweir         default: ;//prevent warning
3052*cdf0e10cSrcweir     }
3053*cdf0e10cSrcweir #endif // !SVX_LIGHT
3054*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
3055*cdf0e10cSrcweir }
3056*cdf0e10cSrcweir 
3057*cdf0e10cSrcweir // -----------------------------------------------------------------------
3058*cdf0e10cSrcweir 
3059*cdf0e10cSrcweir XubString SvxFmtBreakItem::GetValueTextByPos( sal_uInt16 nPos ) const
3060*cdf0e10cSrcweir {
3061*cdf0e10cSrcweir 	DBG_ASSERT( nPos < SVX_BREAK_END, "enum overflow!" );
3062*cdf0e10cSrcweir 	XubString aStr( EditResId( RID_SVXITEMS_BREAK_BEGIN + nPos ) );
3063*cdf0e10cSrcweir 	return aStr;
3064*cdf0e10cSrcweir }
3065*cdf0e10cSrcweir 
3066*cdf0e10cSrcweir // -----------------------------------------------------------------------
3067*cdf0e10cSrcweir sal_Bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
3068*cdf0e10cSrcweir {
3069*cdf0e10cSrcweir 	style::BreakType eBreak = style::BreakType_NONE;
3070*cdf0e10cSrcweir 	switch ( (SvxBreak)GetValue() )
3071*cdf0e10cSrcweir 	{
3072*cdf0e10cSrcweir         case SVX_BREAK_COLUMN_BEFORE:   eBreak = style::BreakType_COLUMN_BEFORE; break;
3073*cdf0e10cSrcweir         case SVX_BREAK_COLUMN_AFTER:    eBreak = style::BreakType_COLUMN_AFTER ; break;
3074*cdf0e10cSrcweir         case SVX_BREAK_COLUMN_BOTH:     eBreak = style::BreakType_COLUMN_BOTH  ; break;
3075*cdf0e10cSrcweir         case SVX_BREAK_PAGE_BEFORE:     eBreak = style::BreakType_PAGE_BEFORE  ; break;
3076*cdf0e10cSrcweir         case SVX_BREAK_PAGE_AFTER:      eBreak = style::BreakType_PAGE_AFTER   ; break;
3077*cdf0e10cSrcweir         case SVX_BREAK_PAGE_BOTH:       eBreak = style::BreakType_PAGE_BOTH    ; break;
3078*cdf0e10cSrcweir         default: ;//prevent warning
3079*cdf0e10cSrcweir     }
3080*cdf0e10cSrcweir 	rVal <<= eBreak;
3081*cdf0e10cSrcweir 	return sal_True;
3082*cdf0e10cSrcweir }
3083*cdf0e10cSrcweir // -----------------------------------------------------------------------
3084*cdf0e10cSrcweir sal_Bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
3085*cdf0e10cSrcweir {
3086*cdf0e10cSrcweir 	style::BreakType nBreak;
3087*cdf0e10cSrcweir 
3088*cdf0e10cSrcweir 	if(!(rVal >>= nBreak))
3089*cdf0e10cSrcweir 	{
3090*cdf0e10cSrcweir 		sal_Int32 nValue = 0;
3091*cdf0e10cSrcweir 		if(!(rVal >>= nValue))
3092*cdf0e10cSrcweir 			return sal_False;
3093*cdf0e10cSrcweir 
3094*cdf0e10cSrcweir 		nBreak = (style::BreakType) nValue;
3095*cdf0e10cSrcweir 	}
3096*cdf0e10cSrcweir 
3097*cdf0e10cSrcweir 	SvxBreak eBreak = SVX_BREAK_NONE;
3098*cdf0e10cSrcweir 	switch( nBreak )
3099*cdf0e10cSrcweir 	{
3100*cdf0e10cSrcweir 		case style::BreakType_COLUMN_BEFORE:	eBreak = SVX_BREAK_COLUMN_BEFORE; break;
3101*cdf0e10cSrcweir 		case style::BreakType_COLUMN_AFTER:	eBreak = SVX_BREAK_COLUMN_AFTER;  break;
3102*cdf0e10cSrcweir 		case style::BreakType_COLUMN_BOTH:		eBreak = SVX_BREAK_COLUMN_BOTH;   break;
3103*cdf0e10cSrcweir 		case style::BreakType_PAGE_BEFORE:		eBreak = SVX_BREAK_PAGE_BEFORE;   break;
3104*cdf0e10cSrcweir 		case style::BreakType_PAGE_AFTER:		eBreak = SVX_BREAK_PAGE_AFTER;    break;
3105*cdf0e10cSrcweir 		case style::BreakType_PAGE_BOTH:		eBreak = SVX_BREAK_PAGE_BOTH;     break;
3106*cdf0e10cSrcweir         default: ;//prevent warning
3107*cdf0e10cSrcweir     }
3108*cdf0e10cSrcweir 	SetValue((sal_uInt16) eBreak);
3109*cdf0e10cSrcweir 
3110*cdf0e10cSrcweir 	return sal_True;
3111*cdf0e10cSrcweir }
3112*cdf0e10cSrcweir 
3113*cdf0e10cSrcweir // -----------------------------------------------------------------------
3114*cdf0e10cSrcweir 
3115*cdf0e10cSrcweir SfxPoolItem* SvxFmtBreakItem::Clone( SfxItemPool* ) const
3116*cdf0e10cSrcweir {
3117*cdf0e10cSrcweir 	return new SvxFmtBreakItem( *this );
3118*cdf0e10cSrcweir }
3119*cdf0e10cSrcweir 
3120*cdf0e10cSrcweir // -----------------------------------------------------------------------
3121*cdf0e10cSrcweir 
3122*cdf0e10cSrcweir SvStream& SvxFmtBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
3123*cdf0e10cSrcweir {
3124*cdf0e10cSrcweir 	rStrm << (sal_Int8)GetValue();
3125*cdf0e10cSrcweir 	if( FMTBREAK_NOAUTO > nItemVersion )
3126*cdf0e10cSrcweir 		rStrm << (sal_Int8)0x01;
3127*cdf0e10cSrcweir 	return rStrm;
3128*cdf0e10cSrcweir }
3129*cdf0e10cSrcweir 
3130*cdf0e10cSrcweir // -----------------------------------------------------------------------
3131*cdf0e10cSrcweir 
3132*cdf0e10cSrcweir sal_uInt16 SvxFmtBreakItem::GetVersion( sal_uInt16 nFFVer ) const
3133*cdf0e10cSrcweir {
3134*cdf0e10cSrcweir 	DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
3135*cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_40==nFFVer ||
3136*cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_50==nFFVer,
3137*cdf0e10cSrcweir 			"SvxFmtBreakItem: Gibt es ein neues Fileformat?" );
3138*cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_31==nFFVer ||
3139*cdf0e10cSrcweir 		   SOFFICE_FILEFORMAT_40==nFFVer ? 0 : FMTBREAK_NOAUTO;
3140*cdf0e10cSrcweir }
3141*cdf0e10cSrcweir 
3142*cdf0e10cSrcweir // -----------------------------------------------------------------------
3143*cdf0e10cSrcweir 
3144*cdf0e10cSrcweir SfxPoolItem* SvxFmtBreakItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
3145*cdf0e10cSrcweir {
3146*cdf0e10cSrcweir 	sal_Int8 eBreak, bDummy;
3147*cdf0e10cSrcweir 	rStrm >> eBreak;
3148*cdf0e10cSrcweir 	if( FMTBREAK_NOAUTO > nVersion )
3149*cdf0e10cSrcweir 		rStrm >> bDummy;
3150*cdf0e10cSrcweir 	return new SvxFmtBreakItem( (const SvxBreak)eBreak, Which() );
3151*cdf0e10cSrcweir }
3152*cdf0e10cSrcweir 
3153*cdf0e10cSrcweir // -----------------------------------------------------------------------
3154*cdf0e10cSrcweir 
3155*cdf0e10cSrcweir sal_uInt16 SvxFmtBreakItem::GetValueCount() const
3156*cdf0e10cSrcweir {
3157*cdf0e10cSrcweir 	return SVX_BREAK_END;	// SVX_BREAK_PAGE_BOTH + 1
3158*cdf0e10cSrcweir }
3159*cdf0e10cSrcweir 
3160*cdf0e10cSrcweir // class SvxFmtKeepItem -------------------------------------------------
3161*cdf0e10cSrcweir 
3162*cdf0e10cSrcweir SfxPoolItem* SvxFmtKeepItem::Clone( SfxItemPool* ) const
3163*cdf0e10cSrcweir {
3164*cdf0e10cSrcweir 	return new SvxFmtKeepItem( *this );
3165*cdf0e10cSrcweir }
3166*cdf0e10cSrcweir 
3167*cdf0e10cSrcweir // -----------------------------------------------------------------------
3168*cdf0e10cSrcweir 
3169*cdf0e10cSrcweir SvStream& SvxFmtKeepItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
3170*cdf0e10cSrcweir {
3171*cdf0e10cSrcweir 	rStrm << (sal_Int8)GetValue();
3172*cdf0e10cSrcweir 	return rStrm;
3173*cdf0e10cSrcweir }
3174*cdf0e10cSrcweir 
3175*cdf0e10cSrcweir // -----------------------------------------------------------------------
3176*cdf0e10cSrcweir 
3177*cdf0e10cSrcweir SfxPoolItem* SvxFmtKeepItem::Create( SvStream& rStrm, sal_uInt16 ) const
3178*cdf0e10cSrcweir {
3179*cdf0e10cSrcweir 	sal_Int8 bIsKeep;
3180*cdf0e10cSrcweir 	rStrm >> bIsKeep;
3181*cdf0e10cSrcweir 	return new SvxFmtKeepItem( sal_Bool( bIsKeep != 0 ), Which() );
3182*cdf0e10cSrcweir }
3183*cdf0e10cSrcweir 
3184*cdf0e10cSrcweir //------------------------------------------------------------------------
3185*cdf0e10cSrcweir 
3186*cdf0e10cSrcweir SfxItemPresentation SvxFmtKeepItem::GetPresentation
3187*cdf0e10cSrcweir (
3188*cdf0e10cSrcweir 	SfxItemPresentation ePres,
3189*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
3190*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
3191*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
3192*cdf0e10cSrcweir     ) const
3193*cdf0e10cSrcweir {
3194*cdf0e10cSrcweir #ifndef SVX_LIGHT
3195*cdf0e10cSrcweir 	switch ( ePres )
3196*cdf0e10cSrcweir 	{
3197*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
3198*cdf0e10cSrcweir 			rText.Erase();
3199*cdf0e10cSrcweir 			return ePres;
3200*cdf0e10cSrcweir 
3201*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
3202*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
3203*cdf0e10cSrcweir 		{
3204*cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_FMTKEEP_FALSE;
3205*cdf0e10cSrcweir 
3206*cdf0e10cSrcweir 			if ( GetValue() )
3207*cdf0e10cSrcweir 				nId = RID_SVXITEMS_FMTKEEP_TRUE;
3208*cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
3209*cdf0e10cSrcweir 			return ePres;
3210*cdf0e10cSrcweir 		}
3211*cdf0e10cSrcweir         default: ;//prevent warning
3212*cdf0e10cSrcweir     }
3213*cdf0e10cSrcweir #endif
3214*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
3215*cdf0e10cSrcweir }
3216*cdf0e10cSrcweir 
3217*cdf0e10cSrcweir // class SvxLineItem ------------------------------------------------------
3218*cdf0e10cSrcweir 
3219*cdf0e10cSrcweir SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
3220*cdf0e10cSrcweir 
3221*cdf0e10cSrcweir 	SfxPoolItem	( nId ),
3222*cdf0e10cSrcweir 
3223*cdf0e10cSrcweir 	pLine( NULL )
3224*cdf0e10cSrcweir {
3225*cdf0e10cSrcweir }
3226*cdf0e10cSrcweir 
3227*cdf0e10cSrcweir // -----------------------------------------------------------------------
3228*cdf0e10cSrcweir 
3229*cdf0e10cSrcweir SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) :
3230*cdf0e10cSrcweir 
3231*cdf0e10cSrcweir 	SfxPoolItem ( rCpy )
3232*cdf0e10cSrcweir {
3233*cdf0e10cSrcweir 	pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : 0;
3234*cdf0e10cSrcweir }
3235*cdf0e10cSrcweir 
3236*cdf0e10cSrcweir 
3237*cdf0e10cSrcweir // -----------------------------------------------------------------------
3238*cdf0e10cSrcweir 
3239*cdf0e10cSrcweir SvxLineItem::~SvxLineItem()
3240*cdf0e10cSrcweir {
3241*cdf0e10cSrcweir 	delete pLine;
3242*cdf0e10cSrcweir }
3243*cdf0e10cSrcweir 
3244*cdf0e10cSrcweir // -----------------------------------------------------------------------
3245*cdf0e10cSrcweir 
3246*cdf0e10cSrcweir SvxLineItem& SvxLineItem::operator=( const SvxLineItem& rLine )
3247*cdf0e10cSrcweir {
3248*cdf0e10cSrcweir 	SetLine( rLine.GetLine() );
3249*cdf0e10cSrcweir 
3250*cdf0e10cSrcweir 	return *this;
3251*cdf0e10cSrcweir }
3252*cdf0e10cSrcweir 
3253*cdf0e10cSrcweir // -----------------------------------------------------------------------
3254*cdf0e10cSrcweir 
3255*cdf0e10cSrcweir int SvxLineItem::operator==( const SfxPoolItem& rAttr ) const
3256*cdf0e10cSrcweir {
3257*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
3258*cdf0e10cSrcweir 
3259*cdf0e10cSrcweir 	return CmpBrdLn( pLine, ((SvxLineItem&)rAttr).GetLine() );
3260*cdf0e10cSrcweir }
3261*cdf0e10cSrcweir 
3262*cdf0e10cSrcweir // -----------------------------------------------------------------------
3263*cdf0e10cSrcweir 
3264*cdf0e10cSrcweir SfxPoolItem* SvxLineItem::Clone( SfxItemPool* ) const
3265*cdf0e10cSrcweir {
3266*cdf0e10cSrcweir 	return new SvxLineItem( *this );
3267*cdf0e10cSrcweir }
3268*cdf0e10cSrcweir 
3269*cdf0e10cSrcweir sal_Bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemId ) const
3270*cdf0e10cSrcweir {
3271*cdf0e10cSrcweir     sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS);
3272*cdf0e10cSrcweir     nMemId &= ~CONVERT_TWIPS;
3273*cdf0e10cSrcweir     if ( nMemId == 0 )
3274*cdf0e10cSrcweir     {
3275*cdf0e10cSrcweir         rVal <<= uno::makeAny( SvxBoxItem::SvxLineToLine(pLine, bConvert) );
3276*cdf0e10cSrcweir         return sal_True;
3277*cdf0e10cSrcweir     }
3278*cdf0e10cSrcweir     else if ( pLine )
3279*cdf0e10cSrcweir     {
3280*cdf0e10cSrcweir 		switch ( nMemId )
3281*cdf0e10cSrcweir 		{
3282*cdf0e10cSrcweir             case MID_FG_COLOR:      rVal <<= sal_Int32(pLine->GetColor().GetColor()); break;
3283*cdf0e10cSrcweir 			case MID_OUTER_WIDTH: 	rVal <<= sal_Int32(pLine->GetOutWidth());	break;
3284*cdf0e10cSrcweir 			case MID_INNER_WIDTH:	rVal <<= sal_Int32(pLine->GetInWidth( ));	break;
3285*cdf0e10cSrcweir 			case MID_DISTANCE:  	rVal <<= sal_Int32(pLine->GetDistance()); 	break;
3286*cdf0e10cSrcweir 			default:
3287*cdf0e10cSrcweir                 DBG_ERROR( "Wrong MemberId" );
3288*cdf0e10cSrcweir                 return sal_False;
3289*cdf0e10cSrcweir 		}
3290*cdf0e10cSrcweir     }
3291*cdf0e10cSrcweir 
3292*cdf0e10cSrcweir     return sal_True;
3293*cdf0e10cSrcweir }
3294*cdf0e10cSrcweir 
3295*cdf0e10cSrcweir // -----------------------------------------------------------------------
3296*cdf0e10cSrcweir 
3297*cdf0e10cSrcweir sal_Bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId )
3298*cdf0e10cSrcweir {
3299*cdf0e10cSrcweir     sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS);
3300*cdf0e10cSrcweir     nMemId &= ~CONVERT_TWIPS;
3301*cdf0e10cSrcweir     sal_Int32 nVal = 0;
3302*cdf0e10cSrcweir     if ( nMemId == 0 )
3303*cdf0e10cSrcweir     {
3304*cdf0e10cSrcweir         table::BorderLine aLine;
3305*cdf0e10cSrcweir         if ( rVal >>= aLine )
3306*cdf0e10cSrcweir         {
3307*cdf0e10cSrcweir             if ( !pLine )
3308*cdf0e10cSrcweir                 pLine = new SvxBorderLine;
3309*cdf0e10cSrcweir             if( !SvxBoxItem::LineToSvxLine(aLine, *pLine, bConvert) )
3310*cdf0e10cSrcweir                 DELETEZ( pLine );
3311*cdf0e10cSrcweir             return sal_True;
3312*cdf0e10cSrcweir         }
3313*cdf0e10cSrcweir         return sal_False;
3314*cdf0e10cSrcweir     }
3315*cdf0e10cSrcweir     else if ( rVal >>= nVal )
3316*cdf0e10cSrcweir     {
3317*cdf0e10cSrcweir         if ( !pLine )
3318*cdf0e10cSrcweir             pLine = new SvxBorderLine;
3319*cdf0e10cSrcweir 
3320*cdf0e10cSrcweir         switch ( nMemId )
3321*cdf0e10cSrcweir         {
3322*cdf0e10cSrcweir             case MID_FG_COLOR:      pLine->SetColor( Color(nVal) ); break;
3323*cdf0e10cSrcweir             case MID_OUTER_WIDTH:   pLine->SetOutWidth((sal_uInt16)nVal);   break;
3324*cdf0e10cSrcweir             case MID_INNER_WIDTH:   pLine->SetInWidth((sal_uInt16)nVal);   break;
3325*cdf0e10cSrcweir             case MID_DISTANCE:      pLine->SetDistance((sal_uInt16)nVal);   break;
3326*cdf0e10cSrcweir             default:
3327*cdf0e10cSrcweir                 DBG_ERROR( "Wrong MemberId" );
3328*cdf0e10cSrcweir                 return sal_False;
3329*cdf0e10cSrcweir         }
3330*cdf0e10cSrcweir 
3331*cdf0e10cSrcweir         return sal_True;
3332*cdf0e10cSrcweir     }
3333*cdf0e10cSrcweir 
3334*cdf0e10cSrcweir     return sal_False;
3335*cdf0e10cSrcweir }
3336*cdf0e10cSrcweir 
3337*cdf0e10cSrcweir //------------------------------------------------------------------------
3338*cdf0e10cSrcweir 
3339*cdf0e10cSrcweir SfxItemPresentation SvxLineItem::GetPresentation
3340*cdf0e10cSrcweir (
3341*cdf0e10cSrcweir 	SfxItemPresentation ePres,
3342*cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
3343*cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
3344*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *pIntl
3345*cdf0e10cSrcweir )	const
3346*cdf0e10cSrcweir {
3347*cdf0e10cSrcweir #ifndef SVX_LIGHT
3348*cdf0e10cSrcweir 	rText.Erase();
3349*cdf0e10cSrcweir 
3350*cdf0e10cSrcweir 	switch ( ePres )
3351*cdf0e10cSrcweir 	{
3352*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
3353*cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
3354*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
3355*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
3356*cdf0e10cSrcweir 		{
3357*cdf0e10cSrcweir 			if ( pLine )
3358*cdf0e10cSrcweir                 rText = pLine->GetValueString( eCoreUnit, ePresUnit, pIntl,
3359*cdf0e10cSrcweir 					(SFX_ITEM_PRESENTATION_COMPLETE == ePres) );
3360*cdf0e10cSrcweir 			return ePres;
3361*cdf0e10cSrcweir 		}
3362*cdf0e10cSrcweir         default: ;//prevent warning
3363*cdf0e10cSrcweir     }
3364*cdf0e10cSrcweir #endif
3365*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
3366*cdf0e10cSrcweir }
3367*cdf0e10cSrcweir 
3368*cdf0e10cSrcweir // -----------------------------------------------------------------------
3369*cdf0e10cSrcweir 
3370*cdf0e10cSrcweir SvStream& SvxLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
3371*cdf0e10cSrcweir {
3372*cdf0e10cSrcweir 	if( pLine )
3373*cdf0e10cSrcweir 	{
3374*cdf0e10cSrcweir 		rStrm << pLine->GetColor()
3375*cdf0e10cSrcweir 			  << (short)pLine->GetOutWidth()
3376*cdf0e10cSrcweir 			  << (short)pLine->GetInWidth()
3377*cdf0e10cSrcweir 			  << (short)pLine->GetDistance();
3378*cdf0e10cSrcweir 	}
3379*cdf0e10cSrcweir     else
3380*cdf0e10cSrcweir         rStrm << Color() << (short)0 << (short)0 << (short)0;
3381*cdf0e10cSrcweir 	return rStrm;
3382*cdf0e10cSrcweir }
3383*cdf0e10cSrcweir 
3384*cdf0e10cSrcweir // -----------------------------------------------------------------------
3385*cdf0e10cSrcweir 
3386*cdf0e10cSrcweir int SvxLineItem::ScaleMetrics( long nMult, long nDiv )
3387*cdf0e10cSrcweir {
3388*cdf0e10cSrcweir 	if ( pLine ) pLine->ScaleMetrics( nMult, nDiv );
3389*cdf0e10cSrcweir 	return 1;
3390*cdf0e10cSrcweir }
3391*cdf0e10cSrcweir 
3392*cdf0e10cSrcweir // -----------------------------------------------------------------------
3393*cdf0e10cSrcweir 
3394*cdf0e10cSrcweir int SvxLineItem::HasMetrics() const
3395*cdf0e10cSrcweir {
3396*cdf0e10cSrcweir 	return 1;
3397*cdf0e10cSrcweir }
3398*cdf0e10cSrcweir 
3399*cdf0e10cSrcweir // -----------------------------------------------------------------------
3400*cdf0e10cSrcweir 
3401*cdf0e10cSrcweir SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const
3402*cdf0e10cSrcweir {
3403*cdf0e10cSrcweir     SvxLineItem* _pLine = new SvxLineItem( Which() );
3404*cdf0e10cSrcweir 	short		 nOutline, nInline, nDistance;
3405*cdf0e10cSrcweir 	Color		 aColor;
3406*cdf0e10cSrcweir 
3407*cdf0e10cSrcweir 	rStrm >> aColor >> nOutline >> nInline >> nDistance;
3408*cdf0e10cSrcweir     if( nOutline )
3409*cdf0e10cSrcweir     {
3410*cdf0e10cSrcweir         SvxBorderLine aLine( &aColor, nOutline, nInline, nDistance );
3411*cdf0e10cSrcweir         _pLine->SetLine( &aLine );
3412*cdf0e10cSrcweir     }
3413*cdf0e10cSrcweir     return _pLine;
3414*cdf0e10cSrcweir }
3415*cdf0e10cSrcweir 
3416*cdf0e10cSrcweir // -----------------------------------------------------------------------
3417*cdf0e10cSrcweir 
3418*cdf0e10cSrcweir void SvxLineItem::SetLine( const SvxBorderLine* pNew )
3419*cdf0e10cSrcweir {
3420*cdf0e10cSrcweir 	delete pLine;
3421*cdf0e10cSrcweir 	pLine = pNew ? new SvxBorderLine( *pNew ) : 0;
3422*cdf0e10cSrcweir }
3423*cdf0e10cSrcweir 
3424*cdf0e10cSrcweir #ifdef _MSC_VER
3425*cdf0e10cSrcweir #pragma optimize ( "", off )
3426*cdf0e10cSrcweir #endif
3427*cdf0e10cSrcweir 
3428*cdf0e10cSrcweir // class SvxBrushItem ----------------------------------------------------
3429*cdf0e10cSrcweir 
3430*cdf0e10cSrcweir #define LOAD_GRAPHIC	((sal_uInt16)0x0001)
3431*cdf0e10cSrcweir #define LOAD_LINK		((sal_uInt16)0x0002)
3432*cdf0e10cSrcweir #define LOAD_FILTER		((sal_uInt16)0x0004)
3433*cdf0e10cSrcweir 
3434*cdf0e10cSrcweir // class SvxBrushItem_Impl -----------------------------------------------
3435*cdf0e10cSrcweir 
3436*cdf0e10cSrcweir class SvxBrushItem_Impl
3437*cdf0e10cSrcweir {
3438*cdf0e10cSrcweir public:
3439*cdf0e10cSrcweir 	GraphicObject*	pGraphicObject;
3440*cdf0e10cSrcweir     sal_Int8        nGraphicTransparency; //contains a percentage value which is
3441*cdf0e10cSrcweir                                           //copied to the GraphicObject when necessary
3442*cdf0e10cSrcweir 	Link			aDoneLink;
3443*cdf0e10cSrcweir 	SvStream*		pStream;
3444*cdf0e10cSrcweir 
3445*cdf0e10cSrcweir     SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0), pStream(0) {}
3446*cdf0e10cSrcweir };
3447*cdf0e10cSrcweir 
3448*cdf0e10cSrcweir // -----------------------------------------------------------------------
3449*cdf0e10cSrcweir 
3450*cdf0e10cSrcweir void SvxBrushItem::SetDoneLink( const Link& rLink )
3451*cdf0e10cSrcweir {
3452*cdf0e10cSrcweir 	pImpl->aDoneLink = rLink;
3453*cdf0e10cSrcweir }
3454*cdf0e10cSrcweir 
3455*cdf0e10cSrcweir // -----------------------------------------------------------------------
3456*cdf0e10cSrcweir 
3457*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( sal_uInt16 _nWhich ) :
3458*cdf0e10cSrcweir 
3459*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
3460*cdf0e10cSrcweir 
3461*cdf0e10cSrcweir 	aColor		( COL_TRANSPARENT ),
3462*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( 0 ) ),
3463*cdf0e10cSrcweir 	pStrLink	( NULL ),
3464*cdf0e10cSrcweir 	pStrFilter	( NULL ),
3465*cdf0e10cSrcweir 	eGraphicPos	( GPOS_NONE ),
3466*cdf0e10cSrcweir 	bLoadAgain	( sal_True )
3467*cdf0e10cSrcweir 
3468*cdf0e10cSrcweir {
3469*cdf0e10cSrcweir }
3470*cdf0e10cSrcweir 
3471*cdf0e10cSrcweir // -----------------------------------------------------------------------
3472*cdf0e10cSrcweir 
3473*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( const Color& rColor, sal_uInt16 _nWhich) :
3474*cdf0e10cSrcweir 
3475*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
3476*cdf0e10cSrcweir 
3477*cdf0e10cSrcweir 	aColor		( rColor ),
3478*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( 0 ) ),
3479*cdf0e10cSrcweir 	pStrLink	( NULL ),
3480*cdf0e10cSrcweir 	pStrFilter	( NULL ),
3481*cdf0e10cSrcweir 	eGraphicPos	( GPOS_NONE ),
3482*cdf0e10cSrcweir 	bLoadAgain	( sal_True )
3483*cdf0e10cSrcweir 
3484*cdf0e10cSrcweir {
3485*cdf0e10cSrcweir }
3486*cdf0e10cSrcweir 
3487*cdf0e10cSrcweir // -----------------------------------------------------------------------
3488*cdf0e10cSrcweir 
3489*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
3490*cdf0e10cSrcweir                             sal_uInt16 _nWhich ) :
3491*cdf0e10cSrcweir 
3492*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
3493*cdf0e10cSrcweir 
3494*cdf0e10cSrcweir 	aColor		( COL_TRANSPARENT ),
3495*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( new GraphicObject( rGraphic ) ) ),
3496*cdf0e10cSrcweir 	pStrLink	( NULL ),
3497*cdf0e10cSrcweir 	pStrFilter	( NULL ),
3498*cdf0e10cSrcweir 	eGraphicPos	( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
3499*cdf0e10cSrcweir 	bLoadAgain	( sal_True )
3500*cdf0e10cSrcweir 
3501*cdf0e10cSrcweir {
3502*cdf0e10cSrcweir 	DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
3503*cdf0e10cSrcweir }
3504*cdf0e10cSrcweir 
3505*cdf0e10cSrcweir // -----------------------------------------------------------------------
3506*cdf0e10cSrcweir 
3507*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
3508*cdf0e10cSrcweir                             SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
3509*cdf0e10cSrcweir 
3510*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
3511*cdf0e10cSrcweir 
3512*cdf0e10cSrcweir 	aColor		( COL_TRANSPARENT ),
3513*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( new GraphicObject( rGraphicObj ) ) ),
3514*cdf0e10cSrcweir 	pStrLink	( NULL ),
3515*cdf0e10cSrcweir 	pStrFilter	( NULL ),
3516*cdf0e10cSrcweir 	eGraphicPos	( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
3517*cdf0e10cSrcweir 	bLoadAgain	( sal_True )
3518*cdf0e10cSrcweir 
3519*cdf0e10cSrcweir {
3520*cdf0e10cSrcweir 	DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
3521*cdf0e10cSrcweir }
3522*cdf0e10cSrcweir 
3523*cdf0e10cSrcweir // -----------------------------------------------------------------------
3524*cdf0e10cSrcweir 
3525*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem(
3526*cdf0e10cSrcweir 	const String& rLink, const String& rFilter,
3527*cdf0e10cSrcweir     SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
3528*cdf0e10cSrcweir 
3529*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
3530*cdf0e10cSrcweir 
3531*cdf0e10cSrcweir 	aColor		( COL_TRANSPARENT ),
3532*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( NULL ) ),
3533*cdf0e10cSrcweir 	pStrLink	( new String( rLink ) ),
3534*cdf0e10cSrcweir 	pStrFilter	( new String( rFilter ) ),
3535*cdf0e10cSrcweir 	eGraphicPos	( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
3536*cdf0e10cSrcweir 	bLoadAgain	( sal_True )
3537*cdf0e10cSrcweir 
3538*cdf0e10cSrcweir {
3539*cdf0e10cSrcweir 	DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
3540*cdf0e10cSrcweir }
3541*cdf0e10cSrcweir 
3542*cdf0e10cSrcweir // -----------------------------------------------------------------------
3543*cdf0e10cSrcweir 
3544*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
3545*cdf0e10cSrcweir                             sal_uInt16 _nWhich ) :
3546*cdf0e10cSrcweir 
3547*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
3548*cdf0e10cSrcweir 
3549*cdf0e10cSrcweir 	aColor		( COL_TRANSPARENT ),
3550*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( NULL ) ),
3551*cdf0e10cSrcweir 	pStrLink	( NULL ),
3552*cdf0e10cSrcweir 	pStrFilter	( NULL ),
3553*cdf0e10cSrcweir 	eGraphicPos	( GPOS_NONE )
3554*cdf0e10cSrcweir 
3555*cdf0e10cSrcweir {
3556*cdf0e10cSrcweir 	sal_Bool bTrans;
3557*cdf0e10cSrcweir 	Color aTempColor;
3558*cdf0e10cSrcweir 	Color aTempFillColor;
3559*cdf0e10cSrcweir 	sal_Int8 nStyle;
3560*cdf0e10cSrcweir 
3561*cdf0e10cSrcweir 	rStream >> bTrans;
3562*cdf0e10cSrcweir 	rStream >> aTempColor;
3563*cdf0e10cSrcweir 	rStream >> aTempFillColor;
3564*cdf0e10cSrcweir 	rStream >> nStyle;
3565*cdf0e10cSrcweir 
3566*cdf0e10cSrcweir 	switch ( nStyle )
3567*cdf0e10cSrcweir 	{
3568*cdf0e10cSrcweir 		case 8://BRUSH_25:
3569*cdf0e10cSrcweir 		{
3570*cdf0e10cSrcweir 			sal_uInt32	nRed	= aTempColor.GetRed();
3571*cdf0e10cSrcweir 			sal_uInt32	nGreen	= aTempColor.GetGreen();
3572*cdf0e10cSrcweir 			sal_uInt32	nBlue	= aTempColor.GetBlue();
3573*cdf0e10cSrcweir 			nRed   += (sal_uInt32)(aTempFillColor.GetRed())*2;
3574*cdf0e10cSrcweir 			nGreen += (sal_uInt32)(aTempFillColor.GetGreen())*2;
3575*cdf0e10cSrcweir 			nBlue  += (sal_uInt32)(aTempFillColor.GetBlue())*2;
3576*cdf0e10cSrcweir 			aColor = Color( (sal_Int8)(nRed/3), (sal_Int8)(nGreen/3), (sal_Int8)(nBlue/3) );
3577*cdf0e10cSrcweir 		}
3578*cdf0e10cSrcweir 		break;
3579*cdf0e10cSrcweir 
3580*cdf0e10cSrcweir 		case 9://BRUSH_50:
3581*cdf0e10cSrcweir 		{
3582*cdf0e10cSrcweir 			sal_uInt32	nRed	= aTempColor.GetRed();
3583*cdf0e10cSrcweir 			sal_uInt32	nGreen	= aTempColor.GetGreen();
3584*cdf0e10cSrcweir 			sal_uInt32	nBlue	= aTempColor.GetBlue();
3585*cdf0e10cSrcweir 			nRed   += (sal_uInt32)(aTempFillColor.GetRed());
3586*cdf0e10cSrcweir 			nGreen += (sal_uInt32)(aTempFillColor.GetGreen());
3587*cdf0e10cSrcweir 			nBlue  += (sal_uInt32)(aTempFillColor.GetBlue());
3588*cdf0e10cSrcweir 			aColor = Color( (sal_Int8)(nRed/2), (sal_Int8)(nGreen/2), (sal_Int8)(nBlue/2) );
3589*cdf0e10cSrcweir 		}
3590*cdf0e10cSrcweir 		break;
3591*cdf0e10cSrcweir 
3592*cdf0e10cSrcweir 		case 10://BRUSH_75:
3593*cdf0e10cSrcweir 		{
3594*cdf0e10cSrcweir 			sal_uInt32	nRed	= aTempColor.GetRed()*2;
3595*cdf0e10cSrcweir 			sal_uInt32	nGreen	= aTempColor.GetGreen()*2;
3596*cdf0e10cSrcweir 			sal_uInt32	nBlue	= aTempColor.GetBlue()*2;
3597*cdf0e10cSrcweir 			nRed   += (sal_uInt32)(aTempFillColor.GetRed());
3598*cdf0e10cSrcweir 			nGreen += (sal_uInt32)(aTempFillColor.GetGreen());
3599*cdf0e10cSrcweir 			nBlue  += (sal_uInt32)(aTempFillColor.GetBlue());
3600*cdf0e10cSrcweir 			aColor = Color( (sal_Int8)(nRed/3), (sal_Int8)(nGreen/3), (sal_Int8)(nBlue/3) );
3601*cdf0e10cSrcweir 		}
3602*cdf0e10cSrcweir 		break;
3603*cdf0e10cSrcweir 
3604*cdf0e10cSrcweir 		case 0://BRUSH_NULL:
3605*cdf0e10cSrcweir 			aColor = Color( COL_TRANSPARENT );
3606*cdf0e10cSrcweir 		break;
3607*cdf0e10cSrcweir 
3608*cdf0e10cSrcweir 		default:
3609*cdf0e10cSrcweir 			aColor = aTempColor;
3610*cdf0e10cSrcweir 	}
3611*cdf0e10cSrcweir 
3612*cdf0e10cSrcweir 	if ( nVersion >= BRUSH_GRAPHIC_VERSION )
3613*cdf0e10cSrcweir 	{
3614*cdf0e10cSrcweir 		sal_uInt16 nDoLoad = 0;
3615*cdf0e10cSrcweir 		sal_Int8 nPos;
3616*cdf0e10cSrcweir 
3617*cdf0e10cSrcweir 		rStream >> nDoLoad;
3618*cdf0e10cSrcweir 
3619*cdf0e10cSrcweir 		if ( nDoLoad & LOAD_GRAPHIC )
3620*cdf0e10cSrcweir 		{
3621*cdf0e10cSrcweir 			Graphic aGraphic;
3622*cdf0e10cSrcweir 
3623*cdf0e10cSrcweir 			rStream >> aGraphic;
3624*cdf0e10cSrcweir 			pImpl->pGraphicObject = new GraphicObject( aGraphic );
3625*cdf0e10cSrcweir 
3626*cdf0e10cSrcweir 			if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() )
3627*cdf0e10cSrcweir 			{
3628*cdf0e10cSrcweir 				rStream.ResetError();
3629*cdf0e10cSrcweir 				rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT|
3630*cdf0e10cSrcweir 								  ERRCODE_WARNING_MASK  );
3631*cdf0e10cSrcweir 			}
3632*cdf0e10cSrcweir 		}
3633*cdf0e10cSrcweir 
3634*cdf0e10cSrcweir 		if ( nDoLoad & LOAD_LINK )
3635*cdf0e10cSrcweir 		{
3636*cdf0e10cSrcweir 			String aRel;
3637*cdf0e10cSrcweir 			// UNICODE: rStream >> aRel;
3638*cdf0e10cSrcweir 			rStream.ReadByteString(aRel);
3639*cdf0e10cSrcweir 
3640*cdf0e10cSrcweir             // TODO/MBA: how can we get a BaseURL here?!
3641*cdf0e10cSrcweir             DBG_ERROR("No BaseURL!");
3642*cdf0e10cSrcweir             String aAbs = INetURLObject::GetAbsURL( String(), aRel );
3643*cdf0e10cSrcweir             DBG_ASSERT( aAbs.Len(), "Invalid URL!" );
3644*cdf0e10cSrcweir 			pStrLink = new String( aAbs );
3645*cdf0e10cSrcweir 		}
3646*cdf0e10cSrcweir 
3647*cdf0e10cSrcweir 		if ( nDoLoad & LOAD_FILTER )
3648*cdf0e10cSrcweir 		{
3649*cdf0e10cSrcweir 			pStrFilter = new String;
3650*cdf0e10cSrcweir 			// UNICODE: rStream >> *pStrFilter;
3651*cdf0e10cSrcweir 			rStream.ReadByteString(*pStrFilter);
3652*cdf0e10cSrcweir 		}
3653*cdf0e10cSrcweir 
3654*cdf0e10cSrcweir 		rStream >> nPos;
3655*cdf0e10cSrcweir 
3656*cdf0e10cSrcweir 		eGraphicPos = (SvxGraphicPosition)nPos;
3657*cdf0e10cSrcweir 	}
3658*cdf0e10cSrcweir }
3659*cdf0e10cSrcweir 
3660*cdf0e10cSrcweir // -----------------------------------------------------------------------
3661*cdf0e10cSrcweir 
3662*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) :
3663*cdf0e10cSrcweir 
3664*cdf0e10cSrcweir 	SfxPoolItem( rItem.Which() ),
3665*cdf0e10cSrcweir 
3666*cdf0e10cSrcweir 	pImpl		( new SvxBrushItem_Impl( NULL ) ),
3667*cdf0e10cSrcweir 	pStrLink	( NULL ),
3668*cdf0e10cSrcweir 	pStrFilter	( NULL ),
3669*cdf0e10cSrcweir 	eGraphicPos	( GPOS_NONE ),
3670*cdf0e10cSrcweir 	bLoadAgain	( sal_True )
3671*cdf0e10cSrcweir 
3672*cdf0e10cSrcweir {
3673*cdf0e10cSrcweir 	*this = rItem;
3674*cdf0e10cSrcweir }
3675*cdf0e10cSrcweir 
3676*cdf0e10cSrcweir // -----------------------------------------------------------------------
3677*cdf0e10cSrcweir 
3678*cdf0e10cSrcweir SvxBrushItem::~SvxBrushItem()
3679*cdf0e10cSrcweir {
3680*cdf0e10cSrcweir 	delete pImpl->pGraphicObject;
3681*cdf0e10cSrcweir 	delete pImpl;
3682*cdf0e10cSrcweir 	delete pStrLink;
3683*cdf0e10cSrcweir 	delete pStrFilter;
3684*cdf0e10cSrcweir }
3685*cdf0e10cSrcweir 
3686*cdf0e10cSrcweir // -----------------------------------------------------------------------
3687*cdf0e10cSrcweir 
3688*cdf0e10cSrcweir sal_uInt16 SvxBrushItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
3689*cdf0e10cSrcweir {
3690*cdf0e10cSrcweir 	return BRUSH_GRAPHIC_VERSION;
3691*cdf0e10cSrcweir }
3692*cdf0e10cSrcweir 
3693*cdf0e10cSrcweir // -----------------------------------------------------------------------
3694*cdf0e10cSrcweir inline sal_Int8 lcl_PercentToTransparency(long nPercent)
3695*cdf0e10cSrcweir {
3696*cdf0e10cSrcweir     //0xff must not be returned!
3697*cdf0e10cSrcweir     return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
3698*cdf0e10cSrcweir }
3699*cdf0e10cSrcweir inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans)
3700*cdf0e10cSrcweir {
3701*cdf0e10cSrcweir     return (sal_Int8)((nTrans * 100 + 127) / 254);
3702*cdf0e10cSrcweir }
3703*cdf0e10cSrcweir 
3704*cdf0e10cSrcweir sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
3705*cdf0e10cSrcweir {
3706*cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3707*cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
3708*cdf0e10cSrcweir 	switch( nMemberId)
3709*cdf0e10cSrcweir 	{
3710*cdf0e10cSrcweir 		case MID_BACK_COLOR:
3711*cdf0e10cSrcweir 			rVal <<= (sal_Int32)( aColor.GetColor() );
3712*cdf0e10cSrcweir 		break;
3713*cdf0e10cSrcweir         case MID_BACK_COLOR_R_G_B:
3714*cdf0e10cSrcweir             rVal <<= (sal_Int32)( aColor.GetRGBColor() );
3715*cdf0e10cSrcweir         break;
3716*cdf0e10cSrcweir         case MID_BACK_COLOR_TRANSPARENCY:
3717*cdf0e10cSrcweir             rVal <<= lcl_TransparencyToPercent(aColor.GetTransparency());
3718*cdf0e10cSrcweir         break;
3719*cdf0e10cSrcweir         case MID_GRAPHIC_POSITION:
3720*cdf0e10cSrcweir             rVal <<= (style::GraphicLocation)(sal_Int16)eGraphicPos;
3721*cdf0e10cSrcweir 		break;
3722*cdf0e10cSrcweir 
3723*cdf0e10cSrcweir 		case MID_GRAPHIC:
3724*cdf0e10cSrcweir 			DBG_ERRORFILE( "not implemented" );
3725*cdf0e10cSrcweir 		break;
3726*cdf0e10cSrcweir 
3727*cdf0e10cSrcweir 		case MID_GRAPHIC_TRANSPARENT:
3728*cdf0e10cSrcweir             rVal = Bool2Any( aColor.GetTransparency() == 0xff );
3729*cdf0e10cSrcweir 		break;
3730*cdf0e10cSrcweir 
3731*cdf0e10cSrcweir 		case MID_GRAPHIC_URL:
3732*cdf0e10cSrcweir 		{
3733*cdf0e10cSrcweir 			OUString sLink;
3734*cdf0e10cSrcweir 			if ( pStrLink )
3735*cdf0e10cSrcweir 				sLink = *pStrLink;
3736*cdf0e10cSrcweir 			else if( pImpl->pGraphicObject )
3737*cdf0e10cSrcweir 			{
3738*cdf0e10cSrcweir 				OUString sPrefix(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
3739*cdf0e10cSrcweir 				String sId( pImpl->pGraphicObject->GetUniqueID(),
3740*cdf0e10cSrcweir 							RTL_TEXTENCODING_ASCII_US );
3741*cdf0e10cSrcweir 				sLink = sPrefix;
3742*cdf0e10cSrcweir 			   	sLink += OUString(sId);
3743*cdf0e10cSrcweir 			}
3744*cdf0e10cSrcweir 			rVal <<= sLink;
3745*cdf0e10cSrcweir 		}
3746*cdf0e10cSrcweir 		break;
3747*cdf0e10cSrcweir 
3748*cdf0e10cSrcweir 		case MID_GRAPHIC_FILTER:
3749*cdf0e10cSrcweir 		{
3750*cdf0e10cSrcweir 			OUString sFilter;
3751*cdf0e10cSrcweir 			if ( pStrFilter )
3752*cdf0e10cSrcweir 				sFilter = *pStrFilter;
3753*cdf0e10cSrcweir 			rVal <<= sFilter;
3754*cdf0e10cSrcweir 		}
3755*cdf0e10cSrcweir 		break;
3756*cdf0e10cSrcweir         case MID_GRAPHIC_TRANSPARENCY :
3757*cdf0e10cSrcweir             rVal <<= pImpl->nGraphicTransparency;
3758*cdf0e10cSrcweir         break;
3759*cdf0e10cSrcweir 	}
3760*cdf0e10cSrcweir 
3761*cdf0e10cSrcweir 	return sal_True;
3762*cdf0e10cSrcweir }
3763*cdf0e10cSrcweir 
3764*cdf0e10cSrcweir // -----------------------------------------------------------------------
3765*cdf0e10cSrcweir 
3766*cdf0e10cSrcweir sal_Bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
3767*cdf0e10cSrcweir {
3768*cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3769*cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
3770*cdf0e10cSrcweir 	switch( nMemberId)
3771*cdf0e10cSrcweir 	{
3772*cdf0e10cSrcweir 		case MID_BACK_COLOR:
3773*cdf0e10cSrcweir         case MID_BACK_COLOR_R_G_B:
3774*cdf0e10cSrcweir         {
3775*cdf0e10cSrcweir 			sal_Int32 nCol = 0;
3776*cdf0e10cSrcweir 			if ( !( rVal >>= nCol ) )
3777*cdf0e10cSrcweir 				return sal_False;
3778*cdf0e10cSrcweir             if(MID_BACK_COLOR_R_G_B == nMemberId)
3779*cdf0e10cSrcweir             {
3780*cdf0e10cSrcweir                 nCol = COLORDATA_RGB( nCol );
3781*cdf0e10cSrcweir                 nCol += aColor.GetColor() & 0xff000000;
3782*cdf0e10cSrcweir             }
3783*cdf0e10cSrcweir             aColor = Color( nCol );
3784*cdf0e10cSrcweir 		}
3785*cdf0e10cSrcweir 		break;
3786*cdf0e10cSrcweir         case MID_BACK_COLOR_TRANSPARENCY:
3787*cdf0e10cSrcweir         {
3788*cdf0e10cSrcweir             sal_Int32 nTrans = 0;
3789*cdf0e10cSrcweir             if ( !( rVal >>= nTrans ) || nTrans < 0 || nTrans > 100 )
3790*cdf0e10cSrcweir 				return sal_False;
3791*cdf0e10cSrcweir             aColor.SetTransparency(lcl_PercentToTransparency(nTrans));
3792*cdf0e10cSrcweir         }
3793*cdf0e10cSrcweir         break;
3794*cdf0e10cSrcweir 
3795*cdf0e10cSrcweir 		case MID_GRAPHIC_POSITION:
3796*cdf0e10cSrcweir 		{
3797*cdf0e10cSrcweir 			style::GraphicLocation eLocation;
3798*cdf0e10cSrcweir 			if ( !( rVal>>=eLocation ) )
3799*cdf0e10cSrcweir 			{
3800*cdf0e10cSrcweir 				sal_Int32 nValue = 0;
3801*cdf0e10cSrcweir 				if ( !( rVal >>= nValue ) )
3802*cdf0e10cSrcweir 					return sal_False;
3803*cdf0e10cSrcweir 				eLocation = (style::GraphicLocation)nValue;
3804*cdf0e10cSrcweir 			}
3805*cdf0e10cSrcweir 			SetGraphicPos( (SvxGraphicPosition)(sal_uInt16)eLocation );
3806*cdf0e10cSrcweir 		}
3807*cdf0e10cSrcweir 		break;
3808*cdf0e10cSrcweir 
3809*cdf0e10cSrcweir 		case MID_GRAPHIC:
3810*cdf0e10cSrcweir 			DBG_ERRORFILE( "not implemented" );
3811*cdf0e10cSrcweir 		break;
3812*cdf0e10cSrcweir 
3813*cdf0e10cSrcweir 		case MID_GRAPHIC_TRANSPARENT:
3814*cdf0e10cSrcweir 			aColor.SetTransparency( Any2Bool( rVal ) ? 0xff : 0 );
3815*cdf0e10cSrcweir 		break;
3816*cdf0e10cSrcweir 
3817*cdf0e10cSrcweir 		case MID_GRAPHIC_URL:
3818*cdf0e10cSrcweir 		{
3819*cdf0e10cSrcweir 			if ( rVal.getValueType() == ::getCppuType( (OUString*)0 ) )
3820*cdf0e10cSrcweir 			{
3821*cdf0e10cSrcweir 				OUString sLink;
3822*cdf0e10cSrcweir 				rVal >>= sLink;
3823*cdf0e10cSrcweir 				if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX,
3824*cdf0e10cSrcweir 								  sizeof(UNO_NAME_GRAPHOBJ_URLPKGPREFIX)-1 ) )
3825*cdf0e10cSrcweir 				{
3826*cdf0e10cSrcweir 					DBG_ERROR( "package urls aren't implemented" );
3827*cdf0e10cSrcweir 				}
3828*cdf0e10cSrcweir 				else if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX,
3829*cdf0e10cSrcweir 								   sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1 ) )
3830*cdf0e10cSrcweir 				{
3831*cdf0e10cSrcweir 					DELETEZ( pStrLink );
3832*cdf0e10cSrcweir 					String sTmp( sLink );
3833*cdf0e10cSrcweir 					ByteString sId( sTmp.Copy(
3834*cdf0e10cSrcweir 										sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1),
3835*cdf0e10cSrcweir 									RTL_TEXTENCODING_ASCII_US );
3836*cdf0e10cSrcweir 					GraphicObject *pOldGrfObj = pImpl->pGraphicObject;
3837*cdf0e10cSrcweir 					pImpl->pGraphicObject = new GraphicObject( sId );
3838*cdf0e10cSrcweir                     ApplyGraphicTransparency_Impl();
3839*cdf0e10cSrcweir                     delete pOldGrfObj;
3840*cdf0e10cSrcweir 				}
3841*cdf0e10cSrcweir 				else
3842*cdf0e10cSrcweir 				{
3843*cdf0e10cSrcweir 					SetGraphicLink(sLink);
3844*cdf0e10cSrcweir 				}
3845*cdf0e10cSrcweir 				if ( sLink.getLength() && eGraphicPos == GPOS_NONE )
3846*cdf0e10cSrcweir 					eGraphicPos = GPOS_MM;
3847*cdf0e10cSrcweir 				else if( !sLink.getLength() )
3848*cdf0e10cSrcweir 					eGraphicPos = GPOS_NONE;
3849*cdf0e10cSrcweir 			}
3850*cdf0e10cSrcweir 		}
3851*cdf0e10cSrcweir 		break;
3852*cdf0e10cSrcweir 
3853*cdf0e10cSrcweir 		case MID_GRAPHIC_FILTER:
3854*cdf0e10cSrcweir 		{
3855*cdf0e10cSrcweir 			if( rVal.getValueType() == ::getCppuType( (OUString*)0 ) )
3856*cdf0e10cSrcweir 			{
3857*cdf0e10cSrcweir 				OUString sLink;
3858*cdf0e10cSrcweir 				rVal >>= sLink;
3859*cdf0e10cSrcweir 				SetGraphicFilter( sLink );
3860*cdf0e10cSrcweir 			}
3861*cdf0e10cSrcweir 		}
3862*cdf0e10cSrcweir 		break;
3863*cdf0e10cSrcweir         case MID_GRAPHIC_TRANSPARENCY :
3864*cdf0e10cSrcweir         {
3865*cdf0e10cSrcweir             sal_Int32 nTmp = 0;
3866*cdf0e10cSrcweir             rVal >>= nTmp;
3867*cdf0e10cSrcweir             if(nTmp >= 0 && nTmp <= 100)
3868*cdf0e10cSrcweir             {
3869*cdf0e10cSrcweir                 pImpl->nGraphicTransparency = sal_Int8(nTmp);
3870*cdf0e10cSrcweir                 if(pImpl->pGraphicObject)
3871*cdf0e10cSrcweir                     ApplyGraphicTransparency_Impl();
3872*cdf0e10cSrcweir             }
3873*cdf0e10cSrcweir         }
3874*cdf0e10cSrcweir         break;
3875*cdf0e10cSrcweir     }
3876*cdf0e10cSrcweir 
3877*cdf0e10cSrcweir 	return sal_True;
3878*cdf0e10cSrcweir }
3879*cdf0e10cSrcweir 
3880*cdf0e10cSrcweir // -----------------------------------------------------------------------
3881*cdf0e10cSrcweir 
3882*cdf0e10cSrcweir SfxItemPresentation SvxBrushItem::GetPresentation
3883*cdf0e10cSrcweir (
3884*cdf0e10cSrcweir 	SfxItemPresentation ePres,
3885*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
3886*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
3887*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
3888*cdf0e10cSrcweir     ) const
3889*cdf0e10cSrcweir {
3890*cdf0e10cSrcweir 	switch ( ePres )
3891*cdf0e10cSrcweir 	{
3892*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
3893*cdf0e10cSrcweir 			rText.Erase();
3894*cdf0e10cSrcweir 			return ePres;
3895*cdf0e10cSrcweir 
3896*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
3897*cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
3898*cdf0e10cSrcweir 		{
3899*cdf0e10cSrcweir 			if ( GPOS_NONE  == eGraphicPos )
3900*cdf0e10cSrcweir 			{
3901*cdf0e10cSrcweir 				rText = ::GetColorString( aColor );
3902*cdf0e10cSrcweir 				rText += cpDelim;
3903*cdf0e10cSrcweir 				sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE;
3904*cdf0e10cSrcweir 
3905*cdf0e10cSrcweir 				if ( aColor.GetTransparency() )
3906*cdf0e10cSrcweir 					nId = RID_SVXITEMS_TRANSPARENT_TRUE;
3907*cdf0e10cSrcweir 				rText += EE_RESSTR(nId);
3908*cdf0e10cSrcweir 			}
3909*cdf0e10cSrcweir 			else
3910*cdf0e10cSrcweir 			{
3911*cdf0e10cSrcweir 				rText = EE_RESSTR(RID_SVXITEMS_GRAPHIC);
3912*cdf0e10cSrcweir 			}
3913*cdf0e10cSrcweir 
3914*cdf0e10cSrcweir 			return ePres;
3915*cdf0e10cSrcweir 		}
3916*cdf0e10cSrcweir         default: ;//prevent warning
3917*cdf0e10cSrcweir     }
3918*cdf0e10cSrcweir 
3919*cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
3920*cdf0e10cSrcweir }
3921*cdf0e10cSrcweir 
3922*cdf0e10cSrcweir // -----------------------------------------------------------------------
3923*cdf0e10cSrcweir 
3924*cdf0e10cSrcweir SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
3925*cdf0e10cSrcweir {
3926*cdf0e10cSrcweir 	aColor = rItem.aColor;
3927*cdf0e10cSrcweir 	eGraphicPos = rItem.eGraphicPos;
3928*cdf0e10cSrcweir 
3929*cdf0e10cSrcweir 	DELETEZ( pImpl->pGraphicObject );
3930*cdf0e10cSrcweir 	DELETEZ( pStrLink );
3931*cdf0e10cSrcweir 	DELETEZ( pStrFilter );
3932*cdf0e10cSrcweir 
3933*cdf0e10cSrcweir 	if ( GPOS_NONE != eGraphicPos )
3934*cdf0e10cSrcweir 	{
3935*cdf0e10cSrcweir 		if ( rItem.pStrLink )
3936*cdf0e10cSrcweir 			pStrLink = new String( *rItem.pStrLink );
3937*cdf0e10cSrcweir 		if ( rItem.pStrFilter )
3938*cdf0e10cSrcweir 			pStrFilter = new String( *rItem.pStrFilter );
3939*cdf0e10cSrcweir 		if ( rItem.pImpl->pGraphicObject )
3940*cdf0e10cSrcweir         {
3941*cdf0e10cSrcweir 			pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject );
3942*cdf0e10cSrcweir         }
3943*cdf0e10cSrcweir 	}
3944*cdf0e10cSrcweir     pImpl->nGraphicTransparency = rItem.pImpl->nGraphicTransparency;
3945*cdf0e10cSrcweir 	return *this;
3946*cdf0e10cSrcweir }
3947*cdf0e10cSrcweir 
3948*cdf0e10cSrcweir // -----------------------------------------------------------------------
3949*cdf0e10cSrcweir 
3950*cdf0e10cSrcweir int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
3951*cdf0e10cSrcweir {
3952*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
3953*cdf0e10cSrcweir 
3954*cdf0e10cSrcweir 	SvxBrushItem& rCmp = (SvxBrushItem&)rAttr;
3955*cdf0e10cSrcweir     sal_Bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos &&
3956*cdf0e10cSrcweir         pImpl->nGraphicTransparency == rCmp.pImpl->nGraphicTransparency);
3957*cdf0e10cSrcweir 
3958*cdf0e10cSrcweir 	if ( bEqual )
3959*cdf0e10cSrcweir 	{
3960*cdf0e10cSrcweir 		if ( GPOS_NONE != eGraphicPos )
3961*cdf0e10cSrcweir 		{
3962*cdf0e10cSrcweir 			if ( !rCmp.pStrLink )
3963*cdf0e10cSrcweir 				bEqual = !pStrLink;
3964*cdf0e10cSrcweir 			else
3965*cdf0e10cSrcweir 				bEqual = pStrLink && ( *pStrLink == *rCmp.pStrLink );
3966*cdf0e10cSrcweir 
3967*cdf0e10cSrcweir 			if ( bEqual )
3968*cdf0e10cSrcweir 			{
3969*cdf0e10cSrcweir 				if ( !rCmp.pStrFilter )
3970*cdf0e10cSrcweir 					bEqual = !pStrFilter;
3971*cdf0e10cSrcweir 				else
3972*cdf0e10cSrcweir 					bEqual = pStrFilter && ( *pStrFilter == *rCmp.pStrFilter );
3973*cdf0e10cSrcweir 			}
3974*cdf0e10cSrcweir 
3975*cdf0e10cSrcweir 			if ( bEqual && !rCmp.pStrLink )
3976*cdf0e10cSrcweir 			{
3977*cdf0e10cSrcweir 				if ( !rCmp.pImpl->pGraphicObject )
3978*cdf0e10cSrcweir 					bEqual = !pImpl->pGraphicObject;
3979*cdf0e10cSrcweir 				else
3980*cdf0e10cSrcweir 					bEqual = pImpl->pGraphicObject &&
3981*cdf0e10cSrcweir                              ( *pImpl->pGraphicObject == *rCmp.pImpl->pGraphicObject );
3982*cdf0e10cSrcweir 			}
3983*cdf0e10cSrcweir 		}
3984*cdf0e10cSrcweir 	}
3985*cdf0e10cSrcweir 
3986*cdf0e10cSrcweir 	return bEqual;
3987*cdf0e10cSrcweir }
3988*cdf0e10cSrcweir 
3989*cdf0e10cSrcweir // -----------------------------------------------------------------------
3990*cdf0e10cSrcweir 
3991*cdf0e10cSrcweir SfxPoolItem* SvxBrushItem::Clone( SfxItemPool* ) const
3992*cdf0e10cSrcweir {
3993*cdf0e10cSrcweir 	return new SvxBrushItem( *this );
3994*cdf0e10cSrcweir }
3995*cdf0e10cSrcweir 
3996*cdf0e10cSrcweir // -----------------------------------------------------------------------
3997*cdf0e10cSrcweir 
3998*cdf0e10cSrcweir SfxPoolItem* SvxBrushItem::Create( SvStream& rStream, sal_uInt16 nVersion ) const
3999*cdf0e10cSrcweir {
4000*cdf0e10cSrcweir 	return new SvxBrushItem( rStream, nVersion, Which() );
4001*cdf0e10cSrcweir }
4002*cdf0e10cSrcweir 
4003*cdf0e10cSrcweir // -----------------------------------------------------------------------
4004*cdf0e10cSrcweir 
4005*cdf0e10cSrcweir SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) const
4006*cdf0e10cSrcweir {
4007*cdf0e10cSrcweir 	rStream << (sal_Bool)sal_False;
4008*cdf0e10cSrcweir 	rStream << aColor;
4009*cdf0e10cSrcweir 	rStream << aColor;
4010*cdf0e10cSrcweir 	rStream << (sal_Int8)(aColor.GetTransparency() > 0 ? 0 : 1); //BRUSH_NULL : BRUSH_SOLID
4011*cdf0e10cSrcweir 
4012*cdf0e10cSrcweir 	sal_uInt16 nDoLoad = 0;
4013*cdf0e10cSrcweir 
4014*cdf0e10cSrcweir 	if ( pImpl->pGraphicObject && !pStrLink )
4015*cdf0e10cSrcweir 		nDoLoad |= LOAD_GRAPHIC;
4016*cdf0e10cSrcweir 	if ( pStrLink )
4017*cdf0e10cSrcweir 		nDoLoad |= LOAD_LINK;
4018*cdf0e10cSrcweir 	if ( pStrFilter )
4019*cdf0e10cSrcweir 		nDoLoad |= LOAD_FILTER;
4020*cdf0e10cSrcweir 	rStream << nDoLoad;
4021*cdf0e10cSrcweir 
4022*cdf0e10cSrcweir 	if ( pImpl->pGraphicObject && !pStrLink )
4023*cdf0e10cSrcweir 		rStream << pImpl->pGraphicObject->GetGraphic();
4024*cdf0e10cSrcweir 	if ( pStrLink )
4025*cdf0e10cSrcweir 	{
4026*cdf0e10cSrcweir         DBG_ERROR("No BaseURL!");
4027*cdf0e10cSrcweir         // TODO/MBA: how to get a BaseURL?!
4028*cdf0e10cSrcweir         String aRel = INetURLObject::GetRelURL( String(), *pStrLink );
4029*cdf0e10cSrcweir 		// UNICODE: rStream << aRel;
4030*cdf0e10cSrcweir 		rStream.WriteByteString(aRel);
4031*cdf0e10cSrcweir 	}
4032*cdf0e10cSrcweir 	if ( pStrFilter )
4033*cdf0e10cSrcweir 	{
4034*cdf0e10cSrcweir 		// UNICODE: rStream << *pStrFilter;
4035*cdf0e10cSrcweir 		rStream.WriteByteString(*pStrFilter);
4036*cdf0e10cSrcweir 	}
4037*cdf0e10cSrcweir 	rStream << (sal_Int8)eGraphicPos;
4038*cdf0e10cSrcweir 	return rStream;
4039*cdf0e10cSrcweir }
4040*cdf0e10cSrcweir 
4041*cdf0e10cSrcweir // -----------------------------------------------------------------------
4042*cdf0e10cSrcweir // const wegcasten, da const als logisches const zu verstehen ist
4043*cdf0e10cSrcweir // wenn GetGraphic() gerufen wird, soll sich das Item darum kuemmern,
4044*cdf0e10cSrcweir // eine gelinkte Grafik zu holen.
4045*cdf0e10cSrcweir // -----------------------------------------------------------------------
4046*cdf0e10cSrcweir 
4047*cdf0e10cSrcweir void SvxBrushItem::PurgeGraphic() const
4048*cdf0e10cSrcweir {
4049*cdf0e10cSrcweir 	PurgeMedium();
4050*cdf0e10cSrcweir 	DELETEZ( pImpl->pGraphicObject );
4051*cdf0e10cSrcweir 	((SvxBrushItem*)this)->bLoadAgain = sal_True;
4052*cdf0e10cSrcweir }
4053*cdf0e10cSrcweir 
4054*cdf0e10cSrcweir // -----------------------------------------------------------------------
4055*cdf0e10cSrcweir 
4056*cdf0e10cSrcweir void SvxBrushItem::PurgeMedium() const
4057*cdf0e10cSrcweir {
4058*cdf0e10cSrcweir 	DELETEZ( pImpl->pStream );
4059*cdf0e10cSrcweir }
4060*cdf0e10cSrcweir 
4061*cdf0e10cSrcweir // -----------------------------------------------------------------------
4062*cdf0e10cSrcweir const GraphicObject* SvxBrushItem::GetGraphicObject() const
4063*cdf0e10cSrcweir {
4064*cdf0e10cSrcweir 	if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject )
4065*cdf0e10cSrcweir 	// wenn Grafik schon geladen, als Cache benutzen
4066*cdf0e10cSrcweir 	{
4067*cdf0e10cSrcweir         //JP 29.6.2001: only with "valid" names - empty names now allowed
4068*cdf0e10cSrcweir 		if( pStrLink->Len() )
4069*cdf0e10cSrcweir 		{
4070*cdf0e10cSrcweir 			// currently we don't have asynchronous processing
4071*cdf0e10cSrcweir /*			if( pImpl->aDoneLink.IsSet() )
4072*cdf0e10cSrcweir 			{
4073*cdf0e10cSrcweir 				// Auf besonderen Wunsch des Writers wird der synchrone und der
4074*cdf0e10cSrcweir 				// asynchrone Fall was die Benachrichtigung angeht unterschiedlich
4075*cdf0e10cSrcweir 				// behandelt. Der Callback erfolgt nur bei asynchronem Eintreffen
4076*cdf0e10cSrcweir 				// der Daten
4077*cdf0e10cSrcweir 
4078*cdf0e10cSrcweir 				Link aTmp = pImpl->aDoneLink;
4079*cdf0e10cSrcweir 				pImpl->aDoneLink = Link();
4080*cdf0e10cSrcweir 				pImpl->xMedium->DownLoad(
4081*cdf0e10cSrcweir 					STATIC_LINK( this, SvxBrushItem, DoneHdl_Impl ) );
4082*cdf0e10cSrcweir 				pImpl->aDoneLink = aTmp;
4083*cdf0e10cSrcweir 			} */
4084*cdf0e10cSrcweir 
4085*cdf0e10cSrcweir 			pImpl->pStream = utl::UcbStreamHelper::CreateStream( *pStrLink, STREAM_STD_READ );
4086*cdf0e10cSrcweir 			if( pImpl->pStream && !pImpl->pStream->GetError() )
4087*cdf0e10cSrcweir 			{
4088*cdf0e10cSrcweir 				Graphic aGraphic;
4089*cdf0e10cSrcweir 				int	nRes;
4090*cdf0e10cSrcweir 				pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN );
4091*cdf0e10cSrcweir 				nRes = GraphicFilter::GetGraphicFilter()->
4092*cdf0e10cSrcweir 					ImportGraphic( aGraphic, *pStrLink, *pImpl->pStream,
4093*cdf0e10cSrcweir 							       GRFILTER_FORMAT_DONTKNOW, NULL, GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG );
4094*cdf0e10cSrcweir 
4095*cdf0e10cSrcweir 				if( nRes != GRFILTER_OK )
4096*cdf0e10cSrcweir 				{
4097*cdf0e10cSrcweir 					const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
4098*cdf0e10cSrcweir 				}
4099*cdf0e10cSrcweir 				else
4100*cdf0e10cSrcweir 				{
4101*cdf0e10cSrcweir 					pImpl->pGraphicObject = new GraphicObject;
4102*cdf0e10cSrcweir 					pImpl->pGraphicObject->SetGraphic( aGraphic );
4103*cdf0e10cSrcweir 				    const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
4104*cdf0e10cSrcweir 				}
4105*cdf0e10cSrcweir 			}
4106*cdf0e10cSrcweir 			else
4107*cdf0e10cSrcweir 			{
4108*cdf0e10cSrcweir 				const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
4109*cdf0e10cSrcweir 			}
4110*cdf0e10cSrcweir 
4111*cdf0e10cSrcweir 			// currently we don't have asynchronous processing
4112*cdf0e10cSrcweir //			pThis->pImpl->aDoneLink.Call( pThis );
4113*cdf0e10cSrcweir 		}
4114*cdf0e10cSrcweir 	}
4115*cdf0e10cSrcweir 
4116*cdf0e10cSrcweir 	return pImpl->pGraphicObject;
4117*cdf0e10cSrcweir }
4118*cdf0e10cSrcweir 
4119*cdf0e10cSrcweir // -----------------------------------------------------------------------
4120*cdf0e10cSrcweir 
4121*cdf0e10cSrcweir const Graphic* SvxBrushItem::GetGraphic() const
4122*cdf0e10cSrcweir {
4123*cdf0e10cSrcweir 	const GraphicObject* pGrafObj = GetGraphicObject();
4124*cdf0e10cSrcweir 	return( pGrafObj ? &( pGrafObj->GetGraphic() ) : NULL );
4125*cdf0e10cSrcweir }
4126*cdf0e10cSrcweir 
4127*cdf0e10cSrcweir // -----------------------------------------------------------------------
4128*cdf0e10cSrcweir 
4129*cdf0e10cSrcweir void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
4130*cdf0e10cSrcweir {
4131*cdf0e10cSrcweir 	eGraphicPos = eNew;
4132*cdf0e10cSrcweir 
4133*cdf0e10cSrcweir 	if ( GPOS_NONE == eGraphicPos )
4134*cdf0e10cSrcweir 	{
4135*cdf0e10cSrcweir 		DELETEZ( pImpl->pGraphicObject );
4136*cdf0e10cSrcweir 		DELETEZ( pStrLink );
4137*cdf0e10cSrcweir 		DELETEZ( pStrFilter );
4138*cdf0e10cSrcweir 	}
4139*cdf0e10cSrcweir 	else
4140*cdf0e10cSrcweir 	{
4141*cdf0e10cSrcweir 		if ( !pImpl->pGraphicObject && !pStrLink )
4142*cdf0e10cSrcweir 		{
4143*cdf0e10cSrcweir 			pImpl->pGraphicObject = new GraphicObject; // dummy anlegen
4144*cdf0e10cSrcweir 		}
4145*cdf0e10cSrcweir 	}
4146*cdf0e10cSrcweir }
4147*cdf0e10cSrcweir 
4148*cdf0e10cSrcweir // -----------------------------------------------------------------------
4149*cdf0e10cSrcweir 
4150*cdf0e10cSrcweir void SvxBrushItem::SetGraphic( const Graphic& rNew )
4151*cdf0e10cSrcweir {
4152*cdf0e10cSrcweir 	if ( !pStrLink )
4153*cdf0e10cSrcweir 	{
4154*cdf0e10cSrcweir 		if ( pImpl->pGraphicObject )
4155*cdf0e10cSrcweir 			pImpl->pGraphicObject->SetGraphic( rNew );
4156*cdf0e10cSrcweir 		else
4157*cdf0e10cSrcweir 			pImpl->pGraphicObject = new GraphicObject( rNew );
4158*cdf0e10cSrcweir 
4159*cdf0e10cSrcweir         ApplyGraphicTransparency_Impl();
4160*cdf0e10cSrcweir 
4161*cdf0e10cSrcweir         if ( GPOS_NONE == eGraphicPos )
4162*cdf0e10cSrcweir 			eGraphicPos = GPOS_MM; // None waere Brush, also Default: Mitte
4163*cdf0e10cSrcweir 	}
4164*cdf0e10cSrcweir 	else
4165*cdf0e10cSrcweir 	{
4166*cdf0e10cSrcweir 		DBG_ERROR( "SetGraphic() on linked graphic! :-/" );
4167*cdf0e10cSrcweir 	}
4168*cdf0e10cSrcweir }
4169*cdf0e10cSrcweir 
4170*cdf0e10cSrcweir // -----------------------------------------------------------------------
4171*cdf0e10cSrcweir 
4172*cdf0e10cSrcweir void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
4173*cdf0e10cSrcweir {
4174*cdf0e10cSrcweir 	if ( !pStrLink )
4175*cdf0e10cSrcweir 	{
4176*cdf0e10cSrcweir 		if ( pImpl->pGraphicObject )
4177*cdf0e10cSrcweir 			*pImpl->pGraphicObject = rNewObj;
4178*cdf0e10cSrcweir 		else
4179*cdf0e10cSrcweir 			pImpl->pGraphicObject = new GraphicObject( rNewObj );
4180*cdf0e10cSrcweir 
4181*cdf0e10cSrcweir         ApplyGraphicTransparency_Impl();
4182*cdf0e10cSrcweir 
4183*cdf0e10cSrcweir         if ( GPOS_NONE == eGraphicPos )
4184*cdf0e10cSrcweir 			eGraphicPos = GPOS_MM; // None waere Brush, also Default: Mitte
4185*cdf0e10cSrcweir 	}
4186*cdf0e10cSrcweir 	else
4187*cdf0e10cSrcweir 	{
4188*cdf0e10cSrcweir 		DBG_ERROR( "SetGraphic() on linked graphic! :-/" );
4189*cdf0e10cSrcweir 	}
4190*cdf0e10cSrcweir }
4191*cdf0e10cSrcweir 
4192*cdf0e10cSrcweir // -----------------------------------------------------------------------
4193*cdf0e10cSrcweir 
4194*cdf0e10cSrcweir void SvxBrushItem::SetGraphicLink( const String& rNew )
4195*cdf0e10cSrcweir {
4196*cdf0e10cSrcweir 	if ( !rNew.Len() )
4197*cdf0e10cSrcweir 		DELETEZ( pStrLink );
4198*cdf0e10cSrcweir 	else
4199*cdf0e10cSrcweir 	{
4200*cdf0e10cSrcweir 		if ( pStrLink )
4201*cdf0e10cSrcweir 			*pStrLink = rNew;
4202*cdf0e10cSrcweir 		else
4203*cdf0e10cSrcweir 			pStrLink = new String( rNew );
4204*cdf0e10cSrcweir 
4205*cdf0e10cSrcweir 		DELETEZ( pImpl->pGraphicObject );
4206*cdf0e10cSrcweir 	}
4207*cdf0e10cSrcweir }
4208*cdf0e10cSrcweir 
4209*cdf0e10cSrcweir // -----------------------------------------------------------------------
4210*cdf0e10cSrcweir 
4211*cdf0e10cSrcweir void SvxBrushItem::SetGraphicFilter( const String& rNew )
4212*cdf0e10cSrcweir {
4213*cdf0e10cSrcweir 	if ( !rNew.Len() )
4214*cdf0e10cSrcweir 		DELETEZ( pStrFilter );
4215*cdf0e10cSrcweir 	else
4216*cdf0e10cSrcweir 	{
4217*cdf0e10cSrcweir 		if ( pStrFilter )
4218*cdf0e10cSrcweir 			*pStrFilter = rNew;
4219*cdf0e10cSrcweir 		else
4220*cdf0e10cSrcweir 			pStrFilter = new String( rNew );
4221*cdf0e10cSrcweir 	}
4222*cdf0e10cSrcweir }
4223*cdf0e10cSrcweir 
4224*cdf0e10cSrcweir //static
4225*cdf0e10cSrcweir SvxGraphicPosition SvxBrushItem::WallpaperStyle2GraphicPos( WallpaperStyle eStyle )
4226*cdf0e10cSrcweir {
4227*cdf0e10cSrcweir 	SvxGraphicPosition eResult;
4228*cdf0e10cSrcweir 	// der Switch ist nicht der schnellste, dafuer aber am sichersten
4229*cdf0e10cSrcweir 	switch( eStyle )
4230*cdf0e10cSrcweir 	{
4231*cdf0e10cSrcweir 		case WALLPAPER_NULL: eResult = GPOS_NONE; break;
4232*cdf0e10cSrcweir 		case WALLPAPER_TILE: eResult = GPOS_TILED; break;
4233*cdf0e10cSrcweir 		case WALLPAPER_CENTER: eResult = GPOS_MM; break;
4234*cdf0e10cSrcweir 		case WALLPAPER_SCALE: eResult = GPOS_AREA; break;
4235*cdf0e10cSrcweir 		case WALLPAPER_TOPLEFT: eResult = GPOS_LT; break;
4236*cdf0e10cSrcweir 		case WALLPAPER_TOP: eResult = GPOS_MT; break;
4237*cdf0e10cSrcweir 		case WALLPAPER_TOPRIGHT: eResult = GPOS_RT; break;
4238*cdf0e10cSrcweir 		case WALLPAPER_LEFT: eResult = GPOS_LM; break;
4239*cdf0e10cSrcweir 		case WALLPAPER_RIGHT: eResult = GPOS_RM; break;
4240*cdf0e10cSrcweir 		case WALLPAPER_BOTTOMLEFT: eResult = GPOS_LB; break;
4241*cdf0e10cSrcweir 		case WALLPAPER_BOTTOM: eResult = GPOS_MB; break;
4242*cdf0e10cSrcweir 		case WALLPAPER_BOTTOMRIGHT: eResult = GPOS_RB; break;
4243*cdf0e10cSrcweir 		default: eResult = GPOS_NONE;
4244*cdf0e10cSrcweir 	}
4245*cdf0e10cSrcweir 	return eResult;
4246*cdf0e10cSrcweir };
4247*cdf0e10cSrcweir 
4248*cdf0e10cSrcweir //static
4249*cdf0e10cSrcweir WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos )
4250*cdf0e10cSrcweir {
4251*cdf0e10cSrcweir 	WallpaperStyle eResult;
4252*cdf0e10cSrcweir 	switch( ePos )
4253*cdf0e10cSrcweir 	{
4254*cdf0e10cSrcweir 		case GPOS_NONE: eResult = WALLPAPER_NULL; break;
4255*cdf0e10cSrcweir 		case GPOS_TILED: eResult = WALLPAPER_TILE; break;
4256*cdf0e10cSrcweir 		case GPOS_MM: eResult = WALLPAPER_CENTER; break;
4257*cdf0e10cSrcweir 		case GPOS_AREA: eResult = WALLPAPER_SCALE; break;
4258*cdf0e10cSrcweir 		case GPOS_LT: eResult = WALLPAPER_TOPLEFT; break;
4259*cdf0e10cSrcweir 		case GPOS_MT: eResult = WALLPAPER_TOP; break;
4260*cdf0e10cSrcweir 		case GPOS_RT: eResult = WALLPAPER_TOPRIGHT; break;
4261*cdf0e10cSrcweir 		case GPOS_LM: eResult = WALLPAPER_LEFT; break;
4262*cdf0e10cSrcweir 		case GPOS_RM: eResult = WALLPAPER_RIGHT; break;
4263*cdf0e10cSrcweir 		case GPOS_LB: eResult = WALLPAPER_BOTTOMLEFT; break;
4264*cdf0e10cSrcweir 		case GPOS_MB: eResult = WALLPAPER_BOTTOM; break;
4265*cdf0e10cSrcweir 		case GPOS_RB: eResult = WALLPAPER_BOTTOMRIGHT; break;
4266*cdf0e10cSrcweir 		default: eResult = WALLPAPER_NULL;
4267*cdf0e10cSrcweir 	}
4268*cdf0e10cSrcweir 	return eResult;
4269*cdf0e10cSrcweir }
4270*cdf0e10cSrcweir 
4271*cdf0e10cSrcweir 
4272*cdf0e10cSrcweir SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich ) :
4273*cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
4274*cdf0e10cSrcweir 	pImpl( new SvxBrushItem_Impl( 0 ) ),
4275*cdf0e10cSrcweir     pStrLink(0),
4276*cdf0e10cSrcweir     pStrFilter(0),
4277*cdf0e10cSrcweir     bLoadAgain( sal_True )
4278*cdf0e10cSrcweir {
4279*cdf0e10cSrcweir 	aColor = rItem.GetColor();
4280*cdf0e10cSrcweir 
4281*cdf0e10cSrcweir 	if( rItem.GetBitmapURL().Len() )
4282*cdf0e10cSrcweir 	{
4283*cdf0e10cSrcweir 		pStrLink	= new String( rItem.GetBitmapURL() );
4284*cdf0e10cSrcweir 		SetGraphicPos( WallpaperStyle2GraphicPos((WallpaperStyle)rItem.GetStyle() ) );
4285*cdf0e10cSrcweir 	}
4286*cdf0e10cSrcweir }
4287*cdf0e10cSrcweir 
4288*cdf0e10cSrcweir CntWallpaperItem* SvxBrushItem::CreateCntWallpaperItem() const
4289*cdf0e10cSrcweir {
4290*cdf0e10cSrcweir 	CntWallpaperItem* pItem = new CntWallpaperItem( 0 );
4291*cdf0e10cSrcweir 	pItem->SetColor( aColor.GetColor() );
4292*cdf0e10cSrcweir 	pItem->SetStyle( (sal_uInt16)GraphicPos2WallpaperStyle( GetGraphicPos() ) );
4293*cdf0e10cSrcweir 	sal_Bool bLink = (pStrLink != 0);
4294*cdf0e10cSrcweir 	if( bLink )
4295*cdf0e10cSrcweir 	{
4296*cdf0e10cSrcweir 		String aURL = *pStrLink;
4297*cdf0e10cSrcweir 		pItem->SetBitmapURL( aURL );
4298*cdf0e10cSrcweir 	}
4299*cdf0e10cSrcweir 	if( pImpl->pGraphicObject )
4300*cdf0e10cSrcweir     {
4301*cdf0e10cSrcweir 		DBG_ERRORFILE( "Don't know what to do with a graphic" );
4302*cdf0e10cSrcweir     }
4303*cdf0e10cSrcweir //		pItem->SetGraphic( *pImpl->pGraphic, bLink );
4304*cdf0e10cSrcweir 
4305*cdf0e10cSrcweir 	return pItem;
4306*cdf0e10cSrcweir }
4307*cdf0e10cSrcweir 
4308*cdf0e10cSrcweir #ifdef _MSC_VER
4309*cdf0e10cSrcweir #pragma optimize ( "", on )
4310*cdf0e10cSrcweir #endif
4311*cdf0e10cSrcweir /* -----------------------------16.08.2002 09:18------------------------------
4312*cdf0e10cSrcweir 
4313*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
4314*cdf0e10cSrcweir void  SvxBrushItem::ApplyGraphicTransparency_Impl()
4315*cdf0e10cSrcweir {
4316*cdf0e10cSrcweir     DBG_ASSERT(pImpl->pGraphicObject, "no GraphicObject available" );
4317*cdf0e10cSrcweir     if(pImpl->pGraphicObject)
4318*cdf0e10cSrcweir     {
4319*cdf0e10cSrcweir         GraphicAttr aAttr(pImpl->pGraphicObject->GetAttr());
4320*cdf0e10cSrcweir         aAttr.SetTransparency(lcl_PercentToTransparency(
4321*cdf0e10cSrcweir                             pImpl->nGraphicTransparency));
4322*cdf0e10cSrcweir         pImpl->pGraphicObject->SetAttr(aAttr);
4323*cdf0e10cSrcweir     }
4324*cdf0e10cSrcweir }
4325*cdf0e10cSrcweir // class SvxFrameDirectionItem ----------------------------------------------
4326*cdf0e10cSrcweir 
4327*cdf0e10cSrcweir SvxFrameDirectionItem::SvxFrameDirectionItem( sal_uInt16 _nWhich )
4328*cdf0e10cSrcweir     : SfxUInt16Item( _nWhich, (sal_uInt16)FRMDIR_HORI_LEFT_TOP )
4329*cdf0e10cSrcweir {
4330*cdf0e10cSrcweir }
4331*cdf0e10cSrcweir 
4332*cdf0e10cSrcweir SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue ,
4333*cdf0e10cSrcweir                                             sal_uInt16 _nWhich )
4334*cdf0e10cSrcweir     : SfxUInt16Item( _nWhich, (sal_uInt16)nValue )
4335*cdf0e10cSrcweir {
4336*cdf0e10cSrcweir }
4337*cdf0e10cSrcweir 
4338*cdf0e10cSrcweir SvxFrameDirectionItem::~SvxFrameDirectionItem()
4339*cdf0e10cSrcweir {
4340*cdf0e10cSrcweir }
4341*cdf0e10cSrcweir 
4342*cdf0e10cSrcweir int SvxFrameDirectionItem::operator==( const SfxPoolItem& rCmp ) const
4343*cdf0e10cSrcweir {
4344*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
4345*cdf0e10cSrcweir 
4346*cdf0e10cSrcweir 	return GetValue() == ((SvxFrameDirectionItem&)rCmp).GetValue();
4347*cdf0e10cSrcweir }
4348*cdf0e10cSrcweir 
4349*cdf0e10cSrcweir SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const
4350*cdf0e10cSrcweir {
4351*cdf0e10cSrcweir 	return new SvxFrameDirectionItem( *this );
4352*cdf0e10cSrcweir }
4353*cdf0e10cSrcweir 
4354*cdf0e10cSrcweir SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/ ) const
4355*cdf0e10cSrcweir {
4356*cdf0e10cSrcweir 	sal_uInt16 nValue;
4357*cdf0e10cSrcweir 	rStrm >> nValue;
4358*cdf0e10cSrcweir 	return new SvxFrameDirectionItem( (SvxFrameDirection)nValue, Which() );
4359*cdf0e10cSrcweir }
4360*cdf0e10cSrcweir 
4361*cdf0e10cSrcweir SvStream& SvxFrameDirectionItem::Store( SvStream & rStrm, sal_uInt16 /*nIVer*/ ) const
4362*cdf0e10cSrcweir {
4363*cdf0e10cSrcweir 	sal_uInt16 nValue = GetValue();
4364*cdf0e10cSrcweir 	rStrm << nValue;
4365*cdf0e10cSrcweir 	return rStrm;
4366*cdf0e10cSrcweir }
4367*cdf0e10cSrcweir 
4368*cdf0e10cSrcweir sal_uInt16 SvxFrameDirectionItem::GetVersion( sal_uInt16 nFVer ) const
4369*cdf0e10cSrcweir {
4370*cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_50 > nFVer ? USHRT_MAX : 0;
4371*cdf0e10cSrcweir }
4372*cdf0e10cSrcweir 
4373*cdf0e10cSrcweir SfxItemPresentation SvxFrameDirectionItem::GetPresentation(
4374*cdf0e10cSrcweir 	SfxItemPresentation ePres,
4375*cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
4376*cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
4377*cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *) const
4378*cdf0e10cSrcweir {
4379*cdf0e10cSrcweir 	SfxItemPresentation eRet = ePres;
4380*cdf0e10cSrcweir     switch( ePres )
4381*cdf0e10cSrcweir     {
4382*cdf0e10cSrcweir     case SFX_ITEM_PRESENTATION_NONE:
4383*cdf0e10cSrcweir         rText.Erase();
4384*cdf0e10cSrcweir 		break;
4385*cdf0e10cSrcweir 
4386*cdf0e10cSrcweir     case SFX_ITEM_PRESENTATION_NAMELESS:
4387*cdf0e10cSrcweir     case SFX_ITEM_PRESENTATION_COMPLETE:
4388*cdf0e10cSrcweir 		rText = EE_RESSTR( RID_SVXITEMS_FRMDIR_BEGIN + GetValue() );
4389*cdf0e10cSrcweir 		break;
4390*cdf0e10cSrcweir 
4391*cdf0e10cSrcweir 	default:
4392*cdf0e10cSrcweir 		eRet = SFX_ITEM_PRESENTATION_NONE;
4393*cdf0e10cSrcweir     }
4394*cdf0e10cSrcweir     return eRet;
4395*cdf0e10cSrcweir }
4396*cdf0e10cSrcweir 
4397*cdf0e10cSrcweir sal_Bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal,
4398*cdf0e10cSrcweir 		 									sal_uInt8 )
4399*cdf0e10cSrcweir {
4400*cdf0e10cSrcweir     sal_Int16 nVal = sal_Int16();
4401*cdf0e10cSrcweir     sal_Bool bRet = ( rVal >>= nVal );
4402*cdf0e10cSrcweir     if( bRet )
4403*cdf0e10cSrcweir     {
4404*cdf0e10cSrcweir         // translate WritingDirection2 constants into SvxFrameDirection
4405*cdf0e10cSrcweir         switch( nVal )
4406*cdf0e10cSrcweir         {
4407*cdf0e10cSrcweir             case text::WritingMode2::LR_TB:
4408*cdf0e10cSrcweir                 SetValue( FRMDIR_HORI_LEFT_TOP );
4409*cdf0e10cSrcweir                 break;
4410*cdf0e10cSrcweir             case text::WritingMode2::RL_TB:
4411*cdf0e10cSrcweir                 SetValue( FRMDIR_HORI_RIGHT_TOP );
4412*cdf0e10cSrcweir                 break;
4413*cdf0e10cSrcweir             case text::WritingMode2::TB_RL:
4414*cdf0e10cSrcweir                 SetValue( FRMDIR_VERT_TOP_RIGHT );
4415*cdf0e10cSrcweir                 break;
4416*cdf0e10cSrcweir             case text::WritingMode2::TB_LR:
4417*cdf0e10cSrcweir                 SetValue( FRMDIR_VERT_TOP_LEFT );
4418*cdf0e10cSrcweir                 break;
4419*cdf0e10cSrcweir             case text::WritingMode2::PAGE:
4420*cdf0e10cSrcweir                 SetValue( FRMDIR_ENVIRONMENT );
4421*cdf0e10cSrcweir                 break;
4422*cdf0e10cSrcweir             default:
4423*cdf0e10cSrcweir                 bRet = sal_False;
4424*cdf0e10cSrcweir                 break;
4425*cdf0e10cSrcweir         }
4426*cdf0e10cSrcweir     }
4427*cdf0e10cSrcweir 
4428*cdf0e10cSrcweir 	return bRet;
4429*cdf0e10cSrcweir }
4430*cdf0e10cSrcweir 
4431*cdf0e10cSrcweir sal_Bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal,
4432*cdf0e10cSrcweir 											sal_uInt8 ) const
4433*cdf0e10cSrcweir {
4434*cdf0e10cSrcweir     // translate SvxFrameDirection into WritingDirection2
4435*cdf0e10cSrcweir     sal_Int16 nVal;
4436*cdf0e10cSrcweir     sal_Bool bRet = sal_True;
4437*cdf0e10cSrcweir     switch( GetValue() )
4438*cdf0e10cSrcweir     {
4439*cdf0e10cSrcweir         case FRMDIR_HORI_LEFT_TOP:
4440*cdf0e10cSrcweir             nVal = text::WritingMode2::LR_TB;
4441*cdf0e10cSrcweir             break;
4442*cdf0e10cSrcweir         case FRMDIR_HORI_RIGHT_TOP:
4443*cdf0e10cSrcweir             nVal = text::WritingMode2::RL_TB;
4444*cdf0e10cSrcweir             break;
4445*cdf0e10cSrcweir         case FRMDIR_VERT_TOP_RIGHT:
4446*cdf0e10cSrcweir             nVal = text::WritingMode2::TB_RL;
4447*cdf0e10cSrcweir             break;
4448*cdf0e10cSrcweir         case FRMDIR_VERT_TOP_LEFT:
4449*cdf0e10cSrcweir             nVal = text::WritingMode2::TB_LR;
4450*cdf0e10cSrcweir             break;
4451*cdf0e10cSrcweir         case FRMDIR_ENVIRONMENT:
4452*cdf0e10cSrcweir             nVal = text::WritingMode2::PAGE;
4453*cdf0e10cSrcweir             break;
4454*cdf0e10cSrcweir         default:
4455*cdf0e10cSrcweir             DBG_ERROR("Unknown SvxFrameDirection value!");
4456*cdf0e10cSrcweir             bRet = sal_False;
4457*cdf0e10cSrcweir             break;
4458*cdf0e10cSrcweir     }
4459*cdf0e10cSrcweir 
4460*cdf0e10cSrcweir     // return value + error state
4461*cdf0e10cSrcweir     if( bRet )
4462*cdf0e10cSrcweir     {
4463*cdf0e10cSrcweir         rVal <<= nVal;
4464*cdf0e10cSrcweir     }
4465*cdf0e10cSrcweir 	return bRet;
4466*cdf0e10cSrcweir }
4467*cdf0e10cSrcweir 
4468