diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:24:29 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:24:29 +0200 |
commit | 92667c8edbaee9a252b1d5d221eb62849f76697c (patch) | |
tree | 8f1d329f2259b7d5bff054bc14d0965637df6961 /xmlscript | |
parent | baecdfb578cb7bc992944857ad4d8882ef7e842c (diff) | |
parent | 48b4a99ce2451f1ddf2e8e128bbfcd6683072999 (diff) |
Merge branch 'master' into feature/gnumake4
Conflicts:
connectivity/source/cpool/Zregistration.cxx
connectivity/source/drivers/evoab/LCatalog.cxx
connectivity/source/drivers/evoab/LColumnAlias.cxx
connectivity/source/drivers/evoab/LColumnAlias.hxx
connectivity/source/drivers/evoab/LColumns.cxx
connectivity/source/drivers/evoab/LColumns.hxx
connectivity/source/drivers/evoab/LConfigAccess.cxx
connectivity/source/drivers/evoab/LConfigAccess.hxx
connectivity/source/drivers/evoab/LConnection.cxx
connectivity/source/drivers/evoab/LConnection.hxx
connectivity/source/drivers/evoab/LDatabaseMetaData.cxx
connectivity/source/drivers/evoab/LDatabaseMetaData.hxx
connectivity/source/drivers/evoab/LDriver.cxx
connectivity/source/drivers/evoab/LDriver.hxx
connectivity/source/drivers/evoab/LFolderList.cxx
connectivity/source/drivers/evoab/LFolderList.hxx
connectivity/source/drivers/evoab/LNoException.cxx
connectivity/source/drivers/evoab/LPreparedStatement.cxx
connectivity/source/drivers/evoab/LPreparedStatement.hxx
connectivity/source/drivers/evoab/LResultSet.cxx
connectivity/source/drivers/evoab/LResultSet.hxx
connectivity/source/drivers/evoab/LServices.cxx
connectivity/source/drivers/evoab/LStatement.cxx
connectivity/source/drivers/evoab/LStatement.hxx
connectivity/source/drivers/evoab/LTable.cxx
connectivity/source/drivers/evoab/LTable.hxx
connectivity/source/drivers/evoab/LTables.cxx
connectivity/source/drivers/evoab/LTables.hxx
connectivity/source/drivers/evoab/evoab.xml
connectivity/source/drivers/evoab/makefile.mk
editeng/Library_editeng.mk
framework/Library_fwe.mk
framework/test/test.cxx
idl/prj/d.lst
idl/util/idlpch.cxx
linguistic/Makefile
linguistic/Module_linguistic.mk
linguistic/inc/linguistic/lngdllapi.h
linguistic/inc/linguistic/lngprophelp.hxx
linguistic/inc/linguistic/misc.hxx
linguistic/prj/build.lst
linguistic/prj/d.lst
linguistic/qa/unoapi/Test.java
linguistic/source/grammarchecker.cxx
linguistic/source/grammarchecker.hxx
linguistic/source/hyphdta.cxx
linguistic/source/lngprophelp.cxx
linguistic/source/makefile.mk
linguistic/source/spelldta.cxx
sfx2/Library_qstart.mk
sfx2/Library_sfx.mk
sfx2/inc/sfx2/qswin32.h
sfx2/prj/build.lst
sfx2/qa/cppunit/makefile.mk
xmlscript/inc/xmlscript/xcrdllapi.h
xmlscript/prj/d.lst
xmlscript/util/makefile.mk
Diffstat (limited to 'xmlscript')
44 files changed, 1379 insertions, 383 deletions
diff --git a/xmlscript/Module_xmlscript.mk b/xmlscript/Module_xmlscript.mk index 30fa3147c8f5..30fa3147c8f5 100644..100755 --- a/xmlscript/Module_xmlscript.mk +++ b/xmlscript/Module_xmlscript.mk diff --git a/xmlscript/Package_dtd.mk b/xmlscript/Package_dtd.mk index cab5ddd0faeb..cab5ddd0faeb 100644..100755 --- a/xmlscript/Package_dtd.mk +++ b/xmlscript/Package_dtd.mk diff --git a/xmlscript/Package_inc.mk b/xmlscript/Package_inc.mk index 649dde7b44b3..649dde7b44b3 100644..100755 --- a/xmlscript/Package_inc.mk +++ b/xmlscript/Package_inc.mk diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd index 020ceedd5a5e..020ceedd5a5e 100644..100755 --- a/xmlscript/dtd/dialog.dtd +++ b/xmlscript/dtd/dialog.dtd diff --git a/xmlscript/dtd/libraries.dtd b/xmlscript/dtd/libraries.dtd index 383f37e21315..383f37e21315 100644..100755 --- a/xmlscript/dtd/libraries.dtd +++ b/xmlscript/dtd/libraries.dtd diff --git a/xmlscript/dtd/library.dtd b/xmlscript/dtd/library.dtd index 80f687b9bfc2..80f687b9bfc2 100644..100755 --- a/xmlscript/dtd/library.dtd +++ b/xmlscript/dtd/library.dtd diff --git a/xmlscript/dtd/module.dtd b/xmlscript/dtd/module.dtd index e0e7c843d46d..e0e7c843d46d 100644..100755 --- a/xmlscript/dtd/module.dtd +++ b/xmlscript/dtd/module.dtd diff --git a/xmlscript/inc/pch/precompiled_xmlscript.cxx b/xmlscript/inc/pch/precompiled_xmlscript.cxx index 7998575efea9..812b8d428514 100644 --- a/xmlscript/inc/pch/precompiled_xmlscript.cxx +++ b/xmlscript/inc/pch/precompiled_xmlscript.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_xmlscript.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/pch/precompiled_xmlscript.hxx b/xmlscript/inc/pch/precompiled_xmlscript.hxx index 31ddc8cda8d8..ad1762464bde 100644 --- a/xmlscript/inc/pch/precompiled_xmlscript.hxx +++ b/xmlscript/inc/pch/precompiled_xmlscript.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,3 +31,4 @@ #ifdef PRECOMPILED_HEADERS #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/xmlscript/xcrdllapi.h b/xmlscript/inc/xmlscript/xcrdllapi.h index 7c01a969b959..8c4a7a581dc4 100644 --- a/xmlscript/inc/xmlscript/xcrdllapi.h +++ b/xmlscript/inc/xmlscript/xcrdllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,3 +42,4 @@ #define XCR_DLLPRIVATE SAL_DLLPRIVATE #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/xmlscript/xml_helper.hxx b/xmlscript/inc/xmlscript/xml_helper.hxx index 0d59fe4eea7b..48c0905a0b49 100644 --- a/xmlscript/inc/xmlscript/xml_helper.hxx +++ b/xmlscript/inc/xmlscript/xml_helper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -145,3 +146,5 @@ SAL_CALL createOutputStream( } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx index 955db5491ca2..86b98c13406b 100644 --- a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,18 +28,12 @@ #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_ #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_ -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_ +#include <com/sun/star/frame/XModel.hpp> + #include <com/sun/star/container/XNameContainer.hpp> -#endif -#ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_ #include <com/sun/star/io/XInputStreamProvider.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HXX_ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> -#endif -#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HXX_ #include <com/sun/star/uno/XComponentContext.hpp> -#endif #include "xmlscript/xmlns.h" #include "xmlscript/xcrdllapi.h" @@ -51,7 +46,9 @@ XCR_DLLPUBLIC void SAL_CALL exportDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut, ::com::sun::star::uno::Reference< - ::com::sun::star::container::XNameContainer > const & xDialogModel ) + ::com::sun::star::container::XNameContainer > const & xDialogModel, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); //============================================================================== @@ -60,7 +57,9 @@ SAL_CALL importDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ) + ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); // additional functions for convenience @@ -71,19 +70,25 @@ SAL_CALL exportDialogModel( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ) + ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); //============================================================================== XCR_DLLPUBLIC void SAL_CALL importDialogModel( ::com::sun::star::uno::Reference< - ::com::sun::star::io::XInputStream > xInput, + ::com::sun::star::io::XInputStream > const & xInput, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel, ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ) + ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > const & xDocument ) SAL_THROW( (::com::sun::star::uno::Exception) ); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/xmlscript/xmllib_imexp.hxx b/xmlscript/inc/xmlscript/xmllib_imexp.hxx index 005546d51da4..9b5aad1318cc 100644 --- a/xmlscript/inc/xmlscript/xmllib_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmllib_imexp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -92,3 +93,5 @@ SAL_CALL importLibrary( LibDescriptor& rLib ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx index 1d2d36e6f0be..fd2faf14586a 100644 --- a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ SAL_CALL importScriptModule( ModuleDescriptor& rMod ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/inc/xmlscript/xmlns.h b/xmlscript/inc/xmlscript/xmlns.h index 4ab2c18376eb..13751ea8489e 100644..100755 --- a/xmlscript/inc/xmlscript/xmlns.h +++ b/xmlscript/inc/xmlscript/xmlns.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,3 +44,5 @@ #define XMLNS_XLINK_PREFIX "xlink" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/prj/makefile.mk b/xmlscript/prj/makefile.mk index 88cd9dfe08b8..88cd9dfe08b8 100644..100755 --- a/xmlscript/prj/makefile.mk +++ b/xmlscript/prj/makefile.mk diff --git a/xmlscript/source/inc/misc.hxx b/xmlscript/source/inc/misc.hxx index 50435002a3bb..bd7f737292af 100644 --- a/xmlscript/source/inc/misc.hxx +++ b/xmlscript/source/inc/misc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ inline T extract_throw( ::com::sun::star::uno::Any const & a ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/inc/xml_import.hxx b/xmlscript/source/inc/xml_import.hxx index d63fdff7f7cb..2e36643379fd 100644 --- a/xmlscript/source/inc/xml_import.hxx +++ b/xmlscript/source/inc/xml_import.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,5 @@ SAL_CALL createDocumentHandler( } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/misc/unoservices.cxx b/xmlscript/source/misc/unoservices.cxx index 6bcaf49c1f72..0e7119368d20 100644 --- a/xmlscript/source/misc/unoservices.cxx +++ b/xmlscript/source/misc/unoservices.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlscript.hxx" -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ #include <cppuhelper/implementationentry.hxx> -#endif using namespace ::rtl; using namespace ::com::sun::star::uno; @@ -122,3 +121,5 @@ extern "C" pImplName, pServiceManager, pRegistryKey, ::xmlscript::s_entries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xml_helper/xml_byteseq.cxx b/xmlscript/source/xml_helper/xml_byteseq.cxx index a570db629aca..e1208e8a0774 100644 --- a/xmlscript/source/xml_helper/xml_byteseq.cxx +++ b/xmlscript/source/xml_helper/xml_byteseq.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,11 +34,11 @@ #include <xmlscript/xml_helper.hxx> -using namespace rtl; using namespace osl; using namespace com::sun::star; using namespace com::sun::star::uno; +using ::rtl::ByteSequence; namespace xmlscript { @@ -171,3 +172,5 @@ Reference< io::XOutputStream > SAL_CALL createOutputStream( ByteSequence * pOutD } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xml_helper/xml_element.cxx b/xmlscript/source/xml_helper/xml_element.cxx index 7fe5436ffd86..6a2717019f7e 100644 --- a/xmlscript/source/xml_helper/xml_element.cxx +++ b/xmlscript/source/xml_helper/xml_element.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,11 +31,10 @@ #include <xmlscript/xml_helper.hxx> -using namespace rtl; using namespace com::sun::star; using namespace com::sun::star::uno; - +using ::rtl::OUString; namespace xmlscript { @@ -73,7 +73,6 @@ void XMLElement::dump( Reference< xml::sax::XDocumentHandler > const & xOut ) xOut->startElement( _name, static_cast< xml::sax::XAttributeList * >( this ) ); // write sub elements dumpSubElements( xOut ); - // xOut->ignorableWhitespace( OUString() ); xOut->endElement( _name ); } @@ -130,3 +129,5 @@ OUString XMLElement::getValueByName( OUString const & rName ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index d014486faaf6..308efd537c29 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,7 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <memory> @@ -70,8 +71,8 @@ OUString getImplementationName_DocumentHandlerImpl() "com.sun.star.comp.xml.input.SaxDocumentHandler") ); } -typedef ::std::hash_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap; -typedef ::std::hash_map< sal_Int32, OUString > t_Long2OUStringMap; +typedef ::boost::unordered_map< OUString, sal_Int32, OUStringHash > t_OUString2LongMap; +typedef ::boost::unordered_map< sal_Int32, OUString > t_Long2OUStringMap; struct PrefixEntry { @@ -81,7 +82,7 @@ struct PrefixEntry { m_Uids.reserve( 4 ); } }; -typedef ::std::hash_map< +typedef ::boost::unordered_map< OUString, PrefixEntry *, OUStringHash > t_OUString2PrefixMap; struct ElementEntry @@ -902,3 +903,5 @@ Reference< XInterface > SAL_CALL create_DocumentHandlerImpl( } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/common.hxx b/xmlscript/source/xmldlg_imexp/common.hxx index f5bc51684ebb..7395c1034f95 100644 --- a/xmlscript/source/xmldlg_imexp/common.hxx +++ b/xmlscript/source/xmldlg_imexp/common.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,4 +40,7 @@ const sal_Int16 BORDER_SIMPLE_COLOR = 3; } +#define XMLSCRIPT_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index a53d02393ae6..50a9d2393393 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,16 +91,18 @@ class ElementDescriptor { css::uno::Reference< css::beans::XPropertySet > _xProps; css::uno::Reference< css::beans::XPropertyState > _xPropState; + css::uno::Reference< css::frame::XModel > _xDocument; public: inline ElementDescriptor( css::uno::Reference< css::beans::XPropertySet > const & xProps, css::uno::Reference< css::beans::XPropertyState > const & xPropState, - ::rtl::OUString const & name ) + ::rtl::OUString const & name, css::uno::Reference< css::frame::XModel > const & xDocument ) SAL_THROW( () ) : XMLElement( name ) , _xProps( xProps ) , _xPropState( xPropState ) + , _xDocument( xDocument ) {} inline ElementDescriptor( ::rtl::OUString const & name ) @@ -112,13 +115,10 @@ public: ::rtl::OUString const & propName, ::rtl::OUString const & attrName, bool forceAttribute = false ); - // template<typename T> inline bool readProp( T * ret, ::rtl::OUString const & rPropName ); css::uno::Any readProp( ::rtl::OUString const & rPropName ); - // void readDefaults( bool supportPrintable = true, bool supportVisible = true ); - // void readStringAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); inline void readDoubleAttr( @@ -141,6 +141,8 @@ public: ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readVerticalAlignAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); + void readImageURLAttr( + ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readImageAlignAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readImagePositionAttr( @@ -157,7 +159,8 @@ public: ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); void readSelectionTypeAttr( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName ); - // + void readDataAwareAttr( + ::rtl::OUString const & rAttrName ); inline void addBoolAttr( ::rtl::OUString const & rAttrName, sal_Bool bValue ) { addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); } @@ -166,11 +169,17 @@ public: const & xFormatProperties, ::rtl::OUString const & rAttrName ); - // void readEvents() SAL_THROW( (css::uno::Exception) ); - // void readDialogModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); + void readBullitinBoard( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); + void readMultiPageModel( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); + void readFrameModel( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); + void readPageModel( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); void readButtonModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); void readEditModel( StyleBag * all_styles ) @@ -211,6 +220,8 @@ public: SAL_THROW( (css::uno::Exception) ); void readScrollBarModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); + void readSpinButtonModel( StyleBag * all_styles ) + SAL_THROW( (css::uno::Exception) ); void readFixedHyperLinkModel( StyleBag * all_styles ) SAL_THROW( (css::uno::Exception) ); }; @@ -229,7 +240,7 @@ inline void ElementDescriptor::read( if (a >>= v) addAttribute( attrName, ::rtl::OUString::valueOf(v) ); else - OSL_ENSURE( 0, "### unexpected property type!" ); + OSL_FAIL( "### unexpected property type!" ); } } @@ -243,3 +254,5 @@ inline bool ElementDescriptor::readProp( } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index 29966392e7a5..0c413a3afe53 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,15 +43,15 @@ #include <com/sun/star/awt/FontEmphasisMark.hpp> #include <com/sun/star/awt/FontRelief.hpp> #include <com/sun/star/xml/input/XRoot.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> #include <vector> - +#include <boost/shared_ptr.hpp> namespace css = ::com::sun::star; namespace xmlscript { -// inline sal_Int32 toInt32( ::rtl::OUString const & rStr ) SAL_THROW( () ) { sal_Int32 nVal; @@ -115,19 +116,22 @@ inline bool getLongAttr( class ImportContext; //============================================================================== +typedef ::cppu::WeakImplHelper1< css::xml::input::XRoot > DialogImport_Base; struct DialogImport - : public ::cppu::WeakImplHelper1< css::xml::input::XRoot > + : DialogImport_Base { friend class ImportContext; css::uno::Reference< css::uno::XComponentContext > _xContext; css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier; - ::std::vector< ::rtl::OUString > _styleNames; - ::std::vector< css::uno::Reference< css::xml::input::XElement > > _styles; + ::boost::shared_ptr< ::std::vector< ::rtl::OUString > > _pStyleNames; + ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > _pStyles; css::uno::Reference< css::container::XNameContainer > _xDialogModel; css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory; + css::uno::Reference< css::frame::XModel > _xDoc; + css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer; sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID; @@ -161,16 +165,35 @@ public: inline DialogImport( css::uno::Reference<css::uno::XComponentContext> const & xContext, css::uno::Reference<css::container::XNameContainer> - const & xDialogModel ) + const & xDialogModel, + ::boost::shared_ptr< ::std::vector< ::rtl::OUString > >& pStyleNames, + ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > >& pStyles, + css::uno::Reference<css::frame::XModel> const & xDoc ) SAL_THROW( () ) : _xContext( xContext ) + , _pStyleNames( pStyleNames ) + , _pStyles( pStyles ) , _xDialogModel( xDialogModel ) - , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ) + , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc ) { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() && _xContext.is() ); } + inline DialogImport( const DialogImport& rOther ) : DialogImport_Base() + , _xContext( rOther._xContext ) + , _xSupplier( rOther._xSupplier ) + , _pStyleNames( rOther._pStyleNames ) + , _pStyles( rOther._pStyles ) + , _xDialogModel( rOther._xDialogModel ) + , _xDialogModelFactory( rOther._xDialogModelFactory ) + , _xDoc( rOther._xDoc ) + , XMLNS_DIALOGS_UID( rOther.XMLNS_DIALOGS_UID ) + , XMLNS_SCRIPT_UID( rOther.XMLNS_SCRIPT_UID ) {} + virtual ~DialogImport() SAL_THROW( () ); + inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; } + + css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer(); // XRoot virtual void SAL_CALL startDocument( css::uno::Reference< css::xml::input::XNamespaceMapping > @@ -357,6 +380,9 @@ protected: ::rtl::OUString getControlId( css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); + ::rtl::OUString getControlModelName( + rtl::OUString const& rDefaultModel, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); css::uno::Reference< css::xml::input::XElement > getStyle( css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); public: @@ -427,6 +453,8 @@ public: bool importVerticalAlignProperty( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); + bool importImageURLProperty( rtl::OUString const & rPropName, rtl::OUString const & rAttrName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes ); bool importImageAlignProperty( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); @@ -451,6 +479,9 @@ public: bool importSelectionTypeProperty( ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName, css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); + bool importDataAwareProperty( + ::rtl::OUString const & rPropName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ); }; //============================================================================== @@ -466,6 +497,14 @@ public: pImport->_xDialogModelFactory->createInstance( rControlName ), css::uno::UNO_QUERY_THROW ), rId ) {} + inline ControlImportContext( + DialogImport * pImport, + const css::uno::Reference< css::beans::XPropertySet >& xProps, ::rtl::OUString const & rControlName ) + : ImportContext( + pImport, + xProps, + rControlName ) + {} inline ~ControlImportContext() { _pImport->_xDialogModel->insertByName( @@ -996,6 +1035,106 @@ public: }; //============================================================================== + +class SpinButtonElement + : public ControlElement +{ +public: + virtual css::uno::Reference< css::xml::input::XElement > + SAL_CALL startChildElement( + sal_Int32 nUid, ::rtl::OUString const & rLocalName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + virtual void SAL_CALL endElement() + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + + inline SpinButtonElement( + ::rtl::OUString const & rLocalName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + SAL_THROW( () ) + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +}; + +//============================================================================== +class MultiPage + : public ControlElement +{ +public: + virtual css::uno::Reference< css::xml::input::XElement > + SAL_CALL startChildElement( + sal_Int32 nUid, ::rtl::OUString const & rLocalName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + virtual void SAL_CALL endElement() + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + + inline MultiPage( + ::rtl::OUString const & rLocalName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + SAL_THROW( () ) + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + { + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ), css::uno::UNO_QUERY ); + } +private: + css::uno::Reference< css::container::XNameContainer > m_xContainer; +}; + +//============================================================================== +class Frame + : public ControlElement +{ + ::rtl::OUString _label; +public: + virtual css::uno::Reference< css::xml::input::XElement > + SAL_CALL startChildElement( + sal_Int32 nUid, ::rtl::OUString const & rLocalName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + virtual void SAL_CALL endElement() + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + + inline Frame( + ::rtl::OUString const & rLocalName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + SAL_THROW( () ) + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + {} +private: + css::uno::Reference< css::container::XNameContainer > m_xContainer; +}; + +//============================================================================== +class Page + : public ControlElement +{ +public: + virtual css::uno::Reference< css::xml::input::XElement > + SAL_CALL startChildElement( + sal_Int32 nUid, ::rtl::OUString const & rLocalName, + css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + virtual void SAL_CALL endElement() + throw (css::xml::sax::SAXException, css::uno::RuntimeException); + + inline Page( + ::rtl::OUString const & rLocalName, + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, + ElementBase * pParent, DialogImport * pImport ) + SAL_THROW( () ) + : ControlElement( rLocalName, xAttributes, pParent, pImport ) + { + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ), css::uno::UNO_QUERY ); + } +private: + css::uno::Reference< css::container::XNameContainer > m_xContainer; +}; + + class ProgressBarElement : public ControlElement { @@ -1018,3 +1157,5 @@ public: }; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx index 22c472ac1782..d435883ef8d3 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,6 +42,7 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; namespace xmlscript { @@ -70,7 +72,8 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream() //================================================================================================== Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( Reference< container::XNameContainer > const & xDialogModel, - Reference< XComponentContext > const & xContext ) + Reference< XComponentContext > const & xContext, + Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); @@ -95,16 +98,17 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY ); xSource->setOutputStream( createOutputStream( &aBytes ) ); - exportDialogModel( xHandler, xDialogModel ); + exportDialogModel( xHandler, xDialogModel, xDocument ); return new InputStreamProvider( aBytes ); } //================================================================================================== void SAL_CALL importDialogModel( - Reference< io::XInputStream > xInput, + Reference< io::XInputStream > const & xInput, Reference< container::XNameContainer > const & xDialogModel, - Reference< XComponentContext > const & xContext ) + Reference< XComponentContext > const & xContext, + Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); @@ -126,7 +130,7 @@ void SAL_CALL importDialogModel( } // error handler, entity resolver omitted for this helper function - xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) ); + xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) ); xml::sax::InputSource source; source.aInputStream = xInput; @@ -136,3 +140,5 @@ void SAL_CALL importDialogModel( } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index 1d9e67d23d28..7ff7b289d2c1 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,8 +30,16 @@ #include "precompiled_xmlscript.hxx" #include "exp_share.hxx" +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> - +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <comphelper/componentcontext.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -65,6 +74,118 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style ) } //__________________________________________________________________________________________________ +void ElementDescriptor::readMultiPageModel( StyleBag * all_styles ) +{ + // collect styles + 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("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); + Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) ); + bool bDecoration = sal_True; + if ( (aDecorationAny >>= bDecoration) && !bDecoration ) + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtabs") ), OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) ); + + readEvents(); + uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY ); + if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() ) + { + ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument ); + pElem->readBullitinBoard( all_styles ); + addSubElement( pElem ); + } +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readFrameModel( StyleBag * all_styles ) +{ + // collect styles + Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 ); + + 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) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + OUString aTitle; + + if ( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle) + { + ElementDescriptor * title = new ElementDescriptor( + _xProps, _xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument ); + title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), + aTitle ); + addSubElement( title ); + } + + uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY ); + if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() ) + { + ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument ); + pElem->readBullitinBoard( all_styles ); + addSubElement( pElem ); + } + readEvents(); +} +//__________________________________________________________________________________________________ +void ElementDescriptor::readPageModel( StyleBag * all_styles ) +{ + // collect styles + 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("TextLineColor") ) ) >>= aStyle._textLineColor) + aStyle._set |= 0x20; + if (readFontProps( this, aStyle )) + aStyle._set |= 0x8; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + rtl::OUString aTitle; + readStringAttr( + OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); + uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY ); + if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() ) + { + ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument ); + pElem->readBullitinBoard( all_styles ); + addSubElement( pElem ); + } + readEvents(); +} + void ElementDescriptor::readButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { @@ -98,8 +219,10 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) ); readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + + readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ), @@ -130,7 +253,7 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ); break; default: - OSL_ENSURE( 0, "### unexpected radio state!" ); + OSL_FAIL( "### unexpected radio state!" ); break; } } @@ -169,8 +292,8 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), @@ -199,7 +322,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles ) OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" ); break; default: - OSL_ENSURE( 0, "### unexpected checkbox state!" ); + OSL_FAIL( "### unexpected checkbox state!" ); break; } } @@ -247,6 +370,9 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) ); readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) ); + // Cell Range, Ref Cell etc. + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); + readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ); // string item list Sequence< OUString > itemValues; @@ -255,14 +381,14 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) { ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument ); OUString const * pItemValues = itemValues.getConstArray(); for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos ) { ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument ); item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), pItemValues[ nPos ] ); popup->addSubElement( item ); @@ -308,7 +434,8 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) ); readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); - + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); + readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ); // string item list Sequence< OUString > itemValues; if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) && @@ -316,7 +443,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) { ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument ); OUString const * pItemValues = itemValues.getConstArray(); sal_Int32 nPos; @@ -324,7 +451,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) { ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument ); item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), pItemValues[ nPos ] ); popup->addSubElement( item ); @@ -348,7 +475,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) readEvents(); } //__________________________________________________________________________________________________ -void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) +void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) { // collect styles @@ -379,12 +506,14 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) ); + readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) ); sal_Int16 nState = 0; if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState) @@ -400,10 +529,11 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ); break; default: - OSL_ENSURE( 0, "### unexpected radio state!" ); + OSL_FAIL( "### unexpected radio state!" ); break; } } + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); readEvents(); } //__________________________________________________________________________________________________ @@ -432,7 +562,7 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles ) { ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument ); title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), aTitle ); addSubElement( title ); @@ -573,6 +703,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ), OUString( &cEcho, 1 ) ); } + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); readEvents(); } //__________________________________________________________________________________________________ @@ -595,10 +726,10 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles ) readDefaults(); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) ); - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) ); readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) ); readEvents(); } //__________________________________________________________________________________________________ @@ -1018,6 +1149,45 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) readEvents(); } + +void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles ) + SAL_THROW( (Exception) ) +{ + // collect styles + Style aStyle( 0x1 | 0x4 ); + if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor) + aStyle._set |= 0x1; + if (readBorderProps( this, aStyle )) + aStyle._set |= 0x4; + if (aStyle._set) + { + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), + all_styles->getStyleId( aStyle ) ); + } + + // collect elements + readDefaults(); + readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) ); + readLongAttr( OUSTR("SpinValueMin"), + OUSTR(XMLNS_DIALOGS_PREFIX ":minval") ); + readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) ); + readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") ); + readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) ); + readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); + readEvents(); +} + //__________________________________________________________________________________________________ void ElementDescriptor::readFixedLineModel( StyleBag * all_styles ) SAL_THROW( (Exception) ) @@ -1111,6 +1281,7 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles ) OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) ); readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) ); + readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ); readEvents(); } //__________________________________________________________________________________________________ @@ -1159,11 +1330,255 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles ) if ( (aDecorationAny >>= bDecoration) && !bDecoration ) addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ), OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) ); + readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); + readEvents(); +} - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) ); +void ElementDescriptor::readBullitinBoard( StyleBag * all_styles ) + SAL_THROW( (Exception) ) +{ + // collect elements + ::std::vector< ElementDescriptor* > all_elements; + // read out all props + Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY ); + if ( !xDialogModel.is() ) + return; // #TODO throw??? + Sequence< OUString > aElements( xDialogModel->getElementNames() ); + OUString const * pElements = aElements.getConstArray(); - readEvents(); + ElementDescriptor * pRadioGroup = 0; + + sal_Int32 nPos; + for ( nPos = 0; nPos < aElements.getLength(); ++nPos ) + { + Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) ); + Reference< beans::XPropertySet > xProps; + OSL_VERIFY( aControlModel >>= xProps ); + if (! xProps.is()) + continue; + Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); + OSL_ENSURE( xPropState.is(), "no XPropertyState!" ); + if (! xPropState.is()) + continue; + Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY ); + OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" ); + if (! xServiceInfo.is()) + continue; + + ElementDescriptor * pElem = 0; + + // group up radio buttons + if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) + { + if (! pRadioGroup) // open radiogroup + { + pRadioGroup = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ), _xDocument ); + all_elements.push_back( pRadioGroup ); + } + + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ), _xDocument ); + pElem->readRadioButtonModel( all_styles ); + pRadioGroup->addSubElement( pElem ); + } + else // no radio + { + pRadioGroup = 0; // close radiogroup + + if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ), _xDocument ); + pElem->readButtonModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ), _xDocument ); + pElem->readCheckBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ), _xDocument ); + pElem->readComboBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ), _xDocument ); + pElem->readListBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ), _xDocument ); + pElem->readGroupBoxModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ), _xDocument ); + pElem->readMultiPageModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":frame") ), _xDocument ); + pElem->readFrameModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ), _xDocument ); + pElem->readPageModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ), _xDocument ); + pElem->readFixedTextModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ), _xDocument ); + pElem->readEditModel( all_styles ); + } + // FixedHyperLink + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ), _xDocument ); + pElem->readFixedHyperLinkModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ), _xDocument ); + pElem->readImageControlModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ), _xDocument ); + pElem->readFileControlModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ), _xDocument ); + pElem->readTreeControlModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ), _xDocument ); + pElem->readCurrencyFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ), _xDocument ); + pElem->readDateFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ), _xDocument ); + pElem->readNumericFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) , _xDocument); + pElem->readTimeFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ), _xDocument ); + pElem->readPatternFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ), _xDocument ); + pElem->readFormattedFieldModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ), _xDocument ); + pElem->readFixedLineModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ), _xDocument ); + pElem->readScrollBarModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ), _xDocument ); + pElem->readSpinButtonModel( all_styles ); + } + else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) + { + pElem = new ElementDescriptor( + xProps, xPropState, + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ), _xDocument ); + pElem->readProgressBarModel( all_styles ); + } + + if (pElem) + { + all_elements.push_back( pElem ); + } + else + { + OSL_FAIL( "unknown control type!" ); + continue; + } + } + } + if (! all_elements.empty()) + { + for ( std::size_t n = 0; n < all_elements.size(); ++n ) + { + addSubElement( all_elements[ n ] ); + } + } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 365355375808..2dce75b26f67 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,6 +47,8 @@ #include <com/sun/star/awt/PushButtonType.hpp> #include <com/sun/star/awt/VisualEffect.hpp> +#include <com/sun/star/io/XPersistObject.hpp> + #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/script/ScriptEventDescriptor.hpp> @@ -57,6 +60,17 @@ #include <com/sun/star/view/SelectionType.hpp> +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> + +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -146,7 +160,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() break; } default: - OSL_ENSURE( 0, "### unexpected border value!" ); + OSL_FAIL( "### unexpected border value!" ); break; } } @@ -169,7 +183,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUSTR("simple") ); break; default: - OSL_ENSURE( 0, "### unexpected visual effect value!" ); + OSL_FAIL( "### unexpected visual effect value!" ); break; } } @@ -233,7 +247,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-family!" ); + OSL_FAIL( "### unexpected font-family!" ); break; } } @@ -283,7 +297,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("symbol") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-charset!" ); + OSL_FAIL( "### unexpected font-charset!" ); break; } } @@ -301,7 +315,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("variable") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-pitch!" ); + OSL_FAIL( "### unexpected font-pitch!" ); break; } } @@ -339,7 +353,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_italic") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-slant!" ); + OSL_FAIL( "### unexpected font-slant!" ); break; } } @@ -417,7 +431,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("boldwave") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-underline!" ); + OSL_FAIL( "### unexpected font-underline!" ); break; } } @@ -447,7 +461,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-strikeout!" ); + OSL_FAIL( "### unexpected font-strikeout!" ); break; } } @@ -487,7 +501,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("scalable") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-type!" ); + OSL_FAIL( "### unexpected font-type!" ); break; } } @@ -509,7 +523,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("engraved") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-relief!" ); + OSL_FAIL( "### unexpected font-relief!" ); break; } // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED @@ -548,7 +562,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() OUString( RTL_CONSTASCII_USTRINGPARAM("below") ) ); break; default: - OSL_ENSURE( 0, "### unexpected font-emphasismark!" ); + OSL_FAIL( "### unexpected font-emphasismark!" ); break; } } @@ -612,7 +626,7 @@ void ElementDescriptor::readStringAttr( if (a >>= v) addAttribute( rAttrName, v ); else - OSL_ENSURE( 0, "### unexpected property type!" ); + OSL_FAIL( "### unexpected property type!" ); } } @@ -680,7 +694,7 @@ void ElementDescriptor::readDateFormatAttr( OUString const & rPropName, OUString addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD_DIN5008") ) ); break; default: - OSL_ENSURE( 0, "### unexpected date format!" ); + OSL_FAIL( "### unexpected date format!" ); break; } } @@ -715,7 +729,7 @@ void ElementDescriptor::readTimeFormatAttr( OUString const & rPropName, OUString addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_long") ) ); break; default: - OSL_ENSURE( 0, "### unexpected time format!" ); + OSL_FAIL( "### unexpected time format!" ); break; } } @@ -741,7 +755,7 @@ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString cons addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) ); break; default: - OSL_ENSURE( 0, "### illegal alignment value!" ); + OSL_FAIL( "### illegal alignment value!" ); break; } } @@ -769,13 +783,40 @@ void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUStr addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) ); break; default: - OSL_ENSURE( 0, "### illegal vertical alignment value!" ); + OSL_FAIL( "### illegal vertical alignment value!" ); break; } } } } //__________________________________________________________________________________________________ +void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString const & rAttrName ) +{ + if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) + { + rtl::OUString sURL; + _xProps->getPropertyValue( rPropName ) >>= sURL; + + if ( sURL.getLength() && sURL.compareToAscii( XMLSCRIPT_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( XMLSCRIPT_GRAPHOBJ_URLPREFIX ) ) == 0 ) + { + Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY ); + if ( xDocStorage.is() ) + { + uno::Sequence< Any > aArgs( 1 ); + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage(); + + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver; + aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver ); + if ( xGraphicResolver.is() ) + sURL = xGraphicResolver->resolveGraphicObjectURL( sURL ); + } + } + if ( sURL.getLength() ) + addAttribute( rAttrName, sURL ); + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) @@ -798,7 +839,7 @@ void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) ); break; default: - OSL_ENSURE( 0, "### illegal image alignment value!" ); + OSL_FAIL( "### illegal image alignment value!" ); break; } } @@ -854,7 +895,7 @@ void ElementDescriptor::readImagePositionAttr( OUString const & rPropName, OUStr addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) ); break; default: - OSL_ENSURE( 0, "### illegal image position value!" ); + OSL_FAIL( "### illegal image position value!" ); break; } } @@ -883,7 +924,7 @@ void ElementDescriptor::readButtonTypeAttr( OUString const & rPropName, OUString addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("help") ) ); break; default: - OSL_ENSURE( 0, "### illegal button-type value!" ); + OSL_FAIL( "### illegal button-type value!" ); break; } } @@ -906,7 +947,7 @@ void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUStrin addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("vertical") ) ); break; default: - OSL_ENSURE( 0, "### illegal orientation value!" ); + OSL_FAIL( "### illegal orientation value!" ); break; } } @@ -932,13 +973,73 @@ void ElementDescriptor::readLineEndFormatAttr( OUString const & rPropName, OUStr addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return-line-feed") ) ); break; default: - OSL_ENSURE( 0, "### illegal line end format value!" ); + OSL_FAIL( "### illegal line end format value!" ); break; } } } } //__________________________________________________________________________________________________ +void ElementDescriptor::readDataAwareAttr( OUString const & rAttrName ) +{ + Reference< lang::XMultiServiceFactory > xFac; + if ( _xDocument.is() ) + xFac.set( _xDocument, uno::UNO_QUERY ); + + Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY ); + + if ( xFac.is() && xBinding.is() && rAttrName.equals( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ) ) + { + try + { + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY ); + if ( xBindable.is() ) + { + table::CellAddress aAddress; + xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress; + xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) ); + rtl::OUString sAddress; + xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress; + if ( sAddress.getLength() > 0 ) + addAttribute( rAttrName, sAddress ); + + OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() ); + + } + } + catch( uno::Exception& ) + { + } + } + Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY ); + if ( xEntrySink.is() && rAttrName.equals( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ) ) + { + Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY ); + if ( xListSource.is() ) + { + try + { + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY ); + + table::CellRangeAddress aAddress; + xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress; + + rtl::OUString sAddress; + xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) ); + xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress; + OSL_TRACE("**** cell range source list %s", + rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() ); + if ( sAddress.getLength() > 0 ) + addAttribute( rAttrName, sAddress ); + } + catch( uno::Exception& ) + { + } + } + } +} +//__________________________________________________________________________________________________ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUString const & rAttrName ) { if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName )) @@ -965,7 +1066,7 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("range") ) ); break; default: - OSL_ENSURE( 0, "### illegal selection type value!" ); + OSL_FAIL( "### illegal selection type value!" ); break; } } @@ -975,6 +1076,28 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible ) { Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) ); + + // The following is a hack to allow 'form' controls to override the default + // control supported by dialogs. This should work well for both vba support and + // normal openoffice ( when normal 'Dialogs' decide to support form control models ) + // In the future VBA support might require custom models ( and not the just the form + // variant of a control that we currently use ) In this case the door is still open, + // we just need to define a new way for the 'ServiceName' to be extracted from the + // incomming model. E.g. the use of supporting service + // "com.sun.star.form.FormComponent", 'ServiceName' and XPersistObject + // is only an implementation detail here, in the future some other + // method ( perhaps a custom prop ) could be used instead. + Reference< lang::XServiceInfo > xSrvInfo( _xProps, UNO_QUERY ); + if ( xSrvInfo.is() && xSrvInfo->supportsService( OUSTR("com.sun.star.form.FormComponent" ) ) ) + { + Reference< io::XPersistObject > xPersist( _xProps, UNO_QUERY ); + if ( xPersist.is() ) + { + OUString sCtrlName = xPersist->getServiceName(); + if ( sCtrlName.getLength() ) + addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":control-implementation") ), sCtrlName ); + } + } addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ), * reinterpret_cast< const OUString * >( a.getValue() ) ); readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ), @@ -991,7 +1114,7 @@ void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible } else { - OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" ); + OSL_FAIL( "unexpected property type for \"Enabled\": not bool!" ); } sal_Bool bVisible = sal_True; @@ -1180,7 +1303,7 @@ void ElementDescriptor::readEvents() } else { - OSL_ENSURE( 0, "### unexpected event type in container!" ); + OSL_FAIL( "### unexpected event type in container!" ); } } } @@ -1325,236 +1448,22 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu //================================================================================================== void SAL_CALL exportDialogModel( Reference< xml::sax::XExtendedDocumentHandler > const & xOut, - Reference< container::XNameContainer > const & xDialogModel ) + Reference< container::XNameContainer > const & xDialogModel, + Reference< frame::XModel > const & xDocument ) SAL_THROW( (Exception) ) { StyleBag all_styles; - ::std::vector< Reference< xml::sax::XAttributeList > > all_elements; - - // read out all props - - Sequence< OUString > aElements( xDialogModel->getElementNames() ); - OUString const * pElements = aElements.getConstArray(); - - ElementDescriptor * pRadioGroup = 0; + // window + Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY ); + OSL_ASSERT( xProps.is() ); + Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); + OSL_ASSERT( xPropState.is() ); - sal_Int32 nPos; - for ( nPos = 0; nPos < aElements.getLength(); ++nPos ) - { - Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) ); - Reference< beans::XPropertySet > xProps; - OSL_VERIFY( aControlModel >>= xProps ); - if (! xProps.is()) - continue; - Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY ); - OSL_ENSURE( xPropState.is(), "no XPropertyState!" ); - if (! xPropState.is()) - continue; - Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY ); - OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" ); - if (! xServiceInfo.is()) - continue; - - ElementDescriptor * pElem = 0; - Reference< xml::sax::XAttributeList > xElem; - - // group up radio buttons - if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) - { - if (! pRadioGroup) // open radiogroup - { - pRadioGroup = new ElementDescriptor( + ElementDescriptor * pElem = new ElementDescriptor( xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ) ); - all_elements.push_back( pRadioGroup ); - } - - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readRadioButtonModel( &all_styles ); - pRadioGroup->addSubElement( xElem ); - } - else // no radio - { - pRadioGroup = 0; // close radiogroup - - if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readButtonModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readCheckBoxModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readComboBoxModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readListBoxModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readGroupBoxModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFixedTextModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readEditModel( &all_styles ); - } - // FixedHyperLink - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFixedHyperLinkModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readImageControlModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFileControlModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readTreeControlModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readCurrencyFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readDateFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readNumericFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readTimeFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readPatternFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFormattedFieldModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readFixedLineModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readScrollBarModel( &all_styles ); - } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) - { - pElem = new ElementDescriptor( - xProps, xPropState, - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ) ); - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readProgressBarModel( &all_styles ); - } - // - - OSL_ASSERT( xElem.is() ); - if (xElem.is()) - { - all_elements.push_back( xElem ); - } - else - { - OSL_ENSURE( sal_False, "unknown control type!" ); - continue; - } - } - } + OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), xDocument ); + Reference< xml::sax::XAttributeList > xElem( pElem ); + pElem->readBullitinBoard( &all_styles ); xOut->startDocument(); @@ -1564,14 +1473,9 @@ void SAL_CALL exportDialogModel( xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); - // 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 ); + ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName, xDocument ); Reference< xml::sax::XAttributeList > xWindow( pWindow ); pWindow->readDialogModel( &all_styles ); xOut->ignorableWhitespace( OUString() ); @@ -1581,20 +1485,14 @@ void SAL_CALL exportDialogModel( // dump out stylebag all_styles.dump( xOut ); - if (! all_elements.empty()) + if ( xDialogModel->getElementNames().getLength() ) { // 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 ( std::size_t n = 0; n < all_elements.size(); ++n ) - { - ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ n ].get() ); - pElem->dump( xOut.get() ); - } + xOut->startElement( aBBoardName, xElem ); + pElem->dumpSubElements( xOut.get() ); // end bulletinboard xOut->ignorableWhitespace( OUString() ); xOut->endElement( aBBoardName ); @@ -1608,3 +1506,5 @@ void SAL_CALL exportDialogModel( } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index a0968eb007d5..2aa541b08efd 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlscript.hxx" #include "imp_share.hxx" - +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> - +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using ::rtl::OUString; @@ -40,6 +50,198 @@ using ::rtl::OUString; namespace xmlscript { +Reference< xml::input::XElement > Frame::startChildElement( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::input::XAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + if ( !m_xContainer.is() ) + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ), UNO_QUERY ); + // event + if (_pImport->isEventElement( nUid, rLocalName )) + { + return new EventElement( + nUid, rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) + { + // Create new DialogImport for this container + DialogImport* pFrameImport = new DialogImport( *_pImport ); + pFrameImport->_xDialogModel = m_xContainer; + return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") )) + { + getStringAttr( &_label, + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + xAttributes, + _pImport->XMLNS_DIALOGS_UID ); + + return new ElementBase( + _pImport->XMLNS_DIALOGS_UID, + rLocalName, xAttributes, this, _pImport ); + } + else + { + OSL_TRACE("****** ARGGGGG!!!! **********"); + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ + +void Frame::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + if ( !m_xContainer.is() ) + m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ), UNO_QUERY ); + Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); + // _pImport is what we need to add to ( e.g. the dialog in this case ) + ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) ); + + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + } + + ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement + if (_label.getLength()) + { + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ), + makeAny( _label ) ); + } + ctx.importEvents( _events ); + // avoid ring-reference: + // vector< event elements > holding event elements holding this (via _pParent) + _events.clear(); +} + +//=== +Reference< xml::input::XElement > MultiPage::startChildElement( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::input::XAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + // event +rtl::OUString _label(RTL_CONSTASCII_USTRINGPARAM("foo")); + if (_pImport->isEventElement( nUid, rLocalName )) + { + return new EventElement( + nUid, rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) + { + // Create new DialogImport for this container + + DialogImport* pMultiPageImport = new DialogImport( *_pImport ); + pMultiPageImport->_xDialogModel = m_xContainer; + return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport ); + } + else + { + + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ + +void MultiPage::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); + // _pImport is what we need to add to ( e.g. the dialog in this case ) + ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes )); + + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + pStyle->importBackgroundColorStyle( xControlModel ); + } + + ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), + _xAttributes ); + ctx.importBooleanProperty( + OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("withtabs") ), + _xAttributes ); + ctx.importEvents( _events ); + // avoid ring-reference: + // vector< event elements > holding event elements holding this (via _pParent) + _events.clear(); +} + +Reference< xml::input::XElement > Page::startChildElement( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::input::XAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + // event + if (_pImport->isEventElement( nUid, rLocalName )) + { + return new EventElement( + nUid, rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) + { + + DialogImport* pPageImport = new DialogImport( *_pImport ); + pPageImport->_xDialogModel = m_xContainer; + return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport ); + } + else + { + + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ + +void Page::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); + + ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes )); + + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + pStyle->importTextColorStyle( xControlModel ); + pStyle->importTextLineColorStyle( xControlModel ); + pStyle->importFontStyle( xControlModel ); + pStyle->importBackgroundColorStyle( xControlModel ); + } + + ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement + 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) + _events.clear(); +} + // progessmeter //__________________________________________________________________________________________________ Reference< xml::input::XElement > ProgressBarElement::startChildElement( @@ -121,7 +323,7 @@ void ScrollBarElement::endElement() { ControlImportContext ctx( _pImport, getControlId( _xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ), _xAttributes ) ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -165,6 +367,72 @@ void ScrollBarElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), _xAttributes ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); + ctx.importEvents( _events ); + // avoid ring-reference: + // vector< event elements > holding event elements holding this (via _pParent) + _events.clear(); +} + +//################################################################################################## + +// spinbutton +//__________________________________________________________________________________________________ +Reference< xml::input::XElement > SpinButtonElement::startChildElement( + sal_Int32 nUid, OUString const & rLocalName, + Reference< xml::input::XAttributes > const & xAttributes ) + throw (xml::sax::SAXException, RuntimeException) +{ + // event + if (_pImport->isEventElement( nUid, rLocalName )) + { + return new EventElement( nUid, rLocalName, xAttributes, this, _pImport ); + } + else + { + throw xml::sax::SAXException( + OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), + Reference< XInterface >(), Any() ); + } +} +//__________________________________________________________________________________________________ +void SpinButtonElement::endElement() + throw (xml::sax::SAXException, RuntimeException) +{ + ControlImportContext ctx( + _pImport, getControlId( _xAttributes ), + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ), _xAttributes ) ); + + Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); + if (xStyle.is()) + { + StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); + Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); + pStyle->importBackgroundColorStyle( xControlModel ); + pStyle->importBorderStyle( xControlModel ); + } + + ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes ); + ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ), + _xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),_xAttributes ); + ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ), _xAttributes ); + ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"), + _xAttributes ); + ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"), _xAttributes ); + ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"), +_xAttributes ); + ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), _xAttributes ); + ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ), _xAttributes ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -454,7 +722,7 @@ void FormattedFieldElement::endElement() } catch (util::MalformedNumberFormatException & exc) { - OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" ); + OSL_FAIL( "### util::MalformedNumberFormatException occurred!" ); // rethrow throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() ); } @@ -467,6 +735,7 @@ void FormattedFieldElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ), _xAttributes ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -1003,9 +1272,10 @@ void ImageControlElement::endElement() ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ), OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ), _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("src") ), - _xAttributes ); + rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) ); + Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY ); + + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "src" ), _xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ), OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ), _xAttributes ); @@ -1341,7 +1611,7 @@ void TitledBoxElement::endElement() ControlImportContext ctx( _pImport, getControlId( xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ), xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); @@ -1368,15 +1638,16 @@ void TitledBoxElement::endElement() ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ), + xAttributes ); sal_Int16 nVal = 0; sal_Bool bChecked = sal_False; @@ -1390,7 +1661,7 @@ void TitledBoxElement::endElement() } xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); - + ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes ); ::std::vector< Reference< xml::input::XElement > > * radioEvents = static_cast< RadioElement * >( xRadio.get() )->getEvents(); ctx.importEvents( *radioEvents ); @@ -1469,7 +1740,7 @@ void RadioGroupElement::endElement() ControlImportContext ctx( _pImport, getControlId( xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ), xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); @@ -1496,15 +1767,16 @@ void RadioGroupElement::endElement() ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), xAttributes ); ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ), OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ), xAttributes ); + ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ), + OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ), + xAttributes ); sal_Int16 nVal = 0; sal_Bool bChecked = sal_False; if (getBoolAttr( &bChecked, @@ -1518,6 +1790,8 @@ void RadioGroupElement::endElement() xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) ); + ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes ); + ::std::vector< Reference< xml::input::XElement > > * radioEvents = static_cast< RadioElement * >( xRadio.get() )->getEvents(); ctx.importEvents( *radioEvents ); @@ -1640,7 +1914,8 @@ void MenuListElement::endElement() { ControlImportContext ctx( _pImport, getControlId( _xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ); + + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ), _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1673,14 +1948,16 @@ void MenuListElement::endElement() ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); - + bool bHasLinkedCell = ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); + bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes ); if (_popup.is()) { MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), - makeAny( p->getItemValues() ) ); - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), - makeAny( p->getSelectedItems() ) ); + if ( !bHasSrcRange ) + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), makeAny( p->getItemValues() ) ); + if ( !bHasLinkedCell ) + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ), makeAny( p->getSelectedItems() ) ); + } ctx.importEvents( _events ); // avoid ring-reference: @@ -1727,7 +2004,7 @@ void ComboBoxElement::endElement() { ControlImportContext ctx( _pImport, getControlId( _xAttributes ), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ); + getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ), _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1769,8 +2046,9 @@ void ComboBoxElement::endElement() ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ), OUString( RTL_CONSTASCII_USTRINGPARAM("align") ), _xAttributes ); - - if (_popup.is()) + ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes ); + bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes ); + if (_popup.is() && !bHasSrcRange ) { MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() ); xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ), @@ -1837,9 +2115,7 @@ void CheckBoxElement::endElement() ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ), OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ), _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - _xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), _xAttributes ); @@ -1940,9 +2216,7 @@ void ButtonElement::endElement() ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ), OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ), _xAttributes ); - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - _xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ), OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ), _xAttributes ); @@ -2096,11 +2370,28 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement( { return new ScrollBarElement( rLocalName, xAttributes, this, _pImport ); } + // spinbutton + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) ) + { + return new SpinButtonElement( rLocalName, xAttributes, this, _pImport ); + } // progressmeter else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") )) { return new ProgressBarElement( rLocalName, xAttributes, this, _pImport ); } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") )) + { + return new MultiPage( rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("frame") )) + { + return new Frame( rLocalName, xAttributes, this, _pImport ); + } + else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("page") )) + { + return new Page( rLocalName, xAttributes, this, _pImport ); + } // bulletinboard else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) { @@ -2276,10 +2567,7 @@ void WindowElement::endElement() OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ), OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ), _xAttributes ); - ctx.importStringProperty( - OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ), - _xAttributes ); + ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes ); ctx.importEvents( _events ); // avoid ring-reference: // vector< event elements > holding event elements holding this (via _pParent) @@ -2287,3 +2575,5 @@ void WindowElement::endElement() } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index d19e83a3526b..8e3b28dafcb9 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,9 +58,23 @@ #include <com/sun/star/script/ScriptEventDescriptor.hpp> #include <com/sun/star/view/SelectionType.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> + +#include <comphelper/componentcontext.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; using ::rtl::OUString; namespace xmlscript @@ -124,6 +139,20 @@ OUString ControlElement::getControlId( return aId; } +OUString ControlElement::getControlModelName( + OUString const& rDefaultModel, + Reference< xml::input::XAttributes > const & xAttributes ) +{ + OUString aModel; + aModel = xAttributes->getValueByUidName( + _pImport->XMLNS_DIALOGS_UID, + OUString( RTL_CONSTASCII_USTRINGPARAM("control-implementation") ) ); + if (! aModel.getLength()) + aModel = rDefaultModel; + return aModel; +} + + //################################################################################################## //__________________________________________________________________________________________________ @@ -815,6 +844,7 @@ bool ImportContext::importDoubleProperty( } return false; } + //__________________________________________________________________________________________________ bool ImportContext::importBooleanProperty( OUString const & rPropName, OUString const & rAttrName, @@ -966,6 +996,115 @@ bool ImportContext::importVerticalAlignProperty( return false; } //__________________________________________________________________________________________________ +bool ImportContext::importImageURLProperty( + OUString const & rPropName, OUString const & rAttrName, + Reference< xml::input::XAttributes > const & xAttributes ) +{ + rtl::OUString sURL = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rAttrName ); + if ( sURL.getLength() ) + { + Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY ); + + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver; + if ( xDocStorage.is() ) + { + uno::Sequence< Any > aArgs( 1 ); + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage(); + ::comphelper::ComponentContext aContext( _pImport->getComponentContext() ); + aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver ); + if ( xGraphicResolver.is() ) + { + rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ); + aTmp += sURL; + try + { + aTmp = xGraphicResolver->resolveGraphicObjectURL( aTmp ); + if ( aTmp.getLength() ) + sURL = aTmp; + } + catch( uno::Exception& e ) + { + (void)e; + return false; + } + + } + } + if ( sURL.getLength() > 0 ) + { + Reference< beans::XPropertySet > xProps( getControlModel(), UNO_QUERY ); + if ( xProps.is() ) + { + xProps->setPropertyValue( rPropName, makeAny( sURL ) ); + return true; + } + } + } + return false; +} +//__________________________________________________________________________________________________ + bool ImportContext::importDataAwareProperty( + ::rtl::OUString const & rPropName, + Reference<xml::input::XAttributes> const & xAttributes ) +{ + OUString sLinkedCell; + OUString sCellRange; + if ( rPropName.equals( OUSTR("linked-cell" ) ) ) + sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rPropName ); + if ( rPropName.equals( OUSTR( "source-cell-range" ) ) ) + sCellRange = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rPropName ); + bool bRes = false; + Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY ); + if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) ) + { + // Set up Celllink + if ( sLinkedCell.getLength() ) + { + Reference< form::binding::XBindableValue > xBindable( getControlModel(), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY ); + if ( xBindable.is() && xConvertor.is() ) + { + table::CellAddress aAddress; + xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) ); + xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress; + beans::NamedValue aArg1; + aArg1.Name = OUSTR("BoundCell"); + aArg1.Value <<= aAddress; + + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= aArg1; + + uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY ); + xBindable->setValueBinding( xBinding ); + bRes = true; + } + } + // Set up CelllRange + if ( sCellRange.getLength() ) + { + Reference< form::binding::XListEntrySink > xListEntrySink( getControlModel(), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY ); + if ( xListEntrySink.is() && xConvertor.is() ) + { + table::CellRangeAddress aAddress; + xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) ); + xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress; + beans::NamedValue aArg1; + aArg1.Name = OUSTR("CellRange"); + aArg1.Value <<= aAddress; + + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= aArg1; + + uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY ); + xListEntrySink->setListEntrySource( xSource ); + bRes = true; + } + } + } + return bRes; +} +//__________________________________________________________________________________________________ bool ImportContext::importImageAlignProperty( OUString const & rPropName, OUString const & rAttrName, Reference< xml::input::XAttributes > const & xAttributes ) @@ -1871,35 +2010,58 @@ void DialogImport::addStyle( Reference< xml::input::XElement > const & xStyle ) SAL_THROW( () ) { - _styleNames.push_back( rStyleId ); - _styles.push_back( xStyle ); + (*_pStyleNames).push_back( rStyleId ); + (*_pStyles).push_back( xStyle ); } //__________________________________________________________________________________________________ Reference< xml::input::XElement > DialogImport::getStyle( OUString const & rStyleId ) const SAL_THROW( () ) { - for ( size_t nPos = 0; nPos < _styleNames.size(); ++nPos ) + for ( size_t nPos = 0; nPos < (*_pStyleNames).size(); ++nPos ) { - if (_styleNames[ nPos ] == rStyleId) + if ( (*_pStyleNames)[ nPos ] == rStyleId) { - return _styles[ nPos ]; + return (*_pStyles)[ nPos ]; } } return 0; } +//__________________________________________________________________________________________________ +Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer() +{ + if( !_xScriptLibraryContainer.is() ) + { + try + { + Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY ); + if( xProps.is() ) + _xScriptLibraryContainer.set( xProps->getPropertyValue( OUSTR("BasicLibraries") ), UNO_QUERY ); + } + catch( const Exception& ) + { + } + } + + return _xScriptLibraryContainer; +} //################################################################################################## //================================================================================================== Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel( Reference< container::XNameContainer > const & xDialogModel, - Reference< XComponentContext > const & xContext ) + Reference< XComponentContext > const & xContext, + Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { - return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( - new DialogImport( xContext, xDialogModel ) ) ); + // single set of styles and stylenames apply to all containees + :: boost::shared_ptr< ::std::vector< ::rtl::OUString > > pStyleNames( new ::std::vector< ::rtl::OUString > ); + :: boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > pStyles( new ::std::vector< css::uno::Reference< css::xml::input::XElement > > ); + return ::xmlscript::createDocumentHandler( + static_cast< xml::input::XRoot * >( + new DialogImport( xContext, xDialogModel, pStyleNames, pStyles, xDocument ) ) ); } - } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx index cfb8de1c1f1e..b6e31ba7951b 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -549,3 +550,5 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& / //......................................................................... } // namespace xmlscript //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx index 452dceb84e12..bd425b0f0aad 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -130,3 +131,5 @@ namespace xmlscript //......................................................................... #endif // XMLSCRIPT_XMLBAS_EXPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx index e4e966189a98..eb9662fe5121 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -929,3 +930,5 @@ void BasicImport::setDocumentLocator( const Reference< xml::sax::XLocator >& /*x //......................................................................... } // namespace xmlscript //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx b/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx index 6c11b197722a..96567f3e2eb5 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_import.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_ #include <com/sun/star/script/XLibraryContainer2.hpp> -#endif #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/xml/input/XRoot.hpp> #include <cppuhelper/implbase1.hxx> @@ -345,3 +344,5 @@ namespace xmlscript //......................................................................... #endif // XMLSCRIPT_XMLBAS_IMPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmllib_imexp/imp_share.hxx b/xmlscript/source/xmllib_imexp/imp_share.hxx index 329f166a1314..1cfa25525a3e 100644 --- a/xmlscript/source/xmllib_imexp/imp_share.hxx +++ b/xmlscript/source/xmllib_imexp/imp_share.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,6 @@ using namespace ::com::sun::star::uno; namespace xmlscript { -// inline sal_Int32 toInt32( OUString const & rStr ) SAL_THROW( () ) { sal_Int32 nVal; @@ -261,3 +261,5 @@ public: }; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmllib_imexp/xmllib_export.cxx b/xmlscript/source/xmllib_imexp/xmllib_export.cxx index 1e21dc49ea32..7684cef4fe8e 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_export.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_export.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,8 @@ using namespace com::sun::star::uno; using namespace com::sun::star; -using namespace rtl; + +using ::rtl::OUString; namespace xmlscript { @@ -174,3 +176,4 @@ SAL_CALL exportLibrary( } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmllib_imexp/xmllib_import.cxx b/xmlscript/source/xmllib_imexp/xmllib_import.cxx index 9ea6f121dbc5..2be008de582c 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -370,3 +371,5 @@ LibDescriptorArray::~LibDescriptorArray() } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlmod_imexp/imp_share.hxx b/xmlscript/source/xmlmod_imexp/imp_share.hxx index b5b42fc56625..3e63aa7a4e3e 100644 --- a/xmlscript/source/xmlmod_imexp/imp_share.hxx +++ b/xmlscript/source/xmlmod_imexp/imp_share.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,3 +142,5 @@ public: //================================================================================================== } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx index 781d2d779dda..aeb39a6df1ef 100644 --- a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx +++ b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,8 @@ using namespace com::sun::star::uno; using namespace com::sun::star; -using namespace rtl; + +using ::rtl::OUString; namespace xmlscript { @@ -78,3 +80,4 @@ SAL_CALL exportScriptModule( } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx index 2c2fe2c028f8..ab64e9eddb61 100644 --- a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx +++ b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -228,3 +229,4 @@ SAL_CALL importScriptModule( ModuleDescriptor& rMod ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx index 04ed371df676..100a3972101b 100644 --- a/xmlscript/test/imexp.cxx +++ b/xmlscript/test/imexp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,7 +95,7 @@ Reference< XComponentContext > createInitialComponentContext( catch( Exception& rExc ) { OString aStr( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( 0, aStr.getStr() ); + OSL_FAIL( aStr.getStr() ); } return xContext; @@ -177,7 +178,7 @@ void MyApp::Main() { if (GetCommandLineParamCount() < 2) { - OSL_ENSURE( 0, "usage: imexp inst_dir inputfile [outputfile]\n" ); + OSL_FAIL( "usage: imexp inst_dir inputfile [outputfile]\n" ); return; } @@ -225,12 +226,12 @@ void MyApp::Main() aStr += OString( " >>> " ); aStr += OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ); } - OSL_ENSURE( 0, aStr.getStr() ); + OSL_FAIL( aStr.getStr() ); } catch (uno::Exception & rExc) { OString aStr( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( 0, aStr.getStr() ); + OSL_FAIL( aStr.getStr() ); } Reference< lang::XComponent > xComp( xContext, UNO_QUERY ); @@ -240,3 +241,4 @@ void MyApp::Main() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/test/makefile.mk b/xmlscript/test/makefile.mk index 2bf8f2116106..2bf8f2116106 100644..100755 --- a/xmlscript/test/makefile.mk +++ b/xmlscript/test/makefile.mk diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml index 7b0f9e802741..7b0f9e802741 100644..100755 --- a/xmlscript/test/test.xml +++ b/xmlscript/test/test.xml diff --git a/xmlscript/util/xcr.component b/xmlscript/util/xcr.component index 5ffe7f862fd7..5ffe7f862fd7 100644..100755 --- a/xmlscript/util/xcr.component +++ b/xmlscript/util/xcr.component |