basic/source/basmgr/basicmanagerrepository.cxx |    3 ++-
 basic/source/inc/scriptcont.hxx                |    8 +++++++-
 basic/source/uno/scriptcont.cxx                |   11 +++++++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Dec 13 11:18:35 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Dec 14 09:16:36 2022 +0000

    loplugin:unocast (basic::SfxScriptLibraryContainer)
    
    (See the upcoming commit introducing that loplugin:unocast on why such
    dynamic_casts from UNO types are dangerous.)
    
    Change-Id: I962b2a11a6407a543fb8b4ad972128d59f62a8a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144142
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index 7a2ed5efd20a..803d8ed4caa0 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -35,6 +35,7 @@
 #include <vcl/svapp.hxx>
 #include <tools/debug.hxx>
 #include <comphelper/diagnose_ex.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <tools/urlobj.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/documentinfo.hxx>
@@ -462,7 +463,7 @@ namespace basic
         }
 
         // knit the containers with the BasicManager
-        LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< 
SfxScriptLibraryContainer* >( xBasicLibs.get() ) );
+        LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, 
comphelper::getFromUnoTunnel< SfxScriptLibraryContainer >( xBasicLibs ) );
         OSL_ENSURE( aInfo.mpOldBasicPassword, 
"ImplRepository::impl_createManagerForModel: wrong BasicLibraries 
implementation!" );
         _out_rpBasicManager->SetLibraryContainerInfo( aInfo );
 
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 2d0e8bcf3232..f4886d216fad 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -21,15 +21,18 @@
 
 #include "namecont.hxx"
 #include <basic/basmgr.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
 #include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase.hxx>
 #include <cppuhelper/implbase1.hxx>
 
 namespace basic
 {
 
 
-class SfxScriptLibraryContainer final : public SfxLibraryContainer
+class SfxScriptLibraryContainer final :
+    public cppu::ImplInheritanceHelper<SfxLibraryContainer, 
css::lang::XUnoTunnel>
 {
     css::uno::Reference< css::container::XNameAccess > mxCodeNameAccess;
 
@@ -99,6 +102,9 @@ public:
 
     // Library password handling for 5.0 documents
     void setLibraryPassword( const OUString& rLibraryName, const OUString& 
rPassword );
+
+    sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & 
aIdentifier) override;
+    static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
 };
 
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index eea449ac47fc..ea69032aa795 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/task/ErrorCodeIOException.hpp>
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <sal/log.hxx>
@@ -107,6 +108,16 @@ void SfxScriptLibraryContainer::setLibraryPassword( const 
OUString& rLibraryName
     catch(const NoSuchElementException& ) {}
 }
 
+sal_Int64 SfxScriptLibraryContainer::getSomething(css::uno::Sequence<sal_Int8> 
const & aIdentifier)
+{
+    return comphelper::getSomethingImpl(aIdentifier, this);
+}
+
+css::uno::Sequence<sal_Int8> const & 
SfxScriptLibraryContainer::getUnoTunnelId() {
+    static comphelper::UnoIdInit const id;
+    return id.getSeq();
+}
+
 // Ctor for service
 SfxScriptLibraryContainer::SfxScriptLibraryContainer()
 {

Reply via email to