1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <xml/statusbardocumenthandler.hxx>
24 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
25 #include <com/sun/star/ui/ItemStyle.hpp>
26 #include <com/sun/star/ui/ItemType.hpp>
27 #include <com/sun/star/beans/PropertyValue.hpp>
29 #include <vcl/svapp.hxx>
30 #include <vcl/status.hxx>
32 #include <comphelper/attributelist.hxx>
34 using namespace ::com::sun::star::uno
;
35 using namespace ::com::sun::star::beans
;
36 using namespace ::com::sun::star::xml::sax
;
37 using namespace ::com::sun::star::ui
;
38 using namespace ::com::sun::star::container
;
40 #define XMLNS_STATUSBAR "http://openoffice.org/2001/statusbar"
41 #define XMLNS_XLINK "http://www.w3.org/1999/xlink"
42 #define XMLNS_STATUSBAR_PREFIX "statusbar:"
43 #define XMLNS_XLINK_PREFIX "xlink:"
45 #define XMLNS_FILTER_SEPARATOR "^"
47 #define ELEMENT_STATUSBAR "statusbar"
48 #define ELEMENT_STATUSBARITEM "statusbaritem"
50 #define ATTRIBUTE_ALIGN "align"
51 #define ATTRIBUTE_STYLE "style"
52 #define ATTRIBUTE_URL "href"
53 #define ATTRIBUTE_WIDTH "width"
54 #define ATTRIBUTE_OFFSET "offset"
55 #define ATTRIBUTE_AUTOSIZE "autosize"
56 #define ATTRIBUTE_OWNERDRAW "ownerdraw"
57 #define ATTRIBUTE_HELPURL "helpid"
59 #define ELEMENT_NS_STATUSBAR "statusbar:statusbar"
60 #define ELEMENT_NS_STATUSBARITEM "statusbar:statusbaritem"
62 #define ATTRIBUTE_XMLNS_STATUSBAR "xmlns:statusbar"
63 #define ATTRIBUTE_XMLNS_XLINK "xmlns:xlink"
65 #define ATTRIBUTE_TYPE_CDATA "CDATA"
67 #define ATTRIBUTE_BOOLEAN_TRUE "true"
68 #define ATTRIBUTE_BOOLEAN_FALSE "false"
70 #define ATTRIBUTE_ALIGN_LEFT "left"
71 #define ATTRIBUTE_ALIGN_RIGHT "right"
72 #define ATTRIBUTE_ALIGN_CENTER "center"
74 #define ATTRIBUTE_STYLE_IN "in"
75 #define ATTRIBUTE_STYLE_OUT "out"
76 #define ATTRIBUTE_STYLE_FLAT "flat"
78 #define STATUSBAR_DOCTYPE "<!DOCTYPE statusbar:statusbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"statusbar.dtd\">"
83 // Property names of a menu/menu item ItemDescriptor
84 static const char ITEM_DESCRIPTOR_COMMANDURL
[] = "CommandURL";
85 static const char ITEM_DESCRIPTOR_HELPURL
[] = "HelpURL";
86 static const char ITEM_DESCRIPTOR_OFFSET
[] = "Offset";
87 static const char ITEM_DESCRIPTOR_STYLE
[] = "Style";
88 static const char ITEM_DESCRIPTOR_WIDTH
[] = "Width";
89 static const char ITEM_DESCRIPTOR_TYPE
[] = "Type";
91 static void ExtractStatusbarItemParameters(
92 const Sequence
< PropertyValue
>& rProp
,
93 OUString
& rCommandURL
,
99 for ( sal_Int32 i
= 0; i
< rProp
.getLength(); i
++ )
101 if ( rProp
[i
].Name
== ITEM_DESCRIPTOR_COMMANDURL
)
103 rProp
[i
].Value
>>= rCommandURL
;
104 rCommandURL
= rCommandURL
.intern();
106 else if ( rProp
[i
].Name
== ITEM_DESCRIPTOR_HELPURL
)
108 rProp
[i
].Value
>>= rHelpURL
;
110 else if ( rProp
[i
].Name
== ITEM_DESCRIPTOR_OFFSET
)
112 rProp
[i
].Value
>>= rOffset
;
114 else if ( rProp
[i
].Name
== ITEM_DESCRIPTOR_STYLE
)
116 rProp
[i
].Value
>>= rStyle
;
118 else if ( rProp
[i
].Name
== ITEM_DESCRIPTOR_WIDTH
)
120 rProp
[i
].Value
>>= rWidth
;
125 struct StatusBarEntryProperty
127 OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace
;
131 StatusBarEntryProperty StatusBarEntries
[OReadStatusBarDocumentHandler::SB_XML_ENTRY_COUNT
] =
133 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ELEMENT_STATUSBAR
},
134 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ELEMENT_STATUSBARITEM
},
135 { OReadStatusBarDocumentHandler::SB_NS_XLINK
, ATTRIBUTE_URL
},
136 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_ALIGN
},
137 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_STYLE
},
138 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_AUTOSIZE
},
139 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_OWNERDRAW
},
140 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_WIDTH
},
141 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_OFFSET
},
142 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR
, ATTRIBUTE_HELPURL
}
145 OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
146 const Reference
< XIndexContainer
>& rStatusBarItems
) :
147 m_aStatusBarItems( rStatusBarItems
)
149 OUString
aNamespaceStatusBar( XMLNS_STATUSBAR
);
150 OUString
aNamespaceXLink( XMLNS_XLINK
);
151 OUString
aSeparator( XMLNS_FILTER_SEPARATOR
);
154 for ( int i
= 0; i
< (int)SB_XML_ENTRY_COUNT
; i
++ )
156 if ( StatusBarEntries
[i
].nNamespace
== SB_NS_STATUSBAR
)
158 OUString
temp( aNamespaceStatusBar
);
160 temp
+= OUString::createFromAscii( StatusBarEntries
[i
].aEntryName
);
161 m_aStatusBarMap
.insert( StatusBarHashMap::value_type( temp
, (StatusBar_XML_Entry
)i
) );
165 OUString
temp( aNamespaceXLink
);
167 temp
+= OUString::createFromAscii( StatusBarEntries
[i
].aEntryName
);
168 m_aStatusBarMap
.insert( StatusBarHashMap::value_type( temp
, (StatusBar_XML_Entry
)i
) );
172 m_bStatusBarStartFound
= false;
173 m_bStatusBarEndFound
= false;
174 m_bStatusBarItemStartFound
= false;
177 OReadStatusBarDocumentHandler::~OReadStatusBarDocumentHandler()
182 void SAL_CALL
OReadStatusBarDocumentHandler::startDocument()
183 throw ( SAXException
, RuntimeException
, std::exception
)
187 void SAL_CALL
OReadStatusBarDocumentHandler::endDocument()
188 throw( SAXException
, RuntimeException
, std::exception
)
192 if (( m_bStatusBarStartFound
&& !m_bStatusBarEndFound
) ||
193 ( !m_bStatusBarStartFound
&& m_bStatusBarEndFound
) )
195 OUString aErrorMessage
= getErrorLineString();
196 aErrorMessage
+= "No matching start or end element 'statusbar' found!";
197 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
201 void SAL_CALL
OReadStatusBarDocumentHandler::startElement(
202 const OUString
& aName
, const Reference
< XAttributeList
> &xAttribs
)
203 throw( SAXException
, RuntimeException
, std::exception
)
207 StatusBarHashMap::const_iterator pStatusBarEntry
= m_aStatusBarMap
.find( aName
);
208 if ( pStatusBarEntry
!= m_aStatusBarMap
.end() )
210 switch ( pStatusBarEntry
->second
)
212 case SB_ELEMENT_STATUSBAR
:
214 if ( m_bStatusBarStartFound
)
216 OUString aErrorMessage
= getErrorLineString();
217 aErrorMessage
+= "Element 'statusbar:statusbar' cannot be embedded into 'statusbar:statusbar'!";
218 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
221 m_bStatusBarStartFound
= true;
225 case SB_ELEMENT_STATUSBARITEM
:
227 if ( !m_bStatusBarStartFound
)
229 OUString aErrorMessage
= getErrorLineString();
230 aErrorMessage
+= "Element 'statusbar:statusbaritem' must be embedded into element 'statusbar:statusbar'!";
231 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
234 if ( m_bStatusBarItemStartFound
)
236 OUString aErrorMessage
= getErrorLineString();
237 aErrorMessage
+= "Element statusbar:statusbaritem is not a container!";
238 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
241 OUString aCommandURL
;
243 sal_Int16
nItemBits( ItemStyle::ALIGN_CENTER
|ItemStyle::DRAW_IN3D
);
244 sal_Int16
nWidth( 0 );
245 sal_Int16
nOffset( STATUSBAR_OFFSET
);
246 bool bCommandURL( false );
248 m_bStatusBarItemStartFound
= true;
249 for ( sal_Int16 n
= 0; n
< xAttribs
->getLength(); n
++ )
251 pStatusBarEntry
= m_aStatusBarMap
.find( xAttribs
->getNameByIndex( n
) );
252 if ( pStatusBarEntry
!= m_aStatusBarMap
.end() )
254 switch ( pStatusBarEntry
->second
)
256 case SB_ATTRIBUTE_URL
:
259 aCommandURL
= xAttribs
->getValueByIndex( n
);
263 case SB_ATTRIBUTE_ALIGN
:
265 if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_ALIGN_LEFT
)
267 nItemBits
|= ItemStyle::ALIGN_LEFT
;
268 nItemBits
&= ~ItemStyle::ALIGN_CENTER
;
270 else if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_ALIGN_CENTER
)
272 nItemBits
|= ItemStyle::ALIGN_CENTER
;
273 nItemBits
&= ~ItemStyle::ALIGN_LEFT
;
275 else if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_ALIGN_RIGHT
)
277 nItemBits
|= ItemStyle::ALIGN_RIGHT
;
281 OUString aErrorMessage
= getErrorLineString();
282 aErrorMessage
+= "Attribute statusbar:align must have one value of 'left','right' or 'center'!";
283 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
288 case SB_ATTRIBUTE_STYLE
:
290 if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_STYLE_IN
)
292 nItemBits
|= ItemStyle::DRAW_IN3D
;
293 nItemBits
&= ~ItemStyle::DRAW_OUT3D
;
295 else if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_STYLE_OUT
)
297 nItemBits
|= ItemStyle::DRAW_OUT3D
;
298 nItemBits
&= ~ItemStyle::DRAW_IN3D
;
300 else if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_STYLE_FLAT
)
302 nItemBits
|= ItemStyle::DRAW_FLAT
;
306 OUString aErrorMessage
= getErrorLineString();
307 aErrorMessage
+= "Attribute statusbar:autosize must have value 'true' or 'false'!";
308 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
313 case SB_ATTRIBUTE_AUTOSIZE
:
315 if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_BOOLEAN_TRUE
)
316 nItemBits
|= ItemStyle::AUTO_SIZE
;
317 else if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_BOOLEAN_FALSE
)
318 nItemBits
&= ~ItemStyle::AUTO_SIZE
;
321 OUString aErrorMessage
= getErrorLineString();
322 aErrorMessage
+= "Attribute statusbar:autosize must have value 'true' or 'false'!";
323 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
328 case SB_ATTRIBUTE_OWNERDRAW
:
330 if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_BOOLEAN_TRUE
)
331 nItemBits
|= ItemStyle::OWNER_DRAW
;
332 else if ( xAttribs
->getValueByIndex( n
) == ATTRIBUTE_BOOLEAN_FALSE
)
333 nItemBits
&= ~ItemStyle::OWNER_DRAW
;
336 OUString aErrorMessage
= getErrorLineString();
337 aErrorMessage
+= "Attribute statusbar:ownerdraw must have value 'true' or 'false'!";
338 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
343 case SB_ATTRIBUTE_WIDTH
:
345 nWidth
= (sal_Int16
)(xAttribs
->getValueByIndex( n
).toInt32());
349 case SB_ATTRIBUTE_OFFSET
:
351 nOffset
= (sal_Int16
)(xAttribs
->getValueByIndex( n
).toInt32());
355 case SB_ATTRIBUTE_HELPURL
:
357 aHelpURL
= xAttribs
->getValueByIndex( n
);
369 OUString aErrorMessage
= getErrorLineString();
370 aErrorMessage
+= "Required attribute statusbar:url must have a value!";
371 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
375 Sequence
< PropertyValue
> aStatusbarItemProp( 6 );
376 aStatusbarItemProp
[0].Name
= ITEM_DESCRIPTOR_COMMANDURL
;
377 aStatusbarItemProp
[1].Name
= ITEM_DESCRIPTOR_HELPURL
;
378 aStatusbarItemProp
[2].Name
= ITEM_DESCRIPTOR_OFFSET
;
379 aStatusbarItemProp
[3].Name
= ITEM_DESCRIPTOR_STYLE
;
380 aStatusbarItemProp
[4].Name
= ITEM_DESCRIPTOR_WIDTH
;
381 aStatusbarItemProp
[5].Name
= ITEM_DESCRIPTOR_TYPE
;
383 aStatusbarItemProp
[0].Value
<<= aCommandURL
;
384 aStatusbarItemProp
[1].Value
<<= aHelpURL
;
385 aStatusbarItemProp
[2].Value
<<= nOffset
;
386 aStatusbarItemProp
[3].Value
<<= nItemBits
;
387 aStatusbarItemProp
[4].Value
<<= nWidth
;
388 aStatusbarItemProp
[5].Value
= makeAny( ::com::sun::star::ui::ItemType::DEFAULT
);
390 m_aStatusBarItems
->insertByIndex( m_aStatusBarItems
->getCount(), makeAny( aStatusbarItemProp
) );
401 void SAL_CALL
OReadStatusBarDocumentHandler::endElement(const OUString
& aName
)
402 throw( SAXException
, RuntimeException
, std::exception
)
406 StatusBarHashMap::const_iterator pStatusBarEntry
= m_aStatusBarMap
.find( aName
);
407 if ( pStatusBarEntry
!= m_aStatusBarMap
.end() )
409 switch ( pStatusBarEntry
->second
)
411 case SB_ELEMENT_STATUSBAR
:
413 if ( !m_bStatusBarStartFound
)
415 OUString aErrorMessage
= getErrorLineString();
416 aErrorMessage
+= "End element 'statusbar' found, but no start element 'statusbar'";
417 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
420 m_bStatusBarStartFound
= false;
424 case SB_ELEMENT_STATUSBARITEM
:
426 if ( !m_bStatusBarItemStartFound
)
428 OUString aErrorMessage
= getErrorLineString();
429 aErrorMessage
+= "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'";
430 throw SAXException( aErrorMessage
, Reference
< XInterface
>(), Any() );
433 m_bStatusBarItemStartFound
= false;
443 void SAL_CALL
OReadStatusBarDocumentHandler::characters(const OUString
&)
444 throw( SAXException
, RuntimeException
, std::exception
)
448 void SAL_CALL
OReadStatusBarDocumentHandler::ignorableWhitespace(const OUString
&)
449 throw( SAXException
, RuntimeException
, std::exception
)
453 void SAL_CALL
OReadStatusBarDocumentHandler::processingInstruction(
454 const OUString
& /*aTarget*/, const OUString
& /*aData*/ )
455 throw( SAXException
, RuntimeException
, std::exception
)
459 void SAL_CALL
OReadStatusBarDocumentHandler::setDocumentLocator(
460 const Reference
< XLocator
> &xLocator
)
461 throw( SAXException
, RuntimeException
, std::exception
)
465 m_xLocator
= xLocator
;
468 OUString
OReadStatusBarDocumentHandler::getErrorLineString()
472 if ( m_xLocator
.is() )
475 snprintf( buffer
, sizeof(buffer
), "Line: %ld - ", static_cast<long>( m_xLocator
->getLineNumber() ));
476 return OUString::createFromAscii( buffer
);
482 // OWriteStatusBarDocumentHandler
484 OWriteStatusBarDocumentHandler::OWriteStatusBarDocumentHandler(
485 const Reference
< XIndexAccess
>& aStatusBarItems
,
486 const Reference
< XDocumentHandler
>& rWriteDocumentHandler
) :
487 m_aStatusBarItems( aStatusBarItems
),
488 m_xWriteDocumentHandler( rWriteDocumentHandler
)
490 ::comphelper::AttributeList
* pList
= new ::comphelper::AttributeList
;
491 m_xEmptyList
= Reference
< XAttributeList
>( (XAttributeList
*) pList
, UNO_QUERY
);
492 m_aAttributeType
= ATTRIBUTE_TYPE_CDATA
;
493 m_aXMLXlinkNS
= XMLNS_XLINK_PREFIX
;
494 m_aXMLStatusBarNS
= XMLNS_STATUSBAR_PREFIX
;
497 OWriteStatusBarDocumentHandler::~OWriteStatusBarDocumentHandler()
501 void OWriteStatusBarDocumentHandler::WriteStatusBarDocument() throw
502 ( SAXException
, RuntimeException
)
506 m_xWriteDocumentHandler
->startDocument();
508 // write DOCTYPE line!
509 Reference
< XExtendedDocumentHandler
> xExtendedDocHandler( m_xWriteDocumentHandler
, UNO_QUERY
);
510 if ( xExtendedDocHandler
.is() )
512 xExtendedDocHandler
->unknown( OUString( STATUSBAR_DOCTYPE
) );
513 m_xWriteDocumentHandler
->ignorableWhitespace( OUString() );
516 ::comphelper::AttributeList
* pList
= new ::comphelper::AttributeList
;
517 Reference
< XAttributeList
> xList( (XAttributeList
*) pList
, UNO_QUERY
);
519 pList
->AddAttribute( OUString( ATTRIBUTE_XMLNS_STATUSBAR
),
521 OUString( XMLNS_STATUSBAR
) );
523 pList
->AddAttribute( OUString( ATTRIBUTE_XMLNS_XLINK
),
525 OUString( XMLNS_XLINK
) );
527 m_xWriteDocumentHandler
->startElement( OUString( ELEMENT_NS_STATUSBAR
), pList
);
528 m_xWriteDocumentHandler
->ignorableWhitespace( OUString() );
530 sal_Int32 nItemCount
= m_aStatusBarItems
->getCount();
533 for ( sal_Int32 nItemPos
= 0; nItemPos
< nItemCount
; nItemPos
++ )
535 Sequence
< PropertyValue
> aProps
;
536 aAny
= m_aStatusBarItems
->getByIndex( nItemPos
);
537 if ( aAny
>>= aProps
)
539 OUString aCommandURL
;
541 sal_Int16
nStyle( ItemStyle::ALIGN_CENTER
|ItemStyle::DRAW_IN3D
);
542 sal_Int16
nWidth( 0 );
543 sal_Int16
nOffset( STATUSBAR_OFFSET
);
545 ExtractStatusbarItemParameters(
553 if ( !aCommandURL
.isEmpty() )
554 WriteStatusBarItem( aCommandURL
, aHelpURL
, nOffset
, nStyle
, nWidth
);
558 m_xWriteDocumentHandler
->ignorableWhitespace( OUString() );
559 m_xWriteDocumentHandler
->endElement( OUString( ELEMENT_NS_STATUSBAR
) );
560 m_xWriteDocumentHandler
->ignorableWhitespace( OUString() );
561 m_xWriteDocumentHandler
->endDocument();
564 // protected member functions
566 void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
567 const OUString
& rCommandURL
,
568 const OUString
& /*rHelpURL*/,
572 throw ( SAXException
, RuntimeException
)
574 ::comphelper::AttributeList
* pList
= new ::comphelper::AttributeList
;
575 Reference
< XAttributeList
> xList( (XAttributeList
*) pList
, UNO_QUERY
);
577 if (m_aAttributeURL
.isEmpty() )
579 m_aAttributeURL
= m_aXMLXlinkNS
;
580 m_aAttributeURL
+= OUString( ATTRIBUTE_URL
);
583 // save required attribute (URL)
584 pList
->AddAttribute( m_aAttributeURL
, m_aAttributeType
, rCommandURL
);
587 if ( nStyle
& ItemStyle::ALIGN_RIGHT
)
589 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_ALIGN
,
591 OUString( ATTRIBUTE_ALIGN_RIGHT
) );
593 else if ( nStyle
& ItemStyle::ALIGN_CENTER
)
595 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_ALIGN
,
597 OUString( ATTRIBUTE_ALIGN_CENTER
) );
601 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_ALIGN
,
603 OUString( ATTRIBUTE_ALIGN_LEFT
) );
606 // style ( SIB_IN is default )
607 if ( nStyle
& ItemStyle::DRAW_FLAT
)
609 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_STYLE
,
611 OUString( ATTRIBUTE_STYLE_FLAT
) );
613 else if ( nStyle
& ItemStyle::DRAW_OUT3D
)
615 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_STYLE
,
617 OUString( ATTRIBUTE_STYLE_OUT
) );
620 // autosize (default sal_False)
621 if ( nStyle
& ItemStyle::AUTO_SIZE
)
623 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_AUTOSIZE
,
625 OUString( ATTRIBUTE_BOOLEAN_TRUE
) );
628 // ownerdraw (default sal_False)
629 if ( nStyle
& ItemStyle::OWNER_DRAW
)
631 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_OWNERDRAW
,
633 OUString( ATTRIBUTE_BOOLEAN_TRUE
) );
639 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_WIDTH
,
641 OUString::number( nWidth
) );
644 // offset (default STATUSBAR_OFFSET)
645 if ( nOffset
!= STATUSBAR_OFFSET
)
647 pList
->AddAttribute( m_aXMLStatusBarNS
+ ATTRIBUTE_OFFSET
,
649 OUString::number( nOffset
) );
652 m_xWriteDocumentHandler
->ignorableWhitespace( OUString() );
653 m_xWriteDocumentHandler
->startElement( OUString( ELEMENT_NS_STATUSBARITEM
), xList
);
654 m_xWriteDocumentHandler
->ignorableWhitespace( OUString() );
655 m_xWriteDocumentHandler
->endElement( OUString( ELEMENT_NS_STATUSBARITEM
) );
658 } // namespace framework
660 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */