summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-04-18 16:49:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-04-27 12:41:14 +0200
commit56dd851cfc77c362c3db5c0aae4a490c7f6782cc (patch)
tree0f5f6564e0b9af8123f4cebfe9a2f55c1bbbba57
parent6afbe153ffd4cab27f0a7bb77f71f25923dc2e43 (diff)
weld cluster of change tracking dialogs
Change-Id: I42ca7acb41699df91b91a9f59fc68cd30972a397 Reviewed-on: https://gerrit.libreoffice.org/70988 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/dialogs/postdlg.cxx2
-rw-r--r--cui/source/factory/dlgfact.cxx6
-rw-r--r--cui/source/factory/dlgfact.hxx6
-rw-r--r--cui/source/inc/postdlg.hxx4
-rw-r--r--cui/source/tabpages/numfmt.cxx2
-rw-r--r--include/sfx2/basedlgs.hxx1
-rw-r--r--include/sfx2/childwin.hxx8
-rw-r--r--include/svtools/ctrlbox.hxx9
-rw-r--r--include/svx/ctredlin.hxx176
-rw-r--r--include/svx/sidebar/PanelLayout.hxx7
-rw-r--r--include/svx/svxdlg.hxx2
-rw-r--r--include/vcl/treelistbox.hxx2
-rw-r--r--include/vcl/weld.hxx24
-rw-r--r--sc/source/ui/docshell/docsh3.cxx6
-rw-r--r--sc/source/ui/inc/acredlin.hxx66
-rw-r--r--sc/source/ui/inc/conflictsdlg.hxx46
-rw-r--r--sc/source/ui/inc/highred.hxx36
-rw-r--r--sc/source/ui/inc/reffact.hxx86
-rw-r--r--sc/source/ui/inc/simpref.hxx2
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx1014
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx308
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx221
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx9
-rw-r--r--sc/source/ui/view/reffact.cxx60
-rw-r--r--sc/source/ui/view/tabview3.cxx24
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx11
-rw-r--r--sc/source/ui/view/tabvwshc.cxx14
-rw-r--r--sc/uiconfig/scalc/ui/conflictsdialog.ui92
-rw-r--r--sc/uiconfig/scalc/ui/showchangesdialog.ui15
-rw-r--r--sfx2/source/appl/workwin.cxx10
-rw-r--r--sfx2/source/dialog/basedlgs.cxx13
-rw-r--r--solenv/sanitizers/ui/modules/scalc.false3
-rw-r--r--solenv/sanitizers/ui/modules/scalc.suppr2
-rw-r--r--svtools/source/control/ctrlbox.cxx12
-rw-r--r--svx/source/dialog/ctredlin.cxx875
-rw-r--r--svx/source/sidebar/PanelLayout.cxx9
-rw-r--r--svx/uiconfig/ui/acceptrejectchangesdialog.ui45
-rw-r--r--svx/uiconfig/ui/redlinefilterpage.ui63
-rw-r--r--svx/uiconfig/ui/redlineviewpage.ui288
-rw-r--r--sw/inc/swabstdlg.hxx2
-rw-r--r--sw/inc/viewsh.hxx3
-rw-r--r--sw/source/core/view/viewsh.cxx8
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx15
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx12
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx2
-rw-r--r--sw/source/ui/misc/swmodalredlineacceptdlg.cxx41
-rw-r--r--sw/source/uibase/inc/redlndlg.hxx46
-rw-r--r--sw/source/uibase/inc/swmodalredlineacceptdlg.hxx8
-rw-r--r--sw/source/uibase/lingu/hhcwrp.cxx2
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx591
-rw-r--r--sw/source/uibase/shells/textsh1.cxx8
-rw-r--r--sw/source/uibase/uiview/viewport.cxx14
-rw-r--r--sw/uiconfig/swriter/ui/managechangessidebar.ui10
-rw-r--r--vcl/source/app/salvtables.cxx85
-rw-r--r--vcl/source/treelist/treelistbox.cxx3
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx135
56 files changed, 2423 insertions, 2141 deletions
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index 570109c6ddfb..940d8ebb564f 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -33,7 +33,7 @@
// class SvxPostItDialog -------------------------------------------------
-SvxPostItDialog::SvxPostItDialog(weld::Window* pParent, const SfxItemSet& rCoreSet,
+SvxPostItDialog::SvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreSet,
bool bPrevNext)
: SfxDialogController(pParent, "cui/ui/comment.ui", "CommentDialog")
, m_rSet(rCoreSet)
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 4669f431df56..11df8ce96030 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1315,9 +1315,9 @@ VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateSfxDialog(weld::Wind
return nullptr;
}
-VclPtr<AbstractSvxPostItDialog> AbstractDialogFactory_Impl::CreateSvxPostItDialog( weld::Window* pParent,
- const SfxItemSet& rCoreSet,
- bool bPrevNext )
+VclPtr<AbstractSvxPostItDialog> AbstractDialogFactory_Impl::CreateSvxPostItDialog(weld::Widget* pParent,
+ const SfxItemSet& rCoreSet,
+ bool bPrevNext)
{
return VclPtr<AbstractSvxPostItDialog_Impl>::Create(std::make_unique<SvxPostItDialog>(pParent, rCoreSet, bPrevNext));
}
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 65b2f4337760..f48afb3fbf31 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -804,9 +804,9 @@ public:
SdrModel* pModel,
const SdrObject* pObj,
bool bHasObj ) override;
- virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog( weld::Window* pParent,
- const SfxItemSet& rCoreSet,
- bool bPrevNext = false ) override;
+ virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Widget* pParent,
+ const SfxItemSet& rCoreSet,
+ bool bPrevNext = false) override;
// For TabPage
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) override;
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index 13ecf359c096..c3c086d89097 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -37,8 +37,8 @@
class SvxPostItDialog : public SfxDialogController
{
public:
- SvxPostItDialog(weld::Window* pParent, const SfxItemSet& rCoreSet,
- bool bPrevNext);
+ SvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreSet,
+ bool bPrevNext);
virtual ~SvxPostItDialog() override;
static const sal_uInt16* GetRanges();
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index f6166de32740..993b4c31baca 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -831,7 +831,7 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<OUString>& rEnt
OUString aPreviewString( GetExpColorString( pPreviewColor, aEntry, aPrivCat ) );
m_xLbFormat->append_text(aPreviewString);
if (pPreviewColor)
- m_xLbFormat->set_font_color(m_xLbFormat->n_children() -1, *pPreviewColor);
+ m_xLbFormat->set_font_color(m_xLbFormat->n_children() - 1, *pPreviewColor);
}
else
{
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 272ad3fae082..d2646af1d9e5 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -143,6 +143,7 @@ public:
virtual void Activate() override;
virtual void Deactivate() override;
virtual void ChildWinDispose() override;
+ virtual void FillInfo(SfxChildWinInfo&) const;
SfxBindings& GetBindings() { return *m_pBindings; }
};
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index 0a65e3c964a6..a01881c7698a 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -163,6 +163,7 @@ public:
void SetController(std::shared_ptr<SfxDialogController> controller) { xController = controller; }
void ClearController() { xController.reset(); }
std::shared_ptr<SfxDialogController>& GetController() { return xController; }
+ const std::shared_ptr<SfxDialogController>& GetController() const { return xController; }
vcl::Window* GetParent() const
{ return pParent; }
SfxChildAlignment GetAlignment() const
@@ -297,6 +298,13 @@ public:
static_cast<SfxModelessDialog*>(GetWindow())->FillInfo( aInfo ); \
return aInfo; }
+#define SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ static_cast<const SfxModelessDialogController*>(GetController().get())->FillInfo( aInfo ); \
+ return aInfo; }
#define SFX_IMPL_DOCKINGWINDOW(Class, MyID) \
SFX_IMPL_CHILDWINDOW(Class, MyID) \
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 80384fd0e882..1923809ba344 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -300,9 +300,14 @@ public:
void set_date(const Date& rDate);
Date get_date() const { return m_xCalendar->get_date(); }
+ void set_label(const OUString& rLabel) { m_xControl->set_label(rLabel); }
+ OUString get_label() const { return m_xControl->get_label(); }
+
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
bool get_sensitive() const { return m_xControl->get_sensitive(); }
void grab_focus() { m_xControl->grab_focus(); }
+
+ void connect_activated(const Link<SvtCalendarBox&, void>& rActivatedHdl) { m_aActivatedHdl = rActivatedHdl; }
private:
DECL_LINK(SelectHdl, weld::Calendar&, void);
DECL_LINK(ActivateHdl, weld::Calendar&, void);
@@ -311,6 +316,10 @@ private:
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Widget> m_xTopLevel;
std::unique_ptr<weld::Calendar> m_xCalendar;
+
+ Link<SvtCalendarBox&, void> m_aActivatedHdl;
+
+ void set_label_from_date();
};
class SVT_DLLPUBLIC FontNameBox : public ComboBox
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index 7e2260b4f1c4..3e2e88367156 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -20,10 +20,12 @@
#ifndef INCLUDED_SVX_CTREDLIN_HXX
#define INCLUDED_SVX_CTREDLIN_HXX
+#include <comphelper/string.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <svx/svxdllapi.h>
#include <svtools/simptabl.hxx>
+#include <svtools/ctrlbox.hxx>
#include <vcl/svlbitm.hxx>
#include <vcl/svtabbx.hxx>
#include <vcl/treelistbox.hxx>
@@ -108,11 +110,13 @@ public:
virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const override;
};
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable : public SvSimpleTable
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRedlinTable
{
- using SvTabListBox::InsertEntry;
-
private:
+ std::unique_ptr<comphelper::string::NaturalStringSorter> xSorter;
+ std::unique_ptr<weld::TreeView> xWriterTreeView;
+ std::unique_ptr<weld::TreeView> xCalcTreeView;
+ weld::TreeView* pTreeView;
sal_uInt16 nDatePos;
bool bAuthor;
@@ -128,18 +132,18 @@ private:
Image maEntryImage;
OUString maEntryString;
std::unique_ptr<utl::TextSearch> pCommentSearcher;
- Link<const SvSortData*,sal_Int32> aColCompareLink;
-
-protected:
- virtual sal_Int32 ColCompare(SvTreeListEntry*,SvTreeListEntry*) override;
- virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind) override;
+ int ColCompare(const weld::TreeIter& rLeft, const weld::TreeIter& rRight);
public:
+ SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
+ std::unique_ptr<weld::TreeView> xCalcControl);
- SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
- virtual ~SvxRedlinTable() override;
- virtual void dispose() override;
+ void set_size_request(int nWidth, int nHeight);
+
+ weld::TreeView& GetWidget() { return *pTreeView; }
+
+ ~SvxRedlinTable();
// For FilterPage only {
void SetFilterDate(bool bFlag);
@@ -157,80 +161,71 @@ public:
// } For FilterPage only
void SetCalcView();
+ void SetWriterView();
bool IsValidEntry(const OUString &rAuthor, const DateTime &rDateTime, const OUString &rComment);
bool IsValidEntry(const OUString &rAuthor, const DateTime &rDateTime);
bool IsValidComment(const OUString &rComment);
- /** Insert a redline entry.
-
- The rStr contains the entire redline entry; the columns are delimited by '\t'.
- */
- SvTreeListEntry* InsertEntry(const OUString &rStr, std::unique_ptr<RedlinData> pUserData,
- SvTreeListEntry* pParent = nullptr, sal_uLong nPos = TREELIST_APPEND);
-
- /** Insert a redline entry.
-
- The rStr contains the entire redline entry; the columns are delimited by '\t'.
- */
- SvTreeListEntry* InsertEntry(const OUString &rStr, std::unique_ptr<RedlinData> pUserData, const Color&,
- SvTreeListEntry* pParent, sal_uLong nPos = TREELIST_APPEND);
-
- /** Insert a redline entry.
-
- rRedlineType contains the image for this redline entry (plus for insertion, minus for deletion etc.).
- rStr contains the rest of the redline entry; the columns are delimited by '\t'.
- */
- SvTreeListEntry* InsertEntry(const Image &rRedlineType, const OUString &rStr, std::unique_ptr<RedlinData> pUserData,
- SvTreeListEntry* pParent, sal_uLong nPos = TREELIST_APPEND);
-
- virtual SvTreeListEntry* CreateEntry() const override;
+ DECL_LINK(HeaderBarClick, int, void);
+};
- void SetColCompareHdl(const Link<const SvSortData*,sal_Int32>& rLink ) { aColCompareLink = rLink; }
+class SVX_DLLPUBLIC SvxTPage
+{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+public:
+ SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID);
+ virtual ~SvxTPage();
+ virtual void ActivatePage();
+ virtual void DeactivatePage();
+ void Show() { m_xContainer->show(); }
};
/// Tabpage with the filter text entries etc.
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public TabPage
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public SvxTPage
{
Link<SvxTPFilter*,void> aReadyLink;
Link<SvxTPFilter*,void> aRefLink;
- VclPtr<SvxRedlinTable> pRedlinTable;
- VclPtr<CheckBox> m_pCbDate;
- VclPtr<ListBox> m_pLbDate;
- VclPtr<DateField> m_pDfDate;
- VclPtr<TimeField> m_pTfDate;
- VclPtr<PushButton> m_pIbClock;
- VclPtr<FixedText> m_pFtDate2;
- VclPtr<DateField> m_pDfDate2;
- VclPtr<TimeField> m_pTfDate2;
- VclPtr<PushButton> m_pIbClock2;
- VclPtr<CheckBox> m_pCbAuthor;
- VclPtr<ListBox> m_pLbAuthor;
- VclPtr<CheckBox> m_pCbRange;
- VclPtr<Edit> m_pEdRange;
- VclPtr<PushButton> m_pBtnRange;
- VclPtr<CheckBox> m_pCbAction;
- VclPtr<ListBox> m_pLbAction;
- VclPtr<CheckBox> m_pCbComment;
- VclPtr<Edit> m_pEdComment;
bool bModified;
- DECL_LINK( SelDateHdl, ListBox&, void );
- DECL_LINK( RowEnableHdl, Button*, void );
- DECL_LINK( TimeHdl, Button*, void );
- DECL_LINK( ModifyHdl, Edit&, void );
- DECL_LINK( ModifyListBoxHdl, ListBox&, void );
- DECL_LINK( ModifyDate, Edit&, void );
- DECL_LINK( RefHandle, Button*, void );
+ SvxRedlinTable* m_pRedlinTable;
+ std::unique_ptr<weld::CheckButton> m_xCbDate;
+ std::unique_ptr<weld::ComboBox> m_xLbDate;
+ std::unique_ptr<SvtCalendarBox> m_xDfDate;
+ std::unique_ptr<weld::TimeSpinButton> m_xTfDate;
+ std::unique_ptr<weld::Button> m_xIbClock;
+ std::unique_ptr<weld::Label> m_xFtDate2;
+ std::unique_ptr<SvtCalendarBox> m_xDfDate2;
+ std::unique_ptr<weld::TimeSpinButton> m_xTfDate2;
+ std::unique_ptr<weld::Button> m_xIbClock2;
+ std::unique_ptr<weld::CheckButton> m_xCbAuthor;
+ std::unique_ptr<weld::ComboBox> m_xLbAuthor;
+ std::unique_ptr<weld::CheckButton> m_xCbRange;
+ std::unique_ptr<weld::Entry> m_xEdRange;
+ std::unique_ptr<weld::Button> m_xBtnRange;
+ std::unique_ptr<weld::CheckButton> m_xCbAction;
+ std::unique_ptr<weld::ComboBox> m_xLbAction;
+ std::unique_ptr<weld::CheckButton> m_xCbComment;
+ std::unique_ptr<weld::Entry> m_xEdComment;
+
+ DECL_LINK( SelDateHdl, weld::ComboBox&, void );
+ DECL_LINK( RowEnableHdl, weld::Button&, void );
+ DECL_LINK( TimeHdl, weld::Button&, void );
+ DECL_LINK( ModifyHdl, weld::Entry&, void );
+ DECL_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
+ DECL_LINK( ModifyDate, SvtCalendarBox&, void );
+ DECL_LINK( ModifyTime, weld::TimeSpinButton&, void );
+ DECL_LINK( RefHandle, weld::Button&, void );
void EnableDateLine1(bool bFlag);
void EnableDateLine2(bool bFlag);
public:
- SvxTPFilter( vcl::Window * pParent);
- virtual ~SvxTPFilter() override;
- virtual void dispose() override;
+ SvxTPFilter(weld::Container* pParent);
+ virtual ~SvxTPFilter() override;
virtual void DeactivatePage() override;
void SetRedlinTable(SvxRedlinTable*);
@@ -277,7 +272,7 @@ public:
void CheckAction(bool bFlag);
void CheckComment(bool bFlag);
- ListBox* GetLbAction() { return m_pLbAction;}
+ weld::ComboBox* GetLbAction() { return m_xLbAction.get(); }
void SetReadyHdl( const Link<SvxTPFilter*,void>& rLink ) { aReadyLink= rLink; }
@@ -291,7 +286,7 @@ public:
};
/// Tabpage with the redlining entries.
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPView : public TabPage
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPView : public SvxTPage
{
private:
@@ -301,35 +296,34 @@ private:
Link<SvxTPView*,void> RejectAllClickLk;
Link<SvxTPView*,void> UndoClickLk;
- VclPtr<SvxRedlinTable> m_pViewData;
- VclPtr<PushButton> m_pAccept;
- VclPtr<PushButton> m_pReject;
- VclPtr<PushButton> m_pAcceptAll;
- VclPtr<PushButton> m_pRejectAll;
- VclPtr<PushButton> m_pUndo;
-
bool bEnableAccept;
bool bEnableAcceptAll;
bool bEnableReject;
bool bEnableRejectAll;
bool bEnableUndo;
- DECL_LINK( PbClickHdl, Button*, void );
+ std::unique_ptr<weld::Button> m_xAccept;
+ std::unique_ptr<weld::Button> m_xReject;
+ std::unique_ptr<weld::Button> m_xAcceptAll;
+ std::unique_ptr<weld::Button> m_xRejectAll;
+ std::unique_ptr<weld::Button> m_xUndo;
+ std::unique_ptr<SvxRedlinTable> m_xViewData;
+
+ DECL_LINK( PbClickHdl, weld::Button&, void );
public:
- SvxTPView(vcl::Window * pParent, VclBuilderContainer *pTopLevel);
+ SvxTPView(weld::Container* pParent, weld::Builder* pTopLevel);
virtual ~SvxTPView() override;
- virtual void dispose() override;
void InsertWriterHeader();
void InsertCalcHeader();
- SvxRedlinTable* GetTableControl() { return m_pViewData;}
+ SvxRedlinTable* GetTableControl() { return m_xViewData.get(); }
void EnableAccept(bool bFlag);
void EnableAcceptAll(bool bFlag);
void EnableReject(bool bFlag);
void EnableRejectAll(bool bFlag);
- static void EnableClearFormatButton(VclPtr<PushButton>, bool bFlag);
+ static void EnableClearFormatButton(weld::Button&, bool bFlag);
void EnableClearFormat(bool bFlag);
void EnableClearFormatAll(bool bFlag);
void EnableUndo(bool bFlag=true);
@@ -350,29 +344,29 @@ public:
virtual void DeactivatePage() override;
};
-
// Redlining - Control (Accept- Changes)
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxAcceptChgCtr
- : public TabControl
- , public VclBuilderContainer
{
private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Notebook> m_xTabCtrl;
- VclPtr<SvxTPFilter> pTPFilter;
- VclPtr<SvxTPView> pTPView;
+ std::unique_ptr<SvxTPFilter> m_xTPFilter;
+ std::unique_ptr<SvxTPView> m_xTPView;
- sal_uInt16 m_nFilterPageId;
+ DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void);
+ DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool);
public:
- SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTopLevel);
-
- virtual ~SvxAcceptChgCtr() override;
- virtual void dispose() override;
+ SvxAcceptChgCtr(weld::Container* pParent, weld::Builder* pTopLevel);
+ ~SvxAcceptChgCtr();
void ShowFilterPage();
- SvxTPFilter* GetFilterPage() { return pTPFilter;}
- SvxTPView* GetViewPage() { return pTPView;}
+ SvxTPFilter* GetFilterPage() { return m_xTPFilter.get(); }
+ SvxTPView* GetViewPage() { return m_xTPView.get(); }
+
+ void set_help_id(const OString& rId) { m_xTabCtrl->set_help_id(rId); }
};
#endif // INCLUDED_SVX_CTREDLIN_HXX
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index 0932fe459f40..ddb52b172b33 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -17,6 +17,7 @@
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/vclptr.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XFrame.hpp>
@@ -24,6 +25,10 @@
/// This class is the base for the Widget Layout-based sidebar panels.
class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
{
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
private:
Idle m_aPanelLayoutIdle;
bool m_bInClose;
@@ -33,7 +38,7 @@ private:
public:
PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
- const css::uno::Reference<css::frame::XFrame> &rFrame);
+ const css::uno::Reference<css::frame::XFrame> &rFrame, bool bInterimBuilder = false);
virtual ~PanelLayout() override;
virtual void dispose() override;
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 2a50a9ccde03..4926a7be9f42 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -428,7 +428,7 @@ public:
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) = 0;
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent, const SfxItemSet& rAttr,
const css::uno::Reference< css::frame::XFrame >& _rxFrame) = 0;
- virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Window* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0;
+ virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) override = 0;
virtual DialogGetRanges GetDialogGetRangesFunc() = 0;
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index c88ada02c74e..f0ac85bd3980 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -208,6 +208,7 @@ class VCL_DLLPUBLIC SvTreeListBox
Link<SvTreeListBox*,bool> aExpandingHdl;
Link<SvTreeListBox*,void> aSelectHdl;
Link<SvTreeListBox*,void> aDeselectHdl;
+ Link<const CommandEvent&, bool> aPopupMenuHdl;
Image aPrevInsertedExpBmp;
Image aPrevInsertedColBmp;
@@ -441,6 +442,7 @@ public:
const Link<SvTreeListBox*,bool>& GetDoubleClickHdl() const { return aDoubleClickHdl; }
void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
+ void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
virtual void ExpandedHdl();
virtual bool ExpandingHdl();
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index a5b83aadbb9d..ed3d69d5a652 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -552,6 +552,8 @@ protected:
Link<const TreeIter&, bool> m_aExpandingHdl;
Link<TreeView&, void> m_aVisibleRangeChangedHdl;
Link<TreeView&, void> m_aModelChangedHdl;
+ Link<const CommandEvent&, bool> m_aPopupMenuHdl;
+ std::function<int(const weld::TreeIter&, const weld::TreeIter&)> m_aCustomSort;
std::vector<int> m_aRadioIndexes;
@@ -673,6 +675,7 @@ public:
virtual OUString get_id(int pos) const = 0;
virtual int find_id(const OUString& rId) const = 0;
void select_id(const OUString& rId) { select(find_id(rId)); }
+ void remove_id(const OUString& rText) { remove(find_id(rText)); }
//via iter
virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
@@ -702,6 +705,11 @@ public:
virtual bool iter_parent(TreeIter& rIter) const = 0;
virtual int get_iter_depth(const TreeIter& rIter) const = 0;
virtual int get_iter_index_in_parent(const TreeIter& rIter) const = 0;
+ /* Compares two paths. If a appears before b in a tree, then -1 is returned.
+ If b appears before a , then 1 is returned. If the two nodes are equal,
+ then 0 is returned.
+ */
+ virtual int iter_compare(const TreeIter& a, const TreeIter& b) const = 0;
virtual bool iter_has_child(const TreeIter& rIter) const = 0;
virtual void remove(const TreeIter& rIter) = 0;
virtual void select(const TreeIter& rIter) = 0;
@@ -721,12 +729,15 @@ public:
virtual void set_image(const TreeIter& rIter,
const css::uno::Reference<css::graphic::XGraphic>& rImage, int col)
= 0;
+ virtual void set_font_color(const TreeIter& rIter, const Color& rColor) const = 0;
virtual void scroll_to_row(const TreeIter& rIter) = 0;
virtual bool is_selected(const TreeIter& rIter) const = 0;
virtual void move_subtree(TreeIter& rNode, const TreeIter* pNewParent, int nIndexInNewParent)
= 0;
+ //calling func on each element until func returns true or we run out of elements
+ virtual void all_foreach(const std::function<bool(TreeIter&)>& func) = 0;
//calling func on each selected element until func returns true or we run out of elements
virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
//calling func on each visible element until func returns true or we run out of elements
@@ -740,6 +751,11 @@ public:
m_aVisibleRangeChangedHdl = rLink;
}
+ virtual void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink)
+ {
+ m_aPopupMenuHdl = rLink;
+ }
+
//all of them
void select_all() { unselect(-1); }
void unselect_all() { select(-1); }
@@ -759,6 +775,12 @@ public:
virtual int get_sort_column() const = 0;
virtual void set_sort_column(int nColumn) = 0;
+ virtual void
+ set_sort_func(const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func)
+ {
+ m_aCustomSort = func;
+ }
+
virtual void clear() = 0;
virtual int get_height_rows(int nRows) const = 0;
@@ -1434,6 +1456,8 @@ public:
return m_xSpinButton->get_value_changed_from_saved();
}
void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
+ void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
+ OUString get_text() const { return m_xSpinButton->get_text(); }
weld::SpinButton& get_widget() { return *m_xSpinButton; }
};
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 0c8e93cd857e..060dc50f36ad 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1199,10 +1199,10 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
while ( bLoop )
{
bLoop = false;
- ScopedVclPtrInstance< ScConflictsDlg > aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList );
- if ( aDlg->Execute() == RET_CANCEL )
+ vcl::Window* pWin = GetActiveDialogParent();
+ ScConflictsDlg aDlg(pWin ? pWin->GetFrameWeld() : nullptr, GetViewData(), &rSharedDoc, aConflictsList);
+ if (aDlg.run() == RET_CANCEL)
{
- vcl::Window* pWin = GetActiveDialogParent();
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
VclMessageType::Question, VclButtonsType::YesNo,
ScResId(STR_DOC_WILLNOTBESAVED)));
diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx
index fd8e19f8f24f..a92d4d2a1c58 100644
--- a/sc/source/ui/inc/acredlin.hxx
+++ b/sc/source/ui/inc/acredlin.hxx
@@ -45,17 +45,12 @@ public:
bool bIsAcceptable;
};
-class ScAcceptChgDlg final : public SfxModelessDialog
+class ScAcceptChgDlg final : public SfxModelessDialogController
{
Idle aSelectionIdle;
Idle aReOpenIdle;
- VclPtr<PopupMenu> m_xPopup;
- VclPtr<SvxAcceptChgCtr> m_pAcceptChgCtr;
ScViewData* pViewData;
ScDocument* pDoc;
- VclPtr<SvxTPFilter> pTPFilter;
- VclPtr<SvxTPView> pTPView;
- VclPtr<SvxRedlinTable> pTheView; // #i48648 now SvHeaderTabListBox
ScRangeList aRangeList;
ScChangeViewSettings aChangeViewSet;
OUString aStrInsertCols;
@@ -82,6 +77,14 @@ class ScAcceptChgDlg final : public SfxModelessDialog
bool bHasFilterEntry:1;
bool bUseColor:1;
+ SvxTPFilter* pTPFilter;
+ SvxTPView* pTPView;
+ SvxRedlinTable* pTheView; // #i48648 now SvHeaderTabListBox
+
+ std::unique_ptr<weld::Container> m_xContentArea;
+ std::unique_ptr<weld::Menu> m_xPopup;
+ std::unique_ptr<SvxAcceptChgCtr> m_xAcceptChgCtr;
+
void Init();
DECL_LINK( FilterHandle, SvxTPFilter*, void );
@@ -90,15 +93,16 @@ class ScAcceptChgDlg final : public SfxModelessDialog
DECL_LINK( AcceptHandle, SvxTPView*, void );
DECL_LINK( RejectAllHandle, SvxTPView*, void );
DECL_LINK( AcceptAllHandle, SvxTPView*, void );
- DECL_LINK( ExpandingHandle, SvTreeListBox*, bool );
- DECL_LINK( SelectHandle, SvTreeListBox*, void );
+ DECL_LINK( ExpandingHandle, const weld::TreeIter&, bool );
+ DECL_LINK( SelectHandle, weld::TreeView&, void );
DECL_LINK( RefInfoHandle, const OUString*, void );
DECL_LINK( UpdateSelectionHdl, Timer*, void );
DECL_LINK( ChgTrackModHdl, ScChangeTrack&, void );
- DECL_LINK( CommandHdl, SvSimpleTable*, void );
+ DECL_LINK( CommandHdl, const CommandEvent&, bool );
DECL_LINK( ReOpenTimerHdl, Timer*, void );
- DECL_LINK( ColCompareHdl, const SvSortData*, sal_Int32 );
+
+ int ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeIter& rRight) const;
void RejectFiltered();
void AcceptFiltered();
@@ -107,31 +111,32 @@ class ScAcceptChgDlg final : public SfxModelessDialog
OUString* MakeTypeString(ScChangeActionType eType);
- SvTreeListEntry* AppendChangeAction(
- const ScChangeAction* pScChangeAction,
- SvTreeListEntry* pParent=nullptr,bool bDelMaster = false,
+ std::unique_ptr<weld::TreeIter> AppendChangeAction(
+ const ScChangeAction* pScChangeAction, bool bCreateOnDamend,
+ const weld::TreeIter* pParent = nullptr, bool bDelMaster = false,
bool bDisabled = false);
- SvTreeListEntry* AppendFilteredAction(
+ std::unique_ptr<weld::TreeIter> AppendFilteredAction(
const ScChangeAction* pScChangeAction,ScChangeActionState eState,
- SvTreeListEntry* pParent = nullptr,bool bDelMaster = false,
+ bool bCreateOnDemand,
+ const weld::TreeIter* pParent = nullptr, bool bDelMaster = false,
bool bDisabled = false);
- SvTreeListEntry* InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
- SvTreeListEntry* pParent,sal_uLong nSpecial);
+ std::unique_ptr<weld::TreeIter> InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
+ const weld::TreeIter& rParent, sal_uLong nSpecial);
- void GetDependents( const ScChangeAction* pScChangeAction,
- ScChangeActionMap& aActionMap,
- SvTreeListEntry* pEntry);
+ void GetDependents(const ScChangeAction* pScChangeAction,
+ ScChangeActionMap& aActionMap,
+ const weld::TreeIter& rEntry);
- bool InsertContentChildren( ScChangeActionMap* pActionMap, SvTreeListEntry* pParent );
+ bool InsertContentChildren(ScChangeActionMap* pActionMap, const weld::TreeIter& rParent);
- bool InsertAcceptedORejected(SvTreeListEntry* pParent);
+ bool InsertAcceptedORejected(const weld::TreeIter& rParent);
- bool InsertDeletedChildren( const ScChangeAction* pChangeAction, ScChangeActionMap* pActionMap,
- SvTreeListEntry* pParent);
+ bool InsertDeletedChildren(const ScChangeAction* pChangeAction, ScChangeActionMap* pActionMap,
+ const weld::TreeIter& rParent);
- bool InsertChildren( ScChangeActionMap* pActionMap, SvTreeListEntry* pParent );
+ bool InsertChildren(ScChangeActionMap* pActionMap, const weld::TreeIter& rParent);
void AppendChanges(const ScChangeTrack* pChanges,sal_uLong nStartAction, sal_uLong nEndAction);
@@ -142,20 +147,17 @@ class ScAcceptChgDlg final : public SfxModelessDialog
void ClearView();
bool Expand(const ScChangeTrack* pChanges,const ScChangeAction* pScChangeAction,
- SvTreeListEntry* pEntry, bool bFilter = false);
+ const weld::TreeIter& rEntry, bool bFilter = false);
public:
- ScAcceptChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
- ScViewData* ptrViewData);
-
- virtual ~ScAcceptChgDlg() override;
- virtual void dispose() override;
+ ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
+ ScViewData* ptrViewData);
+ virtual ~ScAcceptChgDlg() override;
void ReInit(ScViewData* ptrViewData);
void Initialize (SfxChildWinInfo* pInfo);
virtual void FillInfo(SfxChildWinInfo&) const override;
-
};
#endif // INCLUDED_SC_SOURCE_UI_INC_ACREDLIN_HXX
diff --git a/sc/source/ui/inc/conflictsdlg.hxx b/sc/source/ui/inc/conflictsdlg.hxx
index 818023d75269..433d4584b140 100644
--- a/sc/source/ui/inc/conflictsdlg.hxx
+++ b/sc/source/ui/inc/conflictsdlg.hxx
@@ -111,50 +111,46 @@ public:
// class ScConflictsDlg
-class ScConflictsDlg : public ModalDialog
+class ScConflictsDlg : public weld::GenericDialogController
{
private:
- VclPtr<SvSimpleTableContainer> m_pLbConflictsContainer;
- VclPtr<SvxRedlinTable> m_pLbConflicts;
- VclPtr<PushButton> m_pBtnKeepMine;
- VclPtr<PushButton> m_pBtnKeepOther;
- VclPtr<PushButton> m_pBtnKeepAllMine;
- VclPtr<PushButton> m_pBtnKeepAllOthers;
+ OUString const maStrTitleConflict;
+ OUString const maStrUnknownUser;
- OUString const maStrTitleConflict;
- OUString const maStrUnknownUser;
-
- ScViewData* const mpViewData;
+ ScViewData* const mpViewData;
ScDocument* mpOwnDoc;
ScChangeTrack* mpOwnTrack;
- ScDocument* const mpSharedDoc;
+ ScDocument* const mpSharedDoc;
ScChangeTrack* mpSharedTrack;
ScConflictsList& mrConflictsList;
Idle maSelectionIdle;
bool mbInSelectHdl;
- bool mbInDeselectHdl;
+
+ std::unique_ptr<weld::Button> m_xBtnKeepMine;
+ std::unique_ptr<weld::Button> m_xBtnKeepOther;
+ std::unique_ptr<weld::Button> m_xBtnKeepAllMine;
+ std::unique_ptr<weld::Button> m_xBtnKeepAllOthers;
+ std::unique_ptr<SvxRedlinTable> m_xLbConflicts;
OUString GetConflictString( const ScConflictsListEntry& rConflictEntry );
- OUString GetActionString( const ScChangeAction* pAction, ScDocument* pDoc );
- void HandleListBoxSelection( bool bSelectHandle );
+ void SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, weld::TreeIter& rEntry);
+ void HandleListBoxSelection();
- static void SetConflictAction( const SvTreeListEntry* pRootEntry, ScConflictAction eConflictAction );
+ void SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction);
void KeepHandler( bool bMine );
void KeepAllHandler( bool bMine );
- DECL_LINK( SelectHandle, SvTreeListBox*, void );
- DECL_LINK( DeselectHandle, SvTreeListBox*, void );
+ DECL_LINK( SelectHandle, weld::TreeView&, void );
DECL_LINK( UpdateSelectionHdl, Timer*, void );
- DECL_LINK( KeepMineHandle, Button*, void );
- DECL_LINK( KeepOtherHandle, Button*, void );
- DECL_LINK( KeepAllMineHandle, Button*, void );
- DECL_LINK( KeepAllOthersHandle, Button*, void );
+ DECL_LINK( KeepMineHandle, weld::Button&, void );
+ DECL_LINK( KeepOtherHandle, weld::Button&, void );
+ DECL_LINK( KeepAllMineHandle, weld::Button&, void );
+ DECL_LINK( KeepAllOthersHandle, weld::Button&, void );
public:
- ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList );
- virtual ~ScConflictsDlg() override;
- virtual void dispose() override;
+ ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList);
+ virtual ~ScConflictsDlg() override;
void UpdateView();
};
diff --git a/sc/source/ui/inc/highred.hxx b/sc/source/ui/inc/highred.hxx
index 1a4c595a0cb8..ffb504cdf633 100644
--- a/sc/source/ui/inc/highred.hxx
+++ b/sc/source/ui/inc/highred.hxx
@@ -29,42 +29,44 @@ class ScViewData;
class ScDocument;
-class ScHighlightChgDlg : public ScAnyRefDlg
+class ScHighlightChgDlg : public ScAnyRefDlgController
{
private:
- VclPtr<CheckBox> m_pHighlightBox;
- VclPtr<SvxTPFilter> m_pFilterCtr;
- VclPtr<CheckBox> m_pCbAccept;
- VclPtr<CheckBox> m_pCbReject;
- VclPtr<OKButton> m_pOkButton;
-
- VclPtr<formula::RefEdit> m_pEdAssign;
- VclPtr<formula::RefButton> m_pRbAssign;
-
ScViewData* pViewData;
ScDocument* pDoc;
ScChangeViewSettings aChangeViewSet;
+ std::unique_ptr<weld::CheckButton> m_xHighlightBox;
+ std::unique_ptr<weld::CheckButton> m_xCbAccept;
+ std::unique_ptr<weld::CheckButton> m_xCbReject;
+ std::unique_ptr<weld::Button> m_xOkButton;
+
+ std::unique_ptr<formula::WeldRefEdit> m_xEdAssign;
+ std::unique_ptr<formula::WeldRefButton> m_xRbAssign;
+
+ std::unique_ptr<weld::Container> m_xBox;
+
+ std::unique_ptr<SvxTPFilter> m_xFilterCtr;
+
void Init();
DECL_LINK( RefHandle, SvxTPFilter*, void );
- DECL_LINK( HighlightHandle, Button*, void );
- DECL_LINK( OKBtnHdl, Button*, void );
+ DECL_LINK( HighlightHandle, weld::Button&, void );
+ DECL_LINK( OKBtnHdl, weld::Button&, void );
protected:
virtual void RefInputDone( bool bForced = false ) override;
public:
- ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
- ScViewData* ptrViewData);
+ ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
+ ScViewData* ptrViewData);
- virtual ~ScHighlightChgDlg() override;
- virtual void dispose() override;
+ virtual ~ScHighlightChgDlg() override;
virtual void SetActive() override;
virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
- virtual bool Close() override;
+ virtual void Close() override;
virtual bool IsRefInputMode() const override;
};
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index 61ec9321a9ad..eac1e2aa3ad2 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -33,30 +33,19 @@
SFX_DECL_CHILDWINDOW_WITHID(Class); \
};
-#define DECL_WRAPPER_WITHID_CONTROLLER(Class) \
- class Class : public SfxChildWindow \
- { \
- public: \
- Class( vcl::Window*, sal_uInt16, SfxBindings*, const SfxChildWinInfo* ); \
- static std::unique_ptr<SfxChildWindow> CreateImpl(vcl::Window *pParent, sal_uInt16 nId, \
- SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
- static void RegisterChildWindow (bool bVisible=false, SfxModule *pMod=nullptr, SfxChildWindowFlags nFlags=SfxChildWindowFlags::NONE); \
- static sal_uInt16 GetChildWindowId ();\
- };
-
-DECL_WRAPPER_WITHID_CONTROLLER(ScNameDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScNameDefDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScSolverDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScOptSolverDlgWrapper)
+DECL_WRAPPER_WITHID(ScNameDlgWrapper)
+DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
+DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
+DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScXMLSourceDlgWrapper)
DECL_WRAPPER_WITHID(ScPivotLayoutWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScTabOpDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScFilterDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScSpecialFilterDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScDbNameDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScConsolidateDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScPrintAreasDlgWrapper)
-DECL_WRAPPER_WITHID_CONTROLLER(ScColRowNameRangesDlgWrapper)
+DECL_WRAPPER_WITHID(ScTabOpDlgWrapper)
+DECL_WRAPPER_WITHID(ScFilterDlgWrapper)
+DECL_WRAPPER_WITHID(ScSpecialFilterDlgWrapper)
+DECL_WRAPPER_WITHID(ScDbNameDlgWrapper)
+DECL_WRAPPER_WITHID(ScConsolidateDlgWrapper)
+DECL_WRAPPER_WITHID(ScPrintAreasDlgWrapper)
+DECL_WRAPPER_WITHID(ScColRowNameRangesDlgWrapper)
DECL_WRAPPER_WITHID(ScFormulaDlgWrapper)
DECL_WRAPPER_WITHID(ScHighlightChgDlgWrapper)
DECL_WRAPPER_WITHID(ScCondFormatDlgWrapper)
@@ -159,41 +148,38 @@ private:
ScFourierAnalysisDialogWrapper() = delete;
};
-class ScAcceptChgDlgWrapper: public SfxChildWindow
+class ScAcceptChgDlgWrapper : public SfxChildWindow
{
- public:
- ScAcceptChgDlgWrapper( vcl::Window*,
- sal_uInt16,
- SfxBindings*,
- SfxChildWinInfo* );
+public:
+ ScAcceptChgDlgWrapper( vcl::Window*,
+ sal_uInt16,
+ SfxBindings*,
+ SfxChildWinInfo* );
- SFX_DECL_CHILDWINDOW_WITHID(Class);
+ SFX_DECL_CHILDWINDOW_WITHID(Class);
- void ReInitDlg();
+ void ReInitDlg();
};
class ScSimpleRefDlgWrapper: public SfxChildWindow
{
- public:
- ScSimpleRefDlgWrapper( vcl::Window*,
- sal_uInt16,
- SfxBindings*,
- SfxChildWinInfo* );
-
- static std::unique_ptr<SfxChildWindow> CreateImpl(vcl::Window *pParent, sal_uInt16 nId,
- SfxBindings *pBindings, SfxChildWinInfo* pInfo);
- static void RegisterChildWindow(bool bVisible=false, SfxModule *pMod=nullptr, SfxChildWindowFlags nFlags=SfxChildWindowFlags::NONE);
- static sal_uInt16 GetChildWindowId();
-
- static void SetDefaultPosSize(Point aPos, Size aSize);
- void SetRefString(const OUString& rStr);
- void SetCloseHdl( const Link<const OUString*,void>& rLink );
- void SetUnoLinks( const Link<const OUString&,void>& rDone, const Link<const OUString&,void>& rAbort,
- const Link<const OUString&,void>& rChange );
- void SetFlags( bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection );
- static void SetAutoReOpen(bool bFlag);
-
- void StartRefInput();
+public:
+ ScSimpleRefDlgWrapper(vcl::Window*,
+ sal_uInt16,
+ SfxBindings*,
+ SfxChildWinInfo*);
+
+ SFX_DECL_CHILDWINDOW_WITHID(Class);
+
+ static void SetDefaultPosSize(Point aPos, Size aSize);
+ void SetRefString(const OUString& rStr);
+ void SetCloseHdl( const Link<const OUString*,void>& rLink );
+ void SetUnoLinks( const Link<const OUString&,void>& rDone, const Link<const OUString&,void>& rAbort,
+ const Link<const OUString&,void>& rChange );
+ void SetFlags( bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection );
+ static void SetAutoReOpen(bool bFlag);
+
+ void StartRefInput();
};
class SC_DLLPUBLIC ScValidityRefChildWin : public SfxChildWindow
diff --git a/sc/source/ui/inc/simpref.hxx b/sc/source/ui/inc/simpref.hxx
index a69330fbf55b..7920005ac437 100644
--- a/sc/source/ui/inc/simpref.hxx
+++ b/sc/source/ui/inc/simpref.hxx
@@ -35,6 +35,7 @@ private:
ScRange theCurArea;
bool bCloseFlag;
+ bool bAutoReOpen;
bool bCloseOnButtonUp;
bool bSingleCell;
bool bMultiSelection;
@@ -67,6 +68,7 @@ public:
void StartRefInput();
void SetRefString(const OUString &rStr);
+ virtual void FillInfo(SfxChildWinInfo&) const override;
void SetCloseHdl( const Link<const OUString*,void>& rLink );
void SetUnoLinks( const Link<const OUString&,void>& rDone, const Link<const OUString&,void>& rAbort,
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 00b841ed4bc5..54b029509c7b 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -69,104 +69,92 @@ ScRedlinData::~ScRedlinData()
// class ScAcceptChgDlg
-ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
+ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
ScViewData* ptrViewData)
- : SfxModelessDialog(pB, pCW, pParent,
- "AcceptRejectChangesDialog", "svx/ui/acceptrejectchangesdialog.ui"),
- aSelectionIdle("ScAcceptChgDlg SelectionIdle"),
- aReOpenIdle("ScAcceptChgDlg ReOpenIdle"),
- m_xPopup(get_menu("calcmenu")),
- pViewData ( ptrViewData ),
- pDoc ( ptrViewData->GetDocument() ),
- aStrInsertCols (ScResId(STR_CHG_INSERT_COLS)),
- aStrInsertRows (ScResId(STR_CHG_INSERT_ROWS)),
- aStrInsertTabs (ScResId(STR_CHG_INSERT_TABS)),
- aStrDeleteCols (ScResId(STR_CHG_DELETE_COLS)),
- aStrDeleteRows (ScResId(STR_CHG_DELETE_ROWS)),
- aStrDeleteTabs (ScResId(STR_CHG_DELETE_TABS)),
- aStrMove (ScResId(STR_CHG_MOVE)),
- aStrContent (ScResId(STR_CHG_CONTENT)),
- aStrReject (ScResId(STR_CHG_REJECT)),
- aStrAllAccepted (ScResId(STR_CHG_ACCEPTED)),
- aStrAllRejected (ScResId(STR_CHG_REJECTED)),
- aStrNoEntry (ScResId(STR_CHG_NO_ENTRY)),
- aStrContentWithChild (ScResId(STR_CHG_CONTENT_WITH_CHILD)),
- aStrChildContent (ScResId(STR_CHG_CHILD_CONTENT)),
- aStrChildOrgContent (ScResId(STR_CHG_CHILD_ORGCONTENT)),
- aStrEmpty (ScResId(STR_CHG_EMPTY)),
- aUnknown("Unknown"),
- bIgnoreMsg(false),
- bNoSelection(false),
- bHasFilterEntry(false),
- bUseColor(false)
+ : SfxModelessDialogController(pB, pCW, pParent,
+ "svx/ui/acceptrejectchangesdialog.ui", "AcceptRejectChangesDialog")
+ , aSelectionIdle("ScAcceptChgDlg SelectionIdle")
+ , aReOpenIdle("ScAcceptChgDlg ReOpenIdle")
+ , pViewData( ptrViewData )
+ , pDoc( ptrViewData->GetDocument() )
+ , aStrInsertCols(ScResId(STR_CHG_INSERT_COLS))
+ , aStrInsertRows(ScResId(STR_CHG_INSERT_ROWS))
+ , aStrInsertTabs(ScResId(STR_CHG_INSERT_TABS))
+ , aStrDeleteCols(ScResId(STR_CHG_DELETE_COLS))
+ , aStrDeleteRows(ScResId(STR_CHG_DELETE_ROWS))
+ , aStrDeleteTabs(ScResId(STR_CHG_DELETE_TABS))
+ , aStrMove(ScResId(STR_CHG_MOVE))
+ , aStrContent(ScResId(STR_CHG_CONTENT))
+ , aStrReject(ScResId(STR_CHG_REJECT))
+ , aStrAllAccepted(ScResId(STR_CHG_ACCEPTED))
+ , aStrAllRejected(ScResId(STR_CHG_REJECTED))
+ , aStrNoEntry(ScResId(STR_CHG_NO_ENTRY))
+ , aStrContentWithChild(ScResId(STR_CHG_CONTENT_WITH_CHILD))
+ , aStrChildContent(ScResId(STR_CHG_CHILD_CONTENT))
+ , aStrChildOrgContent(ScResId(STR_CHG_CHILD_ORGCONTENT))
+ , aStrEmpty(ScResId(STR_CHG_EMPTY))
+ , aUnknown("Unknown")
+ , bIgnoreMsg(false)
+ , bNoSelection(false)
+ , bHasFilterEntry(false)
+ , bUseColor(false)
+ , m_xContentArea(m_xDialog->weld_content_area())
+ , m_xPopup(m_xBuilder->weld_menu("calcmenu"))
{
- m_pAcceptChgCtr = VclPtr<SvxAcceptChgCtr>::Create(get_content_area(), this);
+ m_xAcceptChgCtr.reset(new SvxAcceptChgCtr(m_xContentArea.get(), m_xBuilder.get()));
nAcceptCount=0;
nRejectCount=0;
aReOpenIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl ));
- pTPFilter=m_pAcceptChgCtr->GetFilterPage();
- pTPView=m_pAcceptChgCtr->GetViewPage();
- pTheView=pTPView->GetTableControl();
+ pTPFilter = m_xAcceptChgCtr->GetFilterPage();
+ pTPView = m_xAcceptChgCtr->GetViewPage();
+ pTheView = pTPView->GetTableControl();
+ pTheView->SetCalcView();
aSelectionIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, UpdateSelectionHdl ));
aSelectionIdle.SetDebugName( "ScAcceptChgDlg aSelectionIdle" );
pTPFilter->SetReadyHdl(LINK( this, ScAcceptChgDlg, FilterHandle ));
pTPFilter->SetRefHdl(LINK( this, ScAcceptChgDlg, RefHandle ));
pTPFilter->HideRange(false);
- pTPView->InsertCalcHeader();
pTPView->SetRejectClickHdl( LINK( this, ScAcceptChgDlg,RejectHandle));
pTPView->SetAcceptClickHdl( LINK(this, ScAcceptChgDlg, AcceptHandle));
pTPView->SetRejectAllClickHdl( LINK( this, ScAcceptChgDlg,RejectAllHandle));
pTPView->SetAcceptAllClickHdl( LINK(this, ScAcceptChgDlg, AcceptAllHandle));
- pTheView->SetCalcView();
- pTheView->SetStyle(pTheView->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
- pTheView->SetExpandingHdl( LINK(this, ScAcceptChgDlg, ExpandingHandle));
- pTheView->SetSelectHdl( LINK(this, ScAcceptChgDlg, SelectHandle));
- pTheView->SetDeselectHdl( LINK(this, ScAcceptChgDlg, SelectHandle));
- pTheView->SetCommandHdl( LINK(this, ScAcceptChgDlg, CommandHdl));
- pTheView->SetColCompareHdl( LINK(this, ScAcceptChgDlg,ColCompareHdl));
- pTheView->SetSelectionMode(SelectionMode::Multiple);
- pTheView->SetHighlightRange(1);
+
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.connect_expanding(LINK(this, ScAcceptChgDlg, ExpandingHandle));
+ rTreeView.connect_changed(LINK(this, ScAcceptChgDlg, SelectHandle));
+ rTreeView.connect_popup_menu(LINK(this, ScAcceptChgDlg, CommandHdl));
+ rTreeView.set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
+ return ColCompareHdl(rLeft, rRight);
+ });
+ rTreeView.set_selection_mode(SelectionMode::Multiple);
Init();
UpdateView();
- SvTreeListEntry* pEntry=pTheView->First();
- if(pEntry!=nullptr)
- {
- pTheView->Select(pEntry);
- }
-}
-ScAcceptChgDlg::~ScAcceptChgDlg()
-{
- disposeOnce();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xEntry))
+ rTreeView.select(*xEntry);
}
-void ScAcceptChgDlg::dispose()
+ScAcceptChgDlg::~ScAcceptChgDlg()
{
ClearView();
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
- if(pChanges!=nullptr)
+ if (pChanges)
{
Link<ScChangeTrack&,void> aLink;
pChanges->SetModifiedLink(aLink);
}
-
- m_xPopup.clear();
- m_pAcceptChgCtr.disposeAndClear();
- pTPFilter.clear();
- pTPView.clear();
- pTheView.clear();
- SfxModelessDialog::dispose();
}
void ScAcceptChgDlg::ReInit(ScViewData* ptrViewData)
{
pViewData=ptrViewData;
- if(pViewData!=nullptr)
+ if (pViewData)
pDoc=ptrViewData->GetDocument();
else
pDoc=nullptr;
@@ -212,10 +200,22 @@ void ScAcceptChgDlg::Init()
aChangeViewSet.AdjustDateMode( *pDoc );
pTPFilter->CheckDate(aChangeViewSet.HasDate());
- pTPFilter->SetFirstDate(aChangeViewSet.GetTheFirstDateTime());
- pTPFilter->SetFirstTime(aChangeViewSet.GetTheFirstDateTime());
- pTPFilter->SetLastDate(aChangeViewSet.GetTheLastDateTime());
- pTPFilter->SetLastTime(aChangeViewSet.GetTheLastDateTime());
+
+ DateTime aEmpty(DateTime::EMPTY);
+
+ DateTime aDateTime(aChangeViewSet.GetTheFirstDateTime());
+ if (aDateTime != aEmpty)
+ {
+ pTPFilter->SetFirstDate(aDateTime);
+ pTPFilter->SetFirstTime(aDateTime);
+ }
+ aDateTime = aChangeViewSet.GetTheLastDateTime();
+ if (aDateTime != aEmpty)
+ {
+ pTPFilter->SetLastDate(aDateTime);
+ pTPFilter->SetLastTime(aDateTime);
+ }
+
pTPFilter->SetDateMode(static_cast<sal_uInt16>(aChangeViewSet.GetTheDateMode()));
pTPFilter->CheckComment(aChangeViewSet.HasComment());
pTPFilter->SetComment(aChangeViewSet.GetTheComment());
@@ -273,10 +273,10 @@ void ScAcceptChgDlg::ClearView()
{
nAcceptCount=0;
nRejectCount=0;
- pTheView->SetUpdateMode(false);
-
- pTheView->Clear();
- pTheView->SetUpdateMode(true);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.freeze();
+ rTreeView.clear();
+ rTreeView.thaw();
}
OUString* ScAcceptChgDlg::MakeTypeString(ScChangeActionType eType)
@@ -348,16 +348,14 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction)
return bFlag;
}
-SvTreeListEntry* ScAcceptChgDlg::AppendChangeAction(
- const ScChangeAction* pScChangeAction,
- SvTreeListEntry* pParent, bool bDelMaster,bool bDisabled)
+std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction(
+ const ScChangeAction* pScChangeAction, bool bCreateOnDemand,
+ const weld::TreeIter* pParent, bool bDelMaster, bool bDisabled)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
- SvTreeListEntry* pEntry=nullptr;
-
bool bFlag = false;
ScRange aRef=pScChangeAction->GetBigRange().MakeRange();
@@ -470,47 +468,44 @@ SvTreeListEntry* ScAcceptChgDlg::AppendChangeAction(
}
}
- if(!bFlag&& bUseColor&& pParent==nullptr)
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ OUString sString(aBuf.makeStringAndClear());
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
+ rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, nullptr, bCreateOnDemand, xEntry.get());
+ if (!bFlag && bUseColor && !pParent)
{
- pEntry = pTheView->InsertEntry(
- aBuf.makeStringAndClear(), std::move(pNewData), COL_LIGHTBLUE, pParent, TREELIST_APPEND);
+ rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE);
}
- else if(bFlag&& bUseColor&& pParent!=nullptr)
+ else if (bFlag && bUseColor && pParent)
{
- pEntry = pTheView->InsertEntry(
- aBuf.makeStringAndClear(), std::move(pNewData), COL_GREEN, pParent, TREELIST_APPEND);
- SvTreeListEntry* pExpEntry=pParent;
+ rTreeView.set_font_color(*xEntry, COL_GREEN);
- while(pExpEntry!=nullptr && !pTheView->IsExpanded(pExpEntry))
- {
- SvTreeListEntry* pTmpEntry=pTheView->GetParent(pExpEntry);
+ std::unique_ptr<weld::TreeIter> xExpEntry(rTreeView.make_iterator(pParent));
- if(pTmpEntry!=nullptr) pTheView->Expand(pExpEntry);
+ while (!rTreeView.get_row_expanded(*xExpEntry))
+ {
+ if (rTreeView.get_iter_depth(*xExpEntry))
+ rTreeView.expand_row(*xExpEntry);
- pExpEntry=pTmpEntry;
+ if (!rTreeView.iter_parent(*xExpEntry))
+ break;
}
}
- else
- {
- pEntry = pTheView->InsertEntry(
- aBuf.makeStringAndClear(), std::move(pNewData), pParent, TREELIST_APPEND);
- }
- return pEntry;
+ return xEntry;
}
-SvTreeListEntry* ScAcceptChgDlg::AppendFilteredAction(
+std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction(
const ScChangeAction* pScChangeAction, ScChangeActionState eState,
- SvTreeListEntry* pParent, bool bDelMaster, bool bDisabled)
+ bool bCreateOnDemand,
+ const weld::TreeIter* pParent, bool bDelMaster, bool bDisabled)
{
-
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
bool bIsGenerated = pChanges->IsGenerated(pScChangeAction->GetActionNumber());
- SvTreeListEntry* pEntry=nullptr;
-
bool bFlag = false;
ScRange aRef=pScChangeAction->GetBigRange().MakeRange();
@@ -536,12 +531,11 @@ SvTreeListEntry* ScAcceptChgDlg::AppendFilteredAction(
bFlag = true;
}
+ std::unique_ptr<weld::TreeIter> xEntry;
if(bFlag)
{
-
- OUString aRefStr;
ScChangeActionType eType=pScChangeAction->GetType();
- OUString aString;
+ OUString aActionString;
OUString aDesc;
std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
@@ -559,20 +553,20 @@ SvTreeListEntry* ScAcceptChgDlg::AppendFilteredAction(
{
if(pScChangeAction->IsDialogParent())
{
- aString=aStrContentWithChild;
+ aActionString=aStrContentWithChild;
pNewData->nInfo=RD_SPECIAL_VISCONTENT;
pNewData->bIsRejectable=false;
pNewData->bIsAcceptable=false;
}
else
{
- aString=*MakeTypeString(eType);
+ aActionString=*MakeTypeString(eType);
pScChangeAction->GetDescription( aDesc, pDoc, true);
}
}
else
{
- aString=*MakeTypeString(eType);
+ aActionString=*MakeTypeString(eType);
if(bDelMaster)
{
@@ -585,45 +579,40 @@ SvTreeListEntry* ScAcceptChgDlg::AppendFilteredAction(
}
- aString += "\t";
- pScChangeAction->GetRefString(aRefStr, pDoc, true);
- aString += aRefStr + "\t";
-
- if(!bIsGenerated)
- {
- aString += aUser
- + "\t"
- + ScGlobal::pLocaleData->getDate(aDateTime)
- + " "
- + ScGlobal::pLocaleData->getTime(aDateTime)
- + "\t";
- }
- else
- {
- aString += "\t";
- aString += "\t";
- }
OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
-
if (!aDesc.isEmpty())
{
aComment += " (" + aDesc + ")";
}
if (pTheView->IsValidComment(aComment))
{
- aString+=aComment;
- pEntry=pTheView->InsertEntry(aString,std::move(pNewData),pParent,TREELIST_APPEND);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ xEntry = rTreeView.make_iterator();
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
+ rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, nullptr, bCreateOnDemand, xEntry.get());
+
+ OUString aRefStr;
+ pScChangeAction->GetRefString(aRefStr, pDoc, true);
+ rTreeView.set_text(*xEntry, aRefStr, 1);
+
+ if (!bIsGenerated)
+ {
+ rTreeView.set_text(*xEntry, aUser, 2);
+ OUString sDate = ScGlobal::pLocaleData->getDate(aDateTime) + " " + ScGlobal::pLocaleData->getTime(aDateTime);
+ rTreeView.set_text(*xEntry, sDate, 3);
+ }
+
+ rTreeView.set_text(*xEntry, aComment, 4);
}
}
- return pEntry;
+ return xEntry;
}
-SvTreeListEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
- SvTreeListEntry* pParent, sal_uLong nSpecial)
+std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
+ const weld::TreeIter& rParent, sal_uLong nSpecial)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
- SvTreeListEntry* pEntry=nullptr;
if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
@@ -727,23 +716,27 @@ SvTreeListEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionC
pNewData->nCol = aRef.aStart.Col();
pNewData->nTable= aRef.aStart.Tab();
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
+ rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, nullptr, false, xEntry.get());
if (pTheView->IsValidComment(aComment) && bFlag)
- {
bHasFilterEntry=true;
- pEntry=pTheView->InsertEntry(aString,std::move(pNewData),pParent);
- }
else
- pEntry=pTheView->InsertEntry(aString,std::move(pNewData),COL_LIGHTBLUE,pParent);
- return pEntry;
+ {
+ rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE);
+ }
+ return xEntry;
}
void ScAcceptChgDlg::UpdateView()
{
- SvTreeListEntry* pParent=nullptr;
+ std::unique_ptr<weld::TreeIter> xParent;
ScChangeTrack* pChanges=nullptr;
const ScChangeAction* pScChangeAction=nullptr;
- SetPointer(PointerStyle::Wait);
- pTheView->SetUpdateMode(false);
+ m_xDialog->set_busy_cursor(true);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.freeze();
bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
pTPFilter->IsAuthor() || pTPFilter->IsComment();
@@ -760,45 +753,41 @@ void ScAcceptChgDlg::UpdateView()
while(pScChangeAction!=nullptr)
{
bHasFilterEntry=false;
- switch(pScChangeAction->GetState())
+ switch (pScChangeAction->GetState())
{
case SC_CAS_VIRGIN:
- if(pScChangeAction->IsDialogRoot())
+ if (pScChangeAction->IsDialogRoot())
{
- if(pScChangeAction->IsDialogParent())
- pParent=AppendChangeAction(pScChangeAction);
+ bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
+ if (pScChangeAction->IsDialogParent())
+ xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
else
- pParent=AppendFilteredAction(pScChangeAction,SC_CAS_VIRGIN);
+ xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
}
else
- pParent=nullptr;
+ xParent.reset();
bTheFlag=true;
break;
case SC_CAS_ACCEPTED:
- pParent=nullptr;
+ xParent.reset();
nAcceptCount++;
break;
case SC_CAS_REJECTED:
- pParent=nullptr;
+ xParent.reset();
nRejectCount++;
break;
}
- if(pParent!=nullptr && pScChangeAction->IsDialogParent())
+ if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
{
- if(!bFilterFlag)
- pParent->EnableChildrenOnDemand();
- else
- {
- bool bTestFlag = bHasFilterEntry;
- bHasFilterEntry=false;
- if(Expand(pChanges,pScChangeAction,pParent,!bTestFlag)&&!bTestFlag)
- pTheView->RemoveEntry(pParent);
- }
+ bool bTestFlag = bHasFilterEntry;
+ bHasFilterEntry=false;
+ if (Expand(pChanges, pScChangeAction, *xParent, !bTestFlag) && !bTestFlag)
+ rTreeView.remove(*xParent);
}
pScChangeAction=pScChangeAction->GetNext();
@@ -812,33 +801,21 @@ void ScAcceptChgDlg::UpdateView()
pTPView->EnableReject(bTheFlag);
pTPView->EnableRejectAll(bTheFlag);
- if(nAcceptCount>0)
- {
- pParent=pTheView->InsertEntry(
- aStrAllAccepted, std::unique_ptr<RedlinData>(),
- static_cast< SvTreeListEntry * >(nullptr));
- pParent->EnableChildrenOnDemand();
- }
- if(nRejectCount>0)
- {
- pParent=pTheView->InsertEntry(
- aStrAllRejected, std::unique_ptr<RedlinData>(),
- static_cast< SvTreeListEntry * >(nullptr));
- pParent->EnableChildrenOnDemand();
- }
- pTheView->SetUpdateMode(true);
- SetPointer(PointerStyle::Arrow);
- SvTreeListEntry* pEntry=pTheView->First();
- if(pEntry!=nullptr)
- pTheView->Select(pEntry);
+ if (nAcceptCount>0)
+ rTreeView.insert(nullptr, -1, &aStrAllAccepted, nullptr, nullptr, nullptr, nullptr, true, nullptr);
+ if (nRejectCount>0)
+ rTreeView.insert(nullptr, -1, &aStrAllRejected, nullptr, nullptr, nullptr, nullptr, true, nullptr);
+ rTreeView.thaw();
+ m_xDialog->set_busy_cursor(false);
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xEntry))
+ rTreeView.select(*xEntry);
}
IMPL_LINK_NOARG(ScAcceptChgDlg, RefHandle, SvxTPFilter*, void)
{
sal_uInt16 nId =ScSimpleRefDlgWrapper::GetChildWindowId();
- ScSimpleRefDlgWrapper::SetDefaultPosSize(GetPosPixel(),GetSizePixel());
-
SC_MOD()->SetRefDialog( nId, true );
SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
@@ -851,44 +828,30 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, RefHandle, SvxTPFilter*, void)
pWnd->SetCloseHdl(LINK( this, ScAcceptChgDlg,RefInfoHandle));
pWnd->SetRefString(pTPFilter->GetRange());
ScSimpleRefDlgWrapper::SetAutoReOpen(false);
- vcl::Window* pWin=pWnd->GetWindow();
- pWin->SetPosSizePixel(GetPosPixel(),GetSizePixel());
- Hide();
- pWin->SetText(GetText());
+ auto xWin = pWnd->GetController();
+ m_xDialog->hide();
+ xWin->set_title(m_xDialog->get_title());
pWnd->StartRefInput();
}
}
IMPL_LINK( ScAcceptChgDlg, RefInfoHandle, const OUString*, pResult, void)
{
- sal_uInt16 nId;
+ sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
ScSimpleRefDlgWrapper::SetAutoReOpen(true);
SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
- if(pResult!=nullptr)
+ if (pResult)
{
pTPFilter->SetRange(*pResult);
FilterHandle(pTPFilter);
- nId = ScSimpleRefDlgWrapper::GetChildWindowId();
- ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
-
- if(pWnd!=nullptr)
- {
- vcl::Window* pWin=pWnd->GetWindow();
- Size aWinSize=pWin->GetSizePixel();
- aWinSize.setWidth(GetSizePixel().Width() );
- SetPosSizePixel(pWin->GetPosPixel(),aWinSize);
- Invalidate();
- }
- nId = ScAcceptChgDlgWrapper::GetChildWindowId();
- pViewFrm->ShowChildWindow( nId );
+ pViewFrm->ShowChildWindow(nId);
}
else
{
- nId = ScAcceptChgDlgWrapper::GetChildWindowId();
- pViewFrm->SetChildWindow( nId, false );
+ pViewFrm->SetChildWindow(nId, false);
}
}
@@ -905,29 +868,25 @@ IMPL_LINK( ScAcceptChgDlg, FilterHandle, SvxTPFilter*, pRef, void )
IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void )
{
- SetPointer(PointerStyle::Wait);
+ m_xDialog->set_busy_cursor(true);
bIgnoreMsg=true;
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
if(pRef!=nullptr)
{
- SvTreeListEntry* pEntry=pTheView->FirstSelected();
- while(pEntry!=nullptr)
- {
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
- if(pEntryData!=nullptr)
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.selected_foreach([this, pChanges, &rTreeView](weld::TreeIter& rEntry){
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ if (pEntryData)
{
- ScChangeAction* pScChangeAction=
- static_cast<ScChangeAction*>(pEntryData->pData);
-
- if(pScChangeAction->GetType()==SC_CAT_INSERT_TABS)
+ ScChangeAction* pScChangeAction= static_cast<ScChangeAction*>(pEntryData->pData);
+ if (pScChangeAction->GetType()==SC_CAT_INSERT_TABS)
pViewData->SetTabNo(0);
-
pChanges->Reject(pScChangeAction);
}
- pEntry = pTheView->NextSelected(pEntry);
- }
+ return false;
+ });
ScDocShell* pDocSh=pViewData->GetDocShell();
pDocSh->PostPaintExtras();
pDocSh->PostPaintGridAll();
@@ -936,23 +895,23 @@ IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void )
ClearView();
UpdateView();
}
- SetPointer(PointerStyle::Arrow);
+
+ m_xDialog->set_busy_cursor(false);
bIgnoreMsg=false;
}
IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
{
- SetPointer(PointerStyle::Wait);
+ m_xDialog->set_busy_cursor(true);
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
bIgnoreMsg=true;
if(pRef!=nullptr)
{
- SvTreeListEntry* pEntry=pTheView->FirstSelected();
- while(pEntry!=nullptr)
- {
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
- if(pEntryData!=nullptr)
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.selected_foreach([pChanges, &rTreeView](weld::TreeIter& rEntry) {
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ if (pEntryData)
{
ScChangeAction* pScChangeAction=
static_cast<ScChangeAction*>(pEntryData->pData);
@@ -966,8 +925,8 @@ IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
else
pChanges->Accept(pScChangeAction);
}
- pEntry = pTheView->NextSelected(pEntry);
- }
+ return false;
+ });
ScDocShell* pDocSh=pViewData->GetDocShell();
pDocSh->PostPaintExtras();
pDocSh->PostPaintGridAll();
@@ -975,7 +934,7 @@ IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
ClearView();
UpdateView();
}
- SetPointer(PointerStyle::Arrow);
+ m_xDialog->set_busy_cursor(false);
bIgnoreMsg=false;
}
@@ -1020,7 +979,7 @@ void ScAcceptChgDlg::AcceptFiltered()
IMPL_LINK_NOARG(ScAcceptChgDlg, RejectAllHandle, SvxTPView*, void)
{
- SetPointer(PointerStyle::Wait);
+ m_xDialog->set_busy_cursor(true);
bIgnoreMsg=true;
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
if(pChanges!=nullptr)
@@ -1040,14 +999,14 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, RejectAllHandle, SvxTPView*, void)
ClearView();
UpdateView();
}
- SetPointer(PointerStyle::Arrow);
+ m_xDialog->set_busy_cursor(false);
bIgnoreMsg=false;
}
IMPL_LINK_NOARG(ScAcceptChgDlg, AcceptAllHandle, SvxTPView*, void)
{
- SetPointer(PointerStyle::Wait);
+ m_xDialog->set_busy_cursor(true);
bIgnoreMsg=true;
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
@@ -1066,27 +1025,29 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, AcceptAllHandle, SvxTPView*, void)
UpdateView();
}
bIgnoreMsg=false;
- SetPointer(PointerStyle::Arrow);
+
+ m_xDialog->set_busy_cursor(false);
}
-IMPL_LINK_NOARG(ScAcceptChgDlg, SelectHandle, SvTreeListBox*, void)
+IMPL_LINK_NOARG(ScAcceptChgDlg, SelectHandle, weld::TreeView&, void)
{
- if(!bNoSelection)
+ if (!bNoSelection)
aSelectionIdle.Start();
bNoSelection=false;
}
-void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction,
- ScChangeActionMap& aActionMap,
- SvTreeListEntry* pEntry)
+void ScAcceptChgDlg::GetDependents(const ScChangeAction* pScChangeAction,
+ ScChangeActionMap& aActionMap,
+ const weld::TreeIter& rEntry)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
- SvTreeListEntry* pParent=pTheView->GetParent(pEntry);
- if(pParent!=nullptr)
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
+ if (rTreeView.iter_parent(*xParent))
{
- ScRedlinData *pParentData=static_cast<ScRedlinData *>(pParent->GetUserData());
+ ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xParent).toInt64());
ScChangeAction* pParentAction=static_cast<ScChangeAction*>(pParentData->pData);
if(pParentAction!=pScChangeAction)
@@ -1101,10 +1062,11 @@ void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction,
aActionMap, pScChangeAction->IsMasterDelete() );
}
-bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeListEntry* pParent)
+bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const weld::TreeIter& rParent)
{
bool bTheTestFlag = true;
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pParent->GetUserData());
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rParent).toInt64());
const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
bool bParentInserted = false;
// If the parent is a MatrixOrigin then place it in the right order before
@@ -1119,7 +1081,6 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeL
const_cast<ScChangeAction*>( pScChangeAction ) ) );
bParentInserted = true;
}
- SvTreeListEntry* pEntry=nullptr;
ScChangeActionMap::iterator itChangeAction = std::find_if(pActionMap->begin(), pActionMap->end(),
[](const std::pair<sal_uLong, ScChangeAction*>& rEntry) { return rEntry.second->GetState() == SC_CAS_VIRGIN; });
@@ -1127,14 +1088,14 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeL
if( itChangeAction == pActionMap->end() )
return true;
- SvTreeListEntry* pOriginal = InsertChangeActionContent(
+ std::unique_ptr<weld::TreeIter> xOriginal = InsertChangeActionContent(
dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
- pParent, RD_SPECIAL_CONTENT );
+ rParent, RD_SPECIAL_CONTENT );
- if(pOriginal!=nullptr)
+ if (xOriginal)
{
bTheTestFlag=false;
- ScRedlinData *pParentData=static_cast<ScRedlinData *>(pOriginal->GetUserData());
+ ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xOriginal).toInt64());
pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
pParentData->nActionNo=pScChangeAction->GetActionNumber();
pParentData->bIsAcceptable=pScChangeAction->IsRejectable(); // select old value
@@ -1145,10 +1106,11 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeL
{
if( itChangeAction->second->GetState() == SC_CAS_VIRGIN )
{
- pEntry = InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
- pParent, RD_SPECIAL_NONE );
+ std::unique_ptr<weld::TreeIter> xEntry =
+ InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
+ rParent, RD_SPECIAL_NONE );
- if(pEntry!=nullptr)
+ if (xEntry)
bTheTestFlag=false;
}
++itChangeAction;
@@ -1156,13 +1118,14 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeL
if ( !bParentInserted )
{
- pEntry=InsertChangeActionContent(static_cast<const ScChangeActionContent*>(
- pScChangeAction),pParent,RD_SPECIAL_NONE);
+ std::unique_ptr<weld::TreeIter> xEntry =
+ InsertChangeActionContent(static_cast<const ScChangeActionContent*>(
+ pScChangeAction),rParent,RD_SPECIAL_NONE);
- if(pEntry!=nullptr)
+ if (xEntry)
{
bTheTestFlag=false;
- ScRedlinData *pParentData=static_cast<ScRedlinData *>(pEntry->GetUserData());
+ ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
pParentData->nActionNo=pScChangeAction->GetActionNumber();
pParentData->bIsAcceptable=pScChangeAction->IsClickable();
@@ -1172,16 +1135,16 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeL
}
return bTheTestFlag;
-
}
-bool ScAcceptChgDlg::InsertAcceptedORejected(SvTreeListEntry* pParent)
+bool ScAcceptChgDlg::InsertAcceptedORejected(const weld::TreeIter& rParent)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
bool bTheTestFlag = true;
ScChangeActionState eState = SC_CAS_VIRGIN;
- OUString aString = pTheView->GetEntryText(pParent);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ OUString aString = rTreeView.get_text(rParent, 0);
OUString a2String = aString.copy(0, aStrAllAccepted.getLength());
if (a2String == aStrAllAccepted)
eState=SC_CAS_ACCEPTED;
@@ -1192,90 +1155,91 @@ bool ScAcceptChgDlg::InsertAcceptedORejected(SvTreeListEntry* pParent)
eState=SC_CAS_REJECTED;
}
- ScChangeAction* pScChangeAction=pChanges->GetFirst();
- while(pScChangeAction!=nullptr)
+ ScChangeAction* pScChangeAction = pChanges->GetFirst();
+ while (pScChangeAction)
{
- if(pScChangeAction->GetState()==eState &&
- AppendFilteredAction(pScChangeAction,eState,pParent)!=nullptr)
+ if (pScChangeAction->GetState()==eState &&
+ AppendFilteredAction(pScChangeAction, eState, false, &rParent))
bTheTestFlag=false;
pScChangeAction=pScChangeAction->GetNext();
}
return bTheTestFlag;
}
-bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvTreeListEntry* pParent)
+bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap, const weld::TreeIter& rParent)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
bool bTheTestFlag = true;
for( const auto& rChangeAction : *pActionMap )
{
- SvTreeListEntry* pEntry=AppendChangeAction( rChangeAction.second, pParent, false, true );
+ std::unique_ptr<weld::TreeIter> xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
- if(pEntry!=nullptr)
+ if (xEntry)
{
bTheTestFlag=false;
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
pEntryData->bIsRejectable=false;
pEntryData->bIsAcceptable=false;
pEntryData->bDisabled=true;
- if( rChangeAction.second->IsDialogParent() )
- Expand( pChanges, rChangeAction.second, pEntry );
+ if (rChangeAction.second->IsDialogParent())
+ Expand(pChanges, rChangeAction.second, *xEntry);
}
}
return bTheTestFlag;
}
bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction,
- ScChangeActionMap* pActionMap,SvTreeListEntry* pParent)
+ ScChangeActionMap* pActionMap, const weld::TreeIter& rParent)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
bool bTheTestFlag = true;
- SvTreeListEntry* pEntry=nullptr;
+ std::unique_ptr<weld::TreeIter> xEntry;
for( const auto& rChangeAction : *pActionMap )
{
if( pScChangeAction != rChangeAction.second )
- pEntry = AppendChangeAction( rChangeAction.second, pParent, false, true );
+ xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
else
- pEntry = AppendChangeAction( rChangeAction.second, pParent, true, true );
+ xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, true, true);
- if(pEntry!=nullptr)
+ if (xEntry)
{
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
pEntryData->bIsRejectable=false;
pEntryData->bIsAcceptable=false;
pEntryData->bDisabled=true;
bTheTestFlag=false;
- if( rChangeAction.second->IsDialogParent() )
- Expand( pChanges, rChangeAction.second, pEntry );
+ if (rChangeAction.second->IsDialogParent())
+ Expand(pChanges, rChangeAction.second, *xEntry);
}
}
return bTheTestFlag;
}
-bool ScAcceptChgDlg::Expand(
- const ScChangeTrack* pChanges, const ScChangeAction* pScChangeAction,
- SvTreeListEntry* pEntry, bool bFilter)
+bool ScAcceptChgDlg::Expand(const ScChangeTrack* pChanges, const ScChangeAction* pScChangeAction,
+ const weld::TreeIter& rEntry, bool bFilter)
{
bool bTheTestFlag = true;
- if(pChanges!=nullptr &&pEntry!=nullptr &&pScChangeAction!=nullptr)
+ if (pChanges && pScChangeAction)
{
ScChangeActionMap aActionMap;
- GetDependents( pScChangeAction, aActionMap, pEntry );
+ GetDependents(pScChangeAction, aActionMap, rEntry);
switch(pScChangeAction->GetType())
{
case SC_CAT_CONTENT:
{
- InsertContentChildren( &aActionMap, pEntry );
+ InsertContentChildren(&aActionMap, rEntry);
bTheTestFlag=!bHasFilterEntry;
break;
}
@@ -1283,14 +1247,14 @@ bool ScAcceptChgDlg::Expand(
case SC_CAT_DELETE_ROWS:
case SC_CAT_DELETE_TABS:
{
- InsertDeletedChildren( pScChangeAction, &aActionMap, pEntry );
+ InsertDeletedChildren(pScChangeAction, &aActionMap, rEntry);
bTheTestFlag=!bHasFilterEntry;
break;
}
default:
{
if(!bFilter)
- bTheTestFlag = InsertChildren( &aActionMap, pEntry );
+ bTheTestFlag = InsertChildren(&aActionMap, rEntry);
break;
}
}
@@ -1299,65 +1263,61 @@ bool ScAcceptChgDlg::Expand(
return bTheTestFlag;
}
-IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvTreeListBox*, pTable, bool )
+IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
- SetPointer(PointerStyle::Wait);
- if(pTable!=nullptr && pChanges!=nullptr)
+ if (pChanges)
{
+ m_xDialog->set_busy_cursor(true);
ScChangeActionMap aActionMap;
- SvTreeListEntry* pEntry=pTheView->GetHdlEntry();
- if(pEntry!=nullptr)
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ if (!rTreeView.iter_has_child(rEntry))
{
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
+ bool bTheTestFlag = true;
- if(pEntry->HasChildrenOnDemand())
+ if (pEntryData)
{
- bool bTheTestFlag = true;
- pEntry->EnableChildrenOnDemand(false);
- SvTreeListEntry* pChildEntry = pTheView->FirstChild(pEntry);
- if (pChildEntry)
- pTheView->RemoveEntry(pChildEntry);
-
- if(pEntryData!=nullptr)
- {
- ScChangeAction* pScChangeAction=static_cast<ScChangeAction*>(pEntryData->pData);
+ ScChangeAction* pScChangeAction=static_cast<ScChangeAction*>(pEntryData->pData);
- GetDependents( pScChangeAction, aActionMap, pEntry );
+ GetDependents(pScChangeAction, aActionMap, rEntry);
- switch(pScChangeAction->GetType())
+ switch (pScChangeAction->GetType())
+ {
+ case SC_CAT_CONTENT:
{
- case SC_CAT_CONTENT:
- {
- bTheTestFlag = InsertContentChildren( &aActionMap, pEntry );
- break;
- }
- case SC_CAT_DELETE_COLS:
- case SC_CAT_DELETE_ROWS:
- case SC_CAT_DELETE_TABS:
- {
- bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, pEntry );
- break;
- }
- default:
- {
- bTheTestFlag = InsertChildren( &aActionMap, pEntry );
- break;
- }
+ bTheTestFlag = InsertContentChildren( &aActionMap, rEntry );
+ break;
+ }
+ case SC_CAT_DELETE_COLS:
+ case SC_CAT_DELETE_ROWS:
+ case SC_CAT_DELETE_TABS:
+ {
+ bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, rEntry );
+ break;
+ }
+ default:
+ {
+ bTheTestFlag = InsertChildren( &aActionMap, rEntry );
+ break;
}
- aActionMap.clear();
-
- }
- else
- {
- bTheTestFlag=InsertAcceptedORejected(pEntry);
}
- if(bTheTestFlag) pTheView->InsertEntry(aStrNoEntry,nullptr,COL_GRAY,pEntry);
- }
+ aActionMap.clear();
+ }
+ else
+ {
+ bTheTestFlag = InsertAcceptedORejected(rEntry);
+ }
+ if (bTheTestFlag)
+ {
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ rTreeView.insert(&rEntry, -1, &aStrNoEntry, nullptr, nullptr, nullptr, nullptr, false, xEntry.get());
+ rTreeView.set_font_color(*xEntry, COL_GRAY);
+ }
}
+ m_xDialog->set_busy_cursor(false);
}
- SetPointer(PointerStyle::Arrow);
return true;
}
@@ -1366,9 +1326,10 @@ void ScAcceptChgDlg::AppendChanges(const ScChangeTrack* pChanges,sal_uLong nStar
{
if(pChanges!=nullptr)
{
- SvTreeListEntry* pParent=nullptr;
- SetPointer(PointerStyle::Wait);
- pTheView->SetUpdateMode(false);
+ std::unique_ptr<weld::TreeIter> xParent;
+ m_xDialog->set_busy_cursor(true);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.freeze();
bool bTheFlag = false;
@@ -1382,45 +1343,41 @@ void ScAcceptChgDlg::AppendChanges(const ScChangeTrack* pChanges,sal_uLong nStar
const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
if(pScChangeAction==nullptr) continue;
- switch(pScChangeAction->GetState())
+ switch (pScChangeAction->GetState())
{
case SC_CAS_VIRGIN:
- if(pScChangeAction->IsDialogRoot())
+ if (pScChangeAction->IsDialogRoot())
{
- if(pScChangeAction->IsDialogParent())
- pParent=AppendChangeAction(pScChangeAction);
+ bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
+ if (pScChangeAction->IsDialogParent())
+ xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
else
- pParent=AppendFilteredAction(pScChangeAction,SC_CAS_VIRGIN);
+ xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
}
else
- pParent=nullptr;
+ xParent.reset();
bTheFlag=true;
break;
case SC_CAS_ACCEPTED:
- pParent=nullptr;
+ xParent.reset();
nAcceptCount++;
break;
case SC_CAS_REJECTED:
- pParent=nullptr;
+ xParent.reset();
nRejectCount++;
break;
}
- if(pParent!=nullptr && pScChangeAction->IsDialogParent())
+ if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
{
- if(!bFilterFlag)
- pParent->EnableChildrenOnDemand();
- else
- {
- bool bTestFlag = bHasFilterEntry;
- bHasFilterEntry = false;
- if(Expand(pChanges,pScChangeAction,pParent,!bTestFlag)&&!bTestFlag)
- pTheView->RemoveEntry(pParent);
- }
+ bool bTestFlag = bHasFilterEntry;
+ bHasFilterEntry = false;
+ if (Expand(pChanges,pScChangeAction,*xParent,!bTestFlag)&&!bTestFlag)
+ rTreeView.remove(*xParent);
}
}
@@ -1432,66 +1389,69 @@ void ScAcceptChgDlg::AppendChanges(const ScChangeTrack* pChanges,sal_uLong nStar
pTPView->EnableReject(bTheFlag);
pTPView->EnableRejectAll(bTheFlag);
- pTheView->SetUpdateMode(true);
- SetPointer(PointerStyle::Arrow);
+ rTreeView.thaw();
+ m_xDialog->set_busy_cursor(false);
}
}
void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction)
{
-
- pTheView->SetUpdateMode(false);
-
- SvTreeListEntry* pEntry=pTheView->GetCurEntry();
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.freeze();
ScRedlinData *pEntryData=nullptr;
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ if (rTreeView.get_cursor(xEntry.get()))
+ pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
- if(pEntry!=nullptr)
- pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
+ rTreeView.get_iter_first(*xEntry);
sal_uLong nAction=0;
- if(pEntryData!=nullptr)
+ if (pEntryData)
nAction=pEntryData->nActionNo;
- if(nAction>=nStartAction && nAction<=nEndAction)
- pTheView->SetCurEntry(pTheView->GetModel()->GetEntry(0));
+ if (nAction>=nStartAction && nAction<=nEndAction)
+ rTreeView.set_cursor(*xEntry);
+ std::vector<OUString> aIdsToRemove;
- // MUST do it backwards, don't delete parents before children and GPF
- pEntry=pTheView->Last();
- while(pEntry!=nullptr)
+ do
{
- bool bRemove = false;
- pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
- if(pEntryData!=nullptr)
+ OUString sId(rTreeView.get_id(*xEntry));
+ pEntryData = reinterpret_cast<ScRedlinData *>(sId.toInt64());
+ if (pEntryData)
{
- nAction=pEntryData->nActionNo;
-
- if(nStartAction<=nAction && nAction<=nEndAction) bRemove=true;
-
+ nAction = pEntryData->nActionNo;
+ if (nStartAction <= nAction && nAction <= nEndAction)
+ aIdsToRemove.push_back(sId);
}
- SvTreeListEntry* pPrevEntry = pTheView->Prev(pEntry);
-
- if(bRemove)
- pTheView->RemoveEntry(pEntry);
-
- pEntry=pPrevEntry;
}
- pTheView->SetUpdateMode(true);
+ while (rTreeView.iter_next(*xEntry));
+
+ // MUST do it backwards, don't delete parents before children and GPF
+ for (auto it = aIdsToRemove.rbegin(); it != aIdsToRemove.rend(); ++it)
+ rTreeView.remove_id(*it);
+ rTreeView.thaw();
}
void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nStartAction,sal_uLong nEndAction)
{
- pTheView->SetUpdateMode(false);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.freeze();
+
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ std::unique_ptr<weld::TreeIter> xLastEntry(rTreeView.make_iterator());
+ std::unique_ptr<weld::TreeIter> xNextEntry(rTreeView.make_iterator());
+
+ bool bEntry = rTreeView.get_iter_first(*xEntry);
+ bool bLastEntry = false;
- SvTreeListEntry* pEntry=pTheView->First();
- SvTreeListEntry* pLastEntry=nullptr;
- while(pEntry!=nullptr)
+ while (bEntry)
{
bool bRemove = false;
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
- if(pEntryData!=nullptr)
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ if (pEntryData)
{
ScChangeAction* pScChangeAction=
static_cast<ScChangeAction*>(pEntryData->pData);
@@ -1501,37 +1461,42 @@ void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nSt
if(nStartAction<=nAction && nAction<=nEndAction) bRemove=true;
}
- SvTreeListEntry* pNextEntry;
- if(bRemove)
+ bool bNextEntry;
+ if (bRemove)
{
- pTheView->RemoveEntry(pEntry);
+ rTreeView.remove(*xEntry);
- if(pLastEntry==nullptr) pLastEntry=pTheView->First();
- if(pLastEntry!=nullptr)
+ if (!bLastEntry)
+ bLastEntry = rTreeView.get_iter_first(*xLastEntry);
+ if (bLastEntry)
{
- pNextEntry=pTheView->Next(pLastEntry);
-
- if(pNextEntry==nullptr)
+ rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
+ bNextEntry = rTreeView.iter_next(*xNextEntry);
+ if (!bNextEntry)
{
- pNextEntry=pLastEntry;
- pLastEntry=nullptr;
+ rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
+ bLastEntry = false;
}
}
else
- pNextEntry=nullptr;
-
+ bNextEntry = false;
}
else
{
- pLastEntry = pEntry;
- pNextEntry = pTheView->Next(pEntry);
+ rTreeView.copy_iterator(*xEntry, *xLastEntry);
+ bLastEntry = true;
+
+ rTreeView.copy_iterator(*xEntry, *xNextEntry);
+ bNextEntry = rTreeView.iter_next(*xNextEntry);
}
- pEntry=pNextEntry;
+
+ rTreeView.copy_iterator(*xNextEntry, *xEntry);
+ bEntry = bNextEntry;
}
AppendChanges(pChgTrack,nStartAction,nEndAction);
- pTheView->SetUpdateMode(true);
+ rTreeView.thaw();
}
IMPL_LINK( ScAcceptChgDlg, ChgTrackModHdl, ScChangeTrack&, rChgTrack, void)
@@ -1569,10 +1534,11 @@ IMPL_LINK( ScAcceptChgDlg, ChgTrackModHdl, ScChangeTrack&, rChgTrack, void)
aMsgQueue.clear();
}
+
IMPL_LINK_NOARG(ScAcceptChgDlg, ReOpenTimerHdl, Timer *, void)
{
ScSimpleRefDlgWrapper::SetAutoReOpen(true);
- m_pAcceptChgCtr->ShowFilterPage();
+ m_xAcceptChgCtr->ShowFilterPage();
RefHandle(nullptr);
}
@@ -1582,14 +1548,13 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
bool bAcceptFlag = true;
bool bRejectFlag = true;
- bool bContMark = false;
pTabView->DoneBlockMode(); // clears old marking
- SvTreeListEntry* pEntry = pTheView->FirstSelected();
- while( pEntry )
- {
- ScRedlinData* pEntryData = static_cast<ScRedlinData*>(pEntry->GetUserData());
- if( pEntryData )
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ std::vector<const ScChangeAction*> aActions;
+ rTreeView.selected_foreach([&rTreeView, &bAcceptFlag, &bRejectFlag, &aActions](weld::TreeIter& rEntry){
+ ScRedlinData* pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ if (pEntryData)
{
bRejectFlag &= pEntryData->bIsRejectable;
bAcceptFlag &= pEntryData->bIsAcceptable;
@@ -1598,13 +1563,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
if( pScChangeAction && (pScChangeAction->GetType() != SC_CAT_DELETE_TABS) &&
(!pEntryData->bDisabled || pScChangeAction->IsVisible()) )
{
- const ScBigRange& rBigRange = pScChangeAction->GetBigRange();
- if( rBigRange.IsValid( pDoc ) && IsActive() )
- {
- bool bSetCursor = !pTheView->NextSelected( pEntry );
- pTabView->MarkRange( rBigRange.MakeRange(), bSetCursor, bContMark );
- bContMark = true;
- }
+ aActions.push_back(pScChangeAction);
}
}
else
@@ -1612,8 +1571,19 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
bAcceptFlag = false;
bRejectFlag = false;
}
+ return false;
+ });
- pEntry = pTheView->NextSelected( pEntry );
+ bool bContMark = false;
+ for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
+ {
+ const ScBigRange& rBigRange = aActions[i]->GetBigRange();
+ if (rBigRange.IsValid(pDoc) && m_xDialog->has_toplevel_focus())
+ {
+ bool bSetCursor = i == nCount - 1;
+ pTabView->MarkRange(rBigRange.MakeRange(), bSetCursor, bContMark);
+ bContMark = true;
+ }
}
ScChangeTrack* pChanges = pDoc->GetChangeTrack();
@@ -1622,83 +1592,58 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
pTPView->EnableReject( bRejectFlag && bEnable );
}
-IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
+IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
{
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
+ return false;
- const CommandEvent aCEvt(pTheView->GetCommandEvent());
-
- if(aCEvt.GetCommand()==CommandEventId::ContextMenu)
- {
- m_xPopup->SetMenuFlags(MenuFlags::HideDisabledEntries);
-
- SvTreeListEntry* pEntry=pTheView->GetCurEntry();
- if(pEntry!=nullptr)
- {
- pTheView->Select(pEntry);
- }
- else
- {
- m_xPopup->Deactivate();
- }
-
- const sal_uInt16 nSubSortId = m_xPopup->GetItemId("calcsort");
- PopupMenu *pSubMenu = m_xPopup->GetPopupMenu(nSubSortId);
- const sal_uInt16 nActionId = pSubMenu->GetItemId("calcaction");
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ bool bEntry = rTreeView.get_cursor(xEntry.get());
+ if (bEntry)
+ rTreeView.select(*xEntry);
- sal_uInt16 nSortedCol = pTheView->GetSortedCol();
- if (nSortedCol != 0xFFFF)
- pSubMenu->CheckItem(nActionId + nSortedCol);
+ int nSortedCol = rTreeView.get_sort_column();
+ for (sal_Int32 i = 0; i < 5; ++i)
+ m_xPopup->set_active(OString("calcsort") + OString::number(i), i == nSortedCol);
- const sal_uInt16 nEditId = m_xPopup->GetItemId("calcedit");
+ m_xPopup->set_sensitive("calcedit", false);
- m_xPopup->EnableItem(nEditId, false);
-
- if(pDoc->IsDocEditable() && pEntry!=nullptr)
+ if (pDoc->IsDocEditable() && bEntry)
+ {
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ if (pEntryData)
{
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
- if(pEntryData!=nullptr)
- {
- ScChangeAction* pScChangeAction=
- static_cast<ScChangeAction*>(pEntryData->pData);
- if (pScChangeAction!=nullptr && !pTheView->GetParent(pEntry))
- m_xPopup->EnableItem(nEditId);
- }
+ ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
+ if (pScChangeAction && !rTreeView.get_iter_depth(*xEntry))
+ m_xPopup->set_sensitive("calcedit", true);
}
+ }
- sal_uInt16 nCommand = m_xPopup->Execute(this, GetPointerPosPixel());
+ OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
- if(nCommand)
+ if (!sCommand.isEmpty())
+ {
+ if (sCommand == "calcedit")
{
- if (nCommand == nEditId)
+ if (bEntry)
{
- if(pEntry!=nullptr)
+ ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ if (pEntryData)
{
- ScRedlinData *pEntryData=static_cast<ScRedlinData *>(pEntry->GetUserData());
- if(pEntryData!=nullptr)
- {
- ScChangeAction* pScChangeAction=
- static_cast<ScChangeAction*>(pEntryData->pData);
-
- pViewData->GetDocShell()->ExecuteChangeCommentDialog(pScChangeAction, GetFrameWeld(), false);
- }
+ ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
+ pViewData->GetDocShell()->ExecuteChangeCommentDialog(pScChangeAction, m_xDialog.get(), false);
}
}
- else
- {
- bool bSortDir = pTheView->GetSortDirection();
- sal_uInt16 nDialogCol = nCommand - nActionId;
- if(nSortedCol==nDialogCol) bSortDir=!bSortDir;
- pTheView->SortByCol(nDialogCol,bSortDir);
- /*
- 0, sort by action
- 1, sort by position
- 2, sort by author
- 3, sort by date
- 4, sort by comment
- */
- }
+ }
+ else
+ {
+ int nDialogCol = sCommand.copy(8).toInt32();
+ pTheView->HeaderBarClick(nDialogCol);
}
}
+
+ return true;
}
namespace
@@ -1732,41 +1677,64 @@ namespace
}
}
-void ScAcceptChgDlg::Initialize(SfxChildWinInfo *pInfo)
+void ScAcceptChgDlg::Initialize(SfxChildWinInfo* pInfo)
{
OUString aStr;
if (pInfo && !pInfo->aExtraString.isEmpty())
aStr = lcl_StripAcceptChgDat(pInfo->aExtraString);
- SfxModelessDialog::Initialize(pInfo);
+ SfxModelessDialogController::Initialize(pInfo);
- if ( !aStr.isEmpty())
+ if (!aStr.isEmpty())
{
- sal_uInt16 nCount=static_cast<sal_uInt16>(aStr.toInt32());
-
- for(sal_uInt16 i=0;i<nCount;i++)
+ int nCount = aStr.toInt32();
+ if (nCount > 2)
{
- sal_Int32 n1 = aStr.indexOf(';');
- aStr = aStr.copy( n1+1 );
- pTheView->SetTab(i, static_cast<sal_uInt16>(aStr.toInt32()), MapUnit::MapPixel);
+ std::vector<int> aEndPos;
+
+ for (int i = 0; i < nCount; ++i)
+ {
+ sal_Int32 n1 = aStr.indexOf(';');
+ aStr = aStr.copy( n1+1 );
+ aEndPos.push_back(aStr.toInt32());
+ }
+
+ std::vector<int> aWidths;
+ for (int i = 1; i < nCount; ++i)
+ aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
+
+ // turn column end points back to column widths, ignoring the small
+ // value used for the the expander column
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.set_column_fixed_widths(aWidths);
}
}
}
void ScAcceptChgDlg::FillInfo(SfxChildWinInfo& rInfo) const
{
- SfxModelessDialog::FillInfo(rInfo);
+ SfxModelessDialogController::FillInfo(rInfo);
//remove any old one before adding a new one
lcl_StripAcceptChgDat(rInfo.aExtraString);
rInfo.aExtraString += "AcceptChgDat:(";
- sal_uInt16 nCount=pTheView->TabCount();
+ const int nTabCount = 5;
- rInfo.aExtraString += OUString::number(nCount);
+ rInfo.aExtraString += OUString::number(nTabCount);
rInfo.aExtraString += ";";
- for(sal_uInt16 i=0;i<nCount;i++)
+
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ std::vector<int> aWidths;
+ // turn column widths back into column end points for compatibility
+ // with how they used to be stored, including a small value for the
+ // expander column
+ aWidths.push_back(rTreeView.get_checkbox_column_width());
+ for (int i = 0; i < nTabCount - 1; ++i)
+ aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i));
+
+ for (auto a : aWidths)
{
- rInfo.aExtraString += OUString::number(pTheView->GetTab(i));
+ rInfo.aExtraString += OUString::number(a);
rInfo.aExtraString += ";";
}
rInfo.aExtraString += ")";
@@ -1775,77 +1743,55 @@ void ScAcceptChgDlg::FillInfo(SfxChildWinInfo& rInfo) const
#define CALC_DATE 3
#define CALC_POS 1
-IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, const SvSortData*, pSortData, sal_Int32 )
+int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeIter& rRight) const
{
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+
sal_Int32 nCompare = 0;
- SCCOL nSortCol= static_cast<SCCOL>(pTheView->GetSortedCol());
+ SCCOL nSortCol= rTreeView.get_sort_column();
- if(pSortData)
+ if (CALC_DATE == nSortCol)
{
- SvTreeListEntry* pLeft = const_cast<SvTreeListEntry*>(pSortData->pLeft );
- SvTreeListEntry* pRight = const_cast<SvTreeListEntry*>(pSortData->pRight );
-
- if(CALC_DATE==nSortCol)
+ RedlinData *pLeftData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rLeft).toInt64());
+ RedlinData *pRightData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRight).toInt64());
+ if (pLeftData && pRightData)
{
- RedlinData *pLeftData=static_cast<RedlinData *>(pLeft->GetUserData());
- RedlinData *pRightData=static_cast<RedlinData *>(pRight->GetUserData());
-
- if(pLeftData!=nullptr && pRightData!=nullptr)
- {
- if(pLeftData->aDateTime < pRightData->aDateTime)
- nCompare = -1;
- else if(pLeftData->aDateTime > pRightData->aDateTime)
- nCompare = 1;
- return nCompare;
- }
+ if(pLeftData->aDateTime < pRightData->aDateTime)
+ nCompare = -1;
+ else if(pLeftData->aDateTime > pRightData->aDateTime)
+ nCompare = 1;
+ return nCompare;
}
- else if(CALC_POS==nSortCol)
+ }
+ else if (CALC_POS == nSortCol)
+ {
+ ScRedlinData *pLeftData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rLeft).toInt64());
+ ScRedlinData *pRightData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rRight).toInt64());
+ if (pLeftData && pRightData)
{
- ScRedlinData *pLeftData=static_cast<ScRedlinData *>(pLeft->GetUserData());
- ScRedlinData *pRightData=static_cast<ScRedlinData *>(pRight->GetUserData());
+ nCompare = 1;
- if(pLeftData!=nullptr && pRightData!=nullptr)
+ if(pLeftData->nTable < pRightData->nTable)
+ nCompare = -1;
+ else if(pLeftData->nTable == pRightData->nTable)
{
- nCompare = 1;
-
- if(pLeftData->nTable < pRightData->nTable)
+ if(pLeftData->nRow < pRightData->nRow)
nCompare = -1;
- else if(pLeftData->nTable == pRightData->nTable)
+ else if(pLeftData->nRow == pRightData->nRow)
{
- if(pLeftData->nRow < pRightData->nRow)
+ if(pLeftData->nCol < pRightData->nCol)
nCompare = -1;
- else if(pLeftData->nRow == pRightData->nRow)
- {
- if(pLeftData->nCol < pRightData->nCol)
- nCompare = -1;
- else if(pLeftData->nCol == pRightData->nCol)
- nCompare = 0;
- }
+ else if(pLeftData->nCol == pRightData->nCol)
+ nCompare = 0;
}
-
- return nCompare;
}
- }
-
- SvLBoxItem* pLeftItem = pTheView->GetEntryAtPos( pLeft, static_cast<sal_uInt16>(nSortCol));
- SvLBoxItem* pRightItem = pTheView->GetEntryAtPos( pRight, static_cast<sal_uInt16>(nSortCol));
- if(pLeftItem != nullptr && pRightItem != nullptr)
- {
- SvLBoxItemType nLeftKind = pLeftItem->GetType();
- SvLBoxItemType nRightKind = pRightItem->GetType();
-
- if (nRightKind == SvLBoxItemType::String &&
- nLeftKind == SvLBoxItemType::String)
- {
- nCompare = ScGlobal::GetCaseCollator()->compareString(
- static_cast<SvLBoxString*>(pLeftItem)->GetText(),
- static_cast<SvLBoxString*>(pRightItem)->GetText());
- }
+ return nCompare;
}
-
}
- return nCompare;
+
+ return ScGlobal::GetCaseCollator()->compareString(rTreeView.get_text(rLeft, nSortCol),
+ rTreeView.get_text(rRight, nSortCol));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 0f5286d4ddda..95e2a285c381 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -329,27 +329,24 @@ void ScConflictsResolver::HandleAction( ScChangeAction* pAction, bool bIsSharedA
// class ScConflictsDlg
-ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList )
- :ModalDialog( pParent, "ConflictsDialog", "modules/scalc/ui/conflictsdialog.ui" )
- ,m_pLbConflictsContainer ( get<SvSimpleTableContainer>("container") )
- ,m_pLbConflicts ( VclPtr<SvxRedlinTable>::Create(*m_pLbConflictsContainer) )
- ,maStrTitleConflict ( ScResId( STR_TITLE_CONFLICT ) )
- ,maStrUnknownUser ( ScResId( STR_UNKNOWN_USER_CONFLICT ) )
- ,mpViewData ( pViewData )
- ,mpOwnDoc ( nullptr )
- ,mpOwnTrack ( nullptr )
- ,mpSharedDoc ( pSharedDoc )
- ,mpSharedTrack ( nullptr )
- ,mrConflictsList ( rConflictsList )
- ,maSelectionIdle ( "ScConflictsDlg SelectionIdle" )
- ,mbInSelectHdl ( false )
- ,mbInDeselectHdl ( false )
+ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList)
+ : GenericDialogController(pParent, "modules/scalc/ui/conflictsdialog.ui", "ConflictsDialog")
+ , maStrTitleConflict ( ScResId( STR_TITLE_CONFLICT ) )
+ , maStrUnknownUser ( ScResId( STR_UNKNOWN_USER_CONFLICT ) )
+ , mpViewData ( pViewData )
+ , mpOwnDoc ( nullptr )
+ , mpOwnTrack ( nullptr )
+ , mpSharedDoc ( pSharedDoc )
+ , mpSharedTrack ( nullptr )
+ , mrConflictsList ( rConflictsList )
+ , maSelectionIdle ( "ScConflictsDlg SelectionIdle" )
+ , mbInSelectHdl ( false )
+ , m_xBtnKeepMine(m_xBuilder->weld_button("keepmine"))
+ , m_xBtnKeepOther(m_xBuilder->weld_button("keepother"))
+ , m_xBtnKeepAllMine(m_xBuilder->weld_button("keepallmine"))
+ , m_xBtnKeepAllOthers(m_xBuilder->weld_button("keepallothers"))
+ , m_xLbConflicts(new SvxRedlinTable(m_xBuilder->weld_tree_view("container"), nullptr))
{
- get(m_pBtnKeepMine, "keepmine");
- get(m_pBtnKeepOther, "keepother");
- get(m_pBtnKeepAllMine, "keepallmine");
- get(m_pBtnKeepAllOthers, "keepallothers");
-
OSL_ENSURE( mpViewData, "ScConflictsDlg CTOR: mpViewData is null!" );
mpOwnDoc = ( mpViewData ? mpViewData->GetDocument() : nullptr );
OSL_ENSURE( mpOwnDoc, "ScConflictsDlg CTOR: mpOwnDoc is null!" );
@@ -359,57 +356,36 @@ ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScD
mpSharedTrack = ( mpSharedDoc ? mpSharedDoc->GetChangeTrack() : nullptr );
OSL_ENSURE( mpSharedTrack, "ScConflictsDlg CTOR: mpSharedTrack is null!" );
- SetMinOutputSizePixel( GetSizePixel() );
-
- long const nTabs[] = { 10, 216, 266 };
- m_pLbConflicts->SetTabs( SAL_N_ELEMENTS(nTabs), nTabs );
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
- OUString aTab('\t');
- OUString aHeader( maStrTitleConflict );
- aHeader += aTab;
- aHeader += ScResId( STR_TITLE_AUTHOR );
- aHeader += aTab;
- aHeader += ScResId( STR_TITLE_DATE );
- m_pLbConflicts->InsertHeaderEntry( aHeader, HEADERBAR_APPEND, HeaderBarItemBits::LEFT | HeaderBarItemBits::LEFTIMAGE );
+ auto nDigitWidth = rTreeView.get_approximate_digit_width();
+ std::vector<int> aWidths;
+ aWidths.push_back(nDigitWidth * 60);
+ aWidths.push_back(nDigitWidth * 20);
+ rTreeView.set_column_fixed_widths(aWidths);
- m_pLbConflicts->SetStyle( m_pLbConflicts->GetStyle() | WB_HASLINES | WB_CLIPCHILDREN | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HSCROLL );
- m_pLbConflicts->SetSelectionMode( SelectionMode::Multiple );
- m_pLbConflicts->SetHighlightRange();
+ rTreeView.set_selection_mode(SelectionMode::Multiple);
+ rTreeView.set_size_request(-1, rTreeView.get_height_rows(16));
maSelectionIdle.SetInvokeHandler( LINK( this, ScConflictsDlg, UpdateSelectionHdl ) );
maSelectionIdle.SetDebugName( "ScConflictsDlg maSelectionIdle" );
- m_pLbConflicts->SetSelectHdl( LINK( this, ScConflictsDlg, SelectHandle ) );
- m_pLbConflicts->SetDeselectHdl( LINK( this, ScConflictsDlg, DeselectHandle ) );
+ rTreeView.connect_changed(LINK(this, ScConflictsDlg, SelectHandle));
- m_pBtnKeepMine->SetClickHdl( LINK( this, ScConflictsDlg, KeepMineHandle ) );
- m_pBtnKeepOther->SetClickHdl( LINK( this, ScConflictsDlg, KeepOtherHandle ) );
- m_pBtnKeepAllMine->SetClickHdl( LINK( this, ScConflictsDlg, KeepAllMineHandle ) );
- m_pBtnKeepAllOthers->SetClickHdl( LINK( this, ScConflictsDlg, KeepAllOthersHandle ) );
+ m_xBtnKeepMine->connect_clicked( LINK( this, ScConflictsDlg, KeepMineHandle ) );
+ m_xBtnKeepOther->connect_clicked( LINK( this, ScConflictsDlg, KeepOtherHandle ) );
+ m_xBtnKeepAllMine->connect_clicked( LINK( this, ScConflictsDlg, KeepAllMineHandle ) );
+ m_xBtnKeepAllOthers->connect_clicked( LINK( this, ScConflictsDlg, KeepAllOthersHandle ) );
UpdateView();
- SvTreeListEntry* pEntry = m_pLbConflicts->First();
- if ( pEntry != nullptr )
- {
- m_pLbConflicts->Select( pEntry );
- }
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ if (rTreeView.get_iter_first(*xEntry))
+ rTreeView.select(*xEntry);
}
ScConflictsDlg::~ScConflictsDlg()
{
- disposeOnce();
-}
-
-void ScConflictsDlg::dispose()
-{
- m_pLbConflictsContainer.clear();
- m_pLbConflicts.disposeAndClear();
- m_pBtnKeepMine.clear();
- m_pBtnKeepOther.clear();
- m_pBtnKeepAllMine.clear();
- m_pBtnKeepAllOthers.clear();
- ModalDialog::dispose();
}
OUString ScConflictsDlg::GetConflictString( const ScConflictsListEntry& rConflictEntry )
@@ -427,97 +403,72 @@ OUString ScConflictsDlg::GetConflictString( const ScConflictsListEntry& rConflic
return aString;
}
-OUString ScConflictsDlg::GetActionString( const ScChangeAction* pAction, ScDocument* pDoc )
+void ScConflictsDlg::SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, weld::TreeIter& rEntry)
{
- OUString aString;
-
OSL_ENSURE( pAction, "ScConflictsDlg::GetActionString(): pAction is null!" );
OSL_ENSURE( pDoc, "ScConflictsDlg::GetActionString(): pDoc is null!" );
- if ( pAction && pDoc )
+ if (pAction && pDoc)
{
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
OUString aDesc;
pAction->GetDescription(aDesc, pDoc, true, false);
- aString += aDesc;
- aString += "\t";
+ rTreeView.set_text(rEntry, aDesc, 0);
OUString aUser = comphelper::string::strip(pAction->GetUser(), ' ');
if ( aUser.isEmpty() )
{
aUser = maStrUnknownUser;
}
- aString += aUser;
- aString += "\t";
+ rTreeView.set_text(rEntry, aUser, 1);
DateTime aDateTime = pAction->GetDateTime();
- aString += ScGlobal::pLocaleData->getDate( aDateTime );
+ OUString aString = ScGlobal::pLocaleData->getDate( aDateTime );
aString += " ";
aString += ScGlobal::pLocaleData->getTime( aDateTime, false );
- aString += "\t";
+ rTreeView.set_text(rEntry, aString, 2);
}
-
- return aString;
}
-void ScConflictsDlg::HandleListBoxSelection( bool bSelectHandle )
+void ScConflictsDlg::HandleListBoxSelection()
{
- SvTreeListEntry* pSelEntry = m_pLbConflicts->GetCurEntry();
- if ( !pSelEntry )
- {
- pSelEntry = m_pLbConflicts->FirstSelected();
- }
- if ( !pSelEntry )
- {
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ bool bSelEntry = rTreeView.get_cursor(xEntry.get());
+ if (!bSelEntry)
+ bSelEntry = rTreeView.get_selected(xEntry.get());
+ if (!bSelEntry)
return;
- }
- SvTreeListEntry* pRootEntry = m_pLbConflicts->GetRootLevelParent( pSelEntry );
- if ( pRootEntry )
+ bool bSelectHandle = rTreeView.is_selected(*xEntry);
+
+ while (rTreeView.get_iter_depth(*xEntry))
+ rTreeView.iter_parent(*xEntry);
+
+ if (bSelectHandle)
+ rTreeView.unselect_all();
+ if (!rTreeView.is_selected(*xEntry))
+ rTreeView.select(*xEntry);
+ if (rTreeView.iter_children(*xEntry))
{
- if ( bSelectHandle )
- {
- m_pLbConflicts->SelectAll( false );
- }
- if ( !m_pLbConflicts->IsSelected( pRootEntry ) )
+ do
{
- m_pLbConflicts->Select( pRootEntry );
- }
- SvTreeListEntry* pEntry = m_pLbConflicts->FirstChild( pRootEntry );
- while ( pEntry )
- {
- if ( !m_pLbConflicts->IsSelected( pEntry ) )
- {
- m_pLbConflicts->Select( pEntry );
- }
- pEntry = pEntry->NextSibling();
- }
+ if (!rTreeView.is_selected(*xEntry))
+ rTreeView.select(*xEntry);
+ } while (rTreeView.iter_next_sibling(*xEntry));
}
}
-IMPL_LINK_NOARG(ScConflictsDlg, SelectHandle, SvTreeListBox*, void)
+IMPL_LINK_NOARG(ScConflictsDlg, SelectHandle, weld::TreeView&, void)
{
- if ( mbInSelectHdl || mbInDeselectHdl )
- {
+ if (mbInSelectHdl)
return;
- }
mbInSelectHdl = true;
- HandleListBoxSelection( true );
+ HandleListBoxSelection();
maSelectionIdle.Start();
mbInSelectHdl = false;
}
-IMPL_LINK_NOARG(ScConflictsDlg, DeselectHandle, SvTreeListBox*, void)
-{
- if ( mbInDeselectHdl || mbInSelectHdl )
- {
- return;
- }
-
- mbInDeselectHdl = true;
- HandleListBoxSelection( false );
- mbInDeselectHdl = false;
-}
-
IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void)
{
if ( !mpViewData || !mpOwnDoc )
@@ -527,36 +478,44 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void)
ScTabView* pTabView = mpViewData->GetView();
pTabView->DoneBlockMode();
- bool bContMark = false;
- SvTreeListEntry* pEntry = m_pLbConflicts->FirstSelected();
- while ( pEntry )
- {
- if ( pEntry != m_pLbConflicts->GetRootLevelParent( pEntry ) )
+
+ std::vector<const ScChangeAction*> aActions;
+
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
+ rTreeView.selected_foreach([&rTreeView, &aActions](weld::TreeIter& rEntry){
+ if (rTreeView.get_iter_depth(rEntry))
{
- RedlinData* pUserData = static_cast< RedlinData* >( pEntry->GetUserData() );
- if ( pUserData )
+ RedlinData* pUserData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ if (pUserData)
{
ScChangeAction* pAction = static_cast< ScChangeAction* >( pUserData->pData );
if ( pAction && ( pAction->GetType() != SC_CAT_DELETE_TABS ) &&
( pAction->IsClickable() || pAction->IsVisible() ) )
{
- const ScBigRange& rBigRange = static_cast< const ScChangeAction* >( pAction )->GetBigRange();
- if ( rBigRange.IsValid( mpOwnDoc ) )
- {
- bool bSetCursor = !m_pLbConflicts->NextSelected( pEntry );
- pTabView->MarkRange( rBigRange.MakeRange(), bSetCursor, bContMark );
- bContMark = true;
- }
+ aActions.push_back(pAction);
}
}
}
- pEntry = m_pLbConflicts->NextSelected( pEntry );
+ return false;
+ });
+
+ bool bContMark = false;
+ for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
+ {
+ const ScBigRange& rBigRange = aActions[i]->GetBigRange();
+ if (rBigRange.IsValid(mpOwnDoc))
+ {
+ bool bSetCursor = i == nCount - 1;
+ pTabView->MarkRange(rBigRange.MakeRange(), bSetCursor, bContMark);
+ bContMark = true;
+ }
}
}
-void ScConflictsDlg::SetConflictAction( const SvTreeListEntry* pRootEntry, ScConflictAction eConflictAction )
+void ScConflictsDlg::SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction)
{
- RedlinData* pUserData = static_cast< RedlinData* >( pRootEntry ? pRootEntry->GetUserData() : nullptr );
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
+ RedlinData* pUserData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRootEntry).toInt64());
ScConflictsListEntry* pConflictEntry = static_cast< ScConflictsListEntry* >( pUserData ? pUserData->pData : nullptr );
if ( pConflictEntry )
{
@@ -564,76 +523,86 @@ void ScConflictsDlg::SetConflictAction( const SvTreeListEntry* pRootEntry, ScCon
}
}
-void ScConflictsDlg::KeepHandler( bool bMine )
+void ScConflictsDlg::KeepHandler(bool bMine)
{
- SvTreeListEntry* pEntry = m_pLbConflicts->FirstSelected();
- SvTreeListEntry* pRootEntry = ( pEntry ? m_pLbConflicts->GetRootLevelParent( pEntry ) : nullptr );
- if ( !pRootEntry )
- {
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ if (!rTreeView.get_selected(xEntry.get()))
return;
- }
- SetPointer( PointerStyle::Wait );
+
+ while (rTreeView.get_iter_depth(*xEntry))
+ rTreeView.iter_parent(*xEntry);
+
+ m_xDialog->set_busy_cursor(true);
ScConflictAction eConflictAction = ( bMine ? SC_CONFLICT_ACTION_KEEP_MINE : SC_CONFLICT_ACTION_KEEP_OTHER );
- SetConflictAction( pRootEntry, eConflictAction );
- m_pLbConflicts->RemoveEntry( pRootEntry );
- SetPointer( PointerStyle::Arrow );
- if ( m_pLbConflicts->GetEntryCount() == 0 )
- {
- EndDialog( RET_OK );
- }
+ SetConflictAction(*xEntry, eConflictAction);
+ rTreeView.remove(*xEntry);
+ m_xDialog->set_busy_cursor(false);
+ if (rTreeView.n_children() == 0)
+ m_xDialog->response(RET_OK);
}
void ScConflictsDlg::KeepAllHandler( bool bMine )
{
- SvTreeListEntry* pEntry = m_pLbConflicts->First();
- SvTreeListEntry* pRootEntry = ( pEntry ? m_pLbConflicts->GetRootLevelParent( pEntry ) : nullptr );
- if ( !pRootEntry )
- {
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ if (!rTreeView.get_iter_first(*xEntry))
return;
- }
- SetPointer( PointerStyle::Wait );
+
+ while (rTreeView.get_iter_depth(*xEntry))
+ rTreeView.iter_parent(*xEntry);
+
+ m_xDialog->set_busy_cursor(true);
+
ScConflictAction eConflictAction = ( bMine ? SC_CONFLICT_ACTION_KEEP_MINE : SC_CONFLICT_ACTION_KEEP_OTHER );
- while ( pRootEntry )
+ do
{
- SetConflictAction( pRootEntry, eConflictAction );
- pRootEntry = pRootEntry->NextSibling();
- }
- m_pLbConflicts->SetUpdateMode( false );
- m_pLbConflicts->Clear();
- m_pLbConflicts->SetUpdateMode( true );
- SetPointer( PointerStyle::Arrow );
- EndDialog( RET_OK );
+ SetConflictAction(*xEntry, eConflictAction);
+ } while (rTreeView.iter_next_sibling(*xEntry));
+
+ rTreeView.freeze();
+ rTreeView.clear();
+ rTreeView.thaw();
+
+ m_xDialog->set_busy_cursor(false);
+
+ m_xDialog->response(RET_OK);
}
-IMPL_LINK_NOARG(ScConflictsDlg, KeepMineHandle, Button*, void)
+IMPL_LINK_NOARG(ScConflictsDlg, KeepMineHandle, weld::Button&, void)
{
KeepHandler( true );
}
-IMPL_LINK_NOARG(ScConflictsDlg, KeepOtherHandle, Button*, void)
+IMPL_LINK_NOARG(ScConflictsDlg, KeepOtherHandle, weld::Button&, void)
{
KeepHandler( false );
}
-IMPL_LINK_NOARG(ScConflictsDlg, KeepAllMineHandle, Button*, void)
+IMPL_LINK_NOARG(ScConflictsDlg, KeepAllMineHandle, weld::Button&, void)
{
KeepAllHandler( true );
}
-IMPL_LINK_NOARG(ScConflictsDlg, KeepAllOthersHandle, Button*, void)
+IMPL_LINK_NOARG(ScConflictsDlg, KeepAllOthersHandle, weld::Button&, void)
{
KeepAllHandler( false );
}
void ScConflictsDlg::UpdateView()
{
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
for ( ScConflictsListEntry& rConflictEntry : mrConflictsList )
{
if (rConflictEntry.meConflictAction == SC_CONFLICT_ACTION_NONE)
{
std::unique_ptr<RedlinData> pRootUserData(new RedlinData());
pRootUserData->pData = static_cast<void*>(&rConflictEntry);
- SvTreeListEntry* pRootEntry = m_pLbConflicts->InsertEntry( GetConflictString( rConflictEntry ), std::move(pRootUserData) );
+ OUString sString(GetConflictString(rConflictEntry));
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pRootUserData.release())));
+ std::unique_ptr<weld::TreeIter> xRootEntry(rTreeView.make_iterator());
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, nullptr, false, xRootEntry.get());
for ( auto& aSharedAction : rConflictEntry.maSharedActions )
{
@@ -650,8 +619,8 @@ void ScConflictsDlg::UpdateView()
}
}
- OUString aString( GetActionString( pAction, mpSharedDoc ) );
- m_pLbConflicts->InsertEntry( aString, std::unique_ptr<RedlinData>(), pRootEntry );
+ rTreeView.insert(xRootEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, nullptr, false, xEntry.get());
+ SetActionString(pAction, mpSharedDoc, *xEntry);
}
}
@@ -670,14 +639,15 @@ void ScConflictsDlg::UpdateView()
}
}
- OUString aString( GetActionString( pAction, mpOwnDoc ) );
std::unique_ptr<RedlinData> pUserData(new RedlinData());
pUserData->pData = static_cast< void* >( pAction );
- m_pLbConflicts->InsertEntry( aString, std::move(pUserData), pRootEntry );
+ OUString aId(OUString::number(reinterpret_cast<sal_Int64>(pUserData.release())));
+ rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, nullptr, false, xEntry.get());
+ SetActionString(pAction, mpOwnDoc, *xEntry);
}
}
- m_pLbConflicts->Expand( pRootEntry );
+ rTreeView.expand_row(*xRootEntry);
}
}
}
diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx
index c59dfc73012a..b75201ce8f63 100644
--- a/sc/source/ui/miscdlgs/highred.cxx
+++ b/sc/source/ui/miscdlgs/highred.cxx
@@ -28,29 +28,28 @@
// class ScHighlightChgDlg
-ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
- ScViewData* ptrViewData)
- : ScAnyRefDlg(pB, pCW, pParent, "ShowChangesDialog",
- "modules/scalc/ui/showchangesdialog.ui")
+ScHighlightChgDlg::ScHighlightChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
+ ScViewData* ptrViewData)
+ : ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/showchangesdialog.ui", "ShowChangesDialog")
, pViewData(ptrViewData)
, pDoc(ptrViewData->GetDocument())
+ , m_xHighlightBox(m_xBuilder->weld_check_button("showchanges"))
+ , m_xCbAccept(m_xBuilder->weld_check_button("showaccepted"))
+ , m_xCbReject(m_xBuilder->weld_check_button("showrejected"))
+ , m_xOkButton(m_xBuilder->weld_button("ok"))
+ , m_xEdAssign(new formula::WeldRefEdit(m_xBuilder->weld_entry("range")))
+ , m_xRbAssign(new formula::WeldRefButton(m_xBuilder->weld_button("rangeref")))
+ , m_xBox(m_xBuilder->weld_container("box"))
+ , m_xFilterCtr(new SvxTPFilter(m_xBox.get()))
{
- m_pFilterCtr = VclPtr<SvxTPFilter>::Create(get<VclContainer>("box"));
- get(m_pHighlightBox, "showchanges");
- get(m_pCbAccept, "showaccepted");
- get(m_pCbReject, "showrejected");
- get(m_pEdAssign, "range");
- m_pEdAssign->SetReferences(this, m_pFilterCtr->get<vcl::Window>("range"));
- m_pEdAssign->SetSizePixel(m_pEdAssign->get_preferred_size());
- get(m_pRbAssign, "rangeref");
- m_pRbAssign->SetReferences(this, m_pEdAssign);
- get(m_pOkButton, "ok");
-
- m_pOkButton->SetClickHdl(LINK( this, ScHighlightChgDlg, OKBtnHdl));
- m_pHighlightBox->SetClickHdl(LINK( this, ScHighlightChgDlg, HighlightHandle ));
- m_pFilterCtr->SetRefHdl(LINK( this, ScHighlightChgDlg, RefHandle ));
- m_pFilterCtr->HideRange(false);
- m_pFilterCtr->Show();
+ m_xEdAssign->SetReferences(this, nullptr);
+ m_xRbAssign->SetReferences(this, m_xEdAssign.get());
+
+ m_xOkButton->connect_clicked(LINK( this, ScHighlightChgDlg, OKBtnHdl));
+ m_xHighlightBox->connect_clicked(LINK( this, ScHighlightChgDlg, HighlightHandle ));
+ m_xFilterCtr->SetRefHdl(LINK( this, ScHighlightChgDlg, RefHandle ));
+ m_xFilterCtr->HideRange(false);
+ m_xFilterCtr->Show();
SetDispatcherLock( true );
Init();
@@ -58,20 +57,7 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl:
ScHighlightChgDlg::~ScHighlightChgDlg()
{
- disposeOnce();
-}
-
-void ScHighlightChgDlg::dispose()
-{
SetDispatcherLock( false );
- m_pFilterCtr.disposeAndClear();
- m_pHighlightBox.clear();
- m_pCbAccept.clear();
- m_pCbReject.clear();
- m_pOkButton.clear();
- m_pEdAssign.clear();
- m_pRbAssign.clear();
- ScAnyRefDlg::dispose();
}
void ScHighlightChgDlg::Init()
@@ -82,81 +68,92 @@ void ScHighlightChgDlg::Init()
if(pChanges!=nullptr)
{
aChangeViewSet.SetTheAuthorToShow(pChanges->GetUser());
- m_pFilterCtr->ClearAuthors();
+ m_xFilterCtr->ClearAuthors();
const std::set<OUString>& rUserColl = pChanges->GetUserCollection();
for (const auto& rItem : rUserColl)
- m_pFilterCtr->InsertAuthor(rItem);
+ m_xFilterCtr->InsertAuthor(rItem);
}
ScChangeViewSettings* pViewSettings=pDoc->GetChangeViewSettings();
if(pViewSettings!=nullptr)
aChangeViewSet=*pViewSettings;
- m_pHighlightBox->Check(aChangeViewSet.ShowChanges());
- m_pFilterCtr->CheckDate(aChangeViewSet.HasDate());
- m_pFilterCtr->SetFirstDate(aChangeViewSet.GetTheFirstDateTime());
- m_pFilterCtr->SetFirstTime(aChangeViewSet.GetTheFirstDateTime());
- m_pFilterCtr->SetLastDate(aChangeViewSet.GetTheLastDateTime());
- m_pFilterCtr->SetLastTime(aChangeViewSet.GetTheLastDateTime());
- m_pFilterCtr->SetDateMode(static_cast<sal_uInt16>(aChangeViewSet.GetTheDateMode()));
- m_pFilterCtr->CheckAuthor(aChangeViewSet.HasAuthor());
- m_pFilterCtr->CheckComment(aChangeViewSet.HasComment());
- m_pFilterCtr->SetComment(aChangeViewSet.GetTheComment());
-
- m_pCbAccept->Check(aChangeViewSet.IsShowAccepted());
- m_pCbReject->Check(aChangeViewSet.IsShowRejected());
+ m_xHighlightBox->set_active(aChangeViewSet.ShowChanges());
+ m_xFilterCtr->CheckDate(aChangeViewSet.HasDate());
+
+ DateTime aEmpty(DateTime::EMPTY);
+
+ DateTime aDateTime(aChangeViewSet.GetTheFirstDateTime());
+ if (aDateTime != aEmpty)
+ {
+ m_xFilterCtr->SetFirstDate(aDateTime);
+ m_xFilterCtr->SetFirstTime(aDateTime);
+ }
+ aDateTime = aChangeViewSet.GetTheLastDateTime();
+ if (aDateTime != aEmpty)
+ {
+ m_xFilterCtr->SetLastDate(aDateTime);
+ m_xFilterCtr->SetLastTime(aDateTime);
+ }
+
+ m_xFilterCtr->SetDateMode(static_cast<sal_uInt16>(aChangeViewSet.GetTheDateMode()));
+ m_xFilterCtr->CheckAuthor(aChangeViewSet.HasAuthor());
+ m_xFilterCtr->CheckComment(aChangeViewSet.HasComment());
+ m_xFilterCtr->SetComment(aChangeViewSet.GetTheComment());
+
+ m_xCbAccept->set_active(aChangeViewSet.IsShowAccepted());
+ m_xCbReject->set_active(aChangeViewSet.IsShowRejected());
OUString aString=aChangeViewSet.GetTheAuthorToShow();
if(!aString.isEmpty())
{
- m_pFilterCtr->SelectAuthor(aString);
+ m_xFilterCtr->SelectAuthor(aString);
}
else
{
- m_pFilterCtr->SelectedAuthorPos(0);
+ m_xFilterCtr->SelectedAuthorPos(0);
}
- m_pFilterCtr->CheckRange(aChangeViewSet.HasRange());
+ m_xFilterCtr->CheckRange(aChangeViewSet.HasRange());
if ( !aChangeViewSet.GetTheRangeList().empty() )
{
const ScRange & rRangeEntry = aChangeViewSet.GetTheRangeList().front();
OUString aRefStr(rRangeEntry.Format(ScRefFlags::RANGE_ABS_3D, pDoc));
- m_pFilterCtr->SetRange(aRefStr);
+ m_xFilterCtr->SetRange(aRefStr);
}
- m_pFilterCtr->Enable();
- HighlightHandle(m_pHighlightBox);
+ m_xFilterCtr->Enable(true);
+ HighlightHandle(*m_xHighlightBox);
}
// Set the reference to a cell range selected with the mouse. This is then
// shown as the new selection in the reference field.
-
void ScHighlightChgDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
- if ( m_pEdAssign->IsVisible() )
+ if (m_xEdAssign->GetWidget()->get_visible())
{
if ( rRef.aStart != rRef.aEnd )
- RefInputStart(m_pEdAssign);
+ RefInputStart(m_xEdAssign.get());
OUString aRefStr(rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP, pDocP->GetAddressConvention()));
- m_pEdAssign->SetRefString( aRefStr );
- m_pFilterCtr->SetRange(aRefStr);
+ m_xEdAssign->SetRefString( aRefStr );
+ m_xFilterCtr->SetRange(aRefStr);
}
}
-bool ScHighlightChgDlg::Close()
+void ScHighlightChgDlg::Close()
{
- return DoClose( ScHighlightChgDlgWrapper::GetChildWindowId() );
+ DoClose( ScHighlightChgDlgWrapper::GetChildWindowId() );
}
void ScHighlightChgDlg::RefInputDone( bool bForced)
{
- ScAnyRefDlg::RefInputDone(bForced);
- if(bForced || !m_pRbAssign->IsVisible())
+ ScAnyRefDlgController::RefInputDone(bForced);
+ if (bForced || !m_xRbAssign->GetWidget()->get_visible())
{
- m_pFilterCtr->SetRange(m_pEdAssign->GetText());
- m_pFilterCtr->SetFocusToRange();
- m_pEdAssign->Hide();
- m_pRbAssign->Hide();
+ m_xFilterCtr->SetRange(m_xEdAssign->GetText());
+ m_xFilterCtr->SetFocusToRange();
+ m_xEdAssign->GetWidget()->hide();
+ m_xRbAssign->GetWidget()->hide();
}
}
@@ -166,25 +163,22 @@ void ScHighlightChgDlg::SetActive()
bool ScHighlightChgDlg::IsRefInputMode() const
{
- return m_pEdAssign->IsVisible();
+ return m_xEdAssign->GetWidget()->get_visible();
}
-IMPL_LINK( ScHighlightChgDlg, HighlightHandle, Button*, pCb, void )
+IMPL_LINK_NOARG(ScHighlightChgDlg, HighlightHandle, weld::Button&, void)
{
- if(pCb!=nullptr)
+ if (m_xHighlightBox->get_active())
+ {
+ m_xFilterCtr->Enable(true);
+ m_xCbAccept->set_sensitive(true);
+ m_xCbReject->set_sensitive(true);
+ }
+ else
{
- if(m_pHighlightBox->IsChecked())
- {
- m_pFilterCtr->Enable();
- m_pCbAccept->Enable();
- m_pCbReject->Enable();
- }
- else
- {
- m_pFilterCtr->Disable();
- m_pCbAccept->Disable();
- m_pCbReject->Disable();
- }
+ m_xFilterCtr->Enable(false);
+ m_xCbAccept->set_sensitive(false);
+ m_xCbReject->set_sensitive(false);
}
}
@@ -193,43 +187,40 @@ IMPL_LINK( ScHighlightChgDlg, RefHandle, SvxTPFilter*, pRef, void )
if(pRef!=nullptr)
{
SetDispatcherLock( true );
- m_pEdAssign->Show();
- m_pRbAssign->Show();
- m_pEdAssign->SetText(m_pFilterCtr->GetRange());
- m_pEdAssign->GrabFocus();
- ScAnyRefDlg::RefInputStart(m_pEdAssign, m_pRbAssign);
+ m_xEdAssign->GetWidget()->show();
+ m_xRbAssign->GetWidget()->show();
+ m_xEdAssign->SetText(m_xFilterCtr->GetRange());
+ m_xEdAssign->GrabFocus();
+ ScAnyRefDlgController::RefInputStart(m_xEdAssign.get(), m_xRbAssign.get());
}
}
-IMPL_LINK( ScHighlightChgDlg, OKBtnHdl, Button*, pOKBtn, void )
+IMPL_LINK_NOARG(ScHighlightChgDlg, OKBtnHdl, weld::Button&, void)
{
- if (pOKBtn == m_pOkButton)
- {
- aChangeViewSet.SetShowChanges(m_pHighlightBox->IsChecked());
- aChangeViewSet.SetHasDate(m_pFilterCtr->IsDate());
- SvxRedlinDateMode eMode = m_pFilterCtr->GetDateMode();
- aChangeViewSet.SetTheDateMode( eMode );
- Date aFirstDate( m_pFilterCtr->GetFirstDate() );
- tools::Time aFirstTime( m_pFilterCtr->GetFirstTime() );
- Date aLastDate( m_pFilterCtr->GetLastDate() );
- tools::Time aLastTime( m_pFilterCtr->GetLastTime() );
- aChangeViewSet.SetTheFirstDateTime( DateTime( aFirstDate, aFirstTime ) );
- aChangeViewSet.SetTheLastDateTime( DateTime( aLastDate, aLastTime ) );
- aChangeViewSet.SetHasAuthor(m_pFilterCtr->IsAuthor());
- aChangeViewSet.SetTheAuthorToShow(m_pFilterCtr->GetSelectedAuthor());
- aChangeViewSet.SetHasRange(m_pFilterCtr->IsRange());
- aChangeViewSet.SetShowAccepted(m_pCbAccept->IsChecked());
- aChangeViewSet.SetShowRejected(m_pCbReject->IsChecked());
- aChangeViewSet.SetHasComment(m_pFilterCtr->IsComment());
- aChangeViewSet.SetTheComment(m_pFilterCtr->GetComment());
- ScRangeList aLocalRangeList;
- aLocalRangeList.Parse(m_pFilterCtr->GetRange(), pDoc);
- aChangeViewSet.SetTheRangeList(aLocalRangeList);
- aChangeViewSet.AdjustDateMode( *pDoc );
- pDoc->SetChangeViewSettings(aChangeViewSet);
- pViewData->GetDocShell()->PostPaintGridAll();
- Close();
- }
+ aChangeViewSet.SetShowChanges(m_xHighlightBox->get_active());
+ aChangeViewSet.SetHasDate(m_xFilterCtr->IsDate());
+ SvxRedlinDateMode eMode = m_xFilterCtr->GetDateMode();
+ aChangeViewSet.SetTheDateMode( eMode );
+ Date aFirstDate( m_xFilterCtr->GetFirstDate() );
+ tools::Time aFirstTime( m_xFilterCtr->GetFirstTime() );
+ Date aLastDate( m_xFilterCtr->GetLastDate() );
+ tools::Time aLastTime( m_xFilterCtr->GetLastTime() );
+ aChangeViewSet.SetTheFirstDateTime( DateTime( aFirstDate, aFirstTime ) );
+ aChangeViewSet.SetTheLastDateTime( DateTime( aLastDate, aLastTime ) );
+ aChangeViewSet.SetHasAuthor(m_xFilterCtr->IsAuthor());
+ aChangeViewSet.SetTheAuthorToShow(m_xFilterCtr->GetSelectedAuthor());
+ aChangeViewSet.SetHasRange(m_xFilterCtr->IsRange());
+ aChangeViewSet.SetShowAccepted(m_xCbAccept->get_active());
+ aChangeViewSet.SetShowRejected(m_xCbReject->get_active());
+ aChangeViewSet.SetHasComment(m_xFilterCtr->IsComment());
+ aChangeViewSet.SetTheComment(m_xFilterCtr->GetComment());
+ ScRangeList aLocalRangeList;
+ aLocalRangeList.Parse(m_xFilterCtr->GetRange(), pDoc);
+ aChangeViewSet.SetTheRangeList(aLocalRangeList);
+ aChangeViewSet.AdjustDateMode( *pDoc );
+ pDoc->SetChangeViewSettings(aChangeViewSet);
+ pViewData->GetDocShell()->PostPaintGridAll();
+ response(RET_OK);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/simpref.cxx b/sc/source/ui/miscdlgs/simpref.cxx
index 6260b51bdfb3..0f39e4cc6073 100644
--- a/sc/source/ui/miscdlgs/simpref.cxx
+++ b/sc/source/ui/miscdlgs/simpref.cxx
@@ -23,6 +23,7 @@
ScSimpleRefDlg::ScSimpleRefDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent)
: ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/simplerefdialog.ui", "SimpleRefDialog")
+ , bAutoReOpen(true)
, bCloseOnButtonUp(false)
, bSingleCell(false)
, bMultiSelection(false)
@@ -45,6 +46,12 @@ ScSimpleRefDlg::~ScSimpleRefDlg()
SetDispatcherLock( false ); // deactivate modal mode
}
+void ScSimpleRefDlg::FillInfo(SfxChildWinInfo& rWinInfo) const
+{
+ ScAnyRefDlgController::FillInfo(rWinInfo);
+ rWinInfo.bVisible = bAutoReOpen;
+}
+
void ScSimpleRefDlg::SetRefString(const OUString &rStr)
{
m_xEdAssign->SetText(rStr);
@@ -158,6 +165,7 @@ void ScSimpleRefDlg::RefInputDone( bool bForced)
IMPL_LINK_NOARG(ScSimpleRefDlg, OkBtnHdl, weld::Button&, void)
{
+ bAutoReOpen = false;
OUString aResult=m_xEdAssign->GetText();
aCloseHdl.Call(&aResult);
Link<const OUString&,void> aUnoLink = aDoneHdl; // stack var because this is deleted in DoClose
@@ -167,6 +175,7 @@ IMPL_LINK_NOARG(ScSimpleRefDlg, OkBtnHdl, weld::Button&, void)
IMPL_LINK_NOARG(ScSimpleRefDlg, CancelBtnHdl, weld::Button&, void)
{
+ bAutoReOpen = false;
OUString aResult=m_xEdAssign->GetText();
aCloseHdl.Call(nullptr);
Link<const OUString&,void> aUnoLink = aAbortedHdl; // stack var because this is deleted in DoClose
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 88b19814d453..cb743915f43a 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -32,23 +32,23 @@
#include <scres.hrc>
#include <validate.hxx>
-SFX_IMPL_CHILDWINDOW_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
-SFX_IMPL_CHILDWINDOW_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
-SFX_IMPL_CHILDWINDOW_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
-SFX_IMPL_CHILDWINDOW_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
SFX_IMPL_MODELESSDIALOG_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
SFX_IMPL_MODELESSDIALOG_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
-SFX_IMPL_CHILDWINDOW_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
-SFX_IMPL_CHILDWINDOW_WITHID(ScFilterDlgWrapper, SID_FILTER )
-SFX_IMPL_CHILDWINDOW_WITHID(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
-SFX_IMPL_CHILDWINDOW_WITHID(ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
-SFX_IMPL_CHILDWINDOW_WITHID(ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE)
-SFX_IMPL_CHILDWINDOW_WITHID(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
-SFX_IMPL_CHILDWINDOW_WITHID(ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScFilterDlgWrapper, SID_FILTER )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
SFX_IMPL_MODELESSDIALOG_WITHID(ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
-SFX_IMPL_CHILDWINDOW_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatDlgWrapper, WID_CONDFRMT_REF )
SFX_IMPL_CHILDWINDOW_WITHID(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
@@ -256,24 +256,24 @@ void ScSimpleRefDlgWrapper::StartRefInput()
// ScAcceptChgDlgWrapper //FIXME: should be moved into ViewShell
-ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( vcl::Window* pParentP,
+ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(vcl::Window* pParentP,
sal_uInt16 nId,
SfxBindings* pBindings,
SfxChildWinInfo* pInfo ) :
SfxChildWindow( pParentP, nId )
{
- ScTabViewShell* pViewShell =
- dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
- OSL_ENSURE( pViewShell, "missing view shell :-(" );
- if (pViewShell)
- {
- SetWindow( VclPtr<ScAcceptChgDlg>::Create( pBindings, this, pParentP, &pViewShell->GetViewData() ) );
- static_cast<ScAcceptChgDlg*>(GetWindow())->Initialize( pInfo );
- }
- else
- SetWindow( nullptr );
- if (pViewShell && !GetWindow())
- pViewShell->GetViewFrame()->SetChildWindow( nId, false );
+ ScTabViewShell* pViewShell =
+ dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
+ OSL_ENSURE( pViewShell, "missing view shell :-(" );
+ if (pViewShell)
+ {
+ SetController(std::make_shared<ScAcceptChgDlg>(pBindings, this, pParentP->GetFrameWeld(), &pViewShell->GetViewData()));
+ static_cast<ScAcceptChgDlg*>(GetController().get())->Initialize( pInfo );
+ }
+ else
+ SetController( nullptr );
+ if (pViewShell && !GetController())
+ pViewShell->GetViewFrame()->SetChildWindow( nId, false );
}
void ScAcceptChgDlgWrapper::ReInitDlg()
@@ -282,15 +282,15 @@ void ScAcceptChgDlgWrapper::ReInitDlg()
dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
OSL_ENSURE( pViewShell, "missing view shell :-(" );
- if(GetWindow() && pViewShell)
+ if (GetController() && pViewShell)
{
- static_cast<ScAcceptChgDlg*>(GetWindow())->ReInit(&pViewShell->GetViewData());
+ static_cast<ScAcceptChgDlg*>(GetController().get())->ReInit(&pViewShell->GetViewData());
}
}
// ScHighlightChgDlgWrapper
-IMPL_CHILD_CTOR( ScHighlightChgDlgWrapper, FID_CHG_SHOW )
+IMPL_CONTROLLER_CHILD_CTOR(ScHighlightChgDlgWrapper, FID_CHG_SHOW)
namespace
{
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 4e94cabc67df..0eebfb583d2f 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -848,19 +848,19 @@ void ScTabView::RemoveHintWindow()
}
// find window that should not be over the cursor
-static vcl::Window* lcl_GetCareWin(SfxViewFrame* pViewFrm)
+static weld::Window* lcl_GetCareWin(SfxViewFrame* pViewFrm)
{
//! also spelling ??? (then set the member variables when calling)
// search & replace
- if ( pViewFrm->HasChildWindow(SID_SEARCH_DLG) )
+ if (pViewFrm->HasChildWindow(SID_SEARCH_DLG))
{
SfxChildWindow* pChild = pViewFrm->GetChildWindow(SID_SEARCH_DLG);
if (pChild)
{
- vcl::Window* pWin = pChild->GetWindow();
- if (pWin && pWin->IsVisible())
- return pWin;
+ auto xDlgController = pChild->GetController();
+ if (xDlgController && xDlgController->getDialog()->get_visible())
+ return xDlgController->getDialog();
}
}
@@ -870,9 +870,9 @@ static vcl::Window* lcl_GetCareWin(SfxViewFrame* pViewFrm)
SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_CHG_ACCEPT);
if (pChild)
{
- vcl::Window* pWin = pChild->GetWindow();
- if (pWin && pWin->IsVisible())
- return pWin;
+ auto xDlgController = pChild->GetController();
+ if (xDlgController && xDlgController->getDialog()->get_visible())
+ return xDlgController->getDialog();
}
}
@@ -940,16 +940,18 @@ void ScTabView::AlignToCursor( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode,
if ( eMode == SC_FOLLOW_JUMP )
{
- vcl::Window* pCare = lcl_GetCareWin( aViewData.GetViewShell()->GetViewFrame() );
+ weld::Window* pCare = lcl_GetCareWin( aViewData.GetViewShell()->GetViewFrame() );
if (pCare)
{
bool bLimit = false;
tools::Rectangle aDlgPixel;
Size aWinSize;
vcl::Window* pWin = GetActiveWin();
- if (pWin)
+ weld::Window* pFrame = pWin ? pWin->GetFrameWeld() : nullptr;
+ int x, y, width, height;
+ if (pFrame && pCare->get_extents_relative_to(*pFrame, x, y, width, height))
{
- aDlgPixel = pCare->GetWindowExtentsRelative( pWin );
+ aDlgPixel = tools::Rectangle(Point(x, y), Size(width, height));
aWinSize = pWin->GetOutputSizePixel();
// dos the dialog cover the GridWin?
if ( aDlgPixel.Right() >= 0 && aDlgPixel.Left() < aWinSize.Width() )
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 7282fcbac4ea..46259a8f12a3 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1154,10 +1154,8 @@ void ScTabViewShell::StartSimpleRefDialog(
pWnd->SetRefString( rInitVal );
pWnd->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
ScSimpleRefDlgWrapper::SetAutoReOpen( false );
- if (vcl::Window* pWin = pWnd->GetWindow())
- pWin->SetText( rTitle );
- if (auto pWin = pWnd->GetController())
- pWin->set_title(rTitle);
+ if (auto xWin = pWnd->GetController())
+ xWin->set_title(rTitle);
pWnd->StartRefInput();
}
}
@@ -1170,11 +1168,6 @@ void ScTabViewShell::StopSimpleRefDialog()
ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
if (pWnd)
{
- if (vcl::Window* pWin = pWnd->GetWindow())
- {
- if (pWin->IsSystemWindow())
- static_cast<SystemWindow*>(pWin)->Close(); // calls abort handler
- }
if (auto pWin = pWnd->GetController())
pWin->response(RET_CLOSE);
}
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 5aecdbd97733..25d555c76aad 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -173,14 +173,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
}
break;
- case FID_CHG_SHOW:
- {
- // dialog checks, what is in the cell
-
- pResult = VclPtr<ScHighlightChgDlg>::Create( pB, pCW, pParent, &GetViewData() );
- }
- break;
-
case WID_CONDFRMT_REF:
{
bool bFound = false;
@@ -480,6 +472,12 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
xResult.reset(new ScOptSolverDlg(pB, pCW, pParent, rViewData.GetDocShell(), aCurPos));
break;
}
+ case FID_CHG_SHOW:
+ {
+ // dialog checks, what is in the cell
+ xResult.reset(new ScHighlightChgDlg(pB, pCW, pParent, &GetViewData()));
+ break;
+ }
}
if (xResult)
diff --git a/sc/uiconfig/scalc/ui/conflictsdialog.ui b/sc/uiconfig/scalc/ui/conflictsdialog.ui
index 3327e2f616da..e5812df23b01 100644
--- a/sc/uiconfig/scalc/ui/conflictsdialog.ui
+++ b/sc/uiconfig/scalc/ui/conflictsdialog.ui
@@ -1,13 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name text2 -->
+ <column type="gchararray"/>
+ <!-- column-name text3 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="ConflictsDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="conflictsdialog|ConflictsDialog">Resolve Conflicts</property>
<property name="resizable">False</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>
@@ -94,10 +109,10 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="conflictsdialog|label1">There are conflicting changes in this shared spreadsheet. Conflicts must be resolved before saving the spreadsheet. Keep either own or other changes.</property>
<property name="wrap">True</property>
<property name="max_width_chars">120</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -106,14 +121,73 @@
</packing>
</child>
<child>
- <object class="svtlo-SvSimpleTableContainer" id="container:border">
- <property name="height_request">150</property>
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</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="Simple Table Container-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="container">
+ <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="search_column">0</property>
+ <property name="show_expanders">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn0">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="conflictsdialog|conflict">Conflict</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer0"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="conflictsdialog|author">Author</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="conflictsdialog|date">Date</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer3"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="changes-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="conflictsdialog|changes-atkobject">Changes</property>
+ </object>
</child>
</object>
<packing>
@@ -173,8 +247,8 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">keepallmine</action-widget>
- <action-widget response="0">keepallothers</action-widget>
+ <action-widget response="101">keepallmine</action-widget>
+ <action-widget response="102">keepallothers</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
diff --git a/sc/uiconfig/scalc/ui/showchangesdialog.ui b/sc/uiconfig/scalc/ui/showchangesdialog.ui
index df4c3636478a..93071ddbc470 100644
--- a/sc/uiconfig/scalc/ui/showchangesdialog.ui
+++ b/sc/uiconfig/scalc/ui/showchangesdialog.ui
@@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="ShowChangesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="showchangesdialog|ShowChangesDialog">Show Changes</property>
<property name="resizable">False</property>
+ <property name="default_width">-1</property>
+ <property name="default_height">-1</property>
<property name="type_hint">normal</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -190,10 +194,11 @@
<property name="hexpand">True</property>
<property name="column_spacing">12</property>
<child>
- <object class="foruilo-RefEdit" id="range">
+ <object class="GtkEntry" id="range">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
<property name="width_chars">35</property>
</object>
<packing>
@@ -202,7 +207,7 @@
</packing>
</child>
<child>
- <object class="foruilo-RefButton" id="rangeref">
+ <object class="GtkButton" id="rangeref">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
@@ -228,6 +233,8 @@
</object>
</child>
<action-widgets>
+ <action-widget response="-5">ok</action-widget>
+ <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index b3f472ac3f81..12276fe01bdb 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -586,8 +586,14 @@ void SfxWorkWindow::DeleteControllers_Impl()
// SplitWindow, cancel it at the workwindow.
// After TH a cancellation on the SplitWindow is not necessary
// since this window is also destroyed (see below).
- if (pCW->pCli && pChild->GetWindow())
- ReleaseChild_Impl(*pChild->GetWindow());
+ if (pCW->pCli)
+ {
+ if (pChild->GetController())
+ ReleaseChild_Impl(*pChild->GetController());
+ else
+ ReleaseChild_Impl(*pChild->GetWindow());
+ }
+
pCW->pWin = nullptr;
pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChild->GetWindow() );
pChild->Destroy();
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index c97560e75406..2b76b9cefc22 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -394,6 +394,19 @@ SfxModelessDialogController::SfxModelessDialogController(SfxBindings* pBindinx,
Init(pBindinx, pCW);
}
+/* [Description]
+
+ Fills a SfxChildWinInfo with specific data from SfxModelessDialog,
+ so that it can be written in the INI file. It is assumed that rinfo
+ receives all other possible relevant data in the ChildWindow class.
+ ModelessDialogs have no specific information, so that the base
+ implementation does nothing and therefore must not be called.
+*/
+void SfxModelessDialogController::FillInfo(SfxChildWinInfo& rInfo) const
+{
+ rInfo.aSize = m_xDialog->get_size();
+}
+
void SfxModelessDialogController::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
{
m_pBindings = pBindinx;
diff --git a/solenv/sanitizers/ui/modules/scalc.false b/solenv/sanitizers/ui/modules/scalc.false
index 41ea2f893f4b..dcfc4752be91 100644
--- a/solenv/sanitizers/ui/modules/scalc.false
+++ b/solenv/sanitizers/ui/modules/scalc.false
@@ -38,7 +38,7 @@ sc/uiconfig/scalc/ui/regressiondialog.ui://GtkButton[@id='variable2-range-button
sc/uiconfig/scalc/ui/regressiondialog.ui://GtkButton[@id='output-range-button'] button-no-label
sc/uiconfig/scalc/ui/samplingdialog.ui://GtkButton[@id='input-range-button'] button-no-label
sc/uiconfig/scalc/ui/samplingdialog.ui://GtkButton[@id='output-range-button'] button-no-label
-sc/uiconfig/scalc/ui/standardfilterdialog.ui://GtkButton[@id='rbcopyarea'] button-no-label
+sc/uiconfig/scalc/ui/showchangesdialog.ui://GtkButton[@id='rangeref'] button-no-label
sc/uiconfig/scalc/ui/simplerefdialog.ui://GtkButton[@id='assignref'] button-no-label
sc/uiconfig/scalc/ui/solverdlg.ui://GtkButton[@id='changebutton'] button-no-label
sc/uiconfig/scalc/ui/solverdlg.ui://GtkButton[@id='targetbutton'] button-no-label
@@ -51,6 +51,7 @@ sc/uiconfig/scalc/ui/solverdlg.ui://GtkButton[@id='val1button'] button-no-label
sc/uiconfig/scalc/ui/solverdlg.ui://GtkButton[@id='val2button'] button-no-label
sc/uiconfig/scalc/ui/solverdlg.ui://GtkButton[@id='val3button'] button-no-label
sc/uiconfig/scalc/ui/solverdlg.ui://GtkButton[@id='val4button'] button-no-label
+sc/uiconfig/scalc/ui/standardfilterdialog.ui://GtkButton[@id='rbcopyarea'] button-no-label
sc/uiconfig/scalc/ui/ttestdialog.ui://GtkButton[@id='variable1-range-button'] button-no-label
sc/uiconfig/scalc/ui/ttestdialog.ui://GtkButton[@id='variable2-range-button'] button-no-label
sc/uiconfig/scalc/ui/ttestdialog.ui://GtkButton[@id='output-range-button'] button-no-label
diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr
index e3d5078c1369..312079c8a5bf 100644
--- a/solenv/sanitizers/ui/modules/scalc.suppr
+++ b/solenv/sanitizers/ui/modules/scalc.suppr
@@ -194,7 +194,7 @@ sc/uiconfig/scalc/ui/sharedocumentdlg.ui://svtlo-SvSimpleTableContainer[@id='use
sc/uiconfig/scalc/ui/sharedocumentdlg.ui://GtkLabel[@id='nouserdata'] orphan-label
sc/uiconfig/scalc/ui/sharedocumentdlg.ui://GtkLabel[@id='unknownuser'] orphan-label
sc/uiconfig/scalc/ui/sharedocumentdlg.ui://GtkLabel[@id='exclusive'] orphan-label
-sc/uiconfig/scalc/ui/showchangesdialog.ui://foruilo-RefEdit[@id='range'] no-labelled-by
+sc/uiconfig/scalc/ui/showchangesdialog.ui://GtkEntry[@id='range'] no-labelled-by
sc/uiconfig/scalc/ui/sidebaralignment.ui://GtkSpinButton[@id='leftindent:0pt'] missing-label-for
sc/uiconfig/scalc/ui/sidebaralignment.ui://GtkSpinButton[@id='leftindent:0pt'] labelled-by-and-mnemonic
sc/uiconfig/scalc/ui/sidebaralignment.ui://GtkLabel[@id='orientationlabel'] orphan-label
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 2beda6b658f9..92f40861aeef 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1746,19 +1746,25 @@ SvtCalendarBox::SvtCalendarBox(std::unique_ptr<weld::MenuButton> pControl)
void SvtCalendarBox::set_date(const Date& rDate)
{
m_xCalendar->set_date(rDate);
- SelectHdl(*m_xCalendar);
+ set_label_from_date();
}
-IMPL_LINK(SvtCalendarBox, SelectHdl, weld::Calendar&, rCalendar, void)
+void SvtCalendarBox::set_label_from_date()
{
const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper();
- m_xControl->set_label(rLocaleData.getDate(rCalendar.get_date()));
+ m_xControl->set_label(rLocaleData.getDate(m_xCalendar->get_date()));
+}
+
+IMPL_LINK_NOARG(SvtCalendarBox, SelectHdl, weld::Calendar&, void)
+{
+ set_label_from_date();
}
IMPL_LINK_NOARG(SvtCalendarBox, ActivateHdl, weld::Calendar&, void)
{
if (m_xControl->get_active())
m_xControl->set_active(false);
+ m_aActivatedHdl.Call(*this);
}
SvtCalendarBox::~SvtCalendarBox()
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 4abffd971c7e..b003402a020b 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <comphelper/processfactory.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
@@ -91,8 +92,12 @@ void SvLBoxColorString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::Rende
rRenderContext.SetTextColor(aColor);
}
-SvxRedlinTable::SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits)
- : SvSimpleTable(rParent,nBits)
+SvxRedlinTable::SvxRedlinTable(std::unique_ptr<weld::TreeView> xWriterControl,
+ std::unique_ptr<weld::TreeView> xCalcControl)
+ : xSorter(new comphelper::string::NaturalStringSorter(::comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetUILanguageTag().getLocale()))
+ , xWriterTreeView(std::move(xWriterControl))
+ , xCalcTreeView(std::move(xCalcControl))
, nDatePos(WRITER_DATE)
, bAuthor(false)
, bDate(false)
@@ -103,65 +108,82 @@ SvxRedlinTable::SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits)
, aDaTiFilterFirst( DateTime::EMPTY )
, aDaTiFilterLast( DateTime::EMPTY )
{
- SetNodeDefaultImages();
+ if (xWriterTreeView)
+ {
+ xWriterTreeView->connect_column_clicked(LINK(this, SvxRedlinTable, HeaderBarClick));
+ xWriterTreeView->set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
+ return ColCompare(rLeft, rRight);
+ });
+ pTreeView = xWriterTreeView.get();
+ }
+ if (xCalcTreeView)
+ {
+ xCalcTreeView->connect_column_clicked(LINK(this, SvxRedlinTable, HeaderBarClick));
+ xCalcTreeView->set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
+ return ColCompare(rLeft, rRight);
+ });
+ pTreeView = xCalcTreeView.get();
+ }
}
-SvxRedlinTable::~SvxRedlinTable()
+void SvxRedlinTable::set_size_request(int nWidth, int nHeight)
{
- disposeOnce();
+ if (xWriterTreeView)
+ xWriterTreeView->set_size_request(nWidth, nHeight);
+ if (xCalcTreeView)
+ xCalcTreeView->set_size_request(nWidth, nHeight);
}
-void SvxRedlinTable::dispose()
+SvxRedlinTable::~SvxRedlinTable()
{
- pCommentSearcher.reset();
- SvSimpleTable::dispose();
}
-sal_Int32 SvxRedlinTable::ColCompare(SvTreeListEntry* pLeft,SvTreeListEntry* pRight)
+IMPL_LINK(SvxRedlinTable, HeaderBarClick, int, nColumn, void)
{
- sal_Int32 nCompare = 0;
+ bool bSortAtoZ = pTreeView->get_sort_order();
- if(aColCompareLink.IsSet())
+ //set new arrow positions in headerbar
+ if (nColumn == pTreeView->get_sort_column())
{
- SvSortData aRedlinCompare;
- aRedlinCompare.pLeft=pLeft;
- aRedlinCompare.pRight=pRight;
- nCompare = aColCompareLink.Call(&aRedlinCompare);
+ bSortAtoZ = !bSortAtoZ;
+ pTreeView->set_sort_order(bSortAtoZ);
}
else
{
- if(nDatePos==GetSortedCol())
- {
- RedlinData *pLeftData=static_cast<RedlinData *>(pLeft->GetUserData());
- RedlinData *pRightData=static_cast<RedlinData *>(pRight->GetUserData());
-
- if(pLeftData!=nullptr && pRightData!=nullptr)
- {
- if(pLeftData->aDateTime < pRightData->aDateTime)
- {
- nCompare = -1;
- }
- else if(pLeftData->aDateTime > pRightData->aDateTime)
- {
- nCompare = 1;
- }
- }
- else
- nCompare = SvSimpleTable::ColCompare(pLeft,pRight);
- }
- else
- {
- nCompare = SvSimpleTable::ColCompare(pLeft,pRight);
- }
-
+ pTreeView->set_sort_indicator(TRISTATE_INDET, pTreeView->get_sort_column());
+ pTreeView->set_sort_column(nColumn);
}
- return nCompare;
+ if (nColumn != -1)
+ {
+ //sort lists
+ pTreeView->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
+ }
}
-void SvxRedlinTable::SetCalcView()
+int SvxRedlinTable::ColCompare(const weld::TreeIter& rLeft, const weld::TreeIter& rRight)
{
- nDatePos=CALC_DATE;
+ sal_Int32 nCompare = 0;
+
+ int nSortCol = pTreeView->get_sort_column();
+
+ if (nSortCol == nDatePos)
+ {
+ RedlinData *pLeftData = reinterpret_cast<RedlinData*>(pTreeView->get_id(rLeft).toInt64());
+ RedlinData *pRightData = reinterpret_cast<RedlinData*>(pTreeView->get_id(rRight).toInt64());
+
+ if (pLeftData && pRightData)
+ {
+ if (pLeftData->aDateTime < pRightData->aDateTime)
+ nCompare = -1;
+ else if (pLeftData->aDateTime > pRightData->aDateTime)
+ nCompare = 1;
+ return nCompare;
+ }
+ }
+
+ return xSorter->compare(pTreeView->get_text(rLeft, nSortCol),
+ pTreeView->get_text(rRight, nSortCol));
}
void SvxRedlinTable::UpdateFilterTest()
@@ -289,209 +311,132 @@ bool SvxRedlinTable::IsValidComment(const OUString &rCommentStr)
return pCommentSearcher->SearchForward( rCommentStr, &nStartPos, &nEndPos);
}
-SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,
- std::unique_ptr<RedlinData> pUserData, SvTreeListEntry* pParent, sal_uLong nPos)
-{
- const Color aColor = (pUserData && pUserData->bDisabled) ? COL_GRAY : GetTextColor();
-
- return InsertEntry(rStr, std::move(pUserData), aColor, pParent, nPos);
-}
-
-SvTreeListEntry* SvxRedlinTable::InsertEntry(const OUString& rStr,
- std::unique_ptr<RedlinData> pUserData, const Color& rColor, SvTreeListEntry* pParent, sal_uLong nPos)
+SvxTPage::~SvxTPage()
{
- maEntryColor = rColor;
- maEntryImage = Image();
-
- sal_Int32 nIndex = 0;
- const OUString aFirstStr(rStr.getToken(0, '\t', nIndex));
- maEntryString = nIndex > 0 ? rStr.copy(nIndex) : OUString();
-
- return SvSimpleTable::InsertEntry(aFirstStr, pParent, false, nPos, pUserData.release());
}
-SvTreeListEntry* SvxRedlinTable::InsertEntry(const Image &rRedlineType, const OUString& rStr,
- std::unique_ptr<RedlinData> pUserData, SvTreeListEntry* pParent, sal_uLong nPos)
+void SvxTPage::ActivatePage()
{
- maEntryColor = (pUserData && pUserData->bDisabled) ? COL_GRAY : GetTextColor();
- maEntryImage = rRedlineType;
- maEntryString = rStr;
-
- return SvSimpleTable::InsertEntry(OUString(), pParent, false, nPos, pUserData.release());
}
-SvTreeListEntry* SvxRedlinTable::CreateEntry() const
+void SvxTPage::DeactivatePage()
{
- return new SvxRedlinEntry;
}
-void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
- const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind)
-{
- if (nTreeFlags & SvTreeFlags::CHKBTN)
- {
- pEntry->AddItem(std::make_unique<SvLBoxButton>(
- eButtonKind, pCheckButtonData));
- }
-
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(
- rColl, rExp, true));
-
- // the type of the change
- assert((rStr.isEmpty() && !!maEntryImage) || (!rStr.isEmpty() && !maEntryImage));
-
- if (rStr.isEmpty())
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(
- maEntryImage, maEntryImage, true));
- else
- pEntry->AddItem(std::make_unique<SvLBoxColorString>(
- rStr, maEntryColor));
-
- // the change tracking entries
- sal_Int32 nIndex = 0;
- const sal_uInt16 nCount = TabCount() - 1;
- for (sal_uInt16 nToken = 0; nToken < nCount; nToken++)
- {
- const OUString aToken = GetToken(maEntryString, nIndex);
- pEntry->AddItem(std::make_unique<SvLBoxColorString>(
- aToken, maEntryColor));
- }
-}
-
-SvxTPView::SvxTPView(vcl::Window *pParent, VclBuilderContainer *pTopLevel)
- : TabPage(pParent, "RedlineViewPage", "svx/ui/redlineviewpage.ui")
+SvxTPView::SvxTPView(weld::Container* pParent, weld::Builder* pTopLevel)
+ : SvxTPage(pParent, "svx/ui/redlineviewpage.ui", "RedlineViewPage")
, bEnableAccept(true)
, bEnableAcceptAll(true)
, bEnableReject(true)
, bEnableRejectAll(true)
, bEnableUndo(true)
+ , m_xAccept(pTopLevel->weld_button("accept"))
+ , m_xReject(pTopLevel->weld_button("reject"))
+ , m_xAcceptAll(pTopLevel->weld_button("acceptall"))
+ , m_xRejectAll(pTopLevel->weld_button("rejectall"))
+ , m_xUndo(pTopLevel->weld_button("undo"))
+ , m_xViewData(new SvxRedlinTable(m_xBuilder->weld_tree_view("writerchanges"),
+ m_xBuilder->weld_tree_view("calcchanges")))
{
- pTopLevel->get(m_pAccept, "accept");
- pTopLevel->get(m_pReject, "reject");
- pTopLevel->get(m_pAcceptAll, "acceptall");
- pTopLevel->get(m_pRejectAll, "rejectall");
- pTopLevel->get(m_pUndo, "undo");
-
// set wider window for the optional extending button labels
// eg. "Reject/Clear formatting" instead of "Reject"
EnableClearFormat(true);
EnableClearFormatAll(true);
- SvSimpleTableContainer* pTable = get<SvSimpleTableContainer>("changes");
Size aControlSize(80, 65);
- aControlSize = LogicToPixel(aControlSize, MapMode(MapUnit::MapAppFont));
- pTable->set_width_request(aControlSize.Width());
- pTable->set_height_request(aControlSize.Height());
- m_pViewData = VclPtr<SvxRedlinTable>::Create(*pTable, 0);
+ m_xViewData->set_size_request(aControlSize.Width(), aControlSize.Height());
- Link<Button*,void> aLink=LINK( this, SvxTPView, PbClickHdl);
+ Link<weld::Button&,void> aLink=LINK( this, SvxTPView, PbClickHdl);
- m_pAccept->SetClickHdl(aLink);
- m_pAcceptAll->SetClickHdl(aLink);
- m_pReject->SetClickHdl(aLink);
- m_pRejectAll->SetClickHdl(aLink);
- m_pUndo->SetClickHdl(aLink);
+ m_xAccept->connect_clicked(aLink);
+ m_xAcceptAll->connect_clicked(aLink);
+ m_xReject->connect_clicked(aLink);
+ m_xRejectAll->connect_clicked(aLink);
+ m_xUndo->connect_clicked(aLink);
}
void SvxTPView::ActivatePage()
{
- m_pAccept->Enable(bEnableAccept);
- m_pReject->Enable(bEnableReject);
- m_pAcceptAll->Enable(bEnableAcceptAll);
- m_pRejectAll->Enable(bEnableRejectAll);
- m_pUndo->Enable(bEnableUndo);
- TabPage::ActivatePage();
+ m_xAccept->set_sensitive(bEnableAccept);
+ m_xReject->set_sensitive(bEnableReject);
+ m_xAcceptAll->set_sensitive(bEnableAcceptAll);
+ m_xRejectAll->set_sensitive(bEnableRejectAll);
+ m_xUndo->set_sensitive(bEnableUndo);
}
void SvxTPView::DeactivatePage()
{
- TabPage::DeactivatePage();
- m_pAccept->Disable();
- m_pReject->Disable();
- m_pAcceptAll->Disable();
- m_pRejectAll->Disable();
- m_pUndo->Disable();
+ m_xAccept->set_sensitive(false);
+ m_xReject->set_sensitive(false);
+ m_xAcceptAll->set_sensitive(false);
+ m_xRejectAll->set_sensitive(false);
+ m_xUndo->set_sensitive(false);
}
SvxTPView::~SvxTPView()
{
- disposeOnce();
-}
-
-void SvxTPView::dispose()
-{
- m_pViewData.disposeAndClear();
- m_pAccept.clear();
- m_pReject.clear();
- m_pAcceptAll.clear();
- m_pRejectAll.clear();
- m_pUndo.clear();
- TabPage::dispose();
}
-void SvxTPView::InsertWriterHeader()
+void SvxRedlinTable::SetWriterView()
{
- const long aTabPositions[] = { 10, 20, 70, 120 };
- m_pViewData->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
+ nDatePos = WRITER_DATE;
+ if (xCalcTreeView)
+ xCalcTreeView->hide();
+ xWriterTreeView->show();
+ pTreeView = xWriterTreeView.get();
- OUString aStrTab('\t');
- OUString aString = get<FixedText>("action")->GetText()
- + aStrTab
- + get<FixedText>("author")->GetText()
- + aStrTab
- + get<FixedText>("date")->GetText()
- + aStrTab
- + get<FixedText>("comment")->GetText();
- m_pViewData->ClearHeader();
- m_pViewData->InsertHeaderEntry(aString);
+ auto nDigitWidth = pTreeView->get_approximate_digit_width();
+ std::vector<int> aWidths;
+ aWidths.push_back(nDigitWidth * 10);
+ aWidths.push_back(nDigitWidth * 20);
+ aWidths.push_back(nDigitWidth * 20);
+ pTreeView->set_column_fixed_widths(aWidths);
}
-void SvxTPView::InsertCalcHeader()
+void SvxRedlinTable::SetCalcView()
{
- const long aTabPositions[] = { 10, 65, 120, 170, 220 };
- m_pViewData->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
+ nDatePos = CALC_DATE;
+ if (xWriterTreeView)
+ xWriterTreeView->hide();
+ xCalcTreeView->show();
+ pTreeView = xCalcTreeView.get();
- OUString aStrTab('\t');
- OUString aString = get<FixedText>("action")->GetText()
- + aStrTab
- + get<FixedText>("position")->GetText()
- + aStrTab
- + get<FixedText>("author")->GetText()
- + aStrTab
- + get<FixedText>("date")->GetText()
- + aStrTab
- + get<FixedText>("comment")->GetText();
- m_pViewData->ClearHeader();
- m_pViewData->InsertHeaderEntry(aString);
+ auto nDigitWidth = pTreeView->get_approximate_digit_width();
+ std::vector<int> aWidths;
+ aWidths.push_back(nDigitWidth * 20);
+ aWidths.push_back(nDigitWidth * 20);
+ aWidths.push_back(nDigitWidth * 20);
+ aWidths.push_back(nDigitWidth * 20);
+ pTreeView->set_column_fixed_widths(aWidths);
}
void SvxTPView::EnableAccept(bool bFlag)
{
bEnableAccept = bFlag;
- m_pAccept->Enable(bFlag);
+ m_xAccept->set_sensitive(bFlag);
}
void SvxTPView::EnableAcceptAll(bool bFlag)
{
bEnableAcceptAll = bFlag;
- m_pAcceptAll->Enable(bFlag);
+ m_xAcceptAll->set_sensitive(bFlag);
}
void SvxTPView::EnableReject(bool bFlag)
{
bEnableReject = bFlag;
- m_pReject->Enable(bFlag);
+ m_xReject->set_sensitive(bFlag);
}
void SvxTPView::EnableRejectAll(bool bFlag)
{
bEnableRejectAll = bFlag;
- m_pRejectAll->Enable(bFlag);
+ m_xRejectAll->set_sensitive(bFlag);
}
-void SvxTPView::EnableClearFormatButton(VclPtr<PushButton> pButton, bool bFlag)
+void SvxTPView::EnableClearFormatButton(weld::Button& rButton, bool bFlag)
{
- OUString sText = pButton->GetText();
+ OUString sText = rButton.get_label();
OUString sClearFormat = SvxResId(RID_SVXSTR_CLEARFORM);
sal_Int32 nPos = sText.indexOf(sClearFormat);
@@ -500,128 +445,130 @@ void SvxTPView::EnableClearFormatButton(VclPtr<PushButton> pButton, bool bFlag)
{
if (nPos == -1)
{
- pButton->SetText(sText + "/" + sClearFormat);
+ rButton.set_label(sText + "/" + sClearFormat);
}
}
else
{
if (nPos > 0)
{
- pButton->SetText(sText.copy(0, nPos - 1));
+ rButton.set_label(sText.copy(0, nPos - 1));
}
}
}
void SvxTPView::EnableClearFormat(bool bFlag)
{
- EnableClearFormatButton( m_pReject, bFlag );
+ EnableClearFormatButton(*m_xReject, bFlag);
}
void SvxTPView::EnableClearFormatAll(bool bFlag)
{
- EnableClearFormatButton( m_pRejectAll, bFlag );
+ EnableClearFormatButton(*m_xRejectAll, bFlag);
}
void SvxTPView::ShowUndo()
{
- m_pUndo->Show();
+ m_xUndo->show();
}
void SvxTPView::EnableUndo(bool bFlag)
{
bEnableUndo = bFlag;
- m_pUndo->Enable(bFlag);
+ m_xUndo->set_sensitive(bFlag);
}
-
-IMPL_LINK( SvxTPView, PbClickHdl, Button*, pButton, void )
+IMPL_LINK( SvxTPView, PbClickHdl, weld::Button&, rPushB, void)
{
- PushButton* pPushB = static_cast<PushButton*>(pButton);
- if (pPushB == m_pAccept)
+ if (&rPushB == m_xAccept.get())
{
AcceptClickLk.Call(this);
}
- else if (pPushB == m_pAcceptAll)
+ else if (&rPushB == m_xAcceptAll.get())
{
AcceptAllClickLk.Call(this);
}
- else if (pPushB == m_pReject)
+ else if (&rPushB == m_xReject.get())
{
RejectClickLk.Call(this);
}
- else if (pPushB == m_pRejectAll)
+ else if (&rPushB == m_xRejectAll.get())
{
RejectAllClickLk.Call(this);
}
- else if (pPushB == m_pUndo)
+ else if (&rPushB == m_xUndo.get())
{
UndoClickLk.Call(this);
}
}
-SvxTPFilter::SvxTPFilter( vcl::Window * pParent)
- : TabPage(pParent, "RedlineFilterPage", "svx/ui/redlinefilterpage.ui")
- , pRedlinTable(nullptr)
- , bModified(false)
+SvxTPage::SvxTPage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID)
+ : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
+ , m_xContainer(m_xBuilder->weld_container(rID))
{
- get(m_pCbDate, "date");
- get(m_pLbDate, "datecond");
- get(m_pDfDate, "startdate");
- get(m_pTfDate, "starttime");
- get(m_pIbClock, "startclock");
- get(m_pFtDate2, "and");
- get(m_pDfDate2, "enddate");
- get(m_pTfDate2, "endtime");
- get(m_pIbClock2, "endclock");
- get(m_pCbAuthor, "author");
- get(m_pLbAuthor, "authorlist");
- get(m_pCbRange, "range");
- get(m_pEdRange, "rangeedit");
- get(m_pBtnRange, "dotdotdot");
- get(m_pCbAction, "action");
- get(m_pLbAction, "actionlist");
- get(m_pCbComment, "comment");
- get(m_pEdComment, "commentedit");
-
- m_pDfDate->SetShowDateCentury( true );
- m_pDfDate2->SetShowDateCentury( true );
-
- m_pLbDate->SelectEntryPos(0);
- m_pLbDate->SetSelectHdl( LINK( this, SvxTPFilter, SelDateHdl ) );
- m_pIbClock->SetClickHdl( LINK( this, SvxTPFilter, TimeHdl) );
- m_pIbClock2->SetClickHdl( LINK( this, SvxTPFilter,TimeHdl) );
- m_pBtnRange->SetClickHdl( LINK( this, SvxTPFilter, RefHandle));
-
- Link<Button*,void> aLink=LINK( this, SvxTPFilter, RowEnableHdl) ;
- m_pCbDate->SetClickHdl(aLink);
- m_pCbAuthor->SetClickHdl(aLink);
- m_pCbRange->SetClickHdl(aLink);
- m_pCbAction->SetClickHdl(aLink);
- m_pCbComment->SetClickHdl(aLink);
-
- Link<Edit&,void> a2Link=LINK( this, SvxTPFilter, ModifyDate);
- m_pDfDate->SetModifyHdl(a2Link);
- m_pTfDate->SetModifyHdl(a2Link);
- m_pDfDate2->SetModifyHdl(a2Link);
- m_pTfDate2->SetModifyHdl(a2Link);
-
- Link<Edit&,void> a3Link=LINK( this, SvxTPFilter, ModifyHdl);
- m_pEdRange->SetModifyHdl(a3Link);
- m_pEdComment->SetModifyHdl(a3Link);
- m_pLbAction->SetSelectHdl(LINK( this, SvxTPFilter, ModifyListBoxHdl));
- m_pLbAuthor->SetSelectHdl(LINK( this, SvxTPFilter, ModifyListBoxHdl));
-
- RowEnableHdl(m_pCbDate);
- RowEnableHdl(m_pCbAuthor);
- RowEnableHdl(m_pCbRange);
- RowEnableHdl(m_pCbAction);
- RowEnableHdl(m_pCbComment);
+}
+
+SvxTPFilter::SvxTPFilter(weld::Container* pParent)
+ : SvxTPage(pParent, "svx/ui/redlinefilterpage.ui", "RedlineFilterPage")
+ , bModified(false)
+ , m_pRedlinTable(nullptr)
+ , m_xCbDate(m_xBuilder->weld_check_button("date"))
+ , m_xLbDate(m_xBuilder->weld_combo_box("datecond"))
+ , m_xDfDate(new SvtCalendarBox(m_xBuilder->weld_menu_button("startdate")))
+ , m_xTfDate(m_xBuilder->weld_time_spin_button("starttime", TimeFieldFormat::F_NONE))
+ , m_xIbClock(m_xBuilder->weld_button("startclock"))
+ , m_xFtDate2(m_xBuilder->weld_label("and"))
+ , m_xDfDate2(new SvtCalendarBox(m_xBuilder->weld_menu_button("enddate")))
+ , m_xTfDate2(m_xBuilder->weld_time_spin_button("endtime", TimeFieldFormat::F_NONE))
+ , m_xIbClock2(m_xBuilder->weld_button("endclock"))
+ , m_xCbAuthor(m_xBuilder->weld_check_button("author"))
+ , m_xLbAuthor(m_xBuilder->weld_combo_box("authorlist"))
+ , m_xCbRange(m_xBuilder->weld_check_button("range"))
+ , m_xEdRange(m_xBuilder->weld_entry("rangeedit"))
+ , m_xBtnRange(m_xBuilder->weld_button("dotdotdot"))
+ , m_xCbAction(m_xBuilder->weld_check_button("action"))
+ , m_xLbAction(m_xBuilder->weld_combo_box("actionlist"))
+ , m_xCbComment(m_xBuilder->weld_check_button("comment"))
+ , m_xEdComment(m_xBuilder->weld_entry("commentedit"))
+{
+ m_xLbDate->set_active(0);
+ m_xLbDate->connect_changed( LINK( this, SvxTPFilter, SelDateHdl ) );
+ m_xIbClock->connect_clicked( LINK( this, SvxTPFilter, TimeHdl) );
+ m_xIbClock2->connect_clicked( LINK( this, SvxTPFilter,TimeHdl) );
+ m_xBtnRange->connect_clicked( LINK( this, SvxTPFilter, RefHandle));
+
+ Link<weld::Button&,void> aLink=LINK( this, SvxTPFilter, RowEnableHdl) ;
+ m_xCbDate->connect_clicked(aLink);
+ m_xCbAuthor->connect_clicked(aLink);
+ m_xCbRange->connect_clicked(aLink);
+ m_xCbAction->connect_clicked(aLink);
+ m_xCbComment->connect_clicked(aLink);
+
+ Link<SvtCalendarBox&,void> a2Link=LINK(this, SvxTPFilter, ModifyDate);
+ m_xDfDate->connect_activated(a2Link);
+ m_xDfDate2->connect_activated(a2Link);
+
+ Link<weld::TimeSpinButton&,void> a3Link=LINK(this, SvxTPFilter, ModifyTime);
+ m_xTfDate->connect_value_changed(a3Link);
+ m_xTfDate2->connect_value_changed(a3Link);
+
+ Link<weld::Entry&,void> a4Link=LINK( this, SvxTPFilter, ModifyHdl);
+ m_xEdRange->connect_changed(a4Link);
+ m_xEdComment->connect_changed(a4Link);
+ m_xLbAction->connect_changed(LINK( this, SvxTPFilter, ModifyListBoxHdl));
+ m_xLbAuthor->connect_changed(LINK( this, SvxTPFilter, ModifyListBoxHdl));
+
+ RowEnableHdl(*m_xCbDate);
+ RowEnableHdl(*m_xCbAuthor);
+ RowEnableHdl(*m_xCbRange);
+ RowEnableHdl(*m_xCbAction);
+ RowEnableHdl(*m_xCbComment);
DateTime aDateTime( DateTime::SYSTEM );
- m_pDfDate->SetDate(aDateTime);
- m_pTfDate->SetTime(aDateTime);
- m_pDfDate2->SetDate(aDateTime);
- m_pTfDate2->SetTime(aDateTime);
+ m_xDfDate->set_date(aDateTime);
+ m_xDfDate2->set_date(aDateTime);
+ m_xTfDate->set_value(aDateTime);
+ m_xTfDate2->set_value(aDateTime);
HideRange();
ShowAction();
bModified=false;
@@ -629,249 +576,223 @@ SvxTPFilter::SvxTPFilter( vcl::Window * pParent)
SvxTPFilter::~SvxTPFilter()
{
- disposeOnce();
-}
-
-void SvxTPFilter::dispose()
-{
- pRedlinTable.clear();
- m_pCbDate.clear();
- m_pLbDate.clear();
- m_pDfDate.clear();
- m_pTfDate.clear();
- m_pIbClock.clear();
- m_pFtDate2.clear();
- m_pDfDate2.clear();
- m_pTfDate2.clear();
- m_pIbClock2.clear();
- m_pCbAuthor.clear();
- m_pLbAuthor.clear();
- m_pCbRange.clear();
- m_pEdRange.clear();
- m_pBtnRange.clear();
- m_pCbAction.clear();
- m_pLbAction.clear();
- m_pCbComment.clear();
- m_pEdComment.clear();
- TabPage::dispose();
}
void SvxTPFilter::SetRedlinTable(SvxRedlinTable* pTable)
{
- pRedlinTable=pTable;
+ m_pRedlinTable = pTable;
}
void SvxTPFilter::EnableDateLine1(bool bFlag)
{
- if(bFlag && m_pCbDate->IsChecked())
+ if(bFlag && m_xCbDate->get_active())
{
- m_pDfDate->Enable();
- m_pTfDate->Enable();
- m_pIbClock->Enable();
+ m_xDfDate->set_sensitive(true);
+ m_xTfDate->set_sensitive(true);
+ m_xIbClock->set_sensitive(true);
}
else
{
- m_pDfDate->Disable();
- m_pTfDate->Disable();
- m_pIbClock->Disable();
+ m_xDfDate->set_sensitive(false);
+ m_xTfDate->set_sensitive(false);
+ m_xIbClock->set_sensitive(false);
}
}
void SvxTPFilter::EnableDateLine2(bool bFlag)
{
- if(bFlag && m_pCbDate->IsChecked())
+ if(bFlag && m_xCbDate->get_active())
{
- m_pFtDate2->Enable();
- m_pDfDate2->Enable();
- m_pTfDate2->Enable();
- m_pIbClock2->Enable();
+ m_xFtDate2->set_sensitive(true);
+ m_xDfDate2->set_sensitive(true);
+ m_xTfDate2->set_sensitive(true);
+ m_xIbClock2->set_sensitive(true);
}
else
{
- m_pFtDate2->Disable();
- m_pDfDate2->Disable();
- m_pDfDate2->SetText(OUString());
- m_pTfDate2->Disable();
- m_pTfDate2->SetText(OUString());
- m_pIbClock2->Disable();
+ m_xFtDate2->set_sensitive(false);
+ m_xDfDate2->set_sensitive(false);
+ m_xDfDate2->set_label(OUString());
+ m_xTfDate2->set_sensitive(false);
+ m_xTfDate2->set_text(OUString());
+ m_xIbClock2->set_sensitive(false);
}
}
Date SvxTPFilter::GetFirstDate() const
{
- return m_pDfDate->GetDate();
+ return m_xDfDate->get_date();
}
void SvxTPFilter::SetFirstDate(const Date &aDate)
{
- m_pDfDate->SetDate(aDate);
+ m_xDfDate->set_date(aDate);
}
tools::Time SvxTPFilter::GetFirstTime() const
{
- return m_pTfDate->GetTime();
+ return m_xTfDate->get_value();
}
void SvxTPFilter::SetFirstTime(const tools::Time &aTime)
{
- m_pTfDate->SetTime(aTime);
+ m_xTfDate->set_value(aTime);
}
-
Date SvxTPFilter::GetLastDate() const
{
- return m_pDfDate2->GetDate();
+ return m_xDfDate2->get_date();
}
void SvxTPFilter::SetLastDate(const Date &aDate)
{
- m_pDfDate2->SetDate(aDate);
+ m_xDfDate2->set_date(aDate);
}
tools::Time SvxTPFilter::GetLastTime() const
{
- return m_pTfDate2->GetTime();
+ return m_xTfDate2->get_value();
}
void SvxTPFilter::SetLastTime(const tools::Time &aTime)
{
- m_pTfDate2->SetTime(aTime);
+ m_xTfDate2->set_value(aTime);
}
void SvxTPFilter::SetDateMode(sal_uInt16 nMode)
{
- m_pLbDate->SelectEntryPos(nMode);
- SelDateHdl(*m_pLbDate);
+ m_xLbDate->set_active(nMode);
+ SelDateHdl(*m_xLbDate);
}
SvxRedlinDateMode SvxTPFilter::GetDateMode()
{
- return static_cast<SvxRedlinDateMode>(m_pLbDate->GetSelectedEntryPos());
+ return static_cast<SvxRedlinDateMode>(m_xLbDate->get_active());
}
void SvxTPFilter::ClearAuthors()
{
- m_pLbAuthor->Clear();
+ m_xLbAuthor->clear();
}
void SvxTPFilter::InsertAuthor( const OUString& rString)
{
- m_pLbAuthor->InsertEntry(rString);
+ m_xLbAuthor->append_text(rString);
}
OUString SvxTPFilter::GetSelectedAuthor() const
{
- return m_pLbAuthor->GetSelectedEntry();
+ return m_xLbAuthor->get_active_text();
}
void SvxTPFilter::SelectedAuthorPos(sal_Int32 nPos)
{
- m_pLbAuthor->SelectEntryPos(nPos);
+ m_xLbAuthor->set_active(nPos);
}
sal_Int32 SvxTPFilter::SelectAuthor(const OUString& aString)
{
- m_pLbAuthor->SelectEntry(aString);
- return m_pLbAuthor->GetSelectedEntryPos();
+ m_xLbAuthor->set_active_text(aString);
+ return m_xLbAuthor->get_active();
}
void SvxTPFilter::SetRange(const OUString& rString)
{
- m_pEdRange->SetText(rString);
+ m_xEdRange->set_text(rString);
}
OUString SvxTPFilter::GetRange() const
{
- return m_pEdRange->GetText();
+ return m_xEdRange->get_text();
}
void SvxTPFilter::SetFocusToRange()
{
- m_pEdRange->GrabFocus();
+ m_xEdRange->grab_focus();
}
void SvxTPFilter::HideRange(bool bHide)
{
if (bHide)
{
- m_pCbRange->Hide();
- m_pEdRange->Hide();
- m_pBtnRange->Hide();
+ m_xCbRange->hide();
+ m_xEdRange->hide();
+ m_xBtnRange->hide();
}
else
{
ShowAction(false);
- m_pCbRange->Show();
- m_pEdRange->Show();
- m_pBtnRange->Show();
+ m_xCbRange->show();
+ m_xEdRange->show();
+ m_xBtnRange->show();
}
}
void SvxTPFilter::SetComment(const OUString &rComment)
{
- m_pEdComment->SetText(rComment);
+ m_xEdComment->set_text(rComment);
}
OUString SvxTPFilter::GetComment()const
{
- return m_pEdComment->GetText();
+ return m_xEdComment->get_text();
}
bool SvxTPFilter::IsDate()
{
- return m_pCbDate->IsChecked();
+ return m_xCbDate->get_active();
}
bool SvxTPFilter::IsAuthor()
{
- return m_pCbAuthor->IsChecked();
+ return m_xCbAuthor->get_active();
}
bool SvxTPFilter::IsRange()
{
- return m_pCbRange->IsChecked();
+ return m_xCbRange->get_active();
}
bool SvxTPFilter::IsAction()
{
- return m_pCbAction->IsChecked();
+ return m_xCbAction->get_active();
}
bool SvxTPFilter::IsComment()
{
- return m_pCbComment->IsChecked();
+ return m_xCbComment->get_active();
}
void SvxTPFilter::CheckDate(bool bFlag)
{
- m_pCbDate->Check(bFlag);
- RowEnableHdl(m_pCbDate);
+ m_xCbDate->set_active(bFlag);
+ RowEnableHdl(*m_xCbDate);
bModified=false;
}
void SvxTPFilter::CheckAuthor(bool bFlag)
{
- m_pCbAuthor->Check(bFlag);
- RowEnableHdl(m_pCbAuthor);
+ m_xCbAuthor->set_active(bFlag);
+ RowEnableHdl(*m_xCbAuthor);
bModified=false;
}
void SvxTPFilter::CheckRange(bool bFlag)
{
- m_pCbRange->Check(bFlag);
- RowEnableHdl(m_pCbRange);
+ m_xCbRange->set_active(bFlag);
+ RowEnableHdl(*m_xCbRange);
bModified=false;
}
void SvxTPFilter::CheckAction(bool bFlag)
{
- m_pCbAction->Check(bFlag);
- RowEnableHdl(m_pCbAction);
+ m_xCbAction->set_active(bFlag);
+ RowEnableHdl(*m_xCbAction);
bModified=false;
}
void SvxTPFilter::CheckComment(bool bFlag)
{
- m_pCbComment->Check(bFlag);
- RowEnableHdl(m_pCbComment);
+ m_xCbComment->set_active(bFlag);
+ RowEnableHdl(*m_xCbComment);
bModified=false;
}
@@ -879,248 +800,246 @@ void SvxTPFilter::ShowAction(bool bShow)
{
if(!bShow)
{
- m_pCbAction->Hide();
- m_pLbAction->Hide();
+ m_xCbAction->hide();
+ m_xLbAction->hide();
}
else
{
HideRange();
- m_pCbAction->Show();
- m_pLbAction->Show();
+ m_xCbAction->show();
+ m_xLbAction->show();
}
}
-
-IMPL_LINK_NOARG( SvxTPFilter, SelDateHdl, ListBox&, void )
+IMPL_LINK_NOARG(SvxTPFilter, SelDateHdl, weld::ComboBox&, void)
{
- SvxRedlinDateMode nKind = static_cast<SvxRedlinDateMode>(m_pLbDate->GetSelectedEntryPos());
+ SvxRedlinDateMode nKind = static_cast<SvxRedlinDateMode>(m_xLbDate->get_active());
switch(nKind)
{
case SvxRedlinDateMode::BEFORE:
- EnableDateLine1(true);
- EnableDateLine2(false);
- break;
+ EnableDateLine1(true);
+ EnableDateLine2(false);
+ break;
case SvxRedlinDateMode::SINCE:
- EnableDateLine1(true);
- EnableDateLine2(false);
- break;
+ EnableDateLine1(true);
+ EnableDateLine2(false);
+ break;
case SvxRedlinDateMode::EQUAL:
- EnableDateLine1(true);
- m_pTfDate->Disable();
- m_pTfDate->SetText(OUString());
- EnableDateLine2(false);
- break;
+ EnableDateLine1(true);
+ m_xTfDate->set_sensitive(false);
+ m_xTfDate->set_text(OUString());
+ EnableDateLine2(false);
+ break;
case SvxRedlinDateMode::NOTEQUAL:
- EnableDateLine1(true);
- m_pTfDate->Disable();
- m_pTfDate->SetText(OUString());
- EnableDateLine2(false);
- break;
+ EnableDateLine1(true);
+ m_xTfDate->set_sensitive(false);
+ m_xTfDate->set_text(OUString());
+ EnableDateLine2(false);
+ break;
case SvxRedlinDateMode::BETWEEN:
- EnableDateLine1(true);
- EnableDateLine2(true);
- break;
+ EnableDateLine1(true);
+ EnableDateLine2(true);
+ break;
case SvxRedlinDateMode::SAVE:
- EnableDateLine1(false);
- EnableDateLine2(false);
- break;
+ EnableDateLine1(false);
+ EnableDateLine2(false);
+ break;
case SvxRedlinDateMode::NONE:
- break;
+ break;
}
- bModified=true;
+ bModified = true;
}
-IMPL_LINK( SvxTPFilter, RowEnableHdl, Button*, pButton, void )
+IMPL_LINK(SvxTPFilter, RowEnableHdl, weld::Button&, rCB, void)
{
- CheckBox* pCB = static_cast<CheckBox*>(pButton);
- if (pCB == m_pCbDate)
+ if (&rCB == m_xCbDate.get())
{
- m_pLbDate->Enable(m_pCbDate->IsChecked());
- m_pLbDate->Invalidate();
+ m_xLbDate->set_sensitive(m_xCbDate->get_active());
EnableDateLine1(false);
EnableDateLine2(false);
- if(m_pCbDate->IsChecked()) SelDateHdl(*m_pLbDate);
+ if(m_xCbDate->get_active()) SelDateHdl(*m_xLbDate);
}
- else if (pCB == m_pCbAuthor)
+ else if (&rCB == m_xCbAuthor.get())
{
- m_pLbAuthor->Enable(m_pCbAuthor->IsChecked());
- m_pLbAuthor->Invalidate();
+ m_xLbAuthor->set_sensitive(m_xCbAuthor->get_active());
}
- else if (pCB == m_pCbRange)
+ else if (&rCB == m_xCbRange.get())
{
- m_pEdRange->Enable(m_pCbRange->IsChecked());
- m_pBtnRange->Enable(m_pCbRange->IsChecked());
+ m_xEdRange->set_sensitive(m_xCbRange->get_active());
+ m_xBtnRange->set_sensitive(m_xCbRange->get_active());
}
- else if (pCB == m_pCbAction)
+ else if (&rCB == m_xCbAction.get())
{
- m_pLbAction->Enable(m_pCbAction->IsChecked());
- m_pLbAction->Invalidate();
+ m_xLbAction->set_sensitive(m_xCbAction->get_active());
}
- else if (pCB == m_pCbComment)
+ else if (&rCB == m_xCbComment.get())
{
- m_pEdComment->Enable(m_pCbComment->IsChecked());
- m_pEdComment->Invalidate();
+ m_xEdComment->set_sensitive(m_xCbComment->get_active());
}
-
- if(pCB!=nullptr)
- bModified=true;
+ bModified = true;
}
-IMPL_LINK( SvxTPFilter, TimeHdl, Button*, pButton, void )
+IMPL_LINK(SvxTPFilter, TimeHdl, weld::Button&, rIB, void)
{
- ImageButton* pIB = static_cast<ImageButton*>(pButton);
DateTime aDateTime( DateTime::SYSTEM );
- if (pIB == m_pIbClock)
+ if (&rIB == m_xIbClock.get())
{
- m_pDfDate->SetDate(aDateTime);
- m_pTfDate->SetTime(aDateTime);
+ m_xDfDate->set_date(aDateTime);
+ m_xTfDate->set_value(aDateTime);
}
- else if (pIB == m_pIbClock2)
+ else if (&rIB == m_xIbClock2.get())
{
- m_pDfDate2->SetDate(aDateTime);
- m_pTfDate2->SetTime(aDateTime);
+ m_xDfDate2->set_date(aDateTime);
+ m_xTfDate2->set_value(aDateTime);
}
bModified=true;
}
-IMPL_LINK_NOARG( SvxTPFilter, ModifyHdl, Edit&, void)
+
+IMPL_LINK_NOARG(SvxTPFilter, ModifyHdl, weld::Entry&, void)
{
bModified=true;
}
-IMPL_LINK_NOARG( SvxTPFilter, ModifyListBoxHdl, ListBox&, void)
+
+IMPL_LINK_NOARG(SvxTPFilter, ModifyListBoxHdl, weld::ComboBox&, void)
{
bModified=true;
}
+
void SvxTPFilter::DeactivatePage()
{
if(bModified)
{
- if(pRedlinTable!=nullptr)
+ if (m_pRedlinTable)
{
- pRedlinTable->SetFilterDate(IsDate());
- pRedlinTable->SetDateTimeMode(GetDateMode());
- pRedlinTable->SetFirstDate(m_pDfDate->GetDate());
- pRedlinTable->SetLastDate(m_pDfDate2->GetDate());
- pRedlinTable->SetFirstTime(m_pTfDate->GetTime());
- pRedlinTable->SetLastTime(m_pTfDate2->GetTime());
- pRedlinTable->SetFilterAuthor(IsAuthor());
- pRedlinTable->SetAuthor(GetSelectedAuthor());
-
- pRedlinTable->SetFilterComment(IsComment());
-
- utl::SearchParam aSearchParam( m_pEdComment->GetText(),
+ m_pRedlinTable->SetFilterDate(IsDate());
+ m_pRedlinTable->SetDateTimeMode(GetDateMode());
+ m_pRedlinTable->SetFirstDate(m_xDfDate->get_date());
+ m_pRedlinTable->SetLastDate(m_xDfDate2->get_date());
+ m_pRedlinTable->SetFirstTime(m_xTfDate->get_value());
+ m_pRedlinTable->SetLastTime(m_xTfDate2->get_value());
+ m_pRedlinTable->SetFilterAuthor(IsAuthor());
+ m_pRedlinTable->SetAuthor(GetSelectedAuthor());
+
+ m_pRedlinTable->SetFilterComment(IsComment());
+
+ utl::SearchParam aSearchParam( m_xEdComment->get_text(),
utl::SearchParam::SearchType::Regexp,false );
- pRedlinTable->SetCommentParams(&aSearchParam);
+ m_pRedlinTable->SetCommentParams(&aSearchParam);
- pRedlinTable->UpdateFilterTest();
+ m_pRedlinTable->UpdateFilterTest();
}
aReadyLink.Call(this);
}
bModified=false;
- TabPage::DeactivatePage();
}
-void SvxTPFilter::Enable( bool bEnable)
+void SvxTPFilter::Enable(bool bEnable)
{
- TabPage::Enable(bEnable);
- if(m_pCbDate->IsEnabled())
+ m_xContainer->set_sensitive(bEnable);
+ if (m_xCbDate->get_sensitive())
{
- RowEnableHdl(m_pCbDate);
- RowEnableHdl(m_pCbAuthor);
- RowEnableHdl(m_pCbRange);
- RowEnableHdl(m_pCbComment);
+ RowEnableHdl(*m_xCbDate);
+ RowEnableHdl(*m_xCbAuthor);
+ RowEnableHdl(*m_xCbRange);
+ RowEnableHdl(*m_xCbComment);
}
}
+
void SvxTPFilter::Disable()
{
Enable( false );
}
-IMPL_LINK( SvxTPFilter, ModifyDate, Edit&, rTF, void)
+IMPL_LINK(SvxTPFilter, ModifyDate, SvtCalendarBox&, rTF, void)
{
Date aDate( Date::SYSTEM );
- tools::Time aTime(0);
- if (m_pDfDate==&rTF)
+ if (m_xDfDate.get() == &rTF)
{
- if(m_pDfDate->GetText().isEmpty())
- m_pDfDate->SetDate(aDate);
+ if (m_xDfDate->get_label().isEmpty())
+ m_xDfDate->set_date(aDate);
- if(pRedlinTable!=nullptr)
- pRedlinTable->SetFirstDate(m_pDfDate->GetDate());
+ if(m_pRedlinTable!=nullptr)
+ m_pRedlinTable->SetFirstDate(m_xDfDate->get_date());
}
- else if (m_pDfDate2==&rTF)
+ else if (m_xDfDate2.get() == &rTF)
{
- if(m_pDfDate2->GetText().isEmpty())
- m_pDfDate2->SetDate(aDate);
+ if (m_xDfDate2->get_label().isEmpty())
+ m_xDfDate2->set_date(aDate);
- if(pRedlinTable!=nullptr)
- pRedlinTable->SetLastDate(m_pDfDate2->GetDate());
+ if (m_pRedlinTable)
+ m_pRedlinTable->SetLastDate(m_xDfDate2->get_date());
}
- else if (m_pTfDate==&rTF)
+ bModified=true;
+}
+
+IMPL_LINK(SvxTPFilter, ModifyTime, weld::TimeSpinButton&, rTF, void)
+{
+ tools::Time aTime(0);
+ if (m_xTfDate.get() == &rTF)
{
- if(m_pTfDate->GetText().isEmpty())
- m_pTfDate->SetTime(aTime);
+ if (m_xTfDate->get_text().isEmpty())
+ m_xTfDate->set_value(aTime);
- if(pRedlinTable!=nullptr)
- pRedlinTable->SetFirstTime(m_pTfDate->GetTime());
+ if(m_pRedlinTable!=nullptr)
+ m_pRedlinTable->SetFirstTime(m_xTfDate->get_value());
}
- else if (m_pTfDate2==&rTF)
+ else if (m_xTfDate2.get() == &rTF)
{
- if(m_pTfDate2->GetText().isEmpty())
- m_pTfDate2->SetTime(aTime);
+ if (m_xTfDate2->get_text().isEmpty())
+ m_xTfDate2->set_value(aTime);
- if(pRedlinTable!=nullptr)
- pRedlinTable->SetLastTime(m_pTfDate2->GetTime());
+ if(m_pRedlinTable!=nullptr)
+ m_pRedlinTable->SetLastTime(m_xTfDate2->get_value());
}
- ModifyHdl(*m_pDfDate);
+ bModified=true;
}
-IMPL_LINK( SvxTPFilter, RefHandle, Button*, pRef, void )
+IMPL_LINK_NOARG(SvxTPFilter, RefHandle, weld::Button&, void)
{
- if(pRef!=nullptr)
- {
- aRefLink.Call(this);
- }
+ aRefLink.Call(this);
}
-SvxAcceptChgCtr::SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTopLevel)
- : TabControl(pParent, WB_TABSTOP | WB_DIALOGCONTROL)
+SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent, weld::Builder* pTopLevel)
+ : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/redlinecontrol.ui"))
+ , m_xTabCtrl(m_xBuilder->weld_notebook("RedlineControl"))
{
- m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), "svx/ui/redlinecontrol.ui", "RedlineControl"));
+ m_xTabCtrl->connect_enter_page(LINK(this, SvxAcceptChgCtr, ActivatePageHdl));
+ m_xTabCtrl->connect_leave_page(LINK(this, SvxAcceptChgCtr, DeactivatePageHdl));
- pTPFilter = VclPtr<SvxTPFilter>::Create(this);
- pTPView = VclPtr<SvxTPView>::Create(this, pTopLevel);
-
- sal_uInt16 nViewPageId = GetPageId("view");
- m_nFilterPageId = GetPageId("filter");
- SetTabPage(nViewPageId, pTPView);
- SetTabPage(m_nFilterPageId, pTPFilter);
-
- pTPFilter->SetRedlinTable(pTPView->GetTableControl());
-
- SetCurPageId(nViewPageId);
-
- Show();
+ m_xTPFilter.reset(new SvxTPFilter(m_xTabCtrl->get_page("filter")));
+ m_xTPView.reset(new SvxTPView(m_xTabCtrl->get_page("view"), pTopLevel));
+ m_xTPFilter->SetRedlinTable(m_xTPView->GetTableControl());
+ m_xTabCtrl->set_current_page("view");
+ m_xTabCtrl->show();
}
SvxAcceptChgCtr::~SvxAcceptChgCtr()
{
- disposeOnce();
}
-void SvxAcceptChgCtr::dispose()
+void SvxAcceptChgCtr::ShowFilterPage()
{
- disposeBuilder();
- pTPView.disposeAndClear();
- pTPFilter.disposeAndClear();
- TabControl::dispose();
+ m_xTabCtrl->set_current_page("filter");
}
-void SvxAcceptChgCtr::ShowFilterPage()
+IMPL_LINK(SvxAcceptChgCtr, ActivatePageHdl, const OString&, rPage, void)
+{
+ if (rPage == "filter")
+ m_xTPFilter->ActivatePage();
+ else if (rPage == "view")
+ m_xTPView->ActivatePage();
+}
+
+IMPL_LINK(SvxAcceptChgCtr, DeactivatePageHdl, const OString&, rPage, bool)
{
- SetCurPageId(m_nFilterPageId);
+ if (rPage == "filter")
+ m_xTPFilter->DeactivatePage();
+ else if (rPage == "view")
+ m_xTPView->DeactivatePage();
+ return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index a0b1362a341e..105bb1c1d6da 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -17,7 +17,8 @@
using namespace sfx2::sidebar;
-PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
+PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
+ const css::uno::Reference<css::frame::XFrame> &rFrame, bool bInterimBuilder)
: Control(pParent)
, m_bInClose(false)
, mxFrame(rFrame)
@@ -28,7 +29,10 @@ PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUStrin
m_aPanelLayoutIdle.SetDebugName("svx::PanelLayout m_aPanelLayoutIdle");
// VclBuilder will trigger resize and start Idle
- m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame));
+ if (!bInterimBuilder)
+ m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame));
+ else
+ m_xBuilder.reset(Application::CreateInterimBuilder(this, rUIXMLDescription));
if (GetSettings().GetStyleSettings().GetAutoMnemonic())
Accelerator::GenerateAutoMnemonicsOnHierarchy(this);
}
@@ -42,6 +46,7 @@ void PanelLayout::dispose()
{
m_bInClose = true;
m_aPanelLayoutIdle.Stop();
+ m_xBuilder.reset();
disposeBuilder();
Control::dispose();
}
diff --git a/svx/uiconfig/ui/acceptrejectchangesdialog.ui b/svx/uiconfig/ui/acceptrejectchangesdialog.ui
index 7e9817689a99..a9db619b328f 100644
--- a/svx/uiconfig/ui/acceptrejectchangesdialog.ui
+++ b/svx/uiconfig/ui/acceptrejectchangesdialog.ui
@@ -1,12 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="AcceptRejectChangesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="acceptrejectchangesdialog|AcceptRejectChangesDialog">Manage Changes</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>
@@ -121,11 +126,11 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">accept</action-widget>
- <action-widget response="0">reject</action-widget>
- <action-widget response="0">acceptall</action-widget>
- <action-widget response="0">rejectall</action-widget>
- <action-widget response="0">undo</action-widget>
+ <action-widget response="105">accept</action-widget>
+ <action-widget response="104">reject</action-widget>
+ <action-widget response="103">acceptall</action-widget>
+ <action-widget response="102">rejectall</action-widget>
+ <action-widget response="101">undo</action-widget>
<action-widget response="-7">close</action-widget>
</action-widgets>
</object>
@@ -150,7 +155,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkRadioMenuItem" id="calcaction">
+ <object class="GtkRadioMenuItem" id="calcsort0">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|calcaction">Action</property>
@@ -158,35 +163,39 @@
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="calcposition">
+ <object class="GtkRadioMenuItem" id="calcsort1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|calcposition">Position</property>
<property name="use_underline">True</property>
+ <property name="group">calcsort0</property>
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="calcauthor">
+ <object class="GtkRadioMenuItem" id="calcsort2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|calcauthor">Author</property>
<property name="use_underline">True</property>
+ <property name="group">calcsort0</property>
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="calcdate">
+ <object class="GtkRadioMenuItem" id="calcsort3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|calcdate">Date</property>
<property name="use_underline">True</property>
+ <property name="group">calcsort0</property>
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="calcdesc">
+ <object class="GtkRadioMenuItem" id="calcsort4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|calcdesc">Description</property>
<property name="use_underline">True</property>
+ <property name="group">calcsort0</property>
</object>
</child>
</object>
@@ -215,7 +224,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkRadioMenuItem" id="writeraction">
+ <object class="GtkRadioMenuItem" id="writersort0">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|writeraction">Action</property>
@@ -223,35 +232,39 @@
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerauthor">
+ <object class="GtkRadioMenuItem" id="writersort1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|writerauthor">Author</property>
<property name="use_underline">True</property>
+ <property name="group">writersort0</property>
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerdate">
+ <object class="GtkRadioMenuItem" id="writersort2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|writerdate">Date</property>
<property name="use_underline">True</property>
+ <property name="group">writersort0</property>
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerdesc">
+ <object class="GtkRadioMenuItem" id="writersort3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|writerdesc">Comment</property>
<property name="use_underline">True</property>
+ <property name="group">writersort0</property>
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerposition">
+ <object class="GtkRadioMenuItem" id="writersort4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="acceptrejectchangesdialog|writerposition">Document Position</property>
<property name="use_underline">True</property>
+ <property name="group">writersort0</property>
</object>
</child>
</object>
diff --git a/svx/uiconfig/ui/redlinefilterpage.ui b/svx/uiconfig/ui/redlinefilterpage.ui
index 1638cc105ff2..5dd59893a511 100644
--- a/svx/uiconfig/ui/redlinefilterpage.ui
+++ b/svx/uiconfig/ui/redlinefilterpage.ui
@@ -1,28 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1">
- <property name="lower">19851231</property>
- <property name="upper">20501231</property>
- <property name="value">19851231</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
+ <property name="upper">86400000</property>
+ <property name="step_increment">1000</property>
+ <property name="page_increment">60000</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">86400000</property>
+ <property name="step_increment">1000</property>
+ <property name="page_increment">60000</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">cmd/sc_timefield.png</property>
+ <property name="icon_name">cmd/sc_timefield.png</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">cmd/sc_timefield.png</property>
+ <property name="icon_name">cmd/sc_timefield.png</property>
</object>
<object class="GtkGrid" id="RedlineFilterPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
@@ -81,6 +86,7 @@
<property name="can_focus">True</property>
<property name="margin_left">24</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="commentedit-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="redlinefilterpage|commentedit-atkobject">Comment</property>
@@ -176,6 +182,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
<accessibility>
<relation type="labelled-by" target="range"/>
</accessibility>
@@ -272,15 +279,17 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="startdate:yy:mm:dd">
- <property name="width_request">120</property>
+ <object class="GtkMenuButton" id="startdate">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="label" translatable="no"></property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="accessible">
- <object class="AtkObject" id="startdate:yy:mm:dd-atkobject">
+ <object class="AtkObject" id="startdate-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="redlinefilterpage|startdate-atkobject">Start Date</property>
</object>
</child>
@@ -291,14 +300,16 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="starttime:hh:mm">
+ <object class="GtkSpinButton" id="starttime">
<property name="width_request">70</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment1</property>
<child internal-child="accessible">
- <object class="AtkObject" id="starttime:hh:mm-atkobject">
+ <object class="AtkObject" id="starttime-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="redlinefilterpage|starttime-atkobject">Start Time</property>
</object>
</child>
@@ -324,15 +335,17 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="enddate:yy:mm:dd">
- <property name="width_request">120</property>
+ <object class="GtkMenuButton" id="enddate">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="label" translatable="no"></property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="accessible">
- <object class="AtkObject" id="enddate:yy:mm:dd-atkobject">
+ <object class="AtkObject" id="enddate-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="redlinefilterpage|enddate-atkobject">End Date</property>
</object>
</child>
@@ -343,14 +356,16 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="endtime:hh:mm">
+ <object class="GtkSpinButton" id="endtime">
<property name="width_request">75</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment2</property>
<child internal-child="accessible">
- <object class="AtkObject" id="endtime:hh:mm-atkobject">
+ <object class="AtkObject" id="endtime-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="redlinefilterpage|endtime-atkobject">End Time</property>
</object>
</child>
diff --git a/svx/uiconfig/ui/redlineviewpage.ui b/svx/uiconfig/ui/redlineviewpage.ui
index 19dd56ef34fc..370b8957a0c3 100644
--- a/svx/uiconfig/ui/redlineviewpage.ui
+++ b/svx/uiconfig/ui/redlineviewpage.ui
@@ -1,7 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name text2 -->
+ <column type="gchararray"/>
+ <!-- column-name text3 -->
+ <column type="gchararray"/>
+ <!-- column-name text4 -->
+ <column type="gchararray"/>
+ <!-- column-name text5 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name textcolor -->
+ <column type="GdkRGBA"/>
+ </columns>
+ </object>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name image -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name text2 -->
+ <column type="gchararray"/>
+ <!-- column-name text3 -->
+ <column type="gchararray"/>
+ <!-- column-name text4 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name textcolor -->
+ <column type="GdkRGBA"/>
+ </columns>
+ </object>
<object class="GtkBox" id="RedlineViewPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -10,90 +45,205 @@
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="box3">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="action">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="redlineviewpage|action">Action</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="position">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="redlineviewpage|position">Position</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="author">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="redlineviewpage|author">Author</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkLabel" id="date">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="redlineviewpage|date">Date</property>
+ <object class="GtkTreeView" id="calcchanges">
+ <property name="visible">False</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="search_column">0</property>
+ <property name="show_expanders">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn0">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|action">Action</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer0"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|position">Position</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer1"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|author">Author</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer2"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|date">Date</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer3"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|comment">Comment</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">4</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
- <child>
- <object class="GtkLabel" id="comment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="redlineviewpage|comment">Comment</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="calcchanges-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="redlineviewpage|calcchanges-atkobject">Changes</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="svtlo-SvSimpleTableContainer" id="changes">
- <property name="visible">True</property>
+ <object class="GtkScrolledWindow">
+ <property name="visible">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="changes-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" context="redlineviewpage|changes-atkobject">Changes</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="writerchanges">
+ <property name="visible">False</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">liststore2</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn00">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|action">Action</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext45"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext25"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn20">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|author">Author</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer29"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn30">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|date">Date</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer39"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn40">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="redlineviewpage|comment">Comment</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer49"/>
+ <attributes>
+ <attribute name="text">4</attribute>
+ <attribute name="foreground-rgba">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Simple Table Container-selection"/>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="writerchanges-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="redlineviewpage|writerchanges-atkobject">Changes</property>
+ </object>
</child>
</object>
<packing>
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index c92ab77686e9..b057b0567353 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -427,7 +427,7 @@ public:
virtual VclPtr<AbstractSwRenameXNamedDlg> CreateSwRenameXNamedDlg(weld::Window* pParent,
css::uno::Reference< css::container::XNamed > & xNamed,
css::uno::Reference< css::container::XNameAccess > & xNameAccess) = 0;
- virtual VclPtr<AbstractSwModalRedlineAcceptDlg> CreateSwModalRedlineAcceptDlg(vcl::Window *pParent) = 0;
+ virtual VclPtr<AbstractSwModalRedlineAcceptDlg> CreateSwModalRedlineAcceptDlg(weld::Window *pParent) = 0;
virtual VclPtr<VclAbstractDialog> CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateFrameTabDialog(const OUString &rDialogType,
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 7536cda1e9fb..641cbdfba6fb 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -436,9 +436,6 @@ public:
static void SetShellRes( ShellResource* pRes ) { mpShellRes = pRes; }
static ShellResource* GetShellRes();
- static void SetCareWin( vcl::Window* pNew );
- static vcl::Window* GetCareWin()
- { return (*mpCareWindow.get()) ? mpCareWindow.get()->get() : nullptr; }
static weld::Window* CareChildWin(SwViewShell const & rVSh);
static void SetCareDialog(const std::shared_ptr<weld::Window>& rNew);
static weld::Window* GetCareDialog(SwViewShell const & rVSh)
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 4cf762870e2d..f8a805dad4a9 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -92,7 +92,6 @@
bool SwViewShell::mbLstAct = false;
ShellResource *SwViewShell::mpShellRes = nullptr;
-vcl::DeleteOnDeinit< VclPtr<vcl::Window> > SwViewShell::mpCareWindow(new VclPtr<vcl::Window>);
vcl::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Window>);
static bool bInSizeNotify = false;
@@ -577,7 +576,7 @@ const SwRect& SwViewShell::VisArea() const
void SwViewShell::MakeVisible( const SwRect &rRect )
{
- if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin() || GetCareDialog(*this) )
+ if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this) )
{
if ( !IsViewLocked() )
{
@@ -2495,11 +2494,6 @@ ShellResource* SwViewShell::GetShellRes()
return mpShellRes;
}
-void SwViewShell::SetCareWin( vcl::Window* pNew )
-{
- (*mpCareWindow.get()) = pNew;
-}
-
void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
{
(*mpCareDialog.get()) = rNew;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 687f70bd90cf..43e7cbf5cfdd 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -206,7 +206,11 @@ short AbstractSwRenameXNamedDlg_Impl::Execute()
return m_xDlg->run();
}
-IMPL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl);
+short AbstractSwModalRedlineAcceptDlg_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
IMPL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl);
short AbstractFieldInputDlg_Impl::Execute()
@@ -514,9 +518,9 @@ void AbstractSwRenameXNamedDlg_Impl::SetAlternativeAccess(
m_xDlg->SetAlternativeAccess( xSecond, xThird);
}
-void AbstractSwModalRedlineAcceptDlg_Impl::AcceptAll( bool bAccept )
+void AbstractSwModalRedlineAcceptDlg_Impl::AcceptAll( bool bAccept )
{
- pDlg->AcceptAll( bAccept);
+ m_xDlg->AcceptAll( bAccept);
}
OUString AbstractGlossaryDlg_Impl::GetCurrGrpName() const
@@ -956,10 +960,9 @@ VclPtr<AbstractSwRenameXNamedDlg> SwAbstractDialogFactory_Impl::CreateSwRenameXN
return VclPtr<AbstractSwRenameXNamedDlg_Impl>::Create(std::make_unique<SwRenameXNamedDlg>(pParent,xNamed, xNameAccess));
}
-VclPtr<AbstractSwModalRedlineAcceptDlg> SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(vcl::Window *pParent)
+VclPtr<AbstractSwModalRedlineAcceptDlg> SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(weld::Window *pParent)
{
- VclPtr<SwModalRedlineAcceptDlg> pDlg = VclPtr<SwModalRedlineAcceptDlg>::Create( pParent );
- return VclPtr<AbstractSwModalRedlineAcceptDlg_Impl>::Create( pDlg );
+ return VclPtr<AbstractSwModalRedlineAcceptDlg_Impl>::Create(std::make_unique<SwModalRedlineAcceptDlg>(pParent));
}
VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 94b7fa965640..a84b966f8c33 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -387,8 +387,14 @@ public:
class AbstractSwModalRedlineAcceptDlg_Impl : public AbstractSwModalRedlineAcceptDlg
{
- DECL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl,SwModalRedlineAcceptDlg )
- virtual void AcceptAll( bool bAccept ) override;
+ std::unique_ptr<SwModalRedlineAcceptDlg> m_xDlg;
+public:
+ explicit AbstractSwModalRedlineAcceptDlg_Impl(std::unique_ptr<SwModalRedlineAcceptDlg> p)
+ : m_xDlg(std::move(p))
+ {
+ }
+ virtual short Execute() override;
+ virtual void AcceptAll(bool bAccept) override;
};
class SwGlossaryDlg;
@@ -652,7 +658,7 @@ public:
virtual VclPtr<AbstractSwRenameXNamedDlg> CreateSwRenameXNamedDlg(weld::Window* pParent,
css::uno::Reference< css::container::XNamed > & xNamed,
css::uno::Reference< css::container::XNameAccess > & xNameAccess) override;
- virtual VclPtr<AbstractSwModalRedlineAcceptDlg> CreateSwModalRedlineAcceptDlg(vcl::Window *pParent) override;
+ virtual VclPtr<AbstractSwModalRedlineAcceptDlg> CreateSwModalRedlineAcceptDlg(weld::Window *pParent) override;
virtual VclPtr<VclAbstractDialog> CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev) override;
virtual VclPtr<SfxAbstractTabDialog> CreateFrameTabDialog( const OUString &rDialogType,
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 32279a180e8f..1e0343ab3327 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -33,7 +33,7 @@
SwWordCountFloatDlg::~SwWordCountFloatDlg()
{
- SwViewShell::SetCareWin( nullptr );
+ SwViewShell::SetCareDialog(nullptr);
}
namespace
diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
index a3f336dc5a30..20dac2f769d3 100644
--- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
+++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
@@ -24,6 +24,7 @@
#include <sfx2/dispatch.hxx>
#include <svx/ctredlin.hxx>
#include <svx/postattr.hxx>
+#include <unotools/viewoptions.hxx>
#include <swtypes.hxx>
#include <wrtsh.hxx>
#include <view.hxx>
@@ -39,28 +40,34 @@
#include <unomid.h>
-SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(vcl::Window *pParent)
- : SfxModalDialog(pParent,
- "AcceptRejectChangesDialog", "svx/ui/acceptrejectchangesdialog.ui")
+SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(weld::Window *pParent)
+ : SfxDialogController(pParent, "svx/ui/acceptrejectchangesdialog.ui",
+ "AcceptRejectChangesDialog")
+ , m_xContentArea(m_xDialog->weld_content_area())
{
- pImplDlg.reset( new SwRedlineAcceptDlg(this, this, get_content_area(), true) );
+ m_xDialog->set_modal(true);
- pImplDlg->Initialize(GetExtraData());
- pImplDlg->Activate(); // for data's initialisation
-}
+ m_xImplDlg.reset(new SwRedlineAcceptDlg(m_xDialog, m_xBuilder.get(), m_xContentArea.get(), true));
-SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg()
-{
- disposeOnce();
+ SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
+ if (aDlgOpt.Exists())
+ {
+ css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem");
+ OUString sExtraData;
+ aUserItem >>= sExtraData;
+ m_xImplDlg->Initialize(sExtraData);
+ }
+ m_xImplDlg->Activate(); // for data's initialisation
}
-void SwModalRedlineAcceptDlg::dispose()
+SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg()
{
AcceptAll(false); // refuse everything remaining
- pImplDlg->FillInfo(GetExtraData());
- pImplDlg.reset();
- SfxModalDialog::dispose();
+ OUString sExtraData;
+ m_xImplDlg->FillInfo(sExtraData);
+ SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
+ aDlgOpt.SetUserItem("UserItem", css::uno::makeAny(sExtraData));
}
void SwModalRedlineAcceptDlg::Activate()
@@ -69,7 +76,7 @@ void SwModalRedlineAcceptDlg::Activate()
void SwModalRedlineAcceptDlg::AcceptAll( bool bAccept )
{
- SvxTPFilter* pFilterTP = pImplDlg->GetChgCtrl().GetFilterPage();
+ SvxTPFilter* pFilterTP = m_xImplDlg->GetChgCtrl().GetFilterPage();
if (pFilterTP->IsDate() || pFilterTP->IsAuthor() ||
pFilterTP->IsRange() || pFilterTP->IsAction())
@@ -78,10 +85,10 @@ void SwModalRedlineAcceptDlg::AcceptAll( bool bAccept )
pFilterTP->CheckAuthor(false);
pFilterTP->CheckRange(false);
pFilterTP->CheckAction(false);
- pImplDlg->FilterChangedHdl(nullptr);
+ m_xImplDlg->FilterChangedHdl(nullptr);
}
- pImplDlg->CallAcceptReject( false, bAccept );
+ m_xImplDlg->CallAcceptReject( false, bAccept );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx
index 7892fcb48fc6..dd74d1f13ecd 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -40,14 +40,14 @@ struct SwRedlineDataChild
{
const SwRedlineData* pChild; // link to original stacked data
const SwRedlineDataChild* pNext; // link to stacked data
- SvTreeListEntry* pTLBChild; // corresponding TreeListBox entry
+ std::unique_ptr<weld::TreeIter> xTLBChild; // corresponding TreeListBox entry
};
struct SwRedlineDataParent
{
const SwRedlineData* pData; // RedlineDataPtr
const SwRedlineDataChild* pNext; // link to stacked data
- SvTreeListEntry* pTLBParent; // corresponding TreeListBox entry
+ std::unique_ptr<weld::TreeIter> xTLBParent; // corresponding TreeListBox entry
OUString sComment; // redline comment
bool operator< ( const SwRedlineDataParent& rObj ) const
@@ -60,13 +60,10 @@ typedef std::vector<std::unique_ptr<SwRedlineDataChild>> SwRedlineDataChildArr;
class SW_DLLPUBLIC SwRedlineAcceptDlg final
{
- VclPtr<vcl::Window> m_pParentDlg;
+ std::shared_ptr<weld::Window> m_xParentDlg;
std::vector<std::unique_ptr<SwRedlineDataParent>> m_RedlineParents;
SwRedlineDataChildArr m_RedlineChildren;
SwRedlineDataParentSortArr m_aUsedSeqNo;
- VclPtr<SvxAcceptChgCtr> m_aTabPagesCTRL;
- VclPtr<PopupMenu> m_xPopup;
- Timer m_aDeselectTimer;
Timer m_aSelectTimer;
OUString const m_sInserted;
OUString const m_sDeleted;
@@ -75,32 +72,25 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg final
OUString const m_sFormatCollSet;
OUString m_sFilterAction;
OUString const m_sAutoFormat;
- VclPtr<SvxTPView> m_pTPView;
- VclPtr<SvxRedlinTable> m_pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
- Link<SvTreeListBox*,void> m_aOldSelectHdl;
- Link<SvTreeListBox*,void> m_aOldDeselectHdl;
bool m_bOnlyFormatedRedlines;
bool const m_bRedlnAutoFormat;
// prevent update dialog data during longer operations (cf #102657#)
bool m_bInhibitActivate;
- Image const m_aInserted;
- Image const m_aDeleted;
- Image const m_aFormated;
- Image const m_aTableChgd;
- Image const m_aFormatCollSet;
+ std::unique_ptr<SvxAcceptChgCtr> m_xTabPagesCTRL;
+ std::unique_ptr<weld::Menu> m_xPopup;
+ SvxTPView* m_pTPView;
+ SvxRedlinTable* m_pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
DECL_DLLPRIVATE_LINK( AcceptHdl, SvxTPView*, void );
DECL_DLLPRIVATE_LINK( AcceptAllHdl, SvxTPView*, void );
DECL_DLLPRIVATE_LINK( RejectHdl, SvxTPView*, void );
DECL_DLLPRIVATE_LINK( RejectAllHdl, SvxTPView*, void );
DECL_DLLPRIVATE_LINK( UndoHdl, SvxTPView*, void );
- DECL_DLLPRIVATE_LINK( DeselectHdl, SvTreeListBox*, void );
- DECL_DLLPRIVATE_LINK( SelectHdl, SvTreeListBox*, void );
- DECL_DLLPRIVATE_LINK( SelectTimerHdl, Timer*, void );
+ DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void );
DECL_DLLPRIVATE_LINK( GotoHdl, Timer*, void );
- DECL_DLLPRIVATE_LINK( CommandHdl, SvSimpleTable*, void );
+ DECL_DLLPRIVATE_LINK( CommandHdl, const CommandEvent&, bool );
SAL_DLLPRIVATE SwRedlineTable::size_type CalcDiff(SwRedlineTable::size_type nStart, bool bChild);
SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, const sal_uInt16 nAutoFormat);
@@ -108,21 +98,20 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg final
SAL_DLLPRIVATE void RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd);
SAL_DLLPRIVATE void InitAuthors();
- SAL_DLLPRIVATE static OUString GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0);
- SAL_DLLPRIVATE Image GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
+ SAL_DLLPRIVATE static OUString GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
- SAL_DLLPRIVATE static SwRedlineTable::size_type GetRedlinePos( const SvTreeListEntry& rEntry);
+ SAL_DLLPRIVATE SwRedlineTable::size_type GetRedlinePos(const weld::TreeIter& rEntry);
SwRedlineAcceptDlg(SwRedlineAcceptDlg const&) = delete;
SwRedlineAcceptDlg& operator=(SwRedlineAcceptDlg const&) = delete;
public:
- SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer *pBuilder, vcl::Window *pContentArea, bool bAutoFormat = false);
+ SwRedlineAcceptDlg(const std::shared_ptr<weld::Window>& rParent, weld::Builder *pBuilder, weld::Container *pContentArea, bool bAutoFormat = false);
~SwRedlineAcceptDlg();
DECL_LINK( FilterChangedHdl, SvxTPFilter*, void );
- SvxAcceptChgCtr& GetChgCtrl() { return *m_aTabPagesCTRL.get(); }
+ SvxAcceptChgCtr& GetChgCtrl() { return *m_xTabPagesCTRL.get(); }
bool HasRedlineAutoFormat() const { return m_bRedlnAutoFormat; }
void Init(SwRedlineTable::size_type nStart = 0);
@@ -134,15 +123,15 @@ public:
void Activate();
};
-class SwModelessRedlineAcceptDlg : public SfxModelessDialog
+class SwModelessRedlineAcceptDlg : public SfxModelessDialogController
{
- std::unique_ptr<SwRedlineAcceptDlg> pImplDlg;
+ std::unique_ptr<weld::Container> m_xContentArea;
+ std::unique_ptr<SwRedlineAcceptDlg> m_xImplDlg;
SwChildWinWrapper* pChildWin;
public:
- SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, vcl::Window *pParent);
+ SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, weld::Window *pParent);
virtual ~SwModelessRedlineAcceptDlg() override;
- virtual void dispose() override;
virtual void Activate() override;
virtual void FillInfo(SfxChildWinInfo&) const override;
@@ -166,6 +155,7 @@ public:
class SwRedlineAcceptPanel : public PanelLayout, public SfxListener
{
std::unique_ptr<SwRedlineAcceptDlg> mpImplDlg;
+ std::unique_ptr<weld::Container> mxContentArea;
public:
SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame);
virtual ~SwRedlineAcceptPanel() override;
diff --git a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx
index 6fc6032c538e..546f1c4a39dd 100644
--- a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx
+++ b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx
@@ -23,14 +23,14 @@
class SwRedlineAcceptDlg;
-class SwModalRedlineAcceptDlg : public SfxModalDialog
+class SwModalRedlineAcceptDlg : public SfxDialogController
{
- std::unique_ptr<SwRedlineAcceptDlg> pImplDlg;
+ std::unique_ptr<weld::Container> m_xContentArea;
+ std::unique_ptr<SwRedlineAcceptDlg> m_xImplDlg;
public:
- SwModalRedlineAcceptDlg(vcl::Window *pParent);
+ SwModalRedlineAcceptDlg(weld::Window *pParent);
virtual ~SwModalRedlineAcceptDlg() override;
- virtual void dispose() override;
void AcceptAll( bool bAccept );
virtual void Activate() override;
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx
index 652a9998f873..52ee334ec21d 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -114,7 +114,7 @@ SwHHCWrapper::~SwHHCWrapper()
{
m_pConvArgs.reset();
- SwViewShell::SetCareWin( nullptr );
+ SwViewShell::SetCareDialog(nullptr);
// check for existence of a draw view which means that there are
// (or previously were) draw objects present in the document.
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 6afaaa11712f..fa6ea10926a1 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -55,10 +55,7 @@
#include <IDocumentRedlineAccess.hxx>
#include <memory>
-SFX_IMPL_MODELESSDIALOG_WITHID( SwRedlineAcceptChild, FN_REDLINE_ACCEPT )
-
-static sal_uInt16 nSortMode = 0xffff;
-static bool bSortDir = true;
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(SwRedlineAcceptChild, FN_REDLINE_ACCEPT)
SwRedlineAcceptChild::SwRedlineAcceptChild(vcl::Window* _pParent,
sal_uInt16 nId,
@@ -66,9 +63,9 @@ SwRedlineAcceptChild::SwRedlineAcceptChild(vcl::Window* _pParent,
SfxChildWinInfo* pInfo)
: SwChildWinWrapper(_pParent, nId)
{
- SetWindow( VclPtr<SwModelessRedlineAcceptDlg>::Create( pBindings, this, _pParent) );
+ SetController(std::make_shared<SwModelessRedlineAcceptDlg>(pBindings, this, _pParent->GetFrameWeld()));
- static_cast<SwModelessRedlineAcceptDlg *>(GetWindow())->Initialize(pInfo);
+ static_cast<SwModelessRedlineAcceptDlg*>(GetController().get())->Initialize(pInfo);
}
// newly initialise dialog after document switch
@@ -76,18 +73,19 @@ bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh)
{
bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
if (bRet) // update immediately, doc switch!
- static_cast<SwModelessRedlineAcceptDlg*>(GetWindow())->Activate();
+ static_cast<SwModelessRedlineAcceptDlg*>(GetController().get())->Activate();
return bRet;
}
SwModelessRedlineAcceptDlg::SwModelessRedlineAcceptDlg(
- SfxBindings* _pBindings, SwChildWinWrapper* pChild, vcl::Window *_pParent)
- : SfxModelessDialog(_pBindings, pChild, _pParent,
- "AcceptRejectChangesDialog", "svx/ui/acceptrejectchangesdialog.ui")
- , pChildWin (pChild)
+ SfxBindings* _pBindings, SwChildWinWrapper* pChild, weld::Window *pParent)
+ : SfxModelessDialogController(_pBindings, pChild, pParent,
+ "svx/ui/acceptrejectchangesdialog.ui", "AcceptRejectChangesDialog")
+ , m_xContentArea(m_xDialog->weld_content_area())
+ , pChildWin(pChild)
{
- pImplDlg.reset(new SwRedlineAcceptDlg(this, this, get_content_area()));
+ m_xImplDlg.reset(new SwRedlineAcceptDlg(m_xDialog, m_xBuilder.get(), m_xContentArea.get()));
}
void SwModelessRedlineAcceptDlg::Activate()
@@ -112,46 +110,37 @@ void SwModelessRedlineAcceptDlg::Activate()
{ &aShow });
if (!bMod)
pSh->ResetModified();
- pImplDlg->Init();
- SfxModelessDialog::Activate();
+ m_xImplDlg->Init();
+ SfxModelessDialogController::Activate();
return;
}
- SfxModelessDialog::Activate();
- pImplDlg->Activate();
+ SfxModelessDialogController::Activate();
+ m_xImplDlg->Activate();
}
void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo* pInfo)
{
if (pInfo != nullptr)
- pImplDlg->Initialize(pInfo->aExtraString);
+ m_xImplDlg->Initialize(pInfo->aExtraString);
- SfxModelessDialog::Initialize(pInfo);
+ SfxModelessDialogController::Initialize(pInfo);
}
void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const
{
- SfxModelessDialog::FillInfo(rInfo);
- pImplDlg->FillInfo(rInfo.aExtraString);
+ SfxModelessDialogController::FillInfo(rInfo);
+ m_xImplDlg->FillInfo(rInfo.aExtraString);
}
SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg()
{
- disposeOnce();
-}
-
-void SwModelessRedlineAcceptDlg::dispose()
-{
- pImplDlg.reset();
- SfxModelessDialog::dispose();
}
-SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer *pBuilder,
- vcl::Window *pContentArea, bool bAutoFormat)
- : m_pParentDlg(pParent)
- , m_aTabPagesCTRL(VclPtr<SvxAcceptChgCtr>::Create(pContentArea, pBuilder))
- , m_xPopup(pBuilder->get_menu("writermenu"))
+SwRedlineAcceptDlg::SwRedlineAcceptDlg(const std::shared_ptr<weld::Window>& rParent, weld::Builder *pBuilder,
+ weld::Container *pContentArea, bool bAutoFormat)
+ : m_xParentDlg(rParent)
, m_sInserted(SwResId(STR_REDLINE_INSERTED))
, m_sDeleted(SwResId(STR_REDLINE_DELETED))
, m_sFormated(SwResId(STR_REDLINE_FORMATTED))
@@ -161,18 +150,15 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer
, m_bOnlyFormatedRedlines(false)
, m_bRedlnAutoFormat(bAutoFormat)
, m_bInhibitActivate(false)
- , m_aInserted(StockImage::Yes, BMP_REDLINE_INSERTED)
- , m_aDeleted(StockImage::Yes, BMP_REDLINE_DELETED)
- , m_aFormated(StockImage::Yes, BMP_REDLINE_FORMATTED)
- , m_aTableChgd(StockImage::Yes, BMP_REDLINE_TABLECHG)
- , m_aFormatCollSet(StockImage::Yes, BMP_REDLINE_FMTCOLLSET)
+ , m_xTabPagesCTRL(new SvxAcceptChgCtr(pContentArea, pBuilder))
+ , m_xPopup(pBuilder->weld_menu("writermenu"))
{
- m_aTabPagesCTRL->SetHelpId(HID_REDLINE_CTRL);
- m_pTPView = m_aTabPagesCTRL->GetViewPage();
+ m_xTabPagesCTRL->set_help_id(HID_REDLINE_CTRL);
+ m_pTPView = m_xTabPagesCTRL->GetViewPage();
m_pTable = m_pTPView->GetTableControl();
+ m_pTable->SetWriterView();
- m_pTPView->InsertWriterHeader();
m_pTPView->SetAcceptClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptHdl));
m_pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptAllHdl));
m_pTPView->SetRejectClickHdl(LINK(this, SwRedlineAcceptDlg, RejectHdl));
@@ -184,40 +170,29 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer
m_pTPView->EnableAcceptAll(false);
m_pTPView->EnableRejectAll(false);
- m_aTabPagesCTRL->GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
+ m_xTabPagesCTRL->GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
- ListBox *pActLB = m_aTabPagesCTRL->GetFilterPage()->GetLbAction();
- pActLB->InsertEntry(m_sInserted);
- pActLB->InsertEntry(m_sDeleted);
- pActLB->InsertEntry(m_sFormated);
- pActLB->InsertEntry(m_sTableChgd);
+ weld::ComboBox* pActLB = m_xTabPagesCTRL->GetFilterPage()->GetLbAction();
+ pActLB->append_text(m_sInserted);
+ pActLB->append_text(m_sDeleted);
+ pActLB->append_text(m_sFormated);
+ pActLB->append_text(m_sTableChgd);
if (HasRedlineAutoFormat())
{
- pActLB->InsertEntry(m_sFormatCollSet);
- pActLB->InsertEntry(m_sAutoFormat);
+ pActLB->append_text(m_sFormatCollSet);
+ pActLB->append_text(m_sAutoFormat);
m_pTPView->ShowUndo();
m_pTPView->DisableUndo(); // no UNDO events yet
}
- pActLB->SelectEntryPos(0);
+ pActLB->set_active(0);
- m_pTable->SetStyle(m_pTable->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
- m_pTable->SetNodeDefaultImages();
- m_pTable->SetSelectionMode(SelectionMode::Multiple);
- m_pTable->SetHighlightRange(1);
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ rTreeView.set_selection_mode(SelectionMode::Multiple);
- m_pTable->SortByCol(nSortMode, bSortDir);
-
- m_aOldSelectHdl = m_pTable->GetSelectHdl();
- m_aOldDeselectHdl = m_pTable->GetDeselectHdl();
- m_pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
- m_pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
- m_pTable->SetCommandHdl(LINK(this, SwRedlineAcceptDlg, CommandHdl));
-
- // avoid flickering of buttons:
- m_aDeselectTimer.SetTimeout(100);
- m_aDeselectTimer.SetInvokeHandler(LINK(this, SwRedlineAcceptDlg, SelectTimerHdl));
+ rTreeView.connect_changed(LINK(this, SwRedlineAcceptDlg, SelectHdl));
+ rTreeView.connect_popup_menu(LINK(this, SwRedlineAcceptDlg, CommandHdl));
// avoid multiple selection of the same texts:
m_aSelectTimer.SetTimeout(100);
@@ -226,43 +201,43 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer
SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
{
- m_aTabPagesCTRL.disposeAndClear();
}
void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart)
{
SwWait aWait( *::GetActiveView()->GetDocShell(), false );
- m_pTable->SetUpdateMode(false);
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
m_aUsedSeqNo.clear();
+ rTreeView.freeze();
if (nStart)
RemoveParents(nStart, m_RedlineParents.size() - 1);
else
{
- m_pTable->Clear();
+ rTreeView.clear();
m_RedlineChildren.clear();
m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.end());
}
+ rTreeView.thaw();
// insert parents
InsertParents(nStart);
InitAuthors();
- m_pTable->SetUpdateMode(true);
// #i69618# this moves the list box to the right position, visually
- SvTreeListEntry* pSelEntry = m_pTable->FirstSelected();
- if( pSelEntry )
- m_pTable->MakeVisible( pSelEntry, true ); //#i70937#, force the scroll
+ std::unique_ptr<weld::TreeIter> xSelEntry(rTreeView.make_iterator());
+ if (rTreeView.get_selected(xSelEntry.get()))
+ rTreeView.scroll_to_row(*xSelEntry); //#i70937#, force the scroll
}
void SwRedlineAcceptDlg::InitAuthors()
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
- if (!m_aTabPagesCTRL)
+ if (!m_xTabPagesCTRL)
return;
- SvxTPFilter *pFilterPage = m_aTabPagesCTRL->GetFilterPage();
+ SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage();
std::vector<OUString> aStrings;
OUString sOldAuthor(pFilterPage->GetSelectedAuthor());
@@ -298,23 +273,22 @@ void SwRedlineAcceptDlg::InitAuthors()
if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && !aStrings.empty())
pFilterPage->SelectAuthor(aStrings[0]);
- bool bEnable = m_pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength();
- bool bSel = m_pTable->FirstSelected() != nullptr;
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ bool bEnable = rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength();
+ bool bSel = rTreeView.get_selected(nullptr);
- SvTreeListEntry* pSelEntry = m_pTable->FirstSelected();
- while (pSelEntry)
- {
+ rTreeView.selected_foreach([this, pSh, &bIsNotFormated](weld::TreeIter& rEntry){
// find the selected redline
// (fdo#57874: ignore, if the redline is already gone)
- SwRedlineTable::size_type nPos = GetRedlinePos(*pSelEntry);
+ SwRedlineTable::size_type nPos = GetRedlinePos(rEntry);
if( nPos != SwRedlineTable::npos )
{
const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
}
- pSelEntry = m_pTable->NextSelected(pSelEntry);
- }
+ return false;
+ });
m_pTPView->EnableAccept( bEnable && bSel );
m_pTPView->EnableReject( bEnable && bSel );
@@ -325,35 +299,19 @@ void SwRedlineAcceptDlg::InitAuthors()
m_bOnlyFormatedRedlines );
}
-OUString SwRedlineAcceptDlg::GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack)
-{
- OUString sEntry(rRedln.GetAuthorString(nStack));
- sEntry += "\t";
-
- const DateTime &rDT = rRedln.GetTimeStamp(nStack);
- rDateTime = rDT;
-
- sEntry += GetAppLangDateTimeString( rDT );
- sEntry += "\t";
-
- sEntry += rRedln.GetComment(nStack);
-
- return sEntry;
-}
-
-Image SwRedlineAcceptDlg::GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack)
+OUString SwRedlineAcceptDlg::GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack)
{
switch (rRedln.GetType(nStack))
{
- case nsRedlineType_t::REDLINE_INSERT: return m_aInserted;
- case nsRedlineType_t::REDLINE_DELETE: return m_aDeleted;
- case nsRedlineType_t::REDLINE_FORMAT: return m_aFormated;
- case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: return m_aFormated;
- case nsRedlineType_t::REDLINE_TABLE: return m_aTableChgd;
- case nsRedlineType_t::REDLINE_FMTCOLL: return m_aFormatCollSet;
+ case nsRedlineType_t::REDLINE_INSERT: return BMP_REDLINE_INSERTED;
+ case nsRedlineType_t::REDLINE_DELETE: return BMP_REDLINE_DELETED;
+ case nsRedlineType_t::REDLINE_FORMAT: return BMP_REDLINE_FORMATTED;
+ case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: return BMP_REDLINE_FORMATTED;
+ case nsRedlineType_t::REDLINE_TABLE: return BMP_REDLINE_TABLECHG;
+ case nsRedlineType_t::REDLINE_FMTCOLL: return BMP_REDLINE_FMTCOLLSET;
}
- return Image();
+ return OUString();
}
OUString SwRedlineAcceptDlg::GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack)
@@ -453,6 +411,7 @@ void SwRedlineAcceptDlg::Activate()
}
// check comment
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
for (SwRedlineTable::size_type i = 0; i < nCount; i++)
{
const SwRangeRedline& rRedln = pSh->GetRedline(i);
@@ -460,11 +419,11 @@ void SwRedlineAcceptDlg::Activate()
if(rRedln.GetComment() != pParent->sComment)
{
- if (pParent->pTLBParent)
+ if (pParent->xTLBParent)
{
// update only comment
const OUString& sComment(rRedln.GetComment());
- m_pTable->SetEntryText(sComment.replace('\n', ' '), pParent->pTLBParent, 3);
+ rTreeView.set_text(*pParent->xTLBParent, sComment.replace('\n', ' '), 3);
}
pParent->sComment = rRedln.GetComment();
}
@@ -481,7 +440,8 @@ SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type
return SwRedlineTable::npos;
}
- m_pTable->SetUpdateMode(false);
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ rTreeView.freeze();
SwView *pView = ::GetActiveView();
SwWrtShell* pSh = pView->GetWrtShellPtr();
sal_uInt16 nAutoFormat = HasRedlineAutoFormat() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
@@ -497,8 +457,8 @@ SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type
while (pBackupData)
{
pNext = const_cast<SwRedlineDataChild*>(pBackupData->pNext);
- if (pBackupData->pTLBChild)
- m_pTable->RemoveEntry(pBackupData->pTLBChild);
+ if (pBackupData->xTLBChild)
+ rTreeView.remove(*pBackupData->xTLBChild);
auto it = std::find_if(m_RedlineChildren.begin(), m_RedlineChildren.end(),
[&pBackupData](const std::unique_ptr<SwRedlineDataChild>& rChildPtr) { return rChildPtr.get() == pBackupData; });
@@ -512,7 +472,7 @@ SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type
// insert new children
InsertChildren(pParent, rRedln, nAutoFormat);
- m_pTable->SetUpdateMode(true);
+ rTreeView.thaw();
return nStart;
}
@@ -524,7 +484,7 @@ SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type
{
// remove entries from nStart to i-1
RemoveParents(nStart, i - 1);
- m_pTable->SetUpdateMode(true);
+ rTreeView.thaw();
return nStart - 1;
}
}
@@ -539,23 +499,24 @@ SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type
{
// insert entries from nStart to i-1
InsertParents(nStart, i - 1);
- m_pTable->SetUpdateMode(true);
+ rTreeView.thaw();
return nStart - 1;
}
}
- m_pTable->SetUpdateMode(true);
+ rTreeView.thaw();
Init(nStart); // adjust all entries until the end
return SwRedlineTable::npos;
}
void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, const sal_uInt16 nAutoFormat)
{
- OUString sChild;
SwRedlineDataChild *pLastRedlineChild = nullptr;
const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
bool bAutoFormat = (rRedln.GetRealType() & nAutoFormat) != 0;
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+
OUString sAction = GetActionText(rRedln);
bool bValidParent = m_sFilterAction.isEmpty() || m_sFilterAction == sAction;
bValidParent = bValidParent && m_pTable->IsValidEntry(rRedln.GetAuthorString(), rRedln.GetTimeStamp(), rRedln.GetComment());
@@ -568,12 +529,11 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
= m_aUsedSeqNo.insert(pParent);
if (ret.second) // already there
{
- if (pParent->pTLBParent)
+ if (pParent->xTLBParent)
{
- m_pTable->SetEntryText(
- m_sAutoFormat, (*ret.first)->pTLBParent, 0);
- m_pTable->RemoveEntry(pParent->pTLBParent);
- pParent->pTLBParent = nullptr;
+ rTreeView.set_text(*(*ret.first)->xTLBParent, m_sAutoFormat, 0);
+ rTreeView.remove(*pParent->xTLBParent);
+ pParent->xTLBParent.reset();
}
return;
}
@@ -607,17 +567,29 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
std::unique_ptr<RedlinData> pData(new RedlinData);
pData->pData = pRedlineChild;
pData->bDisabled = true;
- sChild = GetRedlineText(rRedln, pData->aDateTime, nStack);
- SvTreeListEntry* pChild = m_pTable->InsertEntry(GetActionImage(rRedln, nStack),
- sChild, std::move(pData), pParent->pTLBParent);
+ OUString sImage(GetActionImage(rRedln, nStack));
+ OUString sAuthor = rRedln.GetAuthorString(nStack);
+ pData->aDateTime = rRedln.GetTimeStamp(nStack);
+ OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
+ OUString sComment = rRedln.GetComment(nStack);
- pRedlineChild->pTLBChild = pChild;
+ std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator());
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData.release())));
+ rTreeView.insert(pParent->xTLBParent.get(), -1, nullptr, &sId, nullptr, nullptr,
+ nullptr, false, xChild.get());
+
+ rTreeView.set_image(*xChild, sImage, -1);
+ rTreeView.set_text(*xChild, sAuthor, 1);
+ rTreeView.set_text(*xChild, sDateEntry, 2);
+ rTreeView.set_text(*xChild, sComment, 3);
+
+ pRedlineChild->xTLBChild = std::move(xChild);
if (!bValidParent)
- m_pTable->Expand(pParent->pTLBParent);
+ rTreeView.expand_row(*pParent->xTLBParent);
}
else
- pRedlineChild->pTLBChild = nullptr;
+ pRedlineChild->xTLBChild.reset();
pLastRedlineChild = pRedlineChild;
}
@@ -625,10 +597,10 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
if (pLastRedlineChild)
pLastRedlineChild->pNext = nullptr;
- if (!bValidTree && pParent->pTLBParent)
+ if (!bValidTree && pParent->xTLBParent)
{
- m_pTable->RemoveEntry(pParent->pTLBParent);
- pParent->pTLBParent = nullptr;
+ rTreeView.remove(*pParent->xTLBParent);
+ pParent->xTLBParent.reset();
if (nAutoFormat)
m_aUsedSeqNo.erase(pParent);
}
@@ -639,28 +611,31 @@ void SwRedlineAcceptDlg::RemoveParents(SwRedlineTable::size_type nStart, SwRedli
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
SwRedlineTable::size_type nCount = pSh->GetRedlineCount();
- std::vector<SvTreeListEntry*> aLBoxArr;
+ std::vector<const weld::TreeIter*> aLBoxArr;
+
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
// because of Bug of TLB that ALWAYS calls the SelectHandler at Remove:
- m_pTable->SetSelectHdl(m_aOldSelectHdl);
- m_pTable->SetDeselectHdl(m_aOldDeselectHdl);
+ rTreeView.connect_changed(Link<weld::TreeView&,void>());
+
bool bChildrenRemoved = false;
- m_pTable->SelectAll(false);
+ rTreeView.thaw();
+ rTreeView.unselect_all();
// set the cursor after the last entry because otherwise performance problem in TLB.
// TLB would otherwise reset the cursor at every Remove (expensive)
SwRedlineTable::size_type nPos = std::min(nCount, m_RedlineParents.size());
- SvTreeListEntry *pCurEntry = nullptr;
+ weld::TreeIter *pCurEntry = nullptr;
while( ( pCurEntry == nullptr ) && ( nPos > 0 ) )
{
--nPos;
- pCurEntry = m_RedlineParents[nPos]->pTLBParent;
+ pCurEntry = m_RedlineParents[nPos]->xTLBParent.get();
}
if (pCurEntry)
- m_pTable->SetCurEntry(pCurEntry);
+ rTreeView.set_cursor(*pCurEntry);
- SvTreeList* pModel = m_pTable->GetModel();
+ rTreeView.freeze();
for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++)
{
@@ -683,27 +658,26 @@ void SwRedlineAcceptDlg::RemoveParents(SwRedlineTable::size_type nStart, SwRedli
bChildrenRemoved = true;
}
}
- SvTreeListEntry *const pEntry = m_RedlineParents[i]->pTLBParent;
+ weld::TreeIter *const pEntry = m_RedlineParents[i]->xTLBParent.get();
if (pEntry)
- {
- long nIdx = aLBoxArr.size() - 1;
- sal_uLong nAbsPos = pModel->GetAbsPos(pEntry);
- while (nIdx >= 0 &&
- pModel->GetAbsPos(aLBoxArr[ static_cast< sal_uInt16 >(nIdx) ]) > nAbsPos)
- nIdx--;
- aLBoxArr.insert( aLBoxArr.begin() + static_cast< sal_uInt16 >(++nIdx) , pEntry);
- }
+ aLBoxArr.push_back(pEntry);
}
+ std::sort(aLBoxArr.begin(), aLBoxArr.end(), [&rTreeView](const weld::TreeIter* a, const weld::TreeIter* b) {
+ return rTreeView.iter_compare(*a, *b) == -1;
+ });
// clear TLB from behind
- long nIdx = static_cast<long>(aLBoxArr.size()) - 1;
- while (nIdx >= 0)
- m_pTable->RemoveEntry(aLBoxArr[ static_cast< sal_uInt16 >(nIdx--) ]);
+ for (auto it = aLBoxArr.rbegin(); it != aLBoxArr.rend(); ++it)
+ {
+ const weld::TreeIter* pIter = *it;
+ rTreeView.remove(*pIter);
+ }
- m_pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
- m_pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
+ rTreeView.thaw();
+ rTreeView.connect_changed(LINK(this, SwRedlineAcceptDlg, SelectHdl));
// unfortunately by Remove it was selected from the TLB always again ...
- m_pTable->SelectAll(false);
+ rTreeView.unselect_all();
+ rTreeView.freeze();
m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.begin() + nEnd + 1);
}
@@ -714,17 +688,17 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli
SwWrtShell* pSh = pView->GetWrtShellPtr();
sal_uInt16 nAutoFormat = HasRedlineAutoFormat() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
- OUString sParent;
SwRedlineTable::size_type nCount = pSh->GetRedlineCount();
nEnd = std::min(nEnd, (nCount - 1)); // also treats nEnd=SwRedlineTable::npos (until the end)
if (nEnd == SwRedlineTable::npos)
return; // no redlines in the document
- SvTreeListEntry *pParent;
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+
SwRedlineDataParent* pRedlineParent;
const SwRangeRedline* pCurrRedline;
- if( !nStart && !m_pTable->FirstSelected() )
+ if (!nStart && !rTreeView.get_selected(nullptr))
{
pCurrRedline = pSh->GetCurrRedline();
if( !pCurrRedline )
@@ -738,6 +712,7 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli
else
pCurrRedline = nullptr;
+ rTreeView.freeze();
for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++)
{
const SwRangeRedline& rRedln = pSh->GetRedline(i);
@@ -755,28 +730,42 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli
pData->pData = pRedlineParent;
pData->bDisabled = false;
- sParent = GetRedlineText(rRedln, pData->aDateTime);
- pParent = m_pTable->InsertEntry(GetActionImage(rRedln), sParent, std::move(pData), nullptr, i);
- if( pCurrRedline == &rRedln )
+ OUString sImage = GetActionImage(rRedln);
+ OUString sAuthor = rRedln.GetAuthorString(0);
+ pData->aDateTime = rRedln.GetTimeStamp(0);
+ OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
+
+ OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pData.release()));
+ std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator());
+ rTreeView.insert(nullptr, i, nullptr, &sId, nullptr, nullptr, nullptr, false, xParent.get());
+
+ rTreeView.set_image(*xParent, sImage, -1);
+ rTreeView.set_text(*xParent, sAuthor, 1);
+ rTreeView.set_text(*xParent, sDateEntry, 2);
+ rTreeView.set_text(*xParent, sComment, 3);
+
+ if (pCurrRedline == &rRedln)
{
- m_pTable->SetCurEntry( pParent );
- m_pTable->Select( pParent );
- m_pTable->MakeVisible( pParent );
+ rTreeView.thaw();
+ rTreeView.set_cursor(*xParent);
+ rTreeView.select(*xParent);
+ rTreeView.scroll_to_row(*xParent);
+ rTreeView.freeze();
}
- pRedlineParent->pTLBParent = pParent;
+ pRedlineParent->xTLBParent = std::move(xParent);
InsertChildren(pRedlineParent, rRedln, nAutoFormat);
}
+ rTreeView.thaw();
}
void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
- SvTreeListEntry* pEntry = bSelect ? m_pTable->FirstSelected() : m_pTable->First();
- sal_uLong nPos = LONG_MAX;
+ int nPos = -1;
- typedef std::vector<SvTreeListEntry*> ListBoxEntries_t;
+ typedef std::vector<std::unique_ptr<weld::TreeIter>> ListBoxEntries_t;
ListBoxEntries_t aRedlines;
// don't activate
@@ -784,15 +773,15 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
"recursive call of CallAcceptReject?");
m_bInhibitActivate = true;
- // collect redlines-to-be-accepted/rejected in aRedlines vector
- while( pEntry )
- {
- if( !m_pTable->GetParent( pEntry ) )
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+
+ auto lambda = [this, pSh, bSelect, bAccept, &rTreeView, &nPos, &aRedlines](weld::TreeIter& rEntry) {
+ if (!rTreeView.get_iter_depth(rEntry))
{
- if( bSelect && LONG_MAX == nPos )
- nPos = m_pTable->GetModel()->GetAbsPos( pEntry );
+ if (bSelect && nPos == -1)
+ nPos = rTreeView.get_iter_index_in_parent(rEntry);
- RedlinData *pData = static_cast<RedlinData *>(pEntry->GetUserData());
+ RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64());
bool bIsNotFormatted = true;
@@ -802,19 +791,24 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
// with the extended button label "Reject All/Clear formatting")
if ( !bSelect && !bAccept && !m_bOnlyFormatedRedlines )
{
- SwRedlineTable::size_type nPosition = GetRedlinePos( *pEntry );
+ SwRedlineTable::size_type nPosition = GetRedlinePos(rEntry);
const SwRangeRedline& rRedln = pSh->GetRedline(nPosition);
if( nsRedlineType_t::REDLINE_FORMAT == rRedln.GetType() )
bIsNotFormatted = false;
}
- if( !pData->bDisabled && bIsNotFormatted )
- aRedlines.push_back( pEntry );
+ if (!pData->bDisabled && bIsNotFormatted)
+ aRedlines.emplace_back(rTreeView.make_iterator(&rEntry));
}
+ return false;
+ };
- pEntry = bSelect ? m_pTable->NextSelected(pEntry) : m_pTable->Next(pEntry);
- }
+ // collect redlines-to-be-accepted/rejected in aRedlines vector
+ if (bSelect)
+ rTreeView.selected_foreach(lambda);
+ else
+ rTreeView.all_foreach(lambda);
bool (SwEditShell:: *FnAccRej)( SwRedlineTable::size_type ) = &SwEditShell::AcceptRedline;
if( !bAccept )
@@ -862,28 +856,23 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
m_bInhibitActivate = false;
Activate();
- if( ULONG_MAX != nPos && m_pTable->GetEntryCount() )
+ if (nPos != -1 && rTreeView.n_children())
{
- if( nPos >= m_pTable->GetEntryCount() )
- nPos = m_pTable->GetEntryCount() - 1;
- pEntry = m_pTable->GetEntryAtAbsPos( nPos );
- if( !pEntry && nPos-- )
- pEntry = m_pTable->GetEntryAtAbsPos( nPos );
- if( pEntry )
- {
- m_pTable->Select( pEntry );
- m_pTable->MakeVisible( pEntry );
- m_pTable->SetCurEntry(pEntry);
- }
+ if (nPos >= rTreeView.n_children())
+ nPos = rTreeView.n_children() - 1;
+ rTreeView.select(nPos);
+ rTreeView.scroll_to_row(nPos);
+ rTreeView.set_cursor(nPos);
}
m_pTPView->EnableUndo();
}
-SwRedlineTable::size_type SwRedlineAcceptDlg::GetRedlinePos( const SvTreeListEntry& rEntry )
+SwRedlineTable::size_type SwRedlineAcceptDlg::GetRedlinePos(const weld::TreeIter& rEntry)
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
- return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(static_cast<RedlinData *>(
- rEntry.GetUserData())->pData)->pData );
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(reinterpret_cast<RedlinData*>(
+ rTreeView.get_id(rEntry).toInt64())->pData)->pData );
}
IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptHdl, SvxTPView*, void)
@@ -918,30 +907,18 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, UndoHdl, SvxTPView*, void)
IMPL_LINK_NOARG(SwRedlineAcceptDlg, FilterChangedHdl, SvxTPFilter*, void)
{
- SvxTPFilter *pFilterTP = m_aTabPagesCTRL->GetFilterPage();
+ SvxTPFilter *pFilterTP = m_xTabPagesCTRL->GetFilterPage();
if (pFilterTP->IsAction())
- m_sFilterAction = pFilterTP->GetLbAction()->GetSelectedEntry();
+ m_sFilterAction = pFilterTP->GetLbAction()->get_active_text();
else
m_sFilterAction.clear();
Init();
}
-IMPL_LINK_NOARG(SwRedlineAcceptDlg, DeselectHdl, SvTreeListBox*, void)
-{
- // avoid flickering of buttons:
- m_aDeselectTimer.Start();
-}
-
-IMPL_LINK_NOARG(SwRedlineAcceptDlg, SelectHdl, SvTreeListBox*, void)
+IMPL_LINK_NOARG(SwRedlineAcceptDlg, SelectHdl, weld::TreeView&, void)
{
- SelectTimerHdl(nullptr);
-}
-
-IMPL_LINK_NOARG(SwRedlineAcceptDlg, SelectTimerHdl, Timer *, void)
-{
- m_aDeselectTimer.Stop();
m_aSelectTimer.Start();
}
@@ -957,55 +934,50 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void)
//#107938# But not only ask pTable if it has the focus. To move
// the selection to the selected redline any child of pParentDlg
// may the focus.
- SvTreeListEntry* pSelEntry = nullptr;
-
- if (m_pParentDlg->HasChildPathFocus())
- pSelEntry = m_pTable->FirstSelected();
-
- if( pSelEntry )
+ if (!m_xParentDlg || m_xParentDlg->has_toplevel_focus())
{
- SvTreeListEntry* pActEntry = pSelEntry;
- pSh->StartAction();
- pSh->EnterStdMode();
- SwViewShell::SetCareWin(m_pParentDlg);
-
- while (pSelEntry)
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ std::unique_ptr<weld::TreeIter> xActEntry(rTreeView.make_iterator());
+ if (rTreeView.get_selected(xActEntry.get()))
{
- if (m_pTable->GetParent(pSelEntry))
- {
- pActEntry = m_pTable->GetParent(pSelEntry);
+ pSh->StartAction();
+ pSh->EnterStdMode();
+ SwViewShell::SetCareDialog(m_xParentDlg);
- if (m_pTable->IsSelected(pActEntry))
+ rTreeView.selected_foreach([this, pSh, &rTreeView, &xActEntry, &bIsNotFormated, &bSel](weld::TreeIter& rEntry){
+ rTreeView.copy_iterator(rEntry, *xActEntry);
+ if (rTreeView.get_iter_depth(rEntry))
{
- pSelEntry = pActEntry = m_pTable->NextSelected(pSelEntry);
- continue; // don't select twice
+ rTreeView.iter_parent(*xActEntry);
+ if (rTreeView.is_selected(*xActEntry))
+ return false; // don't select twice
}
- }
- else
- bSel = true;
+ else
+ bSel = true;
- // #98864# find the selected redline (ignore, if the redline is already gone)
- SwRedlineTable::size_type nPos = GetRedlinePos(*pActEntry);
- if( nPos != SwRedlineTable::npos )
- {
+ // #98864# find the selected redline (ignore, if the redline is already gone)
+ SwRedlineTable::size_type nPos = GetRedlinePos(*xActEntry);
+ if (nPos != SwRedlineTable::npos)
+ {
- const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
- bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
+ const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
+ bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
- if (pSh->GotoRedline(nPos, true))
- {
- pSh->SetInSelect();
- pSh->EnterAddMode();
+ if (pSh->GotoRedline(nPos, true))
+ {
+ pSh->SetInSelect();
+ pSh->EnterAddMode();
+ }
}
- }
+ return false;
+ });
- pSelEntry = pActEntry = m_pTable->NextSelected(pSelEntry);
+ pSh->LeaveAddMode();
+ pSh->EndAction();
+ SwViewShell::SetCareDialog(nullptr);
}
-
- pSh->LeaveAddMode();
- pSh->EndAction();
- SwViewShell::SetCareWin(nullptr);
}
+
bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength();
m_pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ );
m_pTPView->EnableReject( bEnable && bSel /*&& !bReadonlySel*/ );
@@ -1014,25 +986,25 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void)
m_pTPView->EnableClearFormatAll( bEnable && m_bOnlyFormatedRedlines );
}
-IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
+IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
{
- const CommandEvent aCEvt(m_pTable->GetCommandEvent());
-
- if (aCEvt.GetCommand() != CommandEventId::ContextMenu)
- return;
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
+ return false;
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
- SvTreeListEntry* pEntry = m_pTable->FirstSelected();
const SwRangeRedline *pRed = nullptr;
- if (pEntry)
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
+ bool bEntry = rTreeView.get_selected(xEntry.get());
+ if (bEntry)
{
- SvTreeListEntry* pTopEntry = pEntry;
+ std::unique_ptr<weld::TreeIter> xTopEntry(rTreeView.make_iterator(xEntry.get()));
- if (m_pTable->GetParent(pEntry))
- pTopEntry = m_pTable->GetParent(pEntry);
+ if (rTreeView.get_iter_depth(*xTopEntry))
+ rTreeView.iter_parent(*xTopEntry);
- SwRedlineTable::size_type nPos = GetRedlinePos(*pTopEntry);
+ SwRedlineTable::size_type nPos = GetRedlinePos(*xTopEntry);
// disable commenting for protected areas
if (nPos != SwRedlineTable::npos && (pRed = pSh->GotoRedline(nPos, true)) != nullptr)
@@ -1043,37 +1015,29 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
}
}
- const sal_uInt16 nEditId = m_xPopup->GetItemId("writeredit");
-
- m_xPopup->EnableItem(nEditId, pEntry && pRed &&
- !m_pTable->GetParent(pEntry) &&
- !m_pTable->NextSelected(pEntry));
-
- sal_uInt16 nColumn = m_pTable->GetSortedCol();
- if (nColumn == 0xffff)
+ m_xPopup->set_sensitive("writeredit", bEntry && pRed &&
+ !rTreeView.get_iter_depth(*xEntry) &&
+ rTreeView.count_selected_rows() == 1);
+ m_xPopup->set_sensitive("writersort", rTreeView.n_children() != 0);
+ int nColumn = rTreeView.get_sort_column();
+ if (nColumn == -1)
nColumn = 4;
+ for (sal_Int32 i = 0; i < 5; ++i)
+ m_xPopup->set_active(OString("writersort") + OString::number(i), i == nColumn);
- const sal_uInt16 nSubSortId = m_xPopup->GetItemId("writersort");
- m_xPopup->EnableItem(nSubSortId, m_pTable->First() != nullptr);
- PopupMenu *pSubMenu = m_xPopup->GetPopupMenu(nSubSortId);
- const sal_uInt16 nActionId = pSubMenu->GetItemId("writeraction");
- for (sal_uInt16 i = nActionId; i < nActionId + 5; ++i)
- pSubMenu->CheckItem(i, false);
- pSubMenu->CheckItem(nActionId + nColumn);
-
- sal_uInt16 nRet = m_xPopup->Execute(m_pTable, aCEvt.GetMousePosPixel());
+ OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
- if (nRet == nEditId)
+ if (sCommand == "writeredit")
{
- if (pEntry)
+ if (bEntry)
{
- if (m_pTable->GetParent(pEntry))
- pEntry = m_pTable->GetParent(pEntry);
+ if (rTreeView.get_iter_depth(*xEntry))
+ rTreeView.iter_parent(*xEntry);
- SwRedlineTable::size_type nPos = GetRedlinePos(*pEntry);
+ SwRedlineTable::size_type nPos = GetRedlinePos(*xEntry);
if (nPos == SwRedlineTable::npos)
- return;
+ return true;
const SwRangeRedline &rRedline = pSh->GetRedline(nPos);
@@ -1096,7 +1060,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
rRedline.GetRedlineData().GetTimeStamp() ),
SID_ATTR_POSTIT_DATE ));
- ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog(m_pParentDlg->GetFrameWeld(), aSet));
+ ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog(&rTreeView, aSet));
pDlg->HideAuthor();
@@ -1132,7 +1096,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
// insert / change comment
pSh->SetRedlineComment(sMsg);
- m_pTable->SetEntryText(sMsg.replace('\n', ' '), pEntry, 3);
+ rTreeView.set_text(*xEntry, sMsg.replace('\n', ' '), 3);
Init();
}
@@ -1140,24 +1104,21 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
pDlg.disposeAndClear();
}
}
- else if (nRet)
+ else if (!sCommand.isEmpty())
{
- bSortDir = true;
- if (nRet - nActionId == 4 && m_pTable->GetSortedCol() == 0xffff)
- return; // we already have it
+ int nSortMode = sCommand.copy(10).toInt32();
- nSortMode = nRet - nActionId;
+ if (nSortMode == 4 && nColumn == 4)
+ return true; // we already have it
if (nSortMode == 4)
- nSortMode = 0xffff; // unsorted / sorted by position
-
- if (m_pTable->GetSortedCol() == nSortMode)
- bSortDir = !m_pTable->GetSortDirection();
+ nSortMode = -1; // unsorted / sorted by position
SwWait aWait( *::GetActiveView()->GetDocShell(), false );
- m_pTable->SortByCol(nSortMode, bSortDir);
- if (nSortMode == 0xffff)
+ m_pTable->HeaderBarClick(nSortMode);
+ if (nSortMode == -1)
Init(); // newly fill everything
}
+ return true;
}
namespace
@@ -1196,13 +1157,26 @@ void SwRedlineAcceptDlg::Initialize(OUString& rExtraString)
OUString aStr = lcl_StripAcceptChgDat(rExtraString);
if (!aStr.isEmpty())
{
- sal_uInt16 nCount = static_cast<sal_uInt16>(aStr.toInt32());
-
- for (sal_uInt16 i = 0; i < nCount; ++i)
+ int nCount = aStr.toInt32();
+ if (nCount > 2)
{
- sal_Int32 n1 = aStr.indexOf(';');
- aStr = aStr.copy(n1 + 1);
- m_pTable->SetTab(i, aStr.toInt32(), MapUnit::MapPixel);
+ std::vector<int> aEndPos;
+
+ for (int i = 0; i < nCount; ++i)
+ {
+ sal_Int32 n1 = aStr.indexOf(';');
+ aStr = aStr.copy( n1+1 );
+ aEndPos.push_back(aStr.toInt32());
+ }
+
+ std::vector<int> aWidths;
+ for (int i = 1; i < nCount; ++i)
+ aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
+
+ // turn column end points back to column widths, ignoring the small
+ // value used for the the expander column
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ rTreeView.set_column_fixed_widths(aWidths);
}
}
}
@@ -1214,22 +1188,33 @@ void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) const
lcl_StripAcceptChgDat(rExtraData);
rExtraData += "AcceptChgDat:(";
- sal_uInt16 nCount = m_pTable->TabCount();
+ const int nTabCount = 4;
- rExtraData += OUString::number(nCount);
+ rExtraData += OUString::number(nTabCount);
rExtraData += ";";
- for(sal_uInt16 i = 0; i < nCount; i++)
+
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ std::vector<int> aWidths;
+ // turn column widths back into column end points for compatibility
+ // with how they used to be stored, including a small value for the
+ // expander column
+ aWidths.push_back(rTreeView.get_checkbox_column_width());
+ for (int i = 0; i < nTabCount - 1; ++i)
+ aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i));
+
+ for (auto a : aWidths)
{
- rExtraData += OUString::number( m_pTable->GetTab(i) );
+ rExtraData += OUString::number(a);
rExtraData += ";";
}
rExtraData += ")";
}
SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame)
- : PanelLayout(pParent, "ManageChangesPanel", "modules/swriter/ui/managechangessidebar.ui", rFrame)
+ : PanelLayout(pParent, "ManageChangesPanel", "modules/swriter/ui/managechangessidebar.ui", rFrame, true)
+ , mxContentArea(m_xBuilder->weld_container("content_area"))
{
- mpImplDlg.reset(new SwRedlineAcceptDlg(this, this, get<VclGrid>("content_area")));
+ mpImplDlg.reset(new SwRedlineAcceptDlg(nullptr, m_xBuilder.get(), mxContentArea.get()));
mpImplDlg->Init();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 44575df241ad..8cc0036bf338 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -720,13 +720,13 @@ void SwTextShell::Execute(SfxRequest &rReq)
pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT);
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> pDlg(pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin()));
+ ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> xDlg(pFact->CreateSwModalRedlineAcceptDlg(GetView().GetEditWin().GetFrameWeld()));
switch (lcl_AskRedlineFlags(GetView().GetFrameWeld()))
{
case RET_OK:
{
- pDlg->AcceptAll(true);
+ xDlg->AcceptAll(true);
SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
aReq.Done();
rReq.Ignore();
@@ -734,12 +734,12 @@ void SwTextShell::Execute(SfxRequest &rReq)
}
case RET_CANCEL:
- pDlg->AcceptAll(false);
+ xDlg->AcceptAll(false);
rReq.Ignore();
break;
case 2:
- pDlg->Execute();
+ xDlg->Execute();
rReq.Done();
break;
}
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 94edaba41a3f..8997372f3b89 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -405,17 +405,12 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt
tools::Rectangle aOldVisArea( m_aVisArea );
long nDiffY = 0;
- vcl::Window* pCareWn = SwViewShell::GetCareWin();
weld::Window* pCareDialog = SwViewShell::GetCareDialog(GetWrtShell());
- if (pCareWn || pCareDialog)
+ if (pCareDialog)
{
int x, y, width, height;
tools::Rectangle aDlgRect;
- if (pCareWn)
- {
- aDlgRect = GetEditWin().PixelToLogic(pCareWn->GetWindowExtentsRelative(&GetEditWin()));
- }
- else if (pCareDialog && pCareDialog->get_extents_relative_to(*GetEditWin().GetFrameWeld(), x, y, width, height))
+ if (pCareDialog->get_extents_relative_to(*GetEditWin().GetFrameWeld(), x, y, width, height))
{
Point aTopLeft(GetEditWin().GetSystemWindow()->OutputToAbsoluteScreenPixel(Point(x, y)));
aTopLeft = GetEditWin().AbsoluteScreenToOutputPixel(aTopLeft);
@@ -522,8 +517,9 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt
aPnt.setX( std::max( (GetLeftMargin( *this ) - lMin) + nLeftOfst, aPnt.X() ) );
}
m_aVisArea = aOldVisArea;
- if (pCareWn || pCareDialog)
- { // If we want to avoid only a dialogue, we do
+ if (pCareDialog)
+ {
+ // If we want to avoid only a dialogue, we do
// not want to go beyond the end of the document.
aPnt.setY( SetVScrollMax( aPnt.Y() ) );
}
diff --git a/sw/uiconfig/swriter/ui/managechangessidebar.ui b/sw/uiconfig/swriter/ui/managechangessidebar.ui
index ce4ea22c597d..7fc15bf6f67a 100644
--- a/sw/uiconfig/swriter/ui/managechangessidebar.ui
+++ b/sw/uiconfig/swriter/ui/managechangessidebar.ui
@@ -170,7 +170,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkRadioMenuItem" id="writeraction">
+ <object class="GtkRadioMenuItem" id="writersort0">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="managechangessidebar|writeraction">Action</property>
@@ -178,7 +178,7 @@
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerauthor">
+ <object class="GtkRadioMenuItem" id="writersort1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="managechangessidebar|writerauthor">Author</property>
@@ -186,7 +186,7 @@
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerdate">
+ <object class="GtkRadioMenuItem" id="writersort2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="managechangessidebar|writerdate">Date</property>
@@ -194,7 +194,7 @@
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerdesc">
+ <object class="GtkRadioMenuItem" id="writersort3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="managechangessidebar|writerdesc">Comment</property>
@@ -202,7 +202,7 @@
</object>
</child>
<child>
- <object class="GtkRadioMenuItem" id="writerposition">
+ <object class="GtkRadioMenuItem" id="writersort4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="managechangessidebar|writerposition">Document Position</property>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index be45ec9bf0bc..6babd546a238 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2389,6 +2389,10 @@ struct SalInstanceTreeIter : public weld::TreeIter
: iter(pOrig ? pOrig->iter : nullptr)
{
}
+ SalInstanceTreeIter(SvTreeListEntry* pIter)
+ : iter(pIter)
+ {
+ }
virtual bool equal(const TreeIter& rOther) const override
{
return iter == static_cast<const SalInstanceTreeIter&>(rOther).iter;
@@ -2448,6 +2452,8 @@ private:
DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
+ DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
+
public:
SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: SalInstanceContainer(pTreeView, pBuilder, bTakeOwnership)
@@ -2462,6 +2468,7 @@ public:
m_xTreeView->SetDeselectHdl(LINK(this, SalInstanceTreeView, DeSelectHdl));
m_xTreeView->SetDoubleClickHdl(LINK(this, SalInstanceTreeView, DoubleClickHdl));
m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl));
+ m_xTreeView->SetPopupMenuHdl(LINK(this, SalInstanceTreeView, PopupMenuHdl));
const long aTabPositions[] = { 0 };
m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
@@ -2548,21 +2555,15 @@ public:
virtual void show() override
{
- LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
- if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
- {
- pHeaderBar->Show();
- }
+ if (LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()))
+ pHeaderBox->GetParent()->Show();
SalInstanceContainer::show();
}
virtual void hide() override
{
- LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
- if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
- {
- pHeaderBar->Hide();
- }
+ if (LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()))
+ pHeaderBox->GetParent()->Hide();
SalInstanceContainer::hide();
}
@@ -2625,6 +2626,12 @@ public:
pEntry->SetTextColor(rColor);
}
+ virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) const override
+ {
+ const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+ rVclIter.iter->SetTextColor(rColor);
+ }
+
virtual void remove(int pos) override
{
disable_notify_events();
@@ -3237,10 +3244,20 @@ public:
m_xTreeView->SetSelectionMode(eMode);
}
+ virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override
+ {
+ SalInstanceTreeIter aVclIter(m_xTreeView->First());
+ while (aVclIter.iter)
+ {
+ if (func(aVclIter))
+ return;
+ aVclIter.iter = m_xTreeView->Next(aVclIter.iter);
+ }
+ }
+
virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
{
- SalInstanceTreeIter aVclIter(nullptr);
- aVclIter.iter = m_xTreeView->FirstSelected();
+ SalInstanceTreeIter aVclIter(m_xTreeView->FirstSelected());
while (aVclIter.iter)
{
if (func(aVclIter))
@@ -3251,8 +3268,7 @@ public:
virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override
{
- SalInstanceTreeIter aVclIter(nullptr);
- aVclIter.iter = m_xTreeView->GetFirstEntryInView();
+ SalInstanceTreeIter aVclIter(m_xTreeView->GetFirstEntryInView());
while (aVclIter.iter)
{
if (func(aVclIter))
@@ -3279,6 +3295,20 @@ public:
return SvTreeList::GetRelPos(rVclIter.iter);
}
+ virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override
+ {
+ const SalInstanceTreeIter& rVclIterA = static_cast<const SalInstanceTreeIter&>(a);
+ const SalInstanceTreeIter& rVclIterB = static_cast<const SalInstanceTreeIter&>(b);
+ const SvTreeList* pModel = m_xTreeView->GetModel();
+ auto nAbsPosA = pModel->GetAbsPos(rVclIterA.iter);
+ auto nAbsPosB = pModel->GetAbsPos(rVclIterB.iter);
+ if (nAbsPosA < nAbsPosB)
+ return -1;
+ if (nAbsPosA > nAbsPosB)
+ return 1;
+ return 0;
+ }
+
virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent, int nIndexInNewParent) override
{
SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rNode);
@@ -3303,6 +3333,13 @@ public:
set_sort_order(true);
}
+ virtual void set_sort_func(const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func) override
+ {
+ weld::TreeView::set_sort_func(func);
+ SvTreeList* pListModel = m_xTreeView->GetModel();
+ pListModel->Resort();
+ }
+
virtual void make_unsorted() override
{
m_xTreeView->SetStyle(m_xTreeView->GetStyle() & ~WB_SORT);
@@ -3369,6 +3406,13 @@ public:
virtual void set_sort_column(int nColumn) override
{
+ if (nColumn == -1)
+ {
+ make_unsorted();
+ m_nSortColumn = -1;
+ return;
+ }
+
if (nColumn != m_nSortColumn)
{
m_nSortColumn = nColumn;
@@ -3396,6 +3440,7 @@ public:
{
static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(Link<SvTreeListBox*, void>());
}
+ m_xTreeView->SetPopupMenuHdl(Link<const CommandEvent&, bool>());
m_xTreeView->SetExpandingHdl(Link<SvTreeListBox*, bool>());
m_xTreeView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
m_xTreeView->SetSelectHdl(Link<SvTreeListBox*, void>());
@@ -3410,6 +3455,10 @@ IMPL_LINK(SalInstanceTreeView, CompareHdl, const SvSortData&, rSortData, sal_Int
const SvTreeListEntry* pRHS = rSortData.pRight;
assert(pLHS && pRHS);
+ if (m_aCustomSort)
+ return m_aCustomSort(SalInstanceTreeIter(const_cast<SvTreeListEntry*>(pLHS)),
+ SalInstanceTreeIter(const_cast<SvTreeListEntry*>(pRHS)));
+
const SvLBoxString* pLeftTextItem;
const SvLBoxString* pRightTextItem;
@@ -3551,8 +3600,7 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ExpandingHdl, SvTreeListBox*, bool)
}
}
- SalInstanceTreeIter aIter(nullptr);
- aIter.iter = pEntry;
+ SalInstanceTreeIter aIter(pEntry);
bool bRet = signal_expanding(aIter);
//expand disallowed, restore placeholder
@@ -3564,6 +3612,11 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ExpandingHdl, SvTreeListBox*, bool)
return bRet;
}
+IMPL_LINK(SalInstanceTreeView, PopupMenuHdl, const CommandEvent&, rEvent, bool)
+{
+ return m_aPopupMenuHdl.Call(rEvent);
+}
+
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
{
private:
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index 9ebbb7aabfb0..2a6d7286a03d 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3255,7 +3255,8 @@ void SvTreeListBox::SetHighlightRange( sal_uInt16 nStart, sal_uInt16 nEnd)
void SvTreeListBox::Command(const CommandEvent& rCEvt)
{
- pImpl->Command(rCEvt);
+ if (!aPopupMenuHdl.Call(rCEvt))
+ pImpl->Command(rCEvt);
//pass at least alt press/release to parent impl
if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
Control::Command(rCEvt);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5f2884186c02..2bb5a83abaa1 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1282,6 +1282,23 @@ protected:
m_aFocusOutHdl.Call(*this);
}
+ void ensureButtonPressSignal()
+ {
+ if (!m_nButtonPressSignalId)
+ m_nButtonPressSignalId = g_signal_connect(m_pWidget, "button-press-event", G_CALLBACK(signalButton), this);
+ }
+
+ static gboolean signalPopupMenu(GtkWidget* pWidget, gpointer widget)
+ {
+ GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
+ SolarMutexGuard aGuard;
+ //center it when we don't know where else to use
+ Point aPos(gtk_widget_get_allocated_width(pWidget) / 2,
+ gtk_widget_get_allocated_height(pWidget) / 2);
+ CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, false);
+ return pThis->signal_popup_menu(aCEvt);
+ }
+
private:
bool m_bTakeOwnership;
bool m_bFrozen;
@@ -1495,7 +1512,7 @@ public:
virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink) override
{
- m_nButtonPressSignalId = g_signal_connect(m_pWidget, "button-press-event", G_CALLBACK(signalButton), this);
+ ensureButtonPressSignal();
weld::Widget::connect_mouse_press(rLink);
}
@@ -4757,6 +4774,11 @@ public:
::set_label(GTK_LABEL(m_pLabel), rText);
}
+ virtual OUString get_label() const override
+ {
+ return ::get_label(GTK_LABEL(m_pLabel));
+ }
+
virtual void set_image(VirtualDevice* pDevice) override
{
ensure_image_widget();
@@ -5366,8 +5388,10 @@ public:
virtual void set_date(const Date& rDate) override
{
+ disable_notify_events();
gtk_calendar_select_month(m_pCalendar, rDate.GetMonth() - 1, rDate.GetYear());
gtk_calendar_select_day(m_pCalendar, rDate.GetDay());
+ enable_notify_events();
}
virtual Date get_date() const override
@@ -5780,7 +5804,7 @@ namespace
namespace
{
- gint sort_func(GtkTreeModel* pModel, GtkTreeIter* a, GtkTreeIter* b, gpointer data)
+ gint default_sort_func(GtkTreeModel* pModel, GtkTreeIter* a, GtkTreeIter* b, gpointer data)
{
comphelper::string::NaturalStringSorter* pSorter = static_cast<comphelper::string::NaturalStringSorter*>(data);
gchar* pName1;
@@ -5830,6 +5854,10 @@ struct GtkInstanceTreeIter : public weld::TreeIter
else
memset(&iter, 0, sizeof(iter));
}
+ GtkInstanceTreeIter(const GtkTreeIter& rOrig)
+ {
+ memcpy(&iter, &rOrig, sizeof(iter));
+ }
virtual bool equal(const TreeIter& rOther) const override
{
return memcmp(&iter, &static_cast<const GtkInstanceTreeIter&>(rOther).iter, sizeof(GtkTreeIter)) == 0;
@@ -5865,6 +5893,7 @@ private:
gulong m_nVAdjustmentChangedSignalId;
gulong m_nRowDeletedSignalId;
gulong m_nRowInsertedSignalId;
+ gulong m_nPopupMenu;
DECL_LINK(async_signal_changed, void*, void);
@@ -5887,6 +5916,11 @@ private:
pThis->signal_row_activated();
}
+ virtual bool signal_popup_menu(const CommandEvent& rCEvt) override
+ {
+ return m_aPopupMenuHdl.Call(rCEvt);
+ }
+
void insert_row(GtkTreeIter& iter, const GtkTreeIter* parent, int pos, const OUString* pId, const OUString* pText,
const OUString* pIconName, const VirtualDevice* pDevice, const OUString* pExpanderName)
{
@@ -6132,6 +6166,19 @@ private:
pThis->signal_model_changed();
}
+ static gint sortFunc(GtkTreeModel* pModel, GtkTreeIter* a, GtkTreeIter* b, gpointer widget)
+ {
+ GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
+ return pThis->sort_func(pModel, a, b);
+ }
+
+ gint sort_func(GtkTreeModel* pModel, GtkTreeIter* a, GtkTreeIter* b)
+ {
+ if (m_aCustomSort)
+ return m_aCustomSort(GtkInstanceTreeIter(*a), GtkInstanceTreeIter(*b));
+ return default_sort_func(pModel, a, b, m_xSorter.get());
+ }
+
public:
GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, bTakeOwnership)
@@ -6145,6 +6192,7 @@ public:
, m_nRowActivatedSignalId(g_signal_connect(pTreeView, "row-activated", G_CALLBACK(signalRowActivated), this))
, m_nTestExpandRowSignalId(g_signal_connect(pTreeView, "test-expand-row", G_CALLBACK(signalTestExpandRow), this))
, m_nVAdjustmentChangedSignalId(0)
+ , m_nPopupMenu(g_signal_connect(pTreeView, "popup-menu", G_CALLBACK(signalPopupMenu), this))
{
m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
int nIndex(0);
@@ -6219,7 +6267,7 @@ public:
{
GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, nColumn));
assert(pColumn && "wrong count");
- return gtk_tree_view_column_get_fixed_width(pColumn) - gtk_tree_view_column_get_spacing(pColumn);
+ return gtk_tree_view_column_get_width(pColumn);
}
virtual OUString get_column_title(int nColumn) const override
@@ -6260,12 +6308,23 @@ public:
enable_notify_events();
}
+ void set_font_color(const GtkTreeIter& iter, const Color& rColor) const
+ {
+ GdkRGBA aColor{rColor.GetRed()/255.0, rColor.GetGreen()/255.0, rColor.GetBlue()/255.0, 0};
+ gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), m_nIdCol + 1, &aColor, -1);
+ }
+
virtual void set_font_color(int pos, const Color& rColor) const override
{
GtkTreeIter iter;
gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(m_pTreeStore), &iter, nullptr, pos);
- GdkRGBA aColor{rColor.GetRed()/255.0, rColor.GetGreen()/255.0, rColor.GetBlue()/255.0, 0};
- gtk_tree_store_set(m_pTreeStore, &iter, m_nIdCol + 1, &aColor, -1);
+ set_font_color(iter, rColor);
+ }
+
+ virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) const override
+ {
+ const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
+ set_font_color(rGtkIter.iter, rColor);
}
virtual void remove(int pos) override
@@ -6346,6 +6405,7 @@ public:
::comphelper::getProcessComponentContext(),
Application::GetSettings().GetUILanguageTag().getLocale()));
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
+ gtk_tree_sortable_set_sort_func(pSortable, m_nTextCol, sortFunc, this, nullptr);
gtk_tree_sortable_set_sort_column_id(pSortable, m_nTextCol, GTK_SORT_ASCENDING);
}
@@ -6417,10 +6477,24 @@ public:
virtual void set_sort_column(int nColumn) override
{
+ if (nColumn == -1)
+ {
+ make_unsorted();
+ return;
+ }
GtkSortType eSortType;
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
gtk_tree_sortable_get_sort_column_id(pSortable, nullptr, &eSortType);
- gtk_tree_sortable_set_sort_column_id(pSortable, get_model_col(nColumn), eSortType);
+ int nSortCol = get_model_col(nColumn);
+ gtk_tree_sortable_set_sort_func(pSortable, nSortCol, sortFunc, this, nullptr);
+ gtk_tree_sortable_set_sort_column_id(pSortable, nSortCol, eSortType);
+ }
+
+ virtual void set_sort_func(const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func) override
+ {
+ weld::TreeView::set_sort_func(func);
+ GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
+ gtk_tree_sortable_sort_column_changed(pSortable);
}
virtual int n_children() const override
@@ -6500,6 +6574,19 @@ public:
return aRows;
}
+ virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override
+ {
+ GtkInstanceTreeIter aGtkIter(nullptr);
+ if (get_iter_first(aGtkIter))
+ {
+ do
+ {
+ if (func(aGtkIter))
+ break;
+ } while (iter_next(aGtkIter));
+ }
+ }
+
virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
{
GtkInstanceTreeIter aGtkIter(nullptr);
@@ -6727,6 +6814,23 @@ public:
return nRet;
}
+ virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override
+ {
+ const GtkInstanceTreeIter& rGtkIterA = static_cast<const GtkInstanceTreeIter&>(a);
+ const GtkInstanceTreeIter& rGtkIterB = static_cast<const GtkInstanceTreeIter&>(b);
+
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ GtkTreePath* pathA = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIterA.iter));
+ GtkTreePath* pathB = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIterB.iter));
+
+ int nRet = gtk_tree_path_compare(pathA, pathB);
+
+ gtk_tree_path_free(pathB);
+ gtk_tree_path_free(pathA);
+
+ return nRet;
+ }
+
// by copy and delete of old copy
void move_subtree(GtkTreeIter& rFromIter, GtkTreeIter* pGtkParentIter, int nIndexInNewParent)
{
@@ -7211,8 +7315,15 @@ public:
g_signal_handler_unblock(gtk_tree_view_get_selection(m_pTreeView), m_nChangedSignalId);
}
+ virtual void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink) override
+ {
+ ensureButtonPressSignal();
+ weld::TreeView::connect_popup_menu(rLink);
+ }
+
virtual ~GtkInstanceTreeView() override
{
+ g_signal_handler_disconnect(m_pTreeView, m_nPopupMenu);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
g_signal_handler_disconnect(pModel, m_nRowDeletedSignalId);
g_signal_handler_disconnect(pModel, m_nRowInsertedSignalId);
@@ -7875,16 +7986,6 @@ private:
{
return m_aPopupMenuHdl.Call(rCEvt);
}
- static gboolean signalPopupMenu(GtkWidget* pWidget, gpointer widget)
- {
- GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
- SolarMutexGuard aGuard;
- //center it when we don't know where else to use
- Point aPos(gtk_widget_get_allocated_width(pWidget) / 2,
- gtk_widget_get_allocated_height(pWidget) / 2);
- CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, false);
- return pThis->signal_popup_menu(aCEvt);
- }
public:
GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* pBuilder, const a11yref& rA11y, bool bTakeOwnership)
: GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership)
@@ -8664,7 +8765,7 @@ public:
Application::GetSettings().GetUILanguageTag().getLocale()));
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeModel);
gtk_tree_sortable_set_sort_column_id(pSortable, 0, GTK_SORT_ASCENDING);
- gtk_tree_sortable_set_sort_func(pSortable, 0, sort_func, m_xSorter.get(), nullptr);
+ gtk_tree_sortable_set_sort_func(pSortable, 0, default_sort_func, m_xSorter.get(), nullptr);
}
virtual bool has_entry() const override