diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-04-18 16:49:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-04-27 12:41:14 +0200 |
commit | 56dd851cfc77c362c3db5c0aae4a490c7f6782cc (patch) | |
tree | 0f5f6564e0b9af8123f4cebfe9a2f55c1bbbba57 /sw | |
parent | 6afbe153ffd4cab27f0a7bb77f71f25923dc2e43 (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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swabstdlg.hxx | 2 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 15 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 12 | ||||
-rw-r--r-- | sw/source/ui/dialog/wordcountdialog.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/swmodalredlineacceptdlg.cxx | 41 | ||||
-rw-r--r-- | sw/source/uibase/inc/redlndlg.hxx | 46 | ||||
-rw-r--r-- | sw/source/uibase/inc/swmodalredlineacceptdlg.hxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/lingu/hhcwrp.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 591 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewport.cxx | 14 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/managechangessidebar.ui | 10 |
14 files changed, 370 insertions, 392 deletions
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> |