Commits

Anonymous committed 2466377

vbasupportdev300_HG: adapt SwVbaCodeNameProvider for XVBAModuleInfo

Comments (0)

Files changed (1)

sw/source/core/unocore/unocoll.cxx

 #include <com/sun/star/script/ModuleInfo.hpp>
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
 #include <vbahelper/vbaaccesshelper.hxx>
 #include <basic/basmgr.hxx>
 #include <comphelper/processfactory.hxx>
                 if ( mpDocShell->GetBasicManager()->GetName().Len() )
                     sProjectName =  mpDocShell->GetBasicManager()->GetName();
     
-                uno::Reference< container::XNameAccess > xStandard( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-                uno::Sequence< rtl::OUString > sModuleNames = xStandard->getElementNames();
+                uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
+                uno::Sequence< rtl::OUString > sModuleNames = xLib->getElementNames();
+                uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
+
                 for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
                 {
                     script::ModuleInfo mInfo;
-                    if ( xStandard->getByName( sModuleNames[ i ] ) >>= mInfo )
+                 
+                    if ( xVBAModuleInfo->hasModuleInfo( sModuleNames[ i ] ) &&  xVBAModuleInfo->getModuleInfo( sModuleNames[ i ] ).ModuleType == script::ModuleType::DOCUMENT )
                     {
-                        if ( mInfo.ModuleType == script::ModuleType::DOCUMENT )
-                        {
-                            msThisDocumentCodeName = sModuleNames[ i ];
-                            break;
-                        }
+                        msThisDocumentCodeName = sModuleNames[ i ];
+                        break;
                     } 
                 }
             }