Kaydet (Commit) b2d15262 authored tarafından Noel Power's avatar Noel Power

Parse workbook name correctly, don't fall over spaces etc.

Change-Id: I26213e4202ea2f2d15014ca722ab7878aa09cbf1
üst 4d1e0ea9
......@@ -58,6 +58,8 @@ public:
// XHelperInterface
virtual OUString getServiceImplName();
virtual css::uno::Sequence<OUString> getServiceNames();
static OUString getNameFromModel( const css::uno::Reference< css::frame::XModel >& xModel );
};
#endif /* VBA_DOCUMENTBASE_HXX */
......
......@@ -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();
}
......
......@@ -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++;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment