diff options
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/dtd/dialog.dtd | 31 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 7 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 10 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 71 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 47 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 142 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 75 | ||||
-rw-r--r-- | xmlscript/test/test.xml | 7 |
8 files changed, 359 insertions, 31 deletions
diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd index b2946572b4cd..5ca873c33286 100644 --- a/xmlscript/dtd/dialog.dtd +++ b/xmlscript/dtd/dialog.dtd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - $Id: dialog.dtd,v 1.11 2001-04-04 14:35:07 dbo Exp $ + $Id: dialog.dtd,v 1.12 2001-05-04 13:17:39 dbo Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -87,7 +87,10 @@ dlg:datefield| dlg:numericfield| dlg:currencyfield| - dlg:patternfield + dlg:patternfield| + dlg:fixedline| + dlg:progressmeter| + dlg:scrollbar )"> <!ELEMENT dlg:window (dlg:styles*, dlg:event*, dlg:bulletinboard*)> @@ -109,6 +112,7 @@ <!ATTLIST dlg:style dlg:style-id CDATA #REQUIRED dlg:background-color %numeric; #IMPLIED dlg:text-color %numeric; #IMPLIED + dlg:fill-color %numeric; #IMPLIED dlg:border (none|3d|simple) #IMPLIED dlg:font-name CDATA #IMPLIED dlg:font-height %numeric; #IMPLIED @@ -290,3 +294,26 @@ dlg:edit-mask CDATA #IMPLIED dlg:literal-mask CDATA #IMPLIED > + +<!ELEMENT dlg:fixedline (dlg:event*)> +<!ATTLIST dlg:fixedline %default-attributes; + dlg:align (horizontal|vertical) #IMPLIED + dlg:value CDATA #IMPLIED + > + +<!ELEMENT dlg:scrollbar (dlg:event*)> +<!ATTLIST dlg:scrollbar %default-attributes; + dlg:align (horizontal|vertical) #IMPLIED + dlg:curpos %numeric #IMPLIED + dlg:maxpos %numeric #IMPLIED + dlg:increment %numeric #IMPLIED + dlg:pageincrement %numeric #IMPLIED + dlg:visible-size %numeric #IMPLIED + > + +<!ELEMENT dlg:progressmeter (dlg:event*)> +<!ATTLIST dlg:progressmeter %default-attributes; + dlg:value %numeric #IMPLIED + dlg:value-min %numeric #IMPLIED + dlg:value-max %numeric #IMPLIED + > diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index 49a7c5ae68c8..c813fca70558 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -2,9 +2,9 @@ * * $RCSfile: exp_share.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: dbo $ $Date: 2001-05-04 09:14:56 $ + * last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,8 @@ struct Style sal_uInt32 _textColor; sal_Int16 _border; awt::FontDescriptor _descr; + sal_uInt32 _fillColor; + short _all; short _set; @@ -145,6 +147,7 @@ public: void readAlignAttr( OUString const & rPropName, OUString const & rAttrName ); void readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName ); void readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName ); + void readOrientationAttr( OUString const & rPropName, OUString const & rAttrName ); // inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ) SAL_THROW( () ); diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index 5e4efea9be93..62f06bc9f629 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -2,9 +2,9 @@ * * $RCSfile: imp_share.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: dbo $ $Date: 2001-05-04 09:14:56 $ + * last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -261,6 +261,7 @@ class StyleElement sal_Int32 _textColor; sal_Int16 _border; awt::FontDescriptor _descr; + sal_Int32 _fillColor; short _inited, _hasValue; @@ -274,6 +275,8 @@ public: bool importTextColorStyle( Reference< beans::XPropertySet > const & xProps ); + bool importFillColorStyle( + Reference< beans::XPropertySet > const & xProps ); bool importBackgroundColorStyle( Reference< beans::XPropertySet > const & xProps ); bool importFontStyle( @@ -384,6 +387,9 @@ public: bool importTimeFormatProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); + bool importOrientationProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); }; //================================================================================================== class ControlImportContext : public ImportContext diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index bb16d1ac48a1..ca00ff3bfb91 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_expmodels.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: dbo $ $Date: 2001-05-04 09:14:56 $ + * last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -684,16 +684,83 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) void ElementDescriptor::readFixedLineModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { + // collect styles + Style aStyle( 0x2 | 0x8 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { + // collect styles + Style aStyle( 0x1 | 0x4 | 0x10 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ) ) >>= aStyle._descr) + aStyle._set |= 0x10; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { + // collect styles + Style aStyle( 0x4 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) + aStyle._set |= 0x4; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":pageincrement") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curpos") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxpos") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible-size") ) ); + readEvents(); } //__________________________________________________________________________________________________ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index ae973685b8d1..e51253744535 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_export.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: dbo $ $Date: 2001-05-04 09:14:56 $ + * last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,6 +112,17 @@ Reference< xml::sax::XAttributeList > Style::createElement() buf.makeStringAndClear() ); } + // fill-color + if (_set & 0x10) + { + OUStringBuffer buf( 16 ); + buf.append( (sal_Unicode)'0' ); + buf.append( (sal_Unicode)'x' ); + buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_fillColor, 16 ) ); + pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fill-color") ), + buf.makeStringAndClear() ); + } + // border if (_set & 0x4) { @@ -630,6 +641,28 @@ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString cons } } //__________________________________________________________________________________________________ +void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + Any a( _xProps->getPropertyValue( rPropName ) ); + if (a.getValueTypeClass() == TypeClass_SHORT) + { + switch (*(sal_Int32 const *)a.getValue()) + { + case 0: + addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("horizontal") ) ); + break; + case 1: + addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("vertical") ) ); + break; + default: + OSL_ENSURE( 0, "### illegal orientation value!" ); + } + } + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readDefaults() { Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) ); @@ -800,6 +833,10 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { continue; } + if ((bset & 0x10) && rStyle._fillColor != pStyle->_fillColor) + { + continue; + } if ((bset & 0x4) && rStyle._border != pStyle->_border) { continue; @@ -819,6 +856,10 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { pStyle->_textColor = rStyle._textColor; } + if (bnset & 0x10) + { + pStyle->_fillColor = rStyle._fillColor; + } if (bnset & 0x4) { pStyle->_border = rStyle._border; @@ -1049,7 +1090,7 @@ void SAL_CALL exportDialogModel( { pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixed-line") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ) ); xElem = static_cast< xml::sax::XAttributeList * >( pElem ); pElem->readFixedLineModel( &all_styles ); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 49d33e6255ec..da3c467d7a76 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_impmodels.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: dbo $ $Date: 2001-05-04 09:14:56 $ + * last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,12 +77,53 @@ Reference< xml::XImportContext > ProgressBarElement::createChildContext( Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException) { - return Reference< xml::XImportContext >(); + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } } //__________________________________________________________________________________________________ void ProgressBarElement::endElement() throw (xml::sax::SAXException, RuntimeException) { + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + pStyle->importFillColorStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), + _xAttributes ); + ctx.importEvents( _events ); } //################################################################################################## @@ -94,29 +135,114 @@ Reference< xml::XImportContext > ScrollBarElement::createChildContext( Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException) { - return Reference< xml::XImportContext >(); + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } } //__________________________________________________________________________________________________ void ScrollBarElement::endElement() throw (xml::sax::SAXException, RuntimeException) { + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBorderStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ), + _xAttributes ); + ctx.importEvents( _events ); } //################################################################################################## -// fixed-line +// fixedline //__________________________________________________________________________________________________ Reference< xml::XImportContext > FixedLineElement::createChildContext( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) throw (xml::sax::SAXException, RuntimeException) { - return Reference< xml::XImportContext >(); + if (XMLNS_DIALOGS_UID != nUid) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ), + Reference< XInterface >(), Any() ); + } + // event + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") )) + { + return new EventElement( rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } } //__________________________________________________________________________________________________ void FixedLineElement::endElement() throw (xml::sax::SAXException, RuntimeException) { + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ); + + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), + _xAttributes ); + ctx.importEvents( _events ); } //################################################################################################## @@ -1416,8 +1542,8 @@ Reference< xml::XImportContext > BulletinBoardElement::createChildContext( { return new PatternFieldElement( rLocalName, xAttributes, this, _pImport ); } - // fixed-line - else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixed-line") )) + // fixedline + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") )) { return new FixedLineElement( rLocalName, xAttributes, this, _pImport ); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 64522952e4cf..70fd8bc8c9e5 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmldlg_import.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ + * last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -144,9 +144,9 @@ OUString ControlElement::getControlId( bool StyleElement::importTextColorStyle( Reference< beans::XPropertySet > const & xProps ) { - if ((_inited & 0x1) != 0) + if ((_inited & 0x2) != 0) { - if ((_hasValue & 0x1) != 0) + if ((_hasValue & 0x2) != 0) { xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ), makeAny( _textColor ) ); @@ -154,12 +154,12 @@ bool StyleElement::importTextColorStyle( } return false; } - _inited |= 0x1; + _inited |= 0x2; if (getLongAttr( &_textColor, OUString( RTL_CONSTASCII_USTRINGPARAM("text-color") ), _xAttributes )) { - _hasValue |= 0x1; + _hasValue |= 0x2; xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ), makeAny( _textColor ) ); return true; @@ -167,12 +167,38 @@ bool StyleElement::importTextColorStyle( return false; } //__________________________________________________________________________________________________ +bool StyleElement::importFillColorStyle( + Reference< beans::XPropertySet > const & xProps ) +{ + if ((_inited & 0x10) != 0) + { + if ((_hasValue & 0x10) != 0) + { + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), makeAny( _fillColor ) ); + return true; + } + return false; + } + _inited |= 0x10; + + if (getLongAttr( &_fillColor, + OUString( RTL_CONSTASCII_USTRINGPARAM("fill-color") ), _xAttributes )) + { + _hasValue |= 0x10; + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), makeAny( _fillColor ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ bool StyleElement::importBackgroundColorStyle( Reference< beans::XPropertySet > const & xProps ) { - if ((_inited & 0x2) != 0) + if ((_inited & 0x1) != 0) { - if ((_hasValue & 0x2) != 0) + if ((_hasValue & 0x1) != 0) { xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) ); @@ -180,12 +206,12 @@ bool StyleElement::importBackgroundColorStyle( } return false; } - _inited |= 0x2; + _inited |= 0x1; if (getLongAttr( &_backgroundColor, OUString( RTL_CONSTASCII_USTRINGPARAM("background-color") ), _xAttributes )) { - _hasValue |= 0x2; + _hasValue |= 0x1; xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) ); return true; @@ -812,6 +838,35 @@ bool ImportContext::importTimeFormatProperty( return false; } //__________________________________________________________________________________________________ +bool ImportContext::importOrientationProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) +{ + OUString aOrient( xAttributes->getValueByUidName( XMLNS_DIALOGS_UID, rAttrName ) ); + if (aOrient.getLength()) + { + sal_Int32 nOrient; + if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("horizontal") )) + { + nOrient = 0; + } + else if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("vertical") )) + { + nOrient = 1; + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("invalid orientation value!") ), + Reference< XInterface >(), Any() ); + } + + _xControlModel->setPropertyValue( rPropName, makeAny( nOrient ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ void ImportContext::importEvents( vector< Reference< xml::sax2::XExtendedAttributes > > const & rEvents ) { diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml index f11d71e4c58e..ad32e10997fa 100644 --- a/xmlscript/test/test.xml +++ b/xmlscript/test/test.xml @@ -4,12 +4,12 @@ <window xmlns="http://openoffice.org/2000/dialog" xmlns:dlg="http://openoffice.org/2000/dialog" style-id="dialog" - id="window1" title="Test-Dialog" left="50" top="50" height="660" width="400"> + id="window1" title="Test-Dialog" left="50" top="50" height="690" width="400"> <dlg:styles xmlns:dlg="http://openoffice.org/2000/dialog"> <dlg:style style-id="bla" background-color="0xffffff" dlg:text-color="255"/> <dlg:style style-id="bla3" background-color="0" dlg:text-color="0xffffff" font-name="Arial" font-height="24"/> - <dlg:style style-id="no_border" border="none"/> + <dlg:style style-id="no_border" border="none" fill-color="0xff"/> <dlg:style style-id="dialog" border="3d"/> </dlg:styles> @@ -79,6 +79,9 @@ <patternfield id="pattern1" left="20" top="0" width="100" height="20" value="pattern" strict-format="true" readonly="true"/> <currencyfield id="currency1" left="200" top="610" width="100" height="20" value="5.6075" value-min="0.5" value-max="10.0" value-step="0.1" spin="true" thousands-separator="true" currency-symbol="$"/> <numericfield id="numeric1" left="200" top="635" width="100" height="20" value="5.6075" value-min="0.5" value-max="10.0" value-step="0.1" thousands-separator="true"/> + <fixedline style-id="bla3" id="fixedline1" left="20" top="660" width="150" height="20" value="FixedLineLabel" align="horizontal"/> + <progressmeter style-id="no_border" id="progress1" left="200" top="660" width="80" height="20" align="horizontal" value="50" value-min="0" value-max="80"/> + <scrollbar style-id="dialog" id="scrollbar1" left="300" top="660" width="80" height="20" align="horizontal" curpos="50" maxpos="200" increment="1" pageincrement="10"/> </dlg:bulletinboard> </window> |