Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
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 <redline.hxx>
24 : #include <tools/datetime.hxx>
25 : #include <vcl/msgbox.hxx>
26 : #include <svl/eitem.hxx>
27 : #include <svx/sidebar/PanelLayout.hxx>
28 : #include <sfx2/basedlgs.hxx>
29 : #include <sfx2/viewfrm.hxx>
30 : #include <sfx2/dispatch.hxx>
31 : #include <svx/ctredlin.hxx>
32 : #include <svx/postattr.hxx>
33 : #include <boost/ptr_container/ptr_vector.hpp>
34 : #include <o3tl/sorted_vector.hxx>
35 :
36 : class SwChildWinWrapper;
37 :
38 : struct SwRedlineDataChild
39 : {
40 : const SwRedlineData* pChild; // link to original stacked data
41 : const SwRedlineDataChild* pNext; // link to stacked data
42 : SvTreeListEntry* pTLBChild; // corresponding TreeListBox entry
43 : };
44 :
45 0 : struct SwRedlineDataParent
46 : {
47 : const SwRedlineData* pData; // RedlineDataPtr
48 : const SwRedlineDataChild* pNext; // link to stacked data
49 : SvTreeListEntry* pTLBParent; // corresponding TreeListBox entry
50 : OUString sComment; // redline comment
51 :
52 : inline bool operator==( const SwRedlineDataParent& rObj ) const
53 : { return (pData && pData->GetSeqNo() == rObj.pData->GetSeqNo()); }
54 0 : inline bool operator< ( const SwRedlineDataParent& rObj ) const
55 0 : { return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); }
56 : };
57 :
58 : typedef boost::ptr_vector<SwRedlineDataParent> SwRedlineDataParentArr;
59 :
60 0 : class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to<SwRedlineDataParent> > {};
61 :
62 : typedef SwRedlineDataChild* SwRedlineDataChildPtr;
63 : typedef boost::ptr_vector<SwRedlineDataChild> SwRedlineDataChildArr;
64 :
65 : typedef SvTreeListEntry* SvLBoxEntryPtr;
66 : typedef std::vector<SvLBoxEntryPtr> SvLBoxEntryArr;
67 :
68 : class SW_DLLPUBLIC SwRedlineAcceptDlg
69 : {
70 : VclPtr<vcl::Window> pParentDlg;
71 : SwRedlineDataParentArr aRedlineParents;
72 : SwRedlineDataChildArr aRedlineChildren;
73 : SwRedlineDataParentSortArr aUsedSeqNo;
74 : VclPtr<SvxAcceptChgCtr> aTabPagesCTRL;
75 : PopupMenu aPopup;
76 : Timer aDeselectTimer;
77 : Timer aSelectTimer;
78 : OUString sInserted;
79 : OUString sDeleted;
80 : OUString sFormated;
81 : OUString sTableChgd;
82 : OUString sFormatCollSet;
83 : OUString sFilterAction;
84 : OUString sAutoFormat;
85 : VclPtr<SvxTPView> pTPView;
86 : VclPtr<SvxRedlinTable> pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
87 : Link<> aOldSelectHdl;
88 : Link<> aOldDeselectHdl;
89 : bool bOnlyFormatedRedlines;
90 : bool bHasReadonlySel;
91 : bool bRedlnAutoFormat;
92 :
93 : // prevent update dialog data during longer operations (cf #102657#)
94 : bool bInhibitActivate;
95 :
96 : DECL_DLLPRIVATE_LINK( AcceptHdl, void* );
97 : DECL_DLLPRIVATE_LINK( AcceptAllHdl, void* );
98 : DECL_DLLPRIVATE_LINK( RejectHdl, void* );
99 : DECL_DLLPRIVATE_LINK( RejectAllHdl, void* );
100 : DECL_DLLPRIVATE_LINK( UndoHdl, void* );
101 : DECL_DLLPRIVATE_LINK( DeselectHdl, void* );
102 : DECL_DLLPRIVATE_LINK( SelectHdl, void* );
103 : DECL_DLLPRIVATE_LINK_TYPED( SelectTimerHdl, Timer*, void );
104 : DECL_DLLPRIVATE_LINK_TYPED( GotoHdl, Timer*, void );
105 : DECL_DLLPRIVATE_LINK( CommandHdl, void* );
106 :
107 : SAL_DLLPRIVATE sal_uInt16 CalcDiff(sal_uInt16 nStart, bool bChild);
108 : SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, const sal_uInt16 nAutoFormat);
109 : SAL_DLLPRIVATE void InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd = USHRT_MAX);
110 : SAL_DLLPRIVATE void RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd);
111 : SAL_DLLPRIVATE void InitAuthors();
112 :
113 : SAL_DLLPRIVATE OUString GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0);
114 : SAL_DLLPRIVATE Image GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
115 : SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
116 : SAL_DLLPRIVATE sal_uInt16 GetRedlinePos( const SvTreeListEntry& rEntry) const;
117 :
118 : public:
119 : SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer *pBuilder, vcl::Window *pContentArea, bool bAutoFormat = false);
120 : virtual ~SwRedlineAcceptDlg();
121 :
122 : DECL_LINK( FilterChangedHdl, void *pDummy = 0 );
123 :
124 0 : inline SvxAcceptChgCtr& GetChgCtrl() { return *aTabPagesCTRL.get(); }
125 0 : inline bool HasRedlineAutoFormat() const { return bRedlnAutoFormat; }
126 :
127 : void Init(sal_uInt16 nStart = 0);
128 : void CallAcceptReject( bool bSelect, bool bAccept );
129 :
130 : void Initialize(const OUString &rExtraData);
131 : void FillInfo(OUString &rExtraData) const;
132 :
133 : void Activate();
134 : };
135 :
136 : class SwModelessRedlineAcceptDlg : public SfxModelessDialog
137 : {
138 : SwRedlineAcceptDlg* pImplDlg;
139 : SwChildWinWrapper* pChildWin;
140 :
141 : public:
142 : SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, vcl::Window *pParent);
143 : virtual ~SwModelessRedlineAcceptDlg();
144 : virtual void dispose() SAL_OVERRIDE;
145 :
146 : virtual void Activate() SAL_OVERRIDE;
147 : virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
148 : void Initialize (SfxChildWinInfo* pInfo);
149 : };
150 :
151 0 : class SwRedlineAcceptChild : public SwChildWinWrapper
152 : {
153 : public:
154 : SwRedlineAcceptChild( vcl::Window* ,
155 : sal_uInt16 nId,
156 : SfxBindings*,
157 : SfxChildWinInfo* );
158 :
159 : SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild );
160 :
161 : virtual bool ReInitDlg(SwDocShell *pDocSh) SAL_OVERRIDE;
162 : };
163 :
164 : /// Redline (Manage Changes) panel for the sidebar.
165 : class SwRedlineAcceptPanel : public PanelLayout, public SfxListener
166 : {
167 : SwRedlineAcceptDlg* mpImplDlg;
168 : public:
169 : SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame);
170 : virtual ~SwRedlineAcceptPanel();
171 : virtual void dispose() SAL_OVERRIDE;
172 :
173 : /// We need to be a SfxListener to be able to update the list of changes when we get SFX_HINT_DOCCHANGED.
174 : using Control::Notify;
175 : virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE;
176 : };
177 :
178 : #endif
179 :
180 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|