weld OrganizeDialog

Change-Id: I976edb0b49c8439d1723be4544b10a5375b8e1d3
Reviewed-on: https://gerrit.libreoffice.org/73755
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2019-06-07 15:42:52 +01:00
parent 0e27158c4f
commit ad1cbee2ff
28 changed files with 1183 additions and 1267 deletions

View File

@ -328,10 +328,10 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
if ( rReq.GetArgs() ) if ( rReq.GetArgs() )
{ {
const SfxUInt16Item &rTabId = rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); const SfxUInt16Item &rTabId = rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID );
Organize( rTabId.GetValue() ); Organize(rReq.GetFrameWeld(), rTabId.GetValue());
} }
else else
Organize( 0 ); Organize(rReq.GetFrameWeld(), 0);
} }
break; break;
case SID_BASICIDE_CHOOSEMACRO: case SID_BASICIDE_CHOOSEMACRO:

View File

@ -55,14 +55,14 @@ extern "C" {
return pScriptURL; return pScriptURL;
} }
SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer( sal_Int16 nTabId ) SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer(void *pParent, sal_Int16 nTabId)
{ {
SAL_INFO("basctl.basicide","in basicide_macro_organizer"); SAL_INFO("basctl.basicide","in basicide_macro_organizer");
basctl::Organize( nTabId ); basctl::Organize(static_cast<weld::Window*>(pParent), nTabId);
} }
} }
void Organize( sal_Int16 tabId ) void Organize(weld::Window* pParent, sal_Int16 tabId)
{ {
EnsureIde(); EnsureIde();
@ -71,8 +71,8 @@ void Organize( sal_Int16 tabId )
if (BaseWindow* pCurWin = pShell->GetCurWindow()) if (BaseWindow* pCurWin = pShell->GetCurWindow())
aDesc = pCurWin->CreateEntryDescriptor(); aDesc = pCurWin->CreateEntryDescriptor();
vcl::Window* pParent = Application::GetDefDialogParent(); auto xDlg(std::make_shared<OrganizeDialog>(pParent, tabId, aDesc));
VclPtr<OrganizeDialog>::Create(pParent, tabId, aDesc)->StartExecuteAsync(nullptr); weld::DialogController::runAsync(xDlg, [](int) {});
} }
bool IsValidSbxName( const OUString& rName ) bool IsValidSbxName( const OUString& rName )
@ -247,7 +247,7 @@ OUString ChooseMacro(weld::Window* pParent,
OUString aScriptURL; OUString aScriptURL;
SbMethod* pMethod = nullptr; SbMethod* pMethod = nullptr;
MacroChooser aChooser(pParent, xDocFrame); MacroChooser aChooser(pParent, xDocFrame, true);
if ( bChooseOnly || !SvtModuleOptions::IsBasicIDE() ) if ( bChooseOnly || !SvtModuleOptions::IsBasicIDE() )
aChooser.SetMode(MacroChooser::ChooseOnly); aChooser.SetMode(MacroChooser::ChooseOnly);

View File

@ -50,7 +50,7 @@ using std::map;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
MacroChooser::MacroChooser(weld::Window* pParnt, const Reference< frame::XFrame >& xDocFrame) MacroChooser::MacroChooser(weld::Window* pParnt, const Reference< frame::XFrame >& xDocFrame, bool bCreateEntries)
: SfxDialogController(pParnt, "modules/BasicIDE/ui/basicmacrodialog.ui", "BasicMacroDialog") : SfxDialogController(pParnt, "modules/BasicIDE/ui/basicmacrodialog.ui", "BasicMacroDialog")
, m_xDocumentFrame(xDocFrame) , m_xDocumentFrame(xDocFrame)
// the Sfx doesn't ask the BasicManager whether modified or not // the Sfx doesn't ask the BasicManager whether modified or not
@ -107,6 +107,7 @@ MacroChooser::MacroChooser(weld::Window* pParnt, const Reference< frame::XFrame
if (SfxDispatcher* pDispatcher = GetDispatcher()) if (SfxDispatcher* pDispatcher = GetDispatcher())
pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
if (bCreateEntries)
m_xBasicBox->ScanAllEntries(); m_xBasicBox->ScanAllEntries();
} }
@ -742,9 +743,9 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
m_xBasicBox->get_selected(m_xBasicBoxIter.get()); m_xBasicBox->get_selected(m_xBasicBoxIter.get());
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get()); EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
VclPtrInstance< OrganizeDialog > pDlg( nullptr, 0, aDesc ); //TODO auto xDlg(std::make_shared<OrganizeDialog>(m_xDialog.get(), 0, aDesc));
pDlg->StartExecuteAsync([this](sal_Int32 nRet){ weld::DialogController::runAsync(xDlg, [this](sal_Int32 nRet) {
if ( nRet ) // not only closed if (nRet == RET_OK) // not only closed
{ {
m_xDialog->response(Macro_Edit); m_xDialog->response(Macro_Edit);
return; return;
@ -759,7 +760,6 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
} }
} }
void MacroChooser::UpdateFields() void MacroChooser::UpdateFields()
{ {
auto nMacroEntry = m_xMacroBox->get_selected_index(); auto nMacroEntry = m_xMacroBox->get_selected_index();

View File

@ -89,7 +89,7 @@ private:
std::unique_ptr<weld::Button> m_xNewLibButton; std::unique_ptr<weld::Button> m_xNewLibButton;
std::unique_ptr<weld::Button> m_xNewModButton; std::unique_ptr<weld::Button> m_xNewModButton;
public: public:
MacroChooser(weld::Window *pParent, const ::css::uno::Reference< ::css::frame::XFrame >& xDocFrame); MacroChooser(weld::Window *pParent, const ::css::uno::Reference< ::css::frame::XFrame >& xDocFrame, bool bCreateEntries);
virtual ~MacroChooser() override; virtual ~MacroChooser() override;
SbMethod* GetMacro(); SbMethod* GetMacro();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,6 @@
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
#include <vcl/tabctrl.hxx> #include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx>
#include <vcl/tabpage.hxx> #include <vcl/tabpage.hxx>
#include <vcl/weld.hxx> #include <vcl/weld.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XInteractionHandler.hpp>
@ -88,50 +87,6 @@ public:
bool isExportAsPackage () const { return m_bExportAsPackage; } bool isExportAsPackage () const { return m_bExportAsPackage; }
}; };
class ExtTreeListBox final : public TreeListBox
{
virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& rSel ) override;
virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) override;
virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, SvTreeListEntry* pEntry ) override;
virtual bool NotifyAcceptDrop( SvTreeListEntry* pEntry ) override;
virtual TriState NotifyMoving( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos ) override;
virtual TriState NotifyCopying( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos ) override;
TriState NotifyCopyingMoving( SvTreeListEntry* pTarget, SvTreeListEntry const * pEntry,
SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos, bool bMove );
public:
ExtTreeListBox(vcl::Window* pParent, WinBits nStyle);
};
class CheckBox : public SvTabListBox
{
private:
ObjectMode eMode;
std::unique_ptr<SvLBoxButtonData> pCheckButton;
ScriptDocument m_aDocument;
void Init();
public:
CheckBox(vcl::Window* pParent, WinBits nStyle);
virtual ~CheckBox() override;
virtual void dispose() override;
SvTreeListEntry* DoInsertEntry( const OUString& rStr, sal_uLong nPos = LISTBOX_APPEND );
SvTreeListEntry* FindEntry( const OUString& rName );
virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind) override;
virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& rSel ) override;
virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) override;
void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
void SetMode(ObjectMode);
};
class LibDialog : public weld::GenericDialogController class LibDialog : public weld::GenericDialogController
{ {
private: private:
@ -153,30 +108,39 @@ public:
void EnableReference (bool b) { m_xReferenceBox->set_sensitive(b); } void EnableReference (bool b) { m_xReferenceBox->set_sensitive(b); }
}; };
class OrganizeDialog : public TabDialog class OrganizeDialog;
class OrganizePage
{ {
private: protected:
VclPtr<TabControl> m_pTabCtrl; OrganizeDialog* m_pDialog;
EntryDescriptor m_aCurEntry; std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
OrganizePage(weld::Container* pParent, const OUString& rUIFile, const OString &rName, OrganizeDialog* pDialog);
virtual ~OrganizePage();
public: public:
OrganizeDialog( vcl::Window* pParent, sal_Int16 tabId, EntryDescriptor const & rDesc ); virtual void ActivatePage() = 0;
virtual ~OrganizeDialog() override;
virtual void dispose() override;
DECL_LINK( ActivatePageHdl, TabControl*, void );
}; };
class ObjectPage final : public TabPage class SbTreeListBoxDropTarget;
{
VclPtr<ExtTreeListBox> m_pBasicBox; class ObjectPage final : public OrganizePage
VclPtr<PushButton> m_pEditButton; {
VclPtr<PushButton> m_pNewModButton; std::unique_ptr<SbTreeListBox> m_xBasicBox;
VclPtr<PushButton> m_pNewDlgButton; std::unique_ptr<weld::Button> m_xEditButton;
VclPtr<PushButton> m_pDelButton; std::unique_ptr<weld::Button> m_xNewModButton;
std::unique_ptr<weld::Button> m_xNewDlgButton;
std::unique_ptr<weld::Button> m_xDelButton;
std::unique_ptr<SbTreeListBoxDropTarget> m_xDropTarget;
DECL_LINK( BasicBoxHighlightHdl, weld::TreeView&, void );
DECL_LINK( ButtonHdl, weld::Button&, void );
DECL_LINK( EditingEntryHdl, const weld::TreeIter&, bool );
typedef std::pair<const weld::TreeIter&, OUString> IterString;
DECL_LINK( EditedEntryHdl, const IterString&, bool );
DECL_LINK( BasicBoxHighlightHdl, SvTreeListBox*, void );
DECL_LINK( ButtonHdl, Button *, void );
void CheckButtons(); void CheckButtons();
bool GetSelection( ScriptDocument& rDocument, OUString& rLibName ); bool GetSelection( ScriptDocument& rDocument, OUString& rLibName );
void DeleteCurrent(); void DeleteCurrent();
@ -184,39 +148,36 @@ class ObjectPage final : public TabPage
void NewDialog(); void NewDialog();
void EndTabDialog(); void EndTabDialog();
VclPtr<TabDialog> pTabDlg;
virtual void ActivatePage() override;
virtual void DeactivatePage() override;
public: public:
ObjectPage(vcl::Window* pParent, const OString& rName, BrowseMode nMode); ObjectPage(weld::Container* pParent, const OString& rName, BrowseMode nMode, OrganizeDialog* pDialog);
virtual ~ObjectPage() override; virtual ~ObjectPage() override;
virtual void dispose() override;
void SetCurrentEntry( EntryDescriptor const & rDesc ); void SetCurrentEntry( EntryDescriptor const & rDesc );
void SetTabDlg( TabDialog* p ) { pTabDlg = p;} virtual void ActivatePage() override;
}; };
class LibPage final : public OrganizePage
class LibPage final : public TabPage
{ {
VclPtr<ListBox> m_pBasicsBox; std::unique_ptr<weld::ComboBox> m_xBasicsBox;
VclPtr<CheckBox> m_pLibBox; std::unique_ptr<weld::TreeView> m_xLibBox;
VclPtr<PushButton> m_pEditButton; std::unique_ptr<weld::Button> m_xEditButton;
VclPtr<PushButton> m_pPasswordButton; std::unique_ptr<weld::Button> m_xPasswordButton;
VclPtr<PushButton> m_pNewLibButton; std::unique_ptr<weld::Button> m_xNewLibButton;
VclPtr<PushButton> m_pInsertLibButton; std::unique_ptr<weld::Button> m_xInsertLibButton;
VclPtr<PushButton> m_pExportButton; std::unique_ptr<weld::Button> m_xExportButton;
VclPtr<PushButton> m_pDelButton; std::unique_ptr<weld::Button> m_xDelButton;
ScriptDocument m_aCurDocument; ScriptDocument m_aCurDocument;
LibraryLocation m_eCurLocation; LibraryLocation m_eCurLocation;
DECL_LINK( TreeListHighlightHdl, SvTreeListBox *, void ); DECL_LINK( TreeListHighlightHdl, weld::TreeView&, void );
DECL_LINK( BasicSelectHdl, ListBox&, void ); DECL_LINK( BasicSelectHdl, weld::ComboBox&, void );
DECL_LINK( ButtonHdl, Button *, void ); DECL_LINK( ButtonHdl, weld::Button&, void );
DECL_LINK( CheckPasswordHdl, SvxPasswordDialog *, bool ); DECL_LINK( CheckPasswordHdl, SvxPasswordDialog *, bool );
DECL_LINK( EditingEntryHdl, const weld::TreeIter&, bool );
typedef std::pair<const weld::TreeIter&, OUString> IterString;
DECL_LINK( EditedEntryHdl, const IterString&, bool );
void CheckButtons(); void CheckButtons();
void DeleteCurrent(); void DeleteCurrent();
void NewLib(); void NewLib();
@ -230,29 +191,35 @@ class LibPage final : public TabPage
void FillListBox(); void FillListBox();
void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
void SetCurLib(); void SetCurLib();
SvTreeListEntry* ImpInsertLibEntry( const OUString& rLibName, sal_uLong nPos ); void ImpInsertLibEntry( const OUString& rLibName, sal_uLong nPos );
virtual void ActivatePage() override;
virtual void DeactivatePage() override;
VclPtr<TabDialog> pTabDlg;
public: public:
explicit LibPage(vcl::Window* pParent); explicit LibPage(weld::Container* pParent, OrganizeDialog* pDialog);
virtual ~LibPage() override; virtual ~LibPage() override;
virtual void dispose() override; virtual void ActivatePage() override;
};
void SetTabDlg( TabDialog* p ) { pTabDlg = p;} class OrganizeDialog : public weld::GenericDialogController
{
private:
std::unique_ptr<weld::Notebook> m_xTabCtrl;
std::unique_ptr<ObjectPage> m_xModulePage;
std::unique_ptr<ObjectPage> m_xDialogPage;
std::unique_ptr<LibPage> m_xLibPage;
EntryDescriptor m_aCurEntry;
DECL_LINK(ActivatePageHdl, const OString&, void);
public:
OrganizeDialog(weld::Window* pParent, sal_Int16 tabId, EntryDescriptor const & rDesc);
virtual ~OrganizeDialog() override;
}; };
// Helper functions // Helper functions
SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument, SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
SbTreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain); SbTreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain);
SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
TreeListBox& rBasicBox, const OUString& rLibName, bool bMain);
void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument, void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
CheckBox* pLibBox, TreeListBox* pBasicBox); weld::TreeView* pLibBox, SbTreeListBox* pBasicBox);
void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
CheckBox* pLibBox, SbTreeListBox* pBasicBox);
} // namespace basctl } // namespace basctl

View File

@ -34,7 +34,7 @@ namespace weld { class Widget; class Window; }
namespace basctl namespace basctl
{ {
void Organize( sal_Int16 tabId ); void Organize(weld::Window* pParent, sal_Int16 tabId);
// help methods for the general use: // help methods for the general use:

View File

@ -309,8 +309,13 @@ public:
void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const { m_xControl->copy_iterator(rSource, rDest); } void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const { m_xControl->copy_iterator(rSource, rDest); }
bool get_selected(weld::TreeIter* pIter) const { return m_xControl->get_selected(pIter); } bool get_selected(weld::TreeIter* pIter) const { return m_xControl->get_selected(pIter); }
void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); } void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); }
void unselect(const weld::TreeIter& rIter) { m_xControl->unselect(rIter); }
void remove(const weld::TreeIter& rIter) { m_xControl->remove(rIter); }
bool get_cursor(weld::TreeIter* pIter) const { return m_xControl->get_cursor(pIter); } bool get_cursor(weld::TreeIter* pIter) const { return m_xControl->get_cursor(pIter); }
void set_cursor(const weld::TreeIter& rIter) { m_xControl->set_cursor(rIter); } void set_cursor(const weld::TreeIter& rIter) { m_xControl->set_cursor(rIter); }
OUString get_text(const weld::TreeIter& rIter) const { return m_xControl->get_text(rIter); }
void set_text(const weld::TreeIter& rIter, const OUString& rText) { m_xControl->set_text(rIter, rText); }
OUString get_id(const weld::TreeIter& rIter) const { return m_xControl->get_id(rIter); }
bool get_iter_first(weld::TreeIter& rIter) const { return m_xControl->get_iter_first(rIter); } bool get_iter_first(weld::TreeIter& rIter) const { return m_xControl->get_iter_first(rIter); }
bool iter_next_sibling(weld::TreeIter& rIter) const { return m_xControl->iter_next_sibling(rIter); } bool iter_next_sibling(weld::TreeIter& rIter) const { return m_xControl->iter_next_sibling(rIter); }
bool iter_children(weld::TreeIter& rIter) const { return m_xControl->iter_children(rIter); } bool iter_children(weld::TreeIter& rIter) const { return m_xControl->iter_children(rIter); }
@ -321,6 +326,15 @@ public:
void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); } void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
float get_approximate_digit_width() const { return m_xControl->get_approximate_digit_width(); } float get_approximate_digit_width() const { return m_xControl->get_approximate_digit_width(); }
int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); } int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
int get_iter_index_in_parent(const weld::TreeIter& rIter) const { return m_xControl->get_iter_index_in_parent(rIter); }
void connect_editing_started(const Link<const weld::TreeIter&, bool>& rLink)
{
m_xControl->connect_editing_started(rLink);
}
void connect_editing_done(const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rLink)
{
m_xControl->connect_editing_done(rLink);
}
void RemoveEntry(const weld::TreeIter& rIter); void RemoveEntry(const weld::TreeIter& rIter);
void RemoveEntry(const ScriptDocument&); void RemoveEntry(const ScriptDocument&);

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="basctl"> <interface domain="basctl">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/> <object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkGrid" id="DialogPage"> <object class="GtkGrid" id="DialogPage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -26,10 +35,10 @@
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="dialogpage|label1">Dialog:</property> <property name="label" translatable="yes" context="dialogpage|label1">Dialog:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">library:border</property> <property name="mnemonic_widget">library</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -37,13 +46,49 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="basctllo-ExtTreeListBox" id="library:border"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="library">
<property name="width_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="reorderable">True</property>
<property name="show_expanders">True</property>
<property name="search_column">1</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="CheckBox List-selection1"/> <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2">
<property name="editable">True</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child> </child>
</object> </object>
<packing> <packing>

View File

@ -2,7 +2,18 @@
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.18.3 -->
<interface domain="basctl"> <interface domain="basctl">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/> <object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name text1 -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkGrid" id="LibPage"> <object class="GtkGrid" id="LibPage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -38,7 +49,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="location"> <object class="GtkComboBoxText" id="location">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
@ -69,7 +80,7 @@
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes" context="libpage|lingudictsft">_Library:</property> <property name="label" translatable="yes" context="libpage|lingudictsft">_Library:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">library:border</property> <property name="mnemonic_widget">library</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -77,13 +88,59 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="basctllo-CheckBox" id="library:border"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="library">
<property name="width_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="search_column">1</property>
<property name="show_expanders">True</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="CheckBox List-selection1"/> <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2">
<property name="editable">True</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child> </child>
</object> </object>
<packing> <packing>

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="basctl"> <interface domain="basctl">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/> <object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkGrid" id="ModulePage"> <object class="GtkGrid" id="ModulePage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -26,10 +35,10 @@
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="modulepage|label1">M_odule:</property> <property name="label" translatable="yes" context="modulepage|label1">M_odule:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">library:border</property> <property name="mnemonic_widget">library</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -37,13 +46,49 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="basctllo-ExtTreeListBox" id="library:border"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="library">
<property name="width_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="reorderable">True</property>
<property name="show_expanders">True</property>
<property name="search_column">1</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="CheckBox List-selection1"/> <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2">
<property name="editable">True</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child> </child>
</object> </object>
<packing> <packing>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.22.1 -->
<interface domain="basctl"> <interface domain="basctl">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="OrganizeDialog"> <object class="GtkDialog" id="OrganizeDialog">
@ -7,7 +7,13 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="organizedialog|OrganizeDialog">%PRODUCTNAME Basic Macro Organizer</property> <property name="title" translatable="yes" context="organizedialog|OrganizeDialog">%PRODUCTNAME Basic Macro Organizer</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -71,6 +77,30 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
</child> </child>
<child type="tab"> <child type="tab">
@ -90,6 +120,30 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -113,6 +167,30 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing> <packing>
<property name="position">2</property> <property name="position">2</property>

View File

@ -742,7 +742,7 @@ include/vcl/svapp.hxx:801
void Application::AppEvent(const class ApplicationEvent &) void Application::AppEvent(const class ApplicationEvent &)
include/vcl/syswin.hxx:172 include/vcl/syswin.hxx:172
void SystemWindow::SetIdleDebugName(const char *) void SystemWindow::SetIdleDebugName(const char *)
include/vcl/tabdlg.hxx:48 include/vcl/toolkit/tabdlg.hxx:49
class vcl::Window * TabDialog::GetViewWindow() const class vcl::Window * TabDialog::GetViewWindow() const
include/vcl/textrectinfo.hxx:45 include/vcl/textrectinfo.hxx:45
_Bool TextRectInfo::operator!=(const class TextRectInfo &) const _Bool TextRectInfo::operator!=(const class TextRectInfo &) const

View File

@ -638,7 +638,7 @@ IMPL_LINK(ScreenshotAnnotationDlg_Impl, pictureFrameListener, VclWindowEvent&, r
ScreenshotAnnotationDlg::ScreenshotAnnotationDlg( ScreenshotAnnotationDlg::ScreenshotAnnotationDlg(
vcl::Window* pParent, vcl::Window* pParent,
Dialog& rParentDialog) Dialog& rParentDialog)
: SfxModalDialog(pParent, "ScreenshotAnnotationDialog", "cui/ui/screenshotannotationdialog.ui") : ModalDialog(pParent, "ScreenshotAnnotationDialog", "cui/ui/screenshotannotationdialog.ui")
{ {
m_pImpl.reset(new ScreenshotAnnotationDlg_Impl(*this, rParentDialog)); m_pImpl.reset(new ScreenshotAnnotationDlg_Impl(*this, rParentDialog));
} }

View File

@ -19,12 +19,12 @@
#ifndef INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX #ifndef INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX
#define INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX #define INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX
#include <sfx2/basedlgs.hxx> #include <vcl/dialog.hxx>
#include <memory> #include <memory>
class ScreenshotAnnotationDlg_Impl; class ScreenshotAnnotationDlg_Impl;
class ScreenshotAnnotationDlg : public SfxModalDialog class ScreenshotAnnotationDlg : public ModalDialog
{ {
private: private:
std::unique_ptr< ScreenshotAnnotationDlg_Impl > m_pImpl; std::unique_ptr< ScreenshotAnnotationDlg_Impl > m_pImpl;

View File

@ -191,9 +191,6 @@
<glade-widget-class title="Address Preview" name="swlo-SwAddressPreview" <glade-widget-class title="Address Preview" name="swlo-SwAddressPreview"
generic-name="Address Preview" parent="GtkDrawingArea" generic-name="Address Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Extended Macro Library" name="basctllo-ExtTreeListBox"
generic-name="Extended Macro Library List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Tree List" name="vcllo-SvTreeListBox" <glade-widget-class title="Tree List" name="vcllo-SvTreeListBox"
generic-name="Tree List" parent="GtkTreeView" generic-name="Tree List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"> icon-name="widget-gtk-treeview">
@ -220,9 +217,6 @@
<glade-widget-class title="Animation ListBox" name="sdlo-CustomAnimationList" <glade-widget-class title="Animation ListBox" name="sdlo-CustomAnimationList"
generic-name="Animation ListBox" parent="vcllo-SvTreeListBox" generic-name="Animation ListBox" parent="vcllo-SvTreeListBox"
icon-name="widget-gtk-treeview"/> icon-name="widget-gtk-treeview"/>
<glade-widget-class title="CheckBox List" name="basctllo-CheckBox"
generic-name="CheckBox List" parent="vcllo-SvTreeListBox"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Page Objs ListBox" name="sdlo-SdPageObjsTLB" <glade-widget-class title="Page Objs ListBox" name="sdlo-SdPageObjsTLB"
generic-name="SdPageObjsTLB" parent="vcllo-SvTreeListBox" generic-name="SdPageObjsTLB" parent="vcllo-SvTreeListBox"
icon-name="widget-gtk-treeview"/> icon-name="widget-gtk-treeview"/>

View File

@ -146,7 +146,7 @@ public:
// Basic/Scripting // Basic/Scripting
static bool IsXScriptURL( const OUString& rScriptURL ); static bool IsXScriptURL( const OUString& rScriptURL );
static OUString ChooseScript(weld::Window *pParent); static OUString ChooseScript(weld::Window *pParent);
static void MacroOrganizer( sal_Int16 nTabId ); static void MacroOrganizer(weld::Window* pParent, sal_Int16 nTabId);
static ErrCode CallBasic( const OUString&, BasicManager*, SbxArray *pArgs, SbxValue *pRet ); static ErrCode CallBasic( const OUString&, BasicManager*, SbxArray *pArgs, SbxValue *pRet );
static ErrCode CallAppBasic( const OUString& i_macroName ) static ErrCode CallAppBasic( const OUString& i_macroName )
{ return CallBasic( i_macroName, SfxApplication::GetBasicManager(), nullptr, nullptr ); } { return CallBasic( i_macroName, SfxApplication::GetBasicManager(), nullptr, nullptr ); }

View File

@ -593,6 +593,8 @@ protected:
Link<TreeView&, void> m_aRowActivatedHdl; Link<TreeView&, void> m_aRowActivatedHdl;
Link<int, void> m_aColumnClickedHdl; Link<int, void> m_aColumnClickedHdl;
Link<const std::pair<int, int>&, void> m_aRadioToggleHdl; Link<const std::pair<int, int>&, void> m_aRadioToggleHdl;
Link<const TreeIter&, bool> m_aEditingStartedHdl;
Link<const std::pair<const TreeIter&, OUString>&, bool> m_aEditingDoneHdl;
// if handler returns false, the expansion of the row is refused // if handler returns false, the expansion of the row is refused
Link<const TreeIter&, bool> m_aExpandingHdl; Link<const TreeIter&, bool> m_aExpandingHdl;
Link<TreeView&, void> m_aVisibleRangeChangedHdl; Link<TreeView&, void> m_aVisibleRangeChangedHdl;
@ -615,6 +617,13 @@ protected:
// arg is pair<row,col> // arg is pair<row,col>
void signal_toggled(const std::pair<int, int>& rRowCol) { m_aRadioToggleHdl.Call(rRowCol); } void signal_toggled(const std::pair<int, int>& rRowCol) { m_aRadioToggleHdl.Call(rRowCol); }
bool signal_editing_started(const TreeIter& rIter) { return m_aEditingStartedHdl.Call(rIter); }
bool signal_editing_done(const std::pair<const TreeIter&, OUString>& rIterText)
{
return m_aEditingDoneHdl.Call(rIterText);
}
public: public:
virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId, virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface, const OUString* pIconName, VirtualDevice* pImageSurface,
@ -807,6 +816,18 @@ public:
void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; } void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
// return true to allow editing, false to disallow
virtual void connect_editing_started(const Link<const TreeIter&, bool>& rLink)
{
m_aEditingStartedHdl = rLink;
}
virtual void
connect_editing_done(const Link<const std::pair<const TreeIter&, OUString>&, bool>& rLink)
{
m_aEditingDoneHdl = rLink;
}
virtual void connect_visible_range_changed(const Link<TreeView&, void>& rLink) virtual void connect_visible_range_changed(const Link<TreeView&, void>& rLink)
{ {
assert(!m_aVisibleRangeChangedHdl.IsSet() || !rLink.IsSet()); assert(!m_aVisibleRangeChangedHdl.IsSet() || !rLink.IsSet());

View File

@ -414,14 +414,14 @@ void SfxApplication::Invalidate( sal_uInt16 nId )
#ifndef DISABLE_DYNLOADING #ifndef DISABLE_DYNLOADING
typedef long (*basicide_handle_basic_error)(void const *); typedef long (*basicide_handle_basic_error)(void const *);
typedef void (*basicide_macro_organizer)(sal_Int16); typedef void (*basicide_macro_organizer)(void const *, sal_Int16);
extern "C" { static void thisModule() {} } extern "C" { static void thisModule() {} }
#else #else
extern "C" long basicide_handle_basic_error(void*); extern "C" long basicide_handle_basic_error(void*);
extern "C" void basicide_macro_organizer(sal_Int16); extern "C" void basicide_macro_organizer(void*, sal_Int16);
#endif #endif
@ -520,7 +520,7 @@ SfxApplication::ChooseScript(weld::Window *pParent)
return aScriptURL; return aScriptURL;
} }
void SfxApplication::MacroOrganizer( sal_Int16 nTabId ) void SfxApplication::MacroOrganizer(weld::Window* pParent, sal_Int16 nTabId)
{ {
#if !HAVE_FEATURE_SCRIPTING #if !HAVE_FEATURE_SCRIPTING
(void) nTabId; (void) nTabId;
@ -541,11 +541,11 @@ void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
return; return;
// call basicide_macro_organizer in basctl // call basicide_macro_organizer in basctl
pSymbol( nTabId ); pSymbol(pParent, nTabId);
#else #else
basicide_macro_organizer( nTabId ); basicide_macro_organizer(pParent, nTabId);
#endif #endif

View File

@ -1520,7 +1520,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
nTabId = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); nTabId = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
} }
SfxApplication::MacroOrganizer( nTabId ); SfxApplication::MacroOrganizer(rReq.GetFrameWeld(), nTabId);
rReq.Done(); rReq.Done();
} }
break; break;

View File

@ -7937,7 +7937,6 @@ include/vcl/syschild.hxx
include/vcl/sysdata.hxx include/vcl/sysdata.hxx
include/vcl/syswin.hxx include/vcl/syswin.hxx
include/vcl/tabctrl.hxx include/vcl/tabctrl.hxx
include/vcl/tabdlg.hxx
include/vcl/tabpage.hxx include/vcl/tabpage.hxx
include/vcl/task.hxx include/vcl/task.hxx
include/vcl/taskpanelist.hxx include/vcl/taskpanelist.hxx
@ -7951,6 +7950,7 @@ include/vcl/timer.hxx
include/vcl/toolbox.hxx include/vcl/toolbox.hxx
include/vcl/toolkit/group.hxx include/vcl/toolkit/group.hxx
include/vcl/toolkit/morebtn.hxx include/vcl/toolkit/morebtn.hxx
include/vcl/toolkit/tabdlg.hxx
include/vcl/toolkit/unowrap.hxx include/vcl/toolkit/unowrap.hxx
include/vcl/transfer.hxx include/vcl/transfer.hxx
include/vcl/treelist.hxx include/vcl/treelist.hxx

View File

@ -111,7 +111,7 @@
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/syschild.hxx> #include <vcl/syschild.hxx>
#include <vcl/tabctrl.hxx> #include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx> #include <vcl/toolkit/tabdlg.hxx>
#include <vcl/tabpage.hxx> #include <vcl/tabpage.hxx>
#include <vcl/toolbox.hxx> #include <vcl/toolbox.hxx>
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>

View File

@ -34,6 +34,8 @@ class LclTabListBox : public SvTabListBox
Link<SvTreeListBox*, void> m_aModelChangedHdl; Link<SvTreeListBox*, void> m_aModelChangedHdl;
Link<SvTreeListBox*, void> m_aStartDragHdl; Link<SvTreeListBox*, void> m_aStartDragHdl;
Link<SvTreeListBox*, void> m_aEndDragHdl; Link<SvTreeListBox*, void> m_aEndDragHdl;
Link<SvTreeListEntry*, bool> m_aEditingEntryHdl;
Link<std::pair<SvTreeListEntry*, OUString>, bool> m_aEditedEntryHdl;
public: public:
LclTabListBox(vcl::Window* pParent, WinBits nWinStyle) LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
@ -44,6 +46,14 @@ public:
void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; } void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
void SetStartDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aStartDragHdl = rLink; } void SetStartDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aStartDragHdl = rLink; }
void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; } void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; }
void SetEditingEntryHdl(const Link<SvTreeListEntry*, bool>& rLink)
{
m_aEditingEntryHdl = rLink;
}
void SetEditedEntryHdl(const Link<std::pair<SvTreeListEntry*, OUString>, bool>& rLink)
{
m_aEditedEntryHdl = rLink;
}
virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override
{ {
@ -114,6 +124,16 @@ public:
return pTargetEntry; return pTargetEntry;
} }
virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
{
return m_aEditingEntryHdl.Call(pEntry);
}
virtual bool EditedEntry(SvTreeListEntry* pEntry, const OUString& rNewText) override
{
return m_aEditedEntryHdl.Call(std::pair<SvTreeListEntry*, OUString>(pEntry, rNewText));
}
}; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View File

@ -2661,6 +2661,9 @@ private:
DECL_LINK(ModelChangedHdl, SvTreeListBox*, void); DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
DECL_LINK(StartDragHdl, SvTreeListBox*, void); DECL_LINK(StartDragHdl, SvTreeListBox*, void);
DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void); DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void);
DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool);
typedef std::pair<SvTreeListEntry*, OUString> IterString;
DECL_LINK(EditedEntryHdl, IterString, bool);
DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void); DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
DECL_LINK(CompareHdl, const SvSortData&, sal_Int32); DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
@ -2699,6 +2702,8 @@ public:
static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(LINK(this, SalInstanceTreeView, ModelChangedHdl)); static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(LINK(this, SalInstanceTreeView, ModelChangedHdl));
static_cast<LclTabListBox&>(*m_xTreeView).SetStartDragHdl(LINK(this, SalInstanceTreeView, StartDragHdl)); static_cast<LclTabListBox&>(*m_xTreeView).SetStartDragHdl(LINK(this, SalInstanceTreeView, StartDragHdl));
static_cast<LclTabListBox&>(*m_xTreeView).SetEndDragHdl(LINK(this, SalInstanceTreeView, FinishDragHdl)); static_cast<LclTabListBox&>(*m_xTreeView).SetEndDragHdl(LINK(this, SalInstanceTreeView, FinishDragHdl));
static_cast<LclTabListBox&>(*m_xTreeView).SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
static_cast<LclTabListBox&>(*m_xTreeView).SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
} }
m_aCheckButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl)); m_aCheckButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl)); m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
@ -3228,6 +3233,18 @@ public:
return ::get_text_emphasis(pEntry, col); return ::get_text_emphasis(pEntry, col);
} }
virtual void connect_editing_started(const Link<const weld::TreeIter&, bool>& rLink) override
{
m_xTreeView->EnableInplaceEditing(true);
weld::TreeView::connect_editing_started(rLink);
}
virtual void connect_editing_done(const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rLink) override
{
m_xTreeView->EnableInplaceEditing(true);
weld::TreeView::connect_editing_done(rLink);
}
void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col) void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col)
{ {
if (col == -1) if (col == -1)
@ -3929,6 +3946,16 @@ IMPL_LINK(SalInstanceTreeView, PopupMenuHdl, const CommandEvent&, rEvent, bool)
return m_aPopupMenuHdl.Call(rEvent); return m_aPopupMenuHdl.Call(rEvent);
} }
IMPL_LINK(SalInstanceTreeView, EditingEntryHdl, SvTreeListEntry*, pEntry, bool)
{
return signal_editing_started(SalInstanceTreeIter(pEntry));
}
IMPL_LINK(SalInstanceTreeView, EditedEntryHdl, IterString, rIterString, bool)
{
return signal_editing_done(std::pair<const weld::TreeIter&, OUString>(SalInstanceTreeIter(rIterString.first), rIterString.second));
}
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
{ {
private: private:

View File

@ -20,7 +20,7 @@
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/tabctrl.hxx> #include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx> #include <vcl/toolkit/tabdlg.hxx>
#include <vcl/tabpage.hxx> #include <vcl/tabpage.hxx>
void TabDialog::ImplInitTabDialogData() void TabDialog::ImplInitTabDialogData()

View File

@ -6651,6 +6651,50 @@ private:
gtk_tree_path_free(tree_path); gtk_tree_path_free(tree_path);
} }
DECL_LINK(async_stop_cell_editing, void*, void);
static void signalCellEditingStarted(GtkCellRenderer*, GtkCellEditable*, const gchar *path, gpointer widget)
{
GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
if (!pThis->signal_cell_editing_started(path))
Application::PostUserEvent(LINK(pThis, GtkInstanceTreeView, async_stop_cell_editing));
}
bool signal_cell_editing_started(const gchar *path)
{
GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkInstanceTreeIter aGtkIter(nullptr);
gtk_tree_model_get_iter(pModel, &aGtkIter.iter, tree_path);
gtk_tree_path_free(tree_path);
return signal_editing_started(aGtkIter);
}
static void signalCellEdited(GtkCellRendererText* pCell, const gchar *path, const gchar *pNewText, gpointer widget)
{
GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
pThis->signal_cell_edited(pCell, path, pNewText);
}
void signal_cell_edited(GtkCellRendererText* pCell, const gchar *path, const gchar* pNewText)
{
GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
GtkInstanceTreeIter aGtkIter(nullptr);
gtk_tree_model_get_iter(pModel, &aGtkIter.iter, tree_path);
gtk_tree_path_free(tree_path);
OUString sText = OUString(pNewText, pNewText ? strlen(pNewText) : 0, RTL_TEXTENCODING_UTF8);
if (signal_editing_done(std::pair<const weld::TreeIter&, OUString>(aGtkIter, sText)))
{
void* pData = g_object_get_data(G_OBJECT(pCell), "g-lo-CellIndex");
set(aGtkIter.iter, reinterpret_cast<sal_IntPtr>(pData), sText);
}
}
void signal_column_clicked(GtkTreeViewColumn* pClickedColumn) void signal_column_clicked(GtkTreeViewColumn* pClickedColumn)
{ {
int nIndex(0); int nIndex(0);
@ -6752,15 +6796,17 @@ public:
for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer)) for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer))
{ {
GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data); GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data);
g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", reinterpret_cast<gpointer>(nIndex));
if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer)) if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
{ {
if (m_nTextCol == -1) if (m_nTextCol == -1)
m_nTextCol = nIndex; m_nTextCol = nIndex;
m_aWeightMap[nIndex] = -1; m_aWeightMap[nIndex] = -1;
g_signal_connect(G_OBJECT(pCellRenderer), "editing-started", G_CALLBACK(signalCellEditingStarted), this);
g_signal_connect(G_OBJECT(pCellRenderer), "edited", G_CALLBACK(signalCellEdited), this);
} }
else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer)) else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer))
{ {
g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", reinterpret_cast<gpointer>(nIndex));
g_signal_connect(G_OBJECT(pCellRenderer), "toggled", G_CALLBACK(signalCellToggled), this); g_signal_connect(G_OBJECT(pCellRenderer), "toggled", G_CALLBACK(signalCellToggled), this);
m_aToggleVisMap[nIndex] = -1; m_aToggleVisMap[nIndex] = -1;
m_aToggleTriStateMap[nIndex] = -1; m_aToggleTriStateMap[nIndex] = -1;
@ -7318,6 +7364,10 @@ public:
void set_image(const GtkTreeIter& iter, int col, GdkPixbuf* pixbuf) void set_image(const GtkTreeIter& iter, int col, GdkPixbuf* pixbuf)
{ {
if (col == -1)
col = m_nExpanderImageCol;
else
col = get_model_col(col);
gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, pixbuf, -1); gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, pixbuf, -1);
if (pixbuf) if (pixbuf)
g_object_unref(pixbuf); g_object_unref(pixbuf);
@ -7351,20 +7401,12 @@ public:
virtual void set_image(const weld::TreeIter& rIter, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override virtual void set_image(const weld::TreeIter& rIter, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override
{ {
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter); const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
if (col == -1)
col = m_nExpanderImageCol;
else
col = get_model_col(col);
set_image(rGtkIter.iter, col, getPixbuf(rImage)); set_image(rGtkIter.iter, col, getPixbuf(rImage));
} }
virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col) override virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col) override
{ {
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter); const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
if (col == -1)
col = m_nExpanderImageCol;
else
col = get_model_col(col);
set_image(rGtkIter.iter, col, getPixbuf(rImage)); set_image(rGtkIter.iter, col, getPixbuf(rImage));
} }
@ -7919,12 +7961,11 @@ public:
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult) override virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult) override
{ {
gtk_drag_unhighlight(GTK_WIDGET(m_pTreeView)); const bool bAsTree = gtk_tree_view_get_enable_tree_lines(m_pTreeView);
gtk_drag_highlight(gtk_widget_get_parent(GTK_WIDGET(m_pTreeView)));
// to keep it simple we'll default to always drop before the current row // to keep it simple we'll default to always drop before the current row
// except for the special edge cases // except for the special edge cases
GtkTreeViewDropPosition pos = GTK_TREE_VIEW_DROP_BEFORE; GtkTreeViewDropPosition pos = bAsTree ? GTK_TREE_VIEW_DROP_INTO_OR_BEFORE : GTK_TREE_VIEW_DROP_BEFORE;
// unhighlight current highlighted row // unhighlight current highlighted row
gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, pos); gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, pos);
@ -7933,7 +7974,7 @@ public:
gtk_drag_unhighlight(GTK_WIDGET(m_pTreeView)); gtk_drag_unhighlight(GTK_WIDGET(m_pTreeView));
GtkTreePath *path = nullptr; GtkTreePath *path = nullptr;
GtkTreeViewDropPosition gtkpos = GTK_TREE_VIEW_DROP_BEFORE; GtkTreeViewDropPosition gtkpos = bAsTree ? GTK_TREE_VIEW_DROP_INTO_OR_BEFORE : GTK_TREE_VIEW_DROP_BEFORE;
bool ret = gtk_tree_view_get_dest_row_at_pos(m_pTreeView, rPos.X(), rPos.Y(), bool ret = gtk_tree_view_get_dest_row_at_pos(m_pTreeView, rPos.X(), rPos.Y(),
&path, &gtkpos); &path, &gtkpos);
@ -8074,6 +8115,14 @@ IMPL_LINK_NOARG(GtkInstanceTreeView, async_signal_changed, void*, void)
signal_changed(); signal_changed();
} }
IMPL_LINK_NOARG(GtkInstanceTreeView, async_stop_cell_editing, void*, void)
{
GtkTreeViewColumn *focus_column = nullptr;
gtk_tree_view_get_cursor(m_pTreeView, nullptr, &focus_column);
if (focus_column)
gtk_cell_area_stop_editing(gtk_cell_layout_get_area(GTK_CELL_LAYOUT(focus_column)), true);
}
class GtkInstanceSpinButton : public GtkInstanceEntry, public virtual weld::SpinButton class GtkInstanceSpinButton : public GtkInstanceEntry, public virtual weld::SpinButton
{ {
private: private: