LibreOffice Module sw (master) 1
IDocumentContentOperations.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_INC_IDOCUMENTCONTENTOPERATIONS_HXX
21#define INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
22
23#include <sal/types.h>
24#include <rtl/ustring.hxx>
25#include "swtypes.hxx"
26
27class SwPaM;
28struct SwPosition;
29class SwNode;
30class SwNodeRange;
31class Graphic;
32class SfxItemSet;
33class SfxPoolItem;
34class GraphicObject;
35class SdrObject;
36class SwFrameFormat;
39class SwNodeIndex;
40class SwRootFrame;
41class SwTextAttr;
42
43namespace utl { class TransliterationWrapper; }
44namespace svt { class EmbeddedObjectRef; }
45
46enum class SwMoveFlags
47{
48 DEFAULT = 0x00,
49 ALLFLYS = 0x01,
50 CREATEUNDOOBJ = 0x02,
51 REDLINES = 0x04,
52 NO_DELFRMS = 0x08
53};
54namespace o3tl
55{
56 template<> struct typed_flags<SwMoveFlags> : is_typed_flags<SwMoveFlags, 0x0f> {};
57}
58
59// constants for inserting text
60enum class SwInsertFlags
61{
62 DEFAULT = 0x00, // no extras
63 EMPTYEXPAND = 0x01, // expand empty hints at insert position
64 NOHINTEXPAND = 0x02, // do not expand any hints at insert pos
65 FORCEHINTEXPAND = 0x04 // expand all hints at insert position
66};
67namespace o3tl
68{
69 template<> struct typed_flags<SwInsertFlags> : is_typed_flags<SwInsertFlags, 0x07> {};
70}
71
72enum class SwCopyFlags
73{
74 Default = 0,
75 CopyAll = (1<<0),
76 CheckPosInFly = (1<<1),
77 IsMoveToFly = (1<<2),
78 SkipBookmarks = (1<<3),
79 // TODO: mbCopyIsMove? mbIsRedlineMove?
80};
81namespace o3tl
82{
83 template<> struct typed_flags<SwCopyFlags> : is_typed_flags<SwCopyFlags, 0x0f> {};
84}
85
86enum class SwDeleteFlags
87{
88 Default = 0,
89 ArtificialSelection = (1<<0),
90};
91namespace o3tl
92{
93 template<> struct typed_flags<SwDeleteFlags> : is_typed_flags<SwDeleteFlags, 0x01> {};
94}
95
99{
100public:
101public:
137 virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, SwCopyFlags flags) const = 0;
138
141 virtual void DeleteSection(SwNode* pNode) = 0;
142
145 virtual void DeleteRange(SwPaM&) = 0;
146
149 virtual bool DelFullPara(SwPaM&) = 0;
150
154
155 virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
156
158
161 virtual void MoveAndJoin(SwPaM&, SwPosition&) = 0;
162
165 virtual bool Overwrite(const SwPaM &rRg, const OUString& rStr) = 0;
166
169 virtual bool InsertString(const SwPaM &rRg, const OUString&,
170 const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) = 0;
171
173 virtual void SetIME(bool bIME) = 0;
174
176 virtual bool GetIME() const = 0;
177
180 virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
181
185 const SwPaM &rRg, const OUString& rGrfName,
186 const OUString& rFltName, const Graphic* pGraphic,
187 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet,
188 SwFrameFormat*) = 0;
189
191 const SwPaM& rRg, const GraphicObject& rGrfObj,
192 const SfxItemSet* pFlyAttrSet,
193 const SfxItemSet* pGrfAttrSet) = 0;
194
197 virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) = 0;
198
203 const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet) = 0;
204
208 const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj,
209 SfxItemSet* pFlyAttrSet) = 0;
210
212 const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect,
213 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet) = 0;
214
217 virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
218
219 virtual bool AppendTextNode(SwPosition& rPos) = 0;
220
227 virtual bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
228 const bool bRegExReplace) = 0;
229
242 virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
243 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
244 SwRootFrame const* pLayout = nullptr,
245 SwTextAttr **ppNewTextAttr = nullptr) = 0;
246
247 virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
248 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
249 SwRootFrame const* pLayout = nullptr) = 0;
250
253 virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
254 virtual void RemoveLeadingWhiteSpace(SwPaM& rPaM) = 0;
255
256protected:
258};
259
260#endif // INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
261
262/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ IsMoveToFly
MakeFlyAndMove.
@ SkipBookmarks
skip bookmarks, but not other kind of marks
@ CheckPosInFly
check if target position is in fly anchored at source range
@ ArtificialSelection
keyboard delete, artificial selection, avoid deleting flys
Text operation/manipulation interface.
virtual bool MoveRange(SwPaM &, SwPosition &, SwMoveFlags)=0
virtual bool AppendTextNode(SwPosition &rPos)=0
virtual void RemoveLeadingWhiteSpace(const SwPosition &rPos)=0
Removes any leading white space from the paragraph.
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual void ReRead(SwPaM &, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic)=0
Transpose graphic (with undo)
virtual SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet)=0
Insert a DrawObject.
virtual SwFlyFrameFormat * InsertOLE(const SwPaM &rRg, const OUString &rObjName, sal_Int64 nAspect, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet)=0
virtual void TransliterateText(const SwPaM &rPaM, utl::TransliterationWrapper &)=0
change text to Upper/Lower/Hiragana/Katakana/...
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
virtual SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)=0
Insert graphic or formula.
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
virtual void DeleteRange(SwPaM &)=0
Delete a range SwFlyFrameFormat.
virtual bool MoveNodeRange(SwNodeRange &, SwNode &, SwMoveFlags)=0
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
virtual bool Overwrite(const SwPaM &rRg, const OUString &rStr)=0
Overwrite string in an existing text node.
virtual bool GetIME() const =0
Did the last inserted string come from IME?
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
virtual void RemoveLeadingWhiteSpace(SwPaM &rPaM)=0
virtual SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, SfxItemSet *pFlyAttrSet)=0
Insert OLE-objects.
virtual void MoveAndJoin(SwPaM &, SwPosition &)=0
Move a range.
virtual SwFlyFrameFormat * InsertGraphicObject(const SwPaM &rRg, const GraphicObject &rGrfObj, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet)=0
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
virtual void SetIME(bool bIME)=0
States that the last inserted string came from IME.
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
Style of a layout element.
Definition: frmfmt.hxx:62
Marks a node in the document model.
Definition: ndindex.hxx:31
Base class of the Writer document model elements.
Definition: node.hxx:84
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
Marks a position in the document model.
Definition: pam.hxx:37
SetAttrMode
Definition: swtypes.hxx:133