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