/src/libreoffice/sw/inc/editsh.hxx
Line | Count | Source |
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 | | #pragma once |
20 | | |
21 | | #include <sfx2/redlinerecordingmode.hxx> |
22 | | |
23 | | #include "crsrsh.hxx" |
24 | | |
25 | | #include "charfmt.hxx" |
26 | | #include "fldupde.hxx" |
27 | | #include "frmfmt.hxx" |
28 | | #include "swdllapi.h" |
29 | | #include "swundo.hxx" |
30 | | #include "tblenum.hxx" |
31 | | #include "tox.hxx" |
32 | | |
33 | | #include <memory> |
34 | | #include <utility> |
35 | | #include <vector> |
36 | | #include <o3tl/sorted_vector.hxx> |
37 | | |
38 | | namespace tools { class PolyPolygon; } |
39 | | class SwDoc; |
40 | | class CommandExtTextInputData; |
41 | | |
42 | | class SvNumberFormatter; |
43 | | class SfxPoolItem; |
44 | | class SfxItemSet; |
45 | | class SfxWatermarkItem; |
46 | | class SvxAutoCorrect; |
47 | | |
48 | | class SwDDEFieldType; |
49 | | class SwDBManager; |
50 | | |
51 | | struct SwDocStat; |
52 | | class SwAutoCompleteWord; |
53 | | |
54 | | class SwFormatRefMark; |
55 | | |
56 | | class SwNumRule; |
57 | | |
58 | | class SwTextFormatColl; |
59 | | class SwGrfNode; |
60 | | |
61 | | class Graphic; |
62 | | class GraphicObject; |
63 | | class GraphicAttr; |
64 | | class SwFormatINetFormat; |
65 | | class SwTable; |
66 | | class SwTextBlocks; |
67 | | class SwFormatFootnote; |
68 | | class SwSection; |
69 | | class SwSectionData; |
70 | | class SwSectionFormat; |
71 | | class SwTableAutoFormat; |
72 | | class SwPageDesc; |
73 | | class SwTextINetFormat; |
74 | | class SwSeqFieldList; |
75 | | class SwGlblDocContent; |
76 | | class SwGlblDocContents; |
77 | | class SwRangeRedline; |
78 | | class SwRedlineData; |
79 | | class SwFootnoteInfo; |
80 | | class SwEndNoteInfo; |
81 | | class SwLineNumberInfo; |
82 | | class SwAuthEntry; |
83 | | class SwRewriter; |
84 | | class SwView; |
85 | | struct SwConversionArgs; |
86 | | struct SvxSwAutoFormatFlags; |
87 | | struct SwInsertTableOptions; |
88 | | struct SwDBData; |
89 | | enum class SvtScriptType : sal_uInt8; |
90 | | enum class SfxClassificationPolicyType; |
91 | | enum class RedlineFlags; |
92 | | enum class TransliterationFlags; |
93 | | enum class GraphicType; |
94 | | |
95 | | namespace com::sun::star::uno { template < class > class Sequence; } |
96 | | namespace com::sun::star::linguistic2 { class XSpellAlternatives; } |
97 | | namespace com::sun::star::linguistic2 { struct ProofreadingResult; } |
98 | | |
99 | | namespace svx{ |
100 | | struct SpellPortion; |
101 | | typedef std::vector<SpellPortion> SpellPortions; |
102 | | class ClassificationResult; |
103 | | } |
104 | | |
105 | | namespace sfx2{ |
106 | | class LinkManager; |
107 | | } |
108 | | |
109 | | namespace sw { |
110 | | class UndoRedoContext; |
111 | | } |
112 | | |
113 | | enum class ParaBreakType { |
114 | | ToBlank = 0, |
115 | | ToOnlyCR = 2 |
116 | | }; |
117 | | |
118 | | /// For querying the INet-attributes for Navigator. |
119 | | struct SwGetINetAttr |
120 | | { |
121 | | OUString sText; |
122 | | const SwTextINetFormat& rINetAttr; |
123 | | |
124 | | SwGetINetAttr( OUString aText, const SwTextINetFormat& rAttr ) |
125 | 38 | : sText(std::move( aText )), rINetAttr( rAttr ) |
126 | 38 | {} |
127 | | }; |
128 | | typedef std::vector<SwGetINetAttr> SwGetINetAttrs; |
129 | | |
130 | | // Types of forms of content. |
131 | 13.7k | #define CNT_TXT 0x0001 |
132 | 0 | #define CNT_GRF 0x0002 |
133 | 0 | #define CNT_OLE 0x0010 |
134 | | |
135 | | // Test USHORT for a defined form of content. |
136 | | #define CNT_HasText(USH) ((USH)&CNT_TXT) |
137 | 0 | #define CNT_HasGrf(USH) ((USH)&CNT_GRF) |
138 | | #define CNT_HasOLE(USH) ((USH)&CNT_OLE) |
139 | | |
140 | | class SAL_DLLPUBLIC_RTTI SwEditShell : public SwCursorShell |
141 | | { |
142 | | static SvxSwAutoFormatFlags* s_pAutoFormatFlags; |
143 | | |
144 | | /// For the private methods DelRange and those of AutoCorrect. |
145 | | friend class SwAutoFormat; |
146 | | friend void InitCore(); |
147 | | friend void FinitCore(); |
148 | | /// For the PamCorrAbs/-Rel methods. |
149 | | friend class SwUndo; |
150 | | |
151 | | /** Returns pointer to a SwGrfNode |
152 | | that will be used by GetGraphic() and GetGraphicSize(). */ |
153 | | SwGrfNode *GetGrfNode_() const ; |
154 | | |
155 | | void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool goLeft = false, bool* pUndo = nullptr); |
156 | | |
157 | | void SetSectionAttr_( SwSectionFormat& rSectFormat, const SfxItemSet& rSet ); |
158 | | |
159 | | void ReinstatePaM(const SwRangeRedline& rRedline, SwPaM& rPaM); |
160 | | |
161 | | using SwViewShell::UpdateFields; |
162 | | using sw::BroadcastingModify::GetInfo; |
163 | | |
164 | | void UpdateSelectionAutoParaDirection(); |
165 | | |
166 | | public: |
167 | | /// Edit (all selected ranges). |
168 | | void Insert( sal_Unicode, bool bOnlyCurrCursor = false ); |
169 | | SW_DLLPUBLIC void Insert2( const OUString &, const bool bForceExpandHints = false ); |
170 | | void Overwrite( const OUString & ); |
171 | | |
172 | | /** Replace a selected range in a TextNode by given string. |
173 | | Meant for Search & Replace. |
174 | | bRegExpRplc - replace tabs (\\t) and insert found string (not \&). |
175 | | E.g.: Fnd: "zzz", Repl: "xx\t\\t..&..\&" |
176 | | --> "xx\t<Tab>..zzz..&" */ |
177 | | SW_DLLPUBLIC bool Replace( const OUString& rNewStr, bool bRegExpRplc ); |
178 | | |
179 | | /** Replace a selected range in a TextNode by given string. |
180 | | Possible comments will be kept (moved to the end of the selection). */ |
181 | | bool ReplaceKeepComments( const OUString& rNewStr); |
182 | | |
183 | | /** Delete content of all ranges. |
184 | | If whole nodes are selected, these nodes get deleted. */ |
185 | | SW_DLLPUBLIC bool Delete(bool isArtificialSelection = false, bool goLeft = false); |
186 | | |
187 | | /// Remove a complete paragraph. |
188 | | SW_DLLPUBLIC bool DelFullPara(); |
189 | | |
190 | | /// Change text to Upper/Lower/Hiragana/Katakana/... |
191 | | void TransliterateText( TransliterationFlags nType ); |
192 | | |
193 | | /// Count words in current selection. |
194 | | SW_DLLPUBLIC void CountWords( SwDocStat& rStat ) const; |
195 | | |
196 | | /// Replace fields by text - mailmerge support. |
197 | | bool ConvertFieldsToText(); |
198 | | |
199 | | /// Set all numbering start points to a fixed value - mailmerge support. |
200 | | void SetNumberingRestart(); |
201 | | |
202 | | /// Embeds all local links (ranges/graphics). |
203 | | SW_DLLPUBLIC sal_uInt16 GetLinkUpdMode() const; |
204 | | SW_DLLPUBLIC void SetLinkUpdMode( sal_uInt16 nMode ); |
205 | | |
206 | | /// Copy content of all ranges at current position of cursor to given Shell. |
207 | | bool Copy( SwEditShell& rDestShell ); |
208 | | |
209 | | /** For copying via ClipBoard: |
210 | | If table is copied into table, move all cursors away from it. |
211 | | Copy and Paste must be in FEShell because of FlyFrames! |
212 | | Copy all selections to the document. */ |
213 | | bool CopySelToDoc( SwDoc& rInsDoc ); |
214 | | |
215 | | SW_DLLPUBLIC void SplitNode(bool bCheckTableStart = true); |
216 | | SW_DLLPUBLIC bool AppendTextNode(); |
217 | | void AutoFormatBySplitNode(); |
218 | | |
219 | | /** If cursor is in an INetAttribute it will be deleted completely |
220 | | including the descriptive text (needed at drag & drop). */ |
221 | | void DelINetAttrWithText(); |
222 | | |
223 | | /** If Cursor is at the end of a character style in which the DontExpand-flag |
224 | | is not yet set, the latter will be set (==> return TRUE). */ |
225 | | bool DontExpandFormat(); |
226 | | |
227 | | /** Apply / remove attributes. |
228 | | @return attributes in required AttributeSet. |
229 | | When not unambiguous the set has a DONT_CARE !! |
230 | | 2nd optional parameter <bMergeIndentValuesOfNumRule>. |
231 | | If <bMergeIndentValuesOfNumRule> == true, the indent attributes of |
232 | | the corresponding list level of an applied list style is merged into |
233 | | the requested item set as a LR-SPACE item, if corresponding node has not |
234 | | its own indent attributes and the position-and-space mode of the list |
235 | | level is SvxNumberFormat::LABEL_ALIGNMENT. */ |
236 | | bool GetPaMAttr( SwPaM* pPaM, SfxItemSet& , |
237 | | const bool bMergeIndentValuesOfNumRule = false ) const; |
238 | | SW_DLLPUBLIC bool GetCurAttr( SfxItemSet& , |
239 | | const bool bMergeIndentValuesOfNumRule = false ) const; |
240 | | SW_DLLPUBLIC void SetAttrItem( const SfxPoolItem&, SetAttrMode nFlags = SetAttrMode::DEFAULT, |
241 | | const bool bParagraphSetting = false ); |
242 | | SW_DLLPUBLIC void SetAttrSet( const SfxItemSet&, SetAttrMode nFlags = SetAttrMode::DEFAULT, |
243 | | SwPaM* pCursor = nullptr, const bool bParagraphSetting = false ); |
244 | | |
245 | | /** Get RES_CHRATR_* items of one type in the current selection. |
246 | | * @param nWhich WhichId of the collected items. |
247 | | * If parts of the selection have different scripttypes, the items with corresponding WhichIds are also collected. |
248 | | * @return a vector of pairs. The pair contains a SfxPoolItem and a SwPaM, in which the item is valid and can be changed. */ |
249 | | std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM>>> GetItemWithPaM( sal_uInt16 nWhich ); |
250 | | |
251 | | /** |
252 | | * Get the paragraph format attribute(s) of the current selection. |
253 | | * |
254 | | * @see GetPaMParAttr() |
255 | | * |
256 | | * @param rSet |
257 | | * output parameter - the SfxItemSet where the automatic paragraph format attribute(s) will be store. |
258 | | * The attributes aren't invalidated or cleared if the function reach the getMaxLookup limit. |
259 | | */ |
260 | | SW_DLLPUBLIC void GetCurParAttr( SfxItemSet& rSet ) const; |
261 | | /** |
262 | | * Get the paragraph format attribute(s) of the selection(s) described by a SwPaM. |
263 | | * |
264 | | * @param pPaM |
265 | | * input parameter - the selection where to look for the paragraph format. |
266 | | * |
267 | | * @param rSet |
268 | | * output parameter - the SfxItemSet where the automatic paragraph format attribute(s) will be store. |
269 | | * The attributes aren't invalidated or cleared if the function reaches the getMaxLookup limit. |
270 | | */ |
271 | | void GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const; |
272 | | |
273 | | /// Set attribute as new default attribute in document. |
274 | | SW_DLLPUBLIC void SetDefault( const SfxPoolItem& ); |
275 | | |
276 | | /// Query default attribute of document. |
277 | | SW_DLLPUBLIC const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const; |
278 | | template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const |
279 | 0 | { |
280 | 0 | return static_cast<const T&>(GetDefault(sal_uInt16(nWhich))); |
281 | 0 | } Unexecuted instantiation: SvxLanguageItem const& SwEditShell::GetDefault<SvxLanguageItem>(TypedWhichId<SvxLanguageItem>) const Unexecuted instantiation: SvxTabStopItem const& SwEditShell::GetDefault<SvxTabStopItem>(TypedWhichId<SvxTabStopItem>) const |
282 | | |
283 | | void ResetAttr( const o3tl::sorted_vector<sal_uInt16> &attrs = o3tl::sorted_vector<sal_uInt16>(), SwPaM* pCursor = nullptr ); |
284 | | void GCAttr(); |
285 | | |
286 | | /// @return the scripttype of the selection. |
287 | | SW_DLLPUBLIC SvtScriptType GetScriptType() const; |
288 | | |
289 | | /// @return the language at current cursor position. |
290 | | SW_DLLPUBLIC LanguageType GetCurLang() const; |
291 | | |
292 | | /// TABLE |
293 | | size_t GetTableFrameFormatCount( bool bUsed = false ) const; |
294 | | SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed = false ) const; |
295 | | SW_DLLPUBLIC UIName GetUniqueTableName() const; |
296 | | |
297 | | /// CHAR |
298 | | SW_DLLPUBLIC sal_uInt16 GetCharFormatCount() const; |
299 | | SW_DLLPUBLIC SwCharFormat& GetCharFormat(sal_uInt16 nFormat) const; |
300 | | SwCharFormat* GetCurCharFormat() const; |
301 | | void FillByEx(SwCharFormat*); |
302 | | SwCharFormat* MakeCharFormat( const UIName& rName ); |
303 | | SW_DLLPUBLIC SwCharFormat* FindCharFormatByName( const UIName& rName ) const; |
304 | | |
305 | | /* FormatCollections (new) - Explaining the general naming pattern: |
306 | | * GetXXXCount() returns the count of xxx in the document. |
307 | | * GetXXX(i) returns i-th xxx (ERR_RAISE if beyond range!). |
308 | | * DelXXX(i) deletes i-th xxx (ERR_RAISE if beyond range!). |
309 | | * GetCurXXX() returns xxx that is valid at cursor or in ranges. |
310 | | * returns 0, if not unanimous. |
311 | | * SetXXX() sets xxx at cursor or in ranges. |
312 | | * MakeXXX() makes a xxx, derived from pDerivedFrom. |
313 | | */ |
314 | | |
315 | | // TXT |
316 | | SwTextFormatColl& GetDfltTextFormatColl() const; |
317 | | SW_DLLPUBLIC sal_uInt16 GetTextFormatCollCount() const; |
318 | | SW_DLLPUBLIC SwTextFormatColl& GetTextFormatColl( sal_uInt16 nTextFormatColl) const; |
319 | | /** |
320 | | * Get the named paragraph format of the current selection. |
321 | | * |
322 | | * @see GetPaMTextFormatColl() |
323 | | * |
324 | | * @return the named paragraph format of the first node that contains one. |
325 | | * Nodes are sort by order of appearance in the selections ; |
326 | | * selections are sort by their order of creation |
327 | | * (last created selection first, oldest selection at last). |
328 | | */ |
329 | | SW_DLLPUBLIC SwTextFormatColl* GetCurTextFormatColl() const; |
330 | | /** |
331 | | * Get the named paragraph format of the selection(s) described by a SwPaM. |
332 | | * |
333 | | * @param pPaM |
334 | | * input parameter - the selection where to look for the paragraph format. |
335 | | * |
336 | | * @return the named paragraph format of the first node that contains one. |
337 | | */ |
338 | | SwTextFormatColl* GetPaMTextFormatColl( SwPaM* pPaM ) const; |
339 | | |
340 | | // #i62675# |
341 | | /// Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTextFormatColl(..)> |
342 | | SW_DLLPUBLIC void SetTextFormatColl(SwTextFormatColl*, |
343 | | const bool bResetListAttrs = false, |
344 | | const bool bResetAllCharAttrs = false); |
345 | | SW_DLLPUBLIC SwTextFormatColl *MakeTextFormatColl(const UIName &rFormatCollName, |
346 | | SwTextFormatColl *pDerivedFrom = nullptr); |
347 | | void FillByEx(SwTextFormatColl*); |
348 | | SW_DLLPUBLIC SwTextFormatColl* FindTextFormatCollByName( const UIName& rName ) const; |
349 | | |
350 | | /// @return "Auto-Collection" with given Id. If it does not exist create it. |
351 | | SW_DLLPUBLIC SwTextFormatColl* GetTextCollFromPool( sal_uInt16 nId ); |
352 | | |
353 | | /// @return required automatic format base class. |
354 | | SwFormat* GetFormatFromPool( sal_uInt16 nId ); |
355 | | |
356 | | /// @return required automatic page style. |
357 | | SW_DLLPUBLIC SwPageDesc* GetPageDescFromPool( sal_uInt16 nId ); |
358 | | |
359 | | /// Query if the paragraph-/character-/frame-/page-style is used. |
360 | | SW_DLLPUBLIC bool IsUsed( const sw::BroadcastingModify& ) const; |
361 | | |
362 | | /// @return required automatic format. |
363 | | SwFrameFormat* GetFrameFormatFromPool( sal_uInt16 nId ) |
364 | 0 | { return static_cast<SwFrameFormat*>(SwEditShell::GetFormatFromPool( nId )); } |
365 | | SwCharFormat* GetCharFormatFromPool( sal_uInt16 nId ) |
366 | 0 | { return static_cast<SwCharFormat*>(SwEditShell::GetFormatFromPool( nId )); } |
367 | | |
368 | | void SetClassification(const OUString& rName, SfxClassificationPolicyType eType); |
369 | | void ApplyAdvancedClassification(std::vector<svx::ClassificationResult> const & rResult); |
370 | | std::vector<svx::ClassificationResult> CollectAdvancedClassification(); |
371 | | |
372 | | SfxWatermarkItem GetWatermark() const; |
373 | | SW_DLLPUBLIC void SetWatermark(const SfxWatermarkItem& rText); |
374 | | |
375 | | /// Sign the paragraph at the cursor. |
376 | | void SignParagraph(); |
377 | | |
378 | | /// Validate the paragraph signatures, if any, of the current text node. |
379 | | void ValidateParagraphSignatures(SwTextNode* pNode, bool updateDontRemove); |
380 | | |
381 | | /// Validate the current paragraph signatures, if any, at the cursor start. |
382 | | void ValidateCurrentParagraphSignatures(bool updateDontRemove); |
383 | | |
384 | | /// Validate all paragraph signatures. |
385 | | void ValidateAllParagraphSignatures(bool updateDontRemove); |
386 | | |
387 | | /// Restore the metadata fields, if missing, from the RDF metadata |
388 | | /// and validate the signatures and update the signature metadata fields. |
389 | | /// Needed since deleting the metadata field doesn't remove the RDF |
390 | | /// and editing docs using software that don't support paragraph signing. |
391 | | void RestoreMetadataFieldsAndValidateParagraphSignatures(); |
392 | | |
393 | | /// Ensure that the classification of the doc is never lower than |
394 | | /// the paragraph with the highest classification. |
395 | | void ClassifyDocPerHighestParagraphClass(); |
396 | | |
397 | | /// Apply the classification to the paragraph at cursor. |
398 | | void ApplyParagraphClassification(std::vector<svx::ClassificationResult> aResult); |
399 | | std::vector<svx::ClassificationResult> CollectParagraphClassification(); |
400 | | |
401 | | /// Returns true iff the cursor is within a paragraph metadata field. |
402 | | /// Currently there are two variants: signature and classification. |
403 | | bool IsCursorInParagraphMetadataField() const; |
404 | | |
405 | | /// Removes the paragraph metadata field at the current cursor, if any. |
406 | | /// Returns true iff a paragraph metadata field was removed. |
407 | | /// Currently there are two variants: signature and classification. |
408 | | bool RemoveParagraphMetadataFieldAtCursor(); |
409 | | |
410 | | bool InsertField(SwField const &, const bool bForceExpandHints); |
411 | | |
412 | | SW_DLLPUBLIC void UpdateOneField(SwField &); ///< One single field. |
413 | | SW_DLLPUBLIC void ConvertOneFieldToText(const SwField& rField); |
414 | | |
415 | | SW_DLLPUBLIC size_t GetFieldTypeCount(SwFieldIds nResId = SwFieldIds::Unknown) const; |
416 | | SW_DLLPUBLIC SwFieldType* GetFieldType(size_t nField, SwFieldIds nResId = SwFieldIds::Unknown) const; |
417 | | SW_DLLPUBLIC SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const; |
418 | | |
419 | | void RemoveFieldType(size_t nField); |
420 | | void RemoveFieldType(SwFieldIds nResId, const OUString& rName); |
421 | | |
422 | | void FieldToText( SwFieldType const * pType ); |
423 | | |
424 | | SW_DLLPUBLIC void ChangeAuthorityData(const SwAuthEntry* pNewData); |
425 | | |
426 | | /// Database information. |
427 | | SW_DLLPUBLIC SwDBData const & GetDBData() const; |
428 | | void ChgDBData(const SwDBData& SwDBData); |
429 | | SW_DLLPUBLIC void ChangeDBFields( const std::vector<OUString>& rOldNames, |
430 | | const OUString& rNewName ); |
431 | | SW_DLLPUBLIC void GetAllUsedDB( std::vector<OUString>& rDBNameList, |
432 | | std::vector<OUString> const * pAllDBNames ); |
433 | | |
434 | | bool IsAnyDatabaseFieldInDoc()const; |
435 | | |
436 | | /// Check whether DB fields point to an available data source and returns it. |
437 | | bool IsFieldDataSourceAvailable(OUString& rUsedDataSource) const; |
438 | | SW_DLLPUBLIC void UpdateExpFields(bool bCloseDB = false);///< only every expression fields update |
439 | | SW_DLLPUBLIC void LockExpFields(); |
440 | | SW_DLLPUBLIC void UnlockExpFields(); |
441 | | bool IsExpFieldsLocked() const; |
442 | | |
443 | | SW_DLLPUBLIC SwFieldUpdateFlags GetFieldUpdateFlags() const; |
444 | | SW_DLLPUBLIC void SetFieldUpdateFlags( SwFieldUpdateFlags eFlags ); |
445 | | |
446 | | /// For evaluation of DB fields (new DB-manager). |
447 | | SW_DLLPUBLIC SwDBManager* GetDBManager() const; |
448 | | |
449 | | SW_DLLPUBLIC SwFieldType* InsertFieldType(const SwFieldType &); |
450 | | |
451 | | /// Changes in document? |
452 | | SW_DLLPUBLIC bool IsModified() const; |
453 | | SW_DLLPUBLIC void SetModified(); |
454 | | SW_DLLPUBLIC void ResetModified(); |
455 | | SW_DLLPUBLIC void SetUndoNoResetModified(); |
456 | | |
457 | | /// Document - Statistics |
458 | | void UpdateDocStat(); |
459 | | SW_DLLPUBLIC const SwDocStat &GetUpdatedDocStat(); |
460 | | |
461 | | void Insert(const SwTOXMark& rMark); |
462 | | |
463 | | void DeleteTOXMark(SwTOXMark const * pMark); |
464 | | |
465 | | /// Get all marks at current SPoint. |
466 | | void GetCurTOXMarks(SwTOXMarks& rMarks) const ; |
467 | | |
468 | | /// Insert content table. Renew if required. |
469 | | void InsertTableOf(const SwTOXBase& rTOX, |
470 | | const SfxItemSet* pSet = nullptr); |
471 | | void UpdateTableOf(const SwTOXBase& rTOX, |
472 | | const SfxItemSet* pSet = nullptr); |
473 | | SW_DLLPUBLIC const SwTOXBase* GetCurTOX() const; |
474 | | SW_DLLPUBLIC const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false ); |
475 | | SW_DLLPUBLIC void SetDefaultTOXBase(const SwTOXBase& rBase); |
476 | | |
477 | | static bool IsTOXBaseReadonly(const SwTOXBase& rTOXBase); |
478 | | void SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly); |
479 | | |
480 | | SW_DLLPUBLIC sal_uInt16 GetTOXCount() const; |
481 | | SW_DLLPUBLIC const SwTOXBase* GetTOX( sal_uInt16 nPos ) const; |
482 | | SW_DLLPUBLIC bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ); |
483 | | |
484 | | /// After reading file update all content tables. |
485 | | void SetUpdateTOX( bool bFlag ); |
486 | | bool IsUpdateTOX() const; |
487 | | |
488 | | /// Manage types of content tables. |
489 | | SW_DLLPUBLIC sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const; |
490 | | SW_DLLPUBLIC const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const; |
491 | | void InsertTOXType(const SwTOXType& rTyp); |
492 | | |
493 | | /// AutoMark file |
494 | | SW_DLLPUBLIC OUString const & GetTOIAutoMarkURL() const; |
495 | | void SetTOIAutoMarkURL(const OUString& rSet); |
496 | | void ApplyAutoMark(); |
497 | | |
498 | | /// Key for managing index. |
499 | | SW_DLLPUBLIC void GetTOIKeys( SwTOIKeyType eTyp, std::vector<OUString>& rArr ) const; |
500 | | |
501 | | SW_DLLPUBLIC void SetOutlineNumRule(const SwNumRule&); |
502 | | SW_DLLPUBLIC const SwNumRule* GetOutlineNumRule() const; |
503 | | |
504 | | bool OutlineUpDown( short nOffset = 1 ); |
505 | | |
506 | | bool MoveOutlinePara( SwOutlineNodes::difference_type nOffset, |
507 | | const SwOutlineNodesInline* pOutlineNodesInline = nullptr ); |
508 | | |
509 | | bool IsProtectedOutlinePara() const; |
510 | | |
511 | | SW_DLLPUBLIC const SwNumRule* GetNumRuleAtCurrCursorPos() const; |
512 | | |
513 | | /** Returns the numbering rule found at the paragraphs of the current selection, |
514 | | if all paragraphs of the current selection have the same or none numbering rule applied. */ |
515 | | const SwNumRule* GetNumRuleAtCurrentSelection() const; |
516 | | |
517 | | /** Optional parameter <bResetIndentAttrs> (default value false). |
518 | | If <bResetIndentAttrs> equals true, the indent attributes "before text" |
519 | | and "first line indent" are additionally reset at the current selection, |
520 | | if the list style makes use of the new list level attributes. |
521 | | Parameters <bCreateNewList> and <sContinuedListId> |
522 | | <bCreateNewList> indicates, if a new list is created by applying the given list style. |
523 | | If <bCreateNewList> equals false, <sContinuedListId> may contain the |
524 | | list Id of a list, which has to be continued by applying the given list style */ |
525 | | void SetCurNumRule( const SwNumRule&, |
526 | | const bool bCreateNewList /*= false*/, |
527 | | const OUString& sContinuedListId = OUString(), |
528 | | const bool bResetIndentAttrs = false ); |
529 | | |
530 | | /// Paragraphs without enumeration but with indents. |
531 | | void NoNum(); |
532 | | |
533 | | /// Delete, split enumeration list. |
534 | | SW_DLLPUBLIC void DelNumRules(); |
535 | | |
536 | | SW_DLLPUBLIC void NumUpDown( bool bDown = true ); |
537 | | |
538 | | SW_DLLPUBLIC bool MoveParagraph( SwNodeOffset nOffset = SwNodeOffset(1)); |
539 | | bool MoveNumParas( bool bUpperLower, bool bUpperLeft ); |
540 | | |
541 | | /// Switch on/off of numbering via Delete/Backspace. |
542 | | SW_DLLPUBLIC bool NumOrNoNum(bool bDelete = false); |
543 | | |
544 | | // #i23726# |
545 | | // #i90078# |
546 | | /// Remove unused default parameter <nLevel> and <bRelative>. |
547 | | // Adjust method name and parameter name |
548 | | void ChangeIndentOfAllListLevels( sal_Int32 nDiff ); |
549 | | // Adjust method name |
550 | | void SetIndent(short nIndent, const SwPosition & rPos); |
551 | | bool IsFirstOfNumRuleAtCursorPos() const; |
552 | | |
553 | | bool IsNoNum() const; |
554 | | |
555 | | /** @return Num-Level of the node in which point of cursor is. |
556 | | @return values can be: NO_NUMBERING, 0..MAXLEVEL-1 */ |
557 | | sal_uInt8 GetNumLevel() const; |
558 | | |
559 | | /// Detect highest and lowest level to check moving of outline levels. |
560 | | void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower ); |
561 | | |
562 | | /// Get Outline level of current paragraph. |
563 | | int GetCurrentParaOutlineLevel( ) const; |
564 | | |
565 | | // i29560 |
566 | | bool HasNumber() const; |
567 | | bool HasBullet() const; |
568 | | |
569 | | bool SelectionHasNumber() const; |
570 | | bool SelectionHasBullet() const; |
571 | | |
572 | | SW_DLLPUBLIC UIName GetUniqueNumRuleName() const; |
573 | | void ChgNumRuleFormats( const SwNumRule& rRule ); |
574 | | |
575 | | /// Set (and query if) a numbering with StartFlag starts at current PointPos. |
576 | | void SetNumRuleStart( bool bFlag, SwPaM* pCursor ); |
577 | | bool IsNumRuleStart( SwPaM* pPaM = nullptr ) const; |
578 | | void SetNodeNumStart( sal_uInt16 nStt ); |
579 | | |
580 | | sal_uInt16 GetNodeNumStart( SwPaM* pPaM ) const; |
581 | | |
582 | | void ReplaceNumRule( const UIName& rOldRule, const UIName& rNewRule ); |
583 | | |
584 | | /** Searches for a text node with a numbering rule. |
585 | | in case a list style is found, <sListId> holds the list id, to which the |
586 | | text node belongs, which applies the found list style. */ |
587 | | const SwNumRule * SearchNumRule(const bool bNum, |
588 | | OUString& sListId ); |
589 | | std::set<OUString> GetUsedBullets(); |
590 | | |
591 | | /** Undo. |
592 | | Maintain UndoHistory in Document. |
593 | | Reset UndoHistory at Save, SaveAs, Create ??? */ |
594 | | SW_DLLPUBLIC void DoUndo( bool bOn = true ); |
595 | | SW_DLLPUBLIC bool DoesUndo() const; |
596 | | void DoGroupUndo( bool bUn ); |
597 | | bool DoesGroupUndo() const; |
598 | | void DelAllUndoObj(); |
599 | | |
600 | | /// Undo: set up Undo parenthesis, return nUndoId of this parenthesis. |
601 | | SW_DLLPUBLIC SwUndoId StartUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr ); |
602 | | |
603 | | /// Closes parenthesis of nUndoId, not used by UI. |
604 | | SW_DLLPUBLIC SwUndoId EndUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr ); |
605 | | |
606 | | SW_DLLPUBLIC bool GetLastUndoInfo(OUString *const o_pStr, |
607 | | SwUndoId *const o_pId, |
608 | | const SwView* pView = nullptr) const; |
609 | | bool GetFirstRedoInfo(OUString *const o_pStr, |
610 | | SwUndoId *const o_pId, |
611 | | const SwView* pView = nullptr) const; |
612 | | SwUndoId GetRepeatInfo(OUString *const o_pStr) const; |
613 | | |
614 | | /// is it forbidden to modify cursors via API calls? |
615 | | bool CursorsLocked() const; |
616 | | /// set selections to those contained in the UndoRedoContext |
617 | | /// should only be called by sw::UndoManager! |
618 | | void HandleUndoRedoContext(::sw::UndoRedoContext & rContext); |
619 | | |
620 | | SW_DLLPUBLIC void Undo(sal_uInt16 const nCount = 1, sal_uInt16 nOffset = 0); |
621 | | SW_DLLPUBLIC void Redo(sal_uInt16 const nCount = 1); |
622 | | void Repeat(sal_uInt16 const nCount); |
623 | | |
624 | | /// To enable set up of StartActions and EndActions. |
625 | | SW_DLLPUBLIC virtual void CalcLayout() override; |
626 | | |
627 | | /// Determine form of content. Return Type at CurrentCursor->SPoint. |
628 | | sal_uInt16 GetCntType() const; |
629 | | |
630 | | /// Are there frames, footnotes, etc. |
631 | | bool HasOtherCnt() const; |
632 | | |
633 | | /// Apply ViewOptions with Start-/EndAction. |
634 | | virtual void ApplyViewOptions( const SwViewOption &rOpt ) override; |
635 | | |
636 | | /// Selected area has readonly content |
637 | | virtual void InfoReadOnlyDialog(bool /*bAsync*/) const |
638 | 0 | { |
639 | | // override in SwWrtShell |
640 | 0 | } |
641 | | |
642 | | /// Selected area has hidden content |
643 | | virtual bool WarnHiddenSectionDialog() const |
644 | 0 | { |
645 | | // override in SwWrtShell |
646 | 0 | return true; |
647 | 0 | } |
648 | | |
649 | | /// Switch to Design mode for Forms |
650 | | virtual bool WarnSwitchToDesignModeDialog() const |
651 | 0 | { |
652 | | // override in SwWrtShell |
653 | 0 | return false; |
654 | 0 | } |
655 | | |
656 | | /** Query text within selection. */ |
657 | | SW_DLLPUBLIC void GetSelectedText( OUString &rBuf, |
658 | | ParaBreakType nHndlParaBreak = ParaBreakType::ToBlank ); |
659 | | |
660 | | /** @return graphic, if CurrentCursor->Point() points to a SwGrfNode |
661 | | (and mark is not set or points to the same graphic). */ |
662 | | |
663 | | const Graphic* GetGraphic( bool bWait = true ) const; |
664 | | const GraphicObject* GetGraphicObj() const; |
665 | | const GraphicAttr* GetGraphicAttr( GraphicAttr& rGA ) const; |
666 | | |
667 | | bool IsLinkedGrfSwapOut() const; |
668 | | GraphicType GetGraphicType() const; |
669 | | |
670 | | const tools::PolyPolygon *GetGraphicPolygon() const; |
671 | | void SetGraphicPolygon( const tools::PolyPolygon *pPoly ); |
672 | | |
673 | | /** If there's an automatic, not manipulated polygon at the selected |
674 | | notxtnode, it has to be deleted, e.g. cause the object has changed. */ |
675 | | void ClearAutomaticContour(); |
676 | | |
677 | | /// @return the size of a graphic in Twips if cursor is in a graphic. |
678 | | SW_DLLPUBLIC bool GetGrfSize(Size&) const; |
679 | | |
680 | | /** @return name and filter of a graphic if the cursor is in a graphic, |
681 | | else give a rap on the knuckles! |
682 | | If a string-ptr != 0 return the respective name. */ |
683 | | void GetGrfNms( OUString* pGrfName, OUString* pFltName ) const; |
684 | | |
685 | | /// Re-read if graphic is not ok. Current graphic is replaced by the new one. |
686 | | void ReRead( const OUString& rGrfName, const OUString& rFltName, |
687 | | const Graphic* pGraphic = nullptr ); |
688 | | |
689 | | /// Unique identification of object (for ImageMapDlg). |
690 | | void *GetIMapInventor() const; |
691 | | |
692 | | // #i73788# |
693 | | /// Remove default parameter, because method always called this default value. |
694 | | SW_DLLPUBLIC Graphic GetIMapGraphic() const; ///< @return a graphic for all Flys! |
695 | | const SwFlyFrameFormat* FindFlyByName( const UIName& rName ) const; |
696 | | |
697 | | /** @return a ClientObject, if CurrentCursor->Point() points to a SwOLENode |
698 | | (and mark is neither set not pointint to same ClientObject) |
699 | | else give rap on the knuckles. */ |
700 | | SW_DLLPUBLIC svt::EmbeddedObjectRef& GetOLEObject() const; |
701 | | |
702 | | /// Is there an OLEObject with this name (SwFormat)? |
703 | | bool HasOLEObj( const UIName& rName ) const; |
704 | | |
705 | | /// @return pointer to the data of the chart in which Cursr is. |
706 | | void SetChartName( const UIName &rName ); |
707 | | |
708 | | /// Update content of all charts for table with given name. |
709 | | void UpdateCharts( const UIName& rName ); |
710 | | |
711 | | OUString GetCurWord() const; |
712 | | |
713 | | /** Glossary from glossary document in current document. |
714 | | Styles only if not already existent. */ |
715 | | void InsertGlossary( SwTextBlocks& rGlossary, const OUString& ); |
716 | | |
717 | | /** Make current selection glossary and insert into glossary document |
718 | | including styles. */ |
719 | | sal_uInt16 MakeGlossary( SwTextBlocks& rToFill, const OUString& rName, |
720 | | const OUString& rShortName, bool bSaveRelFile, |
721 | | const OUString* pOnlyText ); |
722 | | |
723 | | /// Save complete content of doc as glossary. |
724 | | sal_uInt16 SaveGlossaryDoc( SwTextBlocks& rGlossary, const OUString& rName, |
725 | | const OUString& rShortName, |
726 | | bool bSaveRelFile, |
727 | | bool bOnlyText ); |
728 | | |
729 | | // Linguistics... |
730 | | /// Save selections. |
731 | | void HyphStart( SwDocPositions eStart, SwDocPositions eEnd ); |
732 | | |
733 | | /// restore selections. |
734 | | void HyphEnd(); |
735 | | css::uno::Reference< css::uno::XInterface> |
736 | | HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ); |
737 | | |
738 | | void HyphIgnore(); |
739 | | |
740 | | /// For Inserting SoftHyphen. Position is offset within the syllabificated word. |
741 | | static void InsertSoftHyph( const sal_Int32 nHyphPos ); |
742 | | |
743 | | /** |
744 | | * Inserts an nRows x nCols table to the document at the current position. Unlike the UI, this |
745 | | * function does not move the user's cursor to the first cell of the just inserted table, use |
746 | | * `MoveTable(GotoPrevTable, fnTableStart)` to do that. |
747 | | */ |
748 | | SW_DLLPUBLIC const SwTable& InsertTable( const SwInsertTableOptions& rInsTableOpts, ///< All |
749 | | sal_uInt16 nRows, sal_uInt16 nCols, |
750 | | const SwTableAutoFormat* pTAFormat = nullptr ); |
751 | | |
752 | | void InsertDDETable( const SwInsertTableOptions& rInsTableOpts, ///< HeadlineNoBorder |
753 | | SwDDEFieldType* pDDEType, |
754 | | sal_uInt16 nRows, sal_uInt16 nCols ); |
755 | | |
756 | | void UpdateTable(); |
757 | | SW_DLLPUBLIC void SetTableName( SwFrameFormat& rTableFormat, const UIName &rNewName ); |
758 | | |
759 | | SW_DLLPUBLIC SwFrameFormat *GetTableFormat(); |
760 | | SW_DLLPUBLIC bool TextToTable( const SwInsertTableOptions& rInsTableOpts, ///< All |
761 | | sal_Unicode cCh, |
762 | | const SwTableAutoFormat* pTAFormat = nullptr ); |
763 | | SW_DLLPUBLIC bool TableToText( sal_Unicode cCh ); |
764 | | bool IsTextToTableAvailable() const; |
765 | | |
766 | | bool GetTableBoxFormulaAttrs( SfxItemSet& rSet ) const; |
767 | | SW_DLLPUBLIC void SetTableBoxFormulaAttrs( const SfxItemSet& rSet ); |
768 | | |
769 | | bool IsTableBoxTextFormat() const; |
770 | | OUString GetTableBoxText() const; |
771 | | |
772 | | TableChgMode GetTableChgMode() const; |
773 | | SW_DLLPUBLIC void SetTableChgMode( TableChgMode eMode ); |
774 | | |
775 | | /// Split table at cursor position. |
776 | | SW_DLLPUBLIC void SplitTable( SplitTable_HeadlineOption eMode ); |
777 | | |
778 | | /** Merge tables. |
779 | | |
780 | | Can Merge checks if Prev or Next are possible. |
781 | | If pointer pChkNxtPrv is passed possible direction is given. */ |
782 | | bool CanMergeTable( bool bWithPrev = true, bool* pChkNxtPrv = nullptr ) const; |
783 | | bool MergeTable( bool bWithPrev ); |
784 | | |
785 | | /// Set up InsertDB as table Undo. |
786 | | SW_DLLPUBLIC void AppendUndoForInsertFromDB( bool bIsTable ); |
787 | | |
788 | | /// Functions used for spell checking and text conversion. |
789 | | |
790 | | /// Save selections. |
791 | | void SpellStart( SwDocPositions eStart, SwDocPositions eEnd, |
792 | | SwDocPositions eCurr, SwConversionArgs *pConvArgs = nullptr ); |
793 | | |
794 | | /// Restore selections. |
795 | | void SpellEnd( SwConversionArgs const *pConvArgs = nullptr, bool bRestoreSelection = true ); |
796 | | css::uno::Any SpellContinue( |
797 | | sal_uInt16* pPageCnt, sal_uInt16* pPageSt, |
798 | | SwConversionArgs const *pConvArgs ); |
799 | | |
800 | | /** Spells on a sentence basis - the SpellPortions are needed |
801 | | @return false if no error could be found. */ |
802 | | bool SpellSentence(svx::SpellPortions& rToFill, bool bIsGrammarCheck ); |
803 | | |
804 | | /// Make SpellIter start with the current sentence when called next time. |
805 | | static void PutSpellingToSentenceStart(); |
806 | | |
807 | | /// Moves the continuation position to the end of the currently checked sentence. |
808 | | static void MoveContinuationPosToEndOfCheckedSentence(); |
809 | | |
810 | | /// Applies a changed sentence. |
811 | | void ApplyChangedSentence(const svx::SpellPortions& rNewPortions, bool bRecheck); |
812 | | |
813 | | /// Check SwSpellIter data to see if the last sentence got grammar checked. |
814 | | static bool HasLastSentenceGotGrammarChecked(); |
815 | | |
816 | | /// Is text conversion active somewhere else? |
817 | | static bool HasConvIter(); |
818 | | |
819 | | /// Is hyphenation active somewhere else? |
820 | | static bool HasHyphIter(); |
821 | | |
822 | | void HandleCorrectionError(const OUString& aText, SwPosition aPos, sal_Int32 nBegin, |
823 | | sal_Int32 nLen, const Point* pPt, |
824 | | SwRect& rSelectRect); |
825 | | css::uno::Reference< css::linguistic2::XSpellAlternatives > |
826 | | GetCorrection( const Point* pPt, SwRect& rSelectRect ); |
827 | | |
828 | | bool GetGrammarCorrection( css::linguistic2::ProofreadingResult /*out*/ &rResult, |
829 | | sal_Int32 /*out*/ &rErrorPosInText, |
830 | | sal_Int32 /*out*/ &rErrorIndexInResult, |
831 | | css::uno::Sequence< OUString > /*out*/ &rSuggestions, |
832 | | const Point* pPt, SwRect& rSelectRect ); |
833 | | |
834 | | static void IgnoreGrammarErrorAt( SwPaM& rErrorPosition ); |
835 | | void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd ); |
836 | | |
837 | | /// @return reference set in document according to given name. |
838 | | const SwFormatRefMark* GetRefMark( const SwMarkName& rName ) const; |
839 | | |
840 | | /** @return names of all references set in document. |
841 | | If ArrayPointer == 0 then return only whether a RefMark is set in document. */ |
842 | | sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const; |
843 | | |
844 | | /// Call AutoCorrect |
845 | | void AutoCorrect( SvxAutoCorrect& rACorr, bool bInsertMode, |
846 | | sal_Unicode cChar ); |
847 | | OUString GetPrevAutoCorrWord(SvxAutoCorrect& rACorr); |
848 | | |
849 | | // We consider no more than 9 characters before the cursor, and they must not start in the |
850 | | // middle of a word (leading spaces are OK) |
851 | | std::vector<OUString> GetChunkForAutoText(); |
852 | | |
853 | | /// Set our styles according to the respective rules. |
854 | | void AutoFormat( const SvxSwAutoFormatFlags* pAFlags, bool bCurrentParagraphOnly ); |
855 | | |
856 | | SW_DLLPUBLIC static SvxSwAutoFormatFlags* GetAutoFormatFlags(); |
857 | | SW_DLLPUBLIC static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *); |
858 | | |
859 | | /// Calculates selection. |
860 | | OUString Calculate(); |
861 | | |
862 | | bool InsertURL( const SwFormatINetFormat& rFormat, const OUString& rStr, |
863 | | bool bKeepSelection = false ); |
864 | | void GetINetAttrs(SwGetINetAttrs& rArr , bool bIncludeInToxContent = true); |
865 | | |
866 | | SW_DLLPUBLIC OUString GetDropText( const sal_Int32 nChars ) const; |
867 | | void ReplaceDropText( const OUString &rStr, SwPaM* pPaM = nullptr ); |
868 | | |
869 | | /** May an outline be moved or copied? |
870 | | Check whether it's in text body, not in table, and not read-only (move). */ |
871 | | bool IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const; |
872 | | bool IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const; |
873 | | |
874 | | SW_DLLPUBLIC sal_Int32 GetLineCount(); |
875 | | |
876 | | /// Query and set footnote-text/number. Set... to current SSelection! |
877 | | SW_DLLPUBLIC bool GetCurFootnote( SwFormatFootnote* pToFillFootnote = nullptr ); |
878 | | SW_DLLPUBLIC bool SetCurFootnote( const SwFormatFootnote& rFillFootnote ); |
879 | | SW_DLLPUBLIC bool HasFootnotes( bool bEndNotes = false ) const; |
880 | | |
881 | | SW_DLLPUBLIC size_t GetSeqFootnoteList( SwSeqFieldList& rList, bool bEndNotes = false ); |
882 | | /// @return list of all footnotes and their first portions of text. |
883 | | |
884 | | SW_DLLPUBLIC SwSection const* InsertSection( |
885 | | SwSectionData & rNewData, SfxItemSet const*const = nullptr ); |
886 | | SW_DLLPUBLIC bool IsInsRegionAvailable() const; |
887 | | SW_DLLPUBLIC const SwSection* GetCurrSection() const; |
888 | | |
889 | | /** @return current range like Cet CurrSection(). But this function iterates |
890 | | also over frames and catches the range even if the cursor is positioned in |
891 | | a footnote the reference of which is in a columned range. |
892 | | If bOutOfTab is set, the range comprising the table is searched |
893 | | and not an inner one. */ |
894 | | SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = nullptr ); |
895 | | |
896 | | SW_DLLPUBLIC size_t GetSectionFormatCount() const; |
897 | | SW_DLLPUBLIC size_t GetSectionFormatPos(const SwSectionFormat&) const; |
898 | | SW_DLLPUBLIC const SwSectionFormat& GetSectionFormat(size_t nFormat) const; |
899 | | SW_DLLPUBLIC void DelSectionFormat( size_t nFormat); |
900 | | SW_DLLPUBLIC void UpdateSection( size_t const nSect, SwSectionData &, |
901 | | SfxItemSet const*const = nullptr); |
902 | | bool IsAnySectionInDoc() const; |
903 | | |
904 | | SW_DLLPUBLIC OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const; |
905 | | |
906 | | /// Set attributes. |
907 | | SW_DLLPUBLIC void SetSectionAttr(const SfxItemSet& rSet, SwSectionFormat* pSectFormat = nullptr); |
908 | | |
909 | | /** Search inside the cursor selection for full selected sections. |
910 | | if any part of section in the selection @return 0. |
911 | | if more than one in the selection return the count. */ |
912 | | SW_DLLPUBLIC sal_uInt16 GetFullSelectedSectionCount() const; |
913 | | |
914 | | /** Special insert: Insert a new text node just before or after a section or |
915 | | table, if the cursor is positioned at the start/end of said |
916 | | section/table. The purpose of the method is to allow users to insert text |
917 | | at certain 'impossible' positions, e.g. before a table at the document |
918 | | start or between two sections. */ |
919 | | SW_DLLPUBLIC void DoSpecialInsert(); |
920 | | bool CanSpecialInsert() const; |
921 | | |
922 | | /// Optimizing UI. |
923 | | void SetNewDoc(); |
924 | | |
925 | | SW_DLLPUBLIC sfx2::LinkManager& GetLinkManager(); |
926 | | inline const sfx2::LinkManager& GetLinkManager() const; |
927 | | |
928 | | /** Adjust left margin via object bar (similar to adjustment of numerations). |
929 | | One can either change the margin "by" adding or subtracting a given |
930 | | offset or set it "to" this position @param (bModulus = true). */ |
931 | | bool IsMoveLeftMargin( bool bRight, bool bModulus = true ) const; |
932 | | void MoveLeftMargin( bool bRight, bool bModulus = true ); |
933 | | |
934 | | /// Query NumberFormatter from document. |
935 | | SW_DLLPUBLIC SvNumberFormatter* GetNumberFormatter(); |
936 | | const SvNumberFormatter* GetNumberFormatter() const |
937 | 0 | { return const_cast<SwEditShell*>(this)->GetNumberFormatter(); } |
938 | | |
939 | | /// Interfaces for GlobalDocument. |
940 | | bool IsGlobalDoc() const; |
941 | | void SetGlblDocSaveLinks( bool bFlag ); |
942 | | bool IsGlblDocSaveLinks() const; |
943 | | void GetGlobalDocContent( SwGlblDocContents& rArr ) const; |
944 | | void InsertGlobalDocContent( const SwGlblDocContent& rPos, |
945 | | SwSectionData & rNew ); |
946 | | bool InsertGlobalDocContent( const SwGlblDocContent& rPos, |
947 | | const SwTOXBase& rTOX ); |
948 | | bool InsertGlobalDocContent( const SwGlblDocContent& rPos ); |
949 | | void DeleteGlobalDocContent( const SwGlblDocContents& rArr, |
950 | | size_t nPos ); |
951 | | bool MoveGlobalDocContent( const SwGlblDocContents& rArr , |
952 | | size_t nFromPos, size_t nToPos, |
953 | | size_t nNewPos ); |
954 | | void GotoGlobalDocContent( const SwGlblDocContent& rPos ); |
955 | | |
956 | | /// For Redlining. |
957 | | SW_DLLPUBLIC RedlineFlags GetRedlineFlags() const; |
958 | | SW_DLLPUBLIC void SetRedlineFlags( RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic ); |
959 | | bool IsRedlineOn() const; |
960 | | SW_DLLPUBLIC SwRedlineTable::size_type GetRedlineCount() const; |
961 | | const SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ) const; |
962 | | SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ); |
963 | | SW_DLLPUBLIC bool AcceptRedline( SwRedlineTable::size_type nPos, bool bDirect = false ); |
964 | | SW_DLLPUBLIC bool RejectRedline( SwRedlineTable::size_type nPos, bool bDirect = false ); |
965 | | bool AcceptRedlinesInSelection(); |
966 | | bool RejectRedlinesInSelection(); |
967 | | SW_DLLPUBLIC void ReinstateRedline(SwRedlineTable::size_type nPos); |
968 | | void ReinstateRedlinesInSelection(); |
969 | | |
970 | | /** Search Redline for this Data and @return position in array. |
971 | | If not found, return SwRedlineTable::npos. */ |
972 | | SwRedlineTable::size_type FindRedlineOfData( const SwRedlineData& ) const; |
973 | | |
974 | | /// Set comment to Redline at position. |
975 | | bool SetRedlineComment( const OUString& rS ); |
976 | | const SwRangeRedline* GetCurrRedline() const; |
977 | | |
978 | | /// Redline attributes have been changed. Updated views. |
979 | | SW_DLLPUBLIC void UpdateRedlineAttr(); |
980 | | |
981 | | /// Compare two documents. |
982 | | tools::Long CompareDoc( const SwDoc& rDoc ); |
983 | | |
984 | | /// Merge two documents. |
985 | | SW_DLLPUBLIC tools::Long MergeDoc( const SwDoc& rDoc ); |
986 | | |
987 | | /// Footnote attributes global to document. |
988 | | SW_DLLPUBLIC const SwFootnoteInfo& GetFootnoteInfo() const; |
989 | | SW_DLLPUBLIC void SetFootnoteInfo(const SwFootnoteInfo& rInfo); |
990 | | SW_DLLPUBLIC const SwEndNoteInfo& GetEndNoteInfo() const; |
991 | | SW_DLLPUBLIC void SetEndNoteInfo(const SwEndNoteInfo& rInfo); |
992 | | |
993 | | SW_DLLPUBLIC const SwLineNumberInfo &GetLineNumberInfo() const; |
994 | | SW_DLLPUBLIC void SetLineNumberInfo( const SwLineNumberInfo& rInfo); |
995 | | |
996 | | /// Labels: Synchronize ranges. |
997 | | void SetLabelDoc( bool bFlag ); |
998 | | SW_DLLPUBLIC bool IsLabelDoc() const; |
999 | | |
1000 | | /// Interface for TextInputData - (for input of Japanese/Chinese chars.) |
1001 | | void CreateExtTextInput(LanguageType eInputLanguage); |
1002 | | OUString DeleteExtTextInput( bool bInsText = true); |
1003 | | void SetExtTextInputData( const CommandExtTextInputData& ); |
1004 | | |
1005 | | /// Returns true iff paragraph signature validation is enabled. |
1006 | 4.26k | bool IsParagraphSignatureValidationEnabled() const { return m_bDoParagraphSignatureValidation; } |
1007 | | /// Enable/Disable paragraph signature validation and return the previous value. |
1008 | | bool SetParagraphSignatureValidation(const bool bEnable) |
1009 | 8.52k | { |
1010 | 8.52k | const bool bOldFlag = m_bDoParagraphSignatureValidation; |
1011 | 8.52k | m_bDoParagraphSignatureValidation = bEnable; |
1012 | 8.52k | return bOldFlag; |
1013 | 8.52k | } |
1014 | | |
1015 | | /// Interface for access to AutoComplete-list. |
1016 | | static SwAutoCompleteWord& GetAutoCompleteWords(); |
1017 | | |
1018 | | /** @return a scaling factor of selected text. Used for the rotated |
1019 | | character attribute dialog. */ |
1020 | | sal_uInt16 GetScalingOfSelectedText() const; |
1021 | | |
1022 | 0 | bool IsNbspRunNext() const { return m_bNbspRunNext; } |
1023 | | |
1024 | | /// Ctor/Dtor. |
1025 | | SwEditShell( SwDoc&, vcl::Window*, const SwViewOption *pOpt ); |
1026 | | |
1027 | | /// Copy-Constructor in disguise. |
1028 | | SwEditShell( SwEditShell&, vcl::Window* ); |
1029 | | virtual ~SwEditShell() override; |
1030 | | |
1031 | | private: |
1032 | | SwEditShell(const SwEditShell &) = delete; |
1033 | | const SwEditShell &operator=(const SwEditShell &) = delete; |
1034 | | |
1035 | | /* TODO: this flag may have to be invalidated / reset to false at various |
1036 | | * places if it was true and the edit cursor position changes. It's somehow |
1037 | | * overkill though because it can only be true if a NO-BREAK SPACE was |
1038 | | * inserted by the last DoAutoCorrect() call (in French language), any |
1039 | | * subsequent call will reset it anyway and just if the cursor is |
1040 | | * positioned behind "x :" and the next character inserted is not a space |
1041 | | * the existing nb-space will be removed. Bear this in mind if that problem |
1042 | | * arises. */ |
1043 | | bool m_bNbspRunNext; ///< NO-BREAK SPACE state flag passed to and maintained by SvxAutoCorrect::DoAutoCorrect() |
1044 | | bool m_bDoParagraphSignatureValidation; ///< Prevent nested calls of ValidateParagraphSignatures. |
1045 | | }; |
1046 | | |
1047 | | inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const |
1048 | 0 | { return const_cast<SwEditShell*>(this)->GetLinkManager(); } |
1049 | | |
1050 | | /// Class for automated call of Start- and EndAction(). |
1051 | | class SwActContext { |
1052 | | SwEditShell & m_rShell; |
1053 | | public: |
1054 | | SwActContext(SwEditShell *pShell); |
1055 | | ~SwActContext() COVERITY_NOEXCEPT_FALSE; |
1056 | | }; |
1057 | | |
1058 | | /// Class for automated call of Start- and EndCursorMove(). |
1059 | | class SwMvContext { |
1060 | | SwEditShell & m_rShell; |
1061 | | public: |
1062 | | SwMvContext(SwEditShell *pShell); |
1063 | | ~SwMvContext() COVERITY_NOEXCEPT_FALSE; |
1064 | | }; |
1065 | | |
1066 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |