From f220acf3aad954e20f3b15b30910432fac97ed15 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 23 Apr 2023 20:14:45 +0300 Subject: Use getXWeak in shell Change-Id: Ied9a244a0fdd5973f2c9cb3bdd46500f6be2e0cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150868 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- shell/source/backends/desktopbe/desktopbackend.cxx | 6 +++--- shell/source/backends/kf5be/kf5backend.cxx | 5 ++--- shell/source/backends/localebe/localebackend.cxx | 4 ++-- shell/source/backends/macbe/macbackend.mm | 4 ++-- shell/source/backends/wininetbe/wininetbackend.cxx | 4 ++-- shell/source/unix/exec/shellexec.cxx | 4 ++-- shell/source/win32/SysShExec.cxx | 2 +- shell/source/win32/jumplist/JumpList.cxx | 13 ++++++------- 8 files changed, 20 insertions(+), 22 deletions(-) (limited to 'shell') diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx index b6f49e37ed24..8d001499bad0 100644 --- a/shell/source/backends/desktopbe/desktopbackend.cxx +++ b/shell/source/backends/desktopbe/desktopbackend.cxx @@ -106,7 +106,7 @@ void Default::setPropertyValue(OUString const &, css::uno::Any const &) { throw css::lang::IllegalArgumentException( "setPropertyValue not supported", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } OUString xdg_user_dir_lookup (const char *type, bool bAllowHomeDir) @@ -252,7 +252,7 @@ css::uno::Any Default::getPropertyValue(OUString const & PropertyName) } throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); + PropertyName, getXWeak()); } css::uno::Reference< css::uno::XInterface > createBackend( @@ -290,7 +290,7 @@ shell_DesktopBackend_get_implementation( backend = createBackend(context, "com.sun.star.configuration.backend.KF5Backend"); if (!backend) - backend = static_cast< cppu::OWeakObject * >(new Default); + backend = getXWeak(new Default); backend->acquire(); return backend.get(); } diff --git a/shell/source/backends/kf5be/kf5backend.cxx b/shell/source/backends/kf5be/kf5backend.cxx index 7137a9999873..b811300a8e6e 100644 --- a/shell/source/backends/kf5be/kf5backend.cxx +++ b/shell/source/backends/kf5be/kf5backend.cxx @@ -220,8 +220,7 @@ Service::Service() void Service::setPropertyValue(OUString const&, css::uno::Any const&) { - throw css::lang::IllegalArgumentException("setPropertyValue not supported", - static_cast(this), -1); + throw css::lang::IllegalArgumentException("setPropertyValue not supported", getXWeak(), -1); } css::uno::Any Service::getPropertyValue(OUString const& PropertyName) @@ -247,7 +246,7 @@ css::uno::Any Service::getPropertyValue(OUString const& PropertyName) return css::uno::Any(css::beans::Optional()); //TODO: obtain values from KDE? } - throw css::beans::UnknownPropertyException(PropertyName, static_cast(this)); + throw css::beans::UnknownPropertyException(PropertyName, getXWeak()); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx index 9f1d22fef93e..d34c3441e6bc 100644 --- a/shell/source/backends/localebe/localebackend.cxx +++ b/shell/source/backends/localebe/localebackend.cxx @@ -286,7 +286,7 @@ void LocaleBackend::setPropertyValue( { throw css::lang::IllegalArgumentException( "setPropertyValue not supported", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } css::uno::Any LocaleBackend::getPropertyValue( @@ -302,7 +302,7 @@ css::uno::Any LocaleBackend::getPropertyValue( return css::uno::Any(getUILocale()); } else { throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); + PropertyName, getXWeak()); } } diff --git a/shell/source/backends/macbe/macbackend.mm b/shell/source/backends/macbe/macbackend.mm index cb35a4b9d066..e84ecd4b8013 100644 --- a/shell/source/backends/macbe/macbackend.mm +++ b/shell/source/backends/macbe/macbackend.mm @@ -186,7 +186,7 @@ void MacOSXBackend::setPropertyValue( { throw css::lang::IllegalArgumentException( "setPropertyValue not supported", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } css::uno::Any MacOSXBackend::getPropertyValue( @@ -365,7 +365,7 @@ css::uno::Any MacOSXBackend::getPropertyValue( return css::uno::Any(css::beans::Optional< css::uno::Any >()); } else { throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); + PropertyName, getXWeak()); } } diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx index 71de3b135b4c..109ef7fa6519 100644 --- a/shell/source/backends/wininetbe/wininetbackend.cxx +++ b/shell/source/backends/wininetbe/wininetbackend.cxx @@ -301,7 +301,7 @@ void WinInetBackend::setPropertyValue( { throw css::lang::IllegalArgumentException( "setPropertyValue not supported", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } css::uno::Any WinInetBackend::getPropertyValue( @@ -333,7 +333,7 @@ css::uno::Any WinInetBackend::getPropertyValue( return css::uno::Any(valueProxyType_); } else { throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); + PropertyName, getXWeak()); } } diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 97334fcd32c3..71137c7d6703 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -107,7 +107,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar throw RuntimeException( "Cannot translate URI reference to external format: " + aCommand, - static_cast< cppu::OWeakObject * >(this)); + getXWeak()); } #ifdef MACOSX @@ -205,7 +205,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar "XSystemShellExecute.execute URIS_ONLY with non-absolute" " URI reference " + aCommand, - static_cast< cppu::OWeakObject * >(this), 0); + getXWeak(), 0); } else { escapeForShell(aBuffer, OUStringToOString(aCommand, osl_getThreadTextEncoding())); aBuffer.append(" "); diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index 7be77d6344de..57e59f96b6f0 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -234,7 +234,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa "XSystemShellExecute.execute URIS_ONLY with" " non-absolute URI reference " + aCommand, - static_cast< cppu::OWeakObject * >(this), 0); + getXWeak(), 0); } if (uri->getScheme().equalsIgnoreAsciiCase("file")) { // ShellExecuteExW appears to ignore the fragment of a file URL anyway, so remove it: diff --git a/shell/source/win32/jumplist/JumpList.cxx b/shell/source/win32/jumplist/JumpList.cxx index 114c6f4e95b5..2773294be717 100644 --- a/shell/source/win32/jumplist/JumpList.cxx +++ b/shell/source/win32/jumplist/JumpList.cxx @@ -129,7 +129,7 @@ void SAL_CALL JumpListImpl::beginList(const OUString& sApplication) throw IllegalArgumentException( "Parameter 'application' must be one of 'Writer', 'Calc', 'Impress', 'Draw', " "'Math', 'Base', 'Startcenter'.", - static_cast(this), 1); + getXWeak(), 1); } OUString sApplicationID("TheDocumentFoundation.LibreOffice." + sApplication); @@ -157,8 +157,7 @@ void SAL_CALL JumpListImpl::appendCategory(const OUString& sCategory, if (sCategory.isEmpty()) { - throw IllegalArgumentException("Parameter 'category' must not be empty", - static_cast(this), 1); + throw IllegalArgumentException("Parameter 'category' must not be empty", getXWeak(), 1); } try @@ -241,7 +240,7 @@ void SAL_CALL JumpListImpl::appendCategory(const OUString& sCategory, throw IllegalArgumentException( "No valid items given. `jumpListItems` is either empty, or contains only items " "which were removed by the user. See `XJumpList::getRemovedItems()`.", - static_cast(this), 1); + getXWeak(), 1); } ThrowIfFailed( @@ -329,7 +328,7 @@ void SAL_CALL JumpListImpl::addTasks(const Sequence& aJumpListItem if (nItems == 0) { throw IllegalArgumentException("No valid items given. `jumpListItems` is empty.", - static_cast(this), 1); + getXWeak(), 1); } ThrowIfFailed(m_aDestinationList->AddUserTasks(pObjectArray), "AddUserTasks failed."); @@ -417,7 +416,7 @@ void SAL_CALL JumpListImpl::deleteList(const OUString& sApplication) throw IllegalArgumentException( "Parameter 'application' must be one of 'Writer', 'Calc', 'Impress', 'Draw', " "'Math', 'Base', 'Startcenter'.", - static_cast(this), 1); + getXWeak(), 1); } OUString sApplicationID("TheDocumentFoundation.LibreOffice." + sApplication); @@ -442,7 +441,7 @@ Sequence SAL_CALL JumpListImpl::getRemovedItems(const OUString& sA throw IllegalArgumentException( "Parameter 'application' must be one of 'Writer', 'Calc', 'Impress', 'Draw', " "'Math', 'Base', 'Startcenter'.", - static_cast(this), 1); + getXWeak(), 1); } OUString sApplicationID("TheDocumentFoundation.LibreOffice." + sApplication); -- cgit