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