diff options
Diffstat (limited to 'embeddedobj/source/general/docholder.cxx')
-rw-r--r-- | embeddedobj/source/general/docholder.cxx | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 78f73b88a5a6..4fcb563bc424 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <osl/diagnose.h> +#include <utility> #include <vcl/svapp.hxx> #include <unotools/resmgr.hxx> #include <sfx2/strings.hrc> @@ -144,14 +145,16 @@ static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >& pTargetProps[nInd-1].Value <<= xSourceDisp; } - xTargetMenu->insertByIndex( nTargetIndex, uno::makeAny( aTargetProps ) ); + xTargetMenu->insertByIndex( nTargetIndex, uno::Any( aTargetProps ) ); } +namespace embeddedobj +{ -DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >& xContext, +DocumentHolder::DocumentHolder( uno::Reference< uno::XComponentContext > xContext, OCommonEmbeddedObject* pEmbObj ) : m_pEmbedObj( pEmbObj ), - m_xContext( xContext ), + m_xContext(std::move( xContext )), m_bReadOnly( false ), m_bWaitForClose( false ), m_bAllowClosing( false ), @@ -232,8 +235,12 @@ void DocumentHolder::CloseFrame() void DocumentHolder::FreeOffice() { - uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); - xDesktop->removeTerminateListener( this ); + try { + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); + xDesktop->removeTerminateListener( this ); + } catch (const css::uno::DeploymentException&) { + // if this happens, the desktop is already gone + } // the following code is commented out since for now there is still no completely correct way to detect // whether the office can be terminated, so it is better to have unnecessary process running than @@ -537,7 +544,7 @@ uno::Reference< container::XIndexAccess > DocumentHolder::RetrieveOwnMenu_Impl() } if ( !xResult.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException("Unable to retrieve the UI configuration menu.", getXWeak()); return xResult; } @@ -554,7 +561,7 @@ void DocumentHolder::FindConnectPoints( uno::Sequence< beans::PropertyValue > aProps; xMenu->getByIndex( nInd ) >>= aProps; OUString aCommand; - for ( beans::PropertyValue const & prop : std::as_const(aProps) ) + for (beans::PropertyValue const& prop : aProps) if ( prop.Name == "CommandURL" ) { prop.Value >>= aCommand; @@ -562,7 +569,7 @@ void DocumentHolder::FindConnectPoints( } if ( aCommand.isEmpty() ) - throw uno::RuntimeException(); + throw uno::RuntimeException("CommandURL is empty at index: " + OUString::number(nInd), xMenu); if ( aCommand == ".uno:PickList" ) nConnectPoints[0] = nInd; @@ -631,7 +638,7 @@ bool DocumentHolder::MergeMenus_Impl( const uno::Reference< css::frame::XLayoutM uno::UNO_QUERY_THROW ); uno::Reference< container::XIndexAccess > xContMenu = xUISettings->getSettings( true ); if ( !xContMenu.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException("Unable to merge the menu", getXWeak()); uno::Reference< container::XIndexAccess > xOwnMenu = RetrieveOwnMenu_Impl(); uno::Reference< frame::XDispatchProvider > xOwnDisp( m_xFrame, uno::UNO_QUERY_THROW ); @@ -869,7 +876,7 @@ uno::Reference< frame::XFrame > const & DocumentHolder::GetDocFrame() { sal_Int32 nDisplay = Application::GetDisplayBuiltInScreen(); - tools::Rectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay ); + AbsoluteScreenPixelRectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay ); awt::Rectangle aWindowRect = xHWindow->getPosSize(); if (( aWindowRect.Width < aWorkRect.GetWidth()) && ( aWindowRect.Height < aWorkRect.GetHeight() )) @@ -1275,4 +1282,6 @@ void SAL_CALL DocumentHolder::deactivated( ) // so UIDeactivation is actively triggered by the container } +} // namespace embeddedobj + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |