Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / redlndlg.hxx
blobc8cfd8cc8262be5234f82309caf445b29204c0d7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX
21 #include <swdllapi.h>
22 #include "chldwrap.hxx"
23 #include <docary.hxx>
24 #include <redline.hxx>
25 #include <sfx2/sidebar/PanelLayout.hxx>
26 #include <sfx2/basedlgs.hxx>
27 #include <svl/lstner.hxx>
28 #include <svx/ctredlin.hxx>
29 #include <o3tl/sorted_vector.hxx>
31 #include <memory>
32 #include <vector>
34 class SwChildWinWrapper;
36 struct SwRedlineDataChild
38 const SwRedlineData* pChild; // link to original stacked data
39 const SwRedlineDataChild* pNext; // link to stacked data
40 std::unique_ptr<weld::TreeIter> xTLBChild; // corresponding TreeListBox entry
43 struct SwRedlineDataParent
45 const SwRedlineData* pData; // RedlineDataPtr
46 const SwRedlineDataChild* pNext; // link to stacked data
47 std::unique_ptr<weld::TreeIter> xTLBParent; // corresponding TreeListBox entry
48 OUString sComment; // redline comment
50 bool operator< ( const SwRedlineDataParent& rObj ) const
51 { return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); }
54 class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to<SwRedlineDataParent> > {};
56 class SW_DLLPUBLIC SwRedlineAcceptDlg final
58 std::shared_ptr<weld::Window> m_xParentDlg;
59 std::vector<std::unique_ptr<SwRedlineDataParent>> m_RedlineParents;
60 std::vector<std::unique_ptr<SwRedlineDataChild>>
61 m_RedlineChildren;
62 // purely here so we don't leak
63 std::vector<std::unique_ptr<RedlinData>>
64 m_RedlinData;
65 SwRedlineDataParentSortArr m_aUsedSeqNo;
66 Timer m_aSelectTimer;
67 OUString m_sInserted;
68 OUString m_sDeleted;
69 OUString m_sFormated;
70 OUString m_sTableChgd;
71 OUString m_sFormatCollSet;
72 OUString m_sFilterAction;
73 OUString m_sAutoFormat;
74 bool m_bOnlyFormatedRedlines;
75 bool m_bRedlnAutoFormat;
77 // prevent update dialog data during longer operations (cf #102657#)
78 bool m_bInhibitActivate;
80 // table column changes have not continuous redline ranges: it needs major tree list update
81 bool m_bHasTrackedColumn;
83 std::unique_ptr<SvxAcceptChgCtr> m_xTabPagesCTRL;
84 std::unique_ptr<weld::Menu> m_xPopup, m_xSortMenu;
85 SvxTPView* m_pTPView;
86 SvxRedlinTable* m_pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
88 DECL_DLLPRIVATE_LINK( AcceptHdl, SvxTPView*, void );
89 DECL_DLLPRIVATE_LINK( AcceptAllHdl, SvxTPView*, void );
90 DECL_DLLPRIVATE_LINK( RejectHdl, SvxTPView*, void );
91 DECL_DLLPRIVATE_LINK( RejectAllHdl, SvxTPView*, void );
92 DECL_DLLPRIVATE_LINK( UndoHdl, SvxTPView*, void );
93 DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void );
94 DECL_DLLPRIVATE_LINK( GotoHdl, Timer*, void );
95 DECL_DLLPRIVATE_LINK( CommandHdl, const CommandEvent&, bool );
97 SAL_DLLPRIVATE SwRedlineTable::size_type CalcDiff(SwRedlineTable::size_type nStart, bool bChild);
98 SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, bool bHasRedlineAutoFormat);
99 SAL_DLLPRIVATE void InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd = SwRedlineTable::npos);
100 SAL_DLLPRIVATE void RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd);
101 SAL_DLLPRIVATE void InitAuthors();
103 SAL_DLLPRIVATE static OUString GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0,
104 bool bTableChanges = false, bool bRowChanges = false);
105 SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
106 SAL_DLLPRIVATE SwRedlineTable::size_type GetRedlinePos(const weld::TreeIter& rEntry);
108 SwRedlineAcceptDlg(SwRedlineAcceptDlg const&) = delete;
109 SwRedlineAcceptDlg& operator=(SwRedlineAcceptDlg const&) = delete;
111 public:
112 SwRedlineAcceptDlg(std::shared_ptr<weld::Window> xParent, weld::Builder *pBuilder, weld::Container *pContentArea, bool bAutoFormat = false);
113 ~SwRedlineAcceptDlg();
115 DECL_LINK( FilterChangedHdl, SvxTPFilter*, void );
117 SvxAcceptChgCtr& GetChgCtrl() { return *m_xTabPagesCTRL; }
118 bool HasRedlineAutoFormat() const { return m_bRedlnAutoFormat; }
120 void Init(SwRedlineTable::size_type nStart = 0);
121 void CallAcceptReject( bool bSelect, bool bAccept );
123 void Initialize(OUString &rExtraData);
124 void FillInfo(OUString &rExtraData) const;
126 void Activate();
129 class SwModelessRedlineAcceptDlg final : public SfxModelessDialogController
131 std::unique_ptr<weld::Container> m_xContentArea;
132 std::unique_ptr<SwRedlineAcceptDlg> m_xImplDlg;
133 SwChildWinWrapper* m_pChildWin;
135 public:
136 SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, weld::Window *pParent);
137 virtual ~SwModelessRedlineAcceptDlg() override;
139 virtual void Activate() override;
140 virtual void FillInfo(SfxChildWinInfo&) const override;
141 void Initialize(SfxChildWinInfo * pInfo);
144 class SwRedlineAcceptChild final : public SwChildWinWrapper
146 public:
147 SwRedlineAcceptChild(vcl::Window* ,
148 sal_uInt16 nId,
149 SfxBindings*,
150 SfxChildWinInfo*);
152 SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild );
154 virtual bool ReInitDlg(SwDocShell *pDocSh) override;
157 /// Redline (Manage Changes) panel for the sidebar.
158 class SwRedlineAcceptPanel final : public PanelLayout, public SfxListener
160 std::unique_ptr<SwRedlineAcceptDlg> mpImplDlg;
161 std::unique_ptr<weld::Container> mxContentArea;
162 public:
163 SwRedlineAcceptPanel(weld::Widget* pParent);
164 virtual ~SwRedlineAcceptPanel() override;
166 /// We need to be a SfxListener to be able to update the list of changes when we get SfxHintId::DocChanged.
167 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
170 #endif
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */