xref: /AOO41X/main/xmloff/source/style/PageMasterPropHdl.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_xmloff.hxx"
30*cdf0e10cSrcweir #include "PageMasterPropHdl.hxx"
31*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
32*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
33*cdf0e10cSrcweir #include <xmloff/xmlnumi.hxx>
34*cdf0e10cSrcweir #include <xmloff/xmlnume.hxx>
35*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
36*cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
37*cdf0e10cSrcweir #include <com/sun/star/style/PageStyleLayout.hpp>
38*cdf0e10cSrcweir #include <comphelper/types.hxx>
39*cdf0e10cSrcweir #include <comphelper/extract.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir using ::rtl::OUString;
42*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir using namespace ::com::sun::star;
45*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
46*cdf0e10cSrcweir using namespace ::com::sun::star::style;
47*cdf0e10cSrcweir using namespace ::comphelper;
48*cdf0e10cSrcweir using namespace ::xmloff::token;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //______________________________________________________________________________
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #define DEFAULT_PAPERTRAY   (sal_Int32(-1))
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //______________________________________________________________________________
57*cdf0e10cSrcweir // property handler for style:page-usage (style::PageStyleLayout)
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir XMLPMPropHdl_PageStyleLayout::~XMLPMPropHdl_PageStyleLayout()
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir bool XMLPMPropHdl_PageStyleLayout::equals( const Any& rAny1, const Any& rAny2 ) const
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir     style::PageStyleLayout eLayout1, eLayout2;
66*cdf0e10cSrcweir     return ((rAny1 >>= eLayout1) && (rAny2 >>= eLayout2)) ? (eLayout1 == eLayout2) : sal_False;
67*cdf0e10cSrcweir }
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PageStyleLayout::importXML(
70*cdf0e10cSrcweir         const OUString& rStrImpValue,
71*cdf0e10cSrcweir         Any& rValue,
72*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir     sal_Bool bRet = sal_True;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir     if( IsXMLToken( rStrImpValue, XML_ALL ) )
77*cdf0e10cSrcweir         rValue <<= PageStyleLayout_ALL;
78*cdf0e10cSrcweir     else if( IsXMLToken( rStrImpValue, XML_LEFT ) )
79*cdf0e10cSrcweir         rValue <<= PageStyleLayout_LEFT;
80*cdf0e10cSrcweir     else if( IsXMLToken( rStrImpValue, XML_RIGHT ) )
81*cdf0e10cSrcweir         rValue <<= PageStyleLayout_RIGHT;
82*cdf0e10cSrcweir     else if( IsXMLToken( rStrImpValue, XML_MIRRORED ) )
83*cdf0e10cSrcweir         rValue <<= PageStyleLayout_MIRRORED;
84*cdf0e10cSrcweir     else
85*cdf0e10cSrcweir         bRet = sal_False;
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     return bRet;
88*cdf0e10cSrcweir }
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PageStyleLayout::exportXML(
91*cdf0e10cSrcweir         OUString& rStrExpValue,
92*cdf0e10cSrcweir         const Any& rValue,
93*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir     sal_Bool        bRet = sal_False;
96*cdf0e10cSrcweir     PageStyleLayout eLayout;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     if( rValue >>= eLayout )
99*cdf0e10cSrcweir     {
100*cdf0e10cSrcweir         bRet = sal_True;
101*cdf0e10cSrcweir         switch( eLayout )
102*cdf0e10cSrcweir         {
103*cdf0e10cSrcweir             case PageStyleLayout_ALL:
104*cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_ALL );
105*cdf0e10cSrcweir             break;
106*cdf0e10cSrcweir             case PageStyleLayout_LEFT:
107*cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_LEFT );
108*cdf0e10cSrcweir             break;
109*cdf0e10cSrcweir             case PageStyleLayout_RIGHT:
110*cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_RIGHT );
111*cdf0e10cSrcweir             break;
112*cdf0e10cSrcweir             case PageStyleLayout_MIRRORED:
113*cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_MIRRORED );
114*cdf0e10cSrcweir             break;
115*cdf0e10cSrcweir             default:
116*cdf0e10cSrcweir                 bRet = sal_False;
117*cdf0e10cSrcweir         }
118*cdf0e10cSrcweir     }
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     return bRet;
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir //______________________________________________________________________________
125*cdf0e10cSrcweir // property handler for style:num-format (style::NumberingType)
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir XMLPMPropHdl_NumFormat::~XMLPMPropHdl_NumFormat()
128*cdf0e10cSrcweir {
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumFormat::importXML(
132*cdf0e10cSrcweir         const OUString& rStrImpValue,
133*cdf0e10cSrcweir         Any& rValue,
134*cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir     sal_Int16 nSync = sal_Int16();
137*cdf0e10cSrcweir     sal_Int16 nNumType = NumberingType::NUMBER_NONE;
138*cdf0e10cSrcweir     rUnitConverter.convertNumFormat( nNumType, rStrImpValue, OUString(),
139*cdf0e10cSrcweir                                      sal_True );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     if( !(rValue >>= nSync) )
142*cdf0e10cSrcweir         nSync = NumberingType::NUMBER_NONE;
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir     // if num-letter-sync appears before num-format, the function
145*cdf0e10cSrcweir     // XMLPMPropHdl_NumLetterSync::importXML() sets the value
146*cdf0e10cSrcweir     // NumberingType::CHARS_LOWER_LETTER_N
147*cdf0e10cSrcweir     if( nSync == NumberingType::CHARS_LOWER_LETTER_N )
148*cdf0e10cSrcweir     {
149*cdf0e10cSrcweir         switch( nNumType )
150*cdf0e10cSrcweir         {
151*cdf0e10cSrcweir             case NumberingType::CHARS_LOWER_LETTER:
152*cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_LOWER_LETTER_N;
153*cdf0e10cSrcweir             break;
154*cdf0e10cSrcweir             case NumberingType::CHARS_UPPER_LETTER:
155*cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_UPPER_LETTER_N;
156*cdf0e10cSrcweir             break;
157*cdf0e10cSrcweir         }
158*cdf0e10cSrcweir     }
159*cdf0e10cSrcweir     rValue <<= nNumType;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir     return sal_True;
162*cdf0e10cSrcweir }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumFormat::exportXML(
165*cdf0e10cSrcweir         OUString& rStrExpValue,
166*cdf0e10cSrcweir         const Any& rValue,
167*cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
170*cdf0e10cSrcweir     sal_Int16   nNumType = sal_Int16();
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     if( rValue >>= nNumType )
173*cdf0e10cSrcweir     {
174*cdf0e10cSrcweir         OUStringBuffer aBuffer( 10 );
175*cdf0e10cSrcweir         rUnitConverter.convertNumFormat( aBuffer, nNumType );
176*cdf0e10cSrcweir         rStrExpValue = aBuffer.makeStringAndClear();
177*cdf0e10cSrcweir         bRet = sal_True;
178*cdf0e10cSrcweir     }
179*cdf0e10cSrcweir     return bRet;
180*cdf0e10cSrcweir }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir //______________________________________________________________________________
184*cdf0e10cSrcweir // property handler for style:num-letter-sync (style::NumberingType)
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir XMLPMPropHdl_NumLetterSync::~XMLPMPropHdl_NumLetterSync()
187*cdf0e10cSrcweir {
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumLetterSync::importXML(
191*cdf0e10cSrcweir         const OUString& rStrImpValue,
192*cdf0e10cSrcweir         Any& rValue,
193*cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
194*cdf0e10cSrcweir {
195*cdf0e10cSrcweir     sal_Int16 nNumType;
196*cdf0e10cSrcweir     sal_Int16 nSync = NumberingType::NUMBER_NONE;
197*cdf0e10cSrcweir     rUnitConverter.convertNumFormat( nSync, rStrImpValue,
198*cdf0e10cSrcweir                                      GetXMLToken( XML_A ), sal_True );
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     if( !(rValue >>= nNumType) )
201*cdf0e10cSrcweir         nNumType = NumberingType::NUMBER_NONE;
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     if( nSync == NumberingType::CHARS_LOWER_LETTER_N )
204*cdf0e10cSrcweir     {
205*cdf0e10cSrcweir         switch( nNumType )
206*cdf0e10cSrcweir         {
207*cdf0e10cSrcweir             case NumberingType::CHARS_LOWER_LETTER:
208*cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_LOWER_LETTER_N;
209*cdf0e10cSrcweir             break;
210*cdf0e10cSrcweir             case NumberingType::CHARS_UPPER_LETTER:
211*cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_UPPER_LETTER_N;
212*cdf0e10cSrcweir             break;
213*cdf0e10cSrcweir         }
214*cdf0e10cSrcweir     }
215*cdf0e10cSrcweir     rValue <<= nNumType;
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir     return sal_True;
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumLetterSync::exportXML(
221*cdf0e10cSrcweir         OUString& rStrExpValue,
222*cdf0e10cSrcweir         const Any& rValue,
223*cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
226*cdf0e10cSrcweir     sal_Int16   nNumType = sal_Int16();
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     if( rValue >>= nNumType )
229*cdf0e10cSrcweir     {
230*cdf0e10cSrcweir         OUStringBuffer aBuffer( 5 );
231*cdf0e10cSrcweir         rUnitConverter.convertNumLetterSync( aBuffer, nNumType );
232*cdf0e10cSrcweir         rStrExpValue = aBuffer.makeStringAndClear();
233*cdf0e10cSrcweir         bRet = rStrExpValue.getLength() > 0;
234*cdf0e10cSrcweir     }
235*cdf0e10cSrcweir     return bRet;
236*cdf0e10cSrcweir }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir //______________________________________________________________________________
240*cdf0e10cSrcweir // property handler for style:paper-tray-number
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir XMLPMPropHdl_PaperTrayNumber::~XMLPMPropHdl_PaperTrayNumber()
243*cdf0e10cSrcweir {
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PaperTrayNumber::importXML(
247*cdf0e10cSrcweir         const OUString& rStrImpValue,
248*cdf0e10cSrcweir         Any& rValue,
249*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
250*cdf0e10cSrcweir {
251*cdf0e10cSrcweir     sal_Bool bRet = sal_False;
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     if( IsXMLToken( rStrImpValue, XML_DEFAULT ) )
254*cdf0e10cSrcweir     {
255*cdf0e10cSrcweir         rValue <<= DEFAULT_PAPERTRAY;
256*cdf0e10cSrcweir         bRet = sal_True;
257*cdf0e10cSrcweir     }
258*cdf0e10cSrcweir     else
259*cdf0e10cSrcweir     {
260*cdf0e10cSrcweir         sal_Int32 nPaperTray;
261*cdf0e10cSrcweir         if( SvXMLUnitConverter::convertNumber( nPaperTray, rStrImpValue, 0 ) )
262*cdf0e10cSrcweir         {
263*cdf0e10cSrcweir             rValue <<= nPaperTray;
264*cdf0e10cSrcweir             bRet = sal_True;
265*cdf0e10cSrcweir         }
266*cdf0e10cSrcweir     }
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir     return bRet;
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PaperTrayNumber::exportXML(
272*cdf0e10cSrcweir         OUString& rStrExpValue,
273*cdf0e10cSrcweir         const Any& rValue,
274*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
275*cdf0e10cSrcweir {
276*cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
277*cdf0e10cSrcweir     sal_Int32   nPaperTray = 0;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir     if( rValue >>= nPaperTray )
280*cdf0e10cSrcweir     {
281*cdf0e10cSrcweir         if( nPaperTray == DEFAULT_PAPERTRAY )
282*cdf0e10cSrcweir             rStrExpValue = GetXMLToken( XML_DEFAULT );
283*cdf0e10cSrcweir         else
284*cdf0e10cSrcweir         {
285*cdf0e10cSrcweir             OUStringBuffer aBuffer;
286*cdf0e10cSrcweir             SvXMLUnitConverter::convertNumber( aBuffer, nPaperTray );
287*cdf0e10cSrcweir             rStrExpValue = aBuffer.makeStringAndClear();
288*cdf0e10cSrcweir         }
289*cdf0e10cSrcweir         bRet = sal_True;
290*cdf0e10cSrcweir     }
291*cdf0e10cSrcweir     return bRet;
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir //______________________________________________________________________________
296*cdf0e10cSrcweir // property handler for style:print
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir XMLPMPropHdl_Print::XMLPMPropHdl_Print( enum XMLTokenEnum eValue ) :
299*cdf0e10cSrcweir     sAttrValue( GetXMLToken( eValue ) )
300*cdf0e10cSrcweir {
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir XMLPMPropHdl_Print::~XMLPMPropHdl_Print()
304*cdf0e10cSrcweir {
305*cdf0e10cSrcweir }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_Print::importXML(
308*cdf0e10cSrcweir         const OUString& rStrImpValue,
309*cdf0e10cSrcweir         Any& rValue,
310*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
311*cdf0e10cSrcweir {
312*cdf0e10cSrcweir     sal_Unicode cToken  = ' ';
313*cdf0e10cSrcweir     sal_Int32   nTokenIndex = 0;
314*cdf0e10cSrcweir     sal_Bool    bFound  = sal_False;
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir     do
317*cdf0e10cSrcweir     {
318*cdf0e10cSrcweir         bFound = (sAttrValue == rStrImpValue.getToken( 0, cToken, nTokenIndex ));
319*cdf0e10cSrcweir     }
320*cdf0e10cSrcweir     while ( (nTokenIndex >= 0) && !bFound );
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir     setBOOL( rValue, bFound );
323*cdf0e10cSrcweir     return sal_True;
324*cdf0e10cSrcweir }
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_Print::exportXML(
327*cdf0e10cSrcweir         OUString& rStrExpValue,
328*cdf0e10cSrcweir         const Any& rValue,
329*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
330*cdf0e10cSrcweir {
331*cdf0e10cSrcweir     if( getBOOL( rValue ) )
332*cdf0e10cSrcweir     {
333*cdf0e10cSrcweir         if( rStrExpValue.getLength() )
334*cdf0e10cSrcweir             rStrExpValue += OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
335*cdf0e10cSrcweir         rStrExpValue += sAttrValue;
336*cdf0e10cSrcweir     }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     return sal_True;
339*cdf0e10cSrcweir }
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir //______________________________________________________________________________
342*cdf0e10cSrcweir // property handler for style:table-centering
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir XMLPMPropHdl_CenterHorizontal::~XMLPMPropHdl_CenterHorizontal()
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterHorizontal::importXML(
349*cdf0e10cSrcweir         const OUString& rStrImpValue,
350*cdf0e10cSrcweir         Any& rValue,
351*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
352*cdf0e10cSrcweir {
353*cdf0e10cSrcweir     sal_Bool bRet = sal_False;
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     if (rStrImpValue.getLength())
356*cdf0e10cSrcweir         if (IsXMLToken( rStrImpValue, XML_BOTH) ||
357*cdf0e10cSrcweir             IsXMLToken( rStrImpValue, XML_HORIZONTAL))
358*cdf0e10cSrcweir         {
359*cdf0e10cSrcweir             rValue = ::cppu::bool2any(sal_True);
360*cdf0e10cSrcweir             bRet = sal_True;
361*cdf0e10cSrcweir         }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir     return bRet;
365*cdf0e10cSrcweir }
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterHorizontal::exportXML(
368*cdf0e10cSrcweir         OUString& rStrExpValue,
369*cdf0e10cSrcweir         const Any& rValue,
370*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir     if ( ::cppu::any2bool( rValue ) )
375*cdf0e10cSrcweir     {
376*cdf0e10cSrcweir         bRet = sal_True;
377*cdf0e10cSrcweir         if (rStrExpValue.getLength())
378*cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_BOTH);
379*cdf0e10cSrcweir         else
380*cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_HORIZONTAL);
381*cdf0e10cSrcweir     }
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir     return bRet;
384*cdf0e10cSrcweir }
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir XMLPMPropHdl_CenterVertical::~XMLPMPropHdl_CenterVertical()
387*cdf0e10cSrcweir {
388*cdf0e10cSrcweir }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterVertical::importXML(
391*cdf0e10cSrcweir         const OUString& rStrImpValue,
392*cdf0e10cSrcweir         Any& rValue,
393*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
394*cdf0e10cSrcweir {
395*cdf0e10cSrcweir     sal_Bool bRet = sal_False;
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir     if (rStrImpValue.getLength())
398*cdf0e10cSrcweir         if (IsXMLToken(rStrImpValue, XML_BOTH) ||
399*cdf0e10cSrcweir             IsXMLToken(rStrImpValue, XML_VERTICAL) )
400*cdf0e10cSrcweir         {
401*cdf0e10cSrcweir             rValue = ::cppu::bool2any(sal_True);
402*cdf0e10cSrcweir             bRet = sal_True;
403*cdf0e10cSrcweir         }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir     return bRet;
406*cdf0e10cSrcweir }
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterVertical::exportXML(
409*cdf0e10cSrcweir         OUString& rStrExpValue,
410*cdf0e10cSrcweir         const Any& rValue,
411*cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
412*cdf0e10cSrcweir {
413*cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir     if ( ::cppu::any2bool( rValue ) )
416*cdf0e10cSrcweir     {
417*cdf0e10cSrcweir         bRet = sal_True;
418*cdf0e10cSrcweir         if (rStrExpValue.getLength())
419*cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_BOTH);
420*cdf0e10cSrcweir         else
421*cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_VERTICAL);
422*cdf0e10cSrcweir     }
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir     return bRet;
425*cdf0e10cSrcweir }
426*cdf0e10cSrcweir 
427