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() )
{
const SfxUInt16Item &rTabId = rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID );
Organize( rTabId.GetValue() );
Organize(rReq.GetFrameWeld(), rTabId.GetValue());
}
else
Organize( 0 );
Organize(rReq.GetFrameWeld(), 0);
}
break;
case SID_BASICIDE_CHOOSEMACRO:

View File

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

View File

@ -50,7 +50,7 @@ using std::map;
using namespace ::com::sun::star;
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")
, m_xDocumentFrame(xDocFrame)
// the Sfx doesn't ask the BasicManager whether modified or not
@ -107,7 +107,8 @@ MacroChooser::MacroChooser(weld::Window* pParnt, const Reference< frame::XFrame
if (SfxDispatcher* pDispatcher = GetDispatcher())
pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
m_xBasicBox->ScanAllEntries();
if (bCreateEntries)
m_xBasicBox->ScanAllEntries();
}
MacroChooser::~MacroChooser()
@ -742,24 +743,23 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
m_xBasicBox->get_selected(m_xBasicBoxIter.get());
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
VclPtrInstance< OrganizeDialog > pDlg( nullptr, 0, aDesc ); //TODO
pDlg->StartExecuteAsync([this](sal_Int32 nRet){
if ( nRet ) // not only closed
{
m_xDialog->response(Macro_Edit);
return;
}
auto xDlg(std::make_shared<OrganizeDialog>(m_xDialog.get(), 0, aDesc));
weld::DialogController::runAsync(xDlg, [this](sal_Int32 nRet) {
if (nRet == RET_OK) // not only closed
{
m_xDialog->response(Macro_Edit);
return;
}
Shell* pShell = GetShell();
if ( pShell && pShell->IsAppBasicModified() )
bForceStoreBasic = true;
Shell* pShell = GetShell();
if ( pShell && pShell->IsAppBasicModified() )
bForceStoreBasic = true;
m_xBasicBox->UpdateEntries();
});
m_xBasicBox->UpdateEntries();
});
}
}
void MacroChooser::UpdateFields()
{
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_xNewModButton;
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;
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/lstbox.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
@ -88,50 +87,6 @@ public:
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
{
private:
@ -153,30 +108,39 @@ public:
void EnableReference (bool b) { m_xReferenceBox->set_sensitive(b); }
};
class OrganizeDialog : public TabDialog
class OrganizeDialog;
class OrganizePage
{
private:
VclPtr<TabControl> m_pTabCtrl;
EntryDescriptor m_aCurEntry;
protected:
OrganizeDialog* m_pDialog;
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:
OrganizeDialog( vcl::Window* pParent, sal_Int16 tabId, EntryDescriptor const & rDesc );
virtual ~OrganizeDialog() override;
virtual void dispose() override;
DECL_LINK( ActivatePageHdl, TabControl*, void );
virtual void ActivatePage() = 0;
};
class ObjectPage final : public TabPage
{
VclPtr<ExtTreeListBox> m_pBasicBox;
VclPtr<PushButton> m_pEditButton;
VclPtr<PushButton> m_pNewModButton;
VclPtr<PushButton> m_pNewDlgButton;
VclPtr<PushButton> m_pDelButton;
class SbTreeListBoxDropTarget;
class ObjectPage final : public OrganizePage
{
std::unique_ptr<SbTreeListBox> m_xBasicBox;
std::unique_ptr<weld::Button> m_xEditButton;
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();
bool GetSelection( ScriptDocument& rDocument, OUString& rLibName );
void DeleteCurrent();
@ -184,39 +148,36 @@ class ObjectPage final : public TabPage
void NewDialog();
void EndTabDialog();
VclPtr<TabDialog> pTabDlg;
virtual void ActivatePage() override;
virtual void DeactivatePage() override;
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 void dispose() override;
void SetCurrentEntry( EntryDescriptor const & rDesc );
void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
virtual void ActivatePage() override;
};
class LibPage final : public TabPage
class LibPage final : public OrganizePage
{
VclPtr<ListBox> m_pBasicsBox;
VclPtr<CheckBox> m_pLibBox;
VclPtr<PushButton> m_pEditButton;
VclPtr<PushButton> m_pPasswordButton;
VclPtr<PushButton> m_pNewLibButton;
VclPtr<PushButton> m_pInsertLibButton;
VclPtr<PushButton> m_pExportButton;
VclPtr<PushButton> m_pDelButton;
std::unique_ptr<weld::ComboBox> m_xBasicsBox;
std::unique_ptr<weld::TreeView> m_xLibBox;
std::unique_ptr<weld::Button> m_xEditButton;
std::unique_ptr<weld::Button> m_xPasswordButton;
std::unique_ptr<weld::Button> m_xNewLibButton;
std::unique_ptr<weld::Button> m_xInsertLibButton;
std::unique_ptr<weld::Button> m_xExportButton;
std::unique_ptr<weld::Button> m_xDelButton;
ScriptDocument m_aCurDocument;
LibraryLocation m_eCurLocation;
DECL_LINK( TreeListHighlightHdl, SvTreeListBox *, void );
DECL_LINK( BasicSelectHdl, ListBox&, void );
DECL_LINK( ButtonHdl, Button *, void );
DECL_LINK( TreeListHighlightHdl, weld::TreeView&, void );
DECL_LINK( BasicSelectHdl, weld::ComboBox&, void );
DECL_LINK( ButtonHdl, weld::Button&, void );
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 DeleteCurrent();
void NewLib();
@ -230,29 +191,35 @@ class LibPage final : public TabPage
void FillListBox();
void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
void SetCurLib();
SvTreeListEntry* ImpInsertLibEntry( const OUString& rLibName, sal_uLong nPos );
virtual void ActivatePage() override;
virtual void DeactivatePage() override;
VclPtr<TabDialog> pTabDlg;
void ImpInsertLibEntry( const OUString& rLibName, sal_uLong nPos );
public:
explicit LibPage(vcl::Window* pParent);
explicit LibPage(weld::Container* pParent, OrganizeDialog* pDialog);
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
SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
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,
CheckBox* pLibBox, TreeListBox* pBasicBox);
void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
CheckBox* pLibBox, SbTreeListBox* pBasicBox);
weld::TreeView* pLibBox, SbTreeListBox* pBasicBox);
} // namespace basctl

View File

@ -34,7 +34,7 @@ namespace weld { class Widget; class Window; }
namespace basctl
{
void Organize( sal_Int16 tabId );
void Organize(weld::Window* pParent, sal_Int16 tabId);
// 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); }
bool get_selected(weld::TreeIter* pIter) const { return m_xControl->get_selected(pIter); }
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); }
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 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); }
@ -321,6 +326,15 @@ public:
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(); }
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 ScriptDocument&);

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="basctl">
<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">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -26,10 +35,10 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="dialogpage|label1">Dialog:</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>
<packing>
<property name="left_attach">0</property>
@ -37,13 +46,49 @@
</packing>
</child>
<child>
<object class="basctllo-ExtTreeListBox" id="library:border">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="CheckBox List-selection1"/>
<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">
<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>
</object>
<packing>

View File

@ -2,7 +2,18 @@
<!-- Generated with glade 3.18.3 -->
<interface domain="basctl">
<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">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -38,7 +49,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="location">
<object class="GtkComboBoxText" id="location">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@ -69,7 +80,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes" context="libpage|lingudictsft">_Library:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">library:border</property>
<property name="mnemonic_widget">library</property>
</object>
<packing>
<property name="left_attach">0</property>
@ -77,13 +88,59 @@
</packing>
</child>
<child>
<object class="basctllo-CheckBox" id="library:border">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="CheckBox List-selection1"/>
<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">
<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>
</object>
<packing>

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="basctl">
<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">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -26,10 +35,10 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</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="use_underline">True</property>
<property name="mnemonic_widget">library:border</property>
<property name="mnemonic_widget">library</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@ -37,13 +46,49 @@
</packing>
</child>
<child>
<object class="basctllo-ExtTreeListBox" id="library:border">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="CheckBox List-selection1"/>
<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">
<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>
</object>
<packing>

View File

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

View File

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

View File

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

View File

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

View File

@ -191,9 +191,6 @@
<glade-widget-class title="Address Preview" name="swlo-SwAddressPreview"
generic-name="Address Preview" parent="GtkDrawingArea"
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"
generic-name="Tree List" parent="GtkTreeView"
icon-name="widget-gtk-treeview">
@ -220,9 +217,6 @@
<glade-widget-class title="Animation ListBox" name="sdlo-CustomAnimationList"
generic-name="Animation ListBox" parent="vcllo-SvTreeListBox"
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"
generic-name="SdPageObjsTLB" parent="vcllo-SvTreeListBox"
icon-name="widget-gtk-treeview"/>

View File

@ -146,7 +146,7 @@ public:
// Basic/Scripting
static bool IsXScriptURL( const OUString& rScriptURL );
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 CallAppBasic( const OUString& i_macroName )
{ return CallBasic( i_macroName, SfxApplication::GetBasicManager(), nullptr, nullptr ); }

View File

@ -593,6 +593,8 @@ protected:
Link<TreeView&, void> m_aRowActivatedHdl;
Link<int, void> m_aColumnClickedHdl;
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
Link<const TreeIter&, bool> m_aExpandingHdl;
Link<TreeView&, void> m_aVisibleRangeChangedHdl;
@ -615,6 +617,13 @@ protected:
// arg is pair<row,col>
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:
virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface,
@ -807,6 +816,18 @@ public:
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)
{
assert(!m_aVisibleRangeChangedHdl.IsSet() || !rLink.IsSet());

View File

@ -414,14 +414,14 @@ void SfxApplication::Invalidate( sal_uInt16 nId )
#ifndef DISABLE_DYNLOADING
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() {} }
#else
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
@ -520,7 +520,7 @@ SfxApplication::ChooseScript(weld::Window *pParent)
return aScriptURL;
}
void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
void SfxApplication::MacroOrganizer(weld::Window* pParent, sal_Int16 nTabId)
{
#if !HAVE_FEATURE_SCRIPTING
(void) nTabId;
@ -541,11 +541,11 @@ void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
return;
// call basicide_macro_organizer in basctl
pSymbol( nTabId );
pSymbol(pParent, nTabId);
#else
basicide_macro_organizer( nTabId );
basicide_macro_organizer(pParent, nTabId);
#endif

View File

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

View File

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

View File

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

View File

@ -34,6 +34,8 @@ class LclTabListBox : public SvTabListBox
Link<SvTreeListBox*, void> m_aModelChangedHdl;
Link<SvTreeListBox*, void> m_aStartDragHdl;
Link<SvTreeListBox*, void> m_aEndDragHdl;
Link<SvTreeListEntry*, bool> m_aEditingEntryHdl;
Link<std::pair<SvTreeListEntry*, OUString>, bool> m_aEditedEntryHdl;
public:
LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
@ -44,6 +46,14 @@ public:
void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
void SetStartDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aStartDragHdl = 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
{
@ -114,6 +124,16 @@ public:
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: */

View File

@ -2661,6 +2661,9 @@ private:
DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
DECL_LINK(StartDragHdl, 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(CompareHdl, const SvSortData&, sal_Int32);
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).SetStartDragHdl(LINK(this, SalInstanceTreeView, StartDragHdl));
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_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
@ -3228,6 +3233,18 @@ public:
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)
{
if (col == -1)
@ -3929,6 +3946,16 @@ IMPL_LINK(SalInstanceTreeView, PopupMenuHdl, const CommandEvent&, rEvent, bool)
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
{
private:

View File

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

View File

@ -6651,6 +6651,50 @@ private:
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)
{
int nIndex(0);
@ -6752,15 +6796,17 @@ public:
for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer = g_list_next(pRenderer))
{
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 (m_nTextCol == -1)
m_nTextCol = nIndex;
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))
{
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);
m_aToggleVisMap[nIndex] = -1;
m_aToggleTriStateMap[nIndex] = -1;
@ -7318,6 +7364,10 @@ public:
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);
if (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
{
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));
}
virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col) override
{
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));
}
@ -7919,12 +7961,11 @@ public:
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult) override
{
gtk_drag_unhighlight(GTK_WIDGET(m_pTreeView));
gtk_drag_highlight(gtk_widget_get_parent(GTK_WIDGET(m_pTreeView)));
const bool bAsTree = gtk_tree_view_get_enable_tree_lines(m_pTreeView);
// to keep it simple we'll default to always drop before the current row
// 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
gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, pos);
@ -7933,7 +7974,7 @@ public:
gtk_drag_unhighlight(GTK_WIDGET(m_pTreeView));
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(),
&path, &gtkpos);
@ -8074,6 +8115,14 @@ IMPL_LINK_NOARG(GtkInstanceTreeView, async_signal_changed, void*, void)
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
{
private: