1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _SWREDLNDLG_HXX 28 #define _SWREDLNDLG_HXX 29 #include "swdllapi.h" 30 #include "chldwrap.hxx" 31 #include <redline.hxx> 32 #include <tools/datetime.hxx> 33 #include <vcl/msgbox.hxx> 34 #ifndef _SVSTDARR_HXX 35 #include <svl/svstdarr.hxx> 36 #endif 37 #include <svl/eitem.hxx> 38 #include <sfx2/basedlgs.hxx> 39 #include <sfx2/viewfrm.hxx> 40 #include <sfx2/dispatch.hxx> 41 #include <svx/ctredlin.hxx> 42 #include <svx/postattr.hxx> 43 44 class SwChildWinWrapper; 45 46 struct SwRedlineDataChild 47 { 48 const SwRedlineData* pChild; // Verweis auf originale gestackte Daten 49 const SwRedlineDataChild* pNext; // Verweis auf gestackte Daten 50 SvLBoxEntry* pTLBChild; // zugehoeriger TreeListBox-Eintrag 51 }; 52 53 struct SwRedlineDataParent 54 { 55 const SwRedlineData* pData; // RedlineDataPtr 56 const SwRedlineDataChild* pNext; // Verweis auf gestackte Daten 57 SvLBoxEntry* pTLBParent; // zugehoeriger TreeListBox-Eintrag 58 String sComment; // Redline-Kommentar 59 60 inline sal_Bool operator==( const SwRedlineDataParent& rObj ) const 61 { return (pData && pData->GetSeqNo() == rObj.pData->GetSeqNo()); } 62 inline sal_Bool operator< ( const SwRedlineDataParent& rObj ) const 63 { return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); } 64 }; 65 66 typedef SwRedlineDataParent* SwRedlineDataParentPtr; 67 SV_DECL_PTRARR_DEL(SwRedlineDataParentArr, SwRedlineDataParentPtr, 10, 20) 68 69 70 SV_DECL_PTRARR_SORT(SwRedlineDataParentSortArr, SwRedlineDataParentPtr, 10, 20) 71 72 73 typedef SwRedlineDataChild* SwRedlineDataChildPtr; 74 SV_DECL_PTRARR_DEL(SwRedlineDataChildArr, SwRedlineDataChildPtr, 4, 4) 75 76 77 typedef SvLBoxEntry* SvLBoxEntryPtr; 78 SV_DECL_PTRARR(SvLBoxEntryArr, SvLBoxEntryPtr, 100, 100) 79 80 class SW_DLLPUBLIC SwRedlineAcceptDlg 81 { 82 Dialog* pParentDlg; 83 SwRedlineDataParentArr aRedlineParents; 84 SwRedlineDataChildArr aRedlineChilds; 85 SwRedlineDataParentSortArr aUsedSeqNo; 86 SvxAcceptChgCtr aTabPagesCTRL; 87 PopupMenu aPopup; 88 Timer aDeselectTimer; 89 Timer aSelectTimer; 90 String sInserted; 91 String sDeleted; 92 String sFormated; 93 String sTableChgd; 94 String sFmtCollSet; 95 String sFilterAction; 96 String sAutoFormat; 97 Size aBorderSz; 98 SvxTPView* pTPView; 99 SvxRedlinTable* pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox 100 Link aOldSelectHdl; 101 Link aOldDeselectHdl; 102 sal_Bool bOnlyFormatedRedlines; 103 sal_Bool bHasReadonlySel; 104 sal_Bool bRedlnAutoFmt; 105 106 // prevent update dialog data during longer operations (cf #102657#) 107 bool bInhibitActivate; 108 109 SW_DLLPRIVATE DECL_LINK( AcceptHdl, void* ); 110 SW_DLLPRIVATE DECL_LINK( AcceptAllHdl, void* ); 111 SW_DLLPRIVATE DECL_LINK( RejectHdl, void* ); 112 SW_DLLPRIVATE DECL_LINK( RejectAllHdl, void* ); 113 SW_DLLPRIVATE DECL_LINK( UndoHdl, void* ); 114 SW_DLLPRIVATE DECL_LINK( DeselectHdl, void* ); 115 SW_DLLPRIVATE DECL_LINK( SelectHdl, void* ); 116 SW_DLLPRIVATE DECL_LINK( GotoHdl, void* ); 117 SW_DLLPRIVATE DECL_LINK( CommandHdl, void* ); 118 119 SW_DLLPRIVATE sal_uInt16 CalcDiff(sal_uInt16 nStart, sal_Bool bChild); 120 SW_DLLPRIVATE void InsertChilds(SwRedlineDataParent *pParent, const SwRedline& rRedln, const sal_uInt16 nAutoFmt); 121 SW_DLLPRIVATE void InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd = USHRT_MAX); 122 SW_DLLPRIVATE void RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd); 123 SW_DLLPRIVATE void InitAuthors(); 124 125 SW_DLLPRIVATE String GetRedlineText(const SwRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0); 126 SW_DLLPRIVATE const String& GetActionText(const SwRedline& rRedln, sal_uInt16 nStack = 0); 127 SW_DLLPRIVATE sal_uInt16 GetRedlinePos( const SvLBoxEntry& rEntry) const; 128 129 public: 130 SwRedlineAcceptDlg(Dialog *pParent, sal_Bool bAutoFmt = sal_False); 131 virtual ~SwRedlineAcceptDlg(); 132 133 DECL_LINK( FilterChangedHdl, void *pDummy = 0 ); 134 135 inline SvxAcceptChgCtr* GetChgCtrl() { return &aTabPagesCTRL; } 136 inline sal_Bool HasRedlineAutoFmt() const { return bRedlnAutoFmt; } 137 138 void Init(sal_uInt16 nStart = 0); 139 void CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept ); 140 141 void Initialize(const String &rExtraData); 142 void FillInfo(String &rExtraData) const; 143 144 virtual void Activate(); 145 virtual void Resize(); 146 }; 147 148 /*------------------------------------------------------------------------ 149 Beschreibung: 150 ------------------------------------------------------------------------*/ 151 152 class SwModelessRedlineAcceptDlg : public SfxModelessDialog 153 { 154 SwRedlineAcceptDlg* pImplDlg; 155 SwChildWinWrapper* pChildWin; 156 157 virtual void Resize(); 158 159 public: 160 SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, Window *pParent); 161 ~SwModelessRedlineAcceptDlg(); 162 163 virtual void Activate(); 164 virtual void FillInfo(SfxChildWinInfo&) const; 165 void Initialize (SfxChildWinInfo* pInfo); 166 }; 167 168 169 /*------------------------------------------------------------------------ 170 Beschreibung: 171 ------------------------------------------------------------------------*/ 172 173 class SwRedlineAcceptChild : public SwChildWinWrapper 174 { 175 public: 176 SwRedlineAcceptChild( Window* , 177 sal_uInt16 nId, 178 SfxBindings*, 179 SfxChildWinInfo* ); 180 181 SFX_DECL_CHILDWINDOW( SwRedlineAcceptChild ); 182 183 virtual sal_Bool ReInitDlg(SwDocShell *pDocSh); 184 }; 185 186 187 #endif 188 189 190