nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / core / inc / DocumentContentOperationsManager.hxx
blob3df39532978cef7c17f899bfda811c127e74ff37
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
23 #include <IDocumentContentOperations.hxx>
24 #include <ndarr.hxx> //Only for lcl_RstTxtAttr
26 class SwDoc;
27 class SwNoTextNode;
28 class SwFormatColl;
29 class SwHistory;
31 namespace sw
34 class DocumentContentOperationsManager : public IDocumentContentOperations
36 public:
37 DocumentContentOperationsManager( SwDoc& i_rSwdoc );
39 //Interface methods:
40 bool CopyRange(SwPaM&, SwPosition&, SwCopyFlags) const override;
42 void DeleteSection(SwNode* pNode) override;
44 void DeleteRange(SwPaM&) override;
46 bool DelFullPara(SwPaM&) override;
48 // Add optional parameter <bForceJoinNext>, default value <false>
49 // Needed for hiding of deletion redlines
50 bool DeleteAndJoin( SwPaM&,
51 const bool bForceJoinNext = false ) override;
53 bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) override;
55 bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) override;
57 bool MoveAndJoin(SwPaM&, SwPosition&) override;
59 bool Overwrite(const SwPaM &rRg, const OUString& rStr) override;
61 bool InsertString(const SwPaM &rRg, const OUString&,
62 const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) override;
64 void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) override;
66 SwFlyFrameFormat* InsertGraphic(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic,
67 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) override;
69 SwFlyFrameFormat* InsertGraphicObject(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
70 const SfxItemSet* pGrfAttrSet) override;
72 void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) override;
74 SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) override;
76 SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, SfxItemSet* pFlyAttrSet) override;
78 SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
79 const SfxItemSet* pGrfAttrSet) override;
81 bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override;
83 bool AppendTextNode(SwPosition& rPos) override;
85 bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
86 const bool bRegExReplace) override;
88 // Add a para for the char attribute exp...
89 bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
90 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
91 SwRootFrame const* pLayout = nullptr,
92 bool bExpandCharToPara = false,
93 SwTextAttr **ppNewTextAttr = nullptr) override;
95 void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
96 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
97 SwRootFrame const* pLayout = nullptr) override;
99 void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
102 //Non-Interface methods
104 void DeleteDummyChar(SwPosition const& rPos, sal_Unicode cDummy);
106 void CopyWithFlyInFly( const SwNodeRange& rRg,
107 const SwNodeIndex& rInsPos,
108 const std::pair<const SwPaM&, const SwPosition&> * pCopiedPaM = nullptr,
109 bool bMakeNewFrames = true,
110 bool bDelRedlines = true,
111 bool bCopyFlyAtFly = false,
112 SwCopyFlags flags = SwCopyFlags::Default) const;
113 void CopyFlyInFlyImpl( const SwNodeRange& rRg,
114 SwPaM const*const pCopiedPaM,
115 const SwNodeIndex& rStartIdx,
116 const bool bCopyFlyAtFly = false,
117 SwCopyFlags flags = SwCopyFlags::Default) const;
119 /// Parameters for _Rst and lcl_SetTextFormatColl
120 //originallyfrom docfmt.cxx
121 struct ParaRstFormat
123 SwFormatColl* pFormatColl;
124 SwHistory* pHistory;
125 const SwPosition *pSttNd, *pEndNd;
126 const SfxItemSet* pDelSet;
127 SwRootFrame const*const pLayout;
128 sal_uInt16 nWhich;
129 bool bReset;
130 bool bResetListAttrs; // #i62575#
131 bool bResetAll;
132 bool bInclRefToxMark;
133 /// From the attributes included in the range, delete only the ones which have exactly same range. Don't delete the ones which are simply included in the range.
134 bool bExactRange;
136 ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
137 SwHistory* pHst, const SfxItemSet* pSet = nullptr,
138 SwRootFrame const*const pLay = nullptr)
139 : pFormatColl(nullptr)
140 , pHistory(pHst)
141 , pSttNd(pStt)
142 , pEndNd(pEnd)
143 , pDelSet(pSet)
144 , pLayout(pLay)
145 , nWhich(0)
146 , bReset(false) // #i62675#
147 , bResetListAttrs(false)
148 , bResetAll(true)
149 , bInclRefToxMark(false)
150 , bExactRange(false)
154 static bool lcl_RstTextAttr( const SwNodePtr& rpNd, void* pArgs ); //originally from docfmt.cxx
157 virtual ~DocumentContentOperationsManager() override;
159 private:
160 SwDoc& m_rDoc;
162 bool DeleteAndJoinImpl(SwPaM&, const bool);
163 bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
164 bool DeleteRangeImpl(SwPaM&, const bool unused = false);
165 bool DeleteRangeImplImpl(SwPaM &);
166 bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
167 SwFlyFrameFormat* InsNoTextNode( const SwPosition&rPos, SwNoTextNode*,
168 const SfxItemSet* pFlyAttrSet,
169 const SfxItemSet* pGrfAttrSet,
170 SwFrameFormat* );
171 /* Copy a range within the same or to another document.
172 Position may not lie within range! */
173 bool CopyImpl( SwPaM&, SwPosition&,
174 SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const;
175 bool CopyImplImpl(SwPaM&, SwPosition&,
176 SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const;
178 DocumentContentOperationsManager(DocumentContentOperationsManager const&) = delete;
179 DocumentContentOperationsManager& operator=(DocumentContentOperationsManager const&) = delete;
183 void CopyBookmarks(const SwPaM& rPam, SwPosition& rTarget);
185 void CalcBreaks(std::vector<std::pair<sal_uLong, sal_Int32>> & rBreaks,
186 SwPaM const & rPam, bool const isOnlyFieldmarks = false);
190 #endif // INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */