LibreOffice Module sw (master) 1
mvsave.hxx
Go to the documentation of this file.
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_CORE_INC_MVSAVE_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_MVSAVE_HXX
21
22#include <vcl/keycod.hxx>
24#include <vector>
25#include <deque>
27
28namespace sfx2 {
29 class MetadatableUndo;
30}
31
33class SwDoc;
34class SwFormatAnchor;
35class SwFrameFormat;
36class SwIndex;
37class SwNodeIndex;
38class SwNodeRange;
39class SwPaM;
40class SwNode;
41struct SwPosition;
42
43namespace sw::mark
44{
45 class IMark;
46
48 {
49 public:
51 const ::sw::mark::IMark& rBkmk,
52 const SwNodeIndex& rMvPos,
53 const SwIndex* pIdx);
54 void SetInDoc(SwDoc* pDoc,
55 const SwNodeIndex&,
56 const SwIndex* pIdx =nullptr);
57
58 private:
59 OUString m_aName;
60 OUString m_aShortName;
67 sal_Int32 m_nContent1;
68 sal_Int32 m_nContent2;
69 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
70 };
71
72 enum class RestoreMode { Flys = 1, NonFlys = 2, All = 3 };
73
76 {
77 public:
78
79 virtual void Clear() =0;
80 virtual bool Empty() =0;
81 virtual void Save(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nContent, bool bSaveFlySplit=false) =0;
82 virtual void Restore(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode = RestoreMode::All) =0;
83 virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode = RestoreMode::All) =0;
84 virtual ~ContentIdxStore() {};
85 static std::shared_ptr<ContentIdxStore> Create();
86 };
87}
88
89namespace o3tl {
90 template<> struct typed_flags<sw::mark::RestoreMode> : is_typed_flags<sw::mark::RestoreMode, 3> {};
91}
92
93void DelBookmarks(const SwNodeIndex& rStt,
94 const SwNodeIndex& rEnd,
95 std::vector< ::sw::mark::SaveBookmark> * SaveBkmk =nullptr,
96 const SwIndex* pSttIdx =nullptr,
97 const SwIndex* pEndIdx =nullptr);
98
102{
105 sal_Int32 nContentIndex;
107
108 SaveFly( SwNodeOffset nNodeDiff, sal_Int32 const nCntntIdx, SwFrameFormat* pFormat, bool bInsert )
109 : pFrameFormat(pFormat)
110 , nNdDiff(nNodeDiff)
111 , nContentIndex(nCntntIdx)
112 , isAtInsertNode(bInsert)
113 { }
114};
115
116typedef std::deque< SaveFly > SaveFlyArr;
117
118void RestFlyInRange( SaveFlyArr& rArr, const SwPosition& rSttIdx,
119 const SwNodeIndex* pInsPos, bool isForceToStartPos = false);
120void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr );
121void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
122 SaveFlyArr& rArr, bool bMoveAllFlys, SwHistory * pHistory = nullptr);
123
124void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
125 const SwNodeIndex& rPtNdIdx,
126 SwIndex const* pMkIdx = nullptr,
127 SwIndex const* pPtIdx = nullptr);
128
130{
131 const SwPaM* m_pPam;
134 sal_Int32 m_nContent;
135
136public:
137 SwDataChanged( const SwPaM& rPam );
138 SwDataChanged( SwDoc& rDoc, const SwPosition& rPos );
140
141 sal_Int32 GetContent() const { return m_nContent; }
142};
143
149void PaMCorrAbs( const SwPaM& rRange,
150 const SwPosition& rNewPos );
151
153void PaMCorrRel( const SwNodeIndex &rOldNode,
154 const SwPosition &rNewPos,
155 const sal_Int32 nOffset = 0 );
156
162{
165 sal_uInt32 m_nOrdNum;
166
167public:
168 ZSortFly( const SwFrameFormat* pFrameFormat, const SwFormatAnchor* pFlyAnchor,
169 sal_uInt32 nArrOrdNum );
170
171 bool operator==( const ZSortFly& ) const { return false; }
172 bool operator<( const ZSortFly& rCmp ) const
173 { return m_nOrdNum < rCmp.m_nOrdNum; }
174
175 const SwFrameFormat* GetFormat() const { return m_pFormat; }
176 const SwFormatAnchor* GetAnchor() const { return m_pAnchor; }
177};
178
180{
182public:
183 SwTableNumFormatMerge( const SwDoc& rSrc, SwDoc& rDest );
185};
186
188{
189 std::vector<SwPosition*> mvSavArr;
190 std::unique_ptr<SwNodeIndex> mpSaveIndex;
191 sal_Int32 mnSaveContent;
192
193public:
194 SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, sal_Int32 nContent );
196 void Restore();
197};
198
199#endif // INCLUDED_SW_SOURCE_CORE_INC_MVSAVE_HXX
200
201/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SaveRedlEndPosForRestore(const SwNodeIndex &rInsIdx, sal_Int32 nContent)
Definition: docedt.cxx:267
std::unique_ptr< SwNodeIndex > mpSaveIndex
Definition: mvsave.hxx:190
std::vector< SwPosition * > mvSavArr
Definition: mvsave.hxx:189
const SwPaM * m_pPam
Definition: mvsave.hxx:131
sal_Int32 GetContent() const
Definition: mvsave.hxx:141
SwDataChanged(const SwPaM &rPam)
Definition: swserv.cxx:277
sal_Int32 m_nContent
Definition: mvsave.hxx:134
const SwPosition * m_pPos
Definition: mvsave.hxx:132
SwDoc & m_rDoc
Definition: mvsave.hxx:133
Definition: doc.hxx:188
FlyAnchors.
Definition: fmtanchr.hxx:35
Style of a layout element.
Definition: frmfmt.hxx:61
Marks a character position inside a document model node.
Definition: index.hxx:34
Marks a node in the document model.
Definition: ndindex.hxx:31
Base class of the Writer document model elements.
Definition: node.hxx:83
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:138
SwTableNumFormatMerge(const SwDoc &rSrc, SwDoc &rDest)
Definition: docfmt.cxx:1747
SvNumberFormatter * pNFormat
Definition: mvsave.hxx:181
Helper to copy paragraph-bound Flys.
Definition: mvsave.hxx:162
sal_uInt32 m_nOrdNum
Definition: mvsave.hxx:165
bool operator==(const ZSortFly &) const
Definition: mvsave.hxx:171
const SwFormatAnchor * m_pAnchor
Definition: mvsave.hxx:164
ZSortFly(const SwFrameFormat *pFrameFormat, const SwFormatAnchor *pFlyAnchor, sal_uInt32 nArrOrdNum)
Definition: docdraw.cxx:530
bool operator<(const ZSortFly &rCmp) const
Definition: mvsave.hxx:172
const SwFormatAnchor * GetAnchor() const
Definition: mvsave.hxx:176
const SwFrameFormat * m_pFormat
Definition: mvsave.hxx:163
const SwFrameFormat * GetFormat() const
Definition: mvsave.hxx:175
Takes care of storing relevant attributes of an SwTextNode before split, then restore them on the new...
Definition: mvsave.hxx:76
virtual void Save(SwDoc &rDoc, SwNodeOffset nNode, sal_Int32 nContent, bool bSaveFlySplit=false)=0
virtual ~ContentIdxStore()
Definition: mvsave.hxx:84
static std::shared_ptr< ContentIdxStore > Create()
virtual void Restore(SwDoc &rDoc, SwNodeOffset nNode, sal_Int32 nOffset=0, bool bAuto=false, bool bAtStart=false, RestoreMode=RestoreMode::All)=0
virtual void Clear()=0
virtual bool Empty()=0
virtual void Restore(SwNode &rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode=RestoreMode::All)=0
vcl::KeyCode m_aCode
Definition: mvsave.hxx:63
void SetInDoc(SwDoc *pDoc, const SwNodeIndex &, const SwIndex *pIdx=nullptr)
Definition: docbm.cxx:1844
IDocumentMarkAccess::MarkType m_eOrigBkmType
Definition: mvsave.hxx:64
OUString m_aHideCondition
Definition: mvsave.hxx:62
sal_Int32 m_nContent1
Definition: mvsave.hxx:67
SwNodeOffset m_nNode1
Definition: mvsave.hxx:65
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo
Definition: mvsave.hxx:69
SwNodeOffset m_nNode2
Definition: mvsave.hxx:66
sal_Int32 m_nContent2
Definition: mvsave.hxx:68
SaveBookmark(const ::sw::mark::IMark &rBkmk, const SwNodeIndex &rMvPos, const SwIndex *pIdx)
Definition: docbm.cxx:1798
OUString m_aShortName
Definition: mvsave.hxx:60
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rSttIdx, const SwNodeIndex *pInsPos, bool isForceToStartPos=false)
Definition: docedt.cxx:53
void DelFlyInRange(const SwNodeIndex &rMkNdIdx, const SwNodeIndex &rPtNdIdx, SwIndex const *pMkIdx=nullptr, SwIndex const *pPtIdx=nullptr)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:208
void SaveFlyInRange(const SwNodeRange &rRg, SaveFlyArr &rArr)
Definition: docedt.cxx:105
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while.
Definition: doccorr.cxx:86
void DelBookmarks(const SwNodeIndex &rStt, const SwNodeIndex &rEnd, std::vector< ::sw::mark::SaveBookmark > *SaveBkmk=nullptr, const SwIndex *pSttIdx=nullptr, const SwIndex *pEndIdx=nullptr)
void PaMCorrRel(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0)
Sets all PaMs in OldNode to relative Pos.
Definition: doccorr.cxx:241
std::deque< SaveFly > SaveFlyArr
Definition: mvsave.hxx:116
RestoreMode
Definition: mvsave.hxx:72
Dialog to specify the properties of date form field.
data structure to temporarily hold fly anchor positions relative to some location.
Definition: mvsave.hxx:102
SaveFly(SwNodeOffset nNodeDiff, sal_Int32 const nCntntIdx, SwFrameFormat *pFormat, bool bInsert)
Definition: mvsave.hxx:108
bool isAtInsertNode
if true, anchor at insert node index
Definition: mvsave.hxx:106
SwFrameFormat * pFrameFormat
Definition: mvsave.hxx:103
sal_Int32 nContentIndex
relative node difference
Definition: mvsave.hxx:105
SwNodeOffset nNdDiff
the fly's frame format
Definition: mvsave.hxx:104
Marks a position in the document model.
Definition: pam.hxx:37