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 SwNoTxtNode;
29 : class SwFmtColl;
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 ) 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 enum InsertFlags nInsertMode = INS_EMPTYEXPAND ) SAL_OVERRIDE;
65 :
66 : void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) SAL_OVERRIDE;
67 :
68 : SwFlyFrmFmt* Insert(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic,
69 : const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) SAL_OVERRIDE;
70 :
71 : SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
72 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*) SAL_OVERRIDE;
73 :
74 : void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) SAL_OVERRIDE;
75 :
76 : SwDrawFrmFmt* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) SAL_OVERRIDE;
77 :
78 : SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
79 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*) SAL_OVERRIDE;
80 :
81 : SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
82 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*) SAL_OVERRIDE;
83 :
84 : bool SplitNode(const SwPosition &rPos, bool bChkTableStart) SAL_OVERRIDE;
85 :
86 : bool AppendTxtNode(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 sal_uInt16 nFlags,bool bExpandCharToPara=false) SAL_OVERRIDE;
94 :
95 : bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
96 : const sal_uInt16 nFlags) 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_SetTxtFmtColl
118 : //originallyfrom docfmt.cxx
119 : struct ParaRstFmt
120 : {
121 : SwFmtColl* pFmtColl;
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 :
131 171612 : ParaRstFmt(const SwPosition* pStt, const SwPosition* pEnd,
132 : SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0)
133 : : pFmtColl(0)
134 : , pHistory(pHst)
135 : , pSttNd(pStt)
136 : , pEndNd(pEnd)
137 : , pDelSet(pSet)
138 : , nWhich(nWhch)
139 : , bReset(false) // #i62675#
140 : , bResetListAttrs(false)
141 : , bResetAll(true)
142 171612 : , bInclRefToxMark(false)
143 : {
144 171612 : }
145 : };
146 : static bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ); //originally from docfmt.cxx
147 :
148 :
149 : virtual ~DocumentContentOperationsManager();
150 :
151 : private:
152 : SwDoc& m_rSwdoc;
153 :
154 : bool DeleteAndJoinImpl(SwPaM&, const bool);
155 : bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
156 : bool DeleteRangeImpl(SwPaM&, const bool unused = false);
157 : bool DeleteRangeImplImpl(SwPaM &);
158 : bool ReplaceRangeImpl(SwPaM&, OUString const&, const bool);
159 : SwFlyFrmFmt* _InsNoTxtNode( const SwPosition&rPos, SwNoTxtNode*,
160 : const SfxItemSet* pFlyAttrSet,
161 : const SfxItemSet* pGrfAttrSet,
162 : SwFrmFmt* = 0 );
163 : /* Copy a range within the same or to another document.
164 : Position may not lie within range! */
165 : bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrms /*= true */,
166 : const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
167 : };
168 :
169 : }
170 :
171 : #endif // INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCONTENTOPERATIONSMANAGER_HXX
172 :
173 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|