diff options
author | Daniel Vogelheim <dvo@openoffice.org> | 2001-10-16 11:32:03 +0000 |
---|---|---|
committer | Daniel Vogelheim <dvo@openoffice.org> | 2001-10-16 11:32:03 +0000 |
commit | 92440314e292f2411cfe50a1fe2595d30b04de35 (patch) | |
tree | f9106928da8542b7c957239ec26b7058f53d41f9 /xmloff | |
parent | f1875c0372c93543abac294376b9d71404dcefca (diff) |
#93186# initialize() now queries it's arguments
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 55 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 54 |
2 files changed, 64 insertions, 45 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 9867e60de8e3..37d74ddf2271 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlexp.cxx,v $ * - * $Revision: 1.88 $ + * $Revision: 1.89 $ * - * last change: $Author: cl $ $Date: 2001-10-12 16:12:09 $ + * last change: $Author: dvo $ $Date: 2001-10-16 12:32:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -598,35 +598,50 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { + // #93186# we need to queryInterface every single Any with any expected outcome. This variable hold the queryInterface results. + const sal_Int32 nAnyCount = aArguments.getLength(); const uno::Any* pAny = aArguments.getConstArray(); for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ ) { - if( pAny->getValueType() == ::getCppuType((const uno::Reference< task::XStatusIndicator >*)0) ) - { - *pAny >>= xStatusIndicator; - } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< document::XGraphicObjectResolver >*)0) ) - { - *pAny >>= xGraphicResolver; - } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< document::XEmbeddedObjectResolver >*)0) ) + Reference<XInterface> xValue; + *pAny >>= xValue; + + // status indicator + uno::Reference<task::XStatusIndicator> xTmpStatus( xValue, UNO_QUERY ); + if ( xTmpStatus.is() ) + xStatusIndicator = xTmpStatus; + + // graphic resolver + uno::Reference<document::XGraphicObjectResolver> xTmpGraphic( + xValue, UNO_QUERY ); + if ( xTmpGraphic.is() ) + xGraphicResolver = xTmpGraphic; + + // object resolver + uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver( + xValue, UNO_QUERY ); + if ( xTmpObjectResolver.is() ) + xEmbeddedResolver = xTmpObjectResolver; + + // document handler + uno::Reference<xml::sax::XDocumentHandler> xTmpDocHandler( + xValue, UNO_QUERY ); + if( xTmpDocHandler.is() ) { - *pAny >>= xEmbeddedResolver; - } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< xml::sax::XDocumentHandler >*)0)) - { - *pAny >>= xHandler; + xHandler = xTmpDocHandler; *pAny >>= xExtHandler; if (xNumberFormatsSupplier.is() && pNumExport == NULL) pNumExport = new SvXMLNumFmtExport(xHandler, xNumberFormatsSupplier); } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0)) - { - *pAny >>= xExportInfo; - } + + // property set to transport data across + uno::Reference<beans::XPropertySet> xTmpPropertySet( + xValue, UNO_QUERY ); + if( xTmpPropertySet.is() ) + xExportInfo = xTmpPropertySet; } } diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index e35b32bcc3da..1290764f6324 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlimp.cxx,v $ * - * $Revision: 1.59 $ + * $Revision: 1.60 $ * - * last change: $Author: dvo $ $Date: 2001-09-28 16:39:54 $ + * last change: $Author: dvo $ $Date: 2001-10-16 12:32:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -725,32 +725,36 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ ) { - if( pAny->getValueType() == ::getCppuType((const uno::Reference< task::XStatusIndicator >*)0)) + Reference<XInterface> xValue; + *pAny >>= xValue; + + uno::Reference<task::XStatusIndicator> xTmpStatusIndicator( + xValue, UNO_QUERY ); + if( xTmpStatusIndicator.is() ) + mxStatusIndicator = xTmpStatusIndicator; + + uno::Reference<document::XGraphicObjectResolver> xTmpGraphicResolver( + xValue, UNO_QUERY ); + if( xTmpGraphicResolver.is() ) + xGraphicResolver = xTmpGraphicResolver; + + uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver( + xValue, UNO_QUERY ); + if( xTmpObjectResolver.is() ) + xEmbeddedResolver = xTmpObjectResolver; + + uno::Reference<beans::XPropertySet> xTmpPropSet( xValue, UNO_QUERY ); + if( xTmpPropSet.is() ) { - *pAny >>= mxStatusIndicator; - } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< document::XGraphicObjectResolver >*)0)) - { - *pAny >>= xGraphicResolver; - } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< document::XEmbeddedObjectResolver >*)0)) - { - *pAny >>= xEmbeddedResolver; - } - else if( pAny->getValueType() == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0)) - { - *pAny >>= xImportInfo; - if (xImportInfo.is()) + xImportInfo = xTmpPropSet; + uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo(); + if (xPropertySetInfo.is()) { - uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo(); - if (xPropertySetInfo.is()) + OUString sNumberStyles(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES)); + if (xPropertySetInfo->hasPropertyByName(sNumberStyles)) { - OUString sNumberStyles(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES)); - if (xPropertySetInfo->hasPropertyByName(sNumberStyles)) - { - uno::Any aAny = xImportInfo->getPropertyValue(sNumberStyles); - aAny >>= xNumberStyles; - } + uno::Any aAny = xImportInfo->getPropertyValue(sNumberStyles); + aAny >>= xNumberStyles; } } } |