summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-05-03 12:31:27 +0100
committerNoel Power <noel.power@suse.com>2013-05-09 14:11:20 +0100
commitb2d1526203adfe462e744e8b14dabbd4fddf0406 (patch)
treed6657af713f98baa7406a09f7fbbf606a459d533 /vbahelper
parent4d1e0ea98b963ef566d11fcd05f74bfab9ca813e (diff)
Parse workbook name correctly, don't fall over spaces etc.
Change-Id: I26213e4202ea2f2d15014ca722ab7878aa09cbf1
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx11
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx5
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++;
}
}