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() ...@@ -1113,11 +1113,10 @@ void AbstractScriptSelectorDialog_Impl::SetRunLabel()
pDlg->SetRunLabel(); pDlg->SetRunLabel();
} }
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( vcl::Window* pParent, VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(weld::Window* pParent,
const OUString& rLanguage) const OUString& rLanguage)
{ {
VclPtrInstance<SvxScriptOrgDialog> pDlg( pParent, rLanguage); return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<SvxScriptOrgDialog>(pParent, rLanguage));
return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
} }
VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent, VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent,
......
...@@ -836,7 +836,7 @@ public: ...@@ -836,7 +836,7 @@ public:
virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) override; virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) override;
virtual DialogGetRanges GetDialogGetRangesFunc() 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> virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog( CreateScriptSelectorDialog(
......
...@@ -43,49 +43,6 @@ typedef std::unordered_map < OUString, OUString > Selection_hash; ...@@ -43,49 +43,6 @@ typedef std::unordered_map < OUString, OUString > Selection_hash;
class SFEntry; 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 { enum class InputDialogMode {
NEWLIB = 1, NEWLIB = 1,
NEWMACRO = 2, NEWMACRO = 2,
...@@ -122,18 +79,9 @@ public: ...@@ -122,18 +79,9 @@ public:
void setLoaded() { loaded=true; } void setLoaded() { loaded=true; }
}; };
class SvxScriptOrgDialog : public SfxModalDialog class SvxScriptOrgDialog : public SfxDialogController
{ {
protected: 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; OUString m_sLanguage;
static Selection_hash m_lastSelection; static Selection_hash m_lastSelection;
const OUString m_delErrStr; const OUString m_delErrStr;
...@@ -145,32 +93,63 @@ protected: ...@@ -145,32 +93,63 @@ protected:
const OUString m_createErrTitleStr; const OUString m_createErrTitleStr;
const OUString m_renameErrStr; const OUString m_renameErrStr;
const OUString m_renameErrTitleStr; const OUString m_renameErrTitleStr;
const OUString m_sMyMacros;
DECL_LINK( ScriptSelectHdl, SvTreeListBox *, void ); const OUString m_sProdMacros;
DECL_LINK( ButtonHdl, Button *, void );
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 ); 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 CheckButtons( css::uno::Reference< css::script::browse::XBrowseNode > const & node );
void createEntry(weld::TreeIter& rEntry);
void createEntry( SvTreeListEntry* pEntry ); void renameEntry(weld::TreeIter& rEntry);
void renameEntry( SvTreeListEntry* pEntry ); void deleteEntry(weld::TreeIter& rEntry);
void deleteEntry( SvTreeListEntry* pEntry ); css::uno::Reference<css::script::browse::XBrowseNode> getBrowseNode(const weld::TreeIter& rEntry);
static css::uno::Reference< css::script::browse::XBrowseNode > css::uno::Reference<css::frame::XModel> getModel(const weld::TreeIter& rEntry);
getBrowseNode( SvTreeListEntry const * pEntry );
static css::uno::Reference< css::frame::XModel > getModel( SvTreeListEntry const * pEntry );
OUString getListOfChildren( const css::uno::Reference< css::script::browse::XBrowseNode >& node, int depth ); OUString getListOfChildren( const css::uno::Reference< css::script::browse::XBrowseNode >& node, int depth );
void StoreCurrentSelection(); void StoreCurrentSelection();
void RestorePreviousSelection(); void RestorePreviousSelection();
public: void Init(const OUString& language);
// prob need another arg in the ctor void delUserData(weld::TreeIter& rIter);
// to specify the language or provider void deleteTree(weld::TreeIter& rIter);
SvxScriptOrgDialog( vcl::Window* pParent, const OUString& language ); void deleteAllTree();
virtual ~SvxScriptOrgDialog() override; void insertEntry(OUString const & rText, OUString const & rBitmap,
virtual void dispose() override; 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 class SvxScriptErrorDialog : public VclAbstractDialog
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
const css::uno::Reference < css::embed::XEmbeddedObject >& xObj )=0; const css::uno::Reference < css::embed::XEmbeddedObject >& xObj )=0;
virtual VclPtr<SfxAbstractPasteDialog> CreatePasteDialog(weld::Window* pParent) = 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<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> virtual VclPtr<AbstractScriptSelectorDialog>
CreateScriptSelectorDialog( CreateScriptSelectorDialog(
......
...@@ -428,7 +428,7 @@ public: ...@@ -428,7 +428,7 @@ public:
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent, const SfxItemSet& rAttr, virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent, 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(weld::Window* pParent, const OUString& rLanguage) override = 0;
virtual DialogGetRanges GetDialogGetRangesFunc() = 0; virtual DialogGetRanges GetDialogGetRangesFunc() = 0;
......
...@@ -1576,8 +1576,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) ...@@ -1576,8 +1576,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
OUString aLang( aLanguage ); OUString aLang( aLanguage );
SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: about to create dialog for: " << aLang); SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: about to create dialog for: " << aLang);
// not sure about the vcl::Window* ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxScriptOrgDialog(rReq.GetFrameWeld(), aLanguage));
ScopedVclPtr<VclAbstractDialog> pDlg( pFact->CreateSvxScriptOrgDialog( GetTopWindow(), aLanguage ) );
if( pDlg ) if( pDlg )
{ {
pDlg->Execute(); pDlg->Execute();
......
...@@ -472,7 +472,6 @@ custom_widgets = [ ...@@ -472,7 +472,6 @@ custom_widgets = [
'RowEdit', 'RowEdit',
'RubyEdit', 'RubyEdit',
'RubyPreview', 'RubyPreview',
'SFTreeListBox',
'SameContentListBox', 'SameContentListBox',
'ScAutoFmtPreview', 'ScAutoFmtPreview',
'ScCondFormatList', '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