diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-10-16 06:57:26 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-10-16 06:57:26 +0000 |
commit | ae562e931a98e708a75e8d140cf1ff24854acfc7 (patch) | |
tree | 4ccb1ec3b4d4a9157e03f949d62b6687b8aa88eb /xmlscript | |
parent | 7bf29c44efa5985f59c160ba5a75dc212f955d42 (diff) |
CWS-TOOLING: integrate CWS odbmacros3
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/source/xmlflat_imexp/xmlbas_export.cxx | 18 | ||||
-rw-r--r-- | xmlscript/source/xmlflat_imexp/xmlbas_import.cxx | 17 |
2 files changed, 25 insertions, 10 deletions
diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx index 32234fbe369a..d847ec891b3b 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xmlbas_export.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.10.1 $ * * This file is part of OpenOffice.org. * @@ -35,13 +35,10 @@ #include "xmlscript/xml_helper.hxx" #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> -#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_ #include <com/sun/star/script/XLibraryContainer2.hpp> -#endif #include <com/sun/star/script/XLibraryContainerPassword.hpp> -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ +#include <com/sun/star/document/XEmbeddedScripts.hpp> #include <cppuhelper/implementationentry.hxx> -#endif using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -253,13 +250,22 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& / m_xHandler->startElement( aLibContElementName, xLibContAttribs ); Reference< script::XLibraryContainer2 > xLibContainer; - if ( m_xModel.is() ) + + // try the XEmbeddedScripts interface + Reference< document::XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY ); + if ( xDocumentScripts.is() ) + xLibContainer.set( xDocumentScripts->getBasicLibraries().get() ); + + if ( !xLibContainer.is() ) { + // try the "BasicLibraries" property (old-style, for compatibility) Reference< beans::XPropertySet > xPSet( m_xModel, UNO_QUERY ); if ( xPSet.is() ) xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ) >>= xLibContainer; } + OSL_ENSURE( xLibContainer.is(), "XMLBasicExporterBase::filter: nowhere to export to!" ); + if ( xLibContainer.is() ) { Sequence< ::rtl::OUString > aLibNames = xLibContainer->getElementNames(); diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx index d801c1fc9e88..fd339440394b 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_import.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xmlbas_import.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.10.1 $ * * This file is part of OpenOffice.org. * @@ -36,9 +36,8 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ +#include <com/sun/star/document/XEmbeddedScripts.hpp> #include <cppuhelper/implementationentry.hxx> -#endif using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -582,12 +581,22 @@ void BasicImport::setDocumentLocator( const Reference< xml::sax::XLocator >& /*x else if ( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "libraries" ) ) ) { Reference< script::XLibraryContainer2 > xLibContainer; - if ( m_xModel.is() ) + + // try the XEmbeddedScripts interface + Reference< document::XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY ); + if ( xDocumentScripts.is() ) + xLibContainer.set( xDocumentScripts->getBasicLibraries().get() ); + + if ( !xLibContainer.is() ) { + // try the "BasicLibraries" property (old-style, for compatibility) Reference< beans::XPropertySet > xPSet( m_xModel, UNO_QUERY ); if ( xPSet.is() ) xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ) >>= xLibContainer; } + + OSL_ENSURE( xLibContainer.is(), "BasicImport::startRootElement: nowhere to import to!" ); + if ( xLibContainer.is() ) { xElement.set( new BasicLibrariesElement( rLocalName, xAttributes, 0, this, xLibContainer ) ); |