xref: /AOO41X/main/sw/source/ui/misc/redlndlg.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORTDTOR
33*cdf0e10cSrcweir #define _SVSTDARR_USHORTSSORT
34*cdf0e10cSrcweir #define _SVSTDARR_USHORTS
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <redline.hxx>
38*cdf0e10cSrcweir #include <tools/datetime.hxx>
39*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
40*cdf0e10cSrcweir #include <svl/svstdarr.hxx>
41*cdf0e10cSrcweir #include <svl/eitem.hxx>
42*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
43*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
44*cdf0e10cSrcweir #include <svx/ctredlin.hxx>
45*cdf0e10cSrcweir #include <svx/postattr.hxx>
46*cdf0e10cSrcweir #include <swtypes.hxx>
47*cdf0e10cSrcweir #include <wrtsh.hxx>
48*cdf0e10cSrcweir #include <view.hxx>
49*cdf0e10cSrcweir #include <swmodule.hxx>
50*cdf0e10cSrcweir #ifndef _REDLNDLG_HXX
51*cdf0e10cSrcweir #define _REDLNACCEPTDLG
52*cdf0e10cSrcweir #include <redlndlg.hxx>
53*cdf0e10cSrcweir #endif
54*cdf0e10cSrcweir #include <swwait.hxx>
55*cdf0e10cSrcweir #include <uitool.hxx>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir #include <helpid.h>
58*cdf0e10cSrcweir #include <cmdid.h>
59*cdf0e10cSrcweir #include <misc.hrc>
60*cdf0e10cSrcweir #include <redlndlg.hrc>
61*cdf0e10cSrcweir #include <shells.hrc>
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir // -> #111827#
64*cdf0e10cSrcweir #include <comcore.hrc>
65*cdf0e10cSrcweir #include <swundo.hxx>
66*cdf0e10cSrcweir #include <SwRewriter.hxx>
67*cdf0e10cSrcweir // <- #111827#
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir #include <vector>
70*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
71*cdf0e10cSrcweir #include <svx/dialogs.hrc>
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir #include <unomid.h>
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir #include <docsh.hxx>
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir #include <IDocumentRedlineAccess.hxx>
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir /*------------------------------------------------------------------------
80*cdf0e10cSrcweir 	Beschreibung:
81*cdf0e10cSrcweir ------------------------------------------------------------------------*/
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG( SwRedlineAcceptChild, FN_REDLINE_ACCEPT )
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir SV_IMPL_PTRARR(SwRedlineDataParentArr, SwRedlineDataParentPtr)
86*cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT(SwRedlineDataParentSortArr, SwRedlineDataParentPtr)
87*cdf0e10cSrcweir SV_IMPL_PTRARR(SwRedlineDataChildArr, SwRedlineDataChildPtr)
88*cdf0e10cSrcweir SV_IMPL_PTRARR(SvLBoxEntryArr, SvLBoxEntryPtr)
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir static sal_uInt16 nSortMode = 0xffff;
91*cdf0e10cSrcweir static sal_Bool   bSortDir = sal_True;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir /*------------------------------------------------------------------------
94*cdf0e10cSrcweir 	Beschreibung:
95*cdf0e10cSrcweir ------------------------------------------------------------------------*/
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir SwRedlineAcceptChild::SwRedlineAcceptChild( Window* _pParent,
98*cdf0e10cSrcweir 											sal_uInt16 nId,
99*cdf0e10cSrcweir 											SfxBindings* pBindings,
100*cdf0e10cSrcweir 											SfxChildWinInfo* pInfo ) :
101*cdf0e10cSrcweir     SwChildWinWrapper( _pParent, nId )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     pWindow = new SwModelessRedlineAcceptDlg( pBindings, this, _pParent);
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	((SwModelessRedlineAcceptDlg *)pWindow)->Initialize(pInfo);
106*cdf0e10cSrcweir }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir /*--------------------------------------------------------------------
109*cdf0e10cSrcweir 	Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
110*cdf0e10cSrcweir  --------------------------------------------------------------------*/
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir sal_Bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh)
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir 	sal_Bool bRet;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 	if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True)	// Sofort aktualisieren, Dok-Wechsel
117*cdf0e10cSrcweir 		((SwModelessRedlineAcceptDlg*)GetWindow())->Activate();
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	return bRet;
120*cdf0e10cSrcweir }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir /*------------------------------------------------------------------------
123*cdf0e10cSrcweir 	Beschreibung:
124*cdf0e10cSrcweir ------------------------------------------------------------------------*/
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir SwModelessRedlineAcceptDlg::SwModelessRedlineAcceptDlg( SfxBindings* _pBindings,
127*cdf0e10cSrcweir 														SwChildWinWrapper* pChild,
128*cdf0e10cSrcweir                                                         Window *_pParent) :
129*cdf0e10cSrcweir     SfxModelessDialog(_pBindings, pChild, _pParent, SW_RES(DLG_REDLINE_ACCEPT)),
130*cdf0e10cSrcweir 	pChildWin		(pChild)
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir 	pImplDlg = new SwRedlineAcceptDlg(this);
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	FreeResource();
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir /*--------------------------------------------------------------------
138*cdf0e10cSrcweir 	Beschreibung:
139*cdf0e10cSrcweir  --------------------------------------------------------------------*/
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir void SwModelessRedlineAcceptDlg::Activate()
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir 	SwView *pView = ::GetActiveView();
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	if (!pView)	// Kann passieren, wenn man auf eine andere App umschaltet, wenn
146*cdf0e10cSrcweir 		return;	// vorher eine Listbox im Dialog den Focus hatte (eigentlich THs Bug)
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	SwDocShell *pDocSh = pView->GetDocShell();
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	if (pChildWin->GetOldDocShell() != pDocSh)
151*cdf0e10cSrcweir 	{	// Dok-Wechsel
152*cdf0e10cSrcweir 		SwWait aWait( *pDocSh, sal_False );
153*cdf0e10cSrcweir 		SwWrtShell* pSh = pView->GetWrtShellPtr();
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 		pChildWin->SetOldDocShell(pDocSh);	// Rekursion vermeiden (durch Modified-Hdl)
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 		sal_Bool bMod = pSh->IsModified();
158*cdf0e10cSrcweir 		SfxBoolItem aShow(FN_REDLINE_SHOW, sal_True);
159*cdf0e10cSrcweir 		pSh->GetView().GetViewFrame()->GetDispatcher()->Execute(
160*cdf0e10cSrcweir 			FN_REDLINE_SHOW, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aShow, 0L);
161*cdf0e10cSrcweir 		if (!bMod)
162*cdf0e10cSrcweir 			pSh->ResetModified();
163*cdf0e10cSrcweir 		pImplDlg->Init();
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 		return;
166*cdf0e10cSrcweir 	}
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	pImplDlg->Activate();
169*cdf0e10cSrcweir }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir /*--------------------------------------------------------------------
172*cdf0e10cSrcweir 	Beschreibung:
173*cdf0e10cSrcweir  --------------------------------------------------------------------*/
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo *pInfo)
176*cdf0e10cSrcweir {
177*cdf0e10cSrcweir 	String aStr;
178*cdf0e10cSrcweir 	if (pInfo != NULL)
179*cdf0e10cSrcweir 		pImplDlg->Initialize(pInfo->aExtraString);
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 	SfxModelessDialog::Initialize(pInfo);
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir /*--------------------------------------------------------------------
185*cdf0e10cSrcweir 	Beschreibung:
186*cdf0e10cSrcweir  --------------------------------------------------------------------*/
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const
189*cdf0e10cSrcweir {
190*cdf0e10cSrcweir 	SfxModelessDialog::FillInfo(rInfo);
191*cdf0e10cSrcweir 	pImplDlg->FillInfo(rInfo.aExtraString);
192*cdf0e10cSrcweir }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir /*------------------------------------------------------------------------
195*cdf0e10cSrcweir 	Beschreibung:
196*cdf0e10cSrcweir ------------------------------------------------------------------------*/
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir void SwModelessRedlineAcceptDlg::Resize()
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir 	pImplDlg->Resize();
201*cdf0e10cSrcweir 	SfxModelessDialog::Resize();
202*cdf0e10cSrcweir }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir /*------------------------------------------------------------------------
205*cdf0e10cSrcweir 	Beschreibung:
206*cdf0e10cSrcweir ------------------------------------------------------------------------*/
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg()
209*cdf0e10cSrcweir {
210*cdf0e10cSrcweir 	delete pImplDlg;
211*cdf0e10cSrcweir }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir /*------------------------------------------------------------------------
214*cdf0e10cSrcweir 	Beschreibung:
215*cdf0e10cSrcweir ------------------------------------------------------------------------*/
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir SwRedlineAcceptDlg::SwRedlineAcceptDlg(Dialog *pParent, sal_Bool bAutoFmt) :
218*cdf0e10cSrcweir 	pParentDlg		(pParent),
219*cdf0e10cSrcweir     aTabPagesCTRL   (pParent, SW_RES(CTRL_TABPAGES)),
220*cdf0e10cSrcweir     aPopup          (SW_RES(MN_REDLINE_POPUP)),
221*cdf0e10cSrcweir     sInserted       (SW_RES(STR_REDLINE_INSERTED)),
222*cdf0e10cSrcweir     sDeleted        (SW_RES(STR_REDLINE_DELETED)),
223*cdf0e10cSrcweir     sFormated       (SW_RES(STR_REDLINE_FORMATED)),
224*cdf0e10cSrcweir     sTableChgd      (SW_RES(STR_REDLINE_TABLECHG)),
225*cdf0e10cSrcweir     sFmtCollSet     (SW_RES(STR_REDLINE_FMTCOLLSET)),
226*cdf0e10cSrcweir     sAutoFormat     (SW_RES(STR_REDLINE_AUTOFMT)),
227*cdf0e10cSrcweir 	bOnlyFormatedRedlines( sal_False ),
228*cdf0e10cSrcweir 	bHasReadonlySel	( sal_False ),
229*cdf0e10cSrcweir 	bRedlnAutoFmt	(bAutoFmt),
230*cdf0e10cSrcweir     bInhibitActivate( false )
231*cdf0e10cSrcweir {
232*cdf0e10cSrcweir 	aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL);
233*cdf0e10cSrcweir 	pTPView = aTabPagesCTRL.GetViewPage();
234*cdf0e10cSrcweir 	pTable = pTPView->GetTableControl();
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 	pTPView->InsertWriterHeader();
237*cdf0e10cSrcweir 	pTPView->SetAcceptClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptHdl));
238*cdf0e10cSrcweir 	pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptAllHdl));
239*cdf0e10cSrcweir 	pTPView->SetRejectClickHdl(LINK(this, SwRedlineAcceptDlg, RejectHdl));
240*cdf0e10cSrcweir 	pTPView->SetRejectAllClickHdl(LINK(this, SwRedlineAcceptDlg, RejectAllHdl));
241*cdf0e10cSrcweir 	pTPView->SetUndoClickHdl(LINK(this, SwRedlineAcceptDlg, UndoHdl));
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 	aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 	ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction();
246*cdf0e10cSrcweir 	pActLB->InsertEntry(sInserted);
247*cdf0e10cSrcweir 	pActLB->InsertEntry(sDeleted);
248*cdf0e10cSrcweir 	pActLB->InsertEntry(sFormated);
249*cdf0e10cSrcweir 	pActLB->InsertEntry(sTableChgd);
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	if (HasRedlineAutoFmt())
252*cdf0e10cSrcweir 	{
253*cdf0e10cSrcweir 		pActLB->InsertEntry(sFmtCollSet);
254*cdf0e10cSrcweir 		pActLB->InsertEntry(sAutoFormat);
255*cdf0e10cSrcweir 		pTPView->ShowUndo(sal_True);
256*cdf0e10cSrcweir 		pTPView->DisableUndo();		// Noch gibts keine UNDO-Events
257*cdf0e10cSrcweir 	}
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 	pActLB->SelectEntryPos(0);
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 	pTable->SetStyle(pTable->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
262*cdf0e10cSrcweir 	pTable->SetNodeDefaultImages();
263*cdf0e10cSrcweir 	pTable->SetSelectionMode(MULTIPLE_SELECTION);
264*cdf0e10cSrcweir 	pTable->SetHighlightRange(1);
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	static long aStaticTabs[]=
267*cdf0e10cSrcweir 	{
268*cdf0e10cSrcweir 		4,10,70,120,170
269*cdf0e10cSrcweir 	};
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 	pTable->SetTabs(aStaticTabs);
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 	// Minimalgroesse setzen
274*cdf0e10cSrcweir 	Size aMinSz(aTabPagesCTRL.GetMinSizePixel());
275*cdf0e10cSrcweir 	Point aPos(aTabPagesCTRL.GetPosPixel());
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 	aMinSz.Width() += (aPos.X() * 2 - 1);
278*cdf0e10cSrcweir 	aMinSz.Height() += (aPos.Y() * 2 - 1);
279*cdf0e10cSrcweir 	pParentDlg->SetMinOutputSizePixel(aMinSz);
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 	if (pParentDlg->GetOutputSizePixel().Width() < aMinSz.Width())
282*cdf0e10cSrcweir 		pParentDlg->SetOutputSizePixel(Size(aMinSz.Width(), pParentDlg->GetOutputSizePixel().Height()));
283*cdf0e10cSrcweir 	if (pParentDlg->GetOutputSizePixel().Height() < aMinSz.Height())
284*cdf0e10cSrcweir 		pParentDlg->SetOutputSizePixel(Size(pParentDlg->GetOutputSizePixel().Width(), aMinSz.Height()));
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	pTable->SortByCol(nSortMode, bSortDir);
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 	aOldSelectHdl = pTable->GetSelectHdl();
289*cdf0e10cSrcweir 	aOldDeselectHdl = pTable->GetDeselectHdl();
290*cdf0e10cSrcweir 	pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
291*cdf0e10cSrcweir 	pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
292*cdf0e10cSrcweir 	pTable->SetCommandHdl(LINK(this, SwRedlineAcceptDlg, CommandHdl));
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 	// Flackern der Buttons vermeiden:
295*cdf0e10cSrcweir 	aDeselectTimer.SetTimeout(100);
296*cdf0e10cSrcweir 	aDeselectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 	// Mehrfachselektion der selben Texte vermeiden:
299*cdf0e10cSrcweir 	aSelectTimer.SetTimeout(100);
300*cdf0e10cSrcweir 	aSelectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, GotoHdl));
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir /*------------------------------------------------------------------------
304*cdf0e10cSrcweir 	Beschreibung:
305*cdf0e10cSrcweir ------------------------------------------------------------------------*/
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir /*------------------------------------------------------------------------
312*cdf0e10cSrcweir 	Beschreibung:
313*cdf0e10cSrcweir ------------------------------------------------------------------------*/
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir void SwRedlineAcceptDlg::Init(sal_uInt16 nStart)
316*cdf0e10cSrcweir {
317*cdf0e10cSrcweir 	SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False );
318*cdf0e10cSrcweir 	pTable->SetUpdateMode(sal_False);
319*cdf0e10cSrcweir 	aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count());
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 	if (nStart)
322*cdf0e10cSrcweir 		RemoveParents(nStart, aRedlineParents.Count() - 1);
323*cdf0e10cSrcweir 	else
324*cdf0e10cSrcweir 	{
325*cdf0e10cSrcweir 		pTable->Clear();
326*cdf0e10cSrcweir 		aRedlineChilds.DeleteAndDestroy(0, aRedlineChilds.Count());
327*cdf0e10cSrcweir 		aRedlineParents.DeleteAndDestroy(nStart, aRedlineParents.Count() - nStart);
328*cdf0e10cSrcweir 	}
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 	// Parents einfuegen
331*cdf0e10cSrcweir 	InsertParents(nStart);
332*cdf0e10cSrcweir 	InitAuthors();
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 	pTable->SetUpdateMode(sal_True);
335*cdf0e10cSrcweir     // #i69618# this moves the list box to the right position, visually
336*cdf0e10cSrcweir     SvLBoxEntry* pSelEntry = pTable->FirstSelected();
337*cdf0e10cSrcweir     if( pSelEntry )
338*cdf0e10cSrcweir         pTable->MakeVisible( pSelEntry, sal_True ); //#i70937#, force the scroll
339*cdf0e10cSrcweir }
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir /*------------------------------------------------------------------------
342*cdf0e10cSrcweir 	Beschreibung:
343*cdf0e10cSrcweir ------------------------------------------------------------------------*/
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir void SwRedlineAcceptDlg::InitAuthors()
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir 	SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 	SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage();
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 	String sAuthor;
352*cdf0e10cSrcweir 	SvStringsSortDtor aStrings;
353*cdf0e10cSrcweir 	String sOldAuthor(pFilterPage->GetSelectedAuthor());
354*cdf0e10cSrcweir 	pFilterPage->ClearAuthors();
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 	String sParent;
357*cdf0e10cSrcweir 	sal_uInt16 nCount = pSh->GetRedlineCount();
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 	bOnlyFormatedRedlines = sal_True;
360*cdf0e10cSrcweir 	bHasReadonlySel = sal_False;
361*cdf0e10cSrcweir 	sal_Bool bIsNotFormated = sal_False;
362*cdf0e10cSrcweir 	sal_uInt16 i;
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 	// Autoren ermitteln
365*cdf0e10cSrcweir 	for ( i = 0; i < nCount; i++)
366*cdf0e10cSrcweir 	{
367*cdf0e10cSrcweir 		const SwRedline& rRedln = pSh->GetRedline(i);
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 		if( bOnlyFormatedRedlines && nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType() )
370*cdf0e10cSrcweir 			bOnlyFormatedRedlines = sal_False;
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir //JP 27.9.2001: make no sense if we handle readonly sections
373*cdf0e10cSrcweir //		if( !bHasReadonlySel && rRedln.HasReadonlySel() )
374*cdf0e10cSrcweir //			bHasReadonlySel = sal_True;
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 		String *pAuthor = new String(rRedln.GetAuthorString());
377*cdf0e10cSrcweir 		if (!aStrings.Insert(pAuthor))
378*cdf0e10cSrcweir 			delete pAuthor;
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 		for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
381*cdf0e10cSrcweir 		{
382*cdf0e10cSrcweir 			pAuthor = new String(rRedln.GetAuthorString(nStack));
383*cdf0e10cSrcweir 			if (!aStrings.Insert(pAuthor))
384*cdf0e10cSrcweir 				delete pAuthor;
385*cdf0e10cSrcweir 		}
386*cdf0e10cSrcweir 	}
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 	for (i = 0; i < aStrings.Count(); i++)
389*cdf0e10cSrcweir 		pFilterPage->InsertAuthor(*aStrings[i]);
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir 	if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && aStrings.Count())
392*cdf0e10cSrcweir 		pFilterPage->SelectAuthor(*aStrings[0]);
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir     sal_Bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
395*cdf0e10cSrcweir 	sal_Bool bSel = pTable->FirstSelected() != 0;
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir 	SvLBoxEntry* pSelEntry = pTable->FirstSelected();
398*cdf0e10cSrcweir 	while (pSelEntry)
399*cdf0e10cSrcweir 	{
400*cdf0e10cSrcweir 		sal_uInt16 nPos = GetRedlinePos(*pSelEntry);
401*cdf0e10cSrcweir 		const SwRedline& rRedln = pSh->GetRedline( nPos );
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 		bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
404*cdf0e10cSrcweir 		pSelEntry = pTable->NextSelected(pSelEntry);
405*cdf0e10cSrcweir 	}
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 	pTPView->EnableAccept( bEnable && bSel );
408*cdf0e10cSrcweir 	pTPView->EnableReject( bEnable && bIsNotFormated && bSel );
409*cdf0e10cSrcweir 	pTPView->EnableAcceptAll( bEnable && !bHasReadonlySel );
410*cdf0e10cSrcweir 	pTPView->EnableRejectAll( bEnable && !bHasReadonlySel &&
411*cdf0e10cSrcweir 								!bOnlyFormatedRedlines );
412*cdf0e10cSrcweir }
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir /*------------------------------------------------------------------------
415*cdf0e10cSrcweir 	Beschreibung:
416*cdf0e10cSrcweir ------------------------------------------------------------------------*/
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir String SwRedlineAcceptDlg::GetRedlineText( const SwRedline& rRedln,
419*cdf0e10cSrcweir 										DateTime &rDateTime, sal_uInt16 nStack)
420*cdf0e10cSrcweir {
421*cdf0e10cSrcweir 	String sEntry(GetActionText(rRedln, nStack));
422*cdf0e10cSrcweir 	sEntry += '\t';
423*cdf0e10cSrcweir 	sEntry += rRedln.GetAuthorString(nStack);
424*cdf0e10cSrcweir 	sEntry += '\t';
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 	const DateTime &rDT = rRedln.GetTimeStamp(nStack);
427*cdf0e10cSrcweir 	rDateTime = rDT;
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 	sEntry += GetAppLangDateTimeString( rDT );
430*cdf0e10cSrcweir 	sEntry += '\t';
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 	sEntry += rRedln.GetComment(nStack);
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 	return sEntry;
435*cdf0e10cSrcweir }
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir /*------------------------------------------------------------------------
438*cdf0e10cSrcweir 	Beschreibung:
439*cdf0e10cSrcweir ------------------------------------------------------------------------*/
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir const String &SwRedlineAcceptDlg::GetActionText(const SwRedline& rRedln, sal_uInt16 nStack)
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir 	switch( rRedln.GetType(nStack) )
444*cdf0e10cSrcweir 	{
445*cdf0e10cSrcweir 		case nsRedlineType_t::REDLINE_INSERT:	return sInserted;
446*cdf0e10cSrcweir 		case nsRedlineType_t::REDLINE_DELETE:	return sDeleted;
447*cdf0e10cSrcweir 		case nsRedlineType_t::REDLINE_FORMAT:	return sFormated;
448*cdf0e10cSrcweir 		case nsRedlineType_t::REDLINE_TABLE: 	return sTableChgd;
449*cdf0e10cSrcweir 		case nsRedlineType_t::REDLINE_FMTCOLL: 	return sFmtCollSet;
450*cdf0e10cSrcweir         default:;//prevent warning
451*cdf0e10cSrcweir 	}
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir 	return aEmptyStr;
454*cdf0e10cSrcweir }
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir /*------------------------------------------------------------------------
457*cdf0e10cSrcweir 	Beschreibung:
458*cdf0e10cSrcweir ------------------------------------------------------------------------*/
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir void SwRedlineAcceptDlg::Resize()
461*cdf0e10cSrcweir {
462*cdf0e10cSrcweir 	Size aSz(pParentDlg->GetOutputSizePixel());
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir 	Point aPos(aTabPagesCTRL.GetPosPixel());
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	aSz.Width() -= (aPos.X() * 2 - 1);
467*cdf0e10cSrcweir 	aSz.Height() -= (aPos.Y() * 2 - 1);
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir 	aTabPagesCTRL.SetOutputSizePixel(aSz);
470*cdf0e10cSrcweir }
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir /*--------------------------------------------------------------------
473*cdf0e10cSrcweir 	Beschreibung: Nach Aktivierung neu initialisieren
474*cdf0e10cSrcweir  --------------------------------------------------------------------*/
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir void SwRedlineAcceptDlg::Activate()
477*cdf0e10cSrcweir {
478*cdf0e10cSrcweir     // prevent update if flag is set (#102547#)
479*cdf0e10cSrcweir     if( bInhibitActivate )
480*cdf0e10cSrcweir         return;
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 	SwView *pView = ::GetActiveView();
483*cdf0e10cSrcweir 	SwWait aWait( *pView->GetDocShell(), sal_False );
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir 	aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count());
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir 	if (!pView)	// Kann passieren, wenn man auf eine andere App umschaltet, wenn
488*cdf0e10cSrcweir 		return;	// vorher eine Listbox im Dialog den Focus hatte (eigentlich THs Bug)
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir /*	if (HasRedlineAutoFmt())
491*cdf0e10cSrcweir 	{
492*cdf0e10cSrcweir 		Init();
493*cdf0e10cSrcweir 		return;
494*cdf0e10cSrcweir 	}*/
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 	// Hat sich was geaendert?
497*cdf0e10cSrcweir 	SwWrtShell* pSh = pView->GetWrtShellPtr();
498*cdf0e10cSrcweir 	sal_uInt16 nCount = pSh->GetRedlineCount();
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir 	// Anzahl und Pointer ueberpruefen
501*cdf0e10cSrcweir 	SwRedlineDataParent *pParent = 0;
502*cdf0e10cSrcweir 	sal_uInt16 i;
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir 	for ( i = 0; i < nCount; i++)
505*cdf0e10cSrcweir 	{
506*cdf0e10cSrcweir 		const SwRedline& rRedln = pSh->GetRedline(i);
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 		if (i >= aRedlineParents.Count())
509*cdf0e10cSrcweir 		{
510*cdf0e10cSrcweir 			// Neue Eintraege wurden angehaengt
511*cdf0e10cSrcweir 			Init(i);
512*cdf0e10cSrcweir 			return;
513*cdf0e10cSrcweir 		}
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir 		pParent = aRedlineParents[i];
516*cdf0e10cSrcweir 		if (&rRedln.GetRedlineData() != pParent->pData)
517*cdf0e10cSrcweir 		{
518*cdf0e10cSrcweir 			// Redline-Parents wurden eingefuegt, geaendert oder geloescht
519*cdf0e10cSrcweir 			if ((i = CalcDiff(i, sal_False)) == USHRT_MAX)
520*cdf0e10cSrcweir 				return;
521*cdf0e10cSrcweir 			continue;
522*cdf0e10cSrcweir 		}
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 		const SwRedlineData *pRedlineData = rRedln.GetRedlineData().Next();
525*cdf0e10cSrcweir 		const SwRedlineDataChild *pBackupData = pParent->pNext;
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir 		if (!pRedlineData && pBackupData)
528*cdf0e10cSrcweir 		{
529*cdf0e10cSrcweir 			// Redline-Childs wurden geloescht
530*cdf0e10cSrcweir 			if ((i = CalcDiff(i, sal_True)) == USHRT_MAX)
531*cdf0e10cSrcweir 				return;
532*cdf0e10cSrcweir 			continue;
533*cdf0e10cSrcweir 		}
534*cdf0e10cSrcweir 		else
535*cdf0e10cSrcweir 		{
536*cdf0e10cSrcweir 			while (pRedlineData)
537*cdf0e10cSrcweir 			{
538*cdf0e10cSrcweir 				if (pRedlineData != pBackupData->pChild)
539*cdf0e10cSrcweir 				{
540*cdf0e10cSrcweir 					// Redline-Childs wurden eingefuegt, geaendert oder geloescht
541*cdf0e10cSrcweir 					if ((i = CalcDiff(i, sal_True)) == USHRT_MAX)
542*cdf0e10cSrcweir 						return;
543*cdf0e10cSrcweir 					continue;
544*cdf0e10cSrcweir 				}
545*cdf0e10cSrcweir 				if (pBackupData)
546*cdf0e10cSrcweir 					pBackupData = pBackupData->pNext;
547*cdf0e10cSrcweir 				pRedlineData = pRedlineData->Next();
548*cdf0e10cSrcweir 			}
549*cdf0e10cSrcweir 		}
550*cdf0e10cSrcweir 	}
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir 	if (nCount != aRedlineParents.Count())
553*cdf0e10cSrcweir 	{
554*cdf0e10cSrcweir 		// Redlines wurden am Ende geloescht
555*cdf0e10cSrcweir 		Init(nCount);
556*cdf0e10cSrcweir 		return;
557*cdf0e10cSrcweir 	}
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir 	// Kommentar ueberpruefen
560*cdf0e10cSrcweir 	for (i = 0; i < nCount; i++)
561*cdf0e10cSrcweir 	{
562*cdf0e10cSrcweir 		const SwRedline& rRedln = pSh->GetRedline(i);
563*cdf0e10cSrcweir 		pParent = aRedlineParents[i];
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir 		if(!rRedln.GetComment().Equals(pParent->sComment))
566*cdf0e10cSrcweir 		{
567*cdf0e10cSrcweir 			if (pParent->pTLBParent)
568*cdf0e10cSrcweir 			{
569*cdf0e10cSrcweir 				// Nur Kommentar aktualisieren
570*cdf0e10cSrcweir 				String sComment(rRedln.GetComment());
571*cdf0e10cSrcweir 				sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
572*cdf0e10cSrcweir 				pTable->SetEntryText(sComment, pParent->pTLBParent, 3);
573*cdf0e10cSrcweir 			}
574*cdf0e10cSrcweir 			pParent->sComment = rRedln.GetComment();
575*cdf0e10cSrcweir 		}
576*cdf0e10cSrcweir 	}
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir 	InitAuthors();
579*cdf0e10cSrcweir }
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir /* -----------------05.06.98 13:06-------------------
582*cdf0e10cSrcweir  *
583*cdf0e10cSrcweir  * --------------------------------------------------*/
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, sal_Bool bChild)
586*cdf0e10cSrcweir {
587*cdf0e10cSrcweir 	if (!nStart)
588*cdf0e10cSrcweir 	{
589*cdf0e10cSrcweir 		Init();
590*cdf0e10cSrcweir 		return USHRT_MAX;
591*cdf0e10cSrcweir 	}
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir 	pTable->SetUpdateMode(sal_False);
594*cdf0e10cSrcweir 	SwView *pView	= ::GetActiveView();
595*cdf0e10cSrcweir 	SwWrtShell* pSh	= pView->GetWrtShellPtr();
596*cdf0e10cSrcweir     sal_uInt16 nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
597*cdf0e10cSrcweir     SwRedlineDataParent *pParent = aRedlineParents[nStart];
598*cdf0e10cSrcweir 	const SwRedline& rRedln = pSh->GetRedline(nStart);
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir 	if (bChild)		// Sollte eigentlich nie vorkommen, aber sicher ist sicher...
601*cdf0e10cSrcweir 	{
602*cdf0e10cSrcweir 		// Alle Childs des Eintrags wegwerfen und neu initialisieren
603*cdf0e10cSrcweir 		SwRedlineDataChildPtr pBackupData = (SwRedlineDataChildPtr)pParent->pNext;
604*cdf0e10cSrcweir 		SwRedlineDataChildPtr pNext;
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir 		while (pBackupData)
607*cdf0e10cSrcweir 		{
608*cdf0e10cSrcweir 			pNext = (SwRedlineDataChildPtr)pBackupData->pNext;
609*cdf0e10cSrcweir 			if (pBackupData->pTLBChild)
610*cdf0e10cSrcweir                 pTable->RemoveEntry(pBackupData->pTLBChild);
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir 			aRedlineChilds.DeleteAndDestroy(aRedlineChilds.GetPos(pBackupData), 1);
613*cdf0e10cSrcweir 			pBackupData = pNext;
614*cdf0e10cSrcweir 		}
615*cdf0e10cSrcweir 		pParent->pNext = 0;
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir 		// Neue Childs einfuegen
618*cdf0e10cSrcweir 		InsertChilds(pParent, rRedln, nAutoFmt);
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir 		pTable->SetUpdateMode(sal_True);
621*cdf0e10cSrcweir 		return nStart;
622*cdf0e10cSrcweir 	}
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir 	// Wurden Eintraege geloescht?
625*cdf0e10cSrcweir 	const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
626*cdf0e10cSrcweir 	sal_uInt16 i;
627*cdf0e10cSrcweir 	for ( i = nStart + 1; i < aRedlineParents.Count(); i++)
628*cdf0e10cSrcweir 	{
629*cdf0e10cSrcweir 		if (aRedlineParents[i]->pData == pRedlineData)
630*cdf0e10cSrcweir 		{
631*cdf0e10cSrcweir 			// Eintraege von nStart bis i-1 entfernen
632*cdf0e10cSrcweir 			RemoveParents(nStart, i - 1);
633*cdf0e10cSrcweir 			pTable->SetUpdateMode(sal_True);
634*cdf0e10cSrcweir 			return nStart - 1;
635*cdf0e10cSrcweir 		}
636*cdf0e10cSrcweir 	}
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir 	// Wurden Eintraege eingefuegt?
639*cdf0e10cSrcweir 	sal_uInt16 nCount = pSh->GetRedlineCount();
640*cdf0e10cSrcweir 	pRedlineData = aRedlineParents[nStart]->pData;
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir 	for (i = nStart + 1; i < nCount; i++)
643*cdf0e10cSrcweir 	{
644*cdf0e10cSrcweir 		if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData)
645*cdf0e10cSrcweir 		{
646*cdf0e10cSrcweir 			// Eintraege von nStart bis i-1 einfuegen
647*cdf0e10cSrcweir 			InsertParents(nStart, i - 1);
648*cdf0e10cSrcweir 			pTable->SetUpdateMode(sal_True);
649*cdf0e10cSrcweir 			return nStart - 1;
650*cdf0e10cSrcweir 		}
651*cdf0e10cSrcweir 	}
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir 	pTable->SetUpdateMode(sal_True);
654*cdf0e10cSrcweir 	Init(nStart);	// Alle Eintraege bis zum Ende abgleichen
655*cdf0e10cSrcweir 	return USHRT_MAX;
656*cdf0e10cSrcweir }
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir /* -----------------05.06.98 13:57-------------------
659*cdf0e10cSrcweir  *
660*cdf0e10cSrcweir  * --------------------------------------------------*/
661*cdf0e10cSrcweir 
662*cdf0e10cSrcweir void SwRedlineAcceptDlg::InsertChilds(SwRedlineDataParent *pParent, const SwRedline& rRedln, const sal_uInt16 nAutoFmt)
663*cdf0e10cSrcweir {
664*cdf0e10cSrcweir 	String sChild;
665*cdf0e10cSrcweir 	SwRedlineDataChild *pLastRedlineChild = 0;
666*cdf0e10cSrcweir 	const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
667*cdf0e10cSrcweir 	sal_Bool bAutoFmt = (rRedln.GetRealType() & nAutoFmt) != 0;
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir 	const String *pAction = &GetActionText(rRedln);
670*cdf0e10cSrcweir 	sal_Bool bValidParent = !sFilterAction.Len() || sFilterAction == *pAction;
671*cdf0e10cSrcweir 	bValidParent = bValidParent && pTable->IsValidEntry(&rRedln.GetAuthorString(), &rRedln.GetTimeStamp(), &rRedln.GetComment());
672*cdf0e10cSrcweir 	if (nAutoFmt)
673*cdf0e10cSrcweir 	{
674*cdf0e10cSrcweir 		sal_uInt16 nPos;
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir 		if (pParent->pData->GetSeqNo() && !aUsedSeqNo.Insert(pParent, nPos))	// Gibts schon
677*cdf0e10cSrcweir 		{
678*cdf0e10cSrcweir 			if (pParent->pTLBParent)
679*cdf0e10cSrcweir 			{
680*cdf0e10cSrcweir 				pTable->SetEntryText(sAutoFormat, aUsedSeqNo[nPos]->pTLBParent, 0);
681*cdf0e10cSrcweir                 pTable->RemoveEntry(pParent->pTLBParent);
682*cdf0e10cSrcweir 				pParent->pTLBParent = 0;
683*cdf0e10cSrcweir 			}
684*cdf0e10cSrcweir 			return;
685*cdf0e10cSrcweir 		}
686*cdf0e10cSrcweir 		bValidParent = bValidParent && bAutoFmt;
687*cdf0e10cSrcweir 	}
688*cdf0e10cSrcweir 	sal_Bool bValidTree = bValidParent;
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir 	for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
691*cdf0e10cSrcweir 	{
692*cdf0e10cSrcweir 		pRedlineData = pRedlineData->Next();
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir 		SwRedlineDataChildPtr pRedlineChild = new SwRedlineDataChild;
695*cdf0e10cSrcweir 		pRedlineChild->pChild = pRedlineData;
696*cdf0e10cSrcweir 		aRedlineChilds.Insert(pRedlineChild, aRedlineChilds.Count());
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir 		if ( pLastRedlineChild )
699*cdf0e10cSrcweir 			pLastRedlineChild->pNext = pRedlineChild;
700*cdf0e10cSrcweir 		else
701*cdf0e10cSrcweir 			pParent->pNext = pRedlineChild;
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir 		pAction = &GetActionText(rRedln, nStack);
704*cdf0e10cSrcweir 		sal_Bool bValidChild = !sFilterAction.Len() || sFilterAction == *pAction;
705*cdf0e10cSrcweir 		bValidChild = bValidChild && pTable->IsValidEntry(&rRedln.GetAuthorString(nStack), &rRedln.GetTimeStamp(nStack), &rRedln.GetComment());
706*cdf0e10cSrcweir 		if (nAutoFmt)
707*cdf0e10cSrcweir 			bValidChild = bValidChild && bAutoFmt;
708*cdf0e10cSrcweir 		bValidTree |= bValidChild;
709*cdf0e10cSrcweir 
710*cdf0e10cSrcweir 		if (bValidChild)
711*cdf0e10cSrcweir 		{
712*cdf0e10cSrcweir 			RedlinData *pData = new RedlinData;
713*cdf0e10cSrcweir 			pData->pData = pRedlineChild;
714*cdf0e10cSrcweir 			pData->bDisabled = sal_True;
715*cdf0e10cSrcweir 			sChild = GetRedlineText(rRedln, pData->aDateTime, nStack);
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir 			SvLBoxEntry* pChild = pTable->InsertEntry(sChild, pData, pParent->pTLBParent);
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 			pRedlineChild->pTLBChild = pChild;
720*cdf0e10cSrcweir 			if (!bValidParent)
721*cdf0e10cSrcweir 				pTable->Expand(pParent->pTLBParent);
722*cdf0e10cSrcweir 		}
723*cdf0e10cSrcweir 		else
724*cdf0e10cSrcweir 			pRedlineChild->pTLBChild = 0;
725*cdf0e10cSrcweir 
726*cdf0e10cSrcweir 		pLastRedlineChild = pRedlineChild;
727*cdf0e10cSrcweir 	}
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir 	if (pLastRedlineChild)
730*cdf0e10cSrcweir 		pLastRedlineChild->pNext = 0;
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir 	if (!bValidTree && pParent->pTLBParent)
733*cdf0e10cSrcweir 	{
734*cdf0e10cSrcweir         pTable->RemoveEntry(pParent->pTLBParent);
735*cdf0e10cSrcweir 		pParent->pTLBParent = 0;
736*cdf0e10cSrcweir 		if (nAutoFmt)
737*cdf0e10cSrcweir 			aUsedSeqNo.Remove(pParent);
738*cdf0e10cSrcweir 	}
739*cdf0e10cSrcweir }
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir /* -----------------05.06.98 15:20-------------------
742*cdf0e10cSrcweir  *
743*cdf0e10cSrcweir  * --------------------------------------------------*/
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
746*cdf0e10cSrcweir {
747*cdf0e10cSrcweir 	SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
748*cdf0e10cSrcweir 	sal_uInt16 nCount = pSh->GetRedlineCount();
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir 	SvLBoxEntryArr aLBoxArr;
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir 	// Wegen Bug der TLB, die bei Remove den SelectHandler IMMER ruft:
753*cdf0e10cSrcweir 	pTable->SetSelectHdl(aOldSelectHdl);
754*cdf0e10cSrcweir 	pTable->SetDeselectHdl(aOldDeselectHdl);
755*cdf0e10cSrcweir 	sal_Bool bChildsRemoved = sal_False;
756*cdf0e10cSrcweir 	pTable->SelectAll(sal_False);
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir 	// Hinter dem letzten Eintrag Cursor setzen, da sonst Performance-Problem in TLB.
759*cdf0e10cSrcweir 	// TLB wuerde sonst bei jedem Remove den Cursor erneut umsetzen (teuer)
760*cdf0e10cSrcweir 	sal_uInt16 nPos = Min((sal_uInt16)nCount, (sal_uInt16)aRedlineParents.Count());
761*cdf0e10cSrcweir 	SvLBoxEntry *pCurEntry = NULL;
762*cdf0e10cSrcweir 	while( ( pCurEntry == NULL ) && ( nPos > 0 ) )
763*cdf0e10cSrcweir 	{
764*cdf0e10cSrcweir 		--nPos;
765*cdf0e10cSrcweir 		pCurEntry = aRedlineParents[nPos]->pTLBParent;
766*cdf0e10cSrcweir 	}
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 	if (pCurEntry)
769*cdf0e10cSrcweir 		pTable->SetCurEntry(pCurEntry);
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir 	SvLBoxTreeList*	pModel = pTable->GetModel();
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir 	for (sal_uInt16 i = nStart; i <= nEnd; i++)
774*cdf0e10cSrcweir 	{
775*cdf0e10cSrcweir 		if (!bChildsRemoved && aRedlineParents[i]->pNext)
776*cdf0e10cSrcweir 		{
777*cdf0e10cSrcweir 			SwRedlineDataChildPtr pChildPtr = (SwRedlineDataChildPtr)aRedlineParents[i]->pNext;
778*cdf0e10cSrcweir             sal_uInt16 nChildPos = aRedlineChilds.GetPos(pChildPtr);
779*cdf0e10cSrcweir 
780*cdf0e10cSrcweir             if (nChildPos != USHRT_MAX)
781*cdf0e10cSrcweir 			{
782*cdf0e10cSrcweir 				sal_uInt16 nChilds = 0;
783*cdf0e10cSrcweir 
784*cdf0e10cSrcweir 				while (pChildPtr)
785*cdf0e10cSrcweir 				{
786*cdf0e10cSrcweir 					pChildPtr = (SwRedlineDataChildPtr)pChildPtr->pNext;
787*cdf0e10cSrcweir 					nChilds++;
788*cdf0e10cSrcweir 				}
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir                 aRedlineChilds.DeleteAndDestroy(nChildPos, nChilds);
791*cdf0e10cSrcweir 				bChildsRemoved = sal_True;
792*cdf0e10cSrcweir 			}
793*cdf0e10cSrcweir 		}
794*cdf0e10cSrcweir 		SvLBoxEntry *pEntry = aRedlineParents[i]->pTLBParent;
795*cdf0e10cSrcweir 		if (pEntry)
796*cdf0e10cSrcweir 		{
797*cdf0e10cSrcweir             long nIdx = aLBoxArr.Count() - 1L;
798*cdf0e10cSrcweir 			sal_uLong nAbsPos = pModel->GetAbsPos(pEntry);
799*cdf0e10cSrcweir 			while (nIdx >= 0 &&
800*cdf0e10cSrcweir                     pModel->GetAbsPos(aLBoxArr[ static_cast< sal_uInt16 >(nIdx) ]) > nAbsPos)
801*cdf0e10cSrcweir 				nIdx--;
802*cdf0e10cSrcweir             aLBoxArr.Insert( pEntry, static_cast< sal_uInt16 >(++nIdx) );
803*cdf0e10cSrcweir 		}
804*cdf0e10cSrcweir 	}
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 	// TLB von hinten abraeumen
807*cdf0e10cSrcweir 	long nIdx = (long)aLBoxArr.Count() - 1L;
808*cdf0e10cSrcweir 	while (nIdx >= 0)
809*cdf0e10cSrcweir         pTable->RemoveEntry(aLBoxArr[ static_cast< sal_uInt16 >(nIdx--) ]);
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir 	pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
812*cdf0e10cSrcweir 	pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
813*cdf0e10cSrcweir 	// Durch Remove wurde leider wieder dauernd von der TLB selektiert...
814*cdf0e10cSrcweir 	pTable->SelectAll(sal_False);
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 	aRedlineParents.DeleteAndDestroy( nStart, nEnd - nStart + 1);
817*cdf0e10cSrcweir }
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir /* -----------------05.06.98 15:20-------------------
820*cdf0e10cSrcweir  *
821*cdf0e10cSrcweir  * --------------------------------------------------*/
822*cdf0e10cSrcweir 
823*cdf0e10cSrcweir void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
824*cdf0e10cSrcweir {
825*cdf0e10cSrcweir 	SwView *pView	= ::GetActiveView();
826*cdf0e10cSrcweir 	SwWrtShell* pSh	= pView->GetWrtShellPtr();
827*cdf0e10cSrcweir 	sal_uInt16 nAutoFmt	= HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir 	String sParent;
830*cdf0e10cSrcweir 	sal_uInt16 nCount = pSh->GetRedlineCount();
831*cdf0e10cSrcweir 	nEnd = Min((sal_uInt16)nEnd, (sal_uInt16)(nCount - 1));	// Handelt auch nEnd=USHRT_MAX (bis zum Ende) ab
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir 	if (nEnd == USHRT_MAX)
834*cdf0e10cSrcweir 		return;		// Keine Redlines im Dokument
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir 	RedlinData *pData;
837*cdf0e10cSrcweir     SvLBoxEntry *pParent;
838*cdf0e10cSrcweir 	SwRedlineDataParentPtr pRedlineParent;
839*cdf0e10cSrcweir 	const SwRedline* pCurrRedline;
840*cdf0e10cSrcweir 	if( !nStart && !pTable->FirstSelected() )
841*cdf0e10cSrcweir 	{
842*cdf0e10cSrcweir 		pCurrRedline = pSh->GetCurrRedline();
843*cdf0e10cSrcweir 		if( !pCurrRedline )
844*cdf0e10cSrcweir 		{
845*cdf0e10cSrcweir 			pSh->SwCrsrShell::Push();
846*cdf0e10cSrcweir 			if( 0 == (pCurrRedline = pSh->SelNextRedline()))
847*cdf0e10cSrcweir 				pCurrRedline = pSh->SelPrevRedline();
848*cdf0e10cSrcweir 			pSh->SwCrsrShell::Pop( sal_False );
849*cdf0e10cSrcweir 		}
850*cdf0e10cSrcweir 	}
851*cdf0e10cSrcweir 	else
852*cdf0e10cSrcweir 		pCurrRedline = 0;
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 	for (sal_uInt16 i = nStart; i <= nEnd; i++)
855*cdf0e10cSrcweir 	{
856*cdf0e10cSrcweir 		const SwRedline& rRedln = pSh->GetRedline(i);
857*cdf0e10cSrcweir 		const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir 		pRedlineParent = new SwRedlineDataParent;
860*cdf0e10cSrcweir 		pRedlineParent->pData	 = pRedlineData;
861*cdf0e10cSrcweir 		pRedlineParent->pNext	 = 0;
862*cdf0e10cSrcweir 		String sComment(rRedln.GetComment());
863*cdf0e10cSrcweir 		sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
864*cdf0e10cSrcweir 		pRedlineParent->sComment = sComment;
865*cdf0e10cSrcweir 		aRedlineParents.Insert(pRedlineParent, i);
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 		pData = new RedlinData;
868*cdf0e10cSrcweir 		pData->pData = pRedlineParent;
869*cdf0e10cSrcweir 		pData->bDisabled = sal_False;
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir 		sParent = GetRedlineText(rRedln, pData->aDateTime);
872*cdf0e10cSrcweir 		pParent = pTable->InsertEntry(sParent, pData, 0, i);
873*cdf0e10cSrcweir 		if( pCurrRedline == &rRedln )
874*cdf0e10cSrcweir 		{
875*cdf0e10cSrcweir 			pTable->SetCurEntry( pParent );
876*cdf0e10cSrcweir 			pTable->Select( pParent );
877*cdf0e10cSrcweir 			pTable->MakeVisible( pParent );
878*cdf0e10cSrcweir 		}
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir 		pRedlineParent->pTLBParent = pParent;
881*cdf0e10cSrcweir 
882*cdf0e10cSrcweir 		InsertChilds(pRedlineParent, rRedln, nAutoFmt);
883*cdf0e10cSrcweir 	}
884*cdf0e10cSrcweir }
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir /* -----------------05.06.98 13:06-------------------
887*cdf0e10cSrcweir  *
888*cdf0e10cSrcweir  * --------------------------------------------------*/
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir void SwRedlineAcceptDlg::CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept )
891*cdf0e10cSrcweir {
892*cdf0e10cSrcweir 	SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
893*cdf0e10cSrcweir 	SvLBoxEntry* pEntry = bSelect ? pTable->FirstSelected() : pTable->First();
894*cdf0e10cSrcweir 	sal_uLong nPos = LONG_MAX;
895*cdf0e10cSrcweir 
896*cdf0e10cSrcweir     typedef std::vector<SvLBoxEntry*> ListBoxEntries_t;
897*cdf0e10cSrcweir     ListBoxEntries_t aRedlines;
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir     // don't activate
900*cdf0e10cSrcweir     DBG_ASSERT( bInhibitActivate == false,
901*cdf0e10cSrcweir                 "recursive call of CallAcceptReject?");
902*cdf0e10cSrcweir     bInhibitActivate = true;
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir     // collect redlines-to-be-accepted/rejected in aRedlines vector
905*cdf0e10cSrcweir 	while( pEntry )
906*cdf0e10cSrcweir 	{
907*cdf0e10cSrcweir 		if( !pTable->GetParent( pEntry ) )
908*cdf0e10cSrcweir 		{
909*cdf0e10cSrcweir 			if( bSelect && LONG_MAX == nPos )
910*cdf0e10cSrcweir 				nPos = pTable->GetModel()->GetAbsPos( pEntry );
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir 			RedlinData *pData = (RedlinData *)pEntry->GetUserData();
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir 			if( !pData->bDisabled )
915*cdf0e10cSrcweir 				aRedlines.push_back( pEntry );
916*cdf0e10cSrcweir 		}
917*cdf0e10cSrcweir 
918*cdf0e10cSrcweir 		pEntry = bSelect ? pTable->NextSelected(pEntry) : pTable->Next(pEntry);
919*cdf0e10cSrcweir 	}
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir 	sal_Bool (SwEditShell:: *FnAccRej)( sal_uInt16 ) = &SwEditShell::AcceptRedline;
922*cdf0e10cSrcweir 	if( !bAccept )
923*cdf0e10cSrcweir 		FnAccRej = &SwEditShell::RejectRedline;
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir 	SwWait aWait( *pSh->GetView().GetDocShell(), sal_True );
926*cdf0e10cSrcweir 	pSh->StartAction();
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir     // #111827#
929*cdf0e10cSrcweir     if (aRedlines.size() > 1)
930*cdf0e10cSrcweir     {
931*cdf0e10cSrcweir         String aTmpStr;
932*cdf0e10cSrcweir         {
933*cdf0e10cSrcweir             SwRewriter aRewriter;
934*cdf0e10cSrcweir             aRewriter.AddRule(UNDO_ARG1,
935*cdf0e10cSrcweir                               String::CreateFromInt32(aRedlines.size()));
936*cdf0e10cSrcweir             aTmpStr = aRewriter.Apply(String(SW_RES(STR_N_REDLINES)));
937*cdf0e10cSrcweir         }
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir         SwRewriter aRewriter;
940*cdf0e10cSrcweir         aRewriter.AddRule(UNDO_ARG1, aTmpStr);
941*cdf0e10cSrcweir 
942*cdf0e10cSrcweir         pSh->StartUndo(bAccept? UNDO_ACCEPT_REDLINE : UNDO_REJECT_REDLINE,
943*cdf0e10cSrcweir                        &aRewriter);
944*cdf0e10cSrcweir     }
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir     // accept/reject the the redlines in aRedlines. The absolute
947*cdf0e10cSrcweir     // position may change during the process (e.g. when two redlines
948*cdf0e10cSrcweir     // are merged in result of another one being deleted), so the
949*cdf0e10cSrcweir     // position must be resolved late and checked before using it.
950*cdf0e10cSrcweir     // (cf #102547#)
951*cdf0e10cSrcweir     ListBoxEntries_t::iterator aEnd = aRedlines.end();
952*cdf0e10cSrcweir 	for( ListBoxEntries_t::iterator aIter = aRedlines.begin();
953*cdf0e10cSrcweir          aIter != aEnd;
954*cdf0e10cSrcweir          aIter++ )
955*cdf0e10cSrcweir     {
956*cdf0e10cSrcweir         sal_uInt16 nPosition = GetRedlinePos( **aIter );
957*cdf0e10cSrcweir         if( nPosition != USHRT_MAX )
958*cdf0e10cSrcweir             (pSh->*FnAccRej)( nPosition );
959*cdf0e10cSrcweir     }
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir     // #111827#
962*cdf0e10cSrcweir     if (aRedlines.size() > 1)
963*cdf0e10cSrcweir     {
964*cdf0e10cSrcweir         pSh->EndUndo();
965*cdf0e10cSrcweir     }
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir 	pSh->EndAction();
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir     bInhibitActivate = false;
970*cdf0e10cSrcweir 	Activate();
971*cdf0e10cSrcweir 
972*cdf0e10cSrcweir 	if( ULONG_MAX != nPos && pTable->GetEntryCount() )
973*cdf0e10cSrcweir 	{
974*cdf0e10cSrcweir 		if( nPos >= pTable->GetEntryCount() )
975*cdf0e10cSrcweir 			nPos = pTable->GetEntryCount() - 1;
976*cdf0e10cSrcweir 		pEntry = pTable->GetEntry( nPos );
977*cdf0e10cSrcweir 		if( !pEntry && nPos-- )
978*cdf0e10cSrcweir 			pEntry = pTable->GetEntry( nPos );
979*cdf0e10cSrcweir 		if( pEntry )
980*cdf0e10cSrcweir 		{
981*cdf0e10cSrcweir 			pTable->Select( pEntry );
982*cdf0e10cSrcweir 			pTable->MakeVisible( pEntry );
983*cdf0e10cSrcweir 			pTable->SetCurEntry(pEntry);
984*cdf0e10cSrcweir 		}
985*cdf0e10cSrcweir 	}
986*cdf0e10cSrcweir 	pTPView->EnableUndo();
987*cdf0e10cSrcweir }
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir /*--------------------------------------------------------------------
990*cdf0e10cSrcweir 	Beschreibung:
991*cdf0e10cSrcweir  --------------------------------------------------------------------*/
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir sal_uInt16 SwRedlineAcceptDlg::GetRedlinePos( const SvLBoxEntry& rEntry ) const
994*cdf0e10cSrcweir {
995*cdf0e10cSrcweir 	SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
996*cdf0e10cSrcweir 	return pSh->FindRedlineOfData( *((SwRedlineDataParent*)((RedlinData *)
997*cdf0e10cSrcweir 									rEntry.GetUserData())->pData)->pData );
998*cdf0e10cSrcweir }
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir /*--------------------------------------------------------------------
1001*cdf0e10cSrcweir 	Beschreibung:
1002*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1003*cdf0e10cSrcweir 
1004*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, AcceptHdl, void*, EMPTYARG)
1005*cdf0e10cSrcweir {
1006*cdf0e10cSrcweir 	CallAcceptReject( sal_True, sal_True );
1007*cdf0e10cSrcweir 	return 0;
1008*cdf0e10cSrcweir }
1009*cdf0e10cSrcweir 
1010*cdf0e10cSrcweir /*--------------------------------------------------------------------
1011*cdf0e10cSrcweir 	Beschreibung:
1012*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1013*cdf0e10cSrcweir 
1014*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, AcceptAllHdl, void*, EMPTYARG )
1015*cdf0e10cSrcweir {
1016*cdf0e10cSrcweir 	CallAcceptReject( sal_False, sal_True );
1017*cdf0e10cSrcweir 	return 0;
1018*cdf0e10cSrcweir }
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir /*--------------------------------------------------------------------
1021*cdf0e10cSrcweir 	Beschreibung:
1022*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1023*cdf0e10cSrcweir 
1024*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, RejectHdl, void*, EMPTYARG )
1025*cdf0e10cSrcweir {
1026*cdf0e10cSrcweir 	CallAcceptReject( sal_True, sal_False );
1027*cdf0e10cSrcweir 	return 0;
1028*cdf0e10cSrcweir }
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir /*--------------------------------------------------------------------
1031*cdf0e10cSrcweir 	Beschreibung:
1032*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1033*cdf0e10cSrcweir 
1034*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, RejectAllHdl, void*, EMPTYARG )
1035*cdf0e10cSrcweir {
1036*cdf0e10cSrcweir 	CallAcceptReject( sal_False, sal_False );
1037*cdf0e10cSrcweir 	return 0;
1038*cdf0e10cSrcweir }
1039*cdf0e10cSrcweir 
1040*cdf0e10cSrcweir /*--------------------------------------------------------------------
1041*cdf0e10cSrcweir 	Beschreibung:
1042*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, UndoHdl, void*, EMPTYARG )
1045*cdf0e10cSrcweir {
1046*cdf0e10cSrcweir 	SwView * pView = ::GetActiveView();
1047*cdf0e10cSrcweir 	pView->GetViewFrame()->GetDispatcher()->
1048*cdf0e10cSrcweir 				Execute(SID_UNDO, SFX_CALLMODE_SYNCHRON);
1049*cdf0e10cSrcweir 	pTPView->EnableUndo(pView->GetSlotState(SID_UNDO) != 0);
1050*cdf0e10cSrcweir 
1051*cdf0e10cSrcweir 	Activate();
1052*cdf0e10cSrcweir 
1053*cdf0e10cSrcweir 	return 0;
1054*cdf0e10cSrcweir }
1055*cdf0e10cSrcweir 
1056*cdf0e10cSrcweir /*--------------------------------------------------------------------
1057*cdf0e10cSrcweir 	Beschreibung:
1058*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1059*cdf0e10cSrcweir 
1060*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, FilterChangedHdl, void*, EMPTYARG )
1061*cdf0e10cSrcweir {
1062*cdf0e10cSrcweir 	SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage();
1063*cdf0e10cSrcweir 
1064*cdf0e10cSrcweir 	if (pFilterTP->IsAction())
1065*cdf0e10cSrcweir 		sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry();
1066*cdf0e10cSrcweir 	else
1067*cdf0e10cSrcweir 		sFilterAction = aEmptyStr;
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir 	Init();
1070*cdf0e10cSrcweir 
1071*cdf0e10cSrcweir 	return 0;
1072*cdf0e10cSrcweir }
1073*cdf0e10cSrcweir 
1074*cdf0e10cSrcweir /*--------------------------------------------------------------------
1075*cdf0e10cSrcweir 	Beschreibung:
1076*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1077*cdf0e10cSrcweir 
1078*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, DeselectHdl, void*, EMPTYARG )
1079*cdf0e10cSrcweir {
1080*cdf0e10cSrcweir 	// Flackern der Buttons vermeiden:
1081*cdf0e10cSrcweir 	aDeselectTimer.Start();
1082*cdf0e10cSrcweir 
1083*cdf0e10cSrcweir 	return 0;
1084*cdf0e10cSrcweir }
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir /*--------------------------------------------------------------------
1087*cdf0e10cSrcweir 	Beschreibung:
1088*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1089*cdf0e10cSrcweir 
1090*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, SelectHdl, void*, EMPTYARG )
1091*cdf0e10cSrcweir {
1092*cdf0e10cSrcweir 	aDeselectTimer.Stop();
1093*cdf0e10cSrcweir 	aSelectTimer.Start();
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir 	return 0;
1096*cdf0e10cSrcweir }
1097*cdf0e10cSrcweir 
1098*cdf0e10cSrcweir /*--------------------------------------------------------------------
1099*cdf0e10cSrcweir 	Beschreibung:
1100*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, GotoHdl, void*, EMPTYARG )
1103*cdf0e10cSrcweir {
1104*cdf0e10cSrcweir 	SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
1105*cdf0e10cSrcweir 	aSelectTimer.Stop();
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir 	sal_Bool bIsNotFormated = sal_False;
1108*cdf0e10cSrcweir 	sal_Bool bSel = sal_False;
1109*cdf0e10cSrcweir //  sal_Bool bReadonlySel = sal_False;
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir     //#98883# don't select redlines while the dialog is not focussed
1112*cdf0e10cSrcweir     //#107938# But not only ask pTable if it has the focus. To move
1113*cdf0e10cSrcweir     //         the selection to the selected redline any child of pParentDlg
1114*cdf0e10cSrcweir     //         may the focus.
1115*cdf0e10cSrcweir     SvLBoxEntry* pSelEntry = 0;
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir     if (pParentDlg->HasChildPathFocus())
1118*cdf0e10cSrcweir         pSelEntry = pTable->FirstSelected();
1119*cdf0e10cSrcweir 
1120*cdf0e10cSrcweir     if( pSelEntry )
1121*cdf0e10cSrcweir 	{
1122*cdf0e10cSrcweir 		SvLBoxEntry* pActEntry = pSelEntry;
1123*cdf0e10cSrcweir 		pSh->StartAction();
1124*cdf0e10cSrcweir 		pSh->EnterStdMode();
1125*cdf0e10cSrcweir 		pSh->SetCareWin(pParentDlg);
1126*cdf0e10cSrcweir 
1127*cdf0e10cSrcweir 		while (pSelEntry)
1128*cdf0e10cSrcweir 		{
1129*cdf0e10cSrcweir 			if (pTable->GetParent(pSelEntry))
1130*cdf0e10cSrcweir 			{
1131*cdf0e10cSrcweir 				pActEntry = pTable->GetParent(pSelEntry);
1132*cdf0e10cSrcweir 
1133*cdf0e10cSrcweir 				if (pTable->IsSelected(pActEntry))
1134*cdf0e10cSrcweir 				{
1135*cdf0e10cSrcweir 					pSelEntry = pActEntry = pTable->NextSelected(pSelEntry);
1136*cdf0e10cSrcweir 					continue;	// Nicht zweimal selektieren
1137*cdf0e10cSrcweir 				}
1138*cdf0e10cSrcweir 			}
1139*cdf0e10cSrcweir 			else
1140*cdf0e10cSrcweir 				bSel = sal_True;
1141*cdf0e10cSrcweir 
1142*cdf0e10cSrcweir 			// #98864# find the selected redline (ignore, if the redline is already gone)
1143*cdf0e10cSrcweir 			sal_uInt16 nPos = GetRedlinePos(*pActEntry);
1144*cdf0e10cSrcweir 			if( nPos != USHRT_MAX )
1145*cdf0e10cSrcweir 			{
1146*cdf0e10cSrcweir 
1147*cdf0e10cSrcweir 				const SwRedline& rRedln = pSh->GetRedline( nPos );
1148*cdf0e10cSrcweir 				bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
1149*cdf0e10cSrcweir 
1150*cdf0e10cSrcweir //JP 27.9.2001: make no sense if we handle readonly sections
1151*cdf0e10cSrcweir //			if( !bReadonlySel && rRedln.HasReadonlySel() )
1152*cdf0e10cSrcweir //				bReadonlySel = sal_True;
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir 				if (pSh->GotoRedline(nPos, sal_True))
1155*cdf0e10cSrcweir 				{
1156*cdf0e10cSrcweir 					pSh->SetInSelect();
1157*cdf0e10cSrcweir 					pSh->EnterAddMode();
1158*cdf0e10cSrcweir 				}
1159*cdf0e10cSrcweir 			}
1160*cdf0e10cSrcweir 
1161*cdf0e10cSrcweir             pSelEntry = pActEntry = pTable->NextSelected(pSelEntry);
1162*cdf0e10cSrcweir 		}
1163*cdf0e10cSrcweir 
1164*cdf0e10cSrcweir 		pSh->LeaveAddMode();
1165*cdf0e10cSrcweir 		pSh->EndAction();
1166*cdf0e10cSrcweir 		pSh->SetCareWin(NULL);
1167*cdf0e10cSrcweir 	}
1168*cdf0e10cSrcweir     sal_Bool bEnable = !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
1169*cdf0e10cSrcweir     pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ );
1170*cdf0e10cSrcweir     pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ );
1171*cdf0e10cSrcweir     pTPView->EnableRejectAll( bEnable && !bOnlyFormatedRedlines && !bHasReadonlySel );
1172*cdf0e10cSrcweir 
1173*cdf0e10cSrcweir 	return 0;
1174*cdf0e10cSrcweir }
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir /*--------------------------------------------------------------------
1177*cdf0e10cSrcweir 	Beschreibung:
1178*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1179*cdf0e10cSrcweir 
1180*cdf0e10cSrcweir IMPL_LINK( SwRedlineAcceptDlg, CommandHdl, void*, EMPTYARG )
1181*cdf0e10cSrcweir {
1182*cdf0e10cSrcweir 	const CommandEvent aCEvt(pTable->GetCommandEvent());
1183*cdf0e10cSrcweir 
1184*cdf0e10cSrcweir 	switch ( aCEvt.GetCommand() )
1185*cdf0e10cSrcweir 	{
1186*cdf0e10cSrcweir 		case COMMAND_CONTEXTMENU:
1187*cdf0e10cSrcweir 		{
1188*cdf0e10cSrcweir 			SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
1189*cdf0e10cSrcweir 			SvLBoxEntry* pEntry = pTable->FirstSelected();
1190*cdf0e10cSrcweir 			const SwRedline *pRed = 0;
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir 			if (pEntry)
1193*cdf0e10cSrcweir 			{
1194*cdf0e10cSrcweir 				SvLBoxEntry* pTopEntry = pEntry;
1195*cdf0e10cSrcweir 
1196*cdf0e10cSrcweir 				if (pTable->GetParent(pEntry))
1197*cdf0e10cSrcweir 					pTopEntry = pTable->GetParent(pEntry);
1198*cdf0e10cSrcweir 
1199*cdf0e10cSrcweir 				sal_uInt16 nPos = GetRedlinePos(*pTopEntry);
1200*cdf0e10cSrcweir 
1201*cdf0e10cSrcweir 				// Bei geschuetzten Bereichen kommentieren disablen
1202*cdf0e10cSrcweir 				if ((pRed = pSh->GotoRedline(nPos, sal_True)) != 0)
1203*cdf0e10cSrcweir 				{
1204*cdf0e10cSrcweir 					if( pSh->IsCrsrPtAtEnd() )
1205*cdf0e10cSrcweir 						pSh->SwapPam();
1206*cdf0e10cSrcweir 					pSh->SetInSelect();
1207*cdf0e10cSrcweir 				}
1208*cdf0e10cSrcweir 			}
1209*cdf0e10cSrcweir 
1210*cdf0e10cSrcweir 			aPopup.EnableItem( MN_EDIT_COMMENT, pEntry && pRed &&
1211*cdf0e10cSrcweir 											!pTable->GetParent(pEntry) &&
1212*cdf0e10cSrcweir 											!pTable->NextSelected(pEntry)
1213*cdf0e10cSrcweir //JP 27.9.2001: make no sense if we handle readonly sections
1214*cdf0e10cSrcweir //											&& pRed->HasReadonlySel()
1215*cdf0e10cSrcweir 											);
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir 			aPopup.EnableItem( MN_SUB_SORT, pTable->First() != 0 );
1218*cdf0e10cSrcweir 			sal_uInt16 nColumn = pTable->GetSortedCol();
1219*cdf0e10cSrcweir 			if (nColumn == 0xffff)
1220*cdf0e10cSrcweir 				nColumn = 4;
1221*cdf0e10cSrcweir 
1222*cdf0e10cSrcweir 			PopupMenu *pSubMenu = aPopup.GetPopupMenu(MN_SUB_SORT);
1223*cdf0e10cSrcweir 			if (pSubMenu)
1224*cdf0e10cSrcweir 			{
1225*cdf0e10cSrcweir 				for (sal_uInt16 i = MN_SORT_ACTION; i < MN_SORT_ACTION + 5; i++)
1226*cdf0e10cSrcweir 					pSubMenu->CheckItem(i, sal_False);
1227*cdf0e10cSrcweir 
1228*cdf0e10cSrcweir 				pSubMenu->CheckItem(nColumn + MN_SORT_ACTION);
1229*cdf0e10cSrcweir 			}
1230*cdf0e10cSrcweir 
1231*cdf0e10cSrcweir 			sal_uInt16 nRet = aPopup.Execute(pTable, aCEvt.GetMousePosPixel());
1232*cdf0e10cSrcweir 
1233*cdf0e10cSrcweir 			switch( nRet )
1234*cdf0e10cSrcweir 			{
1235*cdf0e10cSrcweir 				case MN_EDIT_COMMENT:
1236*cdf0e10cSrcweir 				{
1237*cdf0e10cSrcweir 					String sComment;
1238*cdf0e10cSrcweir 					if (pEntry)
1239*cdf0e10cSrcweir 					{
1240*cdf0e10cSrcweir 						if (pTable->GetParent(pEntry))
1241*cdf0e10cSrcweir 							pEntry = pTable->GetParent(pEntry);
1242*cdf0e10cSrcweir 
1243*cdf0e10cSrcweir 						sal_uInt16 nPos = GetRedlinePos(*pEntry);
1244*cdf0e10cSrcweir 						const SwRedline &rRedline = pSh->GetRedline(nPos);
1245*cdf0e10cSrcweir 
1246*cdf0e10cSrcweir 
1247*cdf0e10cSrcweir 						/* enable again once we have redline comments in the margin
1248*cdf0e10cSrcweir 						sComment = rRedline.GetComment();
1249*cdf0e10cSrcweir 						if ( sComment == String(::rtl::OUString::createFromAscii("")) )
1250*cdf0e10cSrcweir 							GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED));
1251*cdf0e10cSrcweir 						const_cast<SwRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS));
1252*cdf0e10cSrcweir 						*/
1253*cdf0e10cSrcweir 
1254*cdf0e10cSrcweir 						sComment = rRedline.GetComment();
1255*cdf0e10cSrcweir 						SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1256*cdf0e10cSrcweir                         DBG_ASSERT(pFact, "Dialogdiet fail!");
1257*cdf0e10cSrcweir 						::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
1258*cdf0e10cSrcweir                         DBG_ASSERT(fnGetRange, "Dialogdiet fail! GetRanges()");
1259*cdf0e10cSrcweir 						SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() );
1260*cdf0e10cSrcweir 
1261*cdf0e10cSrcweir 						aSet.Put(SvxPostItTextItem(sComment.ConvertLineEnd(), SID_ATTR_POSTIT_TEXT));
1262*cdf0e10cSrcweir 						aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
1263*cdf0e10cSrcweir 
1264*cdf0e10cSrcweir 						aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString(
1265*cdf0e10cSrcweir 									rRedline.GetRedlineData().GetTimeStamp() ),
1266*cdf0e10cSrcweir 									SID_ATTR_POSTIT_DATE ));
1267*cdf0e10cSrcweir 
1268*cdf0e10cSrcweir                         AbstractSvxPostItDialog* pDlg = pFact->CreateSvxPostItDialog( pParentDlg, aSet, sal_False );
1269*cdf0e10cSrcweir                         DBG_ASSERT(pDlg, "Dialogdiet fail!");
1270*cdf0e10cSrcweir 
1271*cdf0e10cSrcweir 						pDlg->HideAuthor();
1272*cdf0e10cSrcweir 
1273*cdf0e10cSrcweir 						sal_uInt16 nResId = 0;
1274*cdf0e10cSrcweir 						switch( rRedline.GetType() )
1275*cdf0e10cSrcweir 						{
1276*cdf0e10cSrcweir 						case nsRedlineType_t::REDLINE_INSERT:
1277*cdf0e10cSrcweir 							nResId = STR_REDLINE_INSERTED;
1278*cdf0e10cSrcweir 							break;
1279*cdf0e10cSrcweir 						case nsRedlineType_t::REDLINE_DELETE:
1280*cdf0e10cSrcweir 							nResId = STR_REDLINE_DELETED;
1281*cdf0e10cSrcweir 							break;
1282*cdf0e10cSrcweir 						case nsRedlineType_t::REDLINE_FORMAT:
1283*cdf0e10cSrcweir 							nResId = STR_REDLINE_FORMATED;
1284*cdf0e10cSrcweir 							break;
1285*cdf0e10cSrcweir 						case nsRedlineType_t::REDLINE_TABLE:
1286*cdf0e10cSrcweir 							nResId = STR_REDLINE_TABLECHG;
1287*cdf0e10cSrcweir 							break;
1288*cdf0e10cSrcweir                         default:;//prevent warning
1289*cdf0e10cSrcweir 						}
1290*cdf0e10cSrcweir 						String sTitle(SW_RES(STR_REDLINE_COMMENT));
1291*cdf0e10cSrcweir 						if( nResId )
1292*cdf0e10cSrcweir 							sTitle += SW_RESSTR( nResId );
1293*cdf0e10cSrcweir 						pDlg->SetText(sTitle);
1294*cdf0e10cSrcweir 
1295*cdf0e10cSrcweir 						pSh->SetCareWin(pDlg->GetWindow());
1296*cdf0e10cSrcweir 
1297*cdf0e10cSrcweir 						if ( pDlg->Execute() == RET_OK )
1298*cdf0e10cSrcweir 						{
1299*cdf0e10cSrcweir 							const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
1300*cdf0e10cSrcweir 							String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
1301*cdf0e10cSrcweir 
1302*cdf0e10cSrcweir 							// Kommentar einfuegen bzw aendern
1303*cdf0e10cSrcweir 							pSh->SetRedlineComment(sMsg);
1304*cdf0e10cSrcweir 							sMsg.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
1305*cdf0e10cSrcweir 							pTable->SetEntryText(sMsg, pEntry, 3);
1306*cdf0e10cSrcweir 						}
1307*cdf0e10cSrcweir 
1308*cdf0e10cSrcweir 						delete pDlg;
1309*cdf0e10cSrcweir 						pSh->SetCareWin(NULL);
1310*cdf0e10cSrcweir 					}
1311*cdf0e10cSrcweir 
1312*cdf0e10cSrcweir 				}
1313*cdf0e10cSrcweir 				break;
1314*cdf0e10cSrcweir 
1315*cdf0e10cSrcweir 			case MN_SORT_ACTION:
1316*cdf0e10cSrcweir 			case MN_SORT_AUTHOR:
1317*cdf0e10cSrcweir 			case MN_SORT_DATE:
1318*cdf0e10cSrcweir 			case MN_SORT_COMMENT:
1319*cdf0e10cSrcweir 			case MN_SORT_POSITION:
1320*cdf0e10cSrcweir 				{
1321*cdf0e10cSrcweir 					bSortDir = sal_True;
1322*cdf0e10cSrcweir 					if (nRet - MN_SORT_ACTION == 4 && pTable->GetSortedCol() == 0xffff)
1323*cdf0e10cSrcweir 						break;	// Haben wir schon
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir 					nSortMode = nRet - MN_SORT_ACTION;
1326*cdf0e10cSrcweir 					if (nSortMode == 4)
1327*cdf0e10cSrcweir 						nSortMode = 0xffff;	// unsortiert bzw sortiert nach Position
1328*cdf0e10cSrcweir 
1329*cdf0e10cSrcweir 					if (pTable->GetSortedCol() == nSortMode)
1330*cdf0e10cSrcweir 						bSortDir = !pTable->GetSortDirection();
1331*cdf0e10cSrcweir 
1332*cdf0e10cSrcweir 					SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False );
1333*cdf0e10cSrcweir 					pTable->SortByCol(nSortMode, bSortDir);
1334*cdf0e10cSrcweir 					if (nSortMode == 0xffff)
1335*cdf0e10cSrcweir 						Init();				// Alles neu fuellen
1336*cdf0e10cSrcweir 				}
1337*cdf0e10cSrcweir 				break;
1338*cdf0e10cSrcweir 			}
1339*cdf0e10cSrcweir 		}
1340*cdf0e10cSrcweir 		break;
1341*cdf0e10cSrcweir 	}
1342*cdf0e10cSrcweir 
1343*cdf0e10cSrcweir 	return 0;
1344*cdf0e10cSrcweir }
1345*cdf0e10cSrcweir 
1346*cdf0e10cSrcweir /*--------------------------------------------------------------------
1347*cdf0e10cSrcweir 	Beschreibung:
1348*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir void SwRedlineAcceptDlg::Initialize(const String& rExtraData)
1351*cdf0e10cSrcweir {
1352*cdf0e10cSrcweir 	if (rExtraData.Len())
1353*cdf0e10cSrcweir 	{
1354*cdf0e10cSrcweir 		sal_uInt16 nPos = rExtraData.Search(C2S("AcceptChgDat:"));
1355*cdf0e10cSrcweir 
1356*cdf0e10cSrcweir 		// Versuche, den Alignment-String "ALIGN:(...)" einzulesen; wenn
1357*cdf0e10cSrcweir 		// er nicht vorhanden ist, liegt eine "altere Version vor
1358*cdf0e10cSrcweir 		if (nPos != STRING_NOTFOUND)
1359*cdf0e10cSrcweir 		{
1360*cdf0e10cSrcweir 			sal_uInt16 n1 = rExtraData.Search('(', nPos);
1361*cdf0e10cSrcweir 			if (n1 != STRING_NOTFOUND)
1362*cdf0e10cSrcweir 			{
1363*cdf0e10cSrcweir 				sal_uInt16 n2 = rExtraData.Search(')', n1);
1364*cdf0e10cSrcweir 				if (n2 != STRING_NOTFOUND)
1365*cdf0e10cSrcweir 				{
1366*cdf0e10cSrcweir 					// Alignment-String herausschneiden
1367*cdf0e10cSrcweir 					String aStr = rExtraData.Copy(nPos, n2 - nPos + 1);
1368*cdf0e10cSrcweir 					aStr.Erase(0, n1 - nPos + 1);
1369*cdf0e10cSrcweir 
1370*cdf0e10cSrcweir 					if (aStr.Len())
1371*cdf0e10cSrcweir 					{
1372*cdf0e10cSrcweir                         sal_uInt16 nCount = static_cast< sal_uInt16 >(aStr.ToInt32());
1373*cdf0e10cSrcweir 
1374*cdf0e10cSrcweir 						for (sal_uInt16 i = 0; i < nCount; i++)
1375*cdf0e10cSrcweir 						{
1376*cdf0e10cSrcweir                             sal_uInt16 n3 = aStr.Search(';');
1377*cdf0e10cSrcweir                             aStr.Erase(0, n3 + 1);
1378*cdf0e10cSrcweir 							pTable->SetTab(i, aStr.ToInt32(), MAP_PIXEL);
1379*cdf0e10cSrcweir 						}
1380*cdf0e10cSrcweir 					}
1381*cdf0e10cSrcweir 				}
1382*cdf0e10cSrcweir 			}
1383*cdf0e10cSrcweir 		}
1384*cdf0e10cSrcweir 	}
1385*cdf0e10cSrcweir }
1386*cdf0e10cSrcweir 
1387*cdf0e10cSrcweir /*--------------------------------------------------------------------
1388*cdf0e10cSrcweir 	Beschreibung:
1389*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1390*cdf0e10cSrcweir 
1391*cdf0e10cSrcweir void SwRedlineAcceptDlg::FillInfo(String &rExtraData) const
1392*cdf0e10cSrcweir {
1393*cdf0e10cSrcweir 	rExtraData.AppendAscii("AcceptChgDat:(");
1394*cdf0e10cSrcweir 
1395*cdf0e10cSrcweir 	sal_uInt16	nCount = pTable->TabCount();
1396*cdf0e10cSrcweir 
1397*cdf0e10cSrcweir 	rExtraData += String::CreateFromInt32(nCount);
1398*cdf0e10cSrcweir 	rExtraData += ';';
1399*cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < nCount; i++)
1400*cdf0e10cSrcweir 	{
1401*cdf0e10cSrcweir 		rExtraData += String::CreateFromInt32( pTable->GetTab(i) );
1402*cdf0e10cSrcweir 		rExtraData += ';';
1403*cdf0e10cSrcweir 	}
1404*cdf0e10cSrcweir 	rExtraData += ')';
1405*cdf0e10cSrcweir }
1406