cui/source/dialogs/postdlg.cxx | 2 cui/source/factory/dlgfact.cxx | 6 cui/source/factory/dlgfact.hxx | 6 cui/source/inc/postdlg.hxx | 4 cui/source/tabpages/numfmt.cxx | 2 include/sfx2/basedlgs.hxx | 1 include/sfx2/childwin.hxx | 8 include/svtools/ctrlbox.hxx | 9 include/svx/ctredlin.hxx | 176 +-- include/svx/sidebar/PanelLayout.hxx | 7 include/svx/svxdlg.hxx | 2 include/vcl/treelistbox.hxx | 2 include/vcl/weld.hxx | 24 sc/source/ui/docshell/docsh3.cxx | 6 sc/source/ui/inc/acredlin.hxx | 66 - sc/source/ui/inc/conflictsdlg.hxx | 46 - sc/source/ui/inc/highred.hxx | 36 sc/source/ui/inc/reffact.hxx | 86 - sc/source/ui/inc/simpref.hxx | 2 sc/source/ui/miscdlgs/acredlin.cxx | 1014 ++++++++++------------- sc/source/ui/miscdlgs/conflictsdlg.cxx | 308 +++--- sc/source/ui/miscdlgs/highred.cxx | 221 ++--- sc/source/ui/miscdlgs/simpref.cxx | 9 sc/source/ui/view/reffact.cxx | 60 - sc/source/ui/view/tabview3.cxx | 24 sc/source/ui/view/tabvwsh4.cxx | 11 sc/source/ui/view/tabvwshc.cxx | 14 sc/uiconfig/scalc/ui/conflictsdialog.ui | 92 +- sc/uiconfig/scalc/ui/showchangesdialog.ui | 15 sfx2/source/appl/workwin.cxx | 10 sfx2/source/dialog/basedlgs.cxx | 13 solenv/sanitizers/ui/modules/scalc.false | 3 solenv/sanitizers/ui/modules/scalc.suppr | 2 svtools/source/control/ctrlbox.cxx | 12 svx/source/dialog/ctredlin.cxx | 875 +++++++++---------- svx/source/sidebar/PanelLayout.cxx | 9 svx/uiconfig/ui/acceptrejectchangesdialog.ui | 45 - svx/uiconfig/ui/redlinefilterpage.ui | 63 - svx/uiconfig/ui/redlineviewpage.ui | 288 ++++-- sw/inc/swabstdlg.hxx | 2 sw/inc/viewsh.hxx | 3 sw/source/core/view/viewsh.cxx | 8 sw/source/ui/dialog/swdlgfact.cxx | 15 sw/source/ui/dialog/swdlgfact.hxx | 12 sw/source/ui/dialog/wordcountdialog.cxx | 2 sw/source/ui/misc/swmodalredlineacceptdlg.cxx | 41 sw/source/uibase/inc/redlndlg.hxx | 46 - sw/source/uibase/inc/swmodalredlineacceptdlg.hxx | 8 sw/source/uibase/lingu/hhcwrp.cxx | 2 sw/source/uibase/misc/redlndlg.cxx | 591 ++++++------- sw/source/uibase/shells/textsh1.cxx | 8 sw/source/uibase/uiview/viewport.cxx | 14 sw/uiconfig/swriter/ui/managechangessidebar.ui | 10 vcl/headless/svpgdi.cxx | 14 vcl/source/app/salvtables.cxx | 85 + vcl/source/treelist/treelistbox.cxx | 3 vcl/unx/gtk3/gtk3gtkinst.cxx | 135 ++- 57 files changed, 2424 insertions(+), 2154 deletions(-)
New commits: commit 56dd851cfc77c362c3db5c0aae4a490c7f6782cc Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Apr 18 16:49:26 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Apr 27 12:41:14 2019 +0200 weld cluster of change tracking dialogs Change-Id: I42ca7acb41699df91b91a9f59fc68cd30972a397 Reviewed-on: https://gerrit.libreoffice.org/70988 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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) - { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits