LibreOffice Module sw (master) 1
DocumentContentOperationsManager.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
20#pragma once
21
23#include <ndarr.hxx> //Only for lcl_RstTxtAttr
24
25class SwDoc;
26class SwNoTextNode;
27class SwFormatColl;
28class SwHistory;
29
30namespace sw
31{
32
34{
35public:
37
38 //Interface methods:
39 bool CopyRange(SwPaM&, SwPosition&, SwCopyFlags) const override;
40
41 void DeleteSection(SwNode* pNode) override;
42
43 void DeleteRange(SwPaM&) override;
44
45 bool DelFullPara(SwPaM&) override;
46
48
49 bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) override;
50
52
53 void MoveAndJoin(SwPaM&, SwPosition&) override;
54
55 bool Overwrite(const SwPaM &rRg, const OUString& rStr) override;
56
57 bool InsertString(const SwPaM &rRg, const OUString&,
58 const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) override;
59
60 void SetIME(bool bIME) override;
61
62 bool GetIME() const override;
63
64 void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) override;
65
66 SwFlyFrameFormat* InsertGraphic(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic,
67 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) override;
68
69 void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) override;
70
71 SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) override;
72
73 SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, SfxItemSet* pFlyAttrSet) override;
74
75 SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
76 const SfxItemSet* pGrfAttrSet) override;
77
78 bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override;
79
80 bool AppendTextNode(SwPosition& rPos) override;
81
82 bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
83 const bool bRegExReplace) override;
84
85 // Add a para for the char attribute exp...
86 bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
87 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
88 SwRootFrame const* pLayout = nullptr,
89 SwTextAttr **ppNewTextAttr = nullptr) override;
90
91 void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
92 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
93 SwRootFrame const* pLayout = nullptr) override;
94
95 void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
96 void RemoveLeadingWhiteSpace(SwPaM& rPaM) override;
97
98
99 //Non-Interface methods
100
101 void DeleteDummyChar(SwPosition const& rPos, sal_Unicode cDummy);
102
103 void CopyWithFlyInFly( const SwNodeRange& rRg,
104 SwNode& rInsPos,
105 const std::pair<const SwPaM&, const SwPosition&> * pCopiedPaM = nullptr,
106 bool bMakeNewFrames = true,
107 bool bDelRedlines = true,
108 bool bCopyFlyAtFly = false,
109 SwCopyFlags flags = SwCopyFlags::Default) const;
110 void CopyFlyInFlyImpl( const SwNodeRange& rRg,
111 SwPaM const*const pCopiedPaM,
112 SwNode& rStartIdx,
113 const bool bCopyFlyAtFly = false,
114 SwCopyFlags flags = SwCopyFlags::Default) const;
115
117 //originallyfrom docfmt.cxx
119 {
124 SwRootFrame const*const pLayout;
125 sal_uInt16 nWhich;
126 bool bReset;
127 bool bResetListAttrs; // #i62575#
132
133 ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
134 SwHistory* pHst, const SfxItemSet* pSet = nullptr,
135 SwRootFrame const*const pLay = nullptr)
136 : pFormatColl(nullptr)
137 , pHistory(pHst)
138 , pSttNd(pStt)
139 , pEndNd(pEnd)
140 , pDelSet(pSet)
141 , pLayout(pLay)
142 , nWhich(0)
143 , bReset(false) // #i62675#
144 , bResetListAttrs(false)
145 , bResetAll(true)
146 , bInclRefToxMark(false)
147 , bExactRange(false)
148 {
149 }
150 };
151 static bool lcl_RstTextAttr( SwNode* pNd, void* pArgs ); //originally from docfmt.cxx
152
153
154 virtual ~DocumentContentOperationsManager() override;
155
156private:
158
159 bool m_bIME = false;
160
165 bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
167 const SfxItemSet* pFlyAttrSet,
168 const SfxItemSet* pGrfAttrSet,
169 SwFrameFormat* );
170 /* Copy a range within the same or to another document.
171 Position may not lie within range! */
172 bool CopyImpl( SwPaM&, SwPosition&,
173 SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const;
175 SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const;
176
179};
180
181
182void CopyBookmarks(const SwPaM& rPam, const SwPosition& rTarget,
184
185void CalcBreaks(std::vector<std::pair<SwNodeOffset, sal_Int32>> & rBreaks,
186 SwPaM const & rPam, bool const isOnlyFieldmarks = false);
187
188}
189
190/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text operation/manipulation interface.
Definition: doc.hxx:197
SwFormatColl is just an SwFormat subclass that defaults to m_bAutoFormat=false, expressing that this ...
Definition: fmtcol.hxx:38
Style of a layout element.
Definition: frmfmt.hxx:72
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:30
Base class of the Writer document model elements.
Definition: node.hxx:98
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr) override
Insert an attribute.
bool CopyRange(SwPaM &, SwPosition &, SwCopyFlags) const override
Copy a selected content range to a position.
bool MoveNodeRange(SwNodeRange &, SwNode &, SwMoveFlags) override
void RemoveLeadingWhiteSpace(const SwPosition &rPos) override
Removes any leading white space from the paragraph.
void SetIME(bool bIME) override
States that the last inserted string came from IME.
void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr) override
DocumentContentOperationsManager(DocumentContentOperationsManager const &)=delete
bool Overwrite(const SwPaM &rRg, const OUString &rStr) override
Overwrite string in an existing text node.
SwFlyFrameFormat * InsertOLE(const SwPaM &rRg, const OUString &rObjName, sal_Int64 nAspect, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet) override
void ReRead(SwPaM &, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic) override
Transpose graphic (with undo)
void CopyWithFlyInFly(const SwNodeRange &rRg, SwNode &rInsPos, const std::pair< const SwPaM &, const SwPosition & > *pCopiedPaM=nullptr, bool bMakeNewFrames=true, bool bDelRedlines=true, bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
note: rRg/rInsPos exclude a partially selected start text node; pCopiedPaM includes a partially selec...
SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *) override
Insert graphic or formula.
static bool lcl_RstTextAttr(SwNode *pNd, void *pArgs)
@params pArgs contains the document's ChrFormatTable Is need for selections at the beginning/end and ...
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, SwNode &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
void MoveAndJoin(SwPaM &, SwPosition &) override
Move a range.
bool CopyImplImpl(SwPaM &, SwPosition &, SwCopyFlags flags, SwPaM *const pCpyRng) const
bool MoveRange(SwPaM &, SwPosition &, SwMoveFlags) override
DocumentContentOperationsManager & operator=(DocumentContentOperationsManager const &)=delete
bool GetIME() const override
Did the last inserted string come from IME?
bool CopyImpl(SwPaM &, SwPosition &, SwCopyFlags flags, SwPaM *const pCpyRng) const
SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, SfxItemSet *pFlyAttrSet) override
Insert OLE-objects.
SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet) override
Insert a DrawObject.
bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace) override
Replace selected range in a TextNode with string.
bool DelFullPara(SwPaM &) override
Delete full paragraphs.
bool ReplaceRangeImpl(SwPaM &, OUString const &, const bool)
bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override
Split a node at rPos (implemented only for TextNode).
void DeleteSection(SwNode *pNode) override
Delete a full Section of the NodeArray.
void TransliterateText(const SwPaM &rPaM, utl::TransliterationWrapper &) override
change text to Upper/Lower/Hiragana/Katakana/...
bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default) override
complete delete of a given PaM
bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND) override
Insert string into existing text node at position rRg.Point().
void DeleteRange(SwPaM &) override
Delete a range SwFlyFrameFormat.
SwFlyFrameFormat * InsNoTextNode(const SwPosition &rPos, SwNoTextNode *, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)
void DeleteDummyChar(SwPosition const &rPos, sal_Unicode cDummy)
Dialog to specify the properties of date form field.
void CopyBookmarks(const SwPaM &rPam, const SwPosition &rCpyPam, SwCopyFlags flags)
void CalcBreaks(std::vector< std::pair< SwNodeOffset, sal_Int32 > > &rBreaks, SwPaM const &rPam, bool const isOnlyFieldmarks)
Marks a position in the document model.
Definition: pam.hxx:38
ParaRstFormat(const SwPosition *pStt, const SwPosition *pEnd, SwHistory *pHst, const SfxItemSet *pSet=nullptr, SwRootFrame const *const pLay=nullptr)
bool bExactRange
From the attributes included in the range, delete only the ones which have exactly same range....
SetAttrMode
Definition: swtypes.hxx:133
sal_uInt16 sal_Unicode