summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-30 09:40:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-10-30 16:58:19 +0100
commitd465d5b1cc962f56534d685fe8af5f26083fb7ba (patch)
treec709eb4025e46325ce0f3c3595eb27cf2b178085
parent39759e85d9931ba9dcee04bb4010c51d729b7ecf (diff)
can avoid intermediate vcl::Window use
Change-Id: I51d1a84fdf7a8c7d204691d52dec10db051c3b00 Reviewed-on: https://gerrit.libreoffice.org/81745 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sfx2/inc/guisaveas.hxx4
-rw-r--r--sfx2/source/doc/guisaveas.cxx30
-rw-r--r--sfx2/source/view/ipclient.cxx3
-rw-r--r--sfx2/source/view/viewprn.cxx3
4 files changed, 15 insertions, 25 deletions
diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index ac9df75aea61..5e7355709680 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -37,7 +37,7 @@ namespace com { namespace sun { namespace star {
}
} } }
-namespace vcl { class Window; }
+namespace weld { class Window; }
class ModelData_Impl;
class SfxStoringHelper
@@ -79,7 +79,7 @@ public:
bool rDefaultIsAlien );
static css::uno::Reference<css::awt::XWindow> GetModelXWindow(const css::uno::Reference<css::frame::XModel>& rModel);
- static vcl::Window* GetModelWindow( const css::uno::Reference< css::frame::XModel >& xModel );
+ static weld::Window* GetModelWindow( const css::uno::Reference< css::frame::XModel >& xModel );
};
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 573ee808d474..6a9012f63c1f 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -650,8 +650,7 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
&& GetMediaDescr().find( OUString("VersionComment") ) == GetMediaDescr().end() )
{
// notify the user that SaveAs is going to be done
- vcl::Window* pWin = SfxStoringHelper::GetModelWindow(m_xModel);
- std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(SfxStoringHelper::GetModelWindow(m_xModel),
VclMessageType::Question, VclButtonsType::OkCancel, SfxResId(STR_NEW_FILENAME_SAVE)));
if (xMessageBox->run() == RET_OK)
nResult = STATUS_SAVEAS;
@@ -848,8 +847,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
SfxFilterFlags nMust = getMustFlags( nStoreMode );
SfxFilterFlags nDont = getDontFlags( nStoreMode );
- vcl::Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel );
- weld::Window* pFrameWin = pWin ? pWin->GetFrameWeld() : nullptr;
+ weld::Window* pFrameWin = SfxStoringHelper::GetModelWindow(m_xModel);
if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) )
{
if ( ( nStoreMode & PDFEXPORT_REQUESTED ) && !aPreselectedFilterPropsHM.empty() )
@@ -1390,8 +1388,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
|| SignatureState::NOTVALIDATED == nDocumentSignatureState
|| SignatureState::PARTIAL_OK == nDocumentSignatureState)
{
- vcl::Window* pWin = SfxStoringHelper::GetModelWindow( xModel );
- std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(SfxStoringHelper::GetModelWindow(xModel),
VclMessageType::Question, VclButtonsType::YesNo, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE)));
if (xMessageBox->run() != RET_YES)
{
@@ -1796,8 +1793,8 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
if ( !SvtSaveOptions().IsWarnAlienFormat() )
return true;
- vcl::Window* pWin = SfxStoringHelper::GetModelWindow( xModel );
- SfxAlienWarningDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, aOldUIName, aDefExtension, bDefIsAlien);
+ weld::Window* pWin = SfxStoringHelper::GetModelWindow(xModel);
+ SfxAlienWarningDialog aDlg(pWin, aOldUIName, aDefExtension, bDefIsAlien);
return aDlg.run() == RET_OK;
}
@@ -1825,20 +1822,15 @@ uno::Reference<awt::XWindow> SfxStoringHelper::GetModelXWindow(const uno::Refere
return uno::Reference<awt::XWindow>();
}
-vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
+weld::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
{
- VclPtr<vcl::Window> pWin;
+ weld::Window* pWin = nullptr;
- try {
- uno::Reference<awt::XWindow> xWindow = GetModelXWindow(xModel);
- if ( xWindow.is() )
- {
- VCLXWindow* pVCLWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( xWindow );
- if ( pVCLWindow )
- pWin = pVCLWindow->GetWindow();
- }
+ try
+ {
+ pWin = Application::GetFrameWeld(GetModelXWindow(xModel));
}
- catch ( const uno::Exception& )
+ catch (const uno::Exception&)
{
}
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index d810bd44374e..be9b43cd9035 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -878,8 +878,7 @@ sal_Int64 SfxInPlaceClient::GetAspect() const
ErrCode SfxInPlaceClient::DoVerb( long nVerb )
{
- vcl::Window* pWin = m_pViewSh->GetWindow();
- SfxErrorContext aEc(ERRCTX_SO_DOVERB, pWin ? pWin->GetFrameWeld() : nullptr, RID_SO_ERRCTX);
+ SfxErrorContext aEc(ERRCTX_SO_DOVERB, m_pViewSh->GetFrameWeld(), RID_SO_ERRCTX);
ErrCode nError = ERRCODE_NONE;
if ( m_xImp->m_xObject.is() )
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 31befa4e2987..2347f69584c4 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -350,8 +350,7 @@ void SfxPrinterController::jobFinished( css::view::PrintableState nState )
OUString aMsg( SfxResId(STR_NOSTARTPRINTER) );
if ( !m_bApi )
{
- vcl::Window* pWindow = mpViewShell->GetWindow();
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr,
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(mpViewShell->GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
aMsg));
xBox->run();