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