diff options
-rw-r--r-- | xmlscript/dtd/dialog.dtd | 25 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 15 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 37 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 194 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 171 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 116 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 127 | ||||
-rw-r--r-- | xmlscript/test/test.xml | 22 |
8 files changed, 524 insertions, 183 deletions
diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd index 69f5a114ee17..a5a24a8f7b95 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.22 2002-03-06 15:23:47 dbo Exp $ + $Id: dialog.dtd,v 1.23 2002-03-25 12:03:20 dbo Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -100,17 +100,11 @@ )"> <!ELEMENT dlg:window (dlg:styles*, (%event;)*, dlg:bulletinboard*)> -<!ATTLIST dlg:window dlg:id CDATA #REQUIRED - dlg:left %numeric; #IMPLIED - dlg:top %numeric; #IMPLIED - dlg:width %numeric; #IMPLIED - dlg:height %numeric; #IMPLIED - dlg:style-id CDATA #IMPLIED +<!ATTLIST dlg:window %default-attributes; + dlg:closeable %boolean; #IMPLIED + dlg:moveable %boolean; #IMPLIED + dlg:resizeable %boolean; #IMPLIED dlg:title CDATA #IMPLIED - dlg:page %numeric; #IMPLIED - dlg:tag CDATA #IMPLIED - dlg:help-text CDATA #IMPLIED - dlg:help-url CDATA #IMPLIED xmlns:dlg CDATA #FIXED "http://openoffice.org/2000/dialog" xmlns:script CDATA #FIXED "http://openoffice.org/2000/script" > @@ -121,6 +115,7 @@ <!ATTLIST dlg:style dlg:style-id CDATA #REQUIRED dlg:background-color %numeric; #IMPLIED dlg:text-color %numeric; #IMPLIED + dlg:textline-color %numeric; #IMPLIED dlg:fill-color %numeric; #IMPLIED dlg:border (none|3d|simple) #IMPLIED dlg:font-name CDATA #IMPLIED @@ -139,6 +134,8 @@ dlg:font-kerning %boolean; #IMPLIED dlg:font-wordlinemode %boolean; #IMPLIED dlg:font-type (raster|device|scalable) #IMPLIED + dialog:font-relief (none|embossed|engraved) #IMPLIED + dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED > <!ELEMENT script:event EMPTY> @@ -204,6 +201,7 @@ dlg:tabstop %boolean; #IMPLIED dlg:spin %boolean; #IMPLIED dlg:multiselection %boolean; #IMPLIED + dlg:readonly %boolean; #IMPLIED dlg:linecount %numeric; #IMPLIED > @@ -218,7 +216,6 @@ <!ATTLIST dlg:radio %default-attributes; dlg:value CDATA #IMPLIED dlg:checked %boolean; #IMPLIED - dlg:tristate %boolean; #IMPLIED dlg:tabstop %boolean; #IMPLIED > @@ -233,6 +230,7 @@ <!ATTLIST dlg:text %default-attributes; dlg:align (left|center|right) #IMPLIED dlg:multiline %boolean; #IMPLIED + dlg:tabstop %boolean; #IMPLIED dlg:value CDATA #IMPLIED > @@ -284,6 +282,7 @@ dlg:readonly %boolean; #IMPLIED dlg:strict-format %boolean; #IMPLIED dlg:date-format (system_short|system_short_YY|system_short_YYYY|system_long|short_DDMMYY|short_MMDDYY|short_YYMMDD|short_DDMMYYYY|short_MMDDYYYY|short_YYYYMMDD|short_YYMMDD_DIN5008|short_YYYYMMDD_DIN5008) #IMPLIED + dlg:show-century %boolean; #IMPLIED dlg:value CDATA #IMPLIED dlg:value-min CDATA #IMPLIED dlg:value-max CDATA #IMPLIED @@ -323,6 +322,7 @@ dlg:readonly %boolean; #IMPLIED dlg:strict-format %boolean; #IMPLIED dlg:value CDATA #IMPLIED + dlg:maxlength %numeric; #IMPLIED dlg:edit-mask CDATA #IMPLIED dlg:literal-mask CDATA #IMPLIED > @@ -334,6 +334,7 @@ dlg:align (left|center|right) #IMPLIED dlg:format-code CDATA #IMPLIED dlg:format-locale CDATA #IMPLIED + dlg:treat-as-number %boolean; #IMPLIED dlg:strict-format %boolean; #IMPLIED dlg:value-default CDATA #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 c43400033a66..430671973e18 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.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dbo $ $Date: 2002-03-06 14:01:22 $ + * last change: $Author: dbo $ $Date: 2002-03-25 12:03:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,6 +69,8 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/awt/FontEmphasisMark.hpp> +#include <com/sun/star/awt/FontRelief.hpp> using namespace ::rtl; @@ -83,8 +85,11 @@ struct Style { sal_uInt32 _backgroundColor; sal_uInt32 _textColor; + sal_uInt32 _textLineColor; sal_Int16 _border; awt::FontDescriptor _descr; + sal_uInt16 _fontRelief; + sal_uInt16 _fontEmphasisMark; sal_uInt32 _fillColor; short _all; @@ -93,7 +98,9 @@ struct Style OUString _id; inline Style( short all_ ) SAL_THROW( () ) - : _all( all_ ) + : _fontRelief( awt::FontRelief::NONE ) + , _fontEmphasisMark( awt::FontEmphasisMark::NONE ) + , _all( all_ ) , _set( 0 ) {} @@ -136,7 +143,7 @@ public: // Any readProp( OUString const & rPropName ); // - void readDefaults(); + void readDefaults( bool supportPrintable = true ); // void readStringAttr( OUString const & rPropName, OUString const & rAttrName ); void readDoubleAttr( OUString const & rPropName, OUString const & rAttrName ); diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index b08292d12e62..383b79a36dca 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.19 $ + * $Revision: 1.20 $ * - * last change: $Author: dbo $ $Date: 2002-03-06 14:01:22 $ + * last change: $Author: dbo $ $Date: 2002-03-25 12:03:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,8 @@ #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/awt/FontEmphasisMark.hpp> +#include <com/sun/star/awt/FontRelief.hpp> #include <com/sun/star/xml/sax2/XExtendedAttributes.hpp> #include <com/sun/star/xml/XImportContext.hpp> @@ -279,12 +281,17 @@ class StyleElement { sal_Int32 _backgroundColor; sal_Int32 _textColor; + sal_Int32 _textLineColor; sal_Int16 _border; awt::FontDescriptor _descr; + sal_Int16 _fontRelief; + sal_Int16 _fontEmphasisMark; sal_Int32 _fillColor; short _inited, _hasValue; + void setFontProperties( Reference< beans::XPropertySet > const & xProps ); + public: virtual Reference< xml::XImportContext > SAL_CALL createChildContext( sal_Int32 nUid, OUString const & rLocalName, @@ -295,6 +302,8 @@ public: bool importTextColorStyle( Reference< beans::XPropertySet > const & xProps ); + bool importTextLineColorStyle( + Reference< beans::XPropertySet > const & xProps ); bool importFillColorStyle( Reference< beans::XPropertySet > const & xProps ); bool importBackgroundColorStyle( @@ -310,6 +319,8 @@ public: ElementBase * pParent, DialogImport * pImport ) SAL_THROW( () ) : ElementBase( XMLNS_DIALOGS_UID, rLocalName, xAttributes, pParent, pImport ) + , _fontRelief( awt::FontRelief::NONE ) + , _fontEmphasisMark( awt::FontEmphasisMark::NONE ) , _inited( 0 ) , _hasValue( 0 ) {} @@ -368,17 +379,25 @@ class ImportContext { protected: Reference< beans::XPropertySet > _xControlModel; + OUString _aId; public: - inline ImportContext( Reference< beans::XPropertySet > const & xControlModel_ ) + inline ImportContext( + Reference< beans::XPropertySet > const & xControlModel_, OUString const & id ) : _xControlModel( xControlModel_ ) + , _aId( id ) { OSL_ASSERT( _xControlModel.is() ); } inline Reference< beans::XPropertySet > getControlModel() { return _xControlModel; } + void importDefaults( + sal_Int32 nBaseX, sal_Int32 nBaseY, + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + bool supportPrintable = true ); void importEvents( vector< Reference< xml::XImportContext > > const & rEvents ); + bool importStringProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); @@ -421,21 +440,15 @@ public: class ControlImportContext : public ImportContext { DialogImport * _pImport; - OUString _aId; public: - inline ControlImportContext( DialogImport * pImport, - OUString const & rId, OUString const & rControlName ) + inline ControlImportContext( + DialogImport * pImport, OUString const & rId, OUString const & rControlName ) : ImportContext( Reference< beans::XPropertySet >( - pImport->_xDialogModelFactory->createInstance( rControlName ), UNO_QUERY ) ) + pImport->_xDialogModelFactory->createInstance( rControlName ), UNO_QUERY ), rId ) , _pImport( pImport ) - , _aId( rId ) {} inline ~ControlImportContext() { _pImport->_xDialogModel->insertByName( _aId, makeAny( Reference< awt::XControlModel >::query( _xControlModel ) ) ); } - - void importDefaults( - sal_Int32 nBaseX, sal_Int32 nBaseY, - Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); }; //================================================================================================== diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 30f04f90e9d1..d0414b43187b 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.20 $ + * $Revision: 1.21 $ * - * last change: $Author: dbo $ $Date: 2002-03-06 14:01:22 $ + * last change: $Author: dbo $ $Date: 2002-03-25 12:03:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,17 +66,31 @@ namespace xmlscript { +static inline bool readFontProps( ElementDescriptor * element, Style & style ) +{ + bool ret = false; + ret |= (sal_False != (element->readProp( + OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= style._descr)); + ret |= (sal_False != (element->readProp( + OUString( RTL_CONSTASCII_USTRINGPARAM("FontEmphasisMark") ) ) >>= style._fontEmphasisMark)); + ret |= (sal_False != (element->readProp( + OUString( RTL_CONSTASCII_USTRINGPARAM("FontRelief") ) ) >>= style._fontRelief)); + return ret; +} + //__________________________________________________________________________________________________ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -98,6 +112,27 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-align") ) ); + + // State + sal_Int16 nState; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState) + { + switch (nState) + { + case 0: + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) ); + break; + case 1: + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ); + break; + default: + OSL_ENSURE( 0, "### unexpected radio state!" ); + break; + } + } + readEvents(); } //__________________________________________________________________________________________________ @@ -105,10 +140,12 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x2 | 0x8 ); + Style aStyle( 0x2 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -145,6 +182,9 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) case 2: // tristate=true exported, checked omitted => dont know! OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" ); break; + default: + OSL_ENSURE( 0, "### unexpected checkbox state!" ); + break; } } readEvents(); @@ -154,14 +194,16 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -215,14 +257,16 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -286,10 +330,12 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x2 | 0x8 ); + Style aStyle( 0x2 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -317,9 +363,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ), OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ); break; - case 2: // tristate=true exported, checked omitted => dont know! - addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tristate") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ); + default: + OSL_ENSURE( 0, "### unexpected radio state!" ); break; } } @@ -330,10 +375,12 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x2 | 0x8 ); + Style aStyle( 0x2 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -361,14 +408,16 @@ void ElementDescriptor::readFixedTextModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -382,6 +431,8 @@ void ElementDescriptor::readFixedTextModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readEvents(); @@ -391,14 +442,16 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -464,14 +517,16 @@ void ElementDescriptor::readFileControlModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -492,14 +547,16 @@ void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -541,14 +598,16 @@ void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -566,6 +625,8 @@ void ElementDescriptor::readDateFieldModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); readDateFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":date-format") ) ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":show-century") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ), @@ -583,14 +644,16 @@ void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -627,14 +690,16 @@ void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -667,14 +732,16 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -692,6 +759,8 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ), @@ -703,14 +772,16 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) aStyle._set |= 0x1; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border) aStyle._set |= 0x4; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -768,6 +839,9 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) ); } } + readBoolAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treat-as-number") ) ); readEvents(); } @@ -776,10 +850,12 @@ void ElementDescriptor::readFixedLineModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles - Style aStyle( 0x2 | 0x8 ); + Style aStyle( 0x2 | 0x8 | 0x20 ); if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) aStyle._set |= 0x2; - if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -862,16 +938,16 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) ); addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ) ); // collect styles - Style aStyle( 0x1 | 0x4 | 0x8 ); + Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); 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("FontDescriptor") ) ) >>= aStyle._descr) + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) + aStyle._set |= 0x2; + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) aStyle._set |= 0x8; if (aStyle._set) { @@ -879,24 +955,20 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) all_styles->getStyleId( aStyle ) ); } - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":top") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ) ); - readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tag") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-text") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-url") ) ); + // collect elements + readDefaults( false ); + readBoolAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":closeable") ) ); + readBoolAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":moveable") ) ); + readBoolAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":resizeable") ) ); + readStringAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); readEvents(); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 736bf058e85c..b6ebce3da68a 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.27 $ + * $Revision: 1.28 $ * - * last change: $Author: dbo $ $Date: 2002-03-06 14:01:22 $ + * last change: $Author: dbo $ $Date: 2002-03-25 12:03:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,6 +115,17 @@ Reference< xml::sax::XAttributeList > Style::createElement() buf.makeStringAndClear() ); } + // textline-color + if (_set & 0x20) + { + OUStringBuffer buf( 16 ); + buf.append( (sal_Unicode)'0' ); + buf.append( (sal_Unicode)'x' ); + buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textLineColor, 16 ) ); + pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textline-color") ), + buf.makeStringAndClear() ); + } + // fill-color if (_set & 0x10) { @@ -145,6 +156,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() break; default: OSL_ENSURE( 0, "### unexpected border value!" ); + break; } } @@ -206,6 +218,9 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ), OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-family!" ); + break; } } // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED @@ -253,6 +268,9 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ), OUString( RTL_CONSTASCII_USTRINGPARAM("symbol") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-charset!" ); + break; } } // dialog:font-pitch "(fixed|variable)" #IMPLIED @@ -268,6 +286,9 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ), OUString( RTL_CONSTASCII_USTRINGPARAM("variable") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-pitch!" ); + break; } } // dialog:font-charwidth CDATA #IMPLIED @@ -303,6 +324,9 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ), OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_italic") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-slant!" ); + break; } } // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED @@ -378,6 +402,9 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ), OUString( RTL_CONSTASCII_USTRINGPARAM("boldwave") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-underline!" ); + break; } } // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED @@ -405,6 +432,9 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ), OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-strikeout!" ); + break; } } // dialog:font-orientation CDATA #IMPLIED @@ -442,8 +472,71 @@ Reference< xml::sax::XAttributeList > Style::createElement() pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ), OUString( RTL_CONSTASCII_USTRINGPARAM("scalable") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected font-type!" ); + break; } } + + // additional attributes not in FontDescriptor struct + // dialog:font-relief (none|embossed|engraved) #IMPLIED + switch (_fontRelief) + { + case awt::FontRelief::NONE: // dont export default + break; + case awt::FontRelief::EMBOSSED: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("embossed") ) ); + break; + case awt::FontRelief::ENGRAVED: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("engraved") ) ); + break; + default: + OSL_ENSURE( 0, "### unexpected font-relief!" ); + break; + } + // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED + switch (_fontEmphasisMark) + { + case awt::FontEmphasisMark::NONE: // dont export default + break; + case awt::FontEmphasisMark::DOT: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("dot") ) ); + break; + case awt::FontEmphasisMark::CIRCLE: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("circle") ) ); + break; + case awt::FontEmphasisMark::DISC: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("disc") ) ); + break; + case awt::FontEmphasisMark::ACCENT: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("accent") ) ); + break; + case awt::FontEmphasisMark::ABOVE: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("above") ) ); + break; + case awt::FontEmphasisMark::BELOW: + pStyle->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("below") ) ); + break; + default: + OSL_ENSURE( 0, "### unexpected font-emphasismark!" ); + break; + } } return pStyle; @@ -614,6 +707,9 @@ void ElementDescriptor::readDateFormatAttr( OUString const & rPropName, OUString case 11: addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD_DIN5008") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected date format!" ); + break; } } } @@ -646,6 +742,9 @@ void ElementDescriptor::readTimeFormatAttr( OUString const & rPropName, OUString case 5: addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_long") ) ); break; + default: + OSL_ENSURE( 0, "### unexpected time format!" ); + break; } } } @@ -671,6 +770,7 @@ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString cons break; default: OSL_ENSURE( 0, "### illegal alignment value!" ); + break; } } } @@ -699,6 +799,7 @@ void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString break; default: OSL_ENSURE( 0, "### illegal image alignment value!" ); + break; } } } @@ -727,6 +828,7 @@ void ElementDescriptor::readButtonTypeAttr( OUString const & rPropName, OUString break; default: OSL_ENSURE( 0, "### illegal button-type value!" ); + break; } } } @@ -749,12 +851,13 @@ void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUStrin break; default: OSL_ENSURE( 0, "### illegal orientation value!" ); + break; } } } } //__________________________________________________________________________________________________ -void ElementDescriptor::readDefaults() +void ElementDescriptor::readDefaults( bool supportPrintable ) { Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) ); addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), @@ -802,8 +905,12 @@ void ElementDescriptor::readDefaults() OUString::valueOf( *(sal_Int32 const *)a.getValue() ) ); } - readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) ); + if (supportPrintable) + { + readBoolAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) ); + } readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ) ); readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), @@ -935,24 +1042,30 @@ void ElementDescriptor::readEvents() //################################################################################################## -inline bool equals( awt::FontDescriptor const & f1, awt::FontDescriptor const & f2 ) +inline bool equalFont( Style const & style1, Style const & style2 ) { - return (f1.Name == f2.Name && - f1.Height == f2.Height && - f1.Width == f2.Width && - f1.StyleName == f2.StyleName && - f1.Family == f2.Family && - f1.CharSet == f2.CharSet && - f1.Pitch == f2.CharSet && - f1.CharacterWidth == f2.CharacterWidth && - f1.Weight == f2.Weight && - f1.Slant == f2.Slant && - f1.Underline == f2.Underline && - f1.Strikeout == f2.Strikeout && - f1.Orientation == f2.Orientation && - (f1.Kerning != sal_False) == (f2.Kerning != sal_False) && - (f1.WordLineMode != sal_False) == (f2.WordLineMode != sal_False) && - f1.Type == f2.Type); + awt::FontDescriptor const & f1 = style1._descr; + awt::FontDescriptor const & f2 = style2._descr; + return ( + f1.Name == f2.Name && + f1.Height == f2.Height && + f1.Width == f2.Width && + f1.StyleName == f2.StyleName && + f1.Family == f2.Family && + f1.CharSet == f2.CharSet && + f1.Pitch == f2.CharSet && + f1.CharacterWidth == f2.CharacterWidth && + f1.Weight == f2.Weight && + f1.Slant == f2.Slant && + f1.Underline == f2.Underline && + f1.Strikeout == f2.Strikeout && + f1.Orientation == f2.Orientation && + (f1.Kerning != sal_False) == (f2.Kerning != sal_False) && + (f1.WordLineMode != sal_False) == (f2.WordLineMode != sal_False) && + f1.Type == f2.Type && + style1._fontRelief == style2._fontRelief && + style1._fontEmphasisMark == style2._fontEmphasisMark + ); } //__________________________________________________________________________________________________ OUString StyleBag::getStyleId( Style const & rStyle ) @@ -968,8 +1081,6 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { Style * pStyle = _styles[ nStylesPos ]; - // xxx todo: have a look at this... - short demanded_defaults = ~rStyle._set & rStyle._all; // test, if defaults are not set if ((~pStyle->_set & demanded_defaults) == demanded_defaults && @@ -984,6 +1095,10 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { continue; } + if ((bset & 0x20) && rStyle._textLineColor != pStyle->_textLineColor) + { + continue; + } if ((bset & 0x10) && rStyle._fillColor != pStyle->_fillColor) { continue; @@ -992,7 +1107,7 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { continue; } - if ((bset & 0x8) && !equals( rStyle._descr, pStyle->_descr)) + if ((bset & 0x8) && !equalFont( rStyle, *pStyle )) { continue; } @@ -1007,6 +1122,10 @@ OUString StyleBag::getStyleId( Style const & rStyle ) { pStyle->_textColor = rStyle._textColor; } + if (bnset & 0x20) + { + pStyle->_textLineColor = rStyle._textLineColor; + } if (bnset & 0x10) { pStyle->_fillColor = rStyle._fillColor; @@ -1018,6 +1137,8 @@ OUString StyleBag::getStyleId( Style const & rStyle ) if (bnset & 0x8) { pStyle->_descr = rStyle._descr; + pStyle->_fontRelief = rStyle._fontRelief; + pStyle->_fontEmphasisMark = rStyle._fontEmphasisMark; } pStyle->_all |= rStyle._all; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 366743ca07d7..4c4e0eee50cb 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.29 $ + * $Revision: 1.30 $ * - * last change: $Author: dbo $ $Date: 2002-03-06 14:01:22 $ + * last change: $Author: dbo $ $Date: 2002-03-25 12:03:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -231,6 +231,7 @@ void FixedLineElement::endElement() StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -283,6 +284,7 @@ void PatternFieldElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -300,6 +302,9 @@ void PatternFieldElement::endElement() ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), _xAttributes ); + ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ), + _xAttributes ); ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ), OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ), _xAttributes ); @@ -348,6 +353,7 @@ void FormattedFieldElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -462,6 +468,10 @@ void FormattedFieldElement::endElement() throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() ); } } + ctx.importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("treat-as-number") ), + _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: @@ -505,6 +515,7 @@ void TimeFieldElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -576,6 +587,7 @@ void NumericFieldElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -653,6 +665,7 @@ void DateFieldElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -670,6 +683,9 @@ void DateFieldElement::endElement() ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ), OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ), _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ), + _xAttributes ); ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ), OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), _xAttributes ); @@ -727,6 +743,7 @@ void CurrencyFieldElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -810,6 +827,7 @@ void FileControlElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -914,6 +932,7 @@ void TextElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -925,6 +944,9 @@ void TextElement::endElement() ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), + _xAttributes ); ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); @@ -970,6 +992,7 @@ void TextFieldElement::endElement() StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1080,6 +1103,7 @@ void TitledBoxElement::endElement() { StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1112,6 +1136,7 @@ void TitledBoxElement::endElement() { StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1218,6 +1243,7 @@ void RadioGroupElement::endElement() { StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1363,6 +1389,7 @@ void MenuListElement::endElement() StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1374,6 +1401,9 @@ void MenuListElement::endElement() ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ), _xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), + _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ), OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ), _xAttributes ); @@ -1443,6 +1473,7 @@ void ComboBoxElement::endElement() StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importBorderStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1466,17 +1497,17 @@ void ComboBoxElement::endElement() ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ), _xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); if (_popup.is()) { MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), makeAny( p->getItemValues() ) ); - - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), - _xAttributes ); } + ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -1518,6 +1549,7 @@ void CheckBoxElement::endElement() { StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1592,6 +1624,7 @@ void ButtonElement::endElement() Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); pStyle->importBackgroundColorStyle( xControlModel ); pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); pStyle->importFontStyle( xControlModel ); } @@ -1614,6 +1647,15 @@ void ButtonElement::endElement() ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ), _xAttributes ); + // State + sal_Bool bChecked; + if (getBoolAttr( + &bChecked, OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), _xAttributes ) && bChecked) + { + sal_Int16 nVal = 1; + ctx.getControlModel()->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); + } ctx.importEvents( _events ); // avoid ring-reference: @@ -1867,57 +1909,35 @@ void WindowElement::endElement() throw (xml::sax::SAXException, RuntimeException) { Reference< beans::XPropertySet > xProps( _pImport->_xDialogModel, UNO_QUERY ); - ImportContext ctx( xProps ); + ImportContext ctx( xProps, getControlId( _xAttributes ) ); Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) { StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); pStyle->importBackgroundColorStyle( xProps ); -// pStyle->importBorderStyle( xProps ); + pStyle->importTextColorStyle( xProps ); + pStyle->importTextLineColorStyle( xProps ); pStyle->importFontStyle( xProps ); } - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("id") ), - _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("title") ), - _xAttributes ); - ctx.importLongProperty( 0, - OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("left") ), - _xAttributes ); - ctx.importLongProperty( 0, - OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("top") ), - _xAttributes ); - ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("width") ), - _xAttributes ); - ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("height") ), - _xAttributes ); - - sal_Int32 nLong; - if (! getLongAttr( &nLong, OUString( RTL_CONSTASCII_USTRINGPARAM("page") ), _xAttributes )) - { - nLong = 0; - } - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ), - makeAny( nLong ) ); - - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ), - _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("help-text") ), - _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("help-url") ), - _xAttributes ); - + ctx.importDefaults( 0, 0, _xAttributes, false ); + ctx.importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ), + _xAttributes ); + ctx.importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ), + _xAttributes ); + ctx.importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ), + _xAttributes ); + ctx.importStringProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("title") ), + _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 519e6b150766..c6f5ce877a86 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.22 $ + * $Revision: 1.23 $ * - * last change: $Author: dbo $ $Date: 2002-03-06 14:01:22 $ + * last change: $Author: dbo $ $Date: 2002-03-25 12:03:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -169,6 +169,32 @@ bool StyleElement::importTextColorStyle( return false; } //__________________________________________________________________________________________________ +bool StyleElement::importTextLineColorStyle( + Reference< beans::XPropertySet > const & xProps ) +{ + if ((_inited & 0x20) != 0) + { + if ((_hasValue & 0x20) != 0) + { + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ), makeAny( _textLineColor ) ); + return true; + } + return false; + } + _inited |= 0x20; + + if (getLongAttr( &_textLineColor, + OUString( RTL_CONSTASCII_USTRINGPARAM("textline-color") ), _xAttributes )) + { + _hasValue |= 0x20; + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ), makeAny( _textLineColor ) ); + return true; + } + return false; +} +//__________________________________________________________________________________________________ bool StyleElement::importFillColorStyle( Reference< beans::XPropertySet > const & xProps ) { @@ -265,6 +291,17 @@ bool StyleElement::importBorderStyle( return false; } //__________________________________________________________________________________________________ +void StyleElement::setFontProperties( + Reference< beans::XPropertySet > const & xProps ) +{ + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) ); + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("FontEmphasisMark") ), makeAny( _fontEmphasisMark ) ); + xProps->setPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM("FontRelief") ), makeAny( _fontRelief ) ); +} +//__________________________________________________________________________________________________ bool StyleElement::importFontStyle( Reference< beans::XPropertySet > const & xProps ) { @@ -272,8 +309,7 @@ bool StyleElement::importFontStyle( { if ((_hasValue & 0x8) != 0) { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) ); + setFontProperties( xProps ); return true; } return false; @@ -597,11 +633,75 @@ bool StyleElement::importFontStyle( bFontImport = true; } + // additional properties which are not part of the FontDescriptor struct + // dialog:font-relief (none|embossed|engraved) #IMPLIED + if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-relief") ), _xAttributes )) + { + if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) + { + _fontRelief = awt::FontRelief::NONE; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("embossed") )) + { + _fontRelief = awt::FontRelief::EMBOSSED; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("engraved") )) + { + _fontRelief = awt::FontRelief::ENGRAVED; + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-relief style!") ), + Reference< XInterface >(), Any() ); + } + bFontImport = true; + } + // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED + if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-emphasismark") ), _xAttributes )) + { + if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::NONE; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dot") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::DOT; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("circle") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::CIRCLE; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("disc") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::DISC; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("accent") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::ACCENT; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("above") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::ABOVE; + } + else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("below") )) + { + _fontEmphasisMark = awt::FontEmphasisMark::BELOW; + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-emphasismark style!") ), + Reference< XInterface >(), Any() ); + } + bFontImport = true; + } + + // ================================================== if (bFontImport) { _hasValue |= 0x8; - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) ); + setFontProperties( xProps ); } return bFontImport; @@ -1134,9 +1234,10 @@ void ImportContext::importEvents( } } //__________________________________________________________________________________________________ -void ControlImportContext::importDefaults( +void ImportContext::importDefaults( sal_Int32 nBaseX, sal_Int32 nBaseY, - Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) + Reference< xml::sax2::XExtendedAttributes > const & xAttributes, + bool supportPrintable ) { _xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), @@ -1174,9 +1275,13 @@ void ControlImportContext::importDefaults( Reference< XInterface >(), Any() ); } - importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ), - xAttributes ); + if (supportPrintable) + { + importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ), + xAttributes ); + } sal_Int32 nLong; if (! getLongAttr( &nLong, OUString( RTL_CONSTASCII_USTRINGPARAM("page") ), xAttributes )) diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml index 687727edcc30..7b0f9e802741 100644 --- a/xmlscript/test/test.xml +++ b/xmlscript/test/test.xml @@ -5,27 +5,29 @@ xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" style-id="dialog" - id="window1" title="Test-Dialog" left="50" top="50" height="690" width="400"> + id="window1" title="Test-Dialog" left="50" top="50" height="690" width="400" + closeable="true" moveable="true" resizeable="true" disabled="false" +> <script:event script:event-name="on-rowchange" script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic"/> <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="bla" background-color="0xffffff" dlg:text-color="255" dlg:textline-color="0xff0000" dlg:font-underline="single"/> + <dlg:style style-id="bla3" background-color="888888" dlg:text-color="0xffffff" font-name="Arial" font-height="24" font-relief="embossed" font-emphasismark="dot"/> <dlg:style style-id="no_border" border="none" fill-color="0xff"/> - <dlg:style style-id="dialog" border="3d"/> + <dlg:style style-id="dialog" border="3d" dlg:text-color="255" dlg:textline-color="0xff0000"/> </dlg:styles> <dlg:bulletinboard xmlns:ns="http://www.fake" xmlns:dlg="http://openoffice.org/2000/dialog"> - <button dlg:id="button1" ns:value="hallo" dlg:left="50" ns:top="50" width="50" height="50" style-id="bla3" xmlns:ns="http://openoffice.org/2000/dialog"> + <button dlg:id="button1" ns:value="hallo" dlg:left="50" ns:top="50" ns:checked="true" width="50" height="50" style-id="bla3" xmlns:ns="http://openoffice.org/2000/dialog"> <dlg:event listener-type="com.sun.star.awt.XKeyListener" event-method="keyReleased" script-type="StarBasic" script-code="application:ExecutingMacro"/> <script:event script:event-name="on-rowchange" script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic"/> <script:listener-event script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic" script:listener-type="com.sun.star.awt.XMouseListener" script:listener-method="mouseEntered"/> <script:listener-event script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic" script:listener-type="com.sun.star.awt.XMouseListener" script:listener-method="mousePressed" script:listener-param="parameter0, so this will never ever be a script:event, but always a script:listener-event element!"/> </button> - <button dlg:id="button3" dlg:image-src="../../test/w3c.jpg" dlg:image-align="right" ns:value="help button" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" button-type="help" xmlns:ns="http://openoffice.org/2000/dialog"/> + <button dlg:id="button3" dlg:image-src="file:///f|src641/xmlscript/test/w3c.jpg" dlg:image-align="right" ns:value="help button" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" button-type="help" xmlns:ns="http://openoffice.org/2000/dialog"/> <checkbox id="check1" help-text="helphelphelp!!!" help-url="http://www.xml.org" value="checked" left="50" top="150" width="100" height="20" checked="true"/> <checkbox id="check2" value="dontknow" left="50" top="170" width="100" height="20" tristate="true"/> @@ -80,21 +82,21 @@ </text> <textfield id="field1" left="250" top="520" width="50" height="40" value="edit no text here..." readonly="true" vscroll="true" multiline="true" align="right" style-id="no_border"/> <textfield id="field2" left="320" top="520" width="50" height="40" value="hidden text" hscroll="true" echochar="*" align="left"/> - <img id="image1" scale-image="true" left="50" top="585" width="80" height="20" src="../../test/w3c.jpg"> + <img id="image1" scale-image="true" left="50" top="585" width="80" height="20" src="file:///f|src641/xmlscript/test/w3c.jpg"> <script:listener-event script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic" script:listener-type="com.sun.star.awt.XMouseListener" script:listener-method="mouseEntered"/> </img> <filecontrol id="file1" left="150" top="585" width="100" height="20" value="../../test/w3c.jpg"/> - <datefield id="datefield1" left="20" top="610" width="100" height="20" date-format="short_DDMMYY" spin="true" value="20010301"/> + <datefield id="datefield1" left="20" top="610" width="100" height="20" show-century="false" date-format="short_DDMMYY" spin="true" value="20010301"/> <timefield id="time1" left="20" top="635" width="100" height="20" time-format="24h_long" value-min="0" value-max="24000000" strict-format="true" value="12000000" spin="true"/> - <patternfield id="pattern1" left="20" top="0" width="100" height="20" value="pattern" strict-format="true" readonly="true"/> + <patternfield id="pattern1" maxlength="4" 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="$" prepend-symbol="true"/> <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"/> - <formattedfield style-id="dialog" id="ffield0" left="20" top="110" width="80" height="20" align="center" text="first ffield" + <formattedfield style-id="dialog" treat-as-number="true" id="ffield0" left="20" top="110" width="80" height="20" align="center" text="first ffield" dlg:value-max="750" dlg:value-min="0" dlg:value="2" spin="true"/> <formattedfield style-id="dialog" id="ffield1" left="250" top="110" width="80" height="20" align="center" text="second ffield" dlg:format-code="[$$-409]#.##0,00;[ROT]-[$$-409]#.##0,00" dlg:format-locale="de;DE;WIN" dlg:value-max="750" dlg:value-min="0" dlg:value="4" spin="true"/> |