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