Kaydet (Commit) 6e65d918 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxScriptSelectorDialog

Change-Id: I885acfcdfd9544d7f4eb0e602a7acf0215cb9d92
Reviewed-on: https://gerrit.libreoffice.org/68220
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 298d5ee4
......@@ -327,6 +327,31 @@ OUString SfxConfigFunctionListBox::GetHelpText( bool bConsiderParent )
return OUString();
}
OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
{
int nSelected = m_xTreeView->get_selected_index();
if (nSelected != -1)
{
SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(nSelected).toInt64());
if (pData)
{
if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
{
if (bConsiderParent)
return Application::GetHelp()->GetHelpText(pData->sCommand, m_xTreeView.get());
else
return Application::GetHelp()->GetHelpText(pData->sCommand, static_cast<weld::Widget*>(nullptr));
}
else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
{
return pData->sHelpText;
}
}
}
return OUString();
}
OUString SfxConfigFunctionListBox::GetCurCommand()
{
SvTreeListEntry *pEntry = FirstSelected();
......@@ -505,6 +530,10 @@ void SfxConfigGroupListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
pStylesInfo = pStyles;
}
void CuiConfigGroupListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
{
m_pStylesInfo = pStyles;
}
void SfxConfigGroupListBox::InitModule()
{
......@@ -1782,48 +1811,47 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, weld::TreeIter&, rIter, bool)
*/
SvxScriptSelectorDialog::SvxScriptSelectorDialog(
vcl::Window* pParent, bool bShowSlots, const css::uno::Reference< css::frame::XFrame >& xFrame)
: ModalDialog(pParent, "MacroSelectorDialog", "cui/ui/macroselectordialog.ui")
weld::Window* pParent, bool bShowSlots, const css::uno::Reference< css::frame::XFrame >& xFrame)
: GenericDialogController(pParent, "cui/ui/macroselectordialog.ui", "MacroSelectorDialog")
, m_bShowSlots(bShowSlots)
, m_xDialogDescription(m_xBuilder->weld_label(bShowSlots ? "helptoolbar" : "helpmacro"))
, m_xCategories(new CuiConfigGroupListBox(m_xBuilder->weld_tree_view("categories")))
, m_xCommands(new CuiConfigFunctionListBox(m_xBuilder->weld_tree_view("commands")))
, m_xLibraryFT(m_xBuilder->weld_label("libraryft"))
, m_xCategoryFT(m_xBuilder->weld_label("categoryft"))
, m_xMacronameFT(m_xBuilder->weld_label("macronameft"))
, m_xCommandsFT(m_xBuilder->weld_label("commandsft"))
, m_xOKButton(m_xBuilder->weld_button(bShowSlots ? "add" : "ok"))
, m_xCancelButton(m_xBuilder->weld_button(bShowSlots ? "close" : "cancel"))
, m_xDescriptionText(m_xBuilder->weld_text_view("description"))
{
get<FixedText>("libraryft")->Show(!m_bShowSlots);
get<FixedText>("categoryft")->Show(m_bShowSlots);
get<FixedText>("macronameft")->Show(!m_bShowSlots);
get<FixedText>("commandsft")->Show(m_bShowSlots);
get(m_pDescriptionText, "description");
get(m_pCommands, "commands");
if (m_bShowSlots)
{
// If we are showing Slot API commands update labels in the UI
SetText(CuiResId(RID_SVXSTR_SELECTOR_ADD_COMMANDS));
get(m_pCancelButton, "close");
get(m_pDialogDescription, "helptoolbar");
get(m_pOKButton, "add");
m_xDialog->set_title(CuiResId(RID_SVXSTR_SELECTOR_ADD_COMMANDS));
}
else
{
get(m_pCancelButton, "cancel");
get(m_pDialogDescription, "helpmacro");
get(m_pOKButton, "ok");
}
m_pCancelButton->Show();
m_pDialogDescription->Show();
m_pOKButton->Show();
m_xCancelButton->show();
m_xDialogDescription->show();
m_xOKButton->show();
m_xLibraryFT->show(!m_bShowSlots);
m_xCategoryFT->show(m_bShowSlots);
m_xMacronameFT->show(!m_bShowSlots);
m_xCommandsFT->show(m_bShowSlots);
get(m_pCategories, "categories");
const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
m_pCategories->SetFunctionListBox(m_pCommands);
m_pCategories->Init(comphelper::getProcessComponentContext(), xFrame, aModuleName, bShowSlots);
m_xCategories->SetFunctionListBox(m_xCommands.get());
m_xCategories->Init(comphelper::getProcessComponentContext(), xFrame, aModuleName, bShowSlots);
m_pCategories->SetSelectHdl(
m_xCategories->connect_changed(
LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
m_pCommands->SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
m_pCommands->SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
m_xCommands->connect_changed( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
m_xCommands->connect_row_activated( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
m_pOKButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
m_pCancelButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
m_xOKButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
m_xCancelButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
m_sDefaultDesc = m_pDescriptionText->GetText();
m_sDefaultDesc = m_xDescriptionText->get_text();
// Support style commands
uno::Reference<frame::XController> xController;
......@@ -1834,41 +1862,28 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
xModel = xController->getModel();
m_aStylesInfo.init(aModuleName, xModel);
m_pCategories->SetStylesInfo(&m_aStylesInfo);
m_xCategories->SetStylesInfo(&m_aStylesInfo);
UpdateUI();
}
SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
{
disposeOnce();
}
void SvxScriptSelectorDialog::dispose()
IMPL_LINK(SvxScriptSelectorDialog, SelectHdl, weld::TreeView&, rCtrl, void)
{
m_pDialogDescription.clear();
m_pCategories.clear();
m_pCommands.clear();
m_pOKButton.clear();
m_pCancelButton.clear();
m_pDescriptionText.clear();
ModalDialog::dispose();
}
IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, SvTreeListBox*, pCtrl, void )
{
if (pCtrl == m_pCategories)
if (&rCtrl == &m_xCategories->get_widget())
{
m_pCategories->GroupSelected();
m_xCategories->GroupSelected();
}
UpdateUI();
}
IMPL_LINK_NOARG( SvxScriptSelectorDialog, FunctionDoubleClickHdl, SvTreeListBox*, bool )
IMPL_LINK_NOARG(SvxScriptSelectorDialog, FunctionDoubleClickHdl, weld::TreeView&, void)
{
if (m_pOKButton->IsEnabled())
ClickHdl(m_pOKButton);
return false;
if (m_xOKButton->get_sensitive())
ClickHdl(*m_xOKButton);
}
// Check if command is selected and enable the OK button accordingly
......@@ -1879,42 +1894,38 @@ SvxScriptSelectorDialog::UpdateUI()
OUString url = GetScriptURL();
if ( !url.isEmpty() )
{
OUString sMessage = m_pCommands->GetHelpText();
m_pDescriptionText->SetText(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
OUString sMessage = m_xCommands->GetHelpText();
m_xDescriptionText->set_text(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
m_pOKButton->Enable();
m_xOKButton->set_sensitive(true);
}
else
{
m_pDescriptionText->SetText(m_sDefaultDesc);
m_pOKButton->Enable( false );
m_xDescriptionText->set_text(m_sDefaultDesc);
m_xOKButton->set_sensitive(false);
}
}
IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton, void )
IMPL_LINK(SvxScriptSelectorDialog, ClickHdl, weld::Button&, rButton, void)
{
if (pButton == m_pCancelButton)
if (&rButton == m_xCancelButton.get())
{
EndDialog();
m_xDialog->response(RET_CANCEL);
}
else if (pButton == m_pOKButton)
else if (&rButton == m_xOKButton.get())
{
// If we are displaying Slot API commands then this the dialog is being
// run from Tools/Configure and we should not close it
if ( !m_bShowSlots )
{
EndDialog( RET_OK );
m_xDialog->response(RET_OK);
}
else
{
// Select the next entry in the list if possible
SvTreeListEntry* current = m_pCommands->FirstSelected();
SvTreeListEntry* next = current->NextSibling();
if ( next != nullptr )
{
m_pCommands->Select( next );
}
std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
if (m_xCommands->get_selected(xIter.get()) && m_xCommands->iter_next_sibling(*xIter))
m_xCommands->select(*xIter);
}
}
}
......@@ -1922,7 +1933,7 @@ IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton, void )
void
SvxScriptSelectorDialog::SetRunLabel()
{
m_pOKButton->SetText(CuiResId(RID_SVXSTR_SELECTOR_RUN));
m_xOKButton->set_label(CuiResId(RID_SVXSTR_SELECTOR_RUN));
}
OUString
......@@ -1930,10 +1941,10 @@ SvxScriptSelectorDialog::GetScriptURL() const
{
OUString result;
SvTreeListEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->m_pCommands->FirstSelected();
if ( pEntry )
std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
if (m_xCommands->get_selected(xIter.get()))
{
SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter).toInt64());
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
|| ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
|| ( pData->nKind == SfxCfgKind::GROUP_STYLES )
......
......@@ -645,17 +645,14 @@ void SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton*
else if( bAssEnabled )
{
// assign pressed
ScopedVclPtrInstance< SvxScriptSelectorDialog > pDlg( pThis, false, pThis->GetFrame() );
if( pDlg )
SvxScriptSelectorDialog aDlg(pThis->GetDialogFrameWeld(), false, pThis->GetFrame());
short ret = aDlg.run();
if ( ret )
{
short ret = pDlg->Execute();
if ( ret )
{
sEventType = "Script";
sEventURL = pDlg->GetScriptURL();
if(!pThis->bAppEvents)
pThis->bDocModified = true;
}
sEventType = "Script";
sEventURL = aDlg.GetScriptURL();
if(!pThis->bAppEvents)
pThis->bDocModified = true;
}
}
......
......@@ -144,7 +144,10 @@ short AbstractTitleDialog_Impl::Execute()
return m_xDlg->run();
}
IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl);
short AbstractScriptSelectorDialog_Impl::Execute()
{
return m_xDlg->run();
}
short AbstractGalleryIdDialog_Impl::Execute()
{
......@@ -1093,24 +1096,20 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateScriptErrorDialog(co
return VclPtr<SvxScriptErrorDialog>::Create(rException);
}
VclPtr<AbstractScriptSelectorDialog> AbstractDialogFactory_Impl::CreateScriptSelectorDialog(
vcl::Window* pParent, const Reference< frame::XFrame >& _rxFrame )
VclPtr<AbstractScriptSelectorDialog> AbstractDialogFactory_Impl::CreateScriptSelectorDialog(weld::Window* pParent,
const Reference<frame::XFrame>& rxFrame)
{
VclPtrInstance<SvxScriptSelectorDialog> pDlg(pParent, false/*bShowSlots*/, _rxFrame);
return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(pDlg);
return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_unique<SvxScriptSelectorDialog>(pParent, false/*bShowSlots*/, rxFrame));
}
OUString AbstractScriptSelectorDialog_Impl::GetScriptURL() const
{
if (pDlg)
return pDlg->GetScriptURL();
return OUString();
return m_xDlg->GetScriptURL();
}
void AbstractScriptSelectorDialog_Impl::SetRunLabel()
{
if (pDlg)
pDlg->SetRunLabel();
m_xDlg->SetRunLabel();
}
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(weld::Window* pParent,
......
......@@ -282,11 +282,15 @@ public:
class SvxScriptSelectorDialog;
class AbstractScriptSelectorDialog_Impl : public AbstractScriptSelectorDialog
{
DECL_ABSTDLG_BASE(
AbstractScriptSelectorDialog_Impl, SvxScriptSelectorDialog)
protected:
std::unique_ptr<SvxScriptSelectorDialog> m_xDlg;
public:
explicit AbstractScriptSelectorDialog_Impl(std::unique_ptr<SvxScriptSelectorDialog> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
virtual OUString GetScriptURL() const override;
virtual void SetRunLabel() override;
};
......@@ -838,11 +842,8 @@ public:
virtual DialogGetRanges GetDialogGetRangesFunc() override;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) override;
virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog(
vcl::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& _rxFrame
) override;
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) override;
virtual VclPtr<VclAbstractDialog> CreateScriptErrorDialog(const css::uno::Any& rException) override;
......
......@@ -148,7 +148,10 @@ public:
bool get_iter_first(weld::TreeIter& rIter) const { return m_xTreeView->get_iter_first(rIter); }
// set iter to point to next node, depth first, then sibling
bool iter_next(weld::TreeIter& rIter) const { return m_xTreeView->iter_next(rIter); }
bool iter_next_sibling(weld::TreeIter& rIter) const { return m_xTreeView->iter_next_sibling(rIter); }
OUString get_text(const weld::TreeIter& rIter) const { return m_xTreeView->get_text(rIter); }
OUString get_id(const weld::TreeIter& rIter) const { return m_xTreeView->get_id(rIter); }
bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); }
void scroll_to_row(const weld::TreeIter& rIter) { return m_xTreeView->scroll_to_row(rIter); }
void select(const weld::TreeIter& rIter) { m_xTreeView->select(rIter); }
......@@ -156,6 +159,7 @@ public:
void ClearAll();
OUString GetSelectedScriptURI();
OUString GetHelpText( bool bConsiderParent = true );
};
struct SvxConfigGroupBoxResource_Impl;
......@@ -250,6 +254,7 @@ public:
CuiConfigGroupListBox(std::unique_ptr<weld::TreeView> xTreeView);
void set_sensitive(bool bSensitive) { m_xTreeView->set_sensitive(bSensitive); }
void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
const weld::TreeView& get_widget() const { return *m_xTreeView; }
~CuiConfigGroupListBox();
void ClearAll();
......@@ -260,35 +265,36 @@ public:
void SetFunctionListBox( CuiConfigFunctionListBox *pBox )
{ m_pFunctionListBox = pBox; }
void GroupSelected();
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
};
class SvxScriptSelectorDialog : public ModalDialog
class SvxScriptSelectorDialog : public weld::GenericDialogController
{
VclPtr<FixedText> m_pDialogDescription;
VclPtr<SfxConfigGroupListBox> m_pCategories;
VclPtr<SfxConfigFunctionListBox> m_pCommands;
VclPtr<PushButton> m_pOKButton;
VclPtr<PushButton> m_pCancelButton;
VclPtr<VclMultiLineEdit> m_pDescriptionText;
OUString m_sDefaultDesc;
SfxStylesInfo_Impl m_aStylesInfo;
bool m_bShowSlots;
DECL_LINK( ClickHdl, Button *, void );
DECL_LINK( SelectHdl, SvTreeListBox*, void );
DECL_LINK( FunctionDoubleClickHdl, SvTreeListBox*, bool );
std::unique_ptr<weld::Label> m_xDialogDescription;
std::unique_ptr<CuiConfigGroupListBox> m_xCategories;
std::unique_ptr<CuiConfigFunctionListBox> m_xCommands;
std::unique_ptr<weld::Label> m_xLibraryFT;
std::unique_ptr<weld::Label> m_xCategoryFT;
std::unique_ptr<weld::Label> m_xMacronameFT;
std::unique_ptr<weld::Label> m_xCommandsFT;
std::unique_ptr<weld::Button> m_xOKButton;
std::unique_ptr<weld::Button> m_xCancelButton;
std::unique_ptr<weld::TextView> m_xDescriptionText;
DECL_LINK(ClickHdl, weld::Button&, void);
DECL_LINK(SelectHdl, weld::TreeView&, void);
DECL_LINK(FunctionDoubleClickHdl, weld::TreeView&, void);
void UpdateUI();
public:
SvxScriptSelectorDialog (
vcl::Window* pParent,
bool bShowSlots,
const css::uno::Reference< css::frame::XFrame >& xFrame
);
SvxScriptSelectorDialog(weld::Window* pParent, bool bShowSlots,
const css::uno::Reference< css::frame::XFrame >& xFrame);
virtual ~SvxScriptSelectorDialog() override;
virtual void dispose() override;
OUString GetScriptURL() const;
void SetRunLabel();
......
......@@ -162,7 +162,7 @@ public:
// Basic/Scripting
static bool IsXScriptURL( const OUString& rScriptURL );
static OUString ChooseScript();
static OUString ChooseScript(weld::Window *pParent);
static void MacroOrganizer( sal_Int16 nTabId );
static ErrCode CallBasic( const OUString&, BasicManager*, SbxArray *pArgs, SbxValue *pRet );
static ErrCode CallAppBasic( const OUString& i_macroName )
......
......@@ -142,11 +142,8 @@ public:
virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML=false, sfx2::SvBaseLink* p=nullptr) = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) = 0;
virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog(
vcl::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& _rxFrame
) = 0;
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) = 0;
virtual VclPtr<VclAbstractDialog> CreateScriptErrorDialog( const css::uno::Any& rException ) = 0;
......
......@@ -432,11 +432,8 @@ public:
virtual DialogGetRanges GetDialogGetRangesFunc() = 0;
virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog(
vcl::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& _rxFrame
) override = 0;
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) override = 0;
virtual VclPtr<VclAbstractDialog> CreateScriptErrorDialog(const css::uno::Any& rException) override = 0;
......
......@@ -830,7 +830,7 @@ IMPL_LINK_NOARG(ScTPValidationError, ClickSearchHdl, weld::Button&, void)
{
// Use static SfxApplication method to bring up selector dialog for
// choosing a script
OUString aScriptURL = SfxApplication::ChooseScript();
OUString aScriptURL = SfxApplication::ChooseScript(GetDialogFrameWeld());
if ( !aScriptURL.isEmpty() )
{
......
......@@ -424,7 +424,7 @@ void SdTPAction::OpenFileDialog()
else if (bMacro)
{
// choose macro dialog
OUString aScriptURL = SfxApplication::ChooseScript();
OUString aScriptURL = SfxApplication::ChooseScript(GetFrameWeld());
if ( !aScriptURL.isEmpty() )
{
......
......@@ -490,7 +490,7 @@ bool SfxApplication::IsXScriptURL( const OUString& rScriptURL )
}
OUString
SfxApplication::ChooseScript()
SfxApplication::ChooseScript(weld::Window *pParent)
{
OUString aScriptURL;
......@@ -502,8 +502,7 @@ SfxApplication::ChooseScript()
const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr;
uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() );
ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(
pFact->CreateScriptSelectorDialog( nullptr, xFrame ));
ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog(pParent, xFrame));
SAL_INFO( "sfx.appl", "done, now exec it");
......
......@@ -1273,25 +1273,12 @@ static OUString ChooseMacro(weld::Window* pParent, const Reference<XModel>& rxLi
namespace
{
#if HAVE_FEATURE_SCRIPTING
vcl::Window* lcl_getDialogParent( const Reference< XFrame >& _rxFrame, vcl::Window* _pFallback )
weld::Window* lcl_getDialogParent(const Reference<XFrame>& rxFrame)
{
if ( !_rxFrame.is() )
return _pFallback;
try
{
Reference< awt::XWindow > xContainerWindow( _rxFrame->getContainerWindow(), UNO_SET_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
OSL_ENSURE( pWindow, "lcl_getDialogParent: cool, somebody implemented a VCL-less toolkit!" );
if ( pWindow )
return pWindow->GetSystemWindow();
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("sfx.appl");
}
return _pFallback;
Reference<awt::XWindow> xContainerWindow;
if (rxFrame.is())
xContainerWindow = rxFrame->getContainerWindow();
return Application::GetFrameWeld(xContainerWindow);
}
SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell const * i_pBasicIDE )
......@@ -1529,8 +1516,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
do // artificial loop for flow control
{
ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog(
lcl_getDialogParent( xFrame, GetTopWindow() ), xFrame ));
ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog(lcl_getDialogParent(xFrame), xFrame));
OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" );
if ( !pDlg )
break;
......
......@@ -547,7 +547,7 @@ void SwFieldFuncPage::UpdateSubType()
// call MacroBrowser, fill Listbox with Macros
IMPL_LINK_NOARG( SwFieldFuncPage, MacroHdl, Button *, void)
{
if (GetFieldMgr().ChooseMacro())
if (GetFieldMgr().ChooseMacro(GetDialogFrameWeld()))
UpdateSubType();
}
......
......@@ -1782,12 +1782,12 @@ void SwFieldType::GetFieldName_()
}
}
bool SwFieldMgr::ChooseMacro()
bool SwFieldMgr::ChooseMacro(weld::Window* pDialogParent)
{
bool bRet = false;
// choose script dialog
OUString aScriptURL = SfxApplication::ChooseScript();
OUString aScriptURL = SfxApplication::ChooseScript(pDialogParent);
// the script selector dialog returns a valid script URL
if ( !aScriptURL.isEmpty() )
......
......@@ -44,6 +44,7 @@ class SbModule;
class SvxMacroItem;
class SvNumberFormatter;
namespace vcl { class Window; }
namespace weld { class Window; }
enum class SwFieldIds : sal_uInt16;
// the groups of fields
......@@ -137,7 +138,7 @@ public:
void InsertFieldType(SwFieldType const & rType);
bool ChooseMacro();
bool ChooseMacro(weld::Window* pDialogParent);
void SetMacroPath(const OUString& rPath);
const OUString& GetMacroPath() const { return m_sMacroPath; }
const OUString& GetMacroName() const { return m_sMacroName; }
......
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