Line data Source code
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 :
23 : #include <IDocumentContentOperations.hxx>
24 : #include <boost/utility.hpp>
25 : #include <ndarr.hxx> //Only for lcl_RstTxtAttr
26 :
27 : class SwDoc;
28 : class SwNoTextNode;
29 : class SwFormatColl;
30 : class SwHistory;
31 :
32 : namespace sw
33 : {
34 :
35 : class DocumentContentOperationsManager : public IDocumentContentOperations,
36 : public ::boost::noncopyable
37 : {
38 : public:
39 : DocumentContentOperationsManager( SwDoc& i_rSwdoc );
40 :
41 : //Interface methods:
42 : bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll, bool bCheckPos ) const SAL_OVERRIDE;
43 :
44 : void DeleteSection(SwNode* pNode) SAL_OVERRIDE;
45 :
46 : bool DeleteRange(SwPaM&) SAL_OVERRIDE;
47 :
48 : bool DelFullPara(SwPaM&) SAL_OVERRIDE;
49 :
50 : // Add optional parameter <bForceJoinNext>, default value <false>
51 : // Needed for hiding of deletion redlines
52 : bool DeleteAndJoin( SwPaM&,
53 : const bool bForceJoinNext = false ) SAL_OVERRIDE;
54 :
55 : bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) SAL_OVERRIDE;
56 :
57 : bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) SAL_OVERRIDE;
58 :
59 : bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags) SAL_OVERRIDE;
60 :
61 : bool Overwrite(const SwPaM &rRg, const OUString& rStr) SAL_OVERRIDE;
62 :
63 : bool InsertString(const SwPaM &rRg, const OUString&,
64 : const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) SAL_OVERRIDE;
65 :
66 : void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) SAL_OVERRIDE;
67 :
68 : SwFlyFrameFormat* Insert(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic,
69 : const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) SAL_OVERRIDE;
70 :
71 : SwFlyFrameFormat* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
72 : const SfxItemSet* pGrfAttrSet, SwFrameFormat*) SAL_OVERRIDE;
73 :
74 : void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) SAL_OVERRIDE;
75 :
76 : SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) SAL_OVERRIDE;
77 :
78 : SwFlyFrameFormat* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
79 : const SfxItemSet* pGrfAttrSet, SwFrameFormat*) SAL_OVERRIDE;
80 :
81 : SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
82 : const SfxItemSet* pGrfAttrSet, SwFrameFormat*) SAL_OVERRIDE;
83 :
84 : bool SplitNode(const SwPosition &rPos, bool bChkTableStart) SAL_OVERRIDE;
85 :
86 : bool AppendTextNode(SwPosition& rPos) SAL_OVERRIDE;
87 :
88 : bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr,
89 : const bool bRegExReplace) SAL_OVERRIDE;
90 :
91 : // Add a para for the char attribute exp...
92 : bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
93 : const SetAttrMode nFlags = SetAttrMode::DEFAULT, bool bExpandCharToPara=false) SAL_OVERRIDE;
94 :
95 : bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
96 : const SetAttrMode nFlags = SetAttrMode::DEFAULT) SAL_OVERRIDE;
97 :
98 : void RemoveLeadingWhiteSpace(const SwPosition & rPos ) SAL_OVERRIDE;
99 :
100 :
101 : //Non-Interface methods
102 :
103 : void CopyWithFlyInFly( const SwNodeRange& rRg,
104 : const sal_Int32 nEndContentIndex,
105 : const SwNodeIndex& rInsPos,
106 : const SwPaM* pCopiedPaM = NULL,
107 : bool bMakeNewFrms = true,
108 : bool bDelRedlines = true,
109 : bool bCopyFlyAtFly = false,
110 : const bool bMergedFirstNode = false ) const;
111 : void CopyFlyInFlyImpl( const SwNodeRange& rRg,
112 : const sal_Int32 nEndContentIndex,
113 : const SwNodeIndex& rStartIdx,
114 : const bool bCopyFlyAtFly = false,
115 : const bool bMergedFirstNode = false ) const;
116 :
117 : /// Parameters for _Rst and lcl_SetTextFormatColl
118 : //originallyfrom docfmt.cxx
119 : struct ParaRstFormat
120 : {
121 : SwFormatColl* pFormatColl;
122 : SwHistory* pHistory;
123 : const SwPosition *pSttNd, *pEndNd;
124 : const SfxItemSet* pDelSet;
125 : sal_uInt16 nWhich;
126 : bool bReset;
127 : bool bResetListAttrs; // #i62575#
128 : bool bResetAll;
129 : bool bInclRefToxMark;
130 : /// From the attributes included in the range, delete only the ones which have exactly same range. Don't delete the ones which are simply included in the range.
131 : bool bExactRange;
132 :
133 95872 : ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
134 : SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0)
135 : : pFormatColl(0)
136 : , pHistory(pHst)
137 : , pSttNd(pStt)
138 : , pEndNd(pEnd)
139 : , pDelSet(pSet)
140 : , nWhich(nWhch)
141 : , bReset(false) // #i62675#
142 : , bResetListAttrs(false)
143 : , bResetAll(true)
144 : , bInclRefToxMark(false)
145 95872 : , bExactRange(false)
146 : {
147 95872 : }
148 : };
149 : static bool lcl_RstTextAttr( const SwNodePtr& rpNd, void* pArgs ); //originally from docfmt.cxx
150 :
151 :
152 : virtual ~DocumentContentOperationsManager();
153 :
154 : private:
155 : SwDoc& m_rDoc;
156 :
157 : bool DeleteAndJoinImpl(SwPaM&, const bool);
158 : bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
159 : bool DeleteRangeImpl(SwPaM&, const bool unused = false);
160 : bool DeleteRangeImplImpl(SwPaM &);
161 : bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
162 : SwFlyFrameFormat* _InsNoTextNode( const SwPosition&rPos, SwNoTextNode*,
163 : const SfxItemSet* pFlyAttrSet,
164 : const SfxItemSet* pGrfAttrSet,
165 : SwFrameFormat* = 0 );
166 : /* Copy a range within the same or to another document.
167 : Position may not lie within range! */
168 : bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrms /*= true */,
169 : const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
170 : };
171 :
172 : }
173 :
174 : #endif // INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
175 :
176 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|