1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir #include "PageMasterPropHdl.hxx"
27cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
28cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
29cdf0e10cSrcweir #include <xmloff/xmlnumi.hxx>
30cdf0e10cSrcweir #include <xmloff/xmlnume.hxx>
31cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
32cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
33cdf0e10cSrcweir #include <com/sun/star/style/PageStyleLayout.hpp>
34cdf0e10cSrcweir #include <comphelper/types.hxx>
35cdf0e10cSrcweir #include <comphelper/extract.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using ::rtl::OUString;
38cdf0e10cSrcweir using ::rtl::OUStringBuffer;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir using namespace ::com::sun::star;
41cdf0e10cSrcweir using namespace ::com::sun::star::uno;
42cdf0e10cSrcweir using namespace ::com::sun::star::style;
43cdf0e10cSrcweir using namespace ::comphelper;
44cdf0e10cSrcweir using namespace ::xmloff::token;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //______________________________________________________________________________
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #define DEFAULT_PAPERTRAY   (sal_Int32(-1))
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //______________________________________________________________________________
53cdf0e10cSrcweir // property handler for style:page-usage (style::PageStyleLayout)
54cdf0e10cSrcweir 
~XMLPMPropHdl_PageStyleLayout()55cdf0e10cSrcweir XMLPMPropHdl_PageStyleLayout::~XMLPMPropHdl_PageStyleLayout()
56cdf0e10cSrcweir {
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
equals(const Any & rAny1,const Any & rAny2) const59cdf0e10cSrcweir bool XMLPMPropHdl_PageStyleLayout::equals( const Any& rAny1, const Any& rAny2 ) const
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     style::PageStyleLayout eLayout1, eLayout2;
62cdf0e10cSrcweir     return ((rAny1 >>= eLayout1) && (rAny2 >>= eLayout2)) ? (eLayout1 == eLayout2) : sal_False;
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter &) const65cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PageStyleLayout::importXML(
66cdf0e10cSrcweir         const OUString& rStrImpValue,
67cdf0e10cSrcweir         Any& rValue,
68cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     sal_Bool bRet = sal_True;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     if( IsXMLToken( rStrImpValue, XML_ALL ) )
73cdf0e10cSrcweir         rValue <<= PageStyleLayout_ALL;
74cdf0e10cSrcweir     else if( IsXMLToken( rStrImpValue, XML_LEFT ) )
75cdf0e10cSrcweir         rValue <<= PageStyleLayout_LEFT;
76cdf0e10cSrcweir     else if( IsXMLToken( rStrImpValue, XML_RIGHT ) )
77cdf0e10cSrcweir         rValue <<= PageStyleLayout_RIGHT;
78cdf0e10cSrcweir     else if( IsXMLToken( rStrImpValue, XML_MIRRORED ) )
79cdf0e10cSrcweir         rValue <<= PageStyleLayout_MIRRORED;
80cdf0e10cSrcweir     else
81cdf0e10cSrcweir         bRet = sal_False;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     return bRet;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter &) const86cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PageStyleLayout::exportXML(
87cdf0e10cSrcweir         OUString& rStrExpValue,
88cdf0e10cSrcweir         const Any& rValue,
89cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     sal_Bool        bRet = sal_False;
92cdf0e10cSrcweir     PageStyleLayout eLayout;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     if( rValue >>= eLayout )
95cdf0e10cSrcweir     {
96cdf0e10cSrcweir         bRet = sal_True;
97cdf0e10cSrcweir         switch( eLayout )
98cdf0e10cSrcweir         {
99cdf0e10cSrcweir             case PageStyleLayout_ALL:
100cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_ALL );
101cdf0e10cSrcweir             break;
102cdf0e10cSrcweir             case PageStyleLayout_LEFT:
103cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_LEFT );
104cdf0e10cSrcweir             break;
105cdf0e10cSrcweir             case PageStyleLayout_RIGHT:
106cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_RIGHT );
107cdf0e10cSrcweir             break;
108cdf0e10cSrcweir             case PageStyleLayout_MIRRORED:
109cdf0e10cSrcweir                 rStrExpValue = GetXMLToken( XML_MIRRORED );
110cdf0e10cSrcweir             break;
111cdf0e10cSrcweir             default:
112cdf0e10cSrcweir                 bRet = sal_False;
113cdf0e10cSrcweir         }
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     return bRet;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120cdf0e10cSrcweir //______________________________________________________________________________
121cdf0e10cSrcweir // property handler for style:num-format (style::NumberingType)
122cdf0e10cSrcweir 
~XMLPMPropHdl_NumFormat()123cdf0e10cSrcweir XMLPMPropHdl_NumFormat::~XMLPMPropHdl_NumFormat()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter & rUnitConverter) const127cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumFormat::importXML(
128cdf0e10cSrcweir         const OUString& rStrImpValue,
129cdf0e10cSrcweir         Any& rValue,
130cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
131cdf0e10cSrcweir {
132cdf0e10cSrcweir     sal_Int16 nSync = sal_Int16();
133cdf0e10cSrcweir     sal_Int16 nNumType = NumberingType::NUMBER_NONE;
134cdf0e10cSrcweir     rUnitConverter.convertNumFormat( nNumType, rStrImpValue, OUString(),
135cdf0e10cSrcweir                                      sal_True );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     if( !(rValue >>= nSync) )
138cdf0e10cSrcweir         nSync = NumberingType::NUMBER_NONE;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     // if num-letter-sync appears before num-format, the function
141cdf0e10cSrcweir     // XMLPMPropHdl_NumLetterSync::importXML() sets the value
142cdf0e10cSrcweir     // NumberingType::CHARS_LOWER_LETTER_N
143cdf0e10cSrcweir     if( nSync == NumberingType::CHARS_LOWER_LETTER_N )
144cdf0e10cSrcweir     {
145cdf0e10cSrcweir         switch( nNumType )
146cdf0e10cSrcweir         {
147cdf0e10cSrcweir             case NumberingType::CHARS_LOWER_LETTER:
148cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_LOWER_LETTER_N;
149cdf0e10cSrcweir             break;
150cdf0e10cSrcweir             case NumberingType::CHARS_UPPER_LETTER:
151cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_UPPER_LETTER_N;
152cdf0e10cSrcweir             break;
153cdf0e10cSrcweir         }
154cdf0e10cSrcweir     }
155cdf0e10cSrcweir     rValue <<= nNumType;
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     return sal_True;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter & rUnitConverter) const160cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumFormat::exportXML(
161cdf0e10cSrcweir         OUString& rStrExpValue,
162cdf0e10cSrcweir         const Any& rValue,
163cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
166cdf0e10cSrcweir     sal_Int16   nNumType = sal_Int16();
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     if( rValue >>= nNumType )
169cdf0e10cSrcweir     {
170cdf0e10cSrcweir         OUStringBuffer aBuffer( 10 );
171cdf0e10cSrcweir         rUnitConverter.convertNumFormat( aBuffer, nNumType );
172cdf0e10cSrcweir         rStrExpValue = aBuffer.makeStringAndClear();
173cdf0e10cSrcweir         bRet = sal_True;
174cdf0e10cSrcweir     }
175cdf0e10cSrcweir     return bRet;
176cdf0e10cSrcweir }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 
179cdf0e10cSrcweir //______________________________________________________________________________
180cdf0e10cSrcweir // property handler for style:num-letter-sync (style::NumberingType)
181cdf0e10cSrcweir 
~XMLPMPropHdl_NumLetterSync()182cdf0e10cSrcweir XMLPMPropHdl_NumLetterSync::~XMLPMPropHdl_NumLetterSync()
183cdf0e10cSrcweir {
184cdf0e10cSrcweir }
185cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter & rUnitConverter) const186cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumLetterSync::importXML(
187cdf0e10cSrcweir         const OUString& rStrImpValue,
188cdf0e10cSrcweir         Any& rValue,
189cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
190cdf0e10cSrcweir {
191cdf0e10cSrcweir     sal_Int16 nNumType;
192cdf0e10cSrcweir     sal_Int16 nSync = NumberingType::NUMBER_NONE;
193cdf0e10cSrcweir     rUnitConverter.convertNumFormat( nSync, rStrImpValue,
194cdf0e10cSrcweir                                      GetXMLToken( XML_A ), sal_True );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     if( !(rValue >>= nNumType) )
197cdf0e10cSrcweir         nNumType = NumberingType::NUMBER_NONE;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     if( nSync == NumberingType::CHARS_LOWER_LETTER_N )
200cdf0e10cSrcweir     {
201cdf0e10cSrcweir         switch( nNumType )
202cdf0e10cSrcweir         {
203cdf0e10cSrcweir             case NumberingType::CHARS_LOWER_LETTER:
204cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_LOWER_LETTER_N;
205cdf0e10cSrcweir             break;
206cdf0e10cSrcweir             case NumberingType::CHARS_UPPER_LETTER:
207cdf0e10cSrcweir                 nNumType = NumberingType::CHARS_UPPER_LETTER_N;
208cdf0e10cSrcweir             break;
209cdf0e10cSrcweir         }
210cdf0e10cSrcweir     }
211cdf0e10cSrcweir     rValue <<= nNumType;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     return sal_True;
214cdf0e10cSrcweir }
215cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter & rUnitConverter) const216cdf0e10cSrcweir sal_Bool XMLPMPropHdl_NumLetterSync::exportXML(
217cdf0e10cSrcweir         OUString& rStrExpValue,
218cdf0e10cSrcweir         const Any& rValue,
219cdf0e10cSrcweir         const SvXMLUnitConverter& rUnitConverter ) const
220cdf0e10cSrcweir {
221cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
222cdf0e10cSrcweir     sal_Int16   nNumType = sal_Int16();
223cdf0e10cSrcweir 
224cdf0e10cSrcweir     if( rValue >>= nNumType )
225cdf0e10cSrcweir     {
226cdf0e10cSrcweir         OUStringBuffer aBuffer( 5 );
227cdf0e10cSrcweir         rUnitConverter.convertNumLetterSync( aBuffer, nNumType );
228cdf0e10cSrcweir         rStrExpValue = aBuffer.makeStringAndClear();
229cdf0e10cSrcweir         bRet = rStrExpValue.getLength() > 0;
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir     return bRet;
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 
235cdf0e10cSrcweir //______________________________________________________________________________
236cdf0e10cSrcweir // property handler for style:paper-tray-number
237cdf0e10cSrcweir 
~XMLPMPropHdl_PaperTrayNumber()238cdf0e10cSrcweir XMLPMPropHdl_PaperTrayNumber::~XMLPMPropHdl_PaperTrayNumber()
239cdf0e10cSrcweir {
240cdf0e10cSrcweir }
241cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter &) const242cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PaperTrayNumber::importXML(
243cdf0e10cSrcweir         const OUString& rStrImpValue,
244cdf0e10cSrcweir         Any& rValue,
245cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
246cdf0e10cSrcweir {
247cdf0e10cSrcweir     sal_Bool bRet = sal_False;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir     if( IsXMLToken( rStrImpValue, XML_DEFAULT ) )
250cdf0e10cSrcweir     {
251cdf0e10cSrcweir         rValue <<= DEFAULT_PAPERTRAY;
252cdf0e10cSrcweir         bRet = sal_True;
253cdf0e10cSrcweir     }
254cdf0e10cSrcweir     else
255cdf0e10cSrcweir     {
256cdf0e10cSrcweir         sal_Int32 nPaperTray;
257cdf0e10cSrcweir         if( SvXMLUnitConverter::convertNumber( nPaperTray, rStrImpValue, 0 ) )
258cdf0e10cSrcweir         {
259cdf0e10cSrcweir             rValue <<= nPaperTray;
260cdf0e10cSrcweir             bRet = sal_True;
261cdf0e10cSrcweir         }
262cdf0e10cSrcweir     }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     return bRet;
265cdf0e10cSrcweir }
266cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter &) const267cdf0e10cSrcweir sal_Bool XMLPMPropHdl_PaperTrayNumber::exportXML(
268cdf0e10cSrcweir         OUString& rStrExpValue,
269cdf0e10cSrcweir         const Any& rValue,
270cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
271cdf0e10cSrcweir {
272cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
273cdf0e10cSrcweir     sal_Int32   nPaperTray = 0;
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     if( rValue >>= nPaperTray )
276cdf0e10cSrcweir     {
277cdf0e10cSrcweir         if( nPaperTray == DEFAULT_PAPERTRAY )
278cdf0e10cSrcweir             rStrExpValue = GetXMLToken( XML_DEFAULT );
279cdf0e10cSrcweir         else
280cdf0e10cSrcweir         {
281cdf0e10cSrcweir             OUStringBuffer aBuffer;
282cdf0e10cSrcweir             SvXMLUnitConverter::convertNumber( aBuffer, nPaperTray );
283cdf0e10cSrcweir             rStrExpValue = aBuffer.makeStringAndClear();
284cdf0e10cSrcweir         }
285cdf0e10cSrcweir         bRet = sal_True;
286cdf0e10cSrcweir     }
287cdf0e10cSrcweir     return bRet;
288cdf0e10cSrcweir }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 
291cdf0e10cSrcweir //______________________________________________________________________________
292cdf0e10cSrcweir // property handler for style:print
293cdf0e10cSrcweir 
XMLPMPropHdl_Print(enum XMLTokenEnum eValue)294cdf0e10cSrcweir XMLPMPropHdl_Print::XMLPMPropHdl_Print( enum XMLTokenEnum eValue ) :
295cdf0e10cSrcweir     sAttrValue( GetXMLToken( eValue ) )
296cdf0e10cSrcweir {
297cdf0e10cSrcweir }
298cdf0e10cSrcweir 
~XMLPMPropHdl_Print()299cdf0e10cSrcweir XMLPMPropHdl_Print::~XMLPMPropHdl_Print()
300cdf0e10cSrcweir {
301cdf0e10cSrcweir }
302cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter &) const303cdf0e10cSrcweir sal_Bool XMLPMPropHdl_Print::importXML(
304cdf0e10cSrcweir         const OUString& rStrImpValue,
305cdf0e10cSrcweir         Any& rValue,
306cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
307cdf0e10cSrcweir {
308cdf0e10cSrcweir     sal_Unicode cToken  = ' ';
309cdf0e10cSrcweir     sal_Int32   nTokenIndex = 0;
310cdf0e10cSrcweir     sal_Bool    bFound  = sal_False;
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     do
313cdf0e10cSrcweir     {
314cdf0e10cSrcweir         bFound = (sAttrValue == rStrImpValue.getToken( 0, cToken, nTokenIndex ));
315cdf0e10cSrcweir     }
316cdf0e10cSrcweir     while ( (nTokenIndex >= 0) && !bFound );
317cdf0e10cSrcweir 
318cdf0e10cSrcweir     setBOOL( rValue, bFound );
319cdf0e10cSrcweir     return sal_True;
320cdf0e10cSrcweir }
321cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter &) const322cdf0e10cSrcweir sal_Bool XMLPMPropHdl_Print::exportXML(
323cdf0e10cSrcweir         OUString& rStrExpValue,
324cdf0e10cSrcweir         const Any& rValue,
325cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
326cdf0e10cSrcweir {
327cdf0e10cSrcweir     if( getBOOL( rValue ) )
328cdf0e10cSrcweir     {
329cdf0e10cSrcweir         if( rStrExpValue.getLength() )
330cdf0e10cSrcweir             rStrExpValue += OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
331cdf0e10cSrcweir         rStrExpValue += sAttrValue;
332cdf0e10cSrcweir     }
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     return sal_True;
335cdf0e10cSrcweir }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir //______________________________________________________________________________
338cdf0e10cSrcweir // property handler for style:table-centering
339cdf0e10cSrcweir 
~XMLPMPropHdl_CenterHorizontal()340cdf0e10cSrcweir XMLPMPropHdl_CenterHorizontal::~XMLPMPropHdl_CenterHorizontal()
341cdf0e10cSrcweir {
342cdf0e10cSrcweir }
343cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter &) const344cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterHorizontal::importXML(
345cdf0e10cSrcweir         const OUString& rStrImpValue,
346cdf0e10cSrcweir         Any& rValue,
347cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
348cdf0e10cSrcweir {
349cdf0e10cSrcweir     sal_Bool bRet = sal_False;
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     if (rStrImpValue.getLength())
352cdf0e10cSrcweir         if (IsXMLToken( rStrImpValue, XML_BOTH) ||
353cdf0e10cSrcweir             IsXMLToken( rStrImpValue, XML_HORIZONTAL))
354cdf0e10cSrcweir         {
355cdf0e10cSrcweir             rValue = ::cppu::bool2any(sal_True);
356cdf0e10cSrcweir             bRet = sal_True;
357cdf0e10cSrcweir         }
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     return bRet;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter &) const363cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterHorizontal::exportXML(
364cdf0e10cSrcweir         OUString& rStrExpValue,
365cdf0e10cSrcweir         const Any& rValue,
366cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
367cdf0e10cSrcweir {
368cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
369cdf0e10cSrcweir 
370cdf0e10cSrcweir     if ( ::cppu::any2bool( rValue ) )
371cdf0e10cSrcweir     {
372cdf0e10cSrcweir         bRet = sal_True;
373cdf0e10cSrcweir         if (rStrExpValue.getLength())
374cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_BOTH);
375cdf0e10cSrcweir         else
376cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_HORIZONTAL);
377cdf0e10cSrcweir     }
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     return bRet;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir 
~XMLPMPropHdl_CenterVertical()382cdf0e10cSrcweir XMLPMPropHdl_CenterVertical::~XMLPMPropHdl_CenterVertical()
383cdf0e10cSrcweir {
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
importXML(const OUString & rStrImpValue,Any & rValue,const SvXMLUnitConverter &) const386cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterVertical::importXML(
387cdf0e10cSrcweir         const OUString& rStrImpValue,
388cdf0e10cSrcweir         Any& rValue,
389cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
390cdf0e10cSrcweir {
391cdf0e10cSrcweir     sal_Bool bRet = sal_False;
392cdf0e10cSrcweir 
393cdf0e10cSrcweir     if (rStrImpValue.getLength())
394cdf0e10cSrcweir         if (IsXMLToken(rStrImpValue, XML_BOTH) ||
395cdf0e10cSrcweir             IsXMLToken(rStrImpValue, XML_VERTICAL) )
396cdf0e10cSrcweir         {
397cdf0e10cSrcweir             rValue = ::cppu::bool2any(sal_True);
398cdf0e10cSrcweir             bRet = sal_True;
399cdf0e10cSrcweir         }
400cdf0e10cSrcweir 
401cdf0e10cSrcweir     return bRet;
402cdf0e10cSrcweir }
403cdf0e10cSrcweir 
exportXML(OUString & rStrExpValue,const Any & rValue,const SvXMLUnitConverter &) const404cdf0e10cSrcweir sal_Bool XMLPMPropHdl_CenterVertical::exportXML(
405cdf0e10cSrcweir         OUString& rStrExpValue,
406cdf0e10cSrcweir         const Any& rValue,
407cdf0e10cSrcweir         const SvXMLUnitConverter& ) const
408cdf0e10cSrcweir {
409cdf0e10cSrcweir     sal_Bool    bRet = sal_False;
410cdf0e10cSrcweir 
411cdf0e10cSrcweir     if ( ::cppu::any2bool( rValue ) )
412cdf0e10cSrcweir     {
413cdf0e10cSrcweir         bRet = sal_True;
414cdf0e10cSrcweir         if (rStrExpValue.getLength())
415cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_BOTH);
416cdf0e10cSrcweir         else
417cdf0e10cSrcweir             rStrExpValue = GetXMLToken(XML_VERTICAL);
418cdf0e10cSrcweir     }
419cdf0e10cSrcweir 
420cdf0e10cSrcweir     return bRet;
421cdf0e10cSrcweir }
422cdf0e10cSrcweir 
423