diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2001-04-04 13:35:09 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2001-04-04 13:35:09 +0000 |
commit | cf5ace8b4f8bde7a123239ff592b2dcc535d2352 (patch) | |
tree | efff08250ec857194a23c08bd792ed08830e7c74 /xmlscript | |
parent | 366bc9051891fba91d76a02d8c2b94e16db2e0fc (diff) |
#85648# fixed dialog model properties
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/dtd/dialog.dtd | 9 | ||||
-rw-r--r-- | xmlscript/inc/xmlscript/xml_helper.hxx | 65 | ||||
-rw-r--r-- | xmlscript/inc/xmlscript/xml_import.hxx | 128 | ||||
-rw-r--r-- | xmlscript/inc/xmlscript/xmllib_imexp.hxx | 14 | ||||
-rw-r--r-- | xmlscript/inc/xmlscript/xmlmod_imexp.hxx | 14 | ||||
-rw-r--r-- | xmlscript/prj/d.lst | 1 | ||||
-rw-r--r-- | xmlscript/source/xml_helper/xml_impctx.cxx | 6 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 5 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/imp_share.hxx | 51 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 44 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 124 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 129 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 123 | ||||
-rw-r--r-- | xmlscript/test/imexp.cxx | 8 | ||||
-rw-r--r-- | xmlscript/test/test.xml | 10 |
15 files changed, 404 insertions, 327 deletions
diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd index 21dcf5c4884b..b2946572b4cd 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.10 2001-03-22 15:43:06 dbo Exp $ + $Id: dialog.dtd,v 1.11 2001-04-04 14:35:07 dbo Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -68,7 +68,8 @@ dlg:printable %boolean; #IMPLIED dlg:page %numeric; #IMPLIED dlg:tag CDATA #IMPLIED - dlg:helptext CDATA #IMPLIED + dlg:help-text CDATA #IMPLIED + dlg:help-url CDATA #IMPLIED "> <!ENTITY % control "(dlg:bulletinboard| @@ -89,12 +90,13 @@ dlg:patternfield )"> -<!ELEMENT dlg:window (dlg:styles*, dlg:bulletinboard*)> +<!ELEMENT dlg:window (dlg:styles*, dlg: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 dlg:title CDATA #IMPLIED dlg:page %numeric; #IMPLIED dlg:tag CDATA #IMPLIED @@ -185,7 +187,6 @@ dlg:tabstop %boolean; #IMPLIED dlg:value CDATA #IMPLIED dlg:checked %boolean; #IMPLIED - dlg:tristate %boolean; #IMPLIED > <!ELEMENT dlg:titledbox (dlg:title?, dlg:radio*, (%control;)*)> diff --git a/xmlscript/inc/xmlscript/xml_helper.hxx b/xmlscript/inc/xmlscript/xml_helper.hxx index 9d13edda92d8..31a43ccf2860 100644 --- a/xmlscript/inc/xmlscript/xml_helper.hxx +++ b/xmlscript/inc/xmlscript/xml_helper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xml_helper.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dbo $ $Date: 2001-03-28 10:50:35 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,16 +71,13 @@ #include <cppuhelper/implbase1.hxx> #endif -#ifndef _COM_SUN_STAR_XML_XIMPORTER_HXX_ -#include <com/sun/star/xml/XImporter.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HDL_ +#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #endif -#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HXX_ +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ #include <com/sun/star/io/XInputStream.hpp> #endif -#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HXX_ +#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ #include <com/sun/star/io/XOutputStream.hpp> #endif @@ -90,58 +87,6 @@ namespace xmlscript /*################################################################################################## - IMPORTING - -##################################################################################################*/ - -//================================================================================================== -struct NameSpaceUid -{ - /** URI defining XML namespace - */ - ::rtl::OUString sURI; - /** Identifier given for URI (given back in createRootContext(), createChildContext() callbacks - */ - sal_Int32 nUid; - - inline NameSpaceUid( ::rtl::OUString const & sURI_, sal_Int32 nUid_ ) SAL_THROW( () ) - : sURI( sURI_ ) - , nUid( nUid_ ) - {} -}; - -/** Creates a document handler to be used for SAX1 parser that can handle namespaces. - Give a list of NameSpaceUid structs defining namespace mappings to integers (performance). - Implementing the XImporter interface, you will get a createRootContext() for the root - element of your XML document and subsequent createChildContext() callbacks for each - sub element. - Namespaces of tags are identified by their integer value. - - @param pNamespaceUids - array of namespace mappings - @param nNameSpaceUids - number of element in namespace mappings array - @param nUnknownNamespaceUid - namespace id given for unrecognized namespace prefix - (one that is not given via pNamespaceUids) - @param xImporter - initial import object being called for root context - @param bSingleThreadedUse - flag whether context management is synchronized. - @return - document handler for parser -*/ -::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > -SAL_CALL createDocumentHandler( - NameSpaceUid const * pNamespaceUids, sal_Int32 nNameSpaceUids, - sal_Int32 nUnknownNamespaceUid, - ::com::sun::star::uno::Reference< ::com::sun::star::xml::XImporter > const & xImporter, - bool bSingleThreadedUse = true ) - SAL_THROW( () ); - - -/*################################################################################################## - EXPORTING ##################################################################################################*/ diff --git a/xmlscript/inc/xmlscript/xml_import.hxx b/xmlscript/inc/xmlscript/xml_import.hxx new file mode 100644 index 000000000000..8fdf07aa64ae --- /dev/null +++ b/xmlscript/inc/xmlscript/xml_import.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * $RCSfile: xml_import.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _XMLSCRIPT_XML_IMPORT_HXX_ +#define _XMLSCRIPT_XML_IMPORT_HXX_ + +#ifndef _COM_SUN_STAR_XML_XIMPORTER_HPP_ +#include <com/sun/star/xml/XImporter.hpp> +#endif +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#endif + + +namespace xmlscript +{ + +/*################################################################################################## + + IMPORTING + +##################################################################################################*/ + +//================================================================================================== +struct NameSpaceUid +{ + /** URI defining XML namespace + */ + ::rtl::OUString sURI; + /** Identifier given for URI (given back in createRootContext(), createChildContext() callbacks + */ + sal_Int32 nUid; + + inline NameSpaceUid( ::rtl::OUString const & sURI_, sal_Int32 nUid_ ) SAL_THROW( () ) + : sURI( sURI_ ) + , nUid( nUid_ ) + {} +}; + +/** Creates a document handler to be used for SAX1 parser that can handle namespaces. + Give a list of NameSpaceUid structs defining namespace mappings to integers (performance). + Implementing the XImporter interface, you will get a createRootContext() for the root + element of your XML document and subsequent createChildContext() callbacks for each + sub element. + Namespaces of tags are identified by their integer value. + + @param pNamespaceUids + array of namespace mappings + @param nNameSpaceUids + number of element in namespace mappings array + @param nUnknownNamespaceUid + namespace id given for unrecognized namespace prefix + (one that is not given via pNamespaceUids) + @param xImporter + initial import object being called for root context + @param bSingleThreadedUse + flag whether context management is synchronized. + @return + document handler for parser +*/ +::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > +SAL_CALL createDocumentHandler( + NameSpaceUid const * pNamespaceUids, sal_Int32 nNameSpaceUids, + sal_Int32 nUnknownNamespaceUid, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::XImporter > const & xImporter, + bool bSingleThreadedUse = true ) + SAL_THROW( () ); + +} + +#endif diff --git a/xmlscript/inc/xmlscript/xmllib_imexp.hxx b/xmlscript/inc/xmlscript/xmllib_imexp.hxx index 66f03f481f1c..e3d19bf5e39f 100644 --- a/xmlscript/inc/xmlscript/xmllib_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmllib_imexp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmllib_imexp.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: ab $ $Date: 2001-03-27 17:16:54 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,15 +61,11 @@ #ifndef _XMLSCRIPT_XMLLIB_IMEXP_HXX_ #define _XMLSCRIPT_XMLLIB_IMEXP_HXX_ -#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HXX_ +#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #endif -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring.hxx> -#endif - -#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ -#include <com/sun/star/uno/Sequence.h> +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> #endif diff --git a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx index d3361f0d48f6..a57d855ecaf3 100644 --- a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlmod_imexp.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: ab $ $Date: 2001-03-27 17:17:22 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,15 +61,11 @@ #ifndef _XMLSCRIPT_XMLMOD_IMEXP_HXX_ #define _XMLSCRIPT_XMLMOD_IMEXP_HXX_ -#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HXX_ +#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #endif -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring.hxx> -#endif - -#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ -#include <com/sun/star/uno/Sequence.h> +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> #endif diff --git a/xmlscript/prj/d.lst b/xmlscript/prj/d.lst index c09d806777a8..a9a375069e8f 100644 --- a/xmlscript/prj/d.lst +++ b/xmlscript/prj/d.lst @@ -4,6 +4,7 @@ mkdir: %_DEST%\inc\xmlscript ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib +..\inc\xmlscript\xml_helper.hxx %_DEST%\inc%_EXT%\xmlscript\xml_helper.hxx ..\inc\xmlscript\xmldlg_imexp.hxx %_DEST%\inc%_EXT%\xmlscript\xmldlg_imexp.hxx ..\inc\xmlscript\xmllib_imexp.hxx %_DEST%\inc%_EXT%\xmlscript\xmllib_imexp.hxx ..\inc\xmlscript\xmlmod_imexp.hxx %_DEST%\inc%_EXT%\xmlscript\xmlmod_imexp.hxx diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index f9d0a0a600c5..a33b83db9f46 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xml_impctx.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dbo $ $Date: 2001-03-14 16:39:58 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,7 +68,7 @@ #include <rtl/ustrbuf.hxx> #include <cppuhelper/implbase1.hxx> -#include <xmlscript/xml_helper.hxx> +#include <xmlscript/xml_import.hxx> #include <com/sun/star/xml/sax2/XExtendedAttributes.hpp> diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index e1e7a43e1b96..24969388d09d 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.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dbo $ $Date: 2001-03-15 14:44:15 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -151,6 +151,7 @@ public: // void readEvents() SAL_THROW( (Exception) ); // + void readDialogModel( StyleBag * all_styles ) SAL_THROW( (Exception) ); void readButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ); void readEditModel( StyleBag * all_styles ) SAL_THROW( (Exception) ); void readCheckBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) ); diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index 4d20bf8015ee..27b795f02669 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.8 $ + * $Revision: 1.9 $ * - * last change: $Author: ab $ $Date: 2001-03-27 17:44:31 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ inline sal_Int32 toInt32( OUString const & rStr ) SAL_THROW( () ) sal_Int32 nVal; if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x') { - nVal = rStr.toInt32( 16 ); + nVal = rStr.copy( 2 ).toInt32( 16 ); } else { @@ -145,13 +145,13 @@ inline bool getLongAttr( return false; } -class ControlImportContext; +class ImportContext; //================================================================================================== struct DialogImport : public ::cppu::WeakImplHelper1< xml::XImporter > { - friend class ControlImportContext; + friend class ImportContext; vector< OUString > _styleNames; vector< Reference< xml::XImportContext > > _styles; @@ -341,33 +341,21 @@ public: SAL_THROW( () ); }; //================================================================================================== -class ControlImportContext +class ImportContext { - DialogImport * _pImport; - OUString _aId; - +protected: Reference< beans::XPropertySet > _xControlModel; public: - inline ControlImportContext( DialogImport * pImport, - OUString const & rId, OUString const & rControlName ) - : _pImport( pImport ) - , _aId( rId ) - , _xControlModel( pImport->_xDialogModelFactory->createInstance( rControlName ), UNO_QUERY ) + inline ImportContext( Reference< beans::XPropertySet > const & xControlModel_ ) + : _xControlModel( xControlModel_ ) { OSL_ASSERT( _xControlModel.is() ); } - inline ~ControlImportContext() - { _pImport->_xDialogModel->insertByName( _aId, makeAny( Reference< awt::XControlModel >::query( _xControlModel ) ) ); } inline Reference< beans::XPropertySet > getControlModel() { return _xControlModel; } void importEvents( vector< Reference< xml::sax2::XExtendedAttributes > > const & rEvents ); - - void importDefaults( - sal_Int32 nBaseX, sal_Int32 nBaseY, - Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); - bool importStringProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); @@ -398,6 +386,27 @@ public: Reference< xml::sax2::XExtendedAttributes > const & xAttributes ); }; //================================================================================================== +class ControlImportContext : public ImportContext +{ + DialogImport * _pImport; + OUString _aId; +public: + inline ControlImportContext( DialogImport * pImport, + OUString const & rId, OUString const & rControlName ) + : ImportContext( Reference< beans::XPropertySet >( + pImport->_xDialogModelFactory->createInstance( rControlName ), UNO_QUERY ) ) + , _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 ); +}; + +//================================================================================================== class WindowElement : public ControlElement { diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 60079f06193f..e3a94f253bf5 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.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dbo $ $Date: 2001-03-15 14:44:15 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -680,5 +680,45 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) ); readEvents(); } +//__________________________________________________________________________________________________ +void ElementDescriptor::readDialogModel( StyleBag * all_styles ) + SAL_THROW( (Exception) ) +{ + // collect elements + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_DIALOGS_PREFIX) ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ) ); + + // collect styles + Style aStyle( 0x1 | 0x4 | 0x8 ); + 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) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + 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") ) ); + readEvents(); +} }; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index bd3c97a06289..7e1a0eb8045d 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.16 $ + * $Revision: 1.17 $ * - * last change: $Author: tbe $ $Date: 2001-04-03 13:13:48 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -652,14 +652,32 @@ void ElementDescriptor::readDefaults() OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" ); } - 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") ) ); + // force writing of pos/size + a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ) ); + if (a.getValueTypeClass() == TypeClass_LONG) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ), + OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue() ) ); + } + a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ) ); + if (a.getValueTypeClass() == TypeClass_LONG) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":top") ), + OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue() ) ); + } + a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ); + if (a.getValueTypeClass() == TypeClass_LONG) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ), + OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue() ) ); + } + a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ); + if (a.getValueTypeClass() == TypeClass_LONG) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ), + OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue() ) ); + } + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) ); readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ), @@ -667,7 +685,9 @@ void ElementDescriptor::readDefaults() 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 ":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") ) ); } //__________________________________________________________________________________________________ void ElementDescriptor::readEvents() @@ -1043,67 +1063,45 @@ void SAL_CALL exportDialogModel( xOut->startDocument(); - if (! all_elements.empty()) // dump out - { - // window - Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); - OSL_ASSERT( xPropState.is() ); + // window + Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY ); + OSL_ASSERT( xProps.is() ); + Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); + OSL_ASSERT( xPropState.is() ); - OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") ); - ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName ); - Reference< xml::sax::XAttributeList > xWindow( pWindow ); - pWindow->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_DIALOGS_PREFIX) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) ); - pWindow->readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ) ); - pWindow->readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); - pWindow->readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ) ); - pWindow->readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":top") ) ); - pWindow->readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ) ); - pWindow->readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ) ); - pWindow->readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ) ); - pWindow->readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tag") ) ); - //pWindow->readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ), - // OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":helptext") ) ); - xOut->ignorableWhitespace( OUString() ); - xOut->startElement( aWindowName, xWindow ); + OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") ); + ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName ); + Reference< xml::sax::XAttributeList > xWindow( pWindow ); + pWindow->readDialogModel( &all_styles ); + xOut->ignorableWhitespace( OUString() ); + xOut->startElement( aWindowName, xWindow ); - // dump out stylebag - all_styles.dump( xOut ); + // dump out stylebag + all_styles.dump( xOut ); - if (! all_elements.empty()) - { - // open up bulletinboard - OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ); - xOut->ignorableWhitespace( OUString() ); - xOut->startElement( aBBoardName, Reference< xml::sax::XAttributeList >() ); - - // export control elements - for ( size_t nPos = 0; nPos < all_elements.size(); ++nPos ) - { - ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ nPos ].get() ); - pElem->dump( xOut ); - } + if (! all_elements.empty()) + { + // open up bulletinboard + OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ); + xOut->ignorableWhitespace( OUString() ); + xOut->startElement( aBBoardName, Reference< xml::sax::XAttributeList >() ); - // end bulletinboard - xOut->ignorableWhitespace( OUString() ); - xOut->endElement( aBBoardName ); + // export control elements + for ( size_t nPos = 0; nPos < all_elements.size(); ++nPos ) + { + ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ nPos ].get() ); + pElem->dump( xOut ); } - // end window + // end bulletinboard xOut->ignorableWhitespace( OUString() ); - xOut->endElement( aWindowName ); + xOut->endElement( aBBoardName ); } + // end window + xOut->ignorableWhitespace( OUString() ); + xOut->endElement( aWindowName ); + xOut->endDocument(); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index a4342ce5bbc2..0bfc7a458c65 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.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dbo $ $Date: 2001-03-22 15:43:07 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -796,20 +796,13 @@ void TitledBoxElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), xAttributes ); - sal_Int16 nVal; - sal_Bool bTriState = sal_False; - sal_Bool bChecked = sal_False; - getBoolAttr( &bTriState, OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ), xAttributes ); - if (getBoolAttr( &bChecked, OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), xAttributes )) + sal_Int16 nVal = 0; + sal_Bool bChecked; + if (getBoolAttr( &bChecked, OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), xAttributes ) && + bChecked) { - // has "checked" attribute - nVal = (bChecked ? 1 : 0); + nVal = 1; } - else - { - nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know! - } - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); @@ -907,20 +900,13 @@ void RadioGroupElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), xAttributes ); - sal_Int16 nVal; - sal_Bool bTriState = sal_False; - sal_Bool bChecked = sal_False; - getBoolAttr( &bTriState, OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ), xAttributes ); - if (getBoolAttr( &bChecked, OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), xAttributes )) + sal_Int16 nVal = 0; + sal_Bool bChecked; + if (getBoolAttr( &bChecked, OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ), xAttributes ) && + bChecked) { - // has "checked" attribute - nVal = (bChecked ? 1 : 0); + nVal = 1; } - else - { - nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know! - } - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); @@ -1510,79 +1496,52 @@ void WindowElement::endElement() throw (xml::sax::SAXException, RuntimeException) { Reference< beans::XPropertySet > xProps( _pImport->_xDialogModel, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); + ImportContext ctx( xProps ); - OUString aValue( _xAttributes->getValueByUidName( - XMLNS_DIALOGS_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("id") ) ) ); - if (aValue.getLength()) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), - makeAny( aValue ) ); - } - aValue = _xAttributes->getValueByUidName( - XMLNS_DIALOGS_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("title") ) ); - if (aValue.getLength()) + Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), - makeAny( aValue ) ); + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + pStyle->importBackgroundColorStyle( xProps ); + pStyle->importBorderStyle( xProps ); + pStyle->importFontStyle( xProps ); } - sal_Int32 nLong; - - if (getLongAttr( &nLong, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ), _xAttributes )) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ), - makeAny( nLong ) ); - } - if (getLongAttr( &nLong, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ), _xAttributes )) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ), - makeAny( nLong ) ); - } - if (getLongAttr( &nLong, OUString( RTL_CONSTASCII_USTRINGPARAM("width") ), _xAttributes )) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), - makeAny( nLong ) ); - } - if (getLongAttr( &nLong, OUString( RTL_CONSTASCII_USTRINGPARAM("height") ), _xAttributes )) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), - makeAny( nLong ) ); - } + 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 ) ); - aValue = _xAttributes->getValueByUidName( - XMLNS_DIALOGS_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ) ); - if (aValue.getLength()) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), - makeAny( aValue ) ); - } + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ), + _xAttributes ); - aValue = _xAttributes->getValueByUidName( - XMLNS_DIALOGS_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("helptext") ) ); - if (aValue.getLength()) - { - xProps->setPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ), - makeAny( aValue ) ); - } + ctx.importEvents( _events ); } - }; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 4907aefcf070..64522952e4cf 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.12 $ + * $Revision: 1.13 $ * - * last change: $Author: dbo $ $Date: 2001-03-28 10:50:37 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,7 +64,7 @@ #include <rtl/ustrbuf.hxx> -#include <xmlscript/xml_helper.hxx> +#include <xmlscript/xml_import.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/awt/CharSet.hpp> @@ -582,7 +582,7 @@ bool StyleElement::importFontStyle( //################################################################################################## //__________________________________________________________________________________________________ -bool ControlImportContext::importStringProperty( +bool ImportContext::importStringProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -595,7 +595,7 @@ bool ControlImportContext::importStringProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importDoubleProperty( +bool ImportContext::importDoubleProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -608,7 +608,7 @@ bool ControlImportContext::importDoubleProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importBooleanProperty( +bool ImportContext::importBooleanProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -621,7 +621,7 @@ bool ControlImportContext::importBooleanProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importLongProperty( +bool ImportContext::importLongProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -634,7 +634,7 @@ bool ControlImportContext::importLongProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importLongProperty( +bool ImportContext::importLongProperty( sal_Int32 nOffset, OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) @@ -648,7 +648,7 @@ bool ControlImportContext::importLongProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importShortProperty( +bool ImportContext::importShortProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -661,7 +661,7 @@ bool ControlImportContext::importShortProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importAlignProperty( +bool ImportContext::importAlignProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -698,7 +698,7 @@ bool ControlImportContext::importAlignProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importDateFormatProperty( +bool ImportContext::importDateFormatProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -767,7 +767,7 @@ bool ControlImportContext::importDateFormatProperty( return false; } //__________________________________________________________________________________________________ -bool ControlImportContext::importTimeFormatProperty( +bool ImportContext::importTimeFormatProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) { @@ -812,6 +812,53 @@ bool ControlImportContext::importTimeFormatProperty( return false; } //__________________________________________________________________________________________________ +void ImportContext::importEvents( + vector< Reference< xml::sax2::XExtendedAttributes > > const & rEvents ) +{ + Reference< script::XScriptEventsSupplier > xSupplier( _xControlModel, UNO_QUERY ); + if (xSupplier.is()) + { + Reference< container::XNameContainer > xEvents( xSupplier->getEvents() ); + if (xEvents.is()) + { + for ( size_t nPos = 0; nPos < rEvents.size(); ++nPos ) + { + script::ScriptEventDescriptor descr; + Reference< xml::sax2::XExtendedAttributes > xEvent( rEvents[ nPos ] ); + + if (!getStringAttr( &descr.ListenerType, + OUString( RTL_CONSTASCII_USTRINGPARAM("listener-type") ), + xEvent ) || + !getStringAttr( &descr.EventMethod, + OUString( RTL_CONSTASCII_USTRINGPARAM("event-method") ), + xEvent )) + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("missing listener-type | event attribute(s)!") ), + Reference< XInterface >(), Any() ); + } + + getStringAttr( &descr.ScriptType, + OUString( RTL_CONSTASCII_USTRINGPARAM("script-type") ), + xEvent ); + getStringAttr( &descr.ScriptCode, + OUString( RTL_CONSTASCII_USTRINGPARAM("script-code") ), + xEvent ); + getStringAttr( &descr.AddListenerParam, + OUString( RTL_CONSTASCII_USTRINGPARAM("param") ), + xEvent ); + + OUStringBuffer buf( 32 ); + buf.append( descr.ListenerType ); + buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("::") ); + buf.append( descr.EventMethod ); + + xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) ); + } + } + } +} +//__________________________________________________________________________________________________ void ControlImportContext::importDefaults( sal_Int32 nBaseX, sal_Int32 nBaseY, Reference< xml::sax2::XExtendedAttributes > const & xAttributes ) @@ -869,55 +916,11 @@ void ControlImportContext::importDefaults( OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ), xAttributes ); importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("helptext") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("help-text") ), + xAttributes ); + importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("help-url") ), xAttributes ); -} -//__________________________________________________________________________________________________ -void ControlImportContext::importEvents( - vector< Reference< xml::sax2::XExtendedAttributes > > const & rEvents ) -{ - Reference< script::XScriptEventsSupplier > xSupplier( _xControlModel, UNO_QUERY ); - if (xSupplier.is()) - { - Reference< container::XNameContainer > xEvents( xSupplier->getEvents() ); - if (xEvents.is()) - { - for ( size_t nPos = 0; nPos < rEvents.size(); ++nPos ) - { - script::ScriptEventDescriptor descr; - Reference< xml::sax2::XExtendedAttributes > xEvent( rEvents[ nPos ] ); - - if (!getStringAttr( &descr.ListenerType, - OUString( RTL_CONSTASCII_USTRINGPARAM("listener-type") ), - xEvent ) || - !getStringAttr( &descr.EventMethod, - OUString( RTL_CONSTASCII_USTRINGPARAM("event-method") ), - xEvent )) - { - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM("missing listener-type | event attribute(s)!") ), - Reference< XInterface >(), Any() ); - } - - getStringAttr( &descr.ScriptType, - OUString( RTL_CONSTASCII_USTRINGPARAM("script-type") ), - xEvent ); - getStringAttr( &descr.ScriptCode, - OUString( RTL_CONSTASCII_USTRINGPARAM("script-code") ), - xEvent ); - getStringAttr( &descr.AddListenerParam, - OUString( RTL_CONSTASCII_USTRINGPARAM("param") ), - xEvent ); - - OUStringBuffer buf( 32 ); - buf.append( descr.ListenerType ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("::") ); - buf.append( descr.EventMethod ); - - xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) ); - } - } - } } //################################################################################################## diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx index 599f67d02281..53d1569837ad 100644 --- a/xmlscript/test/imexp.cxx +++ b/xmlscript/test/imexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: imexp.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: dbo $ $Date: 2001-03-21 12:30:25 $ + * last change: $Author: dbo $ $Date: 2001-04-04 14:35:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -196,11 +196,11 @@ Reference< lang::XMultiServiceFactory > createApplicationServiceManager() OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ), aDllName, Reference< registry::XSimpleRegistry > () ); #ifdef SAL_W32 - aDllName = OUString::createFromAscii( "int" ); + aDllName = OUString::createFromAscii( "i18n" ); aDllName += OUString::valueOf( (sal_Int32)SUPD ); aDllName += OUString::createFromAscii( "mi.dll" ); #else - aDllName = OUString::createFromAscii( "libint" ); + aDllName = OUString::createFromAscii( "libi18n" ); aDllName += OUString::valueOf( (sal_Int32)SUPD ); aDllName += OUString::createFromAscii( ".so" ); #endif diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml index ebdf3bba8b2a..f11d71e4c58e 100644 --- a/xmlscript/test/test.xml +++ b/xmlscript/test/test.xml @@ -3,12 +3,14 @@ <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"> <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="dialog" border="3d"/> </dlg:styles> <dlg:bulletinboard xmlns:ns="http://www.fake" xmlns:dlg="http://openoffice.org/2000/dialog"> @@ -19,7 +21,7 @@ <button dlg:id="button3" ns:value="hallo2" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" xmlns:ns="http://openoffice.org/2000/dialog"/> - <checkbox id="check1" helptext="helphelphelp!!!" value="checked" left="50" top="150" width="100" height="20" checked="true"/> + <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"/> <checkbox id="check3" value="tristate_checked" left="50" top="190" width="100" height="20" checked="true" tristate="true"/> @@ -57,15 +59,13 @@ <radio id="radio1" value="default radio" left="50" top="250" width="100" height="20"/> <radio id="radio2" value="checked" left="50" top="270" width="100" height="20" checked="true"/> <radio id="radio3" value="unchecked" left="50" top="290" width="100" height="20" checked="false"/> - <radio id="radio4" value="dont know" left="50" top="310" width="100" height="20" tristate="true"/> </radiogroup> <titledbox id="groupbox1" left="250" top="250" width="120" height="100"> <title value="grouped"/> <radio id="radio5" value="default radio" left="5" top="15" width="100" height="20"/> - <radio id="radio6" value="dont know" left="5" top="35" width="100" height="20" tristate="true"/> - <radio id="radio7" value="tristate checked" left="5" top="55" width="100" height="20" tristate="true" checked="true"/> - <radio id="radio8" value="checked" left="5" top="75" width="100" height="20" checked="true"/> + <radio id="radio7" value="unchecked" left="5" top="35" width="100" height="20" checked="false"/> + <radio id="radio8" value="checked" left="5" top="55" width="100" height="20" checked="true"/> </titledbox> <text id="fixed1" left="50" top="520" width="180" height="20" value="fixed text is here..." multiline="true" align="center"/> |