Commits

Anonymous committed de7fde9

Fix for issue: 112596

Comments (0)

Files changed (1)

vbahelper/source/vbahelper/vbadocumentsbase.cxx

 #include <sfx2/objsh.hxx>
 #include <tools/urlobj.hxx>
 #include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbadocumentbase.hxx>
 #include <hash_map>
 #include <osl/file.hxx>
 
 			{
 				uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
 				m_documents.push_back( xModel );
-                rtl::OUString sName = xModel->getURL();
-                if( sName.getLength() )
-                {
-				    INetURLObject aURL( xModel->getURL() );
-				    namesToIndices[ aURL.GetLastName() ] = nIndex++;
-                }    
-                else
-                {
-                    uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
-                    sName = xTitle->getTitle();
-                    namesToIndices[ sName ] = nIndex++;
-                }
+				rtl::OUString sName;
+				uno::Reference< ::ooo::vba::XDocumentBase > xVbaDocument = new VbaDocumentBase( uno::Reference< XHelperInterface >(), xContext, xModel );
+				if ( xVbaDocument.is() )
+				{
+					sName = xVbaDocument->getName();
+				}
+				namesToIndices[ sName ] = nIndex++;
 			}
 		}