Kaydet (Commit) 9aa75976 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxScriptOrgDialog

Change-Id: Ic196887e963bb96f330e47a7a507c143f95e7a61
Reviewed-on: https://gerrit.libreoffice.org/68204
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2befab59
......@@ -1113,11 +1113,10 @@ void AbstractScriptSelectorDialog_Impl::SetRunLabel()
pDlg->SetRunLabel();
}
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( vcl::Window* pParent,
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(weld::Window* pParent,
const OUString& rLanguage)
{
VclPtrInstance<SvxScriptOrgDialog> pDlg( pParent, rLanguage);
return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<SvxScriptOrgDialog>(pParent, rLanguage));
}
VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent,
......
......@@ -836,7 +836,7 @@ public:
virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) override;
virtual DialogGetRanges GetDialogGetRangesFunc() override;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog( vcl::Window* pParent, const OUString& rLanguage ) override;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) override;
virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog(
......
......@@ -43,49 +43,6 @@ typedef std::unordered_map < OUString, OUString > Selection_hash;
class SFEntry;
class SFTreeListBox : public SvTreeListBox
{
friend class SvxScriptOrgDialog;
private:
Image m_hdImage;
Image m_libImage;
Image m_macImage;
Image m_docImage;
OUString m_sMyMacros;
OUString m_sProdMacros;
static css::uno::Reference< css::script::browse::XBrowseNode >
getLangNodeFromRootNode( css::uno::Reference< css::script::browse::XBrowseNode > const & root, OUString const & language );
static void delUserData( SvTreeListEntry* pEntry );
static css::uno::Reference< css::uno::XInterface > getDocumentModel( css::uno::Reference< css::uno::XComponentContext > const & xCtx, OUString const & docName );
protected:
virtual void RequestingChildren( SvTreeListEntry* pParent ) override;
virtual void ExpandedHdl() override;
virtual bool ExpandingHdl() override;
public:
void Init( const OUString& language );
void RequestSubEntries( SvTreeListEntry* pRootEntry,
css::uno::Reference< css::script::browse::XBrowseNode > const & node,
css::uno::Reference< css::frame::XModel>& model );
SFTreeListBox(vcl::Window* pParent);
virtual ~SFTreeListBox() override;
virtual void dispose() override;
SvTreeListEntry * insertEntry(OUString const & rText, OUString const & rBitmap,
SvTreeListEntry * pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData,
const OUString& factoryURL );
SvTreeListEntry * insertEntry(OUString const & rText, OUString const & rBitmap,
SvTreeListEntry * pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData );
void deleteTree( SvTreeListEntry * pEntry );
void deleteAllTree( );
};
enum class InputDialogMode {
NEWLIB = 1,
NEWMACRO = 2,
......@@ -122,18 +79,9 @@ public:
void setLoaded() { loaded=true; }
};
class SvxScriptOrgDialog : public SfxModalDialog
class SvxScriptOrgDialog : public SfxDialogController
{
protected:
VclPtr<SFTreeListBox> m_pScriptsBox;
VclPtr<PushButton> m_pRunButton;
VclPtr<CloseButton> m_pCloseButton;
VclPtr<PushButton> m_pCreateButton;
VclPtr<PushButton> m_pEditButton;
VclPtr<PushButton> m_pRenameButton;
VclPtr<PushButton> m_pDelButton;
OUString m_sLanguage;
static Selection_hash m_lastSelection;
const OUString m_delErrStr;
......@@ -145,32 +93,63 @@ protected:
const OUString m_createErrTitleStr;
const OUString m_renameErrStr;
const OUString m_renameErrTitleStr;
DECL_LINK( ScriptSelectHdl, SvTreeListBox *, void );
DECL_LINK( ButtonHdl, Button *, void );
const OUString m_sMyMacros;
const OUString m_sProdMacros;
std::unique_ptr<weld::TreeView> m_xScriptsBox;
std::unique_ptr<weld::Button> m_xRunButton;
std::unique_ptr<weld::Button> m_xCloseButton;
std::unique_ptr<weld::Button> m_xCreateButton;
std::unique_ptr<weld::Button> m_xEditButton;
std::unique_ptr<weld::Button> m_xRenameButton;
std::unique_ptr<weld::Button> m_xDelButton;
DECL_LINK( ScriptSelectHdl, weld::TreeView&, void );
DECL_LINK( ExpandingHdl, weld::TreeIter&, bool );
DECL_LINK( ButtonHdl, weld::Button&, void );
static bool getBoolProperty( css::uno::Reference< css::beans::XPropertySet > const & xProps, OUString const & propName );
void CheckButtons( css::uno::Reference< css::script::browse::XBrowseNode > const & node );
void createEntry( SvTreeListEntry* pEntry );
void renameEntry( SvTreeListEntry* pEntry );
void deleteEntry( SvTreeListEntry* pEntry );
static css::uno::Reference< css::script::browse::XBrowseNode >
getBrowseNode( SvTreeListEntry const * pEntry );
static css::uno::Reference< css::frame::XModel > getModel( SvTreeListEntry const * pEntry );
void createEntry(weld::TreeIter& rEntry);
void renameEntry(weld::TreeIter& rEntry);
void deleteEntry(weld::TreeIter& rEntry);
css::uno::Reference<css::script::browse::XBrowseNode> getBrowseNode(const weld::TreeIter& rEntry);
css::uno::Reference<css::frame::XModel> getModel(const weld::TreeIter& rEntry);
OUString getListOfChildren( const css::uno::Reference< css::script::browse::XBrowseNode >& node, int depth );
void StoreCurrentSelection();
void RestorePreviousSelection();
public:
// prob need another arg in the ctor
// to specify the language or provider
SvxScriptOrgDialog( vcl::Window* pParent, const OUString& language );
virtual ~SvxScriptOrgDialog() override;
virtual void dispose() override;
void Init(const OUString& language);
void delUserData(weld::TreeIter& rIter);
void deleteTree(weld::TreeIter& rIter);
void deleteAllTree();
void insertEntry(OUString const & rText, OUString const & rBitmap,
weld::TreeIter* pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData,
const OUString& factoryURL, bool bSelect);
void insertEntry(OUString const & rText, OUString const & rBitmap,
weld::TreeIter* pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData,
bool bSelect);
void RequestSubEntries(weld::TreeIter& rRootEntry,
css::uno::Reference< css::script::browse::XBrowseNode > const & node,
css::uno::Reference< css::frame::XModel>& model);
static css::uno::Reference< css::script::browse::XBrowseNode >
getLangNodeFromRootNode( css::uno::Reference< css::script::browse::XBrowseNode > const & root, OUString const & language );
static css::uno::Reference< css::uno::XInterface > getDocumentModel( css::uno::Reference< css::uno::XComponentContext > const & xCtx, OUString const & docName );
virtual short Execute() override;
public:
// prob need another arg in the ctor
// to specify the language or provider
SvxScriptOrgDialog(weld::Window* pParent, const OUString& language);
virtual ~SvxScriptOrgDialog() override;
virtual short run() override;
};
class SvxScriptErrorDialog : public VclAbstractDialog
......
......@@ -140,7 +140,7 @@ public:
const css::uno::Reference < css::embed::XEmbeddedObject >& xObj )=0;
virtual VclPtr<SfxAbstractPasteDialog> CreatePasteDialog(weld::Window* pParent) = 0;
virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML=false, sfx2::SvBaseLink* p=nullptr) = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog( vcl::Window* pParent, const OUString& rLanguage ) = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) = 0;
virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog(
......
......@@ -428,7 +428,7 @@ public:
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;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) override = 0;
virtual DialogGetRanges GetDialogGetRangesFunc() = 0;
......
......@@ -1576,8 +1576,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
OUString aLang( aLanguage );
SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: about to create dialog for: " << aLang);
// not sure about the vcl::Window*
ScopedVclPtr<VclAbstractDialog> pDlg( pFact->CreateSvxScriptOrgDialog( GetTopWindow(), aLanguage ) );
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxScriptOrgDialog(rReq.GetFrameWeld(), aLanguage));
if( pDlg )
{
pDlg->Execute();
......
......@@ -472,7 +472,6 @@ custom_widgets = [
'RowEdit',
'RubyEdit',
'RubyPreview',
'SFTreeListBox',
'SameContentListBox',
'ScAutoFmtPreview',
'ScCondFormatList',
......
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