1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mvsave.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <tools/string.hxx>
35 #ifndef _KEYCOD_HXX //autogen
36 #include <vcl/keycod.hxx>
38 #include <svtools/svarray.hxx>
39 #include <IDocumentMarkAccess.hxx>
42 class SvNumberFormatter
;
54 namespace sw
{ namespace mark
61 SaveBookmark(bool bSavePos
,
63 const ::sw::mark::IMark
& rBkmk
,
64 const SwNodeIndex
& rMvPos
,
65 const SwIndex
* pIdx
=0);
66 void SetInDoc(SwDoc
* pDoc
,
68 const SwIndex
* pIdx
=0);
69 IDocumentMarkAccess::MarkType
GetOriginalBkmType() const
70 { return m_eOrigBkmType
; }
73 ::rtl::OUString m_aName
;
74 ::rtl::OUString m_aShortName
;
78 IDocumentMarkAccess::MarkType m_eOrigBkmType
;
87 #define SAVEFLY_SPLIT 2
89 void _DelBookmarks(const SwNodeIndex
& rStt
,
90 const SwNodeIndex
& rEnd
,
91 ::std::vector
< ::sw::mark::SaveBookmark
> * SaveBkmk
=0,
92 const SwIndex
* pSttIdx
=0,
93 const SwIndex
* pEndIdx
=0);
94 void _SaveCntntIdx( SwDoc
* pDoc
, ULONG nNode
, xub_StrLen nCntnt
,
95 SvULongs
& rSaveArr
, BYTE nSaveFly
= 0 );
96 void _RestoreCntntIdx( SwDoc
* pDoc
, SvULongs
& rSaveArr
,
97 ULONG nNode
, xub_StrLen nOffset
= 0,
99 void _RestoreCntntIdx( SvULongs
& rSaveArr
, const SwNode
& rNd
,
100 xub_StrLen nLen
, xub_StrLen nCorrLen
);
103 /** data structure to temporarily hold fly anchor positions relative to some
107 ULONG nNdDiff
; /// relative node difference
108 SwFrmFmt
* pFrmFmt
; /// the fly's frame format
109 sal_Bool bInsertPosition
; /// if true, anchor _at_ insert position
111 _SaveFly( ULONG nNodeDiff
, SwFrmFmt
* pFmt
, sal_Bool bInsert
)
112 : nNdDiff( nNodeDiff
), pFrmFmt( pFmt
), bInsertPosition( bInsert
)
116 SV_DECL_VARARR( _SaveFlyArr
, _SaveFly
, 0, 10 )
118 void _RestFlyInRange( _SaveFlyArr
& rArr
, const SwNodeIndex
& rSttIdx
,
119 const SwNodeIndex
* pInsPos
);
120 void _SaveFlyInRange( const SwNodeRange
& rRg
, _SaveFlyArr
& rArr
);
121 void _SaveFlyInRange( const SwPaM
& rPam
, const SwNodeIndex
& rInsPos
,
122 _SaveFlyArr
& rArr
, sal_Bool bMoveAllFlys
);
124 void DelFlyInRange( const SwNodeIndex
& rMkNdIdx
,
125 const SwNodeIndex
& rPtNdIdx
);
131 const SwPosition
* pPos
;
135 USHORT nType
; // Insert/Move/Delete/... (UndoIds)
138 SwDataChanged( const SwPaM
& rPam
, USHORT nType
);
139 SwDataChanged( SwDoc
* pDoc
, const SwPosition
& rPos
, USHORT nType
);
142 ULONG
GetNode() const { return nNode
; }
143 xub_StrLen
GetCntnt() const { return nCntnt
; }
147 // Funktions-Deklaration damit auch alles unter der CrsrShell mal die
148 // Crsr verschieben kann
149 // die Funktionen rufen nicht die SwDoc::Corr - Methoden!
151 // Setzt alle PaMs an OldPos auf NewPos + Offset
152 void PaMCorrAbs( const SwPosition
&rOldPos
,
153 const SwPosition
&rNewPos
,
154 const xub_StrLen nOffset
= 0 );
156 // Setzt alle PaMs in OldNode auf NewPos + Offset
157 void PaMCorrAbs( const SwNodeIndex
&rOldNode
,
158 const SwPosition
&rNewPos
,
159 const xub_StrLen nOffset
= 0 );
161 // Setzt alle PaMs im Bereich vom Range nach NewPos
162 void PaMCorrAbs( const SwPaM
& rRange
,
163 const SwPosition
& rNewPos
);
165 // Setzt alle PaMs im Bereich von [StartNode, EndNode] nach NewPos
166 void PaMCorrAbs( const SwNodeIndex
&rStartNode
,
167 const SwNodeIndex
&rEndNode
,
168 const SwPosition
&rNewPos
);
170 // Setzt alle PaMs in OldNode auf relative Pos
171 void PaMCorrRel( const SwNodeIndex
&rOldNode
,
172 const SwPosition
&rNewPos
,
173 const xub_StrLen nOffset
= 0 );
176 // Hilfsklasse zum kopieren von absatzgebundenen Flys. Durch die Sortierung
177 // nach der Ordnungsnummer wird versucht die layout seitige Anordnung
181 const SwFrmFmt
* pFmt
;
182 const SwFmtAnchor
* pAnchor
;
186 _ZSortFly( const SwFrmFmt
* pFrmFmt
, const SwFmtAnchor
* pFlyAnchor
,
188 _ZSortFly
& operator=( const _ZSortFly
& rCpy
)
190 pFmt
= rCpy
.pFmt
, pAnchor
= rCpy
.pAnchor
, nOrdNum
= rCpy
.nOrdNum
;
194 int operator==( const _ZSortFly
& ) const { return FALSE
; }
195 int operator<( const _ZSortFly
& rCmp
) const
196 { return nOrdNum
< rCmp
.nOrdNum
; }
198 const SwFrmFmt
* GetFmt() const { return pFmt
; }
199 const SwFmtAnchor
* GetAnchor() const { return pAnchor
; }
202 SV_DECL_VARARR_SORT( _ZSortFlys
, _ZSortFly
, 0, 10 )
205 class SwTblNumFmtMerge
207 SvNumberFormatter
* pNFmt
;
209 SwTblNumFmtMerge( const SwDoc
& rSrc
, SwDoc
& rDest
);
214 class _SaveRedlEndPosForRestore
217 SwNodeIndex
* pSavIdx
;
218 xub_StrLen nSavCntnt
;
222 _SaveRedlEndPosForRestore( const SwNodeIndex
& rInsIdx
, xub_StrLen nCntnt
);
223 ~_SaveRedlEndPosForRestore();
224 void Restore() { if( pSavArr
) _Restore(); }
228 #endif // _MVSAVE_HXX