1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_xmlscript.hxx" 30 #include "imp_share.hxx" 31 32 #include <com/sun/star/beans/XPropertySet.hpp> 33 #include <com/sun/star/beans/XPropertyState.hpp> 34 35 36 using namespace ::com::sun::star; 37 using namespace ::com::sun::star::uno; 38 using ::rtl::OUString; 39 40 namespace xmlscript 41 { 42 43 // progessmeter 44 //__________________________________________________________________________________________________ 45 Reference< xml::input::XElement > ProgressBarElement::startChildElement( 46 sal_Int32 nUid, OUString const & rLocalName, 47 Reference< xml::input::XAttributes > const & xAttributes ) 48 throw (xml::sax::SAXException, RuntimeException) 49 { 50 // event 51 if (_pImport->isEventElement( nUid, rLocalName )) 52 { 53 return new EventElement( 54 nUid, rLocalName, xAttributes, this, _pImport ); 55 } 56 else 57 { 58 throw xml::sax::SAXException( 59 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 60 Reference< XInterface >(), Any() ); 61 } 62 } 63 //__________________________________________________________________________________________________ 64 void ProgressBarElement::endElement() 65 throw (xml::sax::SAXException, RuntimeException) 66 { 67 ControlImportContext ctx( 68 _pImport, getControlId( _xAttributes ), 69 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ); 70 71 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 72 if (xStyle.is()) 73 { 74 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 75 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 76 pStyle->importBackgroundColorStyle( xControlModel ); 77 pStyle->importBorderStyle( xControlModel ); 78 pStyle->importFillColorStyle( xControlModel ); 79 } 80 81 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 82 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), 83 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 84 _xAttributes ); 85 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ), 86 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), 87 _xAttributes ); 88 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), 89 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), 90 _xAttributes ); 91 ctx.importEvents( _events ); 92 // avoid ring-reference: 93 // vector< event elements > holding event elements holding this (via _pParent) 94 _events.clear(); 95 } 96 97 //################################################################################################## 98 99 // scrollbar 100 //__________________________________________________________________________________________________ 101 Reference< xml::input::XElement > ScrollBarElement::startChildElement( 102 sal_Int32 nUid, OUString const & rLocalName, 103 Reference< xml::input::XAttributes > const & xAttributes ) 104 throw (xml::sax::SAXException, RuntimeException) 105 { 106 // event 107 if (_pImport->isEventElement( nUid, rLocalName )) 108 { 109 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 110 } 111 else 112 { 113 throw xml::sax::SAXException( 114 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 115 Reference< XInterface >(), Any() ); 116 } 117 } 118 //__________________________________________________________________________________________________ 119 void ScrollBarElement::endElement() 120 throw (xml::sax::SAXException, RuntimeException) 121 { 122 ControlImportContext ctx( 123 _pImport, getControlId( _xAttributes ), 124 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ); 125 126 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 127 if (xStyle.is()) 128 { 129 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 130 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 131 pStyle->importBackgroundColorStyle( xControlModel ); 132 pStyle->importBorderStyle( xControlModel ); 133 } 134 135 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 136 ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), 137 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 138 _xAttributes ); 139 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ), 140 OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ), 141 _xAttributes ); 142 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ), 143 OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ), 144 _xAttributes ); 145 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ), 146 OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ), 147 _xAttributes ); 148 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ), 149 OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ), 150 _xAttributes ); 151 ctx.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"), 152 _xAttributes ); 153 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ), 154 OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ), 155 _xAttributes ); 156 ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 157 _xAttributes ); 158 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 159 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 160 _xAttributes ); 161 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ), 162 OUString( RTL_CONSTASCII_USTRINGPARAM("live-scroll") ), 163 _xAttributes ); 164 ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), 165 OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), 166 _xAttributes ); 167 168 ctx.importEvents( _events ); 169 // avoid ring-reference: 170 // vector< event elements > holding event elements holding this (via _pParent) 171 _events.clear(); 172 } 173 174 //################################################################################################## 175 176 // fixedline 177 //__________________________________________________________________________________________________ 178 Reference< xml::input::XElement > FixedLineElement::startChildElement( 179 sal_Int32 nUid, OUString const & rLocalName, 180 Reference< xml::input::XAttributes > const & xAttributes ) 181 throw (xml::sax::SAXException, RuntimeException) 182 { 183 // event 184 if (_pImport->isEventElement( nUid, rLocalName )) 185 { 186 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 187 } 188 else 189 { 190 throw xml::sax::SAXException( 191 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 192 Reference< XInterface >(), Any() ); 193 } 194 } 195 //__________________________________________________________________________________________________ 196 void FixedLineElement::endElement() 197 throw (xml::sax::SAXException, RuntimeException) 198 { 199 ControlImportContext ctx( 200 _pImport, getControlId( _xAttributes ), 201 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ); 202 203 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 204 if (xStyle.is()) 205 { 206 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 207 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 208 pStyle->importTextColorStyle( xControlModel ); 209 pStyle->importTextLineColorStyle( xControlModel ); 210 pStyle->importFontStyle( xControlModel ); 211 } 212 213 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 214 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 215 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 216 _xAttributes ); 217 ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), 218 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 219 _xAttributes ); 220 ctx.importEvents( _events ); 221 // avoid ring-reference: 222 // vector< event elements > holding event elements holding this (via _pParent) 223 _events.clear(); 224 } 225 226 //################################################################################################## 227 228 // patternfield 229 //__________________________________________________________________________________________________ 230 Reference< xml::input::XElement > PatternFieldElement::startChildElement( 231 sal_Int32 nUid, OUString const & rLocalName, 232 Reference< xml::input::XAttributes > const & xAttributes ) 233 throw (xml::sax::SAXException, RuntimeException) 234 { 235 // event 236 if (_pImport->isEventElement( nUid, rLocalName )) 237 { 238 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 239 } 240 else 241 { 242 throw xml::sax::SAXException( 243 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 244 Reference< XInterface >(), Any() ); 245 } 246 } 247 //__________________________________________________________________________________________________ 248 void PatternFieldElement::endElement() 249 throw (xml::sax::SAXException, RuntimeException) 250 { 251 ControlImportContext ctx( 252 _pImport, getControlId( _xAttributes ), 253 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ); 254 255 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 256 if (xStyle.is()) 257 { 258 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 259 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 260 pStyle->importBackgroundColorStyle( xControlModel ); 261 pStyle->importTextColorStyle( xControlModel ); 262 pStyle->importTextLineColorStyle( xControlModel ); 263 pStyle->importBorderStyle( xControlModel ); 264 pStyle->importFontStyle( xControlModel ); 265 } 266 267 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 268 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 269 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 270 _xAttributes ); 271 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 272 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 273 _xAttributes ); 274 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), 275 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), 276 _xAttributes ); 277 ctx.importBooleanProperty( 278 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 279 _xAttributes ); 280 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 281 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 282 _xAttributes ); 283 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), 284 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ), 285 _xAttributes ); 286 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ), 287 OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ), 288 _xAttributes ); 289 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ), 290 OUString( RTL_CONSTASCII_USTRINGPARAM("literal-mask") ), 291 _xAttributes ); 292 ctx.importEvents( _events ); 293 // avoid ring-reference: 294 // vector< event elements > holding event elements holding this (via _pParent) 295 _events.clear(); 296 } 297 298 //################################################################################################## 299 300 // formattedfield 301 //__________________________________________________________________________________________________ 302 Reference< xml::input::XElement > FormattedFieldElement::startChildElement( 303 sal_Int32 nUid, OUString const & rLocalName, 304 Reference< xml::input::XAttributes > const & xAttributes ) 305 throw (xml::sax::SAXException, RuntimeException) 306 { 307 // event 308 if (_pImport->isEventElement( nUid, rLocalName )) 309 { 310 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 311 } 312 else 313 { 314 throw xml::sax::SAXException( 315 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 316 Reference< XInterface >(), Any() ); 317 } 318 } 319 //__________________________________________________________________________________________________ 320 void FormattedFieldElement::endElement() 321 throw (xml::sax::SAXException, RuntimeException) 322 { 323 ControlImportContext ctx( 324 _pImport, getControlId( _xAttributes ), 325 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ); 326 327 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 328 if (xStyle.is()) 329 { 330 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 331 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 332 pStyle->importBackgroundColorStyle( xControlModel ); 333 pStyle->importTextColorStyle( xControlModel ); 334 pStyle->importTextLineColorStyle( xControlModel ); 335 pStyle->importBorderStyle( xControlModel ); 336 pStyle->importFontStyle( xControlModel ); 337 } 338 339 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 340 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 341 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 342 _xAttributes ); 343 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 344 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 345 _xAttributes ); 346 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), 347 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), 348 _xAttributes ); 349 ctx.importBooleanProperty( 350 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 351 _xAttributes ); 352 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 353 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 354 _xAttributes ); 355 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ), 356 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), 357 _xAttributes ); 358 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ), 359 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), 360 _xAttributes ); 361 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ), 362 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 363 _xAttributes ); 364 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 365 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ), 366 _xAttributes ); 367 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), 368 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ), 369 _xAttributes ); 370 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), 371 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 372 _xAttributes ); 373 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 374 _xAttributes )) 375 ctx.getControlModel()->setPropertyValue( 376 OUSTR("Repeat"), makeAny(true) ); 377 378 OUString sDefault( 379 _xAttributes->getValueByUidName( 380 _pImport->XMLNS_DIALOGS_UID, 381 OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) ); 382 if (sDefault.getLength()) 383 { 384 double d = sDefault.toDouble(); 385 if (d != 0.0 || 386 sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) || 387 sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") )) 388 { 389 ctx.getControlModel()->setPropertyValue( 390 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ), 391 makeAny( d ) ); 392 } 393 else // treat as string 394 { 395 ctx.getControlModel()->setPropertyValue( 396 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ), 397 makeAny( sDefault ) ); 398 } 399 } 400 401 // format spec 402 ctx.getControlModel()->setPropertyValue( 403 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ), 404 makeAny( _pImport->getNumberFormatsSupplier() ) ); 405 406 OUString sFormat( 407 _xAttributes->getValueByUidName( 408 _pImport->XMLNS_DIALOGS_UID, 409 OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) ); 410 if (sFormat.getLength()) 411 { 412 lang::Locale locale; 413 414 OUString sLocale( 415 _xAttributes->getValueByUidName( 416 _pImport->XMLNS_DIALOGS_UID, 417 OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) ); 418 if (sLocale.getLength()) 419 { 420 // split locale 421 sal_Int32 semi0 = sLocale.indexOf( ';' ); 422 if (semi0 < 0) // no semi at all, just try language 423 { 424 locale.Language = sLocale; 425 } 426 else 427 { 428 sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 ); 429 if (semi1 > semi0) // language;country;variant 430 { 431 locale.Language = sLocale.copy( 0, semi0 ); 432 locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 ); 433 locale.Variant = sLocale.copy( semi1 +1 ); 434 } 435 else // try language;country 436 { 437 locale.Language = sLocale.copy( 0, semi0 ); 438 locale.Country = sLocale.copy( semi0 +1 ); 439 } 440 } 441 } 442 443 try 444 { 445 Reference< util::XNumberFormats > xFormats( 446 _pImport->getNumberFormatsSupplier()->getNumberFormats() ); 447 sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True ); 448 if (-1 == nKey) 449 { 450 nKey = xFormats->addNew( sFormat, locale ); 451 } 452 ctx.getControlModel()->setPropertyValue( 453 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ), makeAny( nKey ) ); 454 } 455 catch (util::MalformedNumberFormatException & exc) 456 { 457 OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" ); 458 // rethrow 459 throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() ); 460 } 461 } 462 ctx.importBooleanProperty( 463 OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ), 464 OUString( RTL_CONSTASCII_USTRINGPARAM("treat-as-number") ), 465 _xAttributes ); 466 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ), 467 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), 468 _xAttributes ); 469 470 ctx.importEvents( _events ); 471 // avoid ring-reference: 472 // vector< event elements > holding event elements holding this (via _pParent) 473 _events.clear(); 474 } 475 476 //################################################################################################## 477 478 // timefield 479 //__________________________________________________________________________________________________ 480 Reference< xml::input::XElement > TimeFieldElement::startChildElement( 481 sal_Int32 nUid, OUString const & rLocalName, 482 Reference< xml::input::XAttributes > const & xAttributes ) 483 throw (xml::sax::SAXException, RuntimeException) 484 { 485 // event 486 if (_pImport->isEventElement( nUid, rLocalName )) 487 { 488 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 489 } 490 else 491 { 492 throw xml::sax::SAXException( 493 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 494 Reference< XInterface >(), Any() ); 495 } 496 } 497 //__________________________________________________________________________________________________ 498 void TimeFieldElement::endElement() 499 throw (xml::sax::SAXException, RuntimeException) 500 { 501 ControlImportContext ctx( 502 _pImport, getControlId( _xAttributes ), 503 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ); 504 505 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 506 if (xStyle.is()) 507 { 508 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 509 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 510 pStyle->importBackgroundColorStyle( xControlModel ); 511 pStyle->importTextColorStyle( xControlModel ); 512 pStyle->importTextLineColorStyle( xControlModel ); 513 pStyle->importBorderStyle( xControlModel ); 514 pStyle->importFontStyle( xControlModel ); 515 } 516 517 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 518 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 519 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 520 _xAttributes ); 521 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 522 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 523 _xAttributes ); 524 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), 525 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), 526 _xAttributes ); 527 ctx.importBooleanProperty( 528 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 529 _xAttributes ); 530 ctx.importTimeFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ), 531 OUString( RTL_CONSTASCII_USTRINGPARAM("time-format") ), 532 _xAttributes ); 533 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ), 534 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 535 _xAttributes ); 536 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ), 537 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), 538 _xAttributes ); 539 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ), 540 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), 541 _xAttributes ); 542 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), 543 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 544 _xAttributes ); 545 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 546 _xAttributes )) 547 ctx.getControlModel()->setPropertyValue( 548 OUSTR("Repeat"), makeAny(true) ); 549 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 550 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ), 551 _xAttributes ); 552 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ), 553 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), 554 _xAttributes ); 555 556 ctx.importEvents( _events ); 557 // avoid ring-reference: 558 // vector< event elements > holding event elements holding this (via _pParent) 559 _events.clear(); 560 } 561 562 //################################################################################################## 563 564 // numericfield 565 //__________________________________________________________________________________________________ 566 Reference< xml::input::XElement > NumericFieldElement::startChildElement( 567 sal_Int32 nUid, OUString const & rLocalName, 568 Reference< xml::input::XAttributes > const & xAttributes ) 569 throw (xml::sax::SAXException, RuntimeException) 570 { 571 // event 572 if (_pImport->isEventElement( nUid, rLocalName )) 573 { 574 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 575 } 576 else 577 { 578 throw xml::sax::SAXException( 579 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 580 Reference< XInterface >(), Any() ); 581 } 582 } 583 //__________________________________________________________________________________________________ 584 void NumericFieldElement::endElement() 585 throw (xml::sax::SAXException, RuntimeException) 586 { 587 ControlImportContext ctx( 588 _pImport, getControlId( _xAttributes ), 589 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ); 590 591 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 592 if (xStyle.is()) 593 { 594 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 595 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 596 pStyle->importBackgroundColorStyle( xControlModel ); 597 pStyle->importTextColorStyle( xControlModel ); 598 pStyle->importTextLineColorStyle( xControlModel ); 599 pStyle->importBorderStyle( xControlModel ); 600 pStyle->importFontStyle( xControlModel ); 601 } 602 603 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 604 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 605 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 606 _xAttributes ); 607 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 608 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 609 _xAttributes ); 610 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), 611 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), 612 _xAttributes ); 613 ctx.importBooleanProperty( 614 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 615 _xAttributes ); 616 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), 617 OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ), 618 _xAttributes ); 619 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), 620 OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ), 621 _xAttributes ); 622 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), 623 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 624 _xAttributes ); 625 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), 626 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), 627 _xAttributes ); 628 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), 629 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), 630 _xAttributes ); 631 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), 632 OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ), 633 _xAttributes ); 634 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), 635 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 636 _xAttributes ); 637 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 638 _xAttributes )) 639 ctx.getControlModel()->setPropertyValue( 640 OUSTR("Repeat"), makeAny(true) ); 641 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ), 642 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), 643 _xAttributes ); 644 ctx.importEvents( _events ); 645 // avoid ring-reference: 646 // vector< event elements > holding event elements holding this (via _pParent) 647 _events.clear(); 648 } 649 650 //################################################################################################## 651 652 // datefield 653 //__________________________________________________________________________________________________ 654 Reference< xml::input::XElement > DateFieldElement::startChildElement( 655 sal_Int32 nUid, OUString const & rLocalName, 656 Reference< xml::input::XAttributes > const & xAttributes ) 657 throw (xml::sax::SAXException, RuntimeException) 658 { 659 // event 660 if (_pImport->isEventElement( nUid, rLocalName )) 661 { 662 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 663 } 664 else 665 { 666 throw xml::sax::SAXException( 667 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 668 Reference< XInterface >(), Any() ); 669 } 670 } 671 //__________________________________________________________________________________________________ 672 void DateFieldElement::endElement() 673 throw (xml::sax::SAXException, RuntimeException) 674 { 675 ControlImportContext ctx( 676 _pImport, getControlId( _xAttributes ), 677 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ); 678 679 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 680 if (xStyle.is()) 681 { 682 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 683 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 684 pStyle->importBackgroundColorStyle( xControlModel ); 685 pStyle->importTextColorStyle( xControlModel ); 686 pStyle->importTextLineColorStyle( xControlModel ); 687 pStyle->importBorderStyle( xControlModel ); 688 pStyle->importFontStyle( xControlModel ); 689 } 690 691 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 692 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 693 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 694 _xAttributes ); 695 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 696 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 697 _xAttributes ); 698 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), 699 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), 700 _xAttributes ); 701 ctx.importBooleanProperty( 702 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 703 _xAttributes ); 704 ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ), 705 OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ), 706 _xAttributes ); 707 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ), 708 OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ), 709 _xAttributes ); 710 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ), 711 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 712 _xAttributes ); 713 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ), 714 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), 715 _xAttributes ); 716 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ), 717 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), 718 _xAttributes ); 719 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), 720 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 721 _xAttributes ); 722 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 723 _xAttributes )) 724 ctx.getControlModel()->setPropertyValue( 725 OUSTR("Repeat"), makeAny(true) ); 726 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), 727 OUString( RTL_CONSTASCII_USTRINGPARAM("dropdown") ), 728 _xAttributes ); 729 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 730 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ), 731 _xAttributes ); 732 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ), 733 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), 734 _xAttributes ); 735 ctx.importEvents( _events ); 736 // avoid ring-reference: 737 // vector< event elements > holding event elements holding this (via _pParent) 738 _events.clear(); 739 } 740 741 //################################################################################################## 742 743 // currencyfield 744 //__________________________________________________________________________________________________ 745 Reference< xml::input::XElement > CurrencyFieldElement::startChildElement( 746 sal_Int32 nUid, OUString const & rLocalName, 747 Reference< xml::input::XAttributes > const & xAttributes ) 748 throw (xml::sax::SAXException, RuntimeException) 749 { 750 // event 751 if (_pImport->isEventElement( nUid, rLocalName )) 752 { 753 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 754 } 755 else 756 { 757 throw xml::sax::SAXException( 758 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 759 Reference< XInterface >(), Any() ); 760 } 761 } 762 //__________________________________________________________________________________________________ 763 void CurrencyFieldElement::endElement() 764 throw (xml::sax::SAXException, RuntimeException) 765 { 766 ControlImportContext ctx( 767 _pImport, getControlId( _xAttributes ), 768 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ); 769 770 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 771 if (xStyle.is()) 772 { 773 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 774 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 775 pStyle->importBackgroundColorStyle( xControlModel ); 776 pStyle->importTextColorStyle( xControlModel ); 777 pStyle->importTextLineColorStyle( xControlModel ); 778 pStyle->importBorderStyle( xControlModel ); 779 pStyle->importFontStyle( xControlModel ); 780 } 781 782 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 783 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 784 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 785 _xAttributes ); 786 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 787 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 788 _xAttributes ); 789 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ), 790 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ), 791 _xAttributes ); 792 ctx.importBooleanProperty( 793 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 794 _xAttributes ); 795 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ), 796 OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ), 797 _xAttributes ); 798 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ), 799 OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ), 800 _xAttributes ); 801 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ), 802 OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ), 803 _xAttributes ); 804 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ), 805 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 806 _xAttributes ); 807 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ), 808 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), 809 _xAttributes ); 810 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ), 811 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), 812 _xAttributes ); 813 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ), 814 OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ), 815 _xAttributes ); 816 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ), 817 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 818 _xAttributes ); 819 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 820 _xAttributes )) 821 ctx.getControlModel()->setPropertyValue( 822 OUSTR("Repeat"), makeAny(true) ); 823 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ), 824 OUString( RTL_CONSTASCII_USTRINGPARAM("prepend-symbol") ), 825 _xAttributes ); 826 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ), 827 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), 828 _xAttributes ); 829 ctx.importEvents( _events ); 830 // avoid ring-reference: 831 // vector< event elements > holding event elements holding this (via _pParent) 832 _events.clear(); 833 } 834 835 //################################################################################################## 836 837 // filecontrol 838 //__________________________________________________________________________________________________ 839 Reference< xml::input::XElement > FileControlElement::startChildElement( 840 sal_Int32 nUid, OUString const & rLocalName, 841 Reference< xml::input::XAttributes > const & xAttributes ) 842 throw (xml::sax::SAXException, RuntimeException) 843 { 844 // event 845 if (_pImport->isEventElement( nUid, rLocalName )) 846 { 847 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 848 } 849 else 850 { 851 throw xml::sax::SAXException( 852 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 853 Reference< XInterface >(), Any() ); 854 } 855 } 856 //__________________________________________________________________________________________________ 857 void FileControlElement::endElement() 858 throw (xml::sax::SAXException, RuntimeException) 859 { 860 ControlImportContext ctx( 861 _pImport, getControlId( _xAttributes ), 862 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ); 863 864 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 865 if (xStyle.is()) 866 { 867 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 868 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 869 pStyle->importBackgroundColorStyle( xControlModel ); 870 pStyle->importTextColorStyle( xControlModel ); 871 pStyle->importTextLineColorStyle( xControlModel ); 872 pStyle->importBorderStyle( xControlModel ); 873 pStyle->importFontStyle( xControlModel ); 874 } 875 876 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 877 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 878 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 879 _xAttributes ); 880 ctx.importBooleanProperty( 881 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 882 _xAttributes ); 883 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 884 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 885 _xAttributes ); 886 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 887 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 888 _xAttributes ); 889 ctx.importEvents( _events ); 890 // avoid ring-reference: 891 // vector< event elements > holding event elements holding this (via _pParent) 892 _events.clear(); 893 } 894 //################################################################################################## 895 896 // treecontrol 897 //__________________________________________________________________________________________________ 898 Reference< xml::input::XElement > TreeControlElement::startChildElement( 899 sal_Int32 nUid, OUString const & rLocalName, 900 Reference< xml::input::XAttributes > const & xAttributes ) 901 throw (xml::sax::SAXException, RuntimeException) 902 { 903 // event 904 if (_pImport->isEventElement( nUid, rLocalName )) 905 { 906 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 907 } 908 else 909 { 910 throw xml::sax::SAXException( 911 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 912 Reference< XInterface >(), Any() ); 913 } 914 } 915 //__________________________________________________________________________________________________ 916 void TreeControlElement::endElement() 917 throw (xml::sax::SAXException, RuntimeException) 918 { 919 ControlImportContext ctx( 920 _pImport, getControlId( _xAttributes ), 921 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ); 922 923 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 924 if (xStyle.is()) 925 { 926 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 927 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 928 pStyle->importBackgroundColorStyle( xControlModel ); 929 pStyle->importBorderStyle( xControlModel ); 930 } 931 932 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 933 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 934 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 935 _xAttributes ); 936 ctx.importSelectionTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ), 937 OUString( RTL_CONSTASCII_USTRINGPARAM("selectiontype") ), 938 _xAttributes ); 939 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ), 940 OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ), 941 _xAttributes ); 942 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ), 943 OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ), 944 _xAttributes ); 945 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ), 946 OUString( RTL_CONSTASCII_USTRINGPARAM("showsroothandles") ), 947 _xAttributes ); 948 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ), 949 OUString( RTL_CONSTASCII_USTRINGPARAM("editable") ), 950 _xAttributes ); 951 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ), 952 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 953 _xAttributes ); 954 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ), 955 OUString( RTL_CONSTASCII_USTRINGPARAM("invokesstopnodeediting") ), 956 _xAttributes ); 957 958 ctx.importEvents( _events ); 959 // avoid ring-reference: 960 // vector< event elements > holding event elements holding this (via _pParent) 961 _events.clear(); 962 } 963 964 //################################################################################################## 965 966 // imagecontrol 967 //__________________________________________________________________________________________________ 968 Reference< xml::input::XElement > ImageControlElement::startChildElement( 969 sal_Int32 nUid, OUString const & rLocalName, 970 Reference< xml::input::XAttributes > const & xAttributes ) 971 throw (xml::sax::SAXException, RuntimeException) 972 { 973 // event 974 if (_pImport->isEventElement( nUid, rLocalName )) 975 { 976 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 977 } 978 else 979 { 980 throw xml::sax::SAXException( 981 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 982 Reference< XInterface >(), Any() ); 983 } 984 } 985 //__________________________________________________________________________________________________ 986 void ImageControlElement::endElement() 987 throw (xml::sax::SAXException, RuntimeException) 988 { 989 ControlImportContext ctx( 990 _pImport, getControlId( _xAttributes ), 991 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ); 992 993 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 994 if (xStyle.is()) 995 { 996 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 997 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 998 pStyle->importBackgroundColorStyle( xControlModel ); 999 pStyle->importBorderStyle( xControlModel ); 1000 } 1001 1002 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1003 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ), 1004 OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ), 1005 _xAttributes ); 1006 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), 1007 OUString( RTL_CONSTASCII_USTRINGPARAM("src") ), 1008 _xAttributes ); 1009 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1010 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1011 _xAttributes ); 1012 ctx.importEvents( _events ); 1013 // avoid ring-reference: 1014 // vector< event elements > holding event elements holding this (via _pParent) 1015 _events.clear(); 1016 } 1017 1018 //################################################################################################## 1019 1020 // textfield 1021 //__________________________________________________________________________________________________ 1022 Reference< xml::input::XElement > TextElement::startChildElement( 1023 sal_Int32 nUid, OUString const & rLocalName, 1024 Reference< xml::input::XAttributes > const & xAttributes ) 1025 throw (xml::sax::SAXException, RuntimeException) 1026 { 1027 // event 1028 if (_pImport->isEventElement( nUid, rLocalName )) 1029 { 1030 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1031 } 1032 else 1033 { 1034 throw xml::sax::SAXException( 1035 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 1036 Reference< XInterface >(), Any() ); 1037 } 1038 } 1039 //__________________________________________________________________________________________________ 1040 void TextElement::endElement() 1041 throw (xml::sax::SAXException, RuntimeException) 1042 { 1043 ControlImportContext ctx( 1044 _pImport, getControlId( _xAttributes ), 1045 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ); 1046 1047 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1048 if (xStyle.is()) 1049 { 1050 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1051 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1052 pStyle->importBackgroundColorStyle( xControlModel ); 1053 pStyle->importTextColorStyle( xControlModel ); 1054 pStyle->importTextLineColorStyle( xControlModel ); 1055 pStyle->importBorderStyle( xControlModel ); 1056 pStyle->importFontStyle( xControlModel ); 1057 } 1058 1059 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1060 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1061 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1062 _xAttributes ); 1063 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1064 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1065 _xAttributes ); 1066 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), 1067 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), 1068 _xAttributes ); 1069 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1070 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1071 _xAttributes ); 1072 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1073 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1074 _xAttributes ); 1075 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ), 1076 OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ), 1077 _xAttributes ); 1078 ctx.importEvents( _events ); 1079 // avoid ring-reference: 1080 // vector< event elements > holding event elements holding this (via _pParent) 1081 _events.clear(); 1082 } 1083 1084 //################################################################################################## 1085 // FixedHyperLink 1086 //__________________________________________________________________________________________________ 1087 Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement( 1088 sal_Int32 nUid, OUString const & rLocalName, 1089 Reference< xml::input::XAttributes > const & xAttributes ) 1090 throw (xml::sax::SAXException, RuntimeException) 1091 { 1092 // event 1093 if (_pImport->isEventElement( nUid, rLocalName )) 1094 { 1095 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1096 } 1097 else 1098 { 1099 throw xml::sax::SAXException( 1100 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 1101 Reference< XInterface >(), Any() ); 1102 } 1103 } 1104 //__________________________________________________________________________________________________ 1105 void FixedHyperLinkElement::endElement() 1106 throw (xml::sax::SAXException, RuntimeException) 1107 { 1108 ControlImportContext ctx( 1109 _pImport, getControlId( _xAttributes ), 1110 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ); 1111 1112 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1113 if (xStyle.is()) 1114 { 1115 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1116 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1117 pStyle->importBackgroundColorStyle( xControlModel ); 1118 pStyle->importTextColorStyle( xControlModel ); 1119 pStyle->importTextLineColorStyle( xControlModel ); 1120 pStyle->importBorderStyle( xControlModel ); 1121 pStyle->importFontStyle( xControlModel ); 1122 } 1123 1124 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1125 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1126 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1127 _xAttributes ); 1128 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ), 1129 OUString( RTL_CONSTASCII_USTRINGPARAM("url") ), 1130 _xAttributes ); 1131 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ), 1132 OUString( RTL_CONSTASCII_USTRINGPARAM("description") ), 1133 _xAttributes ); 1134 1135 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1136 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1137 _xAttributes ); 1138 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), 1139 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), 1140 _xAttributes ); 1141 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1142 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1143 _xAttributes ); 1144 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1145 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1146 _xAttributes ); 1147 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ), 1148 OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ), 1149 _xAttributes ); 1150 ctx.importEvents( _events ); 1151 // avoid ring-reference: 1152 // vector< event elements > holding event elements holding this (via _pParent) 1153 _events.clear(); 1154 } 1155 1156 //################################################################################################## 1157 1158 // edit 1159 //__________________________________________________________________________________________________ 1160 Reference< xml::input::XElement > TextFieldElement::startChildElement( 1161 sal_Int32 nUid, OUString const & rLocalName, 1162 Reference< xml::input::XAttributes > const & xAttributes ) 1163 throw (xml::sax::SAXException, RuntimeException) 1164 { 1165 // event 1166 if (_pImport->isEventElement( nUid, rLocalName )) 1167 { 1168 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1169 } 1170 else 1171 { 1172 throw xml::sax::SAXException( 1173 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 1174 Reference< XInterface >(), Any() ); 1175 } 1176 } 1177 //__________________________________________________________________________________________________ 1178 void TextFieldElement::endElement() 1179 throw (xml::sax::SAXException, RuntimeException) 1180 { 1181 ControlImportContext ctx( 1182 _pImport, getControlId( _xAttributes ), 1183 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ); 1184 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1185 1186 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1187 if (xStyle.is()) 1188 { 1189 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1190 pStyle->importBackgroundColorStyle( xControlModel ); 1191 pStyle->importTextColorStyle( xControlModel ); 1192 pStyle->importTextLineColorStyle( xControlModel ); 1193 pStyle->importBorderStyle( xControlModel ); 1194 pStyle->importFontStyle( xControlModel ); 1195 } 1196 1197 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1198 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1199 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1200 _xAttributes ); 1201 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1202 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1203 _xAttributes ); 1204 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ), 1205 OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ), 1206 _xAttributes ); 1207 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ), 1208 OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ), 1209 _xAttributes ); 1210 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ), 1211 OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ), 1212 _xAttributes ); 1213 ctx.importBooleanProperty( 1214 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 1215 _xAttributes ); 1216 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), 1217 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ), 1218 _xAttributes ); 1219 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1220 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1221 _xAttributes ); 1222 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 1223 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 1224 _xAttributes ); 1225 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 1226 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1227 _xAttributes ); 1228 ctx.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ), 1229 OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ), 1230 _xAttributes ); 1231 OUString aValue; 1232 if (getStringAttr( &aValue, 1233 OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ), 1234 _xAttributes, 1235 _pImport->XMLNS_DIALOGS_UID ) && 1236 aValue.getLength() > 0) 1237 { 1238 OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" ); 1239 sal_Int16 nChar = (sal_Int16)aValue[ 0 ]; 1240 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ), 1241 makeAny( nChar ) ); 1242 } 1243 1244 ctx.importEvents( _events ); 1245 // avoid ring-reference: 1246 // vector< event elements > holding event elements holding this (via _pParent) 1247 _events.clear(); 1248 } 1249 1250 //################################################################################################## 1251 1252 // titledbox 1253 //__________________________________________________________________________________________________ 1254 Reference< xml::input::XElement > TitledBoxElement::startChildElement( 1255 sal_Int32 nUid, OUString const & rLocalName, 1256 Reference< xml::input::XAttributes > const & xAttributes ) 1257 throw (xml::sax::SAXException, RuntimeException) 1258 { 1259 // event 1260 if (_pImport->isEventElement( nUid, rLocalName )) 1261 { 1262 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1263 } 1264 else if (_pImport->XMLNS_DIALOGS_UID != nUid) 1265 { 1266 throw xml::sax::SAXException( 1267 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1268 Reference< XInterface >(), Any() ); 1269 } 1270 // title 1271 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") )) 1272 { 1273 getStringAttr( &_label, 1274 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1275 xAttributes, 1276 _pImport->XMLNS_DIALOGS_UID ); 1277 1278 return new ElementBase( 1279 _pImport->XMLNS_DIALOGS_UID, 1280 rLocalName, xAttributes, this, _pImport ); 1281 } 1282 // radio 1283 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") )) 1284 { 1285 // dont create radios here, => titledbox must be inserted first due to radio grouping, 1286 // possible predecessors! 1287 Reference< xml::input::XElement > xRet( 1288 new RadioElement( rLocalName, xAttributes, this, _pImport ) ); 1289 _radios.push_back( xRet ); 1290 return xRet; 1291 } 1292 // event 1293 else if (_pImport->isEventElement( nUid, rLocalName )) 1294 { 1295 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1296 } 1297 else 1298 { 1299 return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes ); 1300 } 1301 } 1302 //__________________________________________________________________________________________________ 1303 void TitledBoxElement::endElement() 1304 throw (xml::sax::SAXException, RuntimeException) 1305 { 1306 { 1307 ControlImportContext ctx( 1308 _pImport, getControlId( _xAttributes ), 1309 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ); 1310 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1311 1312 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1313 if (xStyle.is()) 1314 { 1315 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1316 pStyle->importTextColorStyle( xControlModel ); 1317 pStyle->importTextLineColorStyle( xControlModel ); 1318 pStyle->importFontStyle( xControlModel ); 1319 } 1320 1321 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement 1322 1323 if (_label.getLength()) 1324 { 1325 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1326 makeAny( _label ) ); 1327 } 1328 1329 ctx.importEvents( _events ); 1330 // avoid ring-reference: 1331 // vector< event elements > holding event elements holding this (via _pParent) 1332 _events.clear(); 1333 } 1334 1335 // create radios AFTER group box! 1336 for ( size_t nPos = 0; nPos < _radios.size(); ++nPos ) 1337 { 1338 Reference< xml::input::XElement > xRadio( _radios[ nPos ] ); 1339 Reference< xml::input::XAttributes > xAttributes( 1340 xRadio->getAttributes() ); 1341 1342 ControlImportContext ctx( 1343 _pImport, getControlId( xAttributes ), 1344 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ); 1345 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1346 1347 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); 1348 if (xStyle.is()) 1349 { 1350 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1351 pStyle->importBackgroundColorStyle( xControlModel ); 1352 pStyle->importTextColorStyle( xControlModel ); 1353 pStyle->importTextLineColorStyle( xControlModel ); 1354 pStyle->importFontStyle( xControlModel ); 1355 pStyle->importVisualEffectStyle( xControlModel ); 1356 } 1357 1358 ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes ); 1359 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1360 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1361 xAttributes ); 1362 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1363 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1364 xAttributes ); 1365 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1366 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1367 xAttributes ); 1368 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), 1369 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), 1370 xAttributes ); 1371 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), 1372 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), 1373 xAttributes ); 1374 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), 1375 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), 1376 xAttributes ); 1377 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1378 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1379 xAttributes ); 1380 1381 sal_Int16 nVal = 0; 1382 sal_Bool bChecked = sal_False; 1383 if (getBoolAttr( &bChecked, 1384 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), 1385 xAttributes, 1386 _pImport->XMLNS_DIALOGS_UID ) && 1387 bChecked) 1388 { 1389 nVal = 1; 1390 } 1391 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), 1392 makeAny( nVal ) ); 1393 1394 ::std::vector< Reference< xml::input::XElement > > * radioEvents = 1395 static_cast< RadioElement * >( xRadio.get() )->getEvents(); 1396 ctx.importEvents( *radioEvents ); 1397 // avoid ring-reference: 1398 // vector< event elements > holding event elements holding this (via _pParent) 1399 radioEvents->clear(); 1400 } 1401 // avoid ring-reference: 1402 // vector< radio elements > holding radio elements holding this (via _pParent) 1403 _radios.clear(); 1404 } 1405 1406 //################################################################################################## 1407 1408 // radio 1409 //__________________________________________________________________________________________________ 1410 Reference< xml::input::XElement > RadioElement::startChildElement( 1411 sal_Int32 nUid, OUString const & rLocalName, 1412 Reference< xml::input::XAttributes > const & xAttributes ) 1413 throw (xml::sax::SAXException, RuntimeException) 1414 { 1415 // event 1416 if (_pImport->isEventElement( nUid, rLocalName )) 1417 { 1418 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1419 } 1420 else 1421 { 1422 throw xml::sax::SAXException( 1423 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 1424 Reference< XInterface >(), Any() ); 1425 } 1426 } 1427 1428 //################################################################################################## 1429 1430 // radiogroup 1431 //__________________________________________________________________________________________________ 1432 Reference< xml::input::XElement > RadioGroupElement::startChildElement( 1433 sal_Int32 nUid, OUString const & rLocalName, 1434 Reference< xml::input::XAttributes > const & xAttributes ) 1435 throw (xml::sax::SAXException, RuntimeException) 1436 { 1437 if (_pImport->XMLNS_DIALOGS_UID != nUid) 1438 { 1439 throw xml::sax::SAXException( 1440 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1441 Reference< XInterface >(), Any() ); 1442 } 1443 // radio 1444 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") )) 1445 { 1446 // dont create radios here, => titledbox must be inserted first due to radio grouping, 1447 // possible predecessors! 1448 Reference< xml::input::XElement > xRet( 1449 new RadioElement( rLocalName, xAttributes, this, _pImport ) ); 1450 _radios.push_back( xRet ); 1451 return xRet; 1452 } 1453 else 1454 { 1455 throw xml::sax::SAXException( 1456 OUString( RTL_CONSTASCII_USTRINGPARAM("expected radio element!") ), 1457 Reference< XInterface >(), Any() ); 1458 } 1459 } 1460 //__________________________________________________________________________________________________ 1461 void RadioGroupElement::endElement() 1462 throw (xml::sax::SAXException, RuntimeException) 1463 { 1464 for ( size_t nPos = 0; nPos < _radios.size(); ++nPos ) 1465 { 1466 Reference< xml::input::XElement > xRadio( _radios[ nPos ] ); 1467 Reference< xml::input::XAttributes > xAttributes( 1468 xRadio->getAttributes() ); 1469 1470 ControlImportContext ctx( 1471 _pImport, getControlId( xAttributes ), 1472 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ); 1473 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1474 1475 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); 1476 if (xStyle.is()) 1477 { 1478 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1479 pStyle->importBackgroundColorStyle( xControlModel ); 1480 pStyle->importTextColorStyle( xControlModel ); 1481 pStyle->importTextLineColorStyle( xControlModel ); 1482 pStyle->importFontStyle( xControlModel ); 1483 pStyle->importVisualEffectStyle( xControlModel ); 1484 } 1485 1486 ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes ); 1487 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1488 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1489 xAttributes ); 1490 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1491 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1492 xAttributes ); 1493 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1494 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1495 xAttributes ); 1496 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), 1497 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), 1498 xAttributes ); 1499 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), 1500 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), 1501 xAttributes ); 1502 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), 1503 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), 1504 xAttributes ); 1505 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1506 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1507 xAttributes ); 1508 sal_Int16 nVal = 0; 1509 sal_Bool bChecked = sal_False; 1510 if (getBoolAttr( &bChecked, 1511 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), 1512 xAttributes, 1513 _pImport->XMLNS_DIALOGS_UID ) && 1514 bChecked) 1515 { 1516 nVal = 1; 1517 } 1518 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), 1519 makeAny( nVal ) ); 1520 1521 ::std::vector< Reference< xml::input::XElement > > * radioEvents = 1522 static_cast< RadioElement * >( xRadio.get() )->getEvents(); 1523 ctx.importEvents( *radioEvents ); 1524 // avoid ring-reference: 1525 // vector< event elements > holding event elements holding this (via _pParent) 1526 radioEvents->clear(); 1527 } 1528 // avoid ring-reference: 1529 // vector< radio elements > holding radio elements holding this (via _pParent) 1530 _radios.clear(); 1531 } 1532 1533 //################################################################################################## 1534 1535 // menupopup 1536 //__________________________________________________________________________________________________ 1537 Reference< xml::input::XElement > MenuPopupElement::startChildElement( 1538 sal_Int32 nUid, OUString const & rLocalName, 1539 Reference< xml::input::XAttributes > const & xAttributes ) 1540 throw (xml::sax::SAXException, RuntimeException) 1541 { 1542 if (_pImport->XMLNS_DIALOGS_UID != nUid) 1543 { 1544 throw xml::sax::SAXException( 1545 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1546 Reference< XInterface >(), Any() ); 1547 } 1548 // menuitem 1549 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") )) 1550 { 1551 OUString aValue( 1552 xAttributes->getValueByUidName( 1553 _pImport->XMLNS_DIALOGS_UID, 1554 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ) ) ); 1555 OSL_ENSURE( aValue.getLength(), "### menuitem has no value?" ); 1556 if (aValue.getLength()) 1557 { 1558 _itemValues.push_back( aValue ); 1559 1560 OUString aSel( 1561 xAttributes->getValueByUidName( 1562 _pImport->XMLNS_DIALOGS_UID, 1563 OUString( RTL_CONSTASCII_USTRINGPARAM("selected") ) ) ); 1564 if (aSel.getLength() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") )) 1565 { 1566 _itemSelected.push_back( 1567 static_cast<sal_Int16>(_itemValues.size()) -1 ); 1568 } 1569 } 1570 return new ElementBase( 1571 _pImport->XMLNS_DIALOGS_UID, 1572 rLocalName, xAttributes, this, _pImport ); 1573 } 1574 else 1575 { 1576 throw xml::sax::SAXException( 1577 OUString( RTL_CONSTASCII_USTRINGPARAM("expected menuitem!") ), 1578 Reference< XInterface >(), Any() ); 1579 } 1580 } 1581 //__________________________________________________________________________________________________ 1582 Sequence< OUString > MenuPopupElement::getItemValues() 1583 { 1584 Sequence< OUString > aRet( _itemValues.size() ); 1585 OUString * pRet = aRet.getArray(); 1586 for ( size_t nPos = _itemValues.size(); nPos--; ) 1587 { 1588 pRet[ nPos ] = _itemValues[ nPos ]; 1589 } 1590 return aRet; 1591 } 1592 //__________________________________________________________________________________________________ 1593 Sequence< sal_Int16 > MenuPopupElement::getSelectedItems() 1594 { 1595 Sequence< sal_Int16 > aRet( _itemSelected.size() ); 1596 sal_Int16 * pRet = aRet.getArray(); 1597 for ( size_t nPos = _itemSelected.size(); nPos--; ) 1598 { 1599 pRet[ nPos ] = _itemSelected[ nPos ]; 1600 } 1601 return aRet; 1602 } 1603 1604 //################################################################################################## 1605 1606 // menulist 1607 //__________________________________________________________________________________________________ 1608 Reference< xml::input::XElement > MenuListElement::startChildElement( 1609 sal_Int32 nUid, OUString const & rLocalName, 1610 Reference< xml::input::XAttributes > const & xAttributes ) 1611 throw (xml::sax::SAXException, RuntimeException) 1612 { 1613 // event 1614 if (_pImport->isEventElement( nUid, rLocalName )) 1615 { 1616 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1617 } 1618 else if (_pImport->XMLNS_DIALOGS_UID != nUid) 1619 { 1620 throw xml::sax::SAXException( 1621 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1622 Reference< XInterface >(), Any() ); 1623 } 1624 // menupopup 1625 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") )) 1626 { 1627 _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport ); 1628 return _popup; 1629 } 1630 else 1631 { 1632 throw xml::sax::SAXException( 1633 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ), 1634 Reference< XInterface >(), Any() ); 1635 } 1636 } 1637 //__________________________________________________________________________________________________ 1638 void MenuListElement::endElement() 1639 throw (xml::sax::SAXException, RuntimeException) 1640 { 1641 ControlImportContext ctx( 1642 _pImport, getControlId( _xAttributes ), 1643 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ); 1644 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1645 1646 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1647 if (xStyle.is()) 1648 { 1649 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1650 pStyle->importBackgroundColorStyle( xControlModel ); 1651 pStyle->importTextColorStyle( xControlModel ); 1652 pStyle->importTextLineColorStyle( xControlModel ); 1653 pStyle->importBorderStyle( xControlModel ); 1654 pStyle->importFontStyle( xControlModel ); 1655 } 1656 1657 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1658 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1659 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1660 _xAttributes ); 1661 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ), 1662 OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ), 1663 _xAttributes ); 1664 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 1665 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 1666 _xAttributes ); 1667 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), 1668 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 1669 _xAttributes ); 1670 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), 1671 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ), 1672 _xAttributes ); 1673 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1674 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1675 _xAttributes ); 1676 1677 if (_popup.is()) 1678 { 1679 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); 1680 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), 1681 makeAny( p->getItemValues() ) ); 1682 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), 1683 makeAny( p->getSelectedItems() ) ); 1684 } 1685 ctx.importEvents( _events ); 1686 // avoid ring-reference: 1687 // vector< event elements > holding event elements holding this (via _pParent) 1688 _events.clear(); 1689 } 1690 1691 //################################################################################################## 1692 1693 // combobox 1694 //__________________________________________________________________________________________________ 1695 Reference< xml::input::XElement > ComboBoxElement::startChildElement( 1696 sal_Int32 nUid, OUString const & rLocalName, 1697 Reference< xml::input::XAttributes > const & xAttributes ) 1698 throw (xml::sax::SAXException, RuntimeException) 1699 { 1700 // event 1701 if (_pImport->isEventElement( nUid, rLocalName )) 1702 { 1703 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1704 } 1705 else if (_pImport->XMLNS_DIALOGS_UID != nUid) 1706 { 1707 throw xml::sax::SAXException( 1708 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1709 Reference< XInterface >(), Any() ); 1710 } 1711 // menupopup 1712 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") )) 1713 { 1714 _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport ); 1715 return _popup; 1716 } 1717 else 1718 { 1719 throw xml::sax::SAXException( 1720 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ), 1721 Reference< XInterface >(), Any() ); 1722 } 1723 } 1724 //__________________________________________________________________________________________________ 1725 void ComboBoxElement::endElement() 1726 throw (xml::sax::SAXException, RuntimeException) 1727 { 1728 ControlImportContext ctx( 1729 _pImport, getControlId( _xAttributes ), 1730 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ); 1731 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1732 1733 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1734 if (xStyle.is()) 1735 { 1736 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1737 pStyle->importBackgroundColorStyle( xControlModel ); 1738 pStyle->importTextColorStyle( xControlModel ); 1739 pStyle->importTextLineColorStyle( xControlModel ); 1740 pStyle->importBorderStyle( xControlModel ); 1741 pStyle->importFontStyle( xControlModel ); 1742 } 1743 1744 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1745 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1746 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1747 _xAttributes ); 1748 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), 1749 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), 1750 _xAttributes ); 1751 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ), 1752 OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ), 1753 _xAttributes ); 1754 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), 1755 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), 1756 _xAttributes ); 1757 ctx.importBooleanProperty( 1758 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"), 1759 _xAttributes ); 1760 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), 1761 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ), 1762 _xAttributes ); 1763 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), 1764 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ), 1765 _xAttributes ); 1766 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), 1767 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1768 _xAttributes ); 1769 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1770 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1771 _xAttributes ); 1772 1773 if (_popup.is()) 1774 { 1775 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); 1776 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), 1777 makeAny( p->getItemValues() ) ); 1778 } 1779 1780 ctx.importEvents( _events ); 1781 // avoid ring-reference: 1782 // vector< event elements > holding event elements holding this (via _pParent) 1783 _events.clear(); 1784 } 1785 1786 //################################################################################################## 1787 1788 // checkbox 1789 //__________________________________________________________________________________________________ 1790 Reference< xml::input::XElement > CheckBoxElement::startChildElement( 1791 sal_Int32 nUid, OUString const & rLocalName, 1792 Reference< xml::input::XAttributes > const & xAttributes ) 1793 throw (xml::sax::SAXException, RuntimeException) 1794 { 1795 // event 1796 if (_pImport->isEventElement( nUid, rLocalName )) 1797 { 1798 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1799 } 1800 else 1801 { 1802 throw xml::sax::SAXException( 1803 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 1804 Reference< XInterface >(), Any() ); 1805 } 1806 } 1807 //__________________________________________________________________________________________________ 1808 void CheckBoxElement::endElement() 1809 throw (xml::sax::SAXException, RuntimeException) 1810 { 1811 ControlImportContext ctx( 1812 _pImport, getControlId( _xAttributes ), 1813 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ); 1814 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1815 1816 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1817 if (xStyle.is()) 1818 { 1819 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1820 pStyle->importBackgroundColorStyle( xControlModel ); 1821 pStyle->importTextColorStyle( xControlModel ); 1822 pStyle->importTextLineColorStyle( xControlModel ); 1823 pStyle->importFontStyle( xControlModel ); 1824 pStyle->importVisualEffectStyle( xControlModel ); 1825 } 1826 1827 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1828 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1829 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1830 _xAttributes ); 1831 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1832 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1833 _xAttributes ); 1834 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1835 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1836 _xAttributes ); 1837 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), 1838 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), 1839 _xAttributes ); 1840 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), 1841 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), 1842 _xAttributes ); 1843 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), 1844 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), 1845 _xAttributes ); 1846 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1847 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1848 _xAttributes ); 1849 1850 1851 sal_Bool bTriState = sal_False; 1852 if (getBoolAttr( &bTriState, 1853 OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ), 1854 _xAttributes, 1855 _pImport->XMLNS_DIALOGS_UID )) 1856 { 1857 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ), 1858 makeAny( bTriState ) ); 1859 } 1860 sal_Bool bChecked = sal_False; 1861 if (getBoolAttr( &bChecked, 1862 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), 1863 _xAttributes, 1864 _pImport->XMLNS_DIALOGS_UID )) 1865 { 1866 // has "checked" attribute 1867 sal_Int16 nVal = (bChecked ? 1 : 0); 1868 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), 1869 makeAny( nVal ) ); 1870 } 1871 else 1872 { 1873 sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know! 1874 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), 1875 makeAny( nVal ) ); 1876 } 1877 1878 ctx.importEvents( _events ); 1879 // avoid ring-reference: 1880 // vector< event elements > holding event elements holding this (via _pParent) 1881 _events.clear(); 1882 } 1883 1884 //################################################################################################## 1885 1886 // button 1887 //__________________________________________________________________________________________________ 1888 Reference< xml::input::XElement > ButtonElement::startChildElement( 1889 sal_Int32 nUid, OUString const & rLocalName, 1890 Reference< xml::input::XAttributes > const & xAttributes ) 1891 throw (xml::sax::SAXException, RuntimeException) 1892 { 1893 // event 1894 if (_pImport->isEventElement( nUid, rLocalName )) 1895 { 1896 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 1897 } 1898 else 1899 { 1900 throw xml::sax::SAXException( 1901 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), 1902 Reference< XInterface >(), Any() ); 1903 } 1904 } 1905 //__________________________________________________________________________________________________ 1906 void ButtonElement::endElement() 1907 throw (xml::sax::SAXException, RuntimeException) 1908 { 1909 ControlImportContext ctx( 1910 _pImport, getControlId( _xAttributes ), 1911 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ); 1912 1913 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 1914 if (xStyle.is()) 1915 { 1916 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 1917 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); 1918 pStyle->importBackgroundColorStyle( xControlModel ); 1919 pStyle->importTextColorStyle( xControlModel ); 1920 pStyle->importTextLineColorStyle( xControlModel ); 1921 pStyle->importFontStyle( xControlModel ); 1922 } 1923 1924 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); 1925 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), 1926 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), 1927 _xAttributes ); 1928 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), 1929 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), 1930 _xAttributes ); 1931 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), 1932 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), 1933 _xAttributes ); 1934 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), 1935 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), 1936 _xAttributes ); 1937 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ), 1938 OUString( RTL_CONSTASCII_USTRINGPARAM("default") ), 1939 _xAttributes ); 1940 ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), 1941 OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ), 1942 _xAttributes ); 1943 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), 1944 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), 1945 _xAttributes ); 1946 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), 1947 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), 1948 _xAttributes ); 1949 ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ), 1950 OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ), 1951 _xAttributes ); 1952 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"), 1953 _xAttributes )) 1954 ctx.getControlModel()->setPropertyValue( 1955 OUSTR("Repeat"), makeAny(true) ); 1956 sal_Int32 toggled = 0; 1957 if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes, 1958 _pImport->XMLNS_DIALOGS_UID ) && toggled == 1) 1959 ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true)); 1960 ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"), 1961 _xAttributes ); 1962 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), 1963 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), 1964 _xAttributes ); 1965 // State 1966 sal_Bool bChecked = sal_False; 1967 if (getBoolAttr( 1968 &bChecked, 1969 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), 1970 _xAttributes, 1971 _pImport->XMLNS_DIALOGS_UID ) && 1972 bChecked) 1973 { 1974 sal_Int16 nVal = 1; 1975 ctx.getControlModel()->setPropertyValue( 1976 OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); 1977 } 1978 1979 ctx.importEvents( _events ); 1980 // avoid ring-reference: 1981 // vector< event elements > holding event elements holding this (via _pParent) 1982 _events.clear(); 1983 } 1984 1985 //################################################################################################## 1986 1987 // bulletinboard 1988 //__________________________________________________________________________________________________ 1989 Reference< xml::input::XElement > BulletinBoardElement::startChildElement( 1990 sal_Int32 nUid, OUString const & rLocalName, 1991 Reference< xml::input::XAttributes > const & xAttributes ) 1992 throw (xml::sax::SAXException, RuntimeException) 1993 { 1994 if (_pImport->XMLNS_DIALOGS_UID != nUid) 1995 { 1996 throw xml::sax::SAXException( 1997 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 1998 Reference< XInterface >(), Any() ); 1999 } 2000 // button 2001 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") )) 2002 { 2003 return new ButtonElement( rLocalName, xAttributes, this, _pImport ); 2004 } 2005 // checkbox 2006 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") )) 2007 { 2008 return new CheckBoxElement( rLocalName, xAttributes, this, _pImport ); 2009 } 2010 // combobox 2011 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") )) 2012 { 2013 return new ComboBoxElement( rLocalName, xAttributes, this, _pImport ); 2014 } 2015 // listbox 2016 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") )) 2017 { 2018 return new MenuListElement( rLocalName, xAttributes, this, _pImport ); 2019 } 2020 // radiogroup 2021 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") )) 2022 { 2023 return new RadioGroupElement( rLocalName, xAttributes, this, _pImport ); 2024 } 2025 // titledbox 2026 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") )) 2027 { 2028 return new TitledBoxElement( rLocalName, xAttributes, this, _pImport ); 2029 } 2030 // text 2031 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("text") )) 2032 { 2033 return new TextElement( rLocalName, xAttributes, this, _pImport ); 2034 } 2035 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("linklabel") )) 2036 { 2037 return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport ); 2038 } 2039 // textfield 2040 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") )) 2041 { 2042 return new TextFieldElement( rLocalName, xAttributes, this, _pImport ); 2043 } 2044 // img 2045 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") )) 2046 { 2047 return new ImageControlElement( rLocalName, xAttributes, this, _pImport ); 2048 } 2049 // filecontrol 2050 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") )) 2051 { 2052 return new FileControlElement( rLocalName, xAttributes, this, _pImport ); 2053 } 2054 // treecontrol 2055 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") )) 2056 { 2057 return new TreeControlElement( rLocalName, xAttributes, this, _pImport ); 2058 } 2059 // currencyfield 2060 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") )) 2061 { 2062 return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport ); 2063 } 2064 // datefield 2065 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") )) 2066 { 2067 return new DateFieldElement( rLocalName, xAttributes, this, _pImport ); 2068 } 2069 // datefield 2070 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") )) 2071 { 2072 return new NumericFieldElement( rLocalName, xAttributes, this, _pImport ); 2073 } 2074 // timefield 2075 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") )) 2076 { 2077 return new TimeFieldElement( rLocalName, xAttributes, this, _pImport ); 2078 } 2079 // patternfield 2080 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") )) 2081 { 2082 return new PatternFieldElement( rLocalName, xAttributes, this, _pImport ); 2083 } 2084 // formattedfield 2085 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") )) 2086 { 2087 return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport ); 2088 } 2089 // fixedline 2090 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") )) 2091 { 2092 return new FixedLineElement( rLocalName, xAttributes, this, _pImport ); 2093 } 2094 // scrollbar 2095 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") )) 2096 { 2097 return new ScrollBarElement( rLocalName, xAttributes, this, _pImport ); 2098 } 2099 // progressmeter 2100 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") )) 2101 { 2102 return new ProgressBarElement( rLocalName, xAttributes, this, _pImport ); 2103 } 2104 // bulletinboard 2105 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) 2106 { 2107 return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport ); 2108 } 2109 else 2110 { 2111 throw xml::sax::SAXException( 2112 OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles, bulletinboard or bulletinboard element, not: ") ) + rLocalName, 2113 Reference< XInterface >(), Any() ); 2114 } 2115 } 2116 //__________________________________________________________________________________________________ 2117 BulletinBoardElement::BulletinBoardElement( 2118 OUString const & rLocalName, 2119 Reference< xml::input::XAttributes > const & xAttributes, 2120 ElementBase * pParent, DialogImport * pImport ) 2121 SAL_THROW( () ) 2122 : ControlElement( rLocalName, xAttributes, pParent, pImport ) 2123 { 2124 OUString aValue( 2125 _xAttributes->getValueByUidName( 2126 _pImport->XMLNS_DIALOGS_UID, 2127 OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) ) ); 2128 if (aValue.getLength()) 2129 { 2130 _nBasePosX += toInt32( aValue ); 2131 } 2132 aValue = _xAttributes->getValueByUidName( 2133 _pImport->XMLNS_DIALOGS_UID, 2134 OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) ); 2135 if (aValue.getLength()) 2136 { 2137 _nBasePosY += toInt32( aValue ); 2138 } 2139 } 2140 2141 //################################################################################################## 2142 2143 // style 2144 //__________________________________________________________________________________________________ 2145 Reference< xml::input::XElement > StyleElement::startChildElement( 2146 sal_Int32 /*nUid*/, OUString const & /*rLocalName*/, 2147 Reference< xml::input::XAttributes > const & /*xAttributes*/ ) 2148 throw (xml::sax::SAXException, RuntimeException) 2149 { 2150 throw xml::sax::SAXException( 2151 OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected sub elements of style!") ), 2152 Reference< XInterface >(), Any() ); 2153 } 2154 //__________________________________________________________________________________________________ 2155 void StyleElement::endElement() 2156 throw (xml::sax::SAXException, RuntimeException) 2157 { 2158 Reference< xml::input::XAttributes > xStyle; 2159 OUString aStyleId( 2160 _xAttributes->getValueByUidName( 2161 _pImport->XMLNS_DIALOGS_UID, 2162 OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) ); 2163 if (aStyleId.getLength()) 2164 { 2165 _pImport->addStyle( aStyleId, this ); 2166 } 2167 else 2168 { 2169 throw xml::sax::SAXException( 2170 OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ), 2171 Reference< XInterface >(), Any() ); 2172 } 2173 } 2174 2175 //################################################################################################## 2176 2177 // styles 2178 //__________________________________________________________________________________________________ 2179 Reference< xml::input::XElement > StylesElement::startChildElement( 2180 sal_Int32 nUid, OUString const & rLocalName, 2181 Reference< xml::input::XAttributes > const & xAttributes ) 2182 throw (xml::sax::SAXException, RuntimeException) 2183 { 2184 if (_pImport->XMLNS_DIALOGS_UID != nUid) 2185 { 2186 throw xml::sax::SAXException( 2187 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 2188 Reference< XInterface >(), Any() ); 2189 } 2190 // style 2191 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") )) 2192 { 2193 return new StyleElement( rLocalName, xAttributes, this, _pImport ); 2194 } 2195 else 2196 { 2197 throw xml::sax::SAXException( 2198 OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ), 2199 Reference< XInterface >(), Any() ); 2200 } 2201 } 2202 2203 //################################################################################################## 2204 2205 // window 2206 //__________________________________________________________________________________________________ 2207 Reference< xml::input::XElement > WindowElement::startChildElement( 2208 sal_Int32 nUid, OUString const & rLocalName, 2209 Reference< xml::input::XAttributes > const & xAttributes ) 2210 throw (xml::sax::SAXException, RuntimeException) 2211 { 2212 // event 2213 if (_pImport->isEventElement( nUid, rLocalName )) 2214 { 2215 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); 2216 } 2217 else if (_pImport->XMLNS_DIALOGS_UID != nUid) 2218 { 2219 throw xml::sax::SAXException( 2220 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), 2221 Reference< XInterface >(), Any() ); 2222 } 2223 // styles 2224 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") )) 2225 { 2226 return new StylesElement( rLocalName, xAttributes, this, _pImport ); 2227 } 2228 // bulletinboard 2229 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) 2230 { 2231 return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport ); 2232 } 2233 else 2234 { 2235 throw xml::sax::SAXException( 2236 OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ), 2237 Reference< XInterface >(), Any() ); 2238 } 2239 } 2240 //__________________________________________________________________________________________________ 2241 void WindowElement::endElement() 2242 throw (xml::sax::SAXException, RuntimeException) 2243 { 2244 Reference< beans::XPropertySet > xProps( 2245 _pImport->_xDialogModel, UNO_QUERY_THROW ); 2246 ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) ); 2247 2248 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); 2249 if (xStyle.is()) 2250 { 2251 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); 2252 pStyle->importBackgroundColorStyle( xProps ); 2253 pStyle->importTextColorStyle( xProps ); 2254 pStyle->importTextLineColorStyle( xProps ); 2255 pStyle->importFontStyle( xProps ); 2256 } 2257 2258 ctx.importDefaults( 0, 0, _xAttributes, false ); 2259 ctx.importBooleanProperty( 2260 OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ), 2261 OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ), 2262 _xAttributes ); 2263 ctx.importBooleanProperty( 2264 OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ), 2265 OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ), 2266 _xAttributes ); 2267 ctx.importBooleanProperty( 2268 OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ), 2269 OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ), 2270 _xAttributes ); 2271 ctx.importStringProperty( 2272 OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), 2273 OUString( RTL_CONSTASCII_USTRINGPARAM("title") ), 2274 _xAttributes ); 2275 ctx.importBooleanProperty( 2276 OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ), 2277 OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ), 2278 _xAttributes ); 2279 ctx.importStringProperty( 2280 OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), 2281 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), 2282 _xAttributes ); 2283 ctx.importEvents( _events ); 2284 // avoid ring-reference: 2285 // vector< event elements > holding event elements holding this (via _pParent) 2286 _events.clear(); 2287 } 2288 2289 } 2290