xref: /trunk/main/sw/source/ui/inc/redlndlg.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SWREDLNDLG_HXX
24 #define _SWREDLNDLG_HXX
25 #include "swdllapi.h"
26 #include "chldwrap.hxx"
27 #include <redline.hxx>
28 #include <tools/datetime.hxx>
29 #include <vcl/msgbox.hxx>
30 #ifndef _SVSTDARR_HXX
31 #include <svl/svstdarr.hxx>
32 #endif
33 #include <svl/eitem.hxx>
34 #include <sfx2/basedlgs.hxx>
35 #include <sfx2/viewfrm.hxx>
36 #include <sfx2/dispatch.hxx>
37 #include <svx/ctredlin.hxx>
38 #include <svx/postattr.hxx>
39 
40 class SwChildWinWrapper;
41 
42 struct SwRedlineDataChild
43 {
44 	const SwRedlineData*		pChild;		// Verweis auf originale gestackte Daten
45 	const SwRedlineDataChild*	pNext;		// Verweis auf gestackte Daten
46 	SvLBoxEntry*				pTLBChild;	// zugehoeriger TreeListBox-Eintrag
47 };
48 
49 struct SwRedlineDataParent
50 {
51 	const SwRedlineData*		pData;		// RedlineDataPtr
52 	const SwRedlineDataChild*	pNext;		// Verweis auf gestackte Daten
53 	SvLBoxEntry*				pTLBParent;	// zugehoeriger TreeListBox-Eintrag
54 	String						sComment;	// Redline-Kommentar
55 
operator ==SwRedlineDataParent56 	inline sal_Bool	operator==( const SwRedlineDataParent& rObj ) const
57 						{ return (pData && pData->GetSeqNo() == rObj.pData->GetSeqNo()); }
operator <SwRedlineDataParent58 	inline sal_Bool	operator< ( const SwRedlineDataParent& rObj ) const
59 						{ return (pData && pData->GetSeqNo() <  rObj.pData->GetSeqNo()); }
60 };
61 
62 typedef SwRedlineDataParent* SwRedlineDataParentPtr;
63 SV_DECL_PTRARR_DEL(SwRedlineDataParentArr, SwRedlineDataParentPtr, 10, 20)
64 
65 
66 SV_DECL_PTRARR_SORT(SwRedlineDataParentSortArr, SwRedlineDataParentPtr, 10, 20)
67 
68 
69 typedef SwRedlineDataChild* SwRedlineDataChildPtr;
70 SV_DECL_PTRARR_DEL(SwRedlineDataChildArr, SwRedlineDataChildPtr, 4, 4)
71 
72 
73 typedef SvLBoxEntry* SvLBoxEntryPtr;
74 SV_DECL_PTRARR(SvLBoxEntryArr, SvLBoxEntryPtr, 100, 100)
75 
76 class SW_DLLPUBLIC SwRedlineAcceptDlg
77 {
78 	Dialog*					pParentDlg;
79 	SwRedlineDataParentArr	aRedlineParents;
80 	SwRedlineDataChildArr	aRedlineChilds;
81 	SwRedlineDataParentSortArr aUsedSeqNo;
82 	SvxAcceptChgCtr			aTabPagesCTRL;
83 	PopupMenu				aPopup;
84 	Timer					aDeselectTimer;
85 	Timer					aSelectTimer;
86 	String					sInserted;
87 	String					sDeleted;
88 	String					sFormated;
89 	String					sTableChgd;
90 	String					sFmtCollSet;
91 	String					sFilterAction;
92 	String					sAutoFormat;
93 	Size					aBorderSz;
94 	SvxTPView*				pTPView;
95 	SvxRedlinTable*			pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
96 	Link					aOldSelectHdl;
97 	Link					aOldDeselectHdl;
98 	sal_Bool 					bOnlyFormatedRedlines;
99 	sal_Bool					bHasReadonlySel;
100 	sal_Bool					bRedlnAutoFmt;
101 
102     // prevent update dialog data during longer operations (cf #102657#)
103     bool                    bInhibitActivate;
104 
105 	SW_DLLPRIVATE DECL_LINK( AcceptHdl,		void* );
106 	SW_DLLPRIVATE DECL_LINK( AcceptAllHdl,	void* );
107 	SW_DLLPRIVATE DECL_LINK( RejectHdl,		void* );
108 	SW_DLLPRIVATE DECL_LINK( RejectAllHdl,	void* );
109 	SW_DLLPRIVATE DECL_LINK( UndoHdl,			void* );
110 	SW_DLLPRIVATE DECL_LINK( DeselectHdl,		void* );
111 	SW_DLLPRIVATE DECL_LINK( SelectHdl,		void* );
112 	SW_DLLPRIVATE DECL_LINK( GotoHdl,			void* );
113 	SW_DLLPRIVATE DECL_LINK( CommandHdl,		void* );
114 
115 	SW_DLLPRIVATE sal_uInt16			CalcDiff(sal_uInt16 nStart, sal_Bool bChild);
116 	SW_DLLPRIVATE void			InsertChilds(SwRedlineDataParent *pParent, const SwRedline& rRedln, const sal_uInt16 nAutoFmt);
117 	SW_DLLPRIVATE void			InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd = USHRT_MAX);
118 	SW_DLLPRIVATE void			RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd);
119 	SW_DLLPRIVATE void			InitAuthors();
120 
121 	SW_DLLPRIVATE String			GetRedlineText(const SwRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0);
122 	SW_DLLPRIVATE const String&	GetActionText(const SwRedline& rRedln, sal_uInt16 nStack = 0);
123 	SW_DLLPRIVATE sal_uInt16			GetRedlinePos( const SvLBoxEntry& rEntry) const;
124 
125 public:
126 	SwRedlineAcceptDlg(Dialog *pParent, sal_Bool bAutoFmt = sal_False);
127 	virtual ~SwRedlineAcceptDlg();
128 
129 	DECL_LINK( FilterChangedHdl, void *pDummy = 0 );
130 
GetChgCtrl()131 	inline SvxAcceptChgCtr* GetChgCtrl()		{ return &aTabPagesCTRL; }
HasRedlineAutoFmt() const132 	inline sal_Bool		HasRedlineAutoFmt() const 	{ return bRedlnAutoFmt; }
133 
134 	void			Init(sal_uInt16 nStart = 0);
135 	void			CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept );
136 
137 	void			Initialize(const String &rExtraData);
138 	void			FillInfo(String &rExtraData) const;
139 
140 	virtual void	Activate();
141 	virtual void	Resize();
142 };
143 
144 /*------------------------------------------------------------------------
145 	Beschreibung:
146 ------------------------------------------------------------------------*/
147 
148 class SwModelessRedlineAcceptDlg : public SfxModelessDialog
149 {
150 	SwRedlineAcceptDlg*		pImplDlg;
151 	SwChildWinWrapper*		pChildWin;
152 
153 	virtual void	Resize();
154 
155 public:
156 	SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, Window *pParent);
157 	~SwModelessRedlineAcceptDlg();
158 
159 	virtual void	Activate();
160 	virtual void	FillInfo(SfxChildWinInfo&) const;
161 	void			Initialize (SfxChildWinInfo* pInfo);
162 };
163 
164 
165 /*------------------------------------------------------------------------
166 	Beschreibung:
167 ------------------------------------------------------------------------*/
168 
169 class SwRedlineAcceptChild : public SwChildWinWrapper
170 {
171 public:
172 	SwRedlineAcceptChild(	Window* ,
173 							sal_uInt16 nId,
174 							SfxBindings*,
175 							SfxChildWinInfo*  );
176 
177 	SFX_DECL_CHILDWINDOW( SwRedlineAcceptChild );
178 
179 	virtual sal_Bool	ReInitDlg(SwDocShell *pDocSh);
180 };
181 
182 
183 #endif
184 
185 
186