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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
22 
24 #include <ndarr.hxx> //Only for lcl_RstTxtAttr
25 
26 class SwDoc;
27 class SwNoTextNode;
28 class SwFormatColl;
29 class SwHistory;
30 
31 namespace sw
32 {
33 
35 {
36 public:
38 
39  //Interface methods:
40  bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll, bool bCheckPos ) const override;
41 
42  void DeleteSection(SwNode* pNode) override;
43 
44  void DeleteRange(SwPaM&) override;
45 
46  bool DelFullPara(SwPaM&) override;
47 
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;
52 
53  bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) override;
54 
56 
57  bool MoveAndJoin(SwPaM&, SwPosition&) override;
58 
59  bool Overwrite(const SwPaM &rRg, const OUString& rStr) override;
60 
61  bool InsertString(const SwPaM &rRg, const OUString&,
62  const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) 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  SwFlyFrameFormat* InsertGraphicObject(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
70  const SfxItemSet* pGrfAttrSet) override;
71 
72  void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) override;
73 
74  SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) override;
75 
76  SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet) override;
77 
78  SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
79  const SfxItemSet* pGrfAttrSet) override;
80 
81  bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override;
82 
83  bool AppendTextNode(SwPosition& rPos) override;
84 
85  bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
86  const bool bRegExReplace) override;
87 
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;
94 
95  void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
96  const SetAttrMode nFlags = SetAttrMode::DEFAULT,
97  SwRootFrame const* pLayout = nullptr) override;
98 
99  void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
100 
101 
102  //Non-Interface methods
103 
104  void DeleteDummyChar(SwPosition const& rPos, sal_Unicode cDummy);
105 
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 ) const;
112  void CopyFlyInFlyImpl( const SwNodeRange& rRg,
113  SwPaM const*const pCopiedPaM,
114  const SwNodeIndex& rStartIdx,
115  const bool bCopyFlyAtFly = false ) const;
116 
118  //originallyfrom docfmt.cxx
120  {
125  SwRootFrame const*const pLayout;
126  sal_uInt16 nWhich;
127  bool bReset;
128  bool bResetListAttrs; // #i62575#
129  bool bResetAll;
133 
134  ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
135  SwHistory* pHst, const SfxItemSet* pSet = nullptr,
136  SwRootFrame const*const pLay = nullptr)
137  : pFormatColl(nullptr)
138  , pHistory(pHst)
139  , pSttNd(pStt)
140  , pEndNd(pEnd)
141  , pDelSet(pSet)
142  , pLayout(pLay)
143  , nWhich(0)
144  , bReset(false) // #i62675#
145  , bResetListAttrs(false)
146  , bResetAll(true)
147  , bInclRefToxMark(false)
148  , bExactRange(false)
149  {
150  }
151  };
152  static bool lcl_RstTextAttr( const SwNodePtr& rpNd, void* pArgs ); //originally from docfmt.cxx
153 
154 
155  virtual ~DocumentContentOperationsManager() override;
156 
157 private:
159 
160  bool DeleteAndJoinImpl(SwPaM&, const bool);
161  bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
162  bool DeleteRangeImpl(SwPaM&, const bool unused = false);
163  bool DeleteRangeImplImpl(SwPaM &);
164  bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
166  const SfxItemSet* pFlyAttrSet,
167  const SfxItemSet* pGrfAttrSet,
168  SwFrameFormat* );
169  /* Copy a range within the same or to another document.
170  Position may not lie within range! */
171  bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrames /*= true */,
172  const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
173 
176 };
177 
178 }
179 
180 #endif // INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
181 
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet) override
Insert a DrawObject.
void TransliterateText(const SwPaM &rPaM, utl::TransliterationWrapper &) override
change text to Upper/Lower/Hiragana/Katakana/...
DocumentContentOperationsManager & operator=(DocumentContentOperationsManager const &)=delete
Marks a position in the document model.
Definition: pam.hxx:35
bool MoveRange(SwPaM &, SwPosition &, SwMoveFlags) override
SwFlyFrameFormat * InsertOLE(const SwPaM &rRg, const OUString &rObjName, sal_Int64 nAspect, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet) override
static bool lcl_RstTextAttr(const SwNodePtr &rpNd, void *pArgs)
pArgs contains the document's ChrFormatTable Is need for selections at the beginning/end and with no ...
bool CopyRange(SwPaM &, SwPosition &, const bool bCopyAll, bool bCheckPos) const override
Copy a selected content range to a position.
Definition: doc.hxx:185
bool DeleteAndJoinWithRedlineImpl(SwPaM &, const bool unused=false)
Dialog to specify the properties of date form field.
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
bool DelFullPara(SwPaM &) override
Delete full paragraphs.
bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND) override
Insert string into existing text node at position rRg.Point().
sal_uInt16 sal_Unicode
bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override
Split a node at rPos (implemented only for TextNode).
bool DeleteAndJoin(SwPaM &, const bool bForceJoinNext=false) override
complete delete of a given PaM
bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, bool bExpandCharToPara=false, SwTextAttr **ppNewTextAttr=nullptr) override
Add a para for the char attribute exp...
void DeleteDummyChar(SwPosition const &rPos, sal_Unicode cDummy)
void ReRead(SwPaM &, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic) override
Transpose graphic (with undo)
void RemoveLeadingWhiteSpace(const SwPosition &rPos) override
Removes any leading white space from the paragraph.
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, const SfxItemSet *pFlyAttrSet) override
Insert OLE-objects.
SwFlyFrameFormat * InsNoTextNode(const SwPosition &rPos, SwNoTextNode *, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)
Style of a layout element.
Definition: frmfmt.hxx:57
bool MoveAndJoin(SwPaM &, SwPosition &) override
Move a range.
bool bExactRange
From the attributes included in the range, delete only the ones which have exactly same range...
SetAttrMode
Definition: swtypes.hxx:143
SwFlyFrameFormat * InsertGraphicObject(const SwPaM &rRg, const GraphicObject &rGrfObj, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet) override
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, const SwNodeIndex &rStartIdx, const bool bCopyFlyAtFly=false) const
bool MoveNodeRange(SwNodeRange &, SwNodeIndex &, SwMoveFlags) override
Marks a node in the document model.
Definition: ndindex.hxx:31
Text operation/manipulation interface.
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.
bool ReplaceRangeImpl(SwPaM &, OUString const &, const bool)
void DeleteSection(SwNode *pNode) override
Delete a full Section of the NodeArray.
bool Overwrite(const SwPaM &rRg, const OUString &rStr) override
Overwrite string in an existing text node.
void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr) override
void CopyWithFlyInFly(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, const std::pair< const SwPaM &, const SwPosition & > *pCopiedPaM=nullptr, bool bMakeNewFrames=true, bool bDelRedlines=true, bool bCopyFlyAtFly=false) const
note: rRg/rInsPos exclude a partially selected start text node; pCopiedPaM includes a partially selec...
bool CopyImpl(SwPaM &, SwPosition &, const bool MakeNewFrames, const bool bCopyAll, SwPaM *const pCpyRng) const
bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace) override
Replace selected range in a TextNode with string.
ParaRstFormat(const SwPosition *pStt, const SwPosition *pEnd, SwHistory *pHst, const SfxItemSet *pSet=nullptr, SwRootFrame const *const pLay=nullptr)
void DeleteRange(SwPaM &) override
Delete a range SwFlyFrameFormat.
Base class of the Writer document model elements.
Definition: node.hxx:79
bool DeleteRangeImpl(SwPaM &, const bool unused=false)