diff options
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentbase.cxx | 11 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentsbase.cxx | 5 |
2 files changed, 11 insertions, 5 deletions
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 5816b32c864a..d9029ecfcf9f 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -54,16 +54,21 @@ VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args, OUString VbaDocumentBase::getName() throw (uno::RuntimeException) { - OUString sName = getModel()->getURL(); + return VbaDocumentBase::getNameFromModel( getModel() ); +} + +OUString VbaDocumentBase::getNameFromModel( const uno::Reference< frame::XModel >& xModel ) +{ + OUString sName = xModel.is() ? xModel->getURL() : OUString(); if ( !sName.isEmpty() ) { - INetURLObject aURL( getModel()->getURL() ); + INetURLObject aURL( xModel->getURL() ); ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName ); } else { - uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW ); sName = xTitle->getTitle(); sName = sName.trim(); } diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index e06e40c213fd..90314a5f5c1e 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -50,6 +50,7 @@ #include "vbahelper/vbahelper.hxx" #include "vbahelper/vbaapplicationbase.hxx" +#include "vbahelper/vbadocumentbase.hxx" using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -138,8 +139,8 @@ public: { uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given m_documents.push_back( xModel ); - INetURLObject aURL( xModel->getURL() ); - namesToIndices[ aURL.GetLastName() ] = nIndex++; + OUString sName = VbaDocumentBase::getNameFromModel( xModel ); + namesToIndices[ sName ] = nIndex++; } } |