Kaydet (Commit) 3dacf98b authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SfxMacroAssignDlg

Change-Id: I80045f1d1ca189fc490dc88b3471d68782df6f1c
Reviewed-on: https://gerrit.libreoffice.org/63976
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3a713e78
...@@ -336,10 +336,10 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void) ...@@ -336,10 +336,10 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void)
bool bIsInputEnabled = GetParent()->IsInputEnabled(); bool bIsInputEnabled = GetParent()->IsInputEnabled();
if ( bIsInputEnabled ) if ( bIsInputEnabled )
GetParent()->EnableInput( false ); GetParent()->EnableInput( false );
ScopedVclPtrInstance< SfxMacroAssignDlg > aDlg( this, mxDocumentFrame, *pItemSet ); SfxMacroAssignDlg aDlg(GetFrameWeld(), mxDocumentFrame, *pItemSet);
// add events // add events
SfxMacroTabPage *pMacroPage = static_cast<SfxMacroTabPage*>( aDlg->GetTabPage() ); SfxMacroTabPage *pMacroPage = aDlg.GetTabPage();
if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOverObject ) if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOverObject )
pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT1), pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT1),
...@@ -355,11 +355,11 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void) ...@@ -355,11 +355,11 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void)
GetParent()->EnableInput(); GetParent()->EnableInput();
// execute dlg // execute dlg
DisableClose( true ); DisableClose( true );
short nRet = aDlg->Execute(); short nRet = aDlg.run();
DisableClose( false ); DisableClose( false );
if ( RET_OK == nRet ) if ( RET_OK == nRet )
{ {
const SfxItemSet* pOutSet = aDlg->GetOutputItemSet(); const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem )) if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem ))
{ {
......
...@@ -1318,12 +1318,11 @@ VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld:: ...@@ -1318,12 +1318,11 @@ VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld::
return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(o3tl::make_unique<SvxCharacterMap>(pParent, &rAttr, bInsert)); return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(o3tl::make_unique<SvxCharacterMap>(pParent, &rAttr, bInsert));
} }
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog( vcl::Window* pParent, VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog(weld::Window* pParent,
const SfxItemSet& rAttr, const SfxItemSet& rAttr,
const Reference< XFrame >& _rxDocumentFrame) const Reference< XFrame >& _rxDocumentFrame)
{ {
SfxModalDialog* pDlg = VclPtr<SfxMacroAssignDlg>::Create(pParent, _rxDocumentFrame, rAttr); return VclPtr<CuiAbstractController_Impl>::Create(o3tl::make_unique<SfxMacroAssignDlg>(pParent, _rxDocumentFrame, rAttr));
return VclPtr<CuiAbstractSfxDialog_Impl>::Create(pDlg);
} }
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(vcl::Window* pParent, VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(vcl::Window* pParent,
......
...@@ -677,10 +677,9 @@ public: ...@@ -677,10 +677,9 @@ public:
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent,
const SfxItemSet& rAttr, const SfxItemSet& rAttr,
bool bInsert) override; bool bInsert) override;
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog( vcl::Window* pParent, virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent,
const SfxItemSet& rAttr, const SfxItemSet& rAttr,
const css::uno::Reference< css::frame::XFrame >& _rxFrame const css::uno::Reference< css::frame::XFrame >& _rxFrame) override;
) override;
virtual VclPtr<VclAbstractDialog> CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, virtual VclPtr<VclAbstractDialog> CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame,
sal_uInt32 nResId, sal_uInt32 nResId,
const OUString& rParameter ) override; const OUString& rParameter ) override;
......
...@@ -79,13 +79,16 @@ public: ...@@ -79,13 +79,16 @@ public:
static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet ); static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet );
}; };
class SfxMacroAssignDlg : public SfxSingleTabDialog class SfxMacroAssignDlg : public SfxSingleTabDialogController
{ {
public: public:
SfxMacroAssignDlg( SfxMacroAssignDlg(weld::Window* pParent,
vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame,
const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet);
const SfxItemSet& rSet ); SfxMacroTabPage* GetTabPage()
{
return static_cast<SfxMacroTabPage*>(m_xSfxPage.get());
}
}; };
#endif #endif
......
...@@ -318,23 +318,12 @@ void SfxMacroTabPage::AssignDeleteHdl(const weld::Widget* pBtn) ...@@ -318,23 +318,12 @@ void SfxMacroTabPage::AssignDeleteHdl(const weld::Widget* pBtn)
IMPL_LINK( SfxMacroTabPage, TimeOut_Impl, Timer*,, void ) IMPL_LINK( SfxMacroTabPage, TimeOut_Impl, Timer*,, void )
{ {
// FillMacroList() can take a long time -> show wait cursor and disable input // FillMacroList() can take a long time -> show wait cursor and disable input
SfxTabDialog* pTabDlg = GetTabDialog(); weld::Window* pDialog = GetDialogFrameWeld();
// perhaps the tabpage is part of a SingleTabDialog then pTabDlg == NULL // perhaps the tabpage is part of a SingleTabDialog then pDialog == nullptr
if ( pTabDlg ) std::unique_ptr<weld::WaitObject> xWait(pDialog ? new weld::WaitObject(pDialog) : nullptr);
{
pTabDlg->EnterWait();
pTabDlg->EnableInput( false );
}
// fill macro list // fill macro list
mpImpl->m_xGroupLB->Init( mpImpl->m_xGroupLB->Init(comphelper::getProcessComponentContext(), GetFrame(),
comphelper::getProcessComponentContext(), OUString(), false);
GetFrame(),
OUString(), false);
if ( pTabDlg )
{
pTabDlg->EnableInput();
pTabDlg->LeaveWait();
}
} }
void SfxMacroTabPage::InitAndSetHandler() void SfxMacroTabPage::InitAndSetHandler()
...@@ -398,14 +387,15 @@ VclPtr<SfxTabPage> SfxMacroTabPage::Create(TabPageParent pParent, const SfxItemS ...@@ -398,14 +387,15 @@ VclPtr<SfxTabPage> SfxMacroTabPage::Create(TabPageParent pParent, const SfxItemS
return CreateSfxMacroTabPage(pParent, *rAttrSet); return CreateSfxMacroTabPage(pParent, *rAttrSet);
} }
SfxMacroAssignDlg::SfxMacroAssignDlg(vcl::Window* pParent, SfxMacroAssignDlg::SfxMacroAssignDlg(weld::Window* pParent,
const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet) const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet)
: SfxSingleTabDialog(pParent, rSet, "EventAssignDialog", : SfxSingleTabDialogController(pParent, rSet,"cui/ui/eventassigndialog.ui",
"cui/ui/eventassigndialog.ui") "EventAssignDialog")
{ {
VclPtr<SfxMacroTabPage> pPage = CreateSfxMacroTabPage(get_content_area(), rSet); TabPageParent pPageParent(get_content_area(), this);
pPage->SetFrame( rxDocumentFrame ); VclPtr<SfxMacroTabPage> pPage = CreateSfxMacroTabPage(pPageParent, rSet);
SetTabPage( pPage ); pPage->SetFrame(rxDocumentFrame);
SetTabPage(pPage);
pPage->LaunchFillGroup(); pPage->LaunchFillGroup();
} }
......
...@@ -227,7 +227,6 @@ private: ...@@ -227,7 +227,6 @@ private:
class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxDialogController class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxDialogController
{ {
private: private:
VclPtr<SfxTabPage> m_xSfxPage;
std::unique_ptr<SfxItemSet> m_xOutputSet; std::unique_ptr<SfxItemSet> m_xOutputSet;
const SfxItemSet* m_pInputSet; const SfxItemSet* m_pInputSet;
...@@ -247,6 +246,7 @@ public: ...@@ -247,6 +246,7 @@ public:
const SfxItemSet* GetInputItemSet() const { return m_pInputSet; } const SfxItemSet* GetInputItemSet() const { return m_pInputSet; }
protected: protected:
VclPtr<SfxTabPage> m_xSfxPage;
std::unique_ptr<weld::Container> m_xContainer; std::unique_ptr<weld::Container> m_xContainer;
std::unique_ptr<weld::Button> m_xOKBtn; std::unique_ptr<weld::Button> m_xOKBtn;
std::unique_ptr<weld::Button> m_xHelpBtn; std::unique_ptr<weld::Button> m_xHelpBtn;
......
...@@ -438,9 +438,8 @@ public: ...@@ -438,9 +438,8 @@ public:
const SdrView* pView, const SdrView* pView,
sal_uInt32 nResId )=0; sal_uInt32 nResId )=0;
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) = 0; virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) = 0;
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog( vcl::Window* pParent, virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent, const SfxItemSet& rAttr,
const SfxItemSet& rAttr, const css::uno::Reference< css::frame::XFrame >& _rxFrame) = 0;
const css::uno::Reference< css::frame::XFrame >& _rxFrame )=0;
virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Window* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0; virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Window* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog( vcl::Window* pParent, const OUString& rLanguage ) override = 0; virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog( vcl::Window* pParent, const OUString& rLanguage ) override = 0;
......
...@@ -116,7 +116,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) ...@@ -116,7 +116,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
case SID_ASSIGNMACRO: case SID_ASSIGNMACRO:
{ {
if ( pSingleSelectedObj ) if ( pSingleSelectedObj )
ExecuteMacroAssign( pSingleSelectedObj, pWin ); ExecuteMacroAssign(pSingleSelectedObj, pWin ? pWin->GetFrameWeld() : nullptr);
} }
break; break;
...@@ -318,7 +318,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) ...@@ -318,7 +318,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
} }
} }
void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin ) void ScDrawShell::ExecuteMacroAssign(SdrObject* pObj, weld::Window* pWin)
{ {
SvxMacroItem aItem ( SfxGetpApp()->GetPool().GetWhich( SID_ATTR_MACROITEM ) ); SvxMacroItem aItem ( SfxGetpApp()->GetPool().GetWhich( SID_ATTR_MACROITEM ) );
ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, true ); ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, true );
......
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
void ExecFormatPaintbrush(const SfxRequest& rReq); void ExecFormatPaintbrush(const SfxRequest& rReq);
void StateFormatPaintbrush(SfxItemSet& rSet); void StateFormatPaintbrush(SfxItemSet& rSet);
void ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin ); void ExecuteMacroAssign(SdrObject* pObj, weld::Window* pWin);
void ExecuteLineDlg( SfxRequest& rReq ); void ExecuteLineDlg( SfxRequest& rReq );
void ExecuteAreaDlg( SfxRequest& rReq ); void ExecuteAreaDlg( SfxRequest& rReq );
void ExecuteTextAttrDlg( SfxRequest& rReq ); void ExecuteTextAttrDlg( SfxRequest& rReq );
......
...@@ -667,7 +667,7 @@ void IMapWindow::DoMacroAssign() ...@@ -667,7 +667,7 @@ void IMapWindow::DoMacroAssign()
aSet.Put( aMacroItem ); aSet.Put( aMacroItem );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( this, aSet, mxDocumentFrame )); ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(GetFrameWeld(), aSet, mxDocumentFrame));
if ( pMacroDlg->Execute() == RET_OK ) if ( pMacroDlg->Execute() == RET_OK )
{ {
......
...@@ -307,7 +307,7 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void) ...@@ -307,7 +307,7 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void)
IMPL_LINK_NOARG(SwCharURLPage, EventHdl, weld::Button&, void) IMPL_LINK_NOARG(SwCharURLPage, EventHdl, weld::Button&, void)
{ {
bModified |= SwMacroAssignDlg::INetFormatDlg(this, bModified |= SwMacroAssignDlg::INetFormatDlg(GetDialogFrameWeld(),
::GetActiveView()->GetWrtShell(), pINetItem); ::GetActiveView()->GetWrtShell(), pINetItem);
} }
......
...@@ -104,8 +104,8 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) ...@@ -104,8 +104,8 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType )
return aItem; return aItem;
} }
bool SwMacroAssignDlg::INetFormatDlg( vcl::Window* pParent, SwWrtShell& rSh, bool SwMacroAssignDlg::INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh,
std::unique_ptr<SvxMacroItem>& rpINetItem ) std::unique_ptr<SvxMacroItem>& rpINetItem )
{ {
bool bRet = false; bool bRet = false;
SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG>{} ); SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG>{} );
...@@ -119,7 +119,7 @@ bool SwMacroAssignDlg::INetFormatDlg( vcl::Window* pParent, SwWrtShell& rSh, ...@@ -119,7 +119,7 @@ bool SwMacroAssignDlg::INetFormatDlg( vcl::Window* pParent, SwWrtShell& rSh,
aSet.Put( AddEvents( MACASSGN_INETFMT ) ); aSet.Put( AddEvents( MACASSGN_INETFMT ) );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pMacroDlg( pFact->CreateEventConfigDialog( pParent, aSet, ScopedVclPtr<SfxAbstractDialog> pMacroDlg( pFact->CreateEventConfigDialog(pParent, aSet,
rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface() ) ); rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface() ) );
if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
{ {
......
...@@ -531,7 +531,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) ...@@ -531,7 +531,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool )
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( this, aSet, ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(GetFrameWeld(), aSet,
pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface() )); pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ));
if ( pMacroDlg && pMacroDlg->Execute() == RET_OK && if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
SfxItemState::SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, false, &pItem ) ) SfxItemState::SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, false, &pItem ) )
......
...@@ -38,8 +38,8 @@ class SwMacroAssignDlg ...@@ -38,8 +38,8 @@ class SwMacroAssignDlg
{ {
public: public:
static SfxEventNamesItem AddEvents( DlgEventType eType ); static SfxEventNamesItem AddEvents( DlgEventType eType );
static bool INetFormatDlg( vcl::Window* pParent, SwWrtShell& rSh, static bool INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh,
std::unique_ptr<SvxMacroItem>& rpINetItem ); std::unique_ptr<SvxMacroItem>& rpINetItem );
}; };
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment