1*e1d5bd03SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*e1d5bd03SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*e1d5bd03SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*e1d5bd03SAndrew Rist * distributed with this work for additional information 6*e1d5bd03SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*e1d5bd03SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*e1d5bd03SAndrew Rist * "License"); you may not use this file except in compliance 9*e1d5bd03SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*e1d5bd03SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*e1d5bd03SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*e1d5bd03SAndrew Rist * software distributed under the License is distributed on an 15*e1d5bd03SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*e1d5bd03SAndrew Rist * KIND, either express or implied. See the License for the 17*e1d5bd03SAndrew Rist * specific language governing permissions and limitations 18*e1d5bd03SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*e1d5bd03SAndrew Rist *************************************************************/ 21*e1d5bd03SAndrew Rist 22*e1d5bd03SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmlscript.hxx" 26cdf0e10cSrcweir #include "imp_share.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <osl/diagnose.h> 29cdf0e10cSrcweir #include <tools/diagnose_ex.h> 30cdf0e10cSrcweir #include <osl/mutex.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <xmlscript/xml_import.hxx> 35cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <com/sun/star/awt/CharSet.hpp> 38cdf0e10cSrcweir #include <com/sun/star/awt/FontFamily.hpp> 39cdf0e10cSrcweir #include <com/sun/star/awt/FontPitch.hpp> 40cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp> 41cdf0e10cSrcweir #include <com/sun/star/awt/FontStrikeout.hpp> 42cdf0e10cSrcweir #include <com/sun/star/awt/FontType.hpp> 43cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp> 44cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp> 45cdf0e10cSrcweir #include <com/sun/star/awt/FontWidth.hpp> 46cdf0e10cSrcweir #include <com/sun/star/awt/ImagePosition.hpp> 47cdf0e10cSrcweir #include <com/sun/star/awt/LineEndFormat.hpp> 48cdf0e10cSrcweir #include <com/sun/star/awt/PushButtonType.hpp> 49cdf0e10cSrcweir #include <com/sun/star/awt/VisualEffect.hpp> 50cdf0e10cSrcweir #include <com/sun/star/style/VerticalAlignment.hpp> 51cdf0e10cSrcweir 52cdf0e10cSrcweir #include <com/sun/star/script/XScriptEventsSupplier.hpp> 53cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp> 54cdf0e10cSrcweir 55cdf0e10cSrcweir #include <com/sun/star/view/SelectionType.hpp> 56cdf0e10cSrcweir 57cdf0e10cSrcweir using namespace ::com::sun::star; 58cdf0e10cSrcweir using namespace ::com::sun::star::uno; 59cdf0e10cSrcweir using ::rtl::OUString; 60cdf0e10cSrcweir 61cdf0e10cSrcweir namespace xmlscript 62cdf0e10cSrcweir { 63cdf0e10cSrcweir 64cdf0e10cSrcweir //__________________________________________________________________________________________________ 65cdf0e10cSrcweir void EventElement::endElement() 66cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir static_cast< ControlElement * >( _pParent )->_events.push_back( this ); 69cdf0e10cSrcweir } 70cdf0e10cSrcweir //__________________________________________________________________________________________________ 71cdf0e10cSrcweir ControlElement::ControlElement( 72cdf0e10cSrcweir OUString const & rLocalName, 73cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes, 74cdf0e10cSrcweir ElementBase * pParent, DialogImport * pImport ) 75cdf0e10cSrcweir SAL_THROW( () ) 76cdf0e10cSrcweir : ElementBase( 77cdf0e10cSrcweir pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, pParent, pImport ) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir if (_pParent) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir // inherit position 82cdf0e10cSrcweir _nBasePosX = static_cast< ControlElement * >( _pParent )->_nBasePosX; 83cdf0e10cSrcweir _nBasePosY = static_cast< ControlElement * >( _pParent )->_nBasePosY; 84cdf0e10cSrcweir } 85cdf0e10cSrcweir else 86cdf0e10cSrcweir { 87cdf0e10cSrcweir _nBasePosX = 0; 88cdf0e10cSrcweir _nBasePosY = 0; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir //__________________________________________________________________________________________________ 93cdf0e10cSrcweir Reference< xml::input::XElement > ControlElement::getStyle( 94cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir OUString aStyleId( 97cdf0e10cSrcweir xAttributes->getValueByUidName( 98cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, 99cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) ); 100cdf0e10cSrcweir if (aStyleId.getLength()) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir return _pImport->getStyle( aStyleId ); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir return Reference< xml::input::XElement >(); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir //__________________________________________________________________________________________________ 107cdf0e10cSrcweir OUString ControlElement::getControlId( 108cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir OUString aId( 111cdf0e10cSrcweir xAttributes->getValueByUidName( 112cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, 113cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("id") ) ) ); 114cdf0e10cSrcweir if (! aId.getLength()) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir throw xml::sax::SAXException( 117cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("missing id attribute!") ), 118cdf0e10cSrcweir Reference< XInterface >(), Any() ); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir return aId; 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir //################################################################################################## 124cdf0e10cSrcweir 125cdf0e10cSrcweir //__________________________________________________________________________________________________ 126cdf0e10cSrcweir bool StyleElement::importTextColorStyle( 127cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir if ((_inited & 0x2) != 0) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir if ((_hasValue & 0x2) != 0) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir xProps->setPropertyValue( 134cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ), 135cdf0e10cSrcweir makeAny( _textColor ) ); 136cdf0e10cSrcweir return true; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir return false; 139cdf0e10cSrcweir } 140cdf0e10cSrcweir _inited |= 0x2; 141cdf0e10cSrcweir 142cdf0e10cSrcweir if (getLongAttr( &_textColor, 143cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("text-color") ), 144cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir _hasValue |= 0x2; 147cdf0e10cSrcweir xProps->setPropertyValue( 148cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ), 149cdf0e10cSrcweir makeAny( _textColor ) ); 150cdf0e10cSrcweir return true; 151cdf0e10cSrcweir } 152cdf0e10cSrcweir return false; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir //__________________________________________________________________________________________________ 155cdf0e10cSrcweir bool StyleElement::importTextLineColorStyle( 156cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir if ((_inited & 0x20) != 0) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir if ((_hasValue & 0x20) != 0) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir xProps->setPropertyValue( 163cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ), 164cdf0e10cSrcweir makeAny( _textLineColor ) ); 165cdf0e10cSrcweir return true; 166cdf0e10cSrcweir } 167cdf0e10cSrcweir return false; 168cdf0e10cSrcweir } 169cdf0e10cSrcweir _inited |= 0x20; 170cdf0e10cSrcweir 171cdf0e10cSrcweir if (getLongAttr( &_textLineColor, 172cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("textline-color") ), 173cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir _hasValue |= 0x20; 176cdf0e10cSrcweir xProps->setPropertyValue( 177cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ), 178cdf0e10cSrcweir makeAny( _textLineColor ) ); 179cdf0e10cSrcweir return true; 180cdf0e10cSrcweir } 181cdf0e10cSrcweir return false; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir //__________________________________________________________________________________________________ 184cdf0e10cSrcweir bool StyleElement::importFillColorStyle( 185cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir if ((_inited & 0x10) != 0) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir if ((_hasValue & 0x10) != 0) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir xProps->setPropertyValue( 192cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), makeAny( _fillColor ) ); 193cdf0e10cSrcweir return true; 194cdf0e10cSrcweir } 195cdf0e10cSrcweir return false; 196cdf0e10cSrcweir } 197cdf0e10cSrcweir _inited |= 0x10; 198cdf0e10cSrcweir 199cdf0e10cSrcweir if (getLongAttr( 200cdf0e10cSrcweir &_fillColor, 201cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("fill-color") ), 202cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir _hasValue |= 0x10; 205cdf0e10cSrcweir xProps->setPropertyValue( 206cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), 207cdf0e10cSrcweir makeAny( _fillColor ) ); 208cdf0e10cSrcweir return true; 209cdf0e10cSrcweir } 210cdf0e10cSrcweir return false; 211cdf0e10cSrcweir } 212cdf0e10cSrcweir //__________________________________________________________________________________________________ 213cdf0e10cSrcweir bool StyleElement::importBackgroundColorStyle( 214cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 215cdf0e10cSrcweir { 216cdf0e10cSrcweir if ((_inited & 0x1) != 0) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir if ((_hasValue & 0x1) != 0) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir xProps->setPropertyValue( 221cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) ); 222cdf0e10cSrcweir return true; 223cdf0e10cSrcweir } 224cdf0e10cSrcweir return false; 225cdf0e10cSrcweir } 226cdf0e10cSrcweir _inited |= 0x1; 227cdf0e10cSrcweir 228cdf0e10cSrcweir if (getLongAttr( 229cdf0e10cSrcweir &_backgroundColor, 230cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("background-color") ), 231cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir _hasValue |= 0x1; 234cdf0e10cSrcweir xProps->setPropertyValue( 235cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) ); 236cdf0e10cSrcweir return true; 237cdf0e10cSrcweir } 238cdf0e10cSrcweir return false; 239cdf0e10cSrcweir } 240cdf0e10cSrcweir 241cdf0e10cSrcweir //__________________________________________________________________________________________________ 242cdf0e10cSrcweir bool StyleElement::importBorderStyle( 243cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir if ((_inited & 0x4) != 0) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir if ((_hasValue & 0x4) != 0) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir xProps->setPropertyValue( 250cdf0e10cSrcweir OUSTR("Border"), makeAny( _border == BORDER_SIMPLE_COLOR 251cdf0e10cSrcweir ? BORDER_SIMPLE : _border ) ); 252cdf0e10cSrcweir if (_border == BORDER_SIMPLE_COLOR) 253cdf0e10cSrcweir xProps->setPropertyValue( OUSTR("BorderColor"), 254cdf0e10cSrcweir makeAny(_borderColor) ); 255cdf0e10cSrcweir return true; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir return false; 258cdf0e10cSrcweir } 259cdf0e10cSrcweir _inited |= 0x4; 260cdf0e10cSrcweir 261cdf0e10cSrcweir OUString aValue; 262cdf0e10cSrcweir if (getStringAttr( 263cdf0e10cSrcweir &aValue, OUSTR("border"), 264cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) { 265cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) 266cdf0e10cSrcweir _border = BORDER_NONE; 267cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") )) 268cdf0e10cSrcweir _border = BORDER_3D; 269cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") )) 270cdf0e10cSrcweir _border = BORDER_SIMPLE; 271cdf0e10cSrcweir else { 272cdf0e10cSrcweir _border = BORDER_SIMPLE_COLOR; 273cdf0e10cSrcweir _borderColor = toInt32(aValue); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir _hasValue |= 0x4; 277cdf0e10cSrcweir importBorderStyle(xProps); // write values 278cdf0e10cSrcweir } 279cdf0e10cSrcweir return false; 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir //______________________________________________________________________________ 283cdf0e10cSrcweir bool StyleElement::importVisualEffectStyle( 284cdf0e10cSrcweir Reference<beans::XPropertySet> const & xProps ) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir if ((_inited & 0x40) != 0) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir if ((_hasValue & 0x40) != 0) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir xProps->setPropertyValue( OUSTR("VisualEffect"), 291cdf0e10cSrcweir makeAny(_visualEffect) ); 292cdf0e10cSrcweir return true; 293cdf0e10cSrcweir } 294cdf0e10cSrcweir return false; 295cdf0e10cSrcweir } 296cdf0e10cSrcweir _inited |= 0x40; 297cdf0e10cSrcweir 298cdf0e10cSrcweir OUString aValue; 299cdf0e10cSrcweir if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("look") ), 300cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir _visualEffect = awt::VisualEffect::NONE; 305cdf0e10cSrcweir } 306cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") )) 307cdf0e10cSrcweir { 308cdf0e10cSrcweir _visualEffect = awt::VisualEffect::LOOK3D; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") )) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir _visualEffect = awt::VisualEffect::FLAT; 313cdf0e10cSrcweir } 314cdf0e10cSrcweir else 315cdf0e10cSrcweir OSL_ASSERT( 0 ); 316cdf0e10cSrcweir 317cdf0e10cSrcweir _hasValue |= 0x40; 318cdf0e10cSrcweir xProps->setPropertyValue( OUSTR("VisualEffect"), 319cdf0e10cSrcweir makeAny(_visualEffect) ); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir return false; 322cdf0e10cSrcweir } 323cdf0e10cSrcweir 324cdf0e10cSrcweir //__________________________________________________________________________________________________ 325cdf0e10cSrcweir void StyleElement::setFontProperties( 326cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir xProps->setPropertyValue( 329cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) ); 330cdf0e10cSrcweir xProps->setPropertyValue( 331cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FontEmphasisMark") ), makeAny( _fontEmphasisMark ) ); 332cdf0e10cSrcweir xProps->setPropertyValue( 333cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FontRelief") ), makeAny( _fontRelief ) ); 334cdf0e10cSrcweir } 335cdf0e10cSrcweir //__________________________________________________________________________________________________ 336cdf0e10cSrcweir bool StyleElement::importFontStyle( 337cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir if ((_inited & 0x8) != 0) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir if ((_hasValue & 0x8) != 0) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir setFontProperties( xProps ); 344cdf0e10cSrcweir return true; 345cdf0e10cSrcweir } 346cdf0e10cSrcweir return false; 347cdf0e10cSrcweir } 348cdf0e10cSrcweir _inited |= 0x8; 349cdf0e10cSrcweir 350cdf0e10cSrcweir OUString aValue; 351cdf0e10cSrcweir bool bFontImport; 352cdf0e10cSrcweir 353cdf0e10cSrcweir // dialog:font-name CDATA #IMPLIED 354cdf0e10cSrcweir bFontImport = getStringAttr( 355cdf0e10cSrcweir &_descr.Name, OUString( RTL_CONSTASCII_USTRINGPARAM("font-name") ), 356cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ); 357cdf0e10cSrcweir 358cdf0e10cSrcweir // dialog:font-height %numeric; #IMPLIED 359cdf0e10cSrcweir if (getStringAttr( 360cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-height") ), 361cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir _descr.Height = (sal_Int16)toInt32( aValue ); 364cdf0e10cSrcweir bFontImport = true; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir // dialog:font-width %numeric; #IMPLIED 367cdf0e10cSrcweir if (getStringAttr( 368cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-width") ), 369cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir _descr.Width = (sal_Int16)toInt32( aValue ); 372cdf0e10cSrcweir bFontImport = true; 373cdf0e10cSrcweir } 374cdf0e10cSrcweir // dialog:font-stylename CDATA #IMPLIED 375cdf0e10cSrcweir bFontImport |= getStringAttr( 376cdf0e10cSrcweir &_descr.StyleName, 377cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-stylename") ), 378cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ); 379cdf0e10cSrcweir 380cdf0e10cSrcweir // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED 381cdf0e10cSrcweir if (getStringAttr( 382cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-family") ), 383cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("decorative") )) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir _descr.Family = awt::FontFamily::DECORATIVE; 388cdf0e10cSrcweir } 389cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("modern") )) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir _descr.Family = awt::FontFamily::MODERN; 392cdf0e10cSrcweir } 393cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("roman") )) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir _descr.Family = awt::FontFamily::ROMAN; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("script") )) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir _descr.Family = awt::FontFamily::SCRIPT; 400cdf0e10cSrcweir } 401cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("swiss") )) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir _descr.Family = awt::FontFamily::SWISS; 404cdf0e10cSrcweir } 405cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") )) 406cdf0e10cSrcweir { 407cdf0e10cSrcweir _descr.Family = awt::FontFamily::SYSTEM; 408cdf0e10cSrcweir } 409cdf0e10cSrcweir else 410cdf0e10cSrcweir { 411cdf0e10cSrcweir throw xml::sax::SAXException( 412cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-family style!") ), 413cdf0e10cSrcweir Reference< XInterface >(), Any() ); 414cdf0e10cSrcweir } 415cdf0e10cSrcweir bFontImport = true; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED 419cdf0e10cSrcweir if (getStringAttr( 420cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charset") ), 421cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ansi") )) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir _descr.CharSet = awt::CharSet::ANSI; 426cdf0e10cSrcweir } 427cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("mac") )) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir _descr.CharSet = awt::CharSet::MAC; 430cdf0e10cSrcweir } 431cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_437") )) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_437; 434cdf0e10cSrcweir } 435cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_850") )) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_850; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_860") )) 440cdf0e10cSrcweir { 441cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_860; 442cdf0e10cSrcweir } 443cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_861") )) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_861; 446cdf0e10cSrcweir } 447cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_863") )) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_863; 450cdf0e10cSrcweir } 451cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_865") )) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_865; 454cdf0e10cSrcweir } 455cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") )) 456cdf0e10cSrcweir { 457cdf0e10cSrcweir _descr.CharSet = awt::CharSet::SYSTEM; 458cdf0e10cSrcweir } 459cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("symbol") )) 460cdf0e10cSrcweir { 461cdf0e10cSrcweir _descr.CharSet = awt::CharSet::SYMBOL; 462cdf0e10cSrcweir } 463cdf0e10cSrcweir else 464cdf0e10cSrcweir { 465cdf0e10cSrcweir throw xml::sax::SAXException( 466cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-charset style!") ), 467cdf0e10cSrcweir Reference< XInterface >(), Any() ); 468cdf0e10cSrcweir } 469cdf0e10cSrcweir bFontImport = true; 470cdf0e10cSrcweir } 471cdf0e10cSrcweir 472cdf0e10cSrcweir // dialog:font-pitch "(fixed|variable)" #IMPLIED 473cdf0e10cSrcweir if (getStringAttr( 474cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-pitch") ), 475cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixed") )) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir _descr.Pitch = awt::FontPitch::FIXED; 480cdf0e10cSrcweir } 481cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("variable") )) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir _descr.Pitch = awt::FontPitch::VARIABLE; 484cdf0e10cSrcweir } 485cdf0e10cSrcweir else 486cdf0e10cSrcweir { 487cdf0e10cSrcweir throw xml::sax::SAXException( 488cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-pitch style!") ), 489cdf0e10cSrcweir Reference< XInterface >(), Any() ); 490cdf0e10cSrcweir } 491cdf0e10cSrcweir bFontImport = true; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir 494cdf0e10cSrcweir // dialog:font-charwidth CDATA #IMPLIED 495cdf0e10cSrcweir if (getStringAttr( 496cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charwidth") ), 497cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir _descr.CharacterWidth = aValue.toFloat(); 500cdf0e10cSrcweir bFontImport = true; 501cdf0e10cSrcweir } 502cdf0e10cSrcweir // dialog:font-weight CDATA #IMPLIED 503cdf0e10cSrcweir if (getStringAttr( 504cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-weight") ), 505cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir _descr.Weight = aValue.toFloat(); 508cdf0e10cSrcweir bFontImport = true; 509cdf0e10cSrcweir } 510cdf0e10cSrcweir 511cdf0e10cSrcweir // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED 512cdf0e10cSrcweir if (getStringAttr( 513cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-slant") ), 514cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("oblique") )) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir _descr.Slant = awt::FontSlant_OBLIQUE; 519cdf0e10cSrcweir } 520cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("italic") )) 521cdf0e10cSrcweir { 522cdf0e10cSrcweir _descr.Slant = awt::FontSlant_ITALIC; 523cdf0e10cSrcweir } 524cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_oblique") )) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir _descr.Slant = awt::FontSlant_REVERSE_OBLIQUE; 527cdf0e10cSrcweir } 528cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_italic") )) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir _descr.Slant = awt::FontSlant_REVERSE_ITALIC; 531cdf0e10cSrcweir } 532cdf0e10cSrcweir else 533cdf0e10cSrcweir { 534cdf0e10cSrcweir throw xml::sax::SAXException( 535cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-slant style!") ), 536cdf0e10cSrcweir Reference< XInterface >(), Any() ); 537cdf0e10cSrcweir } 538cdf0e10cSrcweir bFontImport = true; 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED 542cdf0e10cSrcweir if (getStringAttr( 543cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-underline") ), 544cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 545cdf0e10cSrcweir { 546cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") )) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::SINGLE; 549cdf0e10cSrcweir } 550cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") )) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DOUBLE; 553cdf0e10cSrcweir } 554cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dotted") )) 555cdf0e10cSrcweir { 556cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DOTTED; 557cdf0e10cSrcweir } 558cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dash") )) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DASH; 561cdf0e10cSrcweir } 562cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("longdash") )) 563cdf0e10cSrcweir { 564cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::LONGDASH; 565cdf0e10cSrcweir } 566cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdot") )) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DASHDOT; 569cdf0e10cSrcweir } 570cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdotdot") )) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DASHDOTDOT; 573cdf0e10cSrcweir } 574cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("smallwave") )) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::SMALLWAVE; 577cdf0e10cSrcweir } 578cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("wave") )) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::WAVE; 581cdf0e10cSrcweir } 582cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("doublewave") )) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DOUBLEWAVE; 585cdf0e10cSrcweir } 586cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") )) 587cdf0e10cSrcweir { 588cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLD; 589cdf0e10cSrcweir } 590cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddotted") )) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDOTTED; 593cdf0e10cSrcweir } 594cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddash") )) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDASH; 597cdf0e10cSrcweir } 598cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldlongdash") )) 599cdf0e10cSrcweir { 600cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDLONGDASH; 601cdf0e10cSrcweir } 602cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdot") )) 603cdf0e10cSrcweir { 604cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDASHDOT; 605cdf0e10cSrcweir } 606cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdotdot") )) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDASHDOTDOT; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldwave") )) 611cdf0e10cSrcweir { 612cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDWAVE; 613cdf0e10cSrcweir } 614cdf0e10cSrcweir else 615cdf0e10cSrcweir { 616cdf0e10cSrcweir throw xml::sax::SAXException( 617cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-underline style!") ), 618cdf0e10cSrcweir Reference< XInterface >(), Any() ); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir bFontImport = true; 621cdf0e10cSrcweir } 622cdf0e10cSrcweir 623cdf0e10cSrcweir // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED 624cdf0e10cSrcweir if (getStringAttr( 625cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-strikeout") ), 626cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") )) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::SINGLE; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") )) 633cdf0e10cSrcweir { 634cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::DOUBLE; 635cdf0e10cSrcweir } 636cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") )) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::BOLD; 639cdf0e10cSrcweir } 640cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("slash") )) 641cdf0e10cSrcweir { 642cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::SLASH; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("x") )) 645cdf0e10cSrcweir { 646cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::X; 647cdf0e10cSrcweir } 648cdf0e10cSrcweir else 649cdf0e10cSrcweir { 650cdf0e10cSrcweir throw xml::sax::SAXException( 651cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-strikeout style!") ), 652cdf0e10cSrcweir Reference< XInterface >(), Any() ); 653cdf0e10cSrcweir } 654cdf0e10cSrcweir bFontImport = true; 655cdf0e10cSrcweir } 656cdf0e10cSrcweir 657cdf0e10cSrcweir // dialog:font-orientation CDATA #IMPLIED 658cdf0e10cSrcweir if (getStringAttr( 659cdf0e10cSrcweir &aValue, 660cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-orientation") ), 661cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir _descr.Orientation = aValue.toFloat(); 664cdf0e10cSrcweir bFontImport = true; 665cdf0e10cSrcweir } 666cdf0e10cSrcweir // dialog:font-kerning %boolean; #IMPLIED 667cdf0e10cSrcweir bFontImport |= getBoolAttr( 668cdf0e10cSrcweir &_descr.Kerning, 669cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-kerning") ), 670cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ); 671cdf0e10cSrcweir // dialog:font-wordlinemode %boolean; #IMPLIED 672cdf0e10cSrcweir bFontImport |= getBoolAttr( 673cdf0e10cSrcweir &_descr.WordLineMode, 674cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-wordlinemode") ), 675cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ); 676cdf0e10cSrcweir 677cdf0e10cSrcweir // dialog:font-type "(raster|device|scalable)" #IMPLIED 678cdf0e10cSrcweir if (getStringAttr( 679cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-type") ), 680cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("raster") )) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir _descr.Type = awt::FontType::RASTER; 685cdf0e10cSrcweir } 686cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("device") )) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir _descr.Type = awt::FontType::DEVICE; 689cdf0e10cSrcweir } 690cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scalable") )) 691cdf0e10cSrcweir { 692cdf0e10cSrcweir _descr.Type = awt::FontType::SCALABLE; 693cdf0e10cSrcweir } 694cdf0e10cSrcweir else 695cdf0e10cSrcweir { 696cdf0e10cSrcweir throw xml::sax::SAXException( 697cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-type style!") ), 698cdf0e10cSrcweir Reference< XInterface >(), Any() ); 699cdf0e10cSrcweir } 700cdf0e10cSrcweir bFontImport = true; 701cdf0e10cSrcweir } 702cdf0e10cSrcweir 703cdf0e10cSrcweir // additional properties which are not part of the FontDescriptor struct 704cdf0e10cSrcweir // dialog:font-relief (none|embossed|engraved) #IMPLIED 705cdf0e10cSrcweir if (getStringAttr( 706cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-relief") ), 707cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 708cdf0e10cSrcweir { 709cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) 710cdf0e10cSrcweir { 711cdf0e10cSrcweir _fontRelief = awt::FontRelief::NONE; 712cdf0e10cSrcweir } 713cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("embossed") )) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir _fontRelief = awt::FontRelief::EMBOSSED; 716cdf0e10cSrcweir } 717cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("engraved") )) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir _fontRelief = awt::FontRelief::ENGRAVED; 720cdf0e10cSrcweir } 721cdf0e10cSrcweir else 722cdf0e10cSrcweir { 723cdf0e10cSrcweir throw xml::sax::SAXException( 724cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-relief style!") ), 725cdf0e10cSrcweir Reference< XInterface >(), Any() ); 726cdf0e10cSrcweir } 727cdf0e10cSrcweir bFontImport = true; 728cdf0e10cSrcweir } 729cdf0e10cSrcweir // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED 730cdf0e10cSrcweir if (getStringAttr( 731cdf0e10cSrcweir &aValue, 732cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-emphasismark") ), 733cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) 734cdf0e10cSrcweir { 735cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) 736cdf0e10cSrcweir { 737cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::NONE; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dot") )) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::DOT; 742cdf0e10cSrcweir } 743cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("circle") )) 744cdf0e10cSrcweir { 745cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::CIRCLE; 746cdf0e10cSrcweir } 747cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("disc") )) 748cdf0e10cSrcweir { 749cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::DISC; 750cdf0e10cSrcweir } 751cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("accent") )) 752cdf0e10cSrcweir { 753cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::ACCENT; 754cdf0e10cSrcweir } 755cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("above") )) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::ABOVE; 758cdf0e10cSrcweir } 759cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("below") )) 760cdf0e10cSrcweir { 761cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::BELOW; 762cdf0e10cSrcweir } 763cdf0e10cSrcweir else 764cdf0e10cSrcweir { 765cdf0e10cSrcweir throw xml::sax::SAXException( 766cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-emphasismark style!") ), 767cdf0e10cSrcweir Reference< XInterface >(), Any() ); 768cdf0e10cSrcweir } 769cdf0e10cSrcweir bFontImport = true; 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir // ================================================== 773cdf0e10cSrcweir if (bFontImport) 774cdf0e10cSrcweir { 775cdf0e10cSrcweir _hasValue |= 0x8; 776cdf0e10cSrcweir setFontProperties( xProps ); 777cdf0e10cSrcweir } 778cdf0e10cSrcweir 779cdf0e10cSrcweir return bFontImport; 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir //################################################################################################## 783cdf0e10cSrcweir 784cdf0e10cSrcweir //__________________________________________________________________________________________________ 785cdf0e10cSrcweir bool ImportContext::importStringProperty( 786cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 787cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir OUString aValue( 790cdf0e10cSrcweir xAttributes->getValueByUidName( 791cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 792cdf0e10cSrcweir if (aValue.getLength()) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( aValue ) ); 795cdf0e10cSrcweir return true; 796cdf0e10cSrcweir } 797cdf0e10cSrcweir return false; 798cdf0e10cSrcweir } 799cdf0e10cSrcweir //__________________________________________________________________________________________________ 800cdf0e10cSrcweir bool ImportContext::importDoubleProperty( 801cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 802cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir OUString aValue( 805cdf0e10cSrcweir xAttributes->getValueByUidName( 806cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 807cdf0e10cSrcweir if (aValue.getLength()) 808cdf0e10cSrcweir { 809cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( aValue.toDouble() ) ); 810cdf0e10cSrcweir return true; 811cdf0e10cSrcweir } 812cdf0e10cSrcweir return false; 813cdf0e10cSrcweir } 814cdf0e10cSrcweir //__________________________________________________________________________________________________ 815cdf0e10cSrcweir bool ImportContext::importBooleanProperty( 816cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 817cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 818cdf0e10cSrcweir { 819cdf0e10cSrcweir sal_Bool bBool; 820cdf0e10cSrcweir if (getBoolAttr( 821cdf0e10cSrcweir &bBool, rAttrName, xAttributes, _pImport->XMLNS_DIALOGS_UID )) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( bBool ) ); 824cdf0e10cSrcweir return true; 825cdf0e10cSrcweir } 826cdf0e10cSrcweir return false; 827cdf0e10cSrcweir } 828cdf0e10cSrcweir //__________________________________________________________________________________________________ 829cdf0e10cSrcweir bool ImportContext::importLongProperty( 830cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 831cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 832cdf0e10cSrcweir { 833cdf0e10cSrcweir OUString aValue( 834cdf0e10cSrcweir xAttributes->getValueByUidName( 835cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 836cdf0e10cSrcweir if (aValue.getLength()) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) ); 839cdf0e10cSrcweir return true; 840cdf0e10cSrcweir } 841cdf0e10cSrcweir return false; 842cdf0e10cSrcweir } 843cdf0e10cSrcweir //__________________________________________________________________________________________________ 844cdf0e10cSrcweir bool ImportContext::importLongProperty( 845cdf0e10cSrcweir sal_Int32 nOffset, 846cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 847cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 848cdf0e10cSrcweir { 849cdf0e10cSrcweir OUString aValue( 850cdf0e10cSrcweir xAttributes->getValueByUidName( 851cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 852cdf0e10cSrcweir if (aValue.getLength()) 853cdf0e10cSrcweir { 854cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) + nOffset ) ); 855cdf0e10cSrcweir return true; 856cdf0e10cSrcweir } 857cdf0e10cSrcweir return false; 858cdf0e10cSrcweir } 859cdf0e10cSrcweir //__________________________________________________________________________________________________ 860cdf0e10cSrcweir bool ImportContext::importHexLongProperty( 861cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 862cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 863cdf0e10cSrcweir { 864cdf0e10cSrcweir OUString aValue( 865cdf0e10cSrcweir xAttributes->getValueByUidName( 866cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 867cdf0e10cSrcweir if (aValue.getLength()) 868cdf0e10cSrcweir { 869cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) ); 870cdf0e10cSrcweir return true; 871cdf0e10cSrcweir } 872cdf0e10cSrcweir return false; 873cdf0e10cSrcweir } 874cdf0e10cSrcweir //__________________________________________________________________________________________________ 875cdf0e10cSrcweir bool ImportContext::importShortProperty( 876cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 877cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 878cdf0e10cSrcweir { 879cdf0e10cSrcweir OUString aValue( 880cdf0e10cSrcweir xAttributes->getValueByUidName( 881cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 882cdf0e10cSrcweir if (aValue.getLength()) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( (sal_Int16)toInt32( aValue ) ) ); 885cdf0e10cSrcweir return true; 886cdf0e10cSrcweir } 887cdf0e10cSrcweir return false; 888cdf0e10cSrcweir } 889cdf0e10cSrcweir //__________________________________________________________________________________________________ 890cdf0e10cSrcweir bool ImportContext::importAlignProperty( 891cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 892cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir OUString aAlign( 895cdf0e10cSrcweir xAttributes->getValueByUidName( 896cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 897cdf0e10cSrcweir if (aAlign.getLength()) 898cdf0e10cSrcweir { 899cdf0e10cSrcweir sal_Int16 nAlign; 900cdf0e10cSrcweir if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") )) 901cdf0e10cSrcweir { 902cdf0e10cSrcweir nAlign = 0; 903cdf0e10cSrcweir } 904cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") )) 905cdf0e10cSrcweir { 906cdf0e10cSrcweir nAlign = 1; 907cdf0e10cSrcweir } 908cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") )) 909cdf0e10cSrcweir { 910cdf0e10cSrcweir nAlign = 2; 911cdf0e10cSrcweir } 912cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) 913cdf0e10cSrcweir { 914cdf0e10cSrcweir nAlign = 0; // default 915cdf0e10cSrcweir } 916cdf0e10cSrcweir else 917cdf0e10cSrcweir { 918cdf0e10cSrcweir throw xml::sax::SAXException( 919cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid align value!") ), 920cdf0e10cSrcweir Reference< XInterface >(), Any() ); 921cdf0e10cSrcweir } 922cdf0e10cSrcweir 923cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) ); 924cdf0e10cSrcweir return true; 925cdf0e10cSrcweir } 926cdf0e10cSrcweir return false; 927cdf0e10cSrcweir } 928cdf0e10cSrcweir //__________________________________________________________________________________________________ 929cdf0e10cSrcweir bool ImportContext::importVerticalAlignProperty( 930cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 931cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 932cdf0e10cSrcweir { 933cdf0e10cSrcweir OUString aAlign( 934cdf0e10cSrcweir xAttributes->getValueByUidName( 935cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 936cdf0e10cSrcweir if (aAlign.getLength()) 937cdf0e10cSrcweir { 938cdf0e10cSrcweir style::VerticalAlignment eAlign; 939cdf0e10cSrcweir 940cdf0e10cSrcweir if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") )) 941cdf0e10cSrcweir { 942cdf0e10cSrcweir eAlign = style::VerticalAlignment_TOP; 943cdf0e10cSrcweir } 944cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") )) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir eAlign = style::VerticalAlignment_MIDDLE; 947cdf0e10cSrcweir } 948cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") )) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir eAlign = style::VerticalAlignment_BOTTOM; 951cdf0e10cSrcweir } 952cdf0e10cSrcweir else 953cdf0e10cSrcweir { 954cdf0e10cSrcweir throw xml::sax::SAXException( 955cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid vertical align value!") ), 956cdf0e10cSrcweir Reference< XInterface >(), Any() ); 957cdf0e10cSrcweir } 958cdf0e10cSrcweir 959cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( eAlign ) ); 960cdf0e10cSrcweir return true; 961cdf0e10cSrcweir } 962cdf0e10cSrcweir return false; 963cdf0e10cSrcweir } 964cdf0e10cSrcweir //__________________________________________________________________________________________________ 965cdf0e10cSrcweir bool ImportContext::importImageAlignProperty( 966cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 967cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 968cdf0e10cSrcweir { 969cdf0e10cSrcweir OUString aAlign( 970cdf0e10cSrcweir xAttributes->getValueByUidName( 971cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 972cdf0e10cSrcweir if (aAlign.getLength()) 973cdf0e10cSrcweir { 974cdf0e10cSrcweir sal_Int16 nAlign; 975cdf0e10cSrcweir if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") )) 976cdf0e10cSrcweir { 977cdf0e10cSrcweir nAlign = 0; 978cdf0e10cSrcweir } 979cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") )) 980cdf0e10cSrcweir { 981cdf0e10cSrcweir nAlign = 1; 982cdf0e10cSrcweir } 983cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") )) 984cdf0e10cSrcweir { 985cdf0e10cSrcweir nAlign = 2; 986cdf0e10cSrcweir } 987cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") )) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir nAlign = 3; 990cdf0e10cSrcweir } 991cdf0e10cSrcweir else 992cdf0e10cSrcweir { 993cdf0e10cSrcweir throw xml::sax::SAXException( 994cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image align value!") ), 995cdf0e10cSrcweir Reference< XInterface >(), Any() ); 996cdf0e10cSrcweir } 997cdf0e10cSrcweir 998cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) ); 999cdf0e10cSrcweir return true; 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir return false; 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir //__________________________________________________________________________________________________ 1004cdf0e10cSrcweir bool ImportContext::importImagePositionProperty( 1005cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1006cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir OUString aPosition( 1009cdf0e10cSrcweir xAttributes->getValueByUidName( 1010cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1011cdf0e10cSrcweir if (aPosition.getLength()) 1012cdf0e10cSrcweir { 1013cdf0e10cSrcweir sal_Int16 nPosition; 1014cdf0e10cSrcweir if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-top") )) 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir nPosition = awt::ImagePosition::LeftTop; 1017cdf0e10cSrcweir } 1018cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-center") )) 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir nPosition = awt::ImagePosition::LeftCenter; 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-bottom") )) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir nPosition = awt::ImagePosition::LeftBottom; 1025cdf0e10cSrcweir } 1026cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-top") )) 1027cdf0e10cSrcweir { 1028cdf0e10cSrcweir nPosition = awt::ImagePosition::RightTop; 1029cdf0e10cSrcweir } 1030cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-center") )) 1031cdf0e10cSrcweir { 1032cdf0e10cSrcweir nPosition = awt::ImagePosition::RightCenter; 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-bottom") )) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir nPosition = awt::ImagePosition::RightBottom; 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-left") )) 1039cdf0e10cSrcweir { 1040cdf0e10cSrcweir nPosition = awt::ImagePosition::AboveLeft; 1041cdf0e10cSrcweir } 1042cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-center") )) 1043cdf0e10cSrcweir { 1044cdf0e10cSrcweir nPosition = awt::ImagePosition::AboveCenter; 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-right") )) 1047cdf0e10cSrcweir { 1048cdf0e10cSrcweir nPosition = awt::ImagePosition::AboveRight; 1049cdf0e10cSrcweir } 1050cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-left") )) 1051cdf0e10cSrcweir { 1052cdf0e10cSrcweir nPosition = awt::ImagePosition::BelowLeft; 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-center") )) 1055cdf0e10cSrcweir { 1056cdf0e10cSrcweir nPosition = awt::ImagePosition::BelowCenter; 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-right") )) 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir nPosition = awt::ImagePosition::BelowRight; 1061cdf0e10cSrcweir } 1062cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") )) 1063cdf0e10cSrcweir { 1064cdf0e10cSrcweir nPosition = awt::ImagePosition::Centered; 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir else 1067cdf0e10cSrcweir { 1068cdf0e10cSrcweir throw xml::sax::SAXException( 1069cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image position value!") ), 1070cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nPosition ) ); 1074cdf0e10cSrcweir return true; 1075cdf0e10cSrcweir } 1076cdf0e10cSrcweir return false; 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir //__________________________________________________________________________________________________ 1079cdf0e10cSrcweir bool ImportContext::importButtonTypeProperty( 1080cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1081cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1082cdf0e10cSrcweir { 1083cdf0e10cSrcweir OUString buttonType( 1084cdf0e10cSrcweir xAttributes->getValueByUidName( 1085cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1086cdf0e10cSrcweir if (buttonType.getLength()) 1087cdf0e10cSrcweir { 1088cdf0e10cSrcweir sal_Int16 nButtonType; 1089cdf0e10cSrcweir if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("standard") )) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir nButtonType = awt::PushButtonType_STANDARD; 1092cdf0e10cSrcweir } 1093cdf0e10cSrcweir else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ok") )) 1094cdf0e10cSrcweir { 1095cdf0e10cSrcweir nButtonType = awt::PushButtonType_OK; 1096cdf0e10cSrcweir } 1097cdf0e10cSrcweir else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("cancel") )) 1098cdf0e10cSrcweir { 1099cdf0e10cSrcweir nButtonType = awt::PushButtonType_CANCEL; 1100cdf0e10cSrcweir } 1101cdf0e10cSrcweir else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("help") )) 1102cdf0e10cSrcweir { 1103cdf0e10cSrcweir nButtonType = awt::PushButtonType_HELP; 1104cdf0e10cSrcweir } 1105cdf0e10cSrcweir else 1106cdf0e10cSrcweir { 1107cdf0e10cSrcweir throw xml::sax::SAXException( 1108cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid button-type value!") ), 1109cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nButtonType ) ); 1113cdf0e10cSrcweir return true; 1114cdf0e10cSrcweir } 1115cdf0e10cSrcweir return false; 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir //__________________________________________________________________________________________________ 1118cdf0e10cSrcweir bool ImportContext::importDateFormatProperty( 1119cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1120cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1121cdf0e10cSrcweir { 1122cdf0e10cSrcweir OUString aFormat( 1123cdf0e10cSrcweir xAttributes->getValueByUidName( 1124cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1125cdf0e10cSrcweir if (aFormat.getLength()) 1126cdf0e10cSrcweir { 1127cdf0e10cSrcweir sal_Int16 nFormat; 1128cdf0e10cSrcweir if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short") )) 1129cdf0e10cSrcweir { 1130cdf0e10cSrcweir nFormat = 0; 1131cdf0e10cSrcweir } 1132cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short_YY") )) 1133cdf0e10cSrcweir { 1134cdf0e10cSrcweir nFormat = 1; 1135cdf0e10cSrcweir } 1136cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short_YYYY") )) 1137cdf0e10cSrcweir { 1138cdf0e10cSrcweir nFormat = 2; 1139cdf0e10cSrcweir } 1140cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_long") )) 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir nFormat = 3; 1143cdf0e10cSrcweir } 1144cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_DDMMYY") )) 1145cdf0e10cSrcweir { 1146cdf0e10cSrcweir nFormat = 4; 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_MMDDYY") )) 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir nFormat = 5; 1151cdf0e10cSrcweir } 1152cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYMMDD") )) 1153cdf0e10cSrcweir { 1154cdf0e10cSrcweir nFormat = 6; 1155cdf0e10cSrcweir } 1156cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_DDMMYYYY") )) 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir nFormat = 7; 1159cdf0e10cSrcweir } 1160cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_MMDDYYYY") )) 1161cdf0e10cSrcweir { 1162cdf0e10cSrcweir nFormat = 8; 1163cdf0e10cSrcweir } 1164cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYYYMMDD") )) 1165cdf0e10cSrcweir { 1166cdf0e10cSrcweir nFormat = 9; 1167cdf0e10cSrcweir } 1168cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYMMDD_DIN5008") )) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir nFormat = 10; 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYYYMMDD_DIN5008") )) 1173cdf0e10cSrcweir { 1174cdf0e10cSrcweir nFormat = 11; 1175cdf0e10cSrcweir } 1176cdf0e10cSrcweir else 1177cdf0e10cSrcweir { 1178cdf0e10cSrcweir throw xml::sax::SAXException( 1179cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid date-format value!") ), 1180cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1181cdf0e10cSrcweir } 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) ); 1184cdf0e10cSrcweir return true; 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir return false; 1187cdf0e10cSrcweir } 1188cdf0e10cSrcweir //__________________________________________________________________________________________________ 1189cdf0e10cSrcweir bool ImportContext::importTimeFormatProperty( 1190cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1191cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1192cdf0e10cSrcweir { 1193cdf0e10cSrcweir OUString aFormat( 1194cdf0e10cSrcweir xAttributes->getValueByUidName( 1195cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1196cdf0e10cSrcweir if (aFormat.getLength()) 1197cdf0e10cSrcweir { 1198cdf0e10cSrcweir sal_Int16 nFormat; 1199cdf0e10cSrcweir if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h_short") )) 1200cdf0e10cSrcweir { 1201cdf0e10cSrcweir nFormat = 0; 1202cdf0e10cSrcweir } 1203cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h_long") )) 1204cdf0e10cSrcweir { 1205cdf0e10cSrcweir nFormat = 1; 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h_short") )) 1208cdf0e10cSrcweir { 1209cdf0e10cSrcweir nFormat = 2; 1210cdf0e10cSrcweir } 1211cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h_long") )) 1212cdf0e10cSrcweir { 1213cdf0e10cSrcweir nFormat = 3; 1214cdf0e10cSrcweir } 1215cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration_short") )) 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir nFormat = 4; 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration_long") )) 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir nFormat = 5; 1222cdf0e10cSrcweir } 1223cdf0e10cSrcweir else 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir throw xml::sax::SAXException( 1226cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid time-format value!") ), 1227cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1228cdf0e10cSrcweir } 1229cdf0e10cSrcweir 1230cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) ); 1231cdf0e10cSrcweir return true; 1232cdf0e10cSrcweir } 1233cdf0e10cSrcweir return false; 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir //__________________________________________________________________________________________________ 1236cdf0e10cSrcweir bool ImportContext::importOrientationProperty( 1237cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1238cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir OUString aOrient( 1241cdf0e10cSrcweir xAttributes->getValueByUidName( 1242cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1243cdf0e10cSrcweir if (aOrient.getLength()) 1244cdf0e10cSrcweir { 1245cdf0e10cSrcweir sal_Int32 nOrient; 1246cdf0e10cSrcweir if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("horizontal") )) 1247cdf0e10cSrcweir { 1248cdf0e10cSrcweir nOrient = 0; 1249cdf0e10cSrcweir } 1250cdf0e10cSrcweir else if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("vertical") )) 1251cdf0e10cSrcweir { 1252cdf0e10cSrcweir nOrient = 1; 1253cdf0e10cSrcweir } 1254cdf0e10cSrcweir else 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir throw xml::sax::SAXException( 1257cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid orientation value!") ), 1258cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1259cdf0e10cSrcweir } 1260cdf0e10cSrcweir 1261cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nOrient ) ); 1262cdf0e10cSrcweir return true; 1263cdf0e10cSrcweir } 1264cdf0e10cSrcweir return false; 1265cdf0e10cSrcweir } 1266cdf0e10cSrcweir //__________________________________________________________________________________________________ 1267cdf0e10cSrcweir bool ImportContext::importLineEndFormatProperty( 1268cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1269cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1270cdf0e10cSrcweir { 1271cdf0e10cSrcweir OUString aFormat( 1272cdf0e10cSrcweir xAttributes->getValueByUidName( 1273cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1274cdf0e10cSrcweir if (aFormat.getLength()) 1275cdf0e10cSrcweir { 1276cdf0e10cSrcweir sal_Int16 nFormat; 1277cdf0e10cSrcweir if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return") )) 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir nFormat = awt::LineEndFormat::CARRIAGE_RETURN; 1280cdf0e10cSrcweir } 1281cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("line-feed") )) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir nFormat = awt::LineEndFormat::LINE_FEED; 1284cdf0e10cSrcweir } 1285cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return-line-feed") )) 1286cdf0e10cSrcweir { 1287cdf0e10cSrcweir nFormat = awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED; 1288cdf0e10cSrcweir } 1289cdf0e10cSrcweir else 1290cdf0e10cSrcweir { 1291cdf0e10cSrcweir throw xml::sax::SAXException( 1292cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid line end format value!") ), 1293cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1294cdf0e10cSrcweir } 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) ); 1297cdf0e10cSrcweir return true; 1298cdf0e10cSrcweir } 1299cdf0e10cSrcweir return false; 1300cdf0e10cSrcweir } 1301cdf0e10cSrcweir //__________________________________________________________________________________________________ 1302cdf0e10cSrcweir bool ImportContext::importSelectionTypeProperty( 1303cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName, 1304cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir OUString aSelectionType( 1307cdf0e10cSrcweir xAttributes->getValueByUidName( 1308cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); 1309cdf0e10cSrcweir if (aSelectionType.getLength()) 1310cdf0e10cSrcweir { 1311cdf0e10cSrcweir view::SelectionType eSelectionType; 1312cdf0e10cSrcweir 1313cdf0e10cSrcweir if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) 1314cdf0e10cSrcweir { 1315cdf0e10cSrcweir eSelectionType = view::SelectionType_NONE; 1316cdf0e10cSrcweir } 1317cdf0e10cSrcweir else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") )) 1318cdf0e10cSrcweir { 1319cdf0e10cSrcweir eSelectionType = view::SelectionType_SINGLE; 1320cdf0e10cSrcweir } 1321cdf0e10cSrcweir else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multi") )) 1322cdf0e10cSrcweir { 1323cdf0e10cSrcweir eSelectionType = view::SelectionType_MULTI; 1324cdf0e10cSrcweir } 1325cdf0e10cSrcweir else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("range") )) 1326cdf0e10cSrcweir { 1327cdf0e10cSrcweir eSelectionType = view::SelectionType_RANGE; 1328cdf0e10cSrcweir } 1329cdf0e10cSrcweir else 1330cdf0e10cSrcweir { 1331cdf0e10cSrcweir throw xml::sax::SAXException( 1332cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid selection type value!") ), 1333cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( eSelectionType ) ); 1337cdf0e10cSrcweir return true; 1338cdf0e10cSrcweir } 1339cdf0e10cSrcweir return false; 1340cdf0e10cSrcweir } 1341cdf0e10cSrcweir 1342cdf0e10cSrcweir //================================================================================================== 1343cdf0e10cSrcweir struct StringTriple 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir char const * first; 1346cdf0e10cSrcweir char const * second; 1347cdf0e10cSrcweir char const * third; 1348cdf0e10cSrcweir }; 1349cdf0e10cSrcweir static StringTriple const s_aEventTranslations[] = 1350cdf0e10cSrcweir { 1351cdf0e10cSrcweir // from xmloff/source/forms/formevents.cxx 1352cdf0e10cSrcweir // 28.09.2001 tbe added on-adjustmentvaluechange 1353cdf0e10cSrcweir { "com.sun.star.form.XApproveActionListener", "approveAction", "on-approveaction" }, 1354cdf0e10cSrcweir { "com.sun.star.awt.XActionListener", "actionPerformed", "on-performaction" }, 1355cdf0e10cSrcweir { "com.sun.star.form.XChangeListener", "changed", "on-change" }, 1356cdf0e10cSrcweir { "com.sun.star.awt.XTextListener", "textChanged", "on-textchange" }, 1357cdf0e10cSrcweir { "com.sun.star.awt.XItemListener", "itemStateChanged", "on-itemstatechange" }, 1358cdf0e10cSrcweir { "com.sun.star.awt.XFocusListener", "focusGained", "on-focus" }, 1359cdf0e10cSrcweir { "com.sun.star.awt.XFocusListener", "focusLost", "on-blur" }, 1360cdf0e10cSrcweir { "com.sun.star.awt.XKeyListener", "keyPressed", "on-keydown" }, 1361cdf0e10cSrcweir { "com.sun.star.awt.XKeyListener", "keyReleased", "on-keyup" }, 1362cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mouseEntered", "on-mouseover" }, 1363cdf0e10cSrcweir { "com.sun.star.awt.XMouseMotionListener", "mouseDragged", "on-mousedrag" }, 1364cdf0e10cSrcweir { "com.sun.star.awt.XMouseMotionListener", "mouseMoved", "on-mousemove" }, 1365cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mousePressed", "on-mousedown" }, 1366cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mouseReleased", "on-mouseup" }, 1367cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mouseExited", "on-mouseout" }, 1368cdf0e10cSrcweir { "com.sun.star.form.XResetListener", "approveReset", "on-approvereset" }, 1369cdf0e10cSrcweir { "com.sun.star.form.XResetListener", "resetted", "on-reset" }, 1370cdf0e10cSrcweir { "com.sun.star.form.XSubmitListener", "approveSubmit", "on-submit" }, 1371cdf0e10cSrcweir { "com.sun.star.form.XUpdateListener", "approveUpdate", "on-approveupdate" }, 1372cdf0e10cSrcweir { "com.sun.star.form.XUpdateListener", "updated", "on-update" }, 1373cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "loaded", "on-load" }, 1374cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "reloading", "on-startreload" }, 1375cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "reloaded", "on-reload" }, 1376cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "unloading", "on-startunload" }, 1377cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "unloaded", "on-unload" }, 1378cdf0e10cSrcweir { "com.sun.star.form.XConfirmDeleteListener", "confirmDelete", "on-confirmdelete" }, 1379cdf0e10cSrcweir { "com.sun.star.sdb.XRowSetApproveListener", "approveRowChange", "on-approverowchange" }, 1380cdf0e10cSrcweir { "com.sun.star.sdbc.XRowSetListener", "rowChanged", "on-rowchange" }, 1381cdf0e10cSrcweir { "com.sun.star.sdb.XRowSetApproveListener", "approveCursorMove", "on-approvecursormove" }, 1382cdf0e10cSrcweir { "com.sun.star.sdbc.XRowSetListener", "cursorMoved", "on-cursormove" }, 1383cdf0e10cSrcweir { "com.sun.star.form.XDatabaseParameterListener", "approveParameter", "on-supplyparameter" }, 1384cdf0e10cSrcweir { "com.sun.star.sdb.XSQLErrorListener", "errorOccured", "on-error" }, 1385cdf0e10cSrcweir { "com.sun.star.awt.XAdjustmentListener", "adjustmentValueChanged", "on-adjustmentvaluechange" }, 1386cdf0e10cSrcweir { 0, 0, 0 } 1387cdf0e10cSrcweir }; 1388cdf0e10cSrcweir extern StringTriple const * const g_pEventTranslations; 1389cdf0e10cSrcweir StringTriple const * const g_pEventTranslations = s_aEventTranslations; 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir //__________________________________________________________________________________________________ 1392cdf0e10cSrcweir void ImportContext::importEvents( 1393cdf0e10cSrcweir ::std::vector< Reference< xml::input::XElement > > const & rEvents ) 1394cdf0e10cSrcweir { 1395cdf0e10cSrcweir Reference< script::XScriptEventsSupplier > xSupplier( 1396cdf0e10cSrcweir _xControlModel, UNO_QUERY ); 1397cdf0e10cSrcweir if (xSupplier.is()) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir Reference< container::XNameContainer > xEvents( xSupplier->getEvents() ); 1400cdf0e10cSrcweir if (xEvents.is()) 1401cdf0e10cSrcweir { 1402cdf0e10cSrcweir for ( size_t nPos = 0; nPos < rEvents.size(); ++nPos ) 1403cdf0e10cSrcweir { 1404cdf0e10cSrcweir script::ScriptEventDescriptor descr; 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir EventElement * pEventElement = static_cast< EventElement * >( rEvents[ nPos ].get() ); 1407cdf0e10cSrcweir sal_Int32 nUid = pEventElement->getUid(); 1408cdf0e10cSrcweir OUString aLocalName( pEventElement->getLocalName() ); 1409cdf0e10cSrcweir Reference< xml::input::XAttributes > xAttributes( 1410cdf0e10cSrcweir pEventElement->getAttributes() ); 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir // nowadays script events 1413cdf0e10cSrcweir if (_pImport->XMLNS_SCRIPT_UID == nUid) 1414cdf0e10cSrcweir { 1415cdf0e10cSrcweir if (!getStringAttr( &descr.ScriptType, 1416cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1417cdf0e10cSrcweir "language") ), 1418cdf0e10cSrcweir xAttributes, 1419cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ) || 1420cdf0e10cSrcweir !getStringAttr( &descr.ScriptCode, 1421cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1422cdf0e10cSrcweir "macro-name") ), 1423cdf0e10cSrcweir xAttributes, 1424cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID )) 1425cdf0e10cSrcweir { 1426cdf0e10cSrcweir throw xml::sax::SAXException( 1427cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1428cdf0e10cSrcweir "missing language or macro-name " 1429cdf0e10cSrcweir "attribute(s) of event!") ), 1430cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1431cdf0e10cSrcweir } 1432cdf0e10cSrcweir if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) ) 1433cdf0e10cSrcweir { 1434cdf0e10cSrcweir OUString aLocation; 1435cdf0e10cSrcweir if (getStringAttr( &aLocation, 1436cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1437cdf0e10cSrcweir "location") ), 1438cdf0e10cSrcweir xAttributes, 1439cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID )) 1440cdf0e10cSrcweir { 1441cdf0e10cSrcweir // prepend location 1442cdf0e10cSrcweir ::rtl::OUStringBuffer buf; 1443cdf0e10cSrcweir buf.append( aLocation ); 1444cdf0e10cSrcweir buf.append( (sal_Unicode)':' ); 1445cdf0e10cSrcweir buf.append( descr.ScriptCode ); 1446cdf0e10cSrcweir descr.ScriptCode = buf.makeStringAndClear(); 1447cdf0e10cSrcweir } 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir else if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ) ) ) 1450cdf0e10cSrcweir { 1451cdf0e10cSrcweir // Check if there is a protocol, if not assume 1452cdf0e10cSrcweir // this is an early scripting framework url ( without 1453cdf0e10cSrcweir // the protocol ) and fix it up!! 1454cdf0e10cSrcweir if ( descr.ScriptCode.indexOf( ':' ) == -1 ) 1455cdf0e10cSrcweir { 1456cdf0e10cSrcweir ::rtl::OUStringBuffer buf; 1457cdf0e10cSrcweir buf.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) ) ); 1458cdf0e10cSrcweir buf.append( descr.ScriptCode ); 1459cdf0e10cSrcweir descr.ScriptCode = buf.makeStringAndClear(); 1460cdf0e10cSrcweir } 1461cdf0e10cSrcweir } 1462cdf0e10cSrcweir 1463cdf0e10cSrcweir // script:event element 1464cdf0e10cSrcweir if (aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) 1465cdf0e10cSrcweir { 1466cdf0e10cSrcweir OUString aEventName; 1467cdf0e10cSrcweir if (! getStringAttr( 1468cdf0e10cSrcweir &aEventName, 1469cdf0e10cSrcweir OUString( 1470cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("event-name") ), 1471cdf0e10cSrcweir xAttributes, 1472cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID )) 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir throw xml::sax::SAXException( 1475cdf0e10cSrcweir OUString( 1476cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 1477cdf0e10cSrcweir "missing event-name attribute!") ), 1478cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1479cdf0e10cSrcweir } 1480cdf0e10cSrcweir 1481cdf0e10cSrcweir // lookup in table 1482cdf0e10cSrcweir ::rtl::OString str( 1483cdf0e10cSrcweir ::rtl::OUStringToOString( 1484cdf0e10cSrcweir aEventName, RTL_TEXTENCODING_ASCII_US ) ); 1485cdf0e10cSrcweir StringTriple const * p = g_pEventTranslations; 1486cdf0e10cSrcweir while (p->first) 1487cdf0e10cSrcweir { 1488cdf0e10cSrcweir if (0 == ::rtl_str_compare( p->third, str.getStr() )) 1489cdf0e10cSrcweir { 1490cdf0e10cSrcweir descr.ListenerType = OUString( 1491cdf0e10cSrcweir p->first, ::rtl_str_getLength( p->first ), 1492cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US ); 1493cdf0e10cSrcweir descr.EventMethod = OUString( 1494cdf0e10cSrcweir p->second, ::rtl_str_getLength( p->second ), 1495cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US ); 1496cdf0e10cSrcweir break; 1497cdf0e10cSrcweir } 1498cdf0e10cSrcweir ++p; 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir 1501cdf0e10cSrcweir if (! p->first) 1502cdf0e10cSrcweir { 1503cdf0e10cSrcweir throw xml::sax::SAXException( 1504cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("no matching event-name found!") ), 1505cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1506cdf0e10cSrcweir } 1507cdf0e10cSrcweir } 1508cdf0e10cSrcweir else // script:listener-event element 1509cdf0e10cSrcweir { 1510cdf0e10cSrcweir OSL_ASSERT( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("listener-event") ) ); 1511cdf0e10cSrcweir 1512cdf0e10cSrcweir if (!getStringAttr( 1513cdf0e10cSrcweir &descr.ListenerType, 1514cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1515cdf0e10cSrcweir "listener-type") ), 1516cdf0e10cSrcweir xAttributes, 1517cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ) || 1518cdf0e10cSrcweir !getStringAttr( 1519cdf0e10cSrcweir &descr.EventMethod, 1520cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1521cdf0e10cSrcweir "listener-method") ), 1522cdf0e10cSrcweir xAttributes, _pImport->XMLNS_SCRIPT_UID )) 1523cdf0e10cSrcweir { 1524cdf0e10cSrcweir throw xml::sax::SAXException( 1525cdf0e10cSrcweir OUString( 1526cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 1527cdf0e10cSrcweir "missing listener-type or " 1528cdf0e10cSrcweir "listener-method attribute(s)!") ), 1529cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1530cdf0e10cSrcweir } 1531cdf0e10cSrcweir // optional listener param 1532cdf0e10cSrcweir getStringAttr( 1533cdf0e10cSrcweir &descr.AddListenerParam, 1534cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1535cdf0e10cSrcweir "listener-param") ), 1536cdf0e10cSrcweir xAttributes, _pImport->XMLNS_SCRIPT_UID ); 1537cdf0e10cSrcweir } 1538cdf0e10cSrcweir } 1539cdf0e10cSrcweir else // deprecated dlg:event element 1540cdf0e10cSrcweir { 1541cdf0e10cSrcweir OSL_ASSERT( 1542cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID == nUid && 1543cdf0e10cSrcweir aLocalName.equalsAsciiL( 1544cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("event") ) ); 1545cdf0e10cSrcweir 1546cdf0e10cSrcweir if (!getStringAttr( &descr.ListenerType, 1547cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1548cdf0e10cSrcweir "listener-type") ), 1549cdf0e10cSrcweir xAttributes, 1550cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID ) || 1551cdf0e10cSrcweir !getStringAttr( &descr.EventMethod, 1552cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1553cdf0e10cSrcweir "event-method") ), 1554cdf0e10cSrcweir xAttributes, 1555cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID )) 1556cdf0e10cSrcweir { 1557cdf0e10cSrcweir throw xml::sax::SAXException( 1558cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("missing listener-type or event-method attribute(s)!") ), 1559cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1560cdf0e10cSrcweir } 1561cdf0e10cSrcweir 1562cdf0e10cSrcweir getStringAttr( 1563cdf0e10cSrcweir &descr.ScriptType, 1564cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("script-type") ), 1565cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ); 1566cdf0e10cSrcweir getStringAttr( 1567cdf0e10cSrcweir &descr.ScriptCode, 1568cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("script-code") ), 1569cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ); 1570cdf0e10cSrcweir getStringAttr( 1571cdf0e10cSrcweir &descr.AddListenerParam, 1572cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("param") ), 1573cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ); 1574cdf0e10cSrcweir } 1575cdf0e10cSrcweir 1576cdf0e10cSrcweir ::rtl::OUStringBuffer buf; 1577cdf0e10cSrcweir buf.append( descr.ListenerType ); 1578cdf0e10cSrcweir buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("::") ); 1579cdf0e10cSrcweir buf.append( descr.EventMethod ); 1580cdf0e10cSrcweir xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) ); 1581cdf0e10cSrcweir } 1582cdf0e10cSrcweir } 1583cdf0e10cSrcweir } 1584cdf0e10cSrcweir } 1585cdf0e10cSrcweir //__________________________________________________________________________________________________ 1586cdf0e10cSrcweir void ImportContext::importDefaults( 1587cdf0e10cSrcweir sal_Int32 nBaseX, sal_Int32 nBaseY, 1588cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes, 1589cdf0e10cSrcweir bool supportPrintable ) 1590cdf0e10cSrcweir { 1591cdf0e10cSrcweir _xControlModel->setPropertyValue( 1592cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), 1593cdf0e10cSrcweir makeAny( _aId ) ); 1594cdf0e10cSrcweir 1595cdf0e10cSrcweir importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ), 1596cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("tab-index") ), 1597cdf0e10cSrcweir xAttributes ); 1598cdf0e10cSrcweir 1599cdf0e10cSrcweir sal_Bool bDisable = sal_False; 1600cdf0e10cSrcweir if (getBoolAttr( 1601cdf0e10cSrcweir &bDisable, OUString( RTL_CONSTASCII_USTRINGPARAM("disabled") ), 1602cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ) && 1603cdf0e10cSrcweir bDisable) 1604cdf0e10cSrcweir { 1605cdf0e10cSrcweir _xControlModel->setPropertyValue( 1606cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), makeAny( sal_False ) ); 1607cdf0e10cSrcweir } 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir sal_Bool bVisible = sal_True; 1610cdf0e10cSrcweir if (getBoolAttr( 1611cdf0e10cSrcweir &bVisible, OUString( RTL_CONSTASCII_USTRINGPARAM("visible") ), 1612cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible) 1613cdf0e10cSrcweir { 1614cdf0e10cSrcweir try 1615cdf0e10cSrcweir { 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir _xControlModel->setPropertyValue( 1618cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) ); 1619cdf0e10cSrcweir } 1620cdf0e10cSrcweir catch( Exception& ) 1621cdf0e10cSrcweir { 1622cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1623cdf0e10cSrcweir } 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir if (!importLongProperty( nBaseX, 1627cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), 1628cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("left") ), 1629cdf0e10cSrcweir xAttributes ) || 1630cdf0e10cSrcweir !importLongProperty( nBaseY, 1631cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), 1632cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("top") ), 1633cdf0e10cSrcweir xAttributes ) || 1634cdf0e10cSrcweir !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), 1635cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("width") ), 1636cdf0e10cSrcweir xAttributes ) || 1637cdf0e10cSrcweir !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), 1638cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("height") ), 1639cdf0e10cSrcweir xAttributes )) 1640cdf0e10cSrcweir { 1641cdf0e10cSrcweir throw xml::sax::SAXException( 1642cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("missing pos size attribute(s)!") ), 1643cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1644cdf0e10cSrcweir } 1645cdf0e10cSrcweir 1646cdf0e10cSrcweir if (supportPrintable) 1647cdf0e10cSrcweir { 1648cdf0e10cSrcweir importBooleanProperty( 1649cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), 1650cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ), 1651cdf0e10cSrcweir xAttributes ); 1652cdf0e10cSrcweir } 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir sal_Int32 nLong; 1655cdf0e10cSrcweir if (! getLongAttr( 1656cdf0e10cSrcweir &nLong, 1657cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("page") ), 1658cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID )) 1659cdf0e10cSrcweir { 1660cdf0e10cSrcweir nLong = 0; 1661cdf0e10cSrcweir } 1662cdf0e10cSrcweir _xControlModel->setPropertyValue( 1663cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ), 1664cdf0e10cSrcweir makeAny( nLong ) ); 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), 1667cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ), 1668cdf0e10cSrcweir xAttributes ); 1669cdf0e10cSrcweir importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ), 1670cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("help-text") ), 1671cdf0e10cSrcweir xAttributes ); 1672cdf0e10cSrcweir importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ), 1673cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("help-url") ), 1674cdf0e10cSrcweir xAttributes ); 1675cdf0e10cSrcweir } 1676cdf0e10cSrcweir 1677cdf0e10cSrcweir //################################################################################################## 1678cdf0e10cSrcweir 1679cdf0e10cSrcweir //__________________________________________________________________________________________________ 1680cdf0e10cSrcweir Reference< xml::input::XElement > ElementBase::getParent() 1681cdf0e10cSrcweir throw (RuntimeException) 1682cdf0e10cSrcweir { 1683cdf0e10cSrcweir return static_cast< xml::input::XElement * >( _pParent ); 1684cdf0e10cSrcweir } 1685cdf0e10cSrcweir //__________________________________________________________________________________________________ 1686cdf0e10cSrcweir OUString ElementBase::getLocalName() 1687cdf0e10cSrcweir throw (RuntimeException) 1688cdf0e10cSrcweir { 1689cdf0e10cSrcweir return _aLocalName; 1690cdf0e10cSrcweir } 1691cdf0e10cSrcweir //__________________________________________________________________________________________________ 1692cdf0e10cSrcweir sal_Int32 ElementBase::getUid() 1693cdf0e10cSrcweir throw (RuntimeException) 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir return _nUid; 1696cdf0e10cSrcweir } 1697cdf0e10cSrcweir //__________________________________________________________________________________________________ 1698cdf0e10cSrcweir Reference< xml::input::XAttributes > ElementBase::getAttributes() 1699cdf0e10cSrcweir throw (RuntimeException) 1700cdf0e10cSrcweir { 1701cdf0e10cSrcweir return _xAttributes; 1702cdf0e10cSrcweir } 1703cdf0e10cSrcweir //__________________________________________________________________________________________________ 1704cdf0e10cSrcweir void ElementBase::ignorableWhitespace( 1705cdf0e10cSrcweir OUString const & /*rWhitespaces*/ ) 1706cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1707cdf0e10cSrcweir { 1708cdf0e10cSrcweir // not used 1709cdf0e10cSrcweir } 1710cdf0e10cSrcweir //__________________________________________________________________________________________________ 1711cdf0e10cSrcweir void ElementBase::characters( OUString const & /*rChars*/ ) 1712cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1713cdf0e10cSrcweir { 1714cdf0e10cSrcweir // not used, all characters ignored 1715cdf0e10cSrcweir } 1716cdf0e10cSrcweir //__________________________________________________________________________________________________ 1717cdf0e10cSrcweir void ElementBase::endElement() 1718cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1719cdf0e10cSrcweir { 1720cdf0e10cSrcweir } 1721cdf0e10cSrcweir //______________________________________________________________________________ 1722cdf0e10cSrcweir void ElementBase::processingInstruction( 1723cdf0e10cSrcweir OUString const & /*Target*/, OUString const & /*Data*/ ) 1724cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1725cdf0e10cSrcweir { 1726cdf0e10cSrcweir } 1727cdf0e10cSrcweir //__________________________________________________________________________________________________ 1728cdf0e10cSrcweir Reference< xml::input::XElement > ElementBase::startChildElement( 1729cdf0e10cSrcweir sal_Int32 /*nUid*/, OUString const & /*rLocalName*/, 1730cdf0e10cSrcweir Reference< xml::input::XAttributes > const & /*xAttributes*/ ) 1731cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1732cdf0e10cSrcweir { 1733cdf0e10cSrcweir throw xml::sax::SAXException( 1734cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ), 1735cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1736cdf0e10cSrcweir } 1737cdf0e10cSrcweir 1738cdf0e10cSrcweir //__________________________________________________________________________________________________ 1739cdf0e10cSrcweir ElementBase::ElementBase( 1740cdf0e10cSrcweir sal_Int32 nUid, OUString const & rLocalName, 1741cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes, 1742cdf0e10cSrcweir ElementBase * pParent, DialogImport * pImport ) 1743cdf0e10cSrcweir SAL_THROW( () ) 1744cdf0e10cSrcweir : _pImport( pImport ) 1745cdf0e10cSrcweir , _pParent( pParent ) 1746cdf0e10cSrcweir , _nUid( nUid ) 1747cdf0e10cSrcweir , _aLocalName( rLocalName ) 1748cdf0e10cSrcweir , _xAttributes( xAttributes ) 1749cdf0e10cSrcweir { 1750cdf0e10cSrcweir _pImport->acquire(); 1751cdf0e10cSrcweir 1752cdf0e10cSrcweir if (_pParent) 1753cdf0e10cSrcweir { 1754cdf0e10cSrcweir _pParent->acquire(); 1755cdf0e10cSrcweir } 1756cdf0e10cSrcweir } 1757cdf0e10cSrcweir //__________________________________________________________________________________________________ 1758cdf0e10cSrcweir ElementBase::~ElementBase() 1759cdf0e10cSrcweir SAL_THROW( () ) 1760cdf0e10cSrcweir { 1761cdf0e10cSrcweir _pImport->release(); 1762cdf0e10cSrcweir 1763cdf0e10cSrcweir if (_pParent) 1764cdf0e10cSrcweir { 1765cdf0e10cSrcweir _pParent->release(); 1766cdf0e10cSrcweir } 1767cdf0e10cSrcweir 1768cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 1769cdf0e10cSrcweir ::rtl::OString aStr( ::rtl::OUStringToOString( 1770cdf0e10cSrcweir _aLocalName, RTL_TEXTENCODING_ASCII_US ) ); 1771cdf0e10cSrcweir OSL_TRACE( "ElementBase::~ElementBase(): %s\n", aStr.getStr() ); 1772cdf0e10cSrcweir #endif 1773cdf0e10cSrcweir } 1774cdf0e10cSrcweir 1775cdf0e10cSrcweir //################################################################################################## 1776cdf0e10cSrcweir 1777cdf0e10cSrcweir // XRoot 1778cdf0e10cSrcweir // 1779cdf0e10cSrcweir 1780cdf0e10cSrcweir //______________________________________________________________________________ 1781cdf0e10cSrcweir void DialogImport::startDocument( 1782cdf0e10cSrcweir Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) 1783cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1784cdf0e10cSrcweir { 1785cdf0e10cSrcweir XMLNS_DIALOGS_UID = xNamespaceMapping->getUidByUri( 1786cdf0e10cSrcweir OUSTR(XMLNS_DIALOGS_URI) ); 1787cdf0e10cSrcweir XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri( 1788cdf0e10cSrcweir OUSTR(XMLNS_SCRIPT_URI) ); 1789cdf0e10cSrcweir } 1790cdf0e10cSrcweir //__________________________________________________________________________________________________ 1791cdf0e10cSrcweir void DialogImport::endDocument() 1792cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1793cdf0e10cSrcweir { 1794cdf0e10cSrcweir // ignored 1795cdf0e10cSrcweir } 1796cdf0e10cSrcweir //__________________________________________________________________________________________________ 1797cdf0e10cSrcweir void DialogImport::processingInstruction( 1798cdf0e10cSrcweir OUString const & /*rTarget*/, OUString const & /*rData*/ ) 1799cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1800cdf0e10cSrcweir { 1801cdf0e10cSrcweir // ignored for now: xxx todo 1802cdf0e10cSrcweir } 1803cdf0e10cSrcweir //__________________________________________________________________________________________________ 1804cdf0e10cSrcweir void DialogImport::setDocumentLocator( 1805cdf0e10cSrcweir Reference< xml::sax::XLocator > const & /*xLocator*/ ) 1806cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1807cdf0e10cSrcweir { 1808cdf0e10cSrcweir // ignored for now: xxx todo 1809cdf0e10cSrcweir } 1810cdf0e10cSrcweir //__________________________________________________________________________________________________ 1811cdf0e10cSrcweir Reference< xml::input::XElement > DialogImport::startRootElement( 1812cdf0e10cSrcweir sal_Int32 nUid, OUString const & rLocalName, 1813cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 1814cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException) 1815cdf0e10cSrcweir { 1816cdf0e10cSrcweir if (XMLNS_DIALOGS_UID != nUid) 1817cdf0e10cSrcweir { 1818cdf0e10cSrcweir throw xml::sax::SAXException( 1819cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1820cdf0e10cSrcweir Reference< XInterface >(), Any() ); 1821cdf0e10cSrcweir } 1822cdf0e10cSrcweir // window 1823cdf0e10cSrcweir else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("window") )) 1824cdf0e10cSrcweir { 1825cdf0e10cSrcweir return new WindowElement( rLocalName, xAttributes, 0, this ); 1826cdf0e10cSrcweir } 1827cdf0e10cSrcweir else 1828cdf0e10cSrcweir { 1829cdf0e10cSrcweir throw xml::sax::SAXException( 1830cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1831cdf0e10cSrcweir "illegal root element (expected window) given: ") ) + 1832cdf0e10cSrcweir rLocalName, Reference< XInterface >(), Any() ); 1833cdf0e10cSrcweir } 1834cdf0e10cSrcweir } 1835cdf0e10cSrcweir //__________________________________________________________________________________________________ 1836cdf0e10cSrcweir DialogImport::~DialogImport() 1837cdf0e10cSrcweir SAL_THROW( () ) 1838cdf0e10cSrcweir { 1839cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 1840cdf0e10cSrcweir OSL_TRACE( "DialogImport::~DialogImport().\n" ); 1841cdf0e10cSrcweir #endif 1842cdf0e10cSrcweir } 1843cdf0e10cSrcweir //__________________________________________________________________________________________________ 1844cdf0e10cSrcweir Reference< util::XNumberFormatsSupplier > const & DialogImport::getNumberFormatsSupplier() 1845cdf0e10cSrcweir { 1846cdf0e10cSrcweir if (! _xSupplier.is()) 1847cdf0e10cSrcweir { 1848cdf0e10cSrcweir Reference< XComponentContext > xContext( getComponentContext() ); 1849cdf0e10cSrcweir Reference< util::XNumberFormatsSupplier > xSupplier( 1850cdf0e10cSrcweir xContext->getServiceManager()->createInstanceWithContext( 1851cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 1852cdf0e10cSrcweir "com.sun.star.util.NumberFormatsSupplier") ), 1853cdf0e10cSrcweir xContext ), UNO_QUERY ); 1854cdf0e10cSrcweir 1855cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 1856cdf0e10cSrcweir if (! _xSupplier.is()) 1857cdf0e10cSrcweir { 1858cdf0e10cSrcweir _xSupplier = xSupplier; 1859cdf0e10cSrcweir } 1860cdf0e10cSrcweir } 1861cdf0e10cSrcweir return _xSupplier; 1862cdf0e10cSrcweir } 1863cdf0e10cSrcweir 1864cdf0e10cSrcweir //__________________________________________________________________________________________________ 1865cdf0e10cSrcweir void DialogImport::addStyle( 1866cdf0e10cSrcweir OUString const & rStyleId, 1867cdf0e10cSrcweir Reference< xml::input::XElement > const & xStyle ) 1868cdf0e10cSrcweir SAL_THROW( () ) 1869cdf0e10cSrcweir { 1870cdf0e10cSrcweir _styleNames.push_back( rStyleId ); 1871cdf0e10cSrcweir _styles.push_back( xStyle ); 1872cdf0e10cSrcweir } 1873cdf0e10cSrcweir //__________________________________________________________________________________________________ 1874cdf0e10cSrcweir Reference< xml::input::XElement > DialogImport::getStyle( 1875cdf0e10cSrcweir OUString const & rStyleId ) const 1876cdf0e10cSrcweir SAL_THROW( () ) 1877cdf0e10cSrcweir { 1878cdf0e10cSrcweir for ( size_t nPos = 0; nPos < _styleNames.size(); ++nPos ) 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir if (_styleNames[ nPos ] == rStyleId) 1881cdf0e10cSrcweir { 1882cdf0e10cSrcweir return _styles[ nPos ]; 1883cdf0e10cSrcweir } 1884cdf0e10cSrcweir } 1885cdf0e10cSrcweir return 0; 1886cdf0e10cSrcweir } 1887cdf0e10cSrcweir 1888cdf0e10cSrcweir //################################################################################################## 1889cdf0e10cSrcweir 1890cdf0e10cSrcweir //================================================================================================== 1891cdf0e10cSrcweir Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel( 1892cdf0e10cSrcweir Reference< container::XNameContainer > const & xDialogModel, 1893cdf0e10cSrcweir Reference< XComponentContext > const & xContext ) 1894cdf0e10cSrcweir SAL_THROW( (Exception) ) 1895cdf0e10cSrcweir { 1896cdf0e10cSrcweir return ::xmlscript::createDocumentHandler( 1897cdf0e10cSrcweir static_cast< xml::input::XRoot * >( 1898cdf0e10cSrcweir new DialogImport( xContext, xDialogModel ) ) ); 1899cdf0e10cSrcweir } 1900cdf0e10cSrcweir 1901cdf0e10cSrcweir } 1902