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 
27 class SwPaM;
28 struct SwPosition;
29 class SwNode;
30 class SwNodeRange;
31 class Graphic;
32 class SfxItemSet;
33 class SfxPoolItem;
34 class GraphicObject;
35 class SdrObject;
36 class SwFrameFormat;
37 class SwDrawFrameFormat;
38 class SwFlyFrameFormat;
39 class SwNodeIndex;
40 class SwRootFrame;
41 class SwTextAttr;
42 
43 namespace utl { class TransliterationWrapper; }
44 namespace svt { class EmbeddedObjectRef; }
45 
46 enum class SwMoveFlags
47 {
48  DEFAULT = 0x00,
49  ALLFLYS = 0x01,
50  CREATEUNDOOBJ = 0x02,
51  REDLINES = 0x04,
52  NO_DELFRMS = 0x08
53 };
54 namespace o3tl
55 {
56  template<> struct typed_flags<SwMoveFlags> : is_typed_flags<SwMoveFlags, 0x0f> {};
57 }
58 
59 // constants for inserting text
60 enum 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 };
67 namespace o3tl
68 {
69  template<> struct typed_flags<SwInsertFlags> : is_typed_flags<SwInsertFlags, 0x07> {};
70 }
71 
72 enum class SwCopyFlags
73 {
74  Default = 0,
75  CopyAll = (1<<0),
76  CheckPosInFly = (1<<1),
77  IsMoveToFly = (1<<2),
78  // TODO: mbCopyIsMove? mbIsRedlineMove?
79 };
80 namespace o3tl
81 {
82  template<> struct typed_flags<SwCopyFlags> : is_typed_flags<SwCopyFlags, 0x07> {};
83 }
84 
88 {
89 public:
90 public:
126  virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, SwCopyFlags flags) const = 0;
127 
130  virtual void DeleteSection(SwNode* pNode) = 0;
131 
134  virtual void DeleteRange(SwPaM&) = 0;
135 
138  virtual bool DelFullPara(SwPaM&) = 0;
139 
146  virtual bool DeleteAndJoin( SwPaM&,
147  const bool bForceJoinNext = false ) = 0;
148 
149  virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
150 
151  virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0;
152 
155  virtual bool MoveAndJoin(SwPaM&, SwPosition&) = 0;
156 
159  virtual bool Overwrite(const SwPaM &rRg, const OUString& rStr) = 0;
160 
163  virtual bool InsertString(const SwPaM &rRg, const OUString&,
164  const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) = 0;
165 
168  virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0;
169 
172  virtual SwFlyFrameFormat* InsertGraphic(
173  const SwPaM &rRg, const OUString& rGrfName,
174  const OUString& rFltName, const Graphic* pGraphic,
175  const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet,
176  SwFrameFormat*) = 0;
177 
178  virtual SwFlyFrameFormat* InsertGraphicObject(
179  const SwPaM& rRg, const GraphicObject& rGrfObj,
180  const SfxItemSet* pFlyAttrSet,
181  const SfxItemSet* pGrfAttrSet) = 0;
182 
185  virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) = 0;
186 
190  virtual SwDrawFrameFormat* InsertDrawObj(
191  const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet) = 0;
192 
195  virtual SwFlyFrameFormat* InsertEmbObject(
196  const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj,
197  SfxItemSet* pFlyAttrSet) = 0;
198 
199  virtual SwFlyFrameFormat* InsertOLE(
200  const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect,
201  const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet) = 0;
202 
205  virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0;
206 
207  virtual bool AppendTextNode(SwPosition& rPos) = 0;
208 
215  virtual bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
216  const bool bRegExReplace) = 0;
217 
230  virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
231  const SetAttrMode nFlags = SetAttrMode::DEFAULT,
232  SwRootFrame const* pLayout = nullptr,
233  bool bExpandCharToPara = false,
234  SwTextAttr **ppNewTextAttr = nullptr) = 0;
235 
236  virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
237  const SetAttrMode nFlags = SetAttrMode::DEFAULT,
238  SwRootFrame const* pLayout = nullptr) = 0;
239 
242  virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
243 
244 protected:
246 };
247 
248 #endif // INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
249 
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Marks a position in the document model.
Definition: pam.hxx:35
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
check if target position is in fly anchored at source range
MakeFlyAndMove.
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
Style of a layout element.
Definition: frmfmt.hxx:57
SetAttrMode
Definition: swtypes.hxx:135
Marks a node in the document model.
Definition: ndindex.hxx:31
Text operation/manipulation interface.
Base class of the Writer document model elements.
Definition: node.hxx:79