1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
22 #include "chldwrap.hxx"
23 #include <redline.hxx>
24 #include <sfx2/sidebar/PanelLayout.hxx>
25 #include <sfx2/basedlgs.hxx>
26 #include <svl/lstner.hxx>
27 #include <svx/ctredlin.hxx>
28 #include <o3tl/sorted_vector.hxx>
33 class SwChildWinWrapper
;
35 struct SwRedlineDataChild
37 const SwRedlineData
* pChild
; // link to original stacked data
38 const SwRedlineDataChild
* pNext
; // link to stacked data
39 std::unique_ptr
<weld::TreeIter
> xTLBChild
; // corresponding TreeListBox entry
42 struct SwRedlineDataParent
44 const SwRedlineData
* pData
; // RedlineDataPtr
45 const SwRedlineDataChild
* pNext
; // link to stacked data
46 std::unique_ptr
<weld::TreeIter
> xTLBParent
; // corresponding TreeListBox entry
47 OUString sComment
; // redline comment
49 bool operator< ( const SwRedlineDataParent
& rObj
) const
50 { return (pData
&& pData
->GetSeqNo() < rObj
.pData
->GetSeqNo()); }
53 class SwRedlineDataParentSortArr
: public o3tl::sorted_vector
<SwRedlineDataParent
*, o3tl::less_ptr_to
<SwRedlineDataParent
> > {};
55 class SW_DLLPUBLIC SwRedlineAcceptDlg final
57 std::shared_ptr
<weld::Window
> m_xParentDlg
;
58 std::vector
<std::unique_ptr
<SwRedlineDataParent
>> m_RedlineParents
;
59 std::vector
<std::unique_ptr
<SwRedlineDataChild
>>
61 SwRedlineDataParentSortArr m_aUsedSeqNo
;
66 OUString m_sTableChgd
;
67 OUString m_sFormatCollSet
;
68 OUString m_sFilterAction
;
69 OUString m_sAutoFormat
;
70 bool m_bOnlyFormatedRedlines
;
71 bool m_bRedlnAutoFormat
;
73 // prevent update dialog data during longer operations (cf #102657#)
74 bool m_bInhibitActivate
;
76 std::unique_ptr
<SvxAcceptChgCtr
> m_xTabPagesCTRL
;
77 std::unique_ptr
<weld::Menu
> m_xPopup
, m_xSortMenu
;
79 SvxRedlinTable
* m_pTable
; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
81 DECL_DLLPRIVATE_LINK( AcceptHdl
, SvxTPView
*, void );
82 DECL_DLLPRIVATE_LINK( AcceptAllHdl
, SvxTPView
*, void );
83 DECL_DLLPRIVATE_LINK( RejectHdl
, SvxTPView
*, void );
84 DECL_DLLPRIVATE_LINK( RejectAllHdl
, SvxTPView
*, void );
85 DECL_DLLPRIVATE_LINK( UndoHdl
, SvxTPView
*, void );
86 DECL_DLLPRIVATE_LINK( SelectHdl
, weld::TreeView
&, void );
87 DECL_DLLPRIVATE_LINK( GotoHdl
, Timer
*, void );
88 DECL_DLLPRIVATE_LINK( CommandHdl
, const CommandEvent
&, bool );
90 SAL_DLLPRIVATE
SwRedlineTable::size_type
CalcDiff(SwRedlineTable::size_type nStart
, bool bChild
);
91 SAL_DLLPRIVATE
void InsertChildren(SwRedlineDataParent
*pParent
, const SwRangeRedline
& rRedln
, bool bHasRedlineAutoFormat
);
92 SAL_DLLPRIVATE
void InsertParents(SwRedlineTable::size_type nStart
, SwRedlineTable::size_type nEnd
= SwRedlineTable::npos
);
93 SAL_DLLPRIVATE
void RemoveParents(SwRedlineTable::size_type nStart
, SwRedlineTable::size_type nEnd
);
94 SAL_DLLPRIVATE
void InitAuthors();
96 SAL_DLLPRIVATE
static OUString
GetActionImage(const SwRangeRedline
& rRedln
, sal_uInt16 nStack
= 0);
97 SAL_DLLPRIVATE OUString
GetActionText(const SwRangeRedline
& rRedln
, sal_uInt16 nStack
= 0);
98 SAL_DLLPRIVATE
SwRedlineTable::size_type
GetRedlinePos(const weld::TreeIter
& rEntry
);
100 SwRedlineAcceptDlg(SwRedlineAcceptDlg
const&) = delete;
101 SwRedlineAcceptDlg
& operator=(SwRedlineAcceptDlg
const&) = delete;
104 SwRedlineAcceptDlg(const std::shared_ptr
<weld::Window
>& rParent
, weld::Builder
*pBuilder
, weld::Container
*pContentArea
, bool bAutoFormat
= false);
105 ~SwRedlineAcceptDlg();
107 DECL_LINK( FilterChangedHdl
, SvxTPFilter
*, void );
109 SvxAcceptChgCtr
& GetChgCtrl() { return *m_xTabPagesCTRL
; }
110 bool HasRedlineAutoFormat() const { return m_bRedlnAutoFormat
; }
112 void Init(SwRedlineTable::size_type nStart
= 0);
113 void CallAcceptReject( bool bSelect
, bool bAccept
);
115 void Initialize(OUString
&rExtraData
);
116 void FillInfo(OUString
&rExtraData
) const;
121 class SwModelessRedlineAcceptDlg
: public SfxModelessDialogController
123 std::unique_ptr
<weld::Container
> m_xContentArea
;
124 std::unique_ptr
<SwRedlineAcceptDlg
> m_xImplDlg
;
125 SwChildWinWrapper
* pChildWin
;
128 SwModelessRedlineAcceptDlg(SfxBindings
*, SwChildWinWrapper
*, weld::Window
*pParent
);
129 virtual ~SwModelessRedlineAcceptDlg() override
;
131 virtual void Activate() override
;
132 virtual void FillInfo(SfxChildWinInfo
&) const override
;
133 void Initialize(SfxChildWinInfo
* pInfo
);
136 class SwRedlineAcceptChild
: public SwChildWinWrapper
139 SwRedlineAcceptChild(vcl::Window
* ,
144 SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild
);
146 virtual bool ReInitDlg(SwDocShell
*pDocSh
) override
;
149 /// Redline (Manage Changes) panel for the sidebar.
150 class SwRedlineAcceptPanel
: public PanelLayout
, public SfxListener
152 std::unique_ptr
<SwRedlineAcceptDlg
> mpImplDlg
;
153 std::unique_ptr
<weld::Container
> mxContentArea
;
155 SwRedlineAcceptPanel(vcl::Window
* pParent
, const css::uno::Reference
<css::frame::XFrame
>& rFrame
);
156 virtual ~SwRedlineAcceptPanel() override
;
157 virtual void dispose() override
;
159 /// We need to be a SfxListener to be able to update the list of changes when we get SfxHintId::DocChanged.
160 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */