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#pragma once
21
22#include <sal/types.h>
23#include <rtl/ustring.hxx>
24#include "swtypes.hxx"
25
26class SwPaM;
27struct SwPosition;
28class SwNode;
29class SwNodeRange;
30class Graphic;
31class SfxItemSet;
32class SfxPoolItem;
33class GraphicObject;
34class SdrObject;
35class SwFrameFormat;
38class SwNodeIndex;
39class SwRootFrame;
40class SwTextAttr;
41
42namespace utl { class TransliterationWrapper; }
43namespace svt { class EmbeddedObjectRef; }
44
45enum class SwMoveFlags
46{
47 DEFAULT = 0x00,
48 ALLFLYS = 0x01,
49 CREATEUNDOOBJ = 0x02,
50 REDLINES = 0x04,
51 NO_DELFRMS = 0x08
52};
53namespace o3tl
54{
55 template<> struct typed_flags<SwMoveFlags> : is_typed_flags<SwMoveFlags, 0x0f> {};
56}
57
58// constants for inserting text
59enum class SwInsertFlags
60{
61 DEFAULT = 0x00, // no extras
62 EMPTYEXPAND = 0x01, // expand empty hints at insert position
63 NOHINTEXPAND = 0x02, // do not expand any hints at insert pos
64 FORCEHINTEXPAND = 0x04 // expand all hints at insert position
65};
66namespace o3tl
67{
68 template<> struct typed_flags<SwInsertFlags> : is_typed_flags<SwInsertFlags, 0x07> {};
69}
70
71enum class SwCopyFlags
72{
73 Default = 0,
74 CopyAll = (1<<0),
75 CheckPosInFly = (1<<1),
76 IsMoveToFly = (1<<2),
77 // TODO: mbCopyIsMove? mbIsRedlineMove?
78};
79namespace o3tl
80{
81 template<> struct typed_flags<SwCopyFlags> : is_typed_flags<SwCopyFlags, 0x07> {};
82}
83
84enum class SwDeleteFlags
85{
86 Default = 0,
87 ArtificialSelection = (1<<0),
88};
89namespace o3tl
90{
91 template<> struct typed_flags<SwDeleteFlags> : is_typed_flags<SwDeleteFlags, 0x01> {};
92}
93
97{
98public:
99public:
135 virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, SwCopyFlags flags) const = 0;
136
139 virtual void DeleteSection(SwNode* pNode) = 0;
140
143 virtual void DeleteRange(SwPaM&) = 0;
144
147 virtual bool DelFullPara(SwPaM&) = 0;
148
152
153 virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
154
156
159 virtual void MoveAndJoin(SwPaM&, SwPosition&) = 0;
160
163 virtual bool Overwrite(const SwPaM &rRg, const OUString& rStr) = 0;
164
167 virtual bool InsertString(const SwPaM &rRg, const OUString&,
168 const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) = 0;
169
171 virtual void SetIME(bool bIME) = 0;
172
174 virtual bool GetIME() const = 0;
175
178 virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
179
183 const SwPaM &rRg, const OUString& rGrfName,
184 const OUString& rFltName, const Graphic* pGraphic,
185 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet,
186 SwFrameFormat*) = 0;
187
190 virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) = 0;
191
196 const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet) = 0;
197
201 const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj,
202 SfxItemSet* pFlyAttrSet) = 0;
203
205 const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect,
206 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet) = 0;
207
210 virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
211
212 virtual bool AppendTextNode(SwPosition& rPos) = 0;
213
220 virtual bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
221 const bool bRegExReplace) = 0;
222
235 virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
236 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
237 SwRootFrame const* pLayout = nullptr,
238 SwTextAttr **ppNewTextAttr = nullptr) = 0;
239
240 virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
241 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
242 SwRootFrame const* pLayout = nullptr) = 0;
243
246 virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
247 virtual void RemoveLeadingWhiteSpace(SwPaM& rPaM) = 0;
248
249protected:
251};
252
253/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ IsMoveToFly
MakeFlyAndMove.
@ 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 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:72
Marks a node in the document model.
Definition: ndindex.hxx:31
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
Marks a position in the document model.
Definition: pam.hxx:38
SetAttrMode
Definition: swtypes.hxx:133