1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SWREDLNDLG_HXX
20 #define _SWREDLNDLG_HXX
22 #include "chldwrap.hxx"
23 #include <redline.hxx>
24 #include <tools/datetime.hxx>
25 #include <vcl/msgbox.hxx>
26 #include <svl/eitem.hxx>
27 #include <sfx2/basedlgs.hxx>
28 #include <sfx2/viewfrm.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <svx/ctredlin.hxx>
31 #include <svx/postattr.hxx>
32 #include <boost/ptr_container/ptr_vector.hpp>
33 #include <o3tl/sorted_vector.hxx>
35 class SwChildWinWrapper
;
37 struct SwRedlineDataChild
39 const SwRedlineData
* pChild
; // link to original stacked data
40 const SwRedlineDataChild
* pNext
; // link to stacked data
41 SvTreeListEntry
* pTLBChild
; // corresponding TreeListBox entry
44 struct SwRedlineDataParent
46 const SwRedlineData
* pData
; // RedlineDataPtr
47 const SwRedlineDataChild
* pNext
; // link to stacked data
48 SvTreeListEntry
* pTLBParent
; // corresponding TreeListBox entry
49 String sComment
; // redline comment
51 inline sal_Bool
operator==( const SwRedlineDataParent
& rObj
) const
52 { return (pData
&& pData
->GetSeqNo() == rObj
.pData
->GetSeqNo()); }
53 inline sal_Bool
operator< ( const SwRedlineDataParent
& rObj
) const
54 { return (pData
&& pData
->GetSeqNo() < rObj
.pData
->GetSeqNo()); }
57 typedef boost::ptr_vector
<SwRedlineDataParent
> SwRedlineDataParentArr
;
59 class SwRedlineDataParentSortArr
: public o3tl::sorted_vector
<SwRedlineDataParent
*, o3tl::less_ptr_to
<SwRedlineDataParent
> > {};
62 typedef SwRedlineDataChild
* SwRedlineDataChildPtr
;
63 typedef boost::ptr_vector
<SwRedlineDataChild
> SwRedlineDataChildArr
;
66 typedef SvTreeListEntry
* SvLBoxEntryPtr
;
67 typedef std::vector
<SvLBoxEntryPtr
> SvLBoxEntryArr
;
69 class SW_DLLPUBLIC SwRedlineAcceptDlg
72 SwRedlineDataParentArr aRedlineParents
;
73 SwRedlineDataChildArr aRedlineChildren
;
74 SwRedlineDataParentSortArr aUsedSeqNo
;
75 SvxAcceptChgCtr aTabPagesCTRL
;
87 SvxRedlinTable
* pTable
; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
90 sal_Bool bOnlyFormatedRedlines
;
91 sal_Bool bHasReadonlySel
;
92 sal_Bool bRedlnAutoFmt
;
94 // prevent update dialog data during longer operations (cf #102657#)
95 bool bInhibitActivate
;
97 SW_DLLPRIVATE
DECL_LINK( AcceptHdl
, void* );
98 SW_DLLPRIVATE
DECL_LINK( AcceptAllHdl
, void* );
99 SW_DLLPRIVATE
DECL_LINK( RejectHdl
, void* );
100 SW_DLLPRIVATE
DECL_LINK( RejectAllHdl
, void* );
101 SW_DLLPRIVATE
DECL_LINK( UndoHdl
, void* );
102 SW_DLLPRIVATE
DECL_LINK( DeselectHdl
, void* );
103 SW_DLLPRIVATE
DECL_LINK( SelectHdl
, void* );
104 SW_DLLPRIVATE
DECL_LINK( GotoHdl
, void* );
105 SW_DLLPRIVATE
DECL_LINK( CommandHdl
, void* );
107 SW_DLLPRIVATE sal_uInt16
CalcDiff(sal_uInt16 nStart
, sal_Bool bChild
);
108 SW_DLLPRIVATE
void InsertChildren(SwRedlineDataParent
*pParent
, const SwRedline
& rRedln
, const sal_uInt16 nAutoFmt
);
109 SW_DLLPRIVATE
void InsertParents(sal_uInt16 nStart
, sal_uInt16 nEnd
= USHRT_MAX
);
110 SW_DLLPRIVATE
void RemoveParents(sal_uInt16 nStart
, sal_uInt16 nEnd
);
111 SW_DLLPRIVATE
void InitAuthors();
113 SW_DLLPRIVATE String
GetRedlineText(const SwRedline
& rRedln
, DateTime
&rDateTime
, sal_uInt16 nStack
= 0);
114 SW_DLLPRIVATE
const String
& GetActionText(const SwRedline
& rRedln
, sal_uInt16 nStack
= 0);
115 SW_DLLPRIVATE sal_uInt16
GetRedlinePos( const SvTreeListEntry
& rEntry
) const;
118 SwRedlineAcceptDlg(Dialog
*pParent
, sal_Bool bAutoFmt
= sal_False
);
119 virtual ~SwRedlineAcceptDlg();
121 DECL_LINK( FilterChangedHdl
, void *pDummy
= 0 );
123 inline SvxAcceptChgCtr
* GetChgCtrl() { return &aTabPagesCTRL
; }
124 inline sal_Bool
HasRedlineAutoFmt() const { return bRedlnAutoFmt
; }
126 void Init(sal_uInt16 nStart
= 0);
127 void CallAcceptReject( sal_Bool bSelect
, sal_Bool bAccept
);
129 void Initialize(const String
&rExtraData
);
130 void FillInfo(String
&rExtraData
) const;
132 virtual void Activate();
135 class SwModelessRedlineAcceptDlg
: public SfxModelessDialog
137 SwRedlineAcceptDlg
* pImplDlg
;
138 SwChildWinWrapper
* pChildWin
;
141 SwModelessRedlineAcceptDlg(SfxBindings
*, SwChildWinWrapper
*, Window
*pParent
);
142 ~SwModelessRedlineAcceptDlg();
144 virtual void Activate();
145 virtual void FillInfo(SfxChildWinInfo
&) const;
146 void Initialize (SfxChildWinInfo
* pInfo
);
149 class SwRedlineAcceptChild
: public SwChildWinWrapper
152 SwRedlineAcceptChild( Window
* ,
157 SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild
);
159 virtual sal_Bool
ReInitDlg(SwDocShell
*pDocSh
);
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */