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;
261  void GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const;
262 
264  void SetDefault( const SfxPoolItem& );
265 
267  const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
268  template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
269  {
270  return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
271  }
272 
273  void ResetAttr( const o3tl::sorted_vector<sal_uInt16> &attrs = o3tl::sorted_vector<sal_uInt16>(), SwPaM* pCursor = nullptr );
274  void GCAttr();
275 
277  SvtScriptType GetScriptType() const;
278 
280  LanguageType GetCurLang() const;
281 
283  size_t GetTableFrameFormatCount( bool bUsed = false ) const;
284  SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed = false ) const;
285  OUString GetUniqueTableName() const;
286 
288  sal_uInt16 GetCharFormatCount() const;
289  SwCharFormat& GetCharFormat(sal_uInt16 nFormat) const;
290  SwCharFormat* GetCurCharFormat() const;
291  void FillByEx(SwCharFormat*);
292  SwCharFormat* MakeCharFormat( const OUString& rName );
293  SwCharFormat* FindCharFormatByName( const OUString& rName ) const;
294 
295  /* FormatCollections (new) - Explaining the general naming pattern:
296  * GetXXXCount() returns the count of xxx in the document.
297  * GetXXX(i) returns i-th xxx (ERR_RAISE if beyond range!).
298  * DelXXX(i) deletes i-th xxx (ERR_RAISE if beyond range!).
299  * GetCurXXX() returns xxx that is valid at cursor or in ranges.
300  * returns 0, if not unanimous.
301  * SetXXX() sets xxx at cursor or in ranges.
302  * MakeXXX() makes a xxx, derived from pDerivedFrom.
303  */
304 
305  // TXT
306  SwTextFormatColl& GetDfltTextFormatColl() const;
307  sal_uInt16 GetTextFormatCollCount() const;
308  SwTextFormatColl& GetTextFormatColl( sal_uInt16 nTextFormatColl) const;
328  SwTextFormatColl* GetPaMTextFormatColl( SwPaM* pPaM ) const;
329 
330  // #i62675#
332  void SetTextFormatColl(SwTextFormatColl*, const bool bResetListAttrs = false);
333  SwTextFormatColl *MakeTextFormatColl(const OUString &rFormatCollName,
334  SwTextFormatColl *pDerivedFrom = nullptr);
335  void FillByEx(SwTextFormatColl*);
336  SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const;
337 
339  SwTextFormatColl* GetTextCollFromPool( sal_uInt16 nId );
340 
342  SwFormat* GetFormatFromPool( sal_uInt16 nId );
343 
345  SwPageDesc* GetPageDescFromPool( sal_uInt16 nId );
346 
348  bool IsUsed( const sw::BroadcastingModify& ) const;
349 
352  { return static_cast<SwFrameFormat*>(SwEditShell::GetFormatFromPool( nId )); }
354  { return static_cast<SwCharFormat*>(SwEditShell::GetFormatFromPool( nId )); }
355 
356  void SetClassification(const OUString& rName, SfxClassificationPolicyType eType);
357  void ApplyAdvancedClassification(std::vector<svx::ClassificationResult> const & rResult);
358  std::vector<svx::ClassificationResult> CollectAdvancedClassification();
359 
360  SfxWatermarkItem GetWatermark() const;
361  void SetWatermark(const SfxWatermarkItem& rText);
362 
364  void SignParagraph();
365 
367  void ValidateParagraphSignatures(SwTextNode* pNode, bool updateDontRemove);
368 
370  void ValidateCurrentParagraphSignatures(bool updateDontRemove);
371 
373  void ValidateAllParagraphSignatures(bool updateDontRemove);
374 
379  void RestoreMetadataFieldsAndValidateParagraphSignatures();
380 
383  void ClassifyDocPerHighestParagraphClass();
384 
386  void ApplyParagraphClassification(std::vector<svx::ClassificationResult> aResult);
387  std::vector<svx::ClassificationResult> CollectParagraphClassification();
388 
391  bool IsCursorInParagraphMetadataField() const;
392 
396  bool RemoveParagraphMetadataFieldAtCursor();
397 
398  void Insert2(SwField const &, const bool bForceExpandHints);
399 
400  void UpdateOneField(SwField &);
401 
402  size_t GetFieldTypeCount(SwFieldIds nResId = SwFieldIds::Unknown) const;
403  SwFieldType* GetFieldType(size_t nField, SwFieldIds nResId = SwFieldIds::Unknown) const;
404  SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const;
405 
406  void RemoveFieldType(size_t nField);
407  void RemoveFieldType(SwFieldIds nResId, const OUString& rName);
408 
409  void FieldToText( SwFieldType const * pType );
410 
411  void ChangeAuthorityData(const SwAuthEntry* pNewData);
412 
414  SwDBData const & GetDBData() const;
415  void ChgDBData(const SwDBData& SwDBData);
416  void ChangeDBFields( const std::vector<OUString>& rOldNames,
417  const OUString& rNewName );
418  void GetAllUsedDB( std::vector<OUString>& rDBNameList,
419  std::vector<OUString> const * pAllDBNames );
420 
421  bool IsAnyDatabaseFieldInDoc()const;
422 
424  bool IsFieldDataSourceAvailable(OUString& rUsedDataSource) const;
425  void UpdateExpFields(bool bCloseDB = false);
426  void LockExpFields();
427  void UnlockExpFields();
428  bool IsExpFieldsLocked() const;
429 
430  SwFieldUpdateFlags GetFieldUpdateFlags() const;
431  void SetFieldUpdateFlags( SwFieldUpdateFlags eFlags );
432 
434  SwDBManager* GetDBManager() const;
435 
436  SwFieldType* InsertFieldType(const SwFieldType &);
437 
439  bool IsModified() const;
440  void SetModified();
441  void ResetModified();
442  void SetUndoNoResetModified();
443 
445  void UpdateDocStat();
446  const SwDocStat &GetUpdatedDocStat();
447 
448  void Insert(const SwTOXMark& rMark);
449 
450  void DeleteTOXMark(SwTOXMark const * pMark);
451 
453  void GetCurTOXMarks(SwTOXMarks& rMarks) const ;
454 
456  void InsertTableOf(const SwTOXBase& rTOX,
457  const SfxItemSet* pSet = nullptr);
458  void UpdateTableOf(const SwTOXBase& rTOX,
459  const SfxItemSet* pSet = nullptr);
460  const SwTOXBase* GetCurTOX() const;
461  const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false );
462  void SetDefaultTOXBase(const SwTOXBase& rBase);
463 
464  static bool IsTOXBaseReadonly(const SwTOXBase& rTOXBase);
465  void SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly);
466 
467  sal_uInt16 GetTOXCount() const;
468  const SwTOXBase* GetTOX( sal_uInt16 nPos ) const;
469  bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes );
470 
472  void SetUpdateTOX( bool bFlag );
473  bool IsUpdateTOX() const;
474 
476  sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const;
477  const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const;
478  void InsertTOXType(const SwTOXType& rTyp);
479 
481  OUString const & GetTOIAutoMarkURL() const;
482  void SetTOIAutoMarkURL(const OUString& rSet);
483  void ApplyAutoMark();
484 
486  void GetTOIKeys( SwTOIKeyType eTyp, std::vector<OUString>& rArr ) const;
487 
488  void SetOutlineNumRule(const SwNumRule&);
489  const SwNumRule* GetOutlineNumRule() const;
490 
491  bool OutlineUpDown( short nOffset = 1 );
492 
493  bool MoveOutlinePara( SwOutlineNodes::difference_type nOffset );
494 
495  bool IsProtectedOutlinePara() const;
496 
497  const SwNumRule* GetNumRuleAtCurrCursorPos() const;
498 
501  const SwNumRule* GetNumRuleAtCurrentSelection() const;
502 
511  void SetCurNumRule( const SwNumRule&,
512  const bool bCreateNewList /*= false*/,
513  const OUString& sContinuedListId = OUString(),
514  const bool bResetIndentAttrs = false );
515 
517  void NoNum();
518 
520  void DelNumRules();
521 
522  void NumUpDown( bool bDown = true );
523 
524  bool MoveParagraph( SwNodeOffset nOffset = SwNodeOffset(1));
525  bool MoveNumParas( bool bUpperLower, bool bUpperLeft );
526 
528  bool NumOrNoNum(bool bDelete = false, bool bChkStart = true);
529 
530  // #i23726#
531  // #i90078#
533  // Adjust method name and parameter name
534  void ChangeIndentOfAllListLevels( sal_Int32 nDiff );
535  // Adjust method name
536  void SetIndent(short nIndent, const SwPosition & rPos);
537  bool IsFirstOfNumRuleAtCursorPos() const;
538 
539  bool IsNoNum( bool bChkStart = true ) const;
540 
543  sal_uInt8 GetNumLevel() const;
544 
546  void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower );
547 
549  int GetCurrentParaOutlineLevel( ) const;
550 
551  // i29560
552  bool HasNumber() const;
553  bool HasBullet() const;
554 
555  bool SelectionHasNumber() const;
556  bool SelectionHasBullet() const;
557 
558  OUString GetUniqueNumRuleName() const;
559  void ChgNumRuleFormats( const SwNumRule& rRule );
560 
562  void SetNumRuleStart( bool bFlag, SwPaM* pCursor );
563  bool IsNumRuleStart( SwPaM* pPaM = nullptr ) const;
564  void SetNodeNumStart( sal_uInt16 nStt );
565 
566  sal_uInt16 GetNodeNumStart( SwPaM* pPaM ) const;
567 
568  void ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule );
569 
573  const SwNumRule * SearchNumRule(const bool bNum,
574  OUString& sListId );
575 
579  void DoUndo( bool bOn = true );
580  bool DoesUndo() const;
581  void DoGroupUndo( bool bUn );
582  bool DoesGroupUndo() const;
583  void DelAllUndoObj();
584 
586  SwUndoId StartUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr );
587 
589  SwUndoId EndUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr );
590 
591  bool GetLastUndoInfo(OUString *const o_pStr,
592  SwUndoId *const o_pId,
593  const SwView* pView = nullptr) const;
594  bool GetFirstRedoInfo(OUString *const o_pStr,
595  SwUndoId *const o_pId,
596  const SwView* pView = nullptr) const;
597  SwUndoId GetRepeatInfo(OUString *const o_pStr) const;
598 
600  bool CursorsLocked() const;
603  void HandleUndoRedoContext(::sw::UndoRedoContext & rContext);
604 
605  void Undo(sal_uInt16 const nCount = 1);
606  void Redo(sal_uInt16 const nCount = 1);
607  void Repeat(sal_uInt16 const nCount);
608 
610  void StartAllAction();
611  void EndAllAction();
612 
614  virtual void CalcLayout() override;
615 
617  sal_uInt16 GetCntType() const;
618 
620  bool HasOtherCnt() const;
621 
623  virtual void ApplyViewOptions( const SwViewOption &rOpt ) override;
624 
626  void GetSelectedText( OUString &rBuf,
627  ParaBreakType nHndlParaBreak = ParaBreakType::ToBlank );
628 
632  const Graphic* GetGraphic( bool bWait = true ) const;
633  const GraphicObject* GetGraphicObj() const;
634  const GraphicAttr* GetGraphicAttr( GraphicAttr& rGA ) const;
635 
636  bool IsLinkedGrfSwapOut() const;
637  GraphicType GetGraphicType() const;
638 
639  const tools::PolyPolygon *GetGraphicPolygon() const;
640  void SetGraphicPolygon( const tools::PolyPolygon *pPoly );
641 
644  void ClearAutomaticContour();
645 
647  bool GetGrfSize(Size&) const;
648 
652  void GetGrfNms( OUString* pGrfName, OUString* pFltName,
653  const SwFlyFrameFormat* = nullptr ) const;
654 
656  void ReRead( const OUString& rGrfName, const OUString& rFltName,
657  const Graphic* pGraphic = nullptr );
658 
660  void *GetIMapInventor() const;
661 
662  // #i73788#
664  Graphic GetIMapGraphic() const;
665  const SwFlyFrameFormat* FindFlyByName( const OUString& rName ) const;
666 
670  svt::EmbeddedObjectRef& GetOLEObject() const;
671 
673  bool HasOLEObj( std::u16string_view rName ) const;
674 
676  void SetChartName( const OUString &rName );
677 
679  void UpdateCharts( const OUString& rName );
680 
681  OUString GetCurWord() const;
682 
685  void InsertGlossary( SwTextBlocks& rGlossary, const OUString& );
686 
689  sal_uInt16 MakeGlossary( SwTextBlocks& rToFill, const OUString& rName,
690  const OUString& rShortName, bool bSaveRelFile,
691  const OUString* pOnlyText );
692 
694  sal_uInt16 SaveGlossaryDoc( SwTextBlocks& rGlossary, const OUString& rName,
695  const OUString& rShortName,
696  bool bSaveRelFile,
697  bool bOnlyText );
698 
699  // Linguistics...
701  void HyphStart( SwDocPositions eStart, SwDocPositions eEnd );
702 
704  void HyphEnd();
705  css::uno::Reference< css::uno::XInterface>
706  HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
707 
708  void HyphIgnore();
709 
711  static void InsertSoftHyph( const sal_Int32 nHyphPos );
712 
713  const SwTable& InsertTable( const SwInsertTableOptions& rInsTableOpts,
714  sal_uInt16 nRows, sal_uInt16 nCols,
715  const SwTableAutoFormat* pTAFormat = nullptr );
716 
717  void InsertDDETable( const SwInsertTableOptions& rInsTableOpts,
718  SwDDEFieldType* pDDEType,
719  sal_uInt16 nRows, sal_uInt16 nCols );
720 
721  void UpdateTable();
722  void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
723 
724  SwFrameFormat *GetTableFormat();
725  bool TextToTable( const SwInsertTableOptions& rInsTableOpts,
726  sal_Unicode cCh,
727  const SwTableAutoFormat* pTAFormat = nullptr );
728  bool TableToText( sal_Unicode cCh );
729  bool IsTextToTableAvailable() const;
730 
731  bool GetTableBoxFormulaAttrs( SfxItemSet& rSet ) const;
732  void SetTableBoxFormulaAttrs( const SfxItemSet& rSet );
733 
734  bool IsTableBoxTextFormat() const;
735  OUString GetTableBoxText() const;
736 
737  TableChgMode GetTableChgMode() const;
738  void SetTableChgMode( TableChgMode eMode );
739 
741  void SplitTable( SplitTable_HeadlineOption eMode );
742 
747  bool CanMergeTable( bool bWithPrev = true, bool* pChkNxtPrv = nullptr ) const;
748  bool MergeTable( bool bWithPrev );
749 
751  void AppendUndoForInsertFromDB( bool bIsTable );
752 
754 
756  void SpellStart( SwDocPositions eStart, SwDocPositions eEnd,
757  SwDocPositions eCurr, SwConversionArgs *pConvArgs = nullptr );
758 
760  void SpellEnd( SwConversionArgs const *pConvArgs = nullptr, bool bRestoreSelection = true );
761  css::uno::Any SpellContinue(
762  sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
763  SwConversionArgs const *pConvArgs );
764 
767  bool SpellSentence(svx::SpellPortions& rToFill, bool bIsGrammarCheck );
768 
770  static void PutSpellingToSentenceStart();
771 
773  static void MoveContinuationPosToEndOfCheckedSentence();
774 
776  void ApplyChangedSentence(const svx::SpellPortions& rNewPortions, bool bRecheck);
777 
779  static bool HasLastSentenceGotGrammarChecked();
780 
782  static bool HasConvIter();
783 
785  static bool HasHyphIter();
786 
787  void HandleCorrectionError(const OUString& aText, SwPosition aPos, sal_Int32 nBegin,
788  sal_Int32 nLen, const Point* pPt,
789  SwRect& rSelectRect);
790  css::uno::Reference< css::linguistic2::XSpellAlternatives >
791  GetCorrection( const Point* pPt, SwRect& rSelectRect );
792 
793  bool GetGrammarCorrection( css::linguistic2::ProofreadingResult /*out*/ &rResult,
794  sal_Int32 /*out*/ &rErrorPosInText,
795  sal_Int32 /*out*/ &rErrorIndexInResult,
796  css::uno::Sequence< OUString > /*out*/ &rSuggestions,
797  const Point* pPt, SwRect& rSelectRect );
798 
799  static void IgnoreGrammarErrorAt( SwPaM& rErrorPosition );
800  void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd );
801 
803  const SwFormatRefMark* GetRefMark( std::u16string_view rName ) const;
804 
807  sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const;
808 
810  void AutoCorrect( SvxAutoCorrect& rACorr, bool bInsertMode,
811  sal_Unicode cChar );
812  OUString GetPrevAutoCorrWord(SvxAutoCorrect& rACorr);
813 
814  // We consider no more than 9 characters before the cursor, and they must not start in the
815  // middle of a word (leading spaces are OK)
816  std::vector<OUString> GetChunkForAutoText();
817 
819  void AutoFormat( const SvxSwAutoFormatFlags* pAFlags );
820 
821  static SvxSwAutoFormatFlags* GetAutoFormatFlags();
822  static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *);
823 
825  OUString Calculate();
826 
827  bool InsertURL( const SwFormatINetFormat& rFormat, const OUString& rStr,
828  bool bKeepSelection = false );
829  void GetINetAttrs( SwGetINetAttrs& rArr );
830 
831  OUString GetDropText( const sal_Int32 nChars ) const;
832  void ReplaceDropText( const OUString &rStr, SwPaM* pPaM = nullptr );
833 
836  bool IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const;
837  bool IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const;
838 
839  sal_uInt16 GetLineCount();
840 
842  bool GetCurFootnote( SwFormatFootnote* pToFillFootnote = nullptr );
843  bool SetCurFootnote( const SwFormatFootnote& rFillFootnote );
844  bool HasFootnotes( bool bEndNotes = false ) const;
845 
846  size_t GetSeqFootnoteList( SwSeqFieldList& rList, bool bEndNotes = false );
848 
849  SwSection const* InsertSection(
850  SwSectionData & rNewData, SfxItemSet const*const = nullptr );
851  bool IsInsRegionAvailable() const;
852  const SwSection* GetCurrSection() const;
853 
859  SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = nullptr );
860 
861  size_t GetSectionFormatCount() const;
862  size_t GetSectionFormatPos(const SwSectionFormat&) const;
863  const SwSectionFormat& GetSectionFormat(size_t nFormat) const;
864  void DelSectionFormat( size_t nFormat);
865  void UpdateSection( size_t const nSect, SwSectionData &,
866  SfxItemSet const*const = nullptr);
867  bool IsAnySectionInDoc() const;
868 
869  OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const;
870 
872  void SetSectionAttr(const SfxItemSet& rSet, SwSectionFormat* pSectFormat = nullptr);
873 
877  sal_uInt16 GetFullSelectedSectionCount() const;
878 
884  void DoSpecialInsert();
885  bool CanSpecialInsert() const;
886 
888  void SetNewDoc();
889 
890  sfx2::LinkManager& GetLinkManager();
891  inline const sfx2::LinkManager& GetLinkManager() const;
892 
896  bool IsMoveLeftMargin( bool bRight, bool bModulus = true ) const;
897  void MoveLeftMargin( bool bRight, bool bModulus = true );
898 
900  SvNumberFormatter* GetNumberFormatter();
902  { return const_cast<SwEditShell*>(this)->GetNumberFormatter(); }
903 
905  bool IsGlobalDoc() const;
906  void SetGlblDocSaveLinks( bool bFlag );
907  bool IsGlblDocSaveLinks() const;
908  void GetGlobalDocContent( SwGlblDocContents& rArr ) const;
909  void InsertGlobalDocContent( const SwGlblDocContent& rPos,
910  SwSectionData & rNew );
911  bool InsertGlobalDocContent( const SwGlblDocContent& rPos,
912  const SwTOXBase& rTOX );
913  bool InsertGlobalDocContent( const SwGlblDocContent& rPos );
914  void DeleteGlobalDocContent( const SwGlblDocContents& rArr,
915  size_t nPos );
916  bool MoveGlobalDocContent( const SwGlblDocContents& rArr ,
917  size_t nFromPos, size_t nToPos,
918  size_t nNewPos );
919  void GotoGlobalDocContent( const SwGlblDocContent& rPos );
920 
923  void SetRedlineFlags( RedlineFlags eMode );
924  bool IsRedlineOn() const;
925  SwRedlineTable::size_type GetRedlineCount() const;
926  const SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ) const;
927  bool AcceptRedline( SwRedlineTable::size_type nPos );
928  bool RejectRedline( SwRedlineTable::size_type nPos );
929  bool AcceptRedlinesInSelection();
930  bool RejectRedlinesInSelection();
931 
934  SwRedlineTable::size_type FindRedlineOfData( const SwRedlineData& ) const;
935 
937  bool SetRedlineComment( const OUString& rS );
938  const SwRangeRedline* GetCurrRedline() const;
939 
941  void UpdateRedlineAttr();
942 
944  tools::Long CompareDoc( const SwDoc& rDoc );
945 
947  tools::Long MergeDoc( const SwDoc& rDoc );
948 
950  const SwFootnoteInfo& GetFootnoteInfo() const;
951  void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
952  const SwEndNoteInfo& GetEndNoteInfo() const;
953  void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
954 
955  const SwLineNumberInfo &GetLineNumberInfo() const;
956  void SetLineNumberInfo( const SwLineNumberInfo& rInfo);
957 
959  void SetLabelDoc( bool bFlag );
960  bool IsLabelDoc() const;
961 
963  void CreateExtTextInput(LanguageType eInputLanguage);
964  OUString DeleteExtTextInput( bool bInsText = true);
965  void SetExtTextInputData( const CommandExtTextInputData& );
966 
968  bool IsParagraphSignatureValidationEnabled() const { return m_bDoParagraphSignatureValidation; }
970  bool SetParagraphSignatureValidation(const bool bEnable)
971  {
972  const bool bOldFlag = m_bDoParagraphSignatureValidation;
973  m_bDoParagraphSignatureValidation = bEnable;
974  return bOldFlag;
975  }
976 
978  static SwAutoCompleteWord& GetAutoCompleteWords();
979 
982  sal_uInt16 GetScalingOfSelectedText() const;
983 
984  bool IsNbspRunNext() const { return m_bNbspRunNext; }
985 
987  SwEditShell( SwDoc&, vcl::Window*, const SwViewOption *pOpt );
988 
991  virtual ~SwEditShell() override;
992 
993 private:
994  SwEditShell(const SwEditShell &) = delete;
995  const SwEditShell &operator=(const SwEditShell &) = delete;
996 
997  /* TODO: this flag may have to be invalidated / reset to false at various
998  * places if it was true and the edit cursor position changes. It's somehow
999  * overkill though because it can only be true if a NO-BREAK SPACE was
1000  * inserted by the last DoAutoCorrect() call (in French language), any
1001  * subsequent call will reset it anyway and just if the cursor is
1002  * positioned behind "x :" and the next character inserted is not a space
1003  * the existing nb-space will be removed. Bear this in mind if that problem
1004  * arises. */
1007 };
1008 
1010 { return const_cast<SwEditShell*>(this)->GetLinkManager(); }
1011 
1015 public:
1016  SwActContext(SwEditShell *pShell);
1017  ~SwActContext() COVERITY_NOEXCEPT_FALSE;
1018 };
1019 
1023 public:
1024  SwMvContext(SwEditShell *pShell);
1025  ~SwMvContext() COVERITY_NOEXCEPT_FALSE;
1026 };
1027 
1028 #endif
1029 
1030 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BroadcasterMixin & operator=(const BroadcasterMixin &)
Definition: calbck.hxx:98
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:241
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:2164
Marks a position in the document model.
Definition: pam.hxx:36
static SwTOXBase & GetTOX(SwDoc &rDoc, SwNodeOffset const nNodeIndex)
SwFieldUpdateFlags
Definition: fldupde.hxx:22
bool IsNbspRunNext() const
Definition: editsh.hxx:984
SwUndoId
Definition: swundo.hxx:29
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:593
virtual void CalcLayout()
Definition: viewsh.cxx:1037
SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:353
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:290
GraphicType
Definition: doc.hxx:188
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:121
const T & GetDefault(TypedWhichId< T > nWhich) const
Definition: editsh.hxx:268
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:34
bool SetParagraphSignatureValidation(const bool bEnable)
Enable/Disable paragraph signature validation and return the previous value.
Definition: editsh.hxx:970
SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:351
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:162
SwDocPositions
Definition: cshtyp.hxx:103
sal_uInt16 sal_Unicode
bool m_bDoParagraphSignatureValidation
Prevent nested calls of ValidateParagraphSignatures.
Definition: editsh.hxx:1006
std::vector< SwGetINetAttr > SwGetINetAttrs
Definition: editsh.hxx:126
SwTOIKeyType
Definition: toxe.hxx:30
SwEditShell & m_rShell
Definition: editsh.hxx:1014
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:120
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:137
Class for automated call of Start- and EndAction().
Definition: editsh.hxx:1013
static void EndUndo(SwWrtShell &rSh)
Definition: basesh.cxx:2783
SvtScriptType
Style of a layout element.
Definition: frmfmt.hxx:59
bool IsParagraphSignatureValidationEnabled() const
Returns true iff paragraph signature validation is enabled.
Definition: editsh.hxx:968
void UpdateFields(bool bCloseDB=false)
Forces update of each field.
Definition: viewsh.cxx:703
SfxClassificationPolicyType
const SwTextINetFormat & rINetAttr
Definition: editsh.hxx:120
void FinitCore()
Definition: init.cxx:666
SetAttrMode
Definition: swtypes.hxx:133
vector_type::size_type size_type
Definition: docary.hxx:223
SplitTable_HeadlineOption
Definition: tblenum.hxx:53
SwFieldIds
Definition: fldbas.hxx:45
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
SwEditShell & m_rShell
Definition: editsh.hxx:1022
const SvNumberFormatter * GetNumberFormatter() const
Definition: editsh.hxx:901
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
Represents the style of a text portion.
Definition: charfmt.hxx:26
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
< 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:1021
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void InitCore()
Definition: init.cxx:447
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:128
virtual void Redo() override
Definition: undobj.cxx:224
ParaBreakType
Definition: editsh.hxx:111
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
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:1005
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