LibreOffice Module sw (master)  1
editsh.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 #ifndef INCLUDED_SW_INC_EDITSH_HXX
20 #define INCLUDED_SW_INC_EDITSH_HXX
21 
22 #include "crsrsh.hxx"
23 
24 #include "charfmt.hxx"
25 #include "fldupde.hxx"
26 #include "frmfmt.hxx"
27 #include "swdllapi.h"
28 #include "swundo.hxx"
29 #include "tblenum.hxx"
30 #include "tox.hxx"
31 
32 #include <memory>
33 #include <vector>
34 #include <o3tl/sorted_vector.hxx>
35 
36 namespace tools { class PolyPolygon; }
37 class SwDoc;
39 
40 class SvNumberFormatter;
41 class SfxPoolItem;
42 class SfxItemSet;
43 class SfxWatermarkItem;
44 class SvxAutoCorrect;
45 
46 class SwDDEFieldType;
47 class SwDBManager;
48 
49 struct SwDocStat;
50 class SwAutoCompleteWord;
51 
52 class SwFormatRefMark;
53 
54 class SwNumRule;
55 
56 class SwTextFormatColl;
57 class SwGrfNode;
58 
59 class Graphic;
60 class GraphicObject;
61 class GraphicAttr;
62 class SwFormatINetFormat;
63 class SwTable;
64 class SwTextBlocks;
65 class SwFormatFootnote;
66 class SwSection;
67 class SwSectionData;
68 class SwSectionFormat;
69 class SwTableAutoFormat;
70 class SwPageDesc;
71 class SwTextINetFormat;
72 class SwSeqFieldList;
73 class SwGlblDocContent;
74 class SwGlblDocContents;
75 class SwRangeRedline;
76 class SwRedlineData;
77 class SwFootnoteInfo;
78 class SwEndNoteInfo;
79 class SwLineNumberInfo;
80 class SwAuthEntry;
81 class SwRewriter;
82 class SwView;
83 struct SwConversionArgs;
86 struct SwDBData;
87 enum class SvtScriptType;
89 enum class RedlineFlags;
90 enum class TransliterationFlags;
91 enum class GraphicType;
92 
93 namespace com::sun::star::uno { template < class > class Sequence; }
94 namespace com::sun::star::linguistic2 { class XSpellAlternatives; }
95 namespace com::sun::star::linguistic2 { struct ProofreadingResult; }
96 
97 namespace svx{
98  struct SpellPortion;
99  typedef std::vector<SpellPortion> SpellPortions;
100  class ClassificationResult;
101 }
102 
103 namespace sfx2{
104  class LinkManager;
105 }
106 
107 namespace sw {
108  class UndoRedoContext;
109 }
110 
111 enum class ParaBreakType {
112  ToBlank = 0,
113  ToOnlyCR = 2
114 };
115 
118 {
119  OUString sText;
121 
122  SwGetINetAttr( const OUString& rText, const SwTextINetFormat& rAttr )
123  : sText( rText ), rINetAttr( rAttr )
124  {}
125 };
126 typedef std::vector<SwGetINetAttr> SwGetINetAttrs;
127 
128 // Types of forms of content.
129 #define CNT_TXT 0x0001
130 #define CNT_GRF 0x0002
131 #define CNT_OLE 0x0010
132 
133 // Test USHORT for a defined form of content.
134 #define CNT_HasText(USH) ((USH)&CNT_TXT)
135 #define CNT_HasGrf(USH) ((USH)&CNT_GRF)
136 #define CNT_HasOLE(USH) ((USH)&CNT_OLE)
137 
139 {
141 
143  friend class SwAutoFormat;
144  friend void InitCore();
145  friend void FinitCore();
147  friend class SwUndo;
148 
151  SAL_DLLPRIVATE SwGrfNode *GetGrfNode_() const ;
152 
153  SAL_DLLPRIVATE void DeleteSel( SwPaM& rPam, bool* pUndo = nullptr );
154 
155  SAL_DLLPRIVATE void SetSectionAttr_( SwSectionFormat& rSectFormat, const SfxItemSet& rSet );
156 
159 
160 public:
162  void Insert( sal_Unicode, bool bOnlyCurrCursor = false );
163  void Insert2( const OUString &, const bool bForceExpandHints = false );
164  void Overwrite( const OUString & );
165 
171  bool Replace( const OUString& rNewStr, bool bRegExpRplc );
172 
175  bool Delete();
176 
178  bool DelFullPara();
179 
181  void TransliterateText( TransliterationFlags nType );
182 
184  void CountWords( SwDocStat& rStat ) const;
185 
187  bool ConvertFieldsToText();
188 
190  void SetNumberingRestart();
191 
193  sal_uInt16 GetLinkUpdMode() const;
194  void SetLinkUpdMode( sal_uInt16 nMode );
195 
197  bool Copy( SwEditShell& rDestShell );
198 
203  bool CopySelToDoc( SwDoc& rInsDoc );
204 
205  void SplitNode( bool bAutoFormat = false, bool bCheckTableStart = true );
206  bool AppendTextNode();
207  void AutoFormatBySplitNode();
208 
211  void DelINetAttrWithText();
212 
215  bool DontExpandFormat();
216 
226  bool GetPaMAttr( SwPaM* pPaM, SfxItemSet& ,
227  const bool bMergeIndentValuesOfNumRule = false ) const;
228  bool GetCurAttr( SfxItemSet& ,
229  const bool bMergeIndentValuesOfNumRule = false ) const;
230  void SetAttrItem( const SfxPoolItem&, SetAttrMode nFlags = SetAttrMode::DEFAULT,
231  const bool bParagraphSetting = false );
232  void SetAttrSet( const SfxItemSet&, SetAttrMode nFlags = SetAttrMode::DEFAULT,
233  SwPaM* pCursor = nullptr, const bool bParagraphSetting = false );
234 
239  std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM>>> GetItemWithPaM( sal_uInt16 nWhich );
240 
250  void GetCurParAttr( SfxItemSet& rSet ) const;
264  bool GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const;
265 
267  void SetDefault( const SfxPoolItem& );
268 
270  const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
271  template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
272  {
273  return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
274  }
275 
276  void ResetAttr( const o3tl::sorted_vector<sal_uInt16> &attrs = o3tl::sorted_vector<sal_uInt16>(), SwPaM* pCursor = nullptr );
277  void GCAttr();
278 
280  SvtScriptType GetScriptType() const;
281 
283  LanguageType GetCurLang() const;
284 
286  size_t GetTableFrameFormatCount( bool bUsed = false ) const;
287  SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed = false ) const;
288  OUString GetUniqueTableName() const;
289 
291  sal_uInt16 GetCharFormatCount() const;
292  SwCharFormat& GetCharFormat(sal_uInt16 nFormat) const;
293  SwCharFormat* GetCurCharFormat() const;
294  void FillByEx(SwCharFormat*);
295  SwCharFormat* MakeCharFormat( const OUString& rName );
296  SwCharFormat* FindCharFormatByName( std::u16string_view rName ) const;
297 
298  /* FormatCollections (new) - Explaining the general naming pattern:
299  * GetXXXCount() returns the count of xxx in the document.
300  * GetXXX(i) returns i-th xxx (ERR_RAISE if beyond range!).
301  * DelXXX(i) deletes i-th xxx (ERR_RAISE if beyond range!).
302  * GetCurXXX() returns xxx that is valid at cursor or in ranges.
303  * returns 0, if not unanimous.
304  * SetXXX() sets xxx at cursor or in ranges.
305  * MakeXXX() makes a xxx, derived from pDerivedFrom.
306  */
307 
308  // TXT
309  SwTextFormatColl& GetDfltTextFormatColl() const;
310  sal_uInt16 GetTextFormatCollCount() const;
311  SwTextFormatColl& GetTextFormatColl( sal_uInt16 nTextFormatColl) const;
331  SwTextFormatColl* GetPaMTextFormatColl( SwPaM* pPaM ) const;
332 
333  // #i62675#
335  void SetTextFormatColl(SwTextFormatColl*, const bool bResetListAttrs = false);
336  SwTextFormatColl *MakeTextFormatColl(const OUString &rFormatCollName,
337  SwTextFormatColl *pDerivedFrom = nullptr);
338  void FillByEx(SwTextFormatColl*);
339  SwTextFormatColl* FindTextFormatCollByName( std::u16string_view rName ) const;
340 
342  SwTextFormatColl* GetTextCollFromPool( sal_uInt16 nId );
343 
345  SwFormat* GetFormatFromPool( sal_uInt16 nId );
346 
348  SwPageDesc* GetPageDescFromPool( sal_uInt16 nId );
349 
351  bool IsUsed( const sw::BroadcastingModify& ) const;
352 
355  { return static_cast<SwFrameFormat*>(SwEditShell::GetFormatFromPool( nId )); }
357  { return static_cast<SwCharFormat*>(SwEditShell::GetFormatFromPool( nId )); }
358 
359  void SetClassification(const OUString& rName, SfxClassificationPolicyType eType);
360  void ApplyAdvancedClassification(std::vector<svx::ClassificationResult> const & rResult);
361  std::vector<svx::ClassificationResult> CollectAdvancedClassification();
362 
363  SfxWatermarkItem GetWatermark() const;
364  void SetWatermark(const SfxWatermarkItem& rText);
365 
367  void SignParagraph();
368 
370  void ValidateParagraphSignatures(SwTextNode* pNode, bool updateDontRemove);
371 
373  void ValidateCurrentParagraphSignatures(bool updateDontRemove);
374 
376  void ValidateAllParagraphSignatures(bool updateDontRemove);
377 
382  void RestoreMetadataFieldsAndValidateParagraphSignatures();
383 
386  void ClassifyDocPerHighestParagraphClass();
387 
389  void ApplyParagraphClassification(std::vector<svx::ClassificationResult> aResult);
390  std::vector<svx::ClassificationResult> CollectParagraphClassification();
391 
394  bool IsCursorInParagraphMetadataField() const;
395 
399  bool RemoveParagraphMetadataFieldAtCursor();
400 
401  void Insert2(SwField const &, const bool bForceExpandHints);
402 
403  void UpdateOneField(SwField &);
404 
405  size_t GetFieldTypeCount(SwFieldIds nResId = SwFieldIds::Unknown) const;
406  SwFieldType* GetFieldType(size_t nField, SwFieldIds nResId = SwFieldIds::Unknown) const;
407  SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const;
408 
409  void RemoveFieldType(size_t nField);
410  void RemoveFieldType(SwFieldIds nResId, const OUString& rName);
411 
412  void FieldToText( SwFieldType const * pType );
413 
414  void ChangeAuthorityData(const SwAuthEntry* pNewData);
415 
417  SwDBData const & GetDBData() const;
418  void ChgDBData(const SwDBData& SwDBData);
419  void ChangeDBFields( const std::vector<OUString>& rOldNames,
420  const OUString& rNewName );
421  void GetAllUsedDB( std::vector<OUString>& rDBNameList,
422  std::vector<OUString> const * pAllDBNames );
423 
424  bool IsAnyDatabaseFieldInDoc()const;
425 
427  bool IsFieldDataSourceAvailable(OUString& rUsedDataSource) const;
428  void UpdateExpFields(bool bCloseDB = false);
429  void LockExpFields();
430  void UnlockExpFields();
431  bool IsExpFieldsLocked() const;
432 
433  SwFieldUpdateFlags GetFieldUpdateFlags() const;
434  void SetFieldUpdateFlags( SwFieldUpdateFlags eFlags );
435 
437  SwDBManager* GetDBManager() const;
438 
439  SwFieldType* InsertFieldType(const SwFieldType &);
440 
442  bool IsModified() const;
443  void SetModified();
444  void ResetModified();
445  void SetUndoNoResetModified();
446 
448  void UpdateDocStat();
449  const SwDocStat &GetUpdatedDocStat();
450 
451  void Insert(const SwTOXMark& rMark);
452 
453  void DeleteTOXMark(SwTOXMark const * pMark);
454 
456  void GetCurTOXMarks(SwTOXMarks& rMarks) const ;
457 
459  void InsertTableOf(const SwTOXBase& rTOX,
460  const SfxItemSet* pSet = nullptr);
461  void UpdateTableOf(const SwTOXBase& rTOX,
462  const SfxItemSet* pSet = nullptr);
463  const SwTOXBase* GetCurTOX() const;
464  const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false );
465  void SetDefaultTOXBase(const SwTOXBase& rBase);
466 
467  static bool IsTOXBaseReadonly(const SwTOXBase& rTOXBase);
468  void SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly);
469 
470  sal_uInt16 GetTOXCount() const;
471  const SwTOXBase* GetTOX( sal_uInt16 nPos ) const;
472  bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes );
473 
475  void SetUpdateTOX( bool bFlag );
476  bool IsUpdateTOX() const;
477 
479  sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const;
480  const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
481  void InsertTOXType(const SwTOXType& rTyp);
482 
484  OUString const & GetTOIAutoMarkURL() const;
485  void SetTOIAutoMarkURL(const OUString& rSet);
486  void ApplyAutoMark();
487 
489  void GetTOIKeys( SwTOIKeyType eTyp, std::vector<OUString>& rArr ) const;
490 
491  void SetOutlineNumRule(const SwNumRule&);
492  const SwNumRule* GetOutlineNumRule() const;
493 
494  bool OutlineUpDown( short nOffset = 1 );
495 
496  bool MoveOutlinePara( SwOutlineNodes::difference_type nOffset );
497 
498  bool IsProtectedOutlinePara() const;
499 
500  const SwNumRule* GetNumRuleAtCurrCursorPos() const;
501 
504  const SwNumRule* GetNumRuleAtCurrentSelection() const;
505 
514  void SetCurNumRule( const SwNumRule&,
515  const bool bCreateNewList /*= false*/,
516  const OUString& sContinuedListId = OUString(),
517  const bool bResetIndentAttrs = false );
518 
520  void NoNum();
521 
523  void DelNumRules();
524 
525  void NumUpDown( bool bDown = true );
526 
527  bool MoveParagraph( tools::Long nOffset = 1);
528  bool MoveNumParas( bool bUpperLower, bool bUpperLeft );
529 
531  bool NumOrNoNum(bool bDelete = false, bool bChkStart = true);
532 
533  // #i23726#
534  // #i90078#
536  // Adjust method name and parameter name
537  void ChangeIndentOfAllListLevels( sal_Int32 nDiff );
538  // Adjust method name
539  void SetIndent(short nIndent, const SwPosition & rPos);
540  bool IsFirstOfNumRuleAtCursorPos() const;
541 
542  bool IsNoNum( bool bChkStart = true ) const;
543 
547  sal_uInt8 GetNumLevel() const;
548 
550  void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower );
551 
553  int GetCurrentParaOutlineLevel( ) const;
554 
555  // i29560
556  bool HasNumber() const;
557  bool HasBullet() const;
558 
559  bool SelectionHasNumber() const;
560  bool SelectionHasBullet() const;
561 
562  OUString GetUniqueNumRuleName() const;
563  void ChgNumRuleFormats( const SwNumRule& rRule );
564 
566  void SetNumRuleStart( bool bFlag, SwPaM* pCursor );
567  bool IsNumRuleStart( SwPaM* pPaM = nullptr ) const;
568  void SetNodeNumStart( sal_uInt16 nStt );
569 
570  sal_uInt16 GetNodeNumStart( SwPaM* pPaM ) const;
571 
572  void ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule );
573 
577  const SwNumRule * SearchNumRule(const bool bNum,
578  OUString& sListId );
579 
583  void DoUndo( bool bOn = true );
584  bool DoesUndo() const;
585  void DoGroupUndo( bool bUn );
586  bool DoesGroupUndo() const;
587  void DelAllUndoObj();
588 
590  SwUndoId StartUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr );
591 
593  SwUndoId EndUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr );
594 
595  bool GetLastUndoInfo(OUString *const o_pStr,
596  SwUndoId *const o_pId,
597  const SwView* pView = nullptr) const;
598  bool GetFirstRedoInfo(OUString *const o_pStr,
599  SwUndoId *const o_pId,
600  const SwView* pView = nullptr) const;
601  SwUndoId GetRepeatInfo(OUString *const o_pStr) const;
602 
604  bool CursorsLocked() const;
607  void HandleUndoRedoContext(::sw::UndoRedoContext & rContext);
608 
609  void Undo(sal_uInt16 const nCount = 1);
610  void Redo(sal_uInt16 const nCount = 1);
611  void Repeat(sal_uInt16 const nCount);
612 
614  void StartAllAction();
615  void EndAllAction();
616 
618  virtual void CalcLayout() override;
619 
621  sal_uInt16 GetCntType() const;
622 
624  bool HasOtherCnt() const;
625 
627  virtual void ApplyViewOptions( const SwViewOption &rOpt ) override;
628 
630  void GetSelectedText( OUString &rBuf,
631  ParaBreakType nHndlParaBreak = ParaBreakType::ToBlank );
632 
636  const Graphic* GetGraphic( bool bWait = true ) const;
637  const GraphicObject* GetGraphicObj() const;
638  const GraphicAttr* GetGraphicAttr( GraphicAttr& rGA ) const;
639 
640  bool IsLinkedGrfSwapOut() const;
641  GraphicType GetGraphicType() const;
642 
643  const tools::PolyPolygon *GetGraphicPolygon() const;
644  void SetGraphicPolygon( const tools::PolyPolygon *pPoly );
645 
648  void ClearAutomaticContour();
649 
651  bool GetGrfSize(Size&) const;
652 
656  void GetGrfNms( OUString* pGrfName, OUString* pFltName,
657  const SwFlyFrameFormat* = nullptr ) const;
658 
660  void ReRead( const OUString& rGrfName, const OUString& rFltName,
661  const Graphic* pGraphic = nullptr );
662 
664  void *GetIMapInventor() const;
665 
666  // #i73788#
668  Graphic GetIMapGraphic() const;
669  const SwFlyFrameFormat* FindFlyByName( const OUString& rName ) const;
670 
674  svt::EmbeddedObjectRef& GetOLEObject() const;
675 
677  bool HasOLEObj( std::u16string_view rName ) const;
678 
680  void SetChartName( const OUString &rName );
681 
683  void UpdateCharts( std::u16string_view rName );
684 
685  OUString GetCurWord() const;
686 
689  void InsertGlossary( SwTextBlocks& rGlossary, const OUString& );
690 
693  sal_uInt16 MakeGlossary( SwTextBlocks& rToFill, const OUString& rName,
694  const OUString& rShortName, bool bSaveRelFile,
695  const OUString* pOnlyText );
696 
698  sal_uInt16 SaveGlossaryDoc( SwTextBlocks& rGlossary, const OUString& rName,
699  const OUString& rShortName,
700  bool bSaveRelFile,
701  bool bOnlyText );
702 
703  // Linguistics...
705  void HyphStart( SwDocPositions eStart, SwDocPositions eEnd );
706 
708  void HyphEnd();
709  css::uno::Reference< css::uno::XInterface>
710  HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
711 
712  void HyphIgnore();
713 
715  static void InsertSoftHyph( const sal_Int32 nHyphPos );
716 
717  const SwTable& InsertTable( const SwInsertTableOptions& rInsTableOpts,
718  sal_uInt16 nRows, sal_uInt16 nCols,
719  const SwTableAutoFormat* pTAFormat = nullptr );
720 
721  void InsertDDETable( const SwInsertTableOptions& rInsTableOpts,
722  SwDDEFieldType* pDDEType,
723  sal_uInt16 nRows, sal_uInt16 nCols );
724 
725  void UpdateTable();
726  void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
727 
728  SwFrameFormat *GetTableFormat();
729  bool TextToTable( const SwInsertTableOptions& rInsTableOpts,
730  sal_Unicode cCh,
731  const SwTableAutoFormat* pTAFormat = nullptr );
732  bool TableToText( sal_Unicode cCh );
733  bool IsTextToTableAvailable() const;
734 
735  bool GetTableBoxFormulaAttrs( SfxItemSet& rSet ) const;
736  void SetTableBoxFormulaAttrs( const SfxItemSet& rSet );
737 
738  bool IsTableBoxTextFormat() const;
739  OUString GetTableBoxText() const;
740 
741  TableChgMode GetTableChgMode() const;
742  void SetTableChgMode( TableChgMode eMode );
743 
745  void SplitTable( SplitTable_HeadlineOption eMode );
746 
751  bool CanMergeTable( bool bWithPrev = true, bool* pChkNxtPrv = nullptr ) const;
752  bool MergeTable( bool bWithPrev );
753 
755  void AppendUndoForInsertFromDB( bool bIsTable );
756 
758 
760  void SpellStart( SwDocPositions eStart, SwDocPositions eEnd,
761  SwDocPositions eCurr, SwConversionArgs *pConvArgs = nullptr );
762 
764  void SpellEnd( SwConversionArgs const *pConvArgs = nullptr, bool bRestoreSelection = true );
765  css::uno::Any SpellContinue(
766  sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
767  SwConversionArgs const *pConvArgs );
768 
771  bool SpellSentence(svx::SpellPortions& rToFill, bool bIsGrammarCheck );
772 
774  static void PutSpellingToSentenceStart();
775 
777  static void MoveContinuationPosToEndOfCheckedSentence();
778 
780  void ApplyChangedSentence(const svx::SpellPortions& rNewPortions, bool bRecheck);
781 
783  static bool HasLastSentenceGotGrammarChecked();
784 
786  static bool HasConvIter();
787 
789  static bool HasHyphIter();
790 
791  void HandleCorrectionError(const OUString& aText, SwPosition aPos, sal_Int32 nBegin,
792  sal_Int32 nLen, const Point* pPt,
793  SwRect& rSelectRect);
794  css::uno::Reference< css::linguistic2::XSpellAlternatives >
795  GetCorrection( const Point* pPt, SwRect& rSelectRect );
796 
797  bool GetGrammarCorrection( css::linguistic2::ProofreadingResult /*out*/ &rResult,
798  sal_Int32 /*out*/ &rErrorPosInText,
799  sal_Int32 /*out*/ &rErrorIndexInResult,
800  css::uno::Sequence< OUString > /*out*/ &rSuggestions,
801  const Point* pPt, SwRect& rSelectRect );
802 
803  static void IgnoreGrammarErrorAt( SwPaM& rErrorPosition );
804  void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd );
805 
807  const SwFormatRefMark* GetRefMark( std::u16string_view rName ) const;
808 
811  sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const;
812 
814  void AutoCorrect( SvxAutoCorrect& rACorr, bool bInsertMode,
815  sal_Unicode cChar );
816  OUString GetPrevAutoCorrWord(SvxAutoCorrect& rACorr);
817 
818  // We consider no more than 9 characters before the cursor, and they must not start in the
819  // middle of a word (leading spaces are OK)
820  std::vector<OUString> GetChunkForAutoText();
821 
823  void AutoFormat( const SvxSwAutoFormatFlags* pAFlags );
824 
825  static SvxSwAutoFormatFlags* GetAutoFormatFlags();
826  static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *);
827 
829  OUString Calculate();
830 
831  bool InsertURL( const SwFormatINetFormat& rFormat, const OUString& rStr,
832  bool bKeepSelection = false );
833  void GetINetAttrs( SwGetINetAttrs& rArr );
834 
835  OUString GetDropText( const sal_Int32 nChars ) const;
836  void ReplaceDropText( const OUString &rStr, SwPaM* pPaM = nullptr );
837 
840  bool IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const;
841  bool IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const;
842 
843  sal_uInt16 GetLineCount();
844 
846  bool GetCurFootnote( SwFormatFootnote* pToFillFootnote = nullptr );
847  bool SetCurFootnote( const SwFormatFootnote& rFillFootnote );
848  bool HasFootnotes( bool bEndNotes = false ) const;
849 
850  size_t GetSeqFootnoteList( SwSeqFieldList& rList, bool bEndNotes = false );
852 
853  SwSection const* InsertSection(
854  SwSectionData & rNewData, SfxItemSet const*const = nullptr );
855  bool IsInsRegionAvailable() const;
856  const SwSection* GetCurrSection() const;
857 
863  SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = nullptr );
864 
865  size_t GetSectionFormatCount() const;
866  size_t GetSectionFormatPos(const SwSectionFormat&) const;
867  const SwSectionFormat& GetSectionFormat(size_t nFormat) const;
868  void DelSectionFormat( size_t nFormat);
869  void UpdateSection( size_t const nSect, SwSectionData &,
870  SfxItemSet const*const = nullptr);
871  bool IsAnySectionInDoc() const;
872 
873  OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const;
874 
876  void SetSectionAttr(const SfxItemSet& rSet, SwSectionFormat* pSectFormat = nullptr);
877 
881  sal_uInt16 GetFullSelectedSectionCount() const;
882 
888  void DoSpecialInsert();
889  bool CanSpecialInsert() const;
890 
892  void SetNewDoc();
893 
894  sfx2::LinkManager& GetLinkManager();
895  inline const sfx2::LinkManager& GetLinkManager() const;
896 
900  bool IsMoveLeftMargin( bool bRight, bool bModulus = true ) const;
901  void MoveLeftMargin( bool bRight, bool bModulus = true );
902 
904  SvNumberFormatter* GetNumberFormatter();
906  { return const_cast<SwEditShell*>(this)->GetNumberFormatter(); }
907 
909  bool IsGlobalDoc() const;
910  void SetGlblDocSaveLinks( bool bFlag );
911  bool IsGlblDocSaveLinks() const;
912  void GetGlobalDocContent( SwGlblDocContents& rArr ) const;
913  void InsertGlobalDocContent( const SwGlblDocContent& rPos,
914  SwSectionData & rNew );
915  bool InsertGlobalDocContent( const SwGlblDocContent& rPos,
916  const SwTOXBase& rTOX );
917  bool InsertGlobalDocContent( const SwGlblDocContent& rPos );
918  void DeleteGlobalDocContent( const SwGlblDocContents& rArr,
919  size_t nPos );
920  bool MoveGlobalDocContent( const SwGlblDocContents& rArr ,
921  size_t nFromPos, size_t nToPos,
922  size_t nNewPos );
923  void GotoGlobalDocContent( const SwGlblDocContent& rPos );
924 
927  void SetRedlineFlags( RedlineFlags eMode );
928  bool IsRedlineOn() const;
929  SwRedlineTable::size_type GetRedlineCount() const;
930  const SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ) const;
931  bool AcceptRedline( SwRedlineTable::size_type nPos );
932  bool RejectRedline( SwRedlineTable::size_type nPos );
933  bool AcceptRedlinesInSelection();
934  bool RejectRedlinesInSelection();
935 
938  SwRedlineTable::size_type FindRedlineOfData( const SwRedlineData& ) const;
939 
941  bool SetRedlineComment( const OUString& rS );
942  const SwRangeRedline* GetCurrRedline() const;
943 
945  void UpdateRedlineAttr();
946 
948  tools::Long CompareDoc( const SwDoc& rDoc );
949 
951  tools::Long MergeDoc( const SwDoc& rDoc );
952 
954  const SwFootnoteInfo& GetFootnoteInfo() const;
955  void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
956  const SwEndNoteInfo& GetEndNoteInfo() const;
957  void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
958 
959  const SwLineNumberInfo &GetLineNumberInfo() const;
960  void SetLineNumberInfo( const SwLineNumberInfo& rInfo);
961 
963  void SetLabelDoc( bool bFlag );
964  bool IsLabelDoc() const;
965 
967  void CreateExtTextInput(LanguageType eInputLanguage);
968  OUString DeleteExtTextInput( bool bInsText = true);
969  void SetExtTextInputData( const CommandExtTextInputData& );
970 
972  bool IsParagraphSignatureValidationEnabled() const { return m_bDoParagraphSignatureValidation; }
974  bool SetParagraphSignatureValidation(const bool bEnable)
975  {
976  const bool bOldFlag = m_bDoParagraphSignatureValidation;
977  m_bDoParagraphSignatureValidation = bEnable;
978  return bOldFlag;
979  }
980 
982  static SwAutoCompleteWord& GetAutoCompleteWords();
983 
986  sal_uInt16 GetScalingOfSelectedText() const;
987 
988  bool IsNbspRunNext() const { return m_bNbspRunNext; }
989 
991  SwEditShell( SwDoc&, vcl::Window*, const SwViewOption *pOpt );
992 
995  virtual ~SwEditShell() override;
996 
997 private:
998  SwEditShell(const SwEditShell &) = delete;
999  const SwEditShell &operator=(const SwEditShell &) = delete;
1000 
1001  /* TODO: this flag may have to be invalidated / reset to false at various
1002  * places if it was true and the edit cursor position changes. It's somehow
1003  * overkill though because it can only be true if a NO-BREAK SPACE was
1004  * inserted by the last DoAutoCorrect() call (in French language), any
1005  * subsequent call will reset it anyway and just if the cursor is
1006  * positioned behind "x :" and the next character inserted is not a space
1007  * the existing nb-space will be removed. Bear this in mind if that problem
1008  * arises. */
1011 };
1012 
1014 { return const_cast<SwEditShell*>(this)->GetLinkManager(); }
1015 
1019 public:
1020  SwActContext(SwEditShell *pShell);
1021  ~SwActContext() COVERITY_NOEXCEPT_FALSE;
1022 };
1023 
1027 public:
1028  SwMvContext(SwEditShell *pShell);
1029  ~SwMvContext() COVERITY_NOEXCEPT_FALSE;
1030 };
1031 
1032 #endif
1033 
1034 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BroadcasterMixin & operator=(const BroadcasterMixin &)
Definition: calbck.hxx:95
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
TOXTypes
Definition: toxe.hxx:39
OUString sText
Definition: editsh.hxx:119
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2109
Marks a position in the document model.
Definition: pam.hxx:35
SwFieldUpdateFlags
Definition: fldupde.hxx:22
bool IsNbspRunNext() const
Definition: editsh.hxx:988
SwUndoId
Definition: swundo.hxx:29
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:593
virtual void CalcLayout()
Definition: viewsh.cxx:977
SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:356
std::vector< SwNode * >::difference_type difference_type
virtual void Repeat(SfxRepeatTarget &) override
Definition: undobj.cxx:247
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:46
long Long
Base class of all fields.
Definition: fldbas.hxx:289
GraphicType
Definition: doc.hxx:187
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:120
const T & GetDefault(TypedWhichId< T > nWhich) const
Definition: editsh.hxx:271
SwGetINetAttr(const OUString &rText, const SwTextINetFormat &rAttr)
Definition: editsh.hxx:122
Dialog to specify the properties of date form field.
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool SetParagraphSignatureValidation(const bool bEnable)
Enable/Disable paragraph signature validation and return the previous value.
Definition: editsh.hxx:974
SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:354
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:160
SwDocPositions
Definition: cshtyp.hxx:103
sal_uInt16 sal_Unicode
bool m_bDoParagraphSignatureValidation
Prevent nested calls of ValidateParagraphSignatures.
Definition: editsh.hxx:1010
std::vector< SwGetINetAttr > SwGetINetAttrs
Definition: editsh.hxx:126
SwTOIKeyType
Definition: toxe.hxx:30
SwEditShell & m_rShell
Definition: editsh.hxx:1018
static SwTOXBase & GetTOX(SwDoc &rDoc, sal_uLong const nNodeIndex)
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:119
TransliterationFlags
Base class for various Writer styles.
Definition: format.hxx:46
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
Class for automated call of Start- and EndAction().
Definition: editsh.hxx:1017
static void EndUndo(SwWrtShell &rSh)
Definition: basesh.cxx:2717
SvtScriptType
Style of a layout element.
Definition: frmfmt.hxx:58
bool IsParagraphSignatureValidationEnabled() const
Returns true iff paragraph signature validation is enabled.
Definition: editsh.hxx:972
void UpdateFields(bool bCloseDB=false)
Forces update of each field.
Definition: viewsh.cxx:643
SfxClassificationPolicyType
const SwTextINetFormat & rINetAttr
Definition: editsh.hxx:120
void FinitCore()
Definition: init.cxx:675
SetAttrMode
Definition: swtypes.hxx:137
vector_type::size_type size_type
Definition: docary.hxx:228
SplitTable_HeadlineOption
Definition: tblenum.hxx:53
SwFieldIds
Definition: fldbas.hxx:44
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
SwEditShell & m_rShell
Definition: editsh.hxx:1026
const SvNumberFormatter * GetNumberFormatter() const
Definition: editsh.hxx:905
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:111
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
static SvxSwAutoFormatFlags * s_pAutoFormatFlags
Definition: editsh.hxx:140
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1025
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void InitCore()
Definition: init.cxx:456
For querying the INet-attributes for Navigator.
Definition: editsh.hxx:117
~SwActContext() COVERITY_NOEXCEPT_FALSE
Definition: edws.cxx:167
unsigned char sal_uInt8
SwFormat * GetFormatFromPool(sal_uInt16 nId)
return the requested automatic format - base-class !
Definition: edfmt.cxx:129
virtual void Redo() override
Definition: undobj.cxx:224
ParaBreakType
Definition: editsh.hxx:111
SwFormatColl * GetCurTextFormatColl(SwPaM &rPam, const bool bConditional)
Definition: unoobj.cxx:616
bool m_bNbspRunNext
NO-BREAK SPACE state flag passed to and maintained by SvxAutoCorrect::DoAutoCorrect() ...
Definition: editsh.hxx:1009
virtual void Undo() override
Definition: undobj.cxx:219
TableChgMode
Definition: tblenum.hxx:46
std::vector< SpellPortion > SpellPortions
std::vector< SwNode * >::size_type size_type
SwActContext(SwEditShell *pShell)
Definition: edws.cxx:161
Definition: view.hxx:144