LibreOffice Module sw (master) 1
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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 .
18 */
20#pragma once
23#include <ndarr.hxx> //Only for lcl_RstTxtAttr
25class SwDoc;
26class SwNoTextNode;
27class SwFormatColl;
28class SwHistory;
30namespace sw
38 //Interface methods:
39 bool CopyRange(SwPaM&, SwPosition&, SwCopyFlags) const override;
41 void DeleteSection(SwNode* pNode) override;
43 void DeleteRange(SwPaM&) override;
45 bool DelFullPara(SwPaM&) override;
49 bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) override;
53 void MoveAndJoin(SwPaM&, SwPosition&) override;
55 bool Overwrite(const SwPaM &rRg, const OUString& rStr) override;
57 bool InsertString(const SwPaM &rRg, const OUString&,
58 const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) override;
60 void SetIME(bool bIME) override;
62 bool GetIME() const override;
64 void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) override;
66 SwFlyFrameFormat* InsertGraphic(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic,
67 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) override;
69 SwFlyFrameFormat* InsertGraphicObject(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
70 const SfxItemSet* pGrfAttrSet) override;
72 void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) override;
74 SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) override;
76 SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, SfxItemSet* pFlyAttrSet) override;
78 SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
79 const SfxItemSet* pGrfAttrSet) override;
81 bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override;
83 bool AppendTextNode(SwPosition& rPos) override;
85 bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
86 const bool bRegExReplace) override;
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 SwTextAttr **ppNewTextAttr = nullptr) override;
94 void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
95 const SetAttrMode nFlags = SetAttrMode::DEFAULT,
96 SwRootFrame const* pLayout = nullptr) override;
98 void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
99 void RemoveLeadingWhiteSpace(SwPaM& rPaM) override;
102 //Non-Interface methods
104 void DeleteDummyChar(SwPosition const& rPos, sal_Unicode cDummy);
106 void CopyWithFlyInFly( const SwNodeRange& rRg,
107 SwNode& rInsPos,
108 const std::pair<const SwPaM&, const SwPosition&> * pCopiedPaM = nullptr,
109 bool bMakeNewFrames = true,
110 bool bDelRedlines = true,
111 bool bCopyFlyAtFly = false,
112 SwCopyFlags flags = SwCopyFlags::Default) const;
113 void CopyFlyInFlyImpl( const SwNodeRange& rRg,
114 SwPaM const*const pCopiedPaM,
115 SwNode& rStartIdx,
116 const bool bCopyFlyAtFly = false,
117 SwCopyFlags flags = SwCopyFlags::Default) const;
120 //originallyfrom docfmt.cxx
122 {
127 SwRootFrame const*const pLayout;
128 sal_uInt16 nWhich;
129 bool bReset;
130 bool bResetListAttrs; // #i62575#
136 ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
137 SwHistory* pHst, const SfxItemSet* pSet = nullptr,
138 SwRootFrame const*const pLay = nullptr)
139 : pFormatColl(nullptr)
140 , pHistory(pHst)
141 , pSttNd(pStt)
142 , pEndNd(pEnd)
143 , pDelSet(pSet)
144 , pLayout(pLay)
145 , nWhich(0)
146 , bReset(false) // #i62675#
147 , bResetListAttrs(false)
148 , bResetAll(true)
149 , bInclRefToxMark(false)
150 , bExactRange(false)
151 {
152 }
153 };
154 static bool lcl_RstTextAttr( SwNode* pNd, void* pArgs ); //originally from docfmt.cxx
157 virtual ~DocumentContentOperationsManager() override;
162 bool m_bIME = false;
168 bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
170 const SfxItemSet* pFlyAttrSet,
171 const SfxItemSet* pGrfAttrSet,
172 SwFrameFormat* );
173 /* Copy a range within the same or to another document.
174 Position may not lie within range! */
175 bool CopyImpl( SwPaM&, SwPosition&,
176 SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const;
178 SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const;
185void CopyBookmarks(const SwPaM& rPam, const SwPosition& rTarget);
187void CalcBreaks(std::vector<std::pair<SwNodeOffset, sal_Int32>> & rBreaks,
188 SwPaM const & rPam, bool const isOnlyFieldmarks = false);
192/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text operation/manipulation interface.
Definition: doc.hxx:194
Style of a layout element.
Definition: frmfmt.hxx:62
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: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
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.
SwFlyFrameFormat * InsertGraphicObject(const SwPaM &rRg, const GraphicObject &rGrfObj, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet) override
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)
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:37
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....
Definition: swtypes.hxx:133
sal_uInt16 sal_Unicode