From ae562e931a98e708a75e8d140cf1ff24854acfc7 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Thu, 16 Oct 2008 06:57:26 +0000 Subject: CWS-TOOLING: integrate CWS odbmacros3 --- xmlscript/source/xmlflat_imexp/xmlbas_export.cxx | 18 ++++++++++++------ xmlscript/source/xmlflat_imexp/xmlbas_import.cxx | 17 +++++++++++++---- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'xmlscript') 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 #include -#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_ #include -#endif #include -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ +#include #include -#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 #include #include -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ +#include #include -#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 ) ); -- cgit