calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / framework / source / fwe / xml / statusbardocumenthandler.cxx
blob3786e2fbd29810a240f836a75830badd1eb5ddb9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <xml/statusbardocumenthandler.hxx>
22 #include <com/sun/star/xml/sax/SAXException.hpp>
23 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
24 #include <com/sun/star/ui/ItemStyle.hpp>
25 #include <com/sun/star/ui/ItemType.hpp>
26 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include <com/sun/star/container/XIndexAccess.hpp>
28 #include <com/sun/star/container/XIndexContainer.hpp>
30 #include <vcl/status.hxx>
32 #include <comphelper/attributelist.hxx>
33 #include <comphelper/propertyvalue.hxx>
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::beans;
37 using namespace ::com::sun::star::xml::sax;
38 using namespace ::com::sun::star::ui;
39 using namespace ::com::sun::star::container;
41 constexpr OUStringLiteral XMLNS_STATUSBAR = u"http://openoffice.org/2001/statusbar";
42 constexpr OUStringLiteral XMLNS_XLINK = u"http://www.w3.org/1999/xlink";
43 constexpr OUStringLiteral XMLNS_STATUSBAR_PREFIX = u"statusbar:";
44 constexpr OUStringLiteral XMLNS_XLINK_PREFIX = u"xlink:";
46 constexpr OUStringLiteral XMLNS_FILTER_SEPARATOR = u"^";
48 #define ELEMENT_STATUSBAR "statusbar"
49 #define ELEMENT_STATUSBARITEM "statusbaritem"
51 #define ATTRIBUTE_ALIGN "align"
52 #define ATTRIBUTE_STYLE "style"
53 #define ATTRIBUTE_URL "href"
54 #define ATTRIBUTE_WIDTH "width"
55 #define ATTRIBUTE_OFFSET "offset"
56 #define ATTRIBUTE_AUTOSIZE "autosize"
57 #define ATTRIBUTE_OWNERDRAW "ownerdraw"
58 #define ATTRIBUTE_HELPURL "helpid"
59 #define ATTRIBUTE_MANDATORY "mandatory"
61 constexpr OUStringLiteral ELEMENT_NS_STATUSBAR = u"statusbar:statusbar";
62 constexpr OUStringLiteral ELEMENT_NS_STATUSBARITEM = u"statusbar:statusbaritem";
64 constexpr OUStringLiteral ATTRIBUTE_XMLNS_STATUSBAR = u"xmlns:statusbar";
65 constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink";
67 constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA";
69 constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_TRUE = u"true";
70 constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_FALSE = u"false";
72 constexpr OUStringLiteral ATTRIBUTE_ALIGN_LEFT = u"left";
73 constexpr OUStringLiteral ATTRIBUTE_ALIGN_RIGHT = u"right";
74 constexpr OUStringLiteral ATTRIBUTE_ALIGN_CENTER = u"center";
76 constexpr OUStringLiteral ATTRIBUTE_STYLE_IN = u"in";
77 constexpr OUStringLiteral ATTRIBUTE_STYLE_OUT = u"out";
78 constexpr OUStringLiteral ATTRIBUTE_STYLE_FLAT = u"flat";
80 constexpr OUStringLiteral STATUSBAR_DOCTYPE = u"<!DOCTYPE statusbar:statusbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"statusbar.dtd\">";
82 namespace framework
85 // Property names of a menu/menu item ItemDescriptor
86 constexpr OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL";
87 constexpr OUStringLiteral ITEM_DESCRIPTOR_HELPURL = u"HelpURL";
88 constexpr OUStringLiteral ITEM_DESCRIPTOR_OFFSET = u"Offset";
89 constexpr OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style";
90 constexpr OUStringLiteral ITEM_DESCRIPTOR_WIDTH = u"Width";
91 constexpr OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type";
93 static void ExtractStatusbarItemParameters(
94 const Sequence< PropertyValue >& rProp,
95 OUString& rCommandURL,
96 OUString& rHelpURL,
97 sal_Int16& rOffset,
98 sal_Int16& rStyle,
99 sal_Int16& rWidth )
101 for ( const PropertyValue& rEntry : rProp )
103 if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL )
105 rEntry.Value >>= rCommandURL;
106 rCommandURL = rCommandURL.intern();
108 else if ( rEntry.Name == ITEM_DESCRIPTOR_HELPURL )
110 rEntry.Value >>= rHelpURL;
112 else if ( rEntry.Name == ITEM_DESCRIPTOR_OFFSET )
114 rEntry.Value >>= rOffset;
116 else if ( rEntry.Name == ITEM_DESCRIPTOR_STYLE )
118 rEntry.Value >>= rStyle;
120 else if ( rEntry.Name == ITEM_DESCRIPTOR_WIDTH )
122 rEntry.Value >>= rWidth;
127 namespace {
129 struct StatusBarEntryProperty
131 OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace;
132 char aEntryName[20];
137 StatusBarEntryProperty const StatusBarEntries[OReadStatusBarDocumentHandler::SB_XML_ENTRY_COUNT] =
139 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ELEMENT_STATUSBAR },
140 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ELEMENT_STATUSBARITEM },
141 { OReadStatusBarDocumentHandler::SB_NS_XLINK, ATTRIBUTE_URL },
142 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_ALIGN },
143 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_STYLE },
144 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_AUTOSIZE },
145 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OWNERDRAW },
146 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_WIDTH },
147 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OFFSET },
148 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_HELPURL },
149 { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_MANDATORY }
152 OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
153 const Reference< XIndexContainer >& rStatusBarItems ) :
154 m_aStatusBarItems( rStatusBarItems )
156 // create hash map
157 for ( int i = 0; i < SB_XML_ENTRY_COUNT; i++ )
159 if ( StatusBarEntries[i].nNamespace == SB_NS_STATUSBAR )
161 OUString temp = XMLNS_STATUSBAR + XMLNS_FILTER_SEPARATOR +
162 OUString::createFromAscii( StatusBarEntries[i].aEntryName );
163 m_aStatusBarMap.emplace( temp, static_cast<StatusBar_XML_Entry>(i) );
165 else
167 OUString temp = XMLNS_XLINK + XMLNS_FILTER_SEPARATOR +
168 OUString::createFromAscii( StatusBarEntries[i].aEntryName );
169 m_aStatusBarMap.emplace( temp, static_cast<StatusBar_XML_Entry>(i) );
173 m_bStatusBarStartFound = false;
174 m_bStatusBarItemStartFound = false;
177 OReadStatusBarDocumentHandler::~OReadStatusBarDocumentHandler()
181 // XDocumentHandler
182 void SAL_CALL OReadStatusBarDocumentHandler::startDocument()
186 void SAL_CALL OReadStatusBarDocumentHandler::endDocument()
188 if ( m_bStatusBarStartFound )
190 OUString aErrorMessage = getErrorLineString() + "No matching start or end element 'statusbar' found!";
191 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
195 void SAL_CALL OReadStatusBarDocumentHandler::startElement(
196 const OUString& aName, const Reference< XAttributeList > &xAttribs )
198 StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName );
199 if ( pStatusBarEntry == m_aStatusBarMap.end() )
200 return;
202 switch ( pStatusBarEntry->second )
204 case SB_ELEMENT_STATUSBAR:
206 if ( m_bStatusBarStartFound )
208 OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbar' cannot be embedded into 'statusbar:statusbar'!";
209 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
212 m_bStatusBarStartFound = true;
214 break;
216 case SB_ELEMENT_STATUSBARITEM:
218 if ( !m_bStatusBarStartFound )
220 OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbaritem' must be embedded into element 'statusbar:statusbar'!";
221 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
224 if ( m_bStatusBarItemStartFound )
226 OUString aErrorMessage = getErrorLineString() + "Element statusbar:statusbaritem is not a container!";
227 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
230 OUString aCommandURL;
231 OUString aHelpURL;
232 sal_Int16 nItemBits( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D|ItemStyle::MANDATORY );
233 sal_Int16 nWidth( 0 );
234 sal_Int16 nOffset( STATUSBAR_OFFSET );
235 bool bCommandURL( false );
237 m_bStatusBarItemStartFound = true;
238 for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
240 pStatusBarEntry = m_aStatusBarMap.find( xAttribs->getNameByIndex( n ) );
241 if ( pStatusBarEntry != m_aStatusBarMap.end() )
243 switch ( pStatusBarEntry->second )
245 case SB_ATTRIBUTE_URL:
247 bCommandURL = true;
248 aCommandURL = xAttribs->getValueByIndex( n );
250 break;
252 case SB_ATTRIBUTE_ALIGN:
254 if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_LEFT )
256 nItemBits |= ItemStyle::ALIGN_LEFT;
257 nItemBits &= ~ItemStyle::ALIGN_CENTER;
259 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_CENTER )
261 nItemBits |= ItemStyle::ALIGN_CENTER;
262 nItemBits &= ~ItemStyle::ALIGN_LEFT;
264 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_RIGHT )
266 nItemBits |= ItemStyle::ALIGN_RIGHT;
268 else
270 OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:align must have one value of 'left','right' or 'center'!";
271 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
274 break;
276 case SB_ATTRIBUTE_STYLE:
278 if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_IN )
280 nItemBits |= ItemStyle::DRAW_IN3D;
281 nItemBits &= ~ItemStyle::DRAW_OUT3D;
283 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_OUT )
285 nItemBits |= ItemStyle::DRAW_OUT3D;
286 nItemBits &= ~ItemStyle::DRAW_IN3D;
288 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_FLAT )
290 nItemBits |= ItemStyle::DRAW_FLAT;
292 else
294 OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!";
295 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
298 break;
300 case SB_ATTRIBUTE_AUTOSIZE:
302 if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
303 nItemBits |= ItemStyle::AUTO_SIZE;
304 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
305 nItemBits &= ~ItemStyle::AUTO_SIZE;
306 else
308 OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!";
309 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
312 break;
314 case SB_ATTRIBUTE_OWNERDRAW:
316 if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
317 nItemBits |= ItemStyle::OWNER_DRAW;
318 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
319 nItemBits &= ~ItemStyle::OWNER_DRAW;
320 else
322 OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:ownerdraw must have value 'true' or 'false'!";
323 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
326 break;
328 case SB_ATTRIBUTE_WIDTH:
330 nWidth = static_cast<sal_Int16>(xAttribs->getValueByIndex( n ).toInt32());
332 break;
334 case SB_ATTRIBUTE_OFFSET:
336 nOffset = static_cast<sal_Int16>(xAttribs->getValueByIndex( n ).toInt32());
338 break;
340 case SB_ATTRIBUTE_HELPURL:
342 aHelpURL = xAttribs->getValueByIndex( n );
344 break;
346 case SB_ATTRIBUTE_MANDATORY:
348 if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
349 nItemBits |= ItemStyle::MANDATORY;
350 else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
351 nItemBits &= ~ItemStyle::MANDATORY;
352 else
354 OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:mandatory must have value 'true' or 'false'!";
355 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
358 break;
360 default:
361 break;
364 } // for
366 if ( !bCommandURL )
368 OUString aErrorMessage = getErrorLineString() + "Required attribute statusbar:url must have a value!";
369 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
371 else
373 Sequence< PropertyValue > aStatusbarItemProp{
374 comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, aCommandURL),
375 comphelper::makePropertyValue(ITEM_DESCRIPTOR_HELPURL, aHelpURL),
376 comphelper::makePropertyValue(ITEM_DESCRIPTOR_OFFSET, nOffset),
377 comphelper::makePropertyValue(ITEM_DESCRIPTOR_STYLE, nItemBits),
378 comphelper::makePropertyValue(ITEM_DESCRIPTOR_WIDTH, nWidth),
379 comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::DEFAULT)
382 m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), Any( aStatusbarItemProp ) );
385 break;
387 default:
388 break;
392 void SAL_CALL OReadStatusBarDocumentHandler::endElement(const OUString& aName)
394 StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName );
395 if ( pStatusBarEntry == m_aStatusBarMap.end() )
396 return;
398 switch ( pStatusBarEntry->second )
400 case SB_ELEMENT_STATUSBAR:
402 if ( !m_bStatusBarStartFound )
404 OUString aErrorMessage = getErrorLineString() + "End element 'statusbar' found, but no start element 'statusbar'";
405 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
408 m_bStatusBarStartFound = false;
410 break;
412 case SB_ELEMENT_STATUSBARITEM:
414 if ( !m_bStatusBarItemStartFound )
416 OUString aErrorMessage = getErrorLineString() + "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'";
417 throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
420 m_bStatusBarItemStartFound = false;
422 break;
424 default: break;
428 void SAL_CALL OReadStatusBarDocumentHandler::characters(const OUString&)
432 void SAL_CALL OReadStatusBarDocumentHandler::ignorableWhitespace(const OUString&)
436 void SAL_CALL OReadStatusBarDocumentHandler::processingInstruction(
437 const OUString& /*aTarget*/, const OUString& /*aData*/ )
441 void SAL_CALL OReadStatusBarDocumentHandler::setDocumentLocator(
442 const Reference< XLocator > &xLocator)
444 m_xLocator = xLocator;
447 OUString OReadStatusBarDocumentHandler::getErrorLineString()
449 if ( m_xLocator.is() )
450 return "Line: " + OUString::number( m_xLocator->getLineNumber() ) + " - ";
451 else
452 return OUString();
455 // OWriteStatusBarDocumentHandler
457 OWriteStatusBarDocumentHandler::OWriteStatusBarDocumentHandler(
458 const Reference< XIndexAccess >& aStatusBarItems,
459 const Reference< XDocumentHandler >& rWriteDocumentHandler ) :
460 m_aStatusBarItems( aStatusBarItems ),
461 m_xWriteDocumentHandler( rWriteDocumentHandler )
463 m_xEmptyList = new ::comphelper::AttributeList;
464 m_aAttributeType = ATTRIBUTE_TYPE_CDATA;
465 m_aXMLXlinkNS = XMLNS_XLINK_PREFIX;
466 m_aXMLStatusBarNS = XMLNS_STATUSBAR_PREFIX;
469 OWriteStatusBarDocumentHandler::~OWriteStatusBarDocumentHandler()
473 void OWriteStatusBarDocumentHandler::WriteStatusBarDocument()
475 m_xWriteDocumentHandler->startDocument();
477 // write DOCTYPE line!
478 Reference< XExtendedDocumentHandler > xExtendedDocHandler( m_xWriteDocumentHandler, UNO_QUERY );
479 if ( xExtendedDocHandler.is() )
481 xExtendedDocHandler->unknown( STATUSBAR_DOCTYPE );
482 m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
485 rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList;
487 pList->AddAttribute( ATTRIBUTE_XMLNS_STATUSBAR,
488 m_aAttributeType,
489 XMLNS_STATUSBAR );
491 pList->AddAttribute( ATTRIBUTE_XMLNS_XLINK,
492 m_aAttributeType,
493 XMLNS_XLINK );
495 m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBAR, pList );
496 m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
498 sal_Int32 nItemCount = m_aStatusBarItems->getCount();
499 Any aAny;
501 for ( sal_Int32 nItemPos = 0; nItemPos < nItemCount; nItemPos++ )
503 Sequence< PropertyValue > aProps;
504 aAny = m_aStatusBarItems->getByIndex( nItemPos );
505 if ( aAny >>= aProps )
507 OUString aCommandURL;
508 OUString aHelpURL;
509 sal_Int16 nStyle( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D );
510 sal_Int16 nWidth( 0 );
511 sal_Int16 nOffset( STATUSBAR_OFFSET );
513 ExtractStatusbarItemParameters(
514 aProps,
515 aCommandURL,
516 aHelpURL,
517 nOffset,
518 nStyle,
519 nWidth );
521 if ( !aCommandURL.isEmpty() )
522 WriteStatusBarItem( aCommandURL, nOffset, nStyle, nWidth );
526 m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
527 m_xWriteDocumentHandler->endElement( ELEMENT_NS_STATUSBAR );
528 m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
529 m_xWriteDocumentHandler->endDocument();
532 // protected member functions
534 void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
535 const OUString& rCommandURL,
536 sal_Int16 nOffset,
537 sal_Int16 nStyle,
538 sal_Int16 nWidth )
540 rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList;
542 if (m_aAttributeURL.isEmpty() )
544 m_aAttributeURL = m_aXMLXlinkNS + ATTRIBUTE_URL;
547 // save required attribute (URL)
548 pList->AddAttribute( m_aAttributeURL, m_aAttributeType, rCommandURL );
550 // alignment
551 if ( nStyle & ItemStyle::ALIGN_RIGHT )
553 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_ALIGN,
554 m_aAttributeType,
555 ATTRIBUTE_ALIGN_RIGHT );
557 else if ( nStyle & ItemStyle::ALIGN_CENTER )
559 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_ALIGN,
560 m_aAttributeType,
561 ATTRIBUTE_ALIGN_CENTER );
563 else
565 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_ALIGN,
566 m_aAttributeType,
567 ATTRIBUTE_ALIGN_LEFT );
570 // style ( StatusBarItemBits::In is default )
571 if ( nStyle & ItemStyle::DRAW_FLAT )
573 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_STYLE,
574 m_aAttributeType,
575 ATTRIBUTE_STYLE_FLAT );
577 else if ( nStyle & ItemStyle::DRAW_OUT3D )
579 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_STYLE,
580 m_aAttributeType,
581 ATTRIBUTE_STYLE_OUT );
584 // autosize (default sal_False)
585 if ( nStyle & ItemStyle::AUTO_SIZE )
587 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_AUTOSIZE,
588 m_aAttributeType,
589 ATTRIBUTE_BOOLEAN_TRUE );
592 // ownerdraw (default sal_False)
593 if ( nStyle & ItemStyle::OWNER_DRAW )
595 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_OWNERDRAW,
596 m_aAttributeType,
597 ATTRIBUTE_BOOLEAN_TRUE );
600 // width (default 0)
601 if ( nWidth > 0 )
603 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_WIDTH,
604 m_aAttributeType,
605 OUString::number( nWidth ) );
608 // offset (default STATUSBAR_OFFSET)
609 if ( nOffset != STATUSBAR_OFFSET )
611 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_OFFSET,
612 m_aAttributeType,
613 OUString::number( nOffset ) );
616 // mandatory (default sal_True)
617 if ( !( nStyle & ItemStyle::MANDATORY ) )
619 pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_MANDATORY,
620 m_aAttributeType,
621 ATTRIBUTE_BOOLEAN_FALSE );
624 m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
625 m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBARITEM, pList );
626 m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
627 m_xWriteDocumentHandler->endElement( ELEMENT_NS_STATUSBARITEM );
630 } // namespace framework
632 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */