summaryrefslogtreecommitdiff
path: root/cui/source/factory
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-09-17 12:50:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-09-20 21:20:51 +0200
commit94d6fa11d086187b82adf9aa596e0f334827e095 (patch)
tree4a44af903b2572efe89ae5e8aa67bb092644e038 /cui/source/factory
parent3c84b18f4f0fe4058de60b1c62149275ed858b79 (diff)
weld OfaTreeOptionsDialog
including ability to host a vcl::Window based XWindow hierarchy inside a native widget, e.g. the dictionary extensions have option pages Change-Id: I17d933bac12679e10164214a9045b677291a6557 Reviewed-on: https://gerrit.libreoffice.org/79070 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source/factory')
-rw-r--r--cui/source/factory/dlgfact.cxx42
-rw-r--r--cui/source/factory/dlgfact.hxx9
2 files changed, 20 insertions, 31 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 289c79ccf8be..7608d9f8cd3e 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -108,8 +108,6 @@ short CuiAbstractSingleTabController_Impl::Execute()
return m_xDlg->run();
}
-IMPL_ABSTDLG_BASE(CuiVclAbstractDialog_Impl)
-
short AbstractSvxDistributeDialog_Impl::Execute()
{
return m_xDlg->run();
@@ -948,9 +946,9 @@ bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const
}
// Create dialogs with simplest interface
-VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pParent, sal_uInt32 nResId )
+VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog(weld::Window* pParent, sal_uInt32 nResId)
{
- VclPtr<Dialog> pDlg;
+ std::unique_ptr<OfaTreeOptionsDialog> xDlg;
switch ( nResId )
{
case SID_OPTIONS_TREEDIALOG :
@@ -961,25 +959,24 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog( vcl::Wind
if (nResId == SID_OPTIONS_TREEDIALOG)
bActivateLastSelection = true;
Reference< frame::XFrame > xFrame;
- VclPtrInstance<OfaTreeOptionsDialog> pOptDlg( pParent, xFrame, bActivateLastSelection );
+ xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, xFrame, bActivateLastSelection);
if (nResId == SID_OPTIONS_DATABASES)
{
- pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
+ xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
}
else if (nResId == SID_LANGUAGE_OPTIONS)
{
//open the tab page "tools/options/languages"
- pOptDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE);
+ xDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE);
}
- pDlg.reset(pOptDlg);
}
break;
default:
break;
}
- if ( pDlg )
- return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
+ if (xDlg)
+ return VclPtr<CuiAbstractController_Impl>::Create(std::move(xDlg));
return nullptr;
}
@@ -988,26 +985,24 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateAboutDialog(weld::Wi
return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<AboutDialog>(pParent));
}
-VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(vcl::Window* pParent, const Reference< frame::XFrame >& rxFrame,
+VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Window* pParent, const Reference< frame::XFrame >& rxFrame,
sal_uInt32 nResId, const OUString& rParameter )
{
- VclPtr<Dialog> pDlg;
- if ( SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId )
+ std::unique_ptr<OfaTreeOptionsDialog> xDlg;
+ if (SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId)
{
// only activate last page if we don't want to activate a special page
bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() );
- VclPtrInstance<OfaTreeOptionsDialog> pOptDlg(pParent, rxFrame, bActivateLastSelection);
+ xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, rxFrame, bActivateLastSelection);
if ( nResId == SID_OPTIONS_DATABASES )
- pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
+ xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
else if ( !rParameter.isEmpty() )
- pOptDlg->ActivatePage( rParameter );
- pDlg.reset(pOptDlg);
+ xDlg->ActivatePage( rParameter );
}
- if ( pDlg )
- return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
- else
- return nullptr;
+ if (xDlg)
+ return VclPtr<CuiAbstractController_Impl>::Create(std::move(xDlg));
+ return nullptr;
}
// TabDialog outside the drawing layer
@@ -1594,10 +1589,9 @@ VclPtr<SvxAbstractNewTableDialog> AbstractDialogFactory_Impl::CreateSvxNewTableD
return VclPtr<SvxNewTableDialog>::Create(pParent);
}
-VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateOptionsDialog(
- weld::Window* /*pParent*/, const OUString& rExtensionId )
+VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateOptionsDialog(weld::Window* pParent, const OUString& rExtensionId)
{
- return VclPtr<CuiVclAbstractDialog_Impl>::Create( VclPtr<OfaTreeOptionsDialog>::Create(nullptr /* TODO: pParent*/, rExtensionId ) );
+ return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<OfaTreeOptionsDialog>(pParent, rExtensionId));
}
VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId)
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 7d579b22ae20..dab0e9ae43d0 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -112,11 +112,6 @@ bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \
return pDlg->StartExecuteAsync(rCtx); \
}
-class CuiVclAbstractDialog_Impl : public VclAbstractDialog
-{
- DECL_ABSTDLG_BASE(CuiVclAbstractDialog_Impl,Dialog)
-};
-
class CuiAbstractController_Impl : public VclAbstractDialog
{
std::unique_ptr<weld::DialogController> m_xDlg;
@@ -761,7 +756,7 @@ public:
class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory
{
public:
- virtual VclPtr<VclAbstractDialog> CreateVclDialog( vcl::Window* pParent, sal_uInt32 nResId ) override;
+ virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nResId) override;
virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* pParent) override;
@@ -775,7 +770,7 @@ public:
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Widget* pParent,
const SfxItemSet& rAttr,
const css::uno::Reference< css::frame::XFrame >& rFrame) override;
- virtual VclPtr<VclAbstractDialog> CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame,
+ virtual VclPtr<VclAbstractDialog> CreateFrameDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame,
sal_uInt32 nResId,
const OUString& rParameter ) override;
virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) override;