summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 15:21:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 17:13:30 +0100
commitf19599c929ac6ae2708b19b9eff62ff70b44ee75 (patch)
tree6ed489ee28db5b89c6f26ddc068197bf0fd94b6d /embeddedobj
parente519d7465f38367205b37bc80f0244029e352306 (diff)
loplugin:flatten in editeng..extensions
Change-Id: Ica8f0a6e3d30dba3b5a083e3c04522073de8303f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127233 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/general/docholder.cxx130
1 files changed, 64 insertions, 66 deletions
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 13e40cf92516..78f73b88a5a6 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -464,30 +464,28 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar
// TODO: some listeners to the frame and the window ( resize for example )
}
- if ( m_xComponent.is() )
- {
- if ( !LoadDocToFrame( true ) )
- {
- CloseFrame();
- return false;
- }
+ if ( !m_xComponent )
+ return false;
- uno::Reference< frame::XControllerBorder > xControllerBorder( m_xFrame->getController(), uno::UNO_QUERY );
- if ( xControllerBorder.is() )
- {
- m_aBorderWidths = xControllerBorder->getBorder();
- xControllerBorder->addBorderResizeListener( static_cast<frame::XBorderResizeListener*>(this) );
- }
+ if ( !LoadDocToFrame( true ) )
+ {
+ CloseFrame();
+ return false;
+ }
- PlaceFrame( aRectangleToShow );
+ uno::Reference< frame::XControllerBorder > xControllerBorder( m_xFrame->getController(), uno::UNO_QUERY );
+ if ( xControllerBorder.is() )
+ {
+ m_aBorderWidths = xControllerBorder->getBorder();
+ xControllerBorder->addBorderResizeListener( static_cast<frame::XBorderResizeListener*>(this) );
+ }
- if ( m_xHatchWindow.is() )
- m_xHatchWindow->setVisible( true );
+ PlaceFrame( aRectangleToShow );
- return true;
- }
+ if ( m_xHatchWindow.is() )
+ m_xHatchWindow->setVisible( true );
- return false;
+ return true;
}
@@ -934,60 +932,60 @@ void DocumentHolder::SetComponent( const uno::Reference< util::XCloseable >& xDo
bool DocumentHolder::LoadDocToFrame( bool bInPlace )
{
- if ( m_xFrame.is() && m_xComponent.is() )
+ if ( !m_xFrame || !m_xComponent )
+ return true;
+
+ uno::Reference < frame::XModel > xDoc( m_xComponent, uno::UNO_QUERY );
+ if ( xDoc.is() )
{
- uno::Reference < frame::XModel > xDoc( m_xComponent, uno::UNO_QUERY );
- if ( xDoc.is() )
- {
- // load new document into the frame
- uno::Reference< frame::XComponentLoader > xComponentLoader( m_xFrame, uno::UNO_QUERY_THROW );
+ // load new document into the frame
+ uno::Reference< frame::XComponentLoader > xComponentLoader( m_xFrame, uno::UNO_QUERY_THROW );
- ::comphelper::NamedValueCollection aArgs;
- aArgs.put( "Model", m_xComponent );
- aArgs.put( "ReadOnly", m_bReadOnly );
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "Model", m_xComponent );
+ aArgs.put( "ReadOnly", m_bReadOnly );
- // set document title to show in the title bar
- css::uno::Reference< css::frame::XTitle > xModelTitle( xDoc, css::uno::UNO_QUERY );
- if( xModelTitle.is() && m_pEmbedObj && !m_pEmbedObj->getContainerName().isEmpty() )
- {
- std::locale aResLoc = Translate::Create("sfx");
- OUString sEmbedded = Translate::get(STR_EMBEDDED_TITLE, aResLoc);
- xModelTitle->setTitle( m_pEmbedObj->getContainerName() + sEmbedded );
- m_aContainerName = m_pEmbedObj->getContainerName();
- // TODO: get real m_aDocumentNamePart
- m_aDocumentNamePart = sEmbedded;
- }
+ // set document title to show in the title bar
+ css::uno::Reference< css::frame::XTitle > xModelTitle( xDoc, css::uno::UNO_QUERY );
+ if( xModelTitle.is() && m_pEmbedObj && !m_pEmbedObj->getContainerName().isEmpty() )
+ {
+ std::locale aResLoc = Translate::Create("sfx");
+ OUString sEmbedded = Translate::get(STR_EMBEDDED_TITLE, aResLoc);
+ xModelTitle->setTitle( m_pEmbedObj->getContainerName() + sEmbedded );
+ m_aContainerName = m_pEmbedObj->getContainerName();
+ // TODO: get real m_aDocumentNamePart
+ m_aDocumentNamePart = sEmbedded;
+ }
- if ( bInPlace )
- aArgs.put( "PluginMode", sal_Int16(1) );
- OUString sUrl;
- uno::Reference< lang::XServiceInfo> xServiceInfo(xDoc,uno::UNO_QUERY);
- if ( xServiceInfo.is()
- && xServiceInfo->supportsService("com.sun.star.report.ReportDefinition") )
- {
- sUrl = ".component:DB/ReportDesign";
- }
- else if( xServiceInfo.is()
- && xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument"))
- sUrl = "private:factory/schart";
- else
- sUrl = "private:object";
+ if ( bInPlace )
+ aArgs.put( "PluginMode", sal_Int16(1) );
+ OUString sUrl;
+ uno::Reference< lang::XServiceInfo> xServiceInfo(xDoc,uno::UNO_QUERY);
+ if ( xServiceInfo.is()
+ && xServiceInfo->supportsService("com.sun.star.report.ReportDefinition") )
+ {
+ sUrl = ".component:DB/ReportDesign";
+ }
+ else if( xServiceInfo.is()
+ && xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument"))
+ sUrl = "private:factory/schart";
+ else
+ sUrl = "private:object";
- xComponentLoader->loadComponentFromURL( sUrl,
- "_self",
- 0,
- aArgs.getPropertyValues() );
+ xComponentLoader->loadComponentFromURL( sUrl,
+ "_self",
+ 0,
+ aArgs.getPropertyValues() );
- return true;
- }
+ return true;
+ }
+ else
+ {
+ uno::Reference < frame::XSynchronousFrameLoader > xLoader( m_xComponent, uno::UNO_QUERY );
+ if ( xLoader.is() )
+ return xLoader->load( uno::Sequence < beans::PropertyValue >(), m_xFrame );
else
- {
- uno::Reference < frame::XSynchronousFrameLoader > xLoader( m_xComponent, uno::UNO_QUERY );
- if ( xLoader.is() )
- return xLoader->load( uno::Sequence < beans::PropertyValue >(), m_xFrame );
- else
- return false;
- }
+ return false;
}
return true;