1*6d739b60SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6d739b60SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6d739b60SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6d739b60SAndrew Rist * distributed with this work for additional information 6*6d739b60SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6d739b60SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6d739b60SAndrew Rist * "License"); you may not use this file except in compliance 9*6d739b60SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*6d739b60SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*6d739b60SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6d739b60SAndrew Rist * software distributed under the License is distributed on an 15*6d739b60SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6d739b60SAndrew Rist * KIND, either express or implied. See the License for the 17*6d739b60SAndrew Rist * specific language governing permissions and limitations 18*6d739b60SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*6d739b60SAndrew Rist *************************************************************/ 21*6d739b60SAndrew Rist 22*6d739b60SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_framework.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <stdio.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 30cdf0e10cSrcweir // my own includes 31cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx> 34cdf0e10cSrcweir #include <xml/statusbardocumenthandler.hxx> 35cdf0e10cSrcweir #include <macros/debug.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 38cdf0e10cSrcweir // interface includes 39cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 40cdf0e10cSrcweir 41cdf0e10cSrcweir #ifndef __COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ 42cdf0e10cSrcweir #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #include <com/sun/star/ui/ItemStyle.hpp> 45cdf0e10cSrcweir #include <com/sun/star/ui/ItemType.hpp> 46cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 47cdf0e10cSrcweir 48cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 49cdf0e10cSrcweir // other includes 50cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 51cdf0e10cSrcweir #include <vcl/svapp.hxx> 52cdf0e10cSrcweir #include <vcl/status.hxx> 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include <comphelper/attributelist.hxx> 55cdf0e10cSrcweir 56cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 57cdf0e10cSrcweir // namespace 58cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 59cdf0e10cSrcweir 60cdf0e10cSrcweir using namespace ::com::sun::star::uno; 61cdf0e10cSrcweir using namespace ::com::sun::star::beans; 62cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax; 63cdf0e10cSrcweir using namespace ::com::sun::star::ui; 64cdf0e10cSrcweir using namespace ::com::sun::star::container; 65cdf0e10cSrcweir 66cdf0e10cSrcweir #define XMLNS_STATUSBAR "http://openoffice.org/2001/statusbar" 67cdf0e10cSrcweir #define XMLNS_XLINK "http://www.w3.org/1999/xlink" 68cdf0e10cSrcweir #define XMLNS_STATUSBAR_PREFIX "statusbar:" 69cdf0e10cSrcweir #define XMLNS_XLINK_PREFIX "xlink:" 70cdf0e10cSrcweir 71cdf0e10cSrcweir #define XMLNS_FILTER_SEPARATOR "^" 72cdf0e10cSrcweir 73cdf0e10cSrcweir #define ELEMENT_STATUSBAR "statusbar" 74cdf0e10cSrcweir #define ELEMENT_STATUSBARITEM "statusbaritem" 75cdf0e10cSrcweir 76cdf0e10cSrcweir #define ATTRIBUTE_ALIGN "align" 77cdf0e10cSrcweir #define ATTRIBUTE_STYLE "style" 78cdf0e10cSrcweir #define ATTRIBUTE_URL "href" 79cdf0e10cSrcweir #define ATTRIBUTE_WIDTH "width" 80cdf0e10cSrcweir #define ATTRIBUTE_OFFSET "offset" 81cdf0e10cSrcweir #define ATTRIBUTE_AUTOSIZE "autosize" 82cdf0e10cSrcweir #define ATTRIBUTE_OWNERDRAW "ownerdraw" 83cdf0e10cSrcweir #define ATTRIBUTE_HELPURL "helpid" 84cdf0e10cSrcweir 85cdf0e10cSrcweir #define ELEMENT_NS_STATUSBAR "statusbar:statusbar" 86cdf0e10cSrcweir #define ELEMENT_NS_STATUSBARITEM "statusbar:statusbaritem" 87cdf0e10cSrcweir 88cdf0e10cSrcweir #define ATTRIBUTE_XMLNS_STATUSBAR "xmlns:statusbar" 89cdf0e10cSrcweir #define ATTRIBUTE_XMLNS_XLINK "xmlns:xlink" 90cdf0e10cSrcweir 91cdf0e10cSrcweir #define ATTRIBUTE_TYPE_CDATA "CDATA" 92cdf0e10cSrcweir 93cdf0e10cSrcweir #define ATTRIBUTE_BOOLEAN_TRUE "true" 94cdf0e10cSrcweir #define ATTRIBUTE_BOOLEAN_FALSE "false" 95cdf0e10cSrcweir 96cdf0e10cSrcweir #define ATTRIBUTE_ALIGN_LEFT "left" 97cdf0e10cSrcweir #define ATTRIBUTE_ALIGN_RIGHT "right" 98cdf0e10cSrcweir #define ATTRIBUTE_ALIGN_CENTER "center" 99cdf0e10cSrcweir 100cdf0e10cSrcweir #define ATTRIBUTE_STYLE_IN "in" 101cdf0e10cSrcweir #define ATTRIBUTE_STYLE_OUT "out" 102cdf0e10cSrcweir #define ATTRIBUTE_STYLE_FLAT "flat" 103cdf0e10cSrcweir 104cdf0e10cSrcweir #define STATUSBAR_DOCTYPE "<!DOCTYPE statusbar:statusbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"statusbar.dtd\">" 105cdf0e10cSrcweir 106cdf0e10cSrcweir namespace framework 107cdf0e10cSrcweir { 108cdf0e10cSrcweir 109cdf0e10cSrcweir // Property names of a menu/menu item ItemDescriptor 110cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; 111cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL"; 112cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_OFFSET[] = "Offset"; 113cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; 114cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_WIDTH[] = "Width"; 115cdf0e10cSrcweir static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; 116cdf0e10cSrcweir 117cdf0e10cSrcweir static void ExtractStatusbarItemParameters( 118cdf0e10cSrcweir const Sequence< PropertyValue > rProp, 119cdf0e10cSrcweir ::rtl::OUString& rCommandURL, 120cdf0e10cSrcweir ::rtl::OUString& rHelpURL, 121cdf0e10cSrcweir sal_Int16& rOffset, 122cdf0e10cSrcweir sal_Int16& rStyle, 123cdf0e10cSrcweir sal_Int16& rWidth ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir for ( sal_Int32 i = 0; i < rProp.getLength(); i++ ) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL )) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir rProp[i].Value >>= rCommandURL; 130cdf0e10cSrcweir rCommandURL = rCommandURL.intern(); 131cdf0e10cSrcweir } 132cdf0e10cSrcweir else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL )) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir rProp[i].Value >>= rHelpURL; 135cdf0e10cSrcweir } 136cdf0e10cSrcweir else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_OFFSET )) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir rProp[i].Value >>= rOffset; 139cdf0e10cSrcweir } 140cdf0e10cSrcweir else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE )) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir rProp[i].Value >>= rStyle; 143cdf0e10cSrcweir } 144cdf0e10cSrcweir else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_WIDTH )) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir rProp[i].Value >>= rWidth; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir } 149cdf0e10cSrcweir } 150cdf0e10cSrcweir 151cdf0e10cSrcweir struct StatusBarEntryProperty 152cdf0e10cSrcweir { 153cdf0e10cSrcweir OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace; 154cdf0e10cSrcweir char aEntryName[20]; 155cdf0e10cSrcweir }; 156cdf0e10cSrcweir 157cdf0e10cSrcweir StatusBarEntryProperty StatusBarEntries[OReadStatusBarDocumentHandler::SB_XML_ENTRY_COUNT] = 158cdf0e10cSrcweir { 159cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ELEMENT_STATUSBAR }, 160cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ELEMENT_STATUSBARITEM }, 161cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_XLINK, ATTRIBUTE_URL }, 162cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_ALIGN }, 163cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_STYLE }, 164cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_AUTOSIZE }, 165cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OWNERDRAW }, 166cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_WIDTH }, 167cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OFFSET }, 168cdf0e10cSrcweir { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_HELPURL } 169cdf0e10cSrcweir }; 170cdf0e10cSrcweir 171cdf0e10cSrcweir 172cdf0e10cSrcweir OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler( 173cdf0e10cSrcweir const Reference< XIndexContainer >& rStatusBarItems ) : 174cdf0e10cSrcweir ThreadHelpBase( &Application::GetSolarMutex() ), 175cdf0e10cSrcweir m_aStatusBarItems( rStatusBarItems ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir ::rtl::OUString aNamespaceStatusBar( RTL_CONSTASCII_USTRINGPARAM( XMLNS_STATUSBAR )); 178cdf0e10cSrcweir ::rtl::OUString aNamespaceXLink( RTL_CONSTASCII_USTRINGPARAM( XMLNS_XLINK )); 179cdf0e10cSrcweir ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( XMLNS_FILTER_SEPARATOR )); 180cdf0e10cSrcweir 181cdf0e10cSrcweir // create hash map 182cdf0e10cSrcweir for ( int i = 0; i < (int)SB_XML_ENTRY_COUNT; i++ ) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir if ( StatusBarEntries[i].nNamespace == SB_NS_STATUSBAR ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir ::rtl::OUString temp( aNamespaceStatusBar ); 187cdf0e10cSrcweir temp += aSeparator; 188cdf0e10cSrcweir temp += ::rtl::OUString::createFromAscii( StatusBarEntries[i].aEntryName ); 189cdf0e10cSrcweir m_aStatusBarMap.insert( StatusBarHashMap::value_type( temp, (StatusBar_XML_Entry)i ) ); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir else 192cdf0e10cSrcweir { 193cdf0e10cSrcweir ::rtl::OUString temp( aNamespaceXLink ); 194cdf0e10cSrcweir temp += aSeparator; 195cdf0e10cSrcweir temp += ::rtl::OUString::createFromAscii( StatusBarEntries[i].aEntryName ); 196cdf0e10cSrcweir m_aStatusBarMap.insert( StatusBarHashMap::value_type( temp, (StatusBar_XML_Entry)i ) ); 197cdf0e10cSrcweir } 198cdf0e10cSrcweir } 199cdf0e10cSrcweir 200cdf0e10cSrcweir m_bStatusBarStartFound = sal_False; 201cdf0e10cSrcweir m_bStatusBarEndFound = sal_False; 202cdf0e10cSrcweir m_bStatusBarItemStartFound = sal_False; 203cdf0e10cSrcweir } 204cdf0e10cSrcweir 205cdf0e10cSrcweir OReadStatusBarDocumentHandler::~OReadStatusBarDocumentHandler() 206cdf0e10cSrcweir { 207cdf0e10cSrcweir } 208cdf0e10cSrcweir 209cdf0e10cSrcweir // XDocumentHandler 210cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::startDocument(void) 211cdf0e10cSrcweir throw ( SAXException, RuntimeException ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir } 214cdf0e10cSrcweir 215cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::endDocument(void) 216cdf0e10cSrcweir throw( SAXException, RuntimeException ) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 219cdf0e10cSrcweir 220cdf0e10cSrcweir if (( m_bStatusBarStartFound && !m_bStatusBarEndFound ) || 221cdf0e10cSrcweir ( !m_bStatusBarStartFound && m_bStatusBarEndFound ) ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 224cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No matching start or end element 'statusbar' found!" )); 225cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir } 228cdf0e10cSrcweir 229cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::startElement( 230cdf0e10cSrcweir const ::rtl::OUString& aName, const Reference< XAttributeList > &xAttribs ) 231cdf0e10cSrcweir throw( SAXException, RuntimeException ) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 234cdf0e10cSrcweir 235cdf0e10cSrcweir StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName ) ; 236cdf0e10cSrcweir if ( pStatusBarEntry != m_aStatusBarMap.end() ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir switch ( pStatusBarEntry->second ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir case SB_ELEMENT_STATUSBAR: 241cdf0e10cSrcweir { 242cdf0e10cSrcweir if ( m_bStatusBarStartFound ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 245cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Element 'statusbar:statusbar' cannot be embeded into 'statusbar:statusbar'!" )); 246cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir m_bStatusBarStartFound = sal_True; 250cdf0e10cSrcweir } 251cdf0e10cSrcweir break; 252cdf0e10cSrcweir 253cdf0e10cSrcweir case SB_ELEMENT_STATUSBARITEM: 254cdf0e10cSrcweir { 255cdf0e10cSrcweir if ( !m_bStatusBarStartFound ) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 258cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Element 'statusbar:statusbaritem' must be embeded into element 'statusbar:statusbar'!" )); 259cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir 262cdf0e10cSrcweir if ( m_bStatusBarItemStartFound ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 265cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Element statusbar:statusbaritem is not a container!" )); 266cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 267cdf0e10cSrcweir } 268cdf0e10cSrcweir 269cdf0e10cSrcweir ::rtl::OUString aCommandURL; 270cdf0e10cSrcweir ::rtl::OUString aHelpURL; 271cdf0e10cSrcweir sal_Int16 nItemBits( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D ); 272cdf0e10cSrcweir sal_Int16 nWidth( 0 ); 273cdf0e10cSrcweir sal_Int16 nOffset( STATUSBAR_OFFSET ); 274cdf0e10cSrcweir sal_Bool bCommandURL( sal_False ); 275cdf0e10cSrcweir 276cdf0e10cSrcweir m_bStatusBarItemStartFound = sal_True; 277cdf0e10cSrcweir for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ ) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir pStatusBarEntry = m_aStatusBarMap.find( xAttribs->getNameByIndex( n ) ); 280cdf0e10cSrcweir if ( pStatusBarEntry != m_aStatusBarMap.end() ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir switch ( pStatusBarEntry->second ) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir case SB_ATTRIBUTE_URL: 285cdf0e10cSrcweir { 286cdf0e10cSrcweir bCommandURL = sal_True; 287cdf0e10cSrcweir aCommandURL = xAttribs->getValueByIndex( n ); 288cdf0e10cSrcweir } 289cdf0e10cSrcweir break; 290cdf0e10cSrcweir 291cdf0e10cSrcweir case SB_ATTRIBUTE_ALIGN: 292cdf0e10cSrcweir { 293cdf0e10cSrcweir if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ALIGN_LEFT )) ) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir nItemBits |= ItemStyle::ALIGN_LEFT; 296cdf0e10cSrcweir nItemBits &= ~ItemStyle::ALIGN_CENTER; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir else if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ALIGN_CENTER )) ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir nItemBits |= ItemStyle::ALIGN_CENTER; 301cdf0e10cSrcweir nItemBits &= ~ItemStyle::ALIGN_LEFT; 302cdf0e10cSrcweir } 303cdf0e10cSrcweir else if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ALIGN_RIGHT )) ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir nItemBits |= ItemStyle::ALIGN_RIGHT; 306cdf0e10cSrcweir } 307cdf0e10cSrcweir else 308cdf0e10cSrcweir { 309cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 310cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Attribute statusbar:align must have one value of 'left','right' or 'center'!" )); 311cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir } 314cdf0e10cSrcweir break; 315cdf0e10cSrcweir 316cdf0e10cSrcweir case SB_ATTRIBUTE_STYLE: 317cdf0e10cSrcweir { 318cdf0e10cSrcweir if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE_IN )) ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir nItemBits |= ItemStyle::DRAW_IN3D; 321cdf0e10cSrcweir nItemBits &= ~ItemStyle::DRAW_OUT3D; 322cdf0e10cSrcweir } 323cdf0e10cSrcweir else if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE_OUT )) ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir nItemBits |= ItemStyle::DRAW_OUT3D; 326cdf0e10cSrcweir nItemBits &= ~ItemStyle::DRAW_IN3D; 327cdf0e10cSrcweir } 328cdf0e10cSrcweir else if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE_FLAT )) ) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir nItemBits |= ItemStyle::DRAW_FLAT; 331cdf0e10cSrcweir } 332cdf0e10cSrcweir else 333cdf0e10cSrcweir { 334cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 335cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Attribute statusbar:autosize must have value 'true' or 'false'!" )); 336cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir } 339cdf0e10cSrcweir break; 340cdf0e10cSrcweir 341cdf0e10cSrcweir case SB_ATTRIBUTE_AUTOSIZE: 342cdf0e10cSrcweir { 343cdf0e10cSrcweir if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_BOOLEAN_TRUE )) ) 344cdf0e10cSrcweir nItemBits |= ItemStyle::AUTO_SIZE; 345cdf0e10cSrcweir else if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_BOOLEAN_FALSE )) ) 346cdf0e10cSrcweir nItemBits &= ~ItemStyle::AUTO_SIZE; 347cdf0e10cSrcweir else 348cdf0e10cSrcweir { 349cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 350cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Attribute statusbar:autosize must have value 'true' or 'false'!" )); 351cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir } 354cdf0e10cSrcweir break; 355cdf0e10cSrcweir 356cdf0e10cSrcweir case SB_ATTRIBUTE_OWNERDRAW: 357cdf0e10cSrcweir { 358cdf0e10cSrcweir if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_BOOLEAN_TRUE )) ) 359cdf0e10cSrcweir nItemBits |= ItemStyle::OWNER_DRAW; 360cdf0e10cSrcweir else if ( xAttribs->getValueByIndex( n ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_BOOLEAN_FALSE )) ) 361cdf0e10cSrcweir nItemBits &= ~ItemStyle::OWNER_DRAW; 362cdf0e10cSrcweir else 363cdf0e10cSrcweir { 364cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 365cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Attribute statusbar:ownerdraw must have value 'true' or 'false'!" )); 366cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } 369cdf0e10cSrcweir break; 370cdf0e10cSrcweir 371cdf0e10cSrcweir case SB_ATTRIBUTE_WIDTH: 372cdf0e10cSrcweir { 373cdf0e10cSrcweir nWidth = (sal_Int16)(xAttribs->getValueByIndex( n ).toInt32()); 374cdf0e10cSrcweir } 375cdf0e10cSrcweir break; 376cdf0e10cSrcweir 377cdf0e10cSrcweir case SB_ATTRIBUTE_OFFSET: 378cdf0e10cSrcweir { 379cdf0e10cSrcweir nOffset = (sal_Int16)(xAttribs->getValueByIndex( n ).toInt32()); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir break; 382cdf0e10cSrcweir 383cdf0e10cSrcweir case SB_ATTRIBUTE_HELPURL: 384cdf0e10cSrcweir { 385cdf0e10cSrcweir aHelpURL = xAttribs->getValueByIndex( n ); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir break; 388cdf0e10cSrcweir 389cdf0e10cSrcweir default: 390cdf0e10cSrcweir break; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393cdf0e10cSrcweir } // for 394cdf0e10cSrcweir 395cdf0e10cSrcweir if ( !bCommandURL ) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 398cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Required attribute statusbar:url must have a value!" )); 399cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir else 402cdf0e10cSrcweir { 403cdf0e10cSrcweir Sequence< PropertyValue > aStatusbarItemProp( 6 ); 404cdf0e10cSrcweir aStatusbarItemProp[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL )); 405cdf0e10cSrcweir aStatusbarItemProp[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )); 406cdf0e10cSrcweir aStatusbarItemProp[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_OFFSET )); 407cdf0e10cSrcweir aStatusbarItemProp[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE )); 408cdf0e10cSrcweir aStatusbarItemProp[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_WIDTH )); 409cdf0e10cSrcweir aStatusbarItemProp[5].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE )); 410cdf0e10cSrcweir 411cdf0e10cSrcweir aStatusbarItemProp[0].Value <<= aCommandURL; 412cdf0e10cSrcweir aStatusbarItemProp[1].Value <<= aHelpURL; 413cdf0e10cSrcweir aStatusbarItemProp[2].Value <<= nOffset; 414cdf0e10cSrcweir aStatusbarItemProp[3].Value <<= nItemBits; 415cdf0e10cSrcweir aStatusbarItemProp[4].Value <<= nWidth; 416cdf0e10cSrcweir aStatusbarItemProp[5].Value = makeAny( ::com::sun::star::ui::ItemType::DEFAULT ); 417cdf0e10cSrcweir 418cdf0e10cSrcweir m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), makeAny( aStatusbarItemProp ) ); 419cdf0e10cSrcweir } 420cdf0e10cSrcweir } 421cdf0e10cSrcweir break; 422cdf0e10cSrcweir 423cdf0e10cSrcweir default: 424cdf0e10cSrcweir break; 425cdf0e10cSrcweir } 426cdf0e10cSrcweir } 427cdf0e10cSrcweir } 428cdf0e10cSrcweir 429cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::endElement(const ::rtl::OUString& aName) 430cdf0e10cSrcweir throw( SAXException, RuntimeException ) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 433cdf0e10cSrcweir 434cdf0e10cSrcweir StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName ) ; 435cdf0e10cSrcweir if ( pStatusBarEntry != m_aStatusBarMap.end() ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir switch ( pStatusBarEntry->second ) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir case SB_ELEMENT_STATUSBAR: 440cdf0e10cSrcweir { 441cdf0e10cSrcweir if ( !m_bStatusBarStartFound ) 442cdf0e10cSrcweir { 443cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 444cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "End element 'statusbar' found, but no start element 'statusbar'" )); 445cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 446cdf0e10cSrcweir } 447cdf0e10cSrcweir 448cdf0e10cSrcweir m_bStatusBarStartFound = sal_False; 449cdf0e10cSrcweir } 450cdf0e10cSrcweir break; 451cdf0e10cSrcweir 452cdf0e10cSrcweir case SB_ELEMENT_STATUSBARITEM: 453cdf0e10cSrcweir { 454cdf0e10cSrcweir if ( !m_bStatusBarItemStartFound ) 455cdf0e10cSrcweir { 456cdf0e10cSrcweir ::rtl::OUString aErrorMessage = getErrorLineString(); 457cdf0e10cSrcweir aErrorMessage += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'" )); 458cdf0e10cSrcweir throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir 461cdf0e10cSrcweir m_bStatusBarItemStartFound = sal_False; 462cdf0e10cSrcweir } 463cdf0e10cSrcweir break; 464cdf0e10cSrcweir 465cdf0e10cSrcweir default: 466cdf0e10cSrcweir break; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir } 469cdf0e10cSrcweir } 470cdf0e10cSrcweir 471cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::characters(const ::rtl::OUString&) 472cdf0e10cSrcweir throw( SAXException, RuntimeException ) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::ignorableWhitespace(const ::rtl::OUString&) 477cdf0e10cSrcweir throw( SAXException, RuntimeException ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir } 480cdf0e10cSrcweir 481cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::processingInstruction( 482cdf0e10cSrcweir const ::rtl::OUString& /*aTarget*/, const ::rtl::OUString& /*aData*/ ) 483cdf0e10cSrcweir throw( SAXException, RuntimeException ) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir void SAL_CALL OReadStatusBarDocumentHandler::setDocumentLocator( 488cdf0e10cSrcweir const Reference< XLocator > &xLocator) 489cdf0e10cSrcweir throw( SAXException, RuntimeException ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 492cdf0e10cSrcweir 493cdf0e10cSrcweir m_xLocator = xLocator; 494cdf0e10cSrcweir } 495cdf0e10cSrcweir 496cdf0e10cSrcweir ::rtl::OUString OReadStatusBarDocumentHandler::getErrorLineString() 497cdf0e10cSrcweir { 498cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 499cdf0e10cSrcweir 500cdf0e10cSrcweir char buffer[32]; 501cdf0e10cSrcweir 502cdf0e10cSrcweir if ( m_xLocator.is() ) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir snprintf( buffer, sizeof(buffer), "Line: %ld - ", static_cast<long>( m_xLocator->getLineNumber() )); 505cdf0e10cSrcweir return ::rtl::OUString::createFromAscii( buffer ); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir else 508cdf0e10cSrcweir return ::rtl::OUString(); 509cdf0e10cSrcweir } 510cdf0e10cSrcweir 511cdf0e10cSrcweir 512cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 513cdf0e10cSrcweir // OWriteStatusBarDocumentHandler 514cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 515cdf0e10cSrcweir 516cdf0e10cSrcweir OWriteStatusBarDocumentHandler::OWriteStatusBarDocumentHandler( 517cdf0e10cSrcweir const Reference< XIndexAccess >& aStatusBarItems, 518cdf0e10cSrcweir const Reference< XDocumentHandler >& rWriteDocumentHandler ) : 519cdf0e10cSrcweir ThreadHelpBase( &Application::GetSolarMutex() ), 520cdf0e10cSrcweir m_aStatusBarItems( aStatusBarItems ), 521cdf0e10cSrcweir m_xWriteDocumentHandler( rWriteDocumentHandler ) 522cdf0e10cSrcweir { 523cdf0e10cSrcweir ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 524cdf0e10cSrcweir m_xEmptyList = Reference< XAttributeList >( (XAttributeList *) pList, UNO_QUERY ); 525cdf0e10cSrcweir m_aAttributeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA )); 526cdf0e10cSrcweir m_aXMLXlinkNS = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_XLINK_PREFIX )); 527cdf0e10cSrcweir m_aXMLStatusBarNS = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_STATUSBAR_PREFIX )); 528cdf0e10cSrcweir } 529cdf0e10cSrcweir 530cdf0e10cSrcweir OWriteStatusBarDocumentHandler::~OWriteStatusBarDocumentHandler() 531cdf0e10cSrcweir { 532cdf0e10cSrcweir } 533cdf0e10cSrcweir 534cdf0e10cSrcweir void OWriteStatusBarDocumentHandler::WriteStatusBarDocument() throw 535cdf0e10cSrcweir ( SAXException, RuntimeException ) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 538cdf0e10cSrcweir 539cdf0e10cSrcweir m_xWriteDocumentHandler->startDocument(); 540cdf0e10cSrcweir 541cdf0e10cSrcweir // write DOCTYPE line! 542cdf0e10cSrcweir Reference< XExtendedDocumentHandler > xExtendedDocHandler( m_xWriteDocumentHandler, UNO_QUERY ); 543cdf0e10cSrcweir if ( xExtendedDocHandler.is() ) 544cdf0e10cSrcweir { 545cdf0e10cSrcweir xExtendedDocHandler->unknown( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STATUSBAR_DOCTYPE )) ); 546cdf0e10cSrcweir m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 547cdf0e10cSrcweir } 548cdf0e10cSrcweir 549cdf0e10cSrcweir ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 550cdf0e10cSrcweir Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); 551cdf0e10cSrcweir 552cdf0e10cSrcweir pList->AddAttribute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_XMLNS_STATUSBAR )), 553cdf0e10cSrcweir m_aAttributeType, 554cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_STATUSBAR )) ); 555cdf0e10cSrcweir 556cdf0e10cSrcweir pList->AddAttribute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_XMLNS_XLINK )), 557cdf0e10cSrcweir m_aAttributeType, 558cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_XLINK )) ); 559cdf0e10cSrcweir 560cdf0e10cSrcweir m_xWriteDocumentHandler->startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_STATUSBAR )), pList ); 561cdf0e10cSrcweir m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 562cdf0e10cSrcweir 563cdf0e10cSrcweir sal_Int32 nItemCount = m_aStatusBarItems->getCount(); 564cdf0e10cSrcweir Any aAny; 565cdf0e10cSrcweir 566cdf0e10cSrcweir for ( sal_Int32 nItemPos = 0; nItemPos < nItemCount; nItemPos++ ) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir Sequence< PropertyValue > aProps; 569cdf0e10cSrcweir aAny = m_aStatusBarItems->getByIndex( nItemPos ); 570cdf0e10cSrcweir if ( aAny >>= aProps ) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir ::rtl::OUString aCommandURL; 573cdf0e10cSrcweir ::rtl::OUString aHelpURL; 574cdf0e10cSrcweir sal_Int16 nStyle( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D ); 575cdf0e10cSrcweir sal_Int16 nWidth( 0 ); 576cdf0e10cSrcweir sal_Int16 nOffset( STATUSBAR_OFFSET ); 577cdf0e10cSrcweir 578cdf0e10cSrcweir ExtractStatusbarItemParameters( 579cdf0e10cSrcweir aProps, 580cdf0e10cSrcweir aCommandURL, 581cdf0e10cSrcweir aHelpURL, 582cdf0e10cSrcweir nOffset, 583cdf0e10cSrcweir nStyle, 584cdf0e10cSrcweir nWidth ); 585cdf0e10cSrcweir 586cdf0e10cSrcweir if ( aCommandURL.getLength() > 0 ) 587cdf0e10cSrcweir WriteStatusBarItem( aCommandURL, aHelpURL, nOffset, nStyle, nWidth ); 588cdf0e10cSrcweir } 589cdf0e10cSrcweir } 590cdf0e10cSrcweir 591cdf0e10cSrcweir m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 592cdf0e10cSrcweir m_xWriteDocumentHandler->endElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_STATUSBAR )) ); 593cdf0e10cSrcweir m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 594cdf0e10cSrcweir m_xWriteDocumentHandler->endDocument(); 595cdf0e10cSrcweir } 596cdf0e10cSrcweir 597cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 598cdf0e10cSrcweir // protected member functions 599cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 600cdf0e10cSrcweir 601cdf0e10cSrcweir void OWriteStatusBarDocumentHandler::WriteStatusBarItem( 602cdf0e10cSrcweir const rtl::OUString& rCommandURL, 603cdf0e10cSrcweir const rtl::OUString& /*rHelpURL*/, 604cdf0e10cSrcweir sal_Int16 nOffset, 605cdf0e10cSrcweir sal_Int16 nStyle, 606cdf0e10cSrcweir sal_Int16 nWidth ) 607cdf0e10cSrcweir throw ( SAXException, RuntimeException ) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 610cdf0e10cSrcweir Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); 611cdf0e10cSrcweir 612cdf0e10cSrcweir if ( m_aAttributeURL.getLength() == 0 ) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir m_aAttributeURL = m_aXMLXlinkNS; 615cdf0e10cSrcweir m_aAttributeURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_URL )); 616cdf0e10cSrcweir } 617cdf0e10cSrcweir 618cdf0e10cSrcweir // save required attribute (URL) 619cdf0e10cSrcweir pList->AddAttribute( m_aAttributeURL, m_aAttributeType, rCommandURL ); 620cdf0e10cSrcweir 621cdf0e10cSrcweir // alignment 622cdf0e10cSrcweir if ( nStyle & ItemStyle::ALIGN_RIGHT ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ALIGN )), 625cdf0e10cSrcweir m_aAttributeType, 626cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ALIGN_RIGHT )) ); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir else if ( nStyle & ItemStyle::ALIGN_CENTER ) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ALIGN )), 631cdf0e10cSrcweir m_aAttributeType, 632cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ALIGN_CENTER )) ); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir else 635cdf0e10cSrcweir { 636cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ALIGN )), 637cdf0e10cSrcweir m_aAttributeType, 638cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ALIGN_LEFT )) ); 639cdf0e10cSrcweir } 640cdf0e10cSrcweir 641cdf0e10cSrcweir // style ( SIB_IN is default ) 642cdf0e10cSrcweir if ( nStyle & ItemStyle::DRAW_FLAT ) 643cdf0e10cSrcweir { 644cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_STYLE )), 645cdf0e10cSrcweir m_aAttributeType, 646cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_STYLE_FLAT )) ); 647cdf0e10cSrcweir } 648cdf0e10cSrcweir else if ( nStyle & ItemStyle::DRAW_OUT3D ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_STYLE )), 651cdf0e10cSrcweir m_aAttributeType, 652cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_STYLE_OUT )) ); 653cdf0e10cSrcweir } 654cdf0e10cSrcweir 655cdf0e10cSrcweir // autosize (default sal_False) 656cdf0e10cSrcweir if ( nStyle & ItemStyle::AUTO_SIZE ) 657cdf0e10cSrcweir { 658cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_AUTOSIZE )), 659cdf0e10cSrcweir m_aAttributeType, 660cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_BOOLEAN_TRUE )) ); 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir // ownerdraw (default sal_False) 664cdf0e10cSrcweir if ( nStyle & ItemStyle::OWNER_DRAW ) 665cdf0e10cSrcweir { 666cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_OWNERDRAW )), 667cdf0e10cSrcweir m_aAttributeType, 668cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_BOOLEAN_TRUE )) ); 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir // width (default 0) 672cdf0e10cSrcweir if ( nWidth > 0 ) 673cdf0e10cSrcweir { 674cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_WIDTH )), 675cdf0e10cSrcweir m_aAttributeType, 676cdf0e10cSrcweir ::rtl::OUString::valueOf( (sal_Int32)nWidth ) ); 677cdf0e10cSrcweir } 678cdf0e10cSrcweir 679cdf0e10cSrcweir // offset (default STATUSBAR_OFFSET) 680cdf0e10cSrcweir if ( nOffset != STATUSBAR_OFFSET ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir pList->AddAttribute( m_aXMLStatusBarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_OFFSET )), 683cdf0e10cSrcweir m_aAttributeType, 684cdf0e10cSrcweir ::rtl::OUString::valueOf( (sal_Int32)nOffset ) ); 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 688cdf0e10cSrcweir m_xWriteDocumentHandler->startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_STATUSBARITEM )), xList ); 689cdf0e10cSrcweir m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 690cdf0e10cSrcweir m_xWriteDocumentHandler->endElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_STATUSBARITEM )) ); 691cdf0e10cSrcweir } 692cdf0e10cSrcweir 693cdf0e10cSrcweir } // namespace framework 694cdf0e10cSrcweir 695