Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX
21 : #include "swdllapi.h"
22 : #include "chldwrap.hxx"
23 : #include <redline.hxx>
24 : #include <tools/datetime.hxx>
25 : #include <vcl/msgbox.hxx>
26 : #include <svl/eitem.hxx>
27 : #include <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>
34 :
35 : class SwChildWinWrapper;
36 :
37 : struct SwRedlineDataChild
38 : {
39 : const SwRedlineData* pChild; // link to original stacked data
40 : const SwRedlineDataChild* pNext; // link to stacked data
41 : SvTreeListEntry* pTLBChild; // corresponding TreeListBox entry
42 : };
43 :
44 0 : struct SwRedlineDataParent
45 : {
46 : const SwRedlineData* pData; // RedlineDataPtr
47 : const SwRedlineDataChild* pNext; // link to stacked data
48 : SvTreeListEntry* pTLBParent; // corresponding TreeListBox entry
49 : OUString sComment; // redline comment
50 :
51 : inline bool operator==( const SwRedlineDataParent& rObj ) const
52 : { return (pData && pData->GetSeqNo() == rObj.pData->GetSeqNo()); }
53 0 : inline bool operator< ( const SwRedlineDataParent& rObj ) const
54 0 : { return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); }
55 : };
56 :
57 : typedef boost::ptr_vector<SwRedlineDataParent> SwRedlineDataParentArr;
58 :
59 0 : class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to<SwRedlineDataParent> > {};
60 :
61 : typedef SwRedlineDataChild* SwRedlineDataChildPtr;
62 : typedef boost::ptr_vector<SwRedlineDataChild> SwRedlineDataChildArr;
63 :
64 : typedef SvTreeListEntry* SvLBoxEntryPtr;
65 : typedef std::vector<SvLBoxEntryPtr> SvLBoxEntryArr;
66 :
67 : class SW_DLLPUBLIC SwRedlineAcceptDlg
68 : {
69 : Dialog* pParentDlg;
70 : SwRedlineDataParentArr aRedlineParents;
71 : SwRedlineDataChildArr aRedlineChildren;
72 : SwRedlineDataParentSortArr aUsedSeqNo;
73 : SvxAcceptChgCtr aTabPagesCTRL;
74 : PopupMenu aPopup;
75 : Timer aDeselectTimer;
76 : Timer aSelectTimer;
77 : OUString sInserted;
78 : OUString sDeleted;
79 : OUString sFormated;
80 : OUString sTableChgd;
81 : OUString sFmtCollSet;
82 : OUString sFilterAction;
83 : OUString sAutoFormat;
84 : SvxTPView* pTPView;
85 : SvxRedlinTable* pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
86 : Link aOldSelectHdl;
87 : Link aOldDeselectHdl;
88 : bool bOnlyFormatedRedlines;
89 : bool bHasReadonlySel;
90 : bool bRedlnAutoFmt;
91 :
92 : // prevent update dialog data during longer operations (cf #102657#)
93 : bool bInhibitActivate;
94 :
95 : SAL_DLLPRIVATE DECL_LINK( AcceptHdl, void* );
96 : SAL_DLLPRIVATE DECL_LINK( AcceptAllHdl, void* );
97 : SAL_DLLPRIVATE DECL_LINK( RejectHdl, void* );
98 : SAL_DLLPRIVATE DECL_LINK( RejectAllHdl, void* );
99 : SAL_DLLPRIVATE DECL_LINK( UndoHdl, void* );
100 : SAL_DLLPRIVATE DECL_LINK( DeselectHdl, void* );
101 : SAL_DLLPRIVATE DECL_LINK( SelectHdl, void* );
102 : SAL_DLLPRIVATE DECL_LINK( GotoHdl, void* );
103 : SAL_DLLPRIVATE DECL_LINK( CommandHdl, void* );
104 :
105 : SAL_DLLPRIVATE sal_uInt16 CalcDiff(sal_uInt16 nStart, bool bChild);
106 : SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, const sal_uInt16 nAutoFmt);
107 : SAL_DLLPRIVATE void InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd = USHRT_MAX);
108 : SAL_DLLPRIVATE void RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd);
109 : SAL_DLLPRIVATE void InitAuthors();
110 :
111 : SAL_DLLPRIVATE OUString GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0);
112 : SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0);
113 : SAL_DLLPRIVATE sal_uInt16 GetRedlinePos( const SvTreeListEntry& rEntry) const;
114 :
115 : public:
116 : SwRedlineAcceptDlg(Dialog *pParent, bool bAutoFmt = false);
117 : virtual ~SwRedlineAcceptDlg();
118 :
119 : DECL_LINK( FilterChangedHdl, void *pDummy = 0 );
120 :
121 0 : inline SvxAcceptChgCtr& GetChgCtrl() { return aTabPagesCTRL; }
122 0 : inline bool HasRedlineAutoFmt() const { return bRedlnAutoFmt; }
123 :
124 : void Init(sal_uInt16 nStart = 0);
125 : void CallAcceptReject( bool bSelect, bool bAccept );
126 :
127 : void Initialize(const OUString &rExtraData);
128 : void FillInfo(OUString &rExtraData) const;
129 :
130 : virtual void Activate();
131 : };
132 :
133 : class SwModelessRedlineAcceptDlg : public SfxModelessDialog
134 : {
135 : SwRedlineAcceptDlg* pImplDlg;
136 : SwChildWinWrapper* pChildWin;
137 :
138 : public:
139 : SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, vcl::Window *pParent);
140 : virtual ~SwModelessRedlineAcceptDlg();
141 :
142 : virtual void Activate() SAL_OVERRIDE;
143 : virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
144 : void Initialize (SfxChildWinInfo* pInfo);
145 : };
146 :
147 0 : class SwRedlineAcceptChild : public SwChildWinWrapper
148 : {
149 : public:
150 : SwRedlineAcceptChild( vcl::Window* ,
151 : sal_uInt16 nId,
152 : SfxBindings*,
153 : SfxChildWinInfo* );
154 :
155 : SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild );
156 :
157 : virtual bool ReInitDlg(SwDocShell *pDocSh) SAL_OVERRIDE;
158 : };
159 :
160 : #endif
161 :
162 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|