LibreOffice Module sw (master)  1
tox.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_TOX_HXX
20 #define INCLUDED_SW_INC_TOX_HXX
21 
22 #include <vector>
23 #include <optional>
24 
25 #include <cppuhelper/weakref.hxx>
26 #include <editeng/svxenum.hxx>
27 #include <i18nlangtag/lang.h>
28 #include <o3tl/typed_flags_set.hxx>
29 #include <sal/log.hxx>
30 #include <svl/listener.hxx>
31 #include <svl/poolitem.hxx>
32 #include <com/sun/star/text/XDocumentIndexMark.hpp>
33 
34 #include "calbck.hxx"
35 #include "hints.hxx"
36 #include "swtypes.hxx"
37 #include "toxe.hxx"
38 
39 class SwTOXType;
40 class SwTOXMark;
41 class SwTextTOXMark;
42 class SwDoc;
43 class SwRootFrame;
45 
46 
47 typedef std::vector<SwTOXMark*> SwTOXMarks;
48 
49 namespace sw {
50  struct CollectTextMarksHint final : SfxHint {
52  CollectTextMarksHint(SwTOXMarks& rMarks) : m_rMarks(rMarks) {}
53  };
54  struct FindContentFrameHint final : SfxHint {
56  const SwDoc& m_rDoc;
58  FindContentFrameHint(SwContentFrame*& rpContentFrame, const SwDoc& rDoc, const SwRootFrame& rLayout)
59  : m_rpContentFrame(rpContentFrame)
60  , m_rDoc(rDoc)
61  , m_rLayout(rLayout)
62  {}
63  };
65  std::vector<std::reference_wrapper<SwTextTOXMark>>& m_rMarks;
67  CollectTextTOXMarksForLayoutHint(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) : m_rMarks(rMarks), m_pLayout(pLayout) {}
68  };
69  SW_DLLPUBLIC auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& rName)
70  -> std::optional<std::pair<SwTOXMark, sal_Int32>>;
71 }
72 
73 // Entry of content index, alphabetical index or user defined index
74 
75 extern const sal_Unicode C_NUM_REPL;
76 extern const sal_Unicode C_END_PAGE_NUM;
77 
79  : public SfxPoolItem
80  , public sw::BroadcastingModify
81  , public SvtListener
82 {
83  friend void InitCore();
84  friend class SwTextTOXMark;
85 
87  OUString m_aAltText; // Text of caption is different.
88  OUString m_aPrimaryKey;
89  OUString m_aSecondaryKey;
90 
91  // three more strings for phonetic sorting
92  OUString m_aTextReading;
95 
97 
98  sal_uInt16 m_nLevel;
99  OUString m_aBookmarkName;
100  bool m_bAutoGenerated; // generated using a concordance file
101  bool m_bMainEntry; // main entry emphasized by character style
102 
103  css::uno::WeakReference<css::text::XDocumentIndexMark> m_wXDocumentIndexMark;
104 
105  SwTOXMark(); // to create the default attribute in InitCore
106 
107  virtual void Notify(const SfxHint& rHint) override;
108 
109 public:
110 
111  // single argument ctors shall be explicit.
112  explicit SwTOXMark( const SwTOXType* pTyp );
113  virtual ~SwTOXMark() override;
114 
115  SwTOXMark( const SwTOXMark& rCopy );
116  SwTOXMark& operator=( const SwTOXMark& rCopy );
117 
118  // "pure virtual methods" of SfxPoolItem
119  virtual bool operator==( const SfxPoolItem& ) const override;
120  virtual SwTOXMark* Clone( SfxItemPool* pPool = nullptr ) const override;
121 
122  void InvalidateTOXMark();
123 
124  OUString GetText(SwRootFrame const* pLayout) const;
125 
126  inline bool IsAlternativeText() const;
127  inline const OUString& GetAlternativeText() const;
128 
129  inline void SetAlternativeText( const OUString& rAlt );
130 
131  // content or user defined index
132  inline void SetLevel(sal_uInt16 nLevel);
133  inline sal_uInt16 GetLevel() const;
134  inline void SetBookmarkName( const OUString& bName);
135  inline const OUString& GetBookmarkName() const;
136 
137  // for alphabetical index only
138  inline void SetPrimaryKey(const OUString& rStr );
139  inline void SetSecondaryKey(const OUString& rStr);
140  inline void SetTextReading(const OUString& rStr);
141  inline void SetPrimaryKeyReading(const OUString& rStr );
142  inline void SetSecondaryKeyReading(const OUString& rStr);
143 
144  inline OUString const & GetPrimaryKey() const;
145  inline OUString const & GetSecondaryKey() const;
146  inline OUString const & GetTextReading() const;
147  inline OUString const & GetPrimaryKeyReading() const;
148  inline OUString const & GetSecondaryKeyReading() const;
149 
150  bool IsAutoGenerated() const {return m_bAutoGenerated;}
151  void SetAutoGenerated(bool bSet) {m_bAutoGenerated = bSet;}
152 
153  bool IsMainEntry() const {return m_bMainEntry;}
154  void SetMainEntry(bool bSet) { m_bMainEntry = bSet;}
155 
156  inline const SwTOXType* GetTOXType() const;
157 
158  const SwTextTOXMark* GetTextTOXMark() const { return m_pTextAttr; }
159  SwTextTOXMark* GetTextTOXMark() { return m_pTextAttr; }
160 
161  SAL_DLLPRIVATE css::uno::WeakReference<css::text::XDocumentIndexMark> const& GetXTOXMark() const
162  { return m_wXDocumentIndexMark; }
163  SAL_DLLPRIVATE void SetXTOXMark(css::uno::Reference<css::text::XDocumentIndexMark> const& xMark)
164  { m_wXDocumentIndexMark = xMark; }
165  void RegisterToTOXType( SwTOXType& rMark );
166 
167  static constexpr OUStringLiteral S_PAGE_DELI = u", ";
168 };
169 
170 // index types
172 {
173 public:
174  SwTOXType(SwDoc& rDoc, TOXTypes eTyp, const OUString& rName);
175 
176  // @@@ public copy ctor, but no copy assignment?
177  SwTOXType(const SwTOXType& rCopy);
178 
179  inline const OUString& GetTypeName() const;
180  inline TOXTypes GetType() const;
181  SwDoc& GetDoc() const { return m_rDoc; }
182  void CollectTextMarks(SwTOXMarks& rMarks) const
183  { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextMarksHint(rMarks)); }
184  SwContentFrame* FindContentFrame(const SwDoc& rDoc, const SwRootFrame& rLayout) const
185  {
186  SwContentFrame* pContentFrame = nullptr;
187  const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::FindContentFrameHint(pContentFrame, rDoc, rLayout));
188  return pContentFrame;
189  }
190  void CollectTextTOXMarksForLayout(std::vector<std::reference_wrapper<SwTextTOXMark>>& rMarks, const SwRootFrame* pLayout) const
191  { const_cast<SwTOXType*>(this)->GetNotifier().Broadcast(sw::CollectTextTOXMarksForLayoutHint(rMarks, pLayout)); }
192 
193 
194 private:
196  OUString m_aName;
198 
199  // @@@ public copy ctor, but no copy assignment?
200  SwTOXType & operator= (const SwTOXType &) = delete;
201 };
202 
203 // Structure of the index lines
204 #define FORM_TITLE 0
205 #define FORM_ALPHA_DELIMITER 1
206 #define FORM_PRIMARY_KEY 2
207 #define FORM_SECONDARY_KEY 3
208 #define FORM_ENTRY 4
209 
210 /*
211  Pattern structure
212 
213  <E#> - entry number <E# CharStyleName,PoolId>
214  <ET> - entry text <ET CharStyleName,PoolId>
215  <E> - entry text and number <E CharStyleName,PoolId>
216  <T> - tab stop <T,,Position,Adjust>
217  <C> - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId>
218  <TX> - text token <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER>
219  <#> - Page number <# CharStyleName,PoolId>
220  <LS> - Link start <LS>
221  <LE> - Link end <LE>
222  <A00> - Authority entry field <A02 CharStyleName, PoolId>
223  */
224 
225 // These enum values are stored and must not be changed!
227 {
239 };
240 
242 {
243  OUString sText;
244  OUString sCharStyleName;
247  sal_uInt16 nPoolId;
249  sal_uInt16 nChapterFormat; //SwChapterFormat;
250  sal_uInt16 nOutlineLevel;//the maximum permitted outline level in numbering
251  sal_uInt16 nAuthorityField; //enum ToxAuthorityField
253  bool bWithTab; // true: do generate tab
254  // character only the tab stop
255  // #i21237#
256 
258  nTabStopPosition(0),
259  eTokenType(eType),
260  nPoolId(USHRT_MAX),
261  eTabAlign( SvxTabAdjust::Left ),
262  nChapterFormat(0 /*CF_NUMBER*/),
263  nOutlineLevel(MAXLEVEL), //default to maximum outline level
264  nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/),
265  cTabFillChar(' '),
266  bWithTab(true) // #i21237#
267  {}
268 
269  OUString GetString() const;
270 };
271 
273 {
275 
277  bool operator()(const SwFormToken & rToken)
278  {
279  return rToken.eTokenType == eType;
280  }
281 };
282 
284 typedef std::vector<SwFormToken> SwFormTokens;
285 
291 {
294 
295 public:
301  SwFormTokensHelper(const OUString & rStr);
302 
308  const SwFormTokens & GetTokens() const { return m_Tokens; }
309 };
310 
312 {
313  SwFormTokens m_aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
314  OUString m_aTemplate[ AUTH_TYPE_END + 1 ];
315 
317  sal_uInt16 m_nFormMaxLevel;
318 
319  bool m_bIsRelTabPos : 1;
320  bool m_bCommaSeparated : 1;
321 
322 public:
323  SwForm( TOXTypes eTOXType = TOX_CONTENT );
324  SwForm( const SwForm& rForm );
325 
326  SwForm& operator=( const SwForm& rForm );
327 
328  inline void SetTemplate(sal_uInt16 nLevel, const OUString& rName);
329  inline OUString const & GetTemplate(sal_uInt16 nLevel) const;
330 
331  // #i21237#
332  void SetPattern(sal_uInt16 nLevel, SwFormTokens&& rName);
333  void SetPattern(sal_uInt16 nLevel, const OUString& rStr);
334  const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
335 
336  // fill tab stop positions from template to pattern- #i21237#
337  void AdjustTabStops( SwDoc const & rDoc );
338 
339  inline TOXTypes GetTOXType() const;
340  inline sal_uInt16 GetFormMax() const;
341 
342  bool IsRelTabPos() const { return m_bIsRelTabPos; }
343  void SetRelTabPos( bool b ) { m_bIsRelTabPos = b; }
344 
345  bool IsCommaSeparated() const { return m_bCommaSeparated;}
346  void SetCommaSeparated( bool b) { m_bCommaSeparated = b;}
347 
348  static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
349 
350  static OUString GetFormEntry();
351  static OUString GetFormTab();
352  static OUString GetFormPageNums();
353  static OUString GetFormLinkStt();
354  static OUString GetFormLinkEnd();
355  static OUString GetFormEntryNum();
356  static OUString GetFormEntryText();
357  static OUString GetFormChapterMark();
358  static OUString GetFormText();
359  static OUString GetFormAuth();
360 };
361 
362 // Content to create indexes of
363 enum class SwTOXElement : sal_uInt16
364 {
365  NONE = 0x0000,
366  Mark = 0x0001,
367  OutlineLevel = 0x0002,
368  Template = 0x0004,
369  Ole = 0x0008,
370  Table = 0x0010,
371  Graphic = 0x0020,
372  Frame = 0x0040,
373  Sequence = 0x0080,
374  TableLeader = 0x0100,
375  TableInToc = 0x0200,
376  Bookmark = 0x0400,
377  Newline = 0x0800,
378  ParagraphOutlineLevel = 0x1000,
379 };
380 namespace o3tl {
381  template<> struct typed_flags<SwTOXElement> : is_typed_flags<SwTOXElement, 0x3fff> {};
382 }
383 
384 enum class SwTOIOptions : sal_uInt16
385 {
386  NONE = 0x00,
387  SameEntry = 0x01,
388  FF = 0x02,
389  CaseSensitive = 0x04,
390  KeyAsEntry = 0x08,
391  AlphaDelimiter = 0x10,
392  Dash = 0x20,
393  InitialCaps = 0x40,
394 };
395 namespace o3tl {
396  template<> struct typed_flags<SwTOIOptions> : is_typed_flags<SwTOIOptions, 0x7f> {};
397 }
398 
399 //which part of the caption is to be displayed
401 {
405 };
406 
407 enum class SwTOOElements : sal_uInt16
408 {
409  NONE = 0x00,
410  Math = 0x01,
411  Chart = 0x02,
412  Calc = 0x08,
413  DrawImpress = 0x10,
414  Other = 0x80,
415 };
416 namespace o3tl {
417  template<> struct typed_flags<SwTOOElements> : is_typed_flags<SwTOOElements, 0x9b> {};
418 }
419 
420 #define TOX_STYLE_DELIMITER u'\x0001'
421 
422 // Class for all indexes
424 {
425  SwForm m_aForm; // description of the lines
426  OUString m_aName; // unique name
427  OUString m_aTitle; // title
428  OUString m_aBookmarkName; //Bookmark Name
429 
430  OUString m_sMainEntryCharStyle; // name of the character style applied to main index entries
431 
432  OUString m_aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
433  OUString m_sSequenceName; // FieldTypeName of a caption sequence
434 
437 
438  union {
439  sal_uInt16 nLevel; // consider outline levels
440  SwTOIOptions nOptions; // options of alphabetical index
441  } m_aData;
442 
443  SwTOXElement m_nCreateType; // sources to create the index from
444  SwTOOElements m_nOLEOptions; // OLE sources
446  bool m_bProtected : 1; // index protected ?
447  bool m_bFromChapter : 1; // create from chapter or document
448  bool m_bFromObjectNames : 1; // create a table or object index
449  // from the names rather than the caption
450  bool m_bLevelFromChapter : 1; // User index: get the level from the source chapter
451 
452 protected:
453  // Add a data member, for record the TOC field expression of MS Word binary format
454  // For keeping fidelity and may giving a better exporting performance
457 
458 public:
459  SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
460  SwTOXElement nCreaType, const OUString& rTitle );
461  SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr );
462  virtual ~SwTOXBase() override;
463 
464  virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) override
465  {
466  if(dynamic_cast<const sw::DocumentDyingHint*>(&rHint))
467  GetRegisteredIn()->Remove(this);
468  else
469  SwClient::SwClientNotify(rMod, rHint);
470  }
471  // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
472  // If not, so create it and copy all other used things.
473  void CopyTOXBase( SwDoc*, const SwTOXBase& );
474 
475  const SwTOXType* GetTOXType() const;
476 
477  SwTOXElement GetCreateType() const; // creation types
478 
479  const OUString& GetTOXName() const {return m_aName;}
480  void SetTOXName(const OUString& rSet) {m_aName = rSet;}
481 
482  // for record the TOC field expression of MS Word binary format
483  const OUString& GetMSTOCExpression() const{return maMSTOCExpression;}
484  void SetMSTOCExpression(const OUString& rExp) {maMSTOCExpression = rExp;}
485  void EnableKeepExpression() {mbKeepExpression = true;}
486  void DisableKeepExpression() {mbKeepExpression = false;}
487 
488  const OUString& GetTitle() const; // Title
489  const OUString& GetBookmarkName() const;
490  OUString const & GetTypeName() const; // Name
491  const SwForm& GetTOXForm() const; // description of the lines
492 
493  void SetCreate(SwTOXElement);
494  void SetTitle(const OUString& rTitle);
495  void SetTOXForm(const SwForm& rForm);
496  void SetBookmarkName(const OUString& bName);
497 
498  TOXTypes GetType() const;
499 
500  const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;}
501  void SetMainEntryCharStyle(const OUString& rSet) {m_sMainEntryCharStyle = rSet;}
502 
503  // content index only
504  inline void SetLevel(sal_uInt16); // consider outline level
505  inline sal_uInt16 GetLevel() const;
506 
507  // alphabetical index only
508  inline SwTOIOptions GetOptions() const; // alphabetical index options
509  inline void SetOptions(SwTOIOptions nOpt);
510 
511  // index of objects
512  SwTOOElements GetOLEOptions() const {return m_nOLEOptions;}
513  void SetOLEOptions(SwTOOElements nOpt) {m_nOLEOptions = nOpt;}
514 
515  // index of objects
516 
517  OUString const & GetStyleNames(sal_uInt16 nLevel) const
518  {
519  SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
520  return m_aStyleNames[nLevel];
521  }
522  void SetStyleNames(const OUString& rSet, sal_uInt16 nLevel)
523  {
524  SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
525  m_aStyleNames[nLevel] = rSet;
526  }
527  bool IsFromChapter() const { return m_bFromChapter;}
528  void SetFromChapter(bool bSet) { m_bFromChapter = bSet;}
529 
530  bool IsFromObjectNames() const {return m_bFromObjectNames;}
531  void SetFromObjectNames(bool bSet) {m_bFromObjectNames = bSet;}
532 
533  bool IsLevelFromChapter() const {return m_bLevelFromChapter;}
534  void SetLevelFromChapter(bool bSet) {m_bLevelFromChapter = bSet;}
535 
536  bool IsProtected() const { return m_bProtected; }
537  void SetProtected(bool bSet) { m_bProtected = bSet; }
538 
539  const OUString& GetSequenceName() const {return m_sSequenceName;}
540  void SetSequenceName(const OUString& rSet) {m_sSequenceName = rSet;}
541 
542  SwCaptionDisplay GetCaptionDisplay() const { return m_eCaptionDisplay;}
543  void SetCaptionDisplay(SwCaptionDisplay eSet) {m_eCaptionDisplay = eSet;}
544 
545  bool IsTOXBaseInReadonly() const;
546 
547  const SfxItemSet* GetAttrSet() const;
548  void SetAttrSet( const SfxItemSet& );
549 
550  LanguageType GetLanguage() const {return m_eLanguage;}
551  void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;}
552 
553  const OUString& GetSortAlgorithm()const {return m_sSortAlgorithm;}
554  void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;}
555  // #i21237#
556  void AdjustTabStops( SwDoc const & rDoc )
557  {
558  m_aForm.AdjustTabStops( rDoc );
559  }
560 
561  SwTOXBase& operator=(const SwTOXBase& rSource);
562  void RegisterToTOXType( SwTOXType& rMark );
563  virtual bool IsVisible() const { return true; }
564 };
565 
566 //SwTOXMark
567 
568 inline const OUString& SwTOXMark::GetAlternativeText() const
569  { return m_aAltText; }
570 
571 inline const OUString& SwTOXMark::GetBookmarkName() const
572  { return m_aBookmarkName; }
573 
574 inline const SwTOXType* SwTOXMark::GetTOXType() const
575  { return m_pType; }
576 
577 inline bool SwTOXMark::IsAlternativeText() const
578  { return !m_aAltText.isEmpty(); }
579 
580 inline void SwTOXMark::SetAlternativeText(const OUString& rAlt)
581 {
582  m_aAltText = rAlt;
583 }
584 
585 inline void SwTOXMark::SetBookmarkName(const OUString& bName)
586 {
587  m_aBookmarkName = bName;
588 }
589 
590 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
591 {
592  SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
593  m_nLevel = nLvl;
594 }
595 
596 inline void SwTOXMark::SetPrimaryKey( const OUString& rKey )
597 {
598  SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
599  m_aPrimaryKey = rKey;
600 }
601 
602 inline void SwTOXMark::SetSecondaryKey( const OUString& rKey )
603 {
604  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
605  m_aSecondaryKey = rKey;
606 }
607 
608 inline void SwTOXMark::SetTextReading( const OUString& rText )
609 {
610  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
611  m_aTextReading = rText;
612 }
613 
614 inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey )
615 {
616  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
617  m_aPrimaryKeyReading = rKey;
618 }
619 
620 inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey )
621 {
622  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
623  m_aSecondaryKeyReading = rKey;
624 }
625 
626 inline sal_uInt16 SwTOXMark::GetLevel() const
627 {
628  SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
629  return m_nLevel;
630 }
631 
632 inline OUString const & SwTOXMark::GetPrimaryKey() const
633 {
634  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
635  return m_aPrimaryKey;
636 }
637 
638 inline OUString const & SwTOXMark::GetSecondaryKey() const
639 {
640  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
641  return m_aSecondaryKey;
642 }
643 
644 inline OUString const & SwTOXMark::GetTextReading() const
645 {
646  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
647  return m_aTextReading;
648 }
649 
650 inline OUString const & SwTOXMark::GetPrimaryKeyReading() const
651 {
652  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
653  return m_aPrimaryKeyReading;
654 }
655 
656 inline OUString const & SwTOXMark::GetSecondaryKeyReading() const
657 {
658  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
659  return m_aSecondaryKeyReading;
660 }
661 
662 //SwForm
663 
664 inline void SwForm::SetTemplate(sal_uInt16 nLevel, const OUString& rTemplate)
665 {
666  SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
667  m_aTemplate[nLevel] = rTemplate;
668 }
669 
670 inline OUString const & SwForm::GetTemplate(sal_uInt16 nLevel) const
671 {
672  SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
673  return m_aTemplate[nLevel];
674 }
675 
677 {
678  return m_eType;
679 }
680 
681 inline sal_uInt16 SwForm::GetFormMax() const
682 {
683  return m_nFormMaxLevel;
684 }
685 
686 //SwTOXType
687 
688 inline const OUString& SwTOXType::GetTypeName() const
689  { return m_aName; }
690 
692  { return m_eType; }
693 
694 // SwTOXBase
695 
696 inline const SwTOXType* SwTOXBase::GetTOXType() const
697  { return static_cast<const SwTOXType*>(GetRegisteredIn()); }
698 
700  { return m_nCreateType; }
701 
702 inline const OUString& SwTOXBase::GetTitle() const
703  { return m_aTitle; }
704 
705 inline const OUString& SwTOXBase::GetBookmarkName() const
706  { return m_aBookmarkName; }
707 
708 inline OUString const & SwTOXBase::GetTypeName() const
709  { return GetTOXType()->GetTypeName(); }
710 
711 inline const SwForm& SwTOXBase::GetTOXForm() const
712  { return m_aForm; }
713 
714 inline void SwTOXBase::SetCreate(SwTOXElement nCreate)
715  { m_nCreateType = nCreate; }
716 
717 inline void SwTOXBase::SetTOXForm(const SwForm& rForm)
718  { m_aForm = rForm; }
719 
721  { return GetTOXType()->GetType(); }
722 
723 inline void SwTOXBase::SetLevel(sal_uInt16 nLev)
724 {
725  SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
726  m_aData.nLevel = nLev;
727 }
728 
729 inline sal_uInt16 SwTOXBase::GetLevel() const
730 {
731  SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type");
732  return m_aData.nLevel;
733 }
734 
736 {
737  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
738  return m_aData.nOptions;
739 }
740 
742 {
743  SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
744  m_aData.nOptions = nOpt;
745 }
746 
747 #endif // INCLUDED_SW_INC_TOX_HXX
748 
749 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TOXTypes GetTOXType() const
Definition: tox.hxx:676
const SwFormTokens & GetTokens() const
Returns vector of tokens.
Definition: tox.hxx:308
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:284
SwCaptionDisplay m_eCaptionDisplay
Definition: tox.hxx:445
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
Definition: tox.hxx:464
void SetLevelFromChapter(bool bSet)
Definition: tox.hxx:534
TOXTypes
Definition: toxe.hxx:39
void SetLanguage(LanguageType nLang)
Definition: tox.hxx:551
SAL_DLLPRIVATE css::uno::WeakReference< css::text::XDocumentIndexMark > const & GetXTOXMark() const
Definition: tox.hxx:161
SwTOXType & operator=(const SwTOXType &)=delete
bool IsAlternativeText() const
Definition: tox.hxx:577
OUString const & GetSecondaryKeyReading() const
Definition: tox.hxx:656
SwTOIOptions
Definition: tox.hxx:384
SwTOXMarks & m_rMarks
Definition: tox.hxx:51
SwTOXElement GetCreateType() const
Definition: tox.hxx:699
SwTOIOptions GetOptions() const
Definition: tox.hxx:735
OUString m_sSequenceName
Definition: tox.hxx:433
SwTextTOXMark * m_pTextAttr
Definition: tox.hxx:96
void DisableKeepExpression()
Definition: tox.hxx:486
CollectTextMarksHint(SwTOXMarks &rMarks)
Definition: tox.hxx:52
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:3242
SwTOXType(SwDoc &rDoc, TOXTypes eTyp, const OUString &rName)
Definition: tox.cxx:212
virtual bool operator==(const SfxPoolItem &) const =0
OUString const & GetPrimaryKey() const
Definition: tox.hxx:632
SwFormToken(FormTokenType eType)
Definition: tox.hxx:257
bool IsProtected() const
Definition: tox.hxx:536
const OUString & GetBookmarkName() const
Definition: tox.hxx:571
sal_uInt16 nOutlineLevel
Definition: tox.hxx:250
void SetLevel(sal_uInt16 nLevel)
Definition: tox.hxx:590
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SwTOOElements
Definition: tox.hxx:407
Definition: tox.hxx:311
OUString m_aTitle
Definition: tox.hxx:427
OUString m_aBookmarkName
Definition: tox.hxx:428
SAL_DLLPRIVATE void SetXTOXMark(css::uno::Reference< css::text::XDocumentIndexMark > const &xMark)
Definition: tox.hxx:163
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:44
bool operator()(const SwFormToken &rToken)
Definition: tox.hxx:277
OUString const & GetTemplate(sal_uInt16 nLevel) const
Definition: tox.hxx:670
void CollectTextMarks(SwTOXMarks &rMarks) const
Definition: tox.hxx:182
Definition: doc.hxx:187
const SwRootFrame * m_pLayout
Definition: tox.hxx:66
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
OUString const & GetTypeName() const
Definition: tox.hxx:708
bool m_bMainEntry
Definition: tox.hxx:101
SfxPoolItem & operator=(const SfxPoolItem &)=delete
union SwTOXBase::@30 m_aData
sal_uInt16 m_nFormMaxLevel
Definition: tox.hxx:317
css::uno::WeakReference< css::text::XDocumentIndexMark > m_wXDocumentIndexMark
Definition: tox.hxx:103
sal_uInt16 GetFormMax() const
Definition: tox.hxx:681
Dialog to specify the properties of date form field.
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:120
SwFormTokens m_Tokens
the tokens
Definition: tox.hxx:293
const SwTOXType * GetTOXType() const
Definition: tox.hxx:574
sal_uInt16 nLevel
Definition: tox.hxx:439
SwClient * Remove(SwClient *pDepend)
Definition: calbck.cxx:225
sal_uInt16 nPoolId
Definition: tox.hxx:247
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
bool bWithTab
Definition: tox.hxx:253
void SetOptions(SwTOIOptions nOpt)
Definition: tox.hxx:741
SwTextTOXMark * GetTextTOXMark()
Definition: tox.hxx:159
sal_Unicode cTabFillChar
Definition: tox.hxx:252
void SetOLEOptions(SwTOOElements nOpt)
Definition: tox.hxx:513
static LanguageType nLang
Definition: srtdlg.cxx:51
SwTOIOptions nOptions
Definition: tox.hxx:440
void SetRelTabPos(bool b)
Definition: tox.hxx:343
OUString GetString(int nId)
void SetCreate(SwTOXElement)
Definition: tox.hxx:714
sal_uInt16 sal_Unicode
OUString const & GetPrimaryKeyReading() const
Definition: tox.hxx:650
const SwTOXType * GetTOXType() const
Definition: tox.hxx:696
SwTOXElement m_nCreateType
Definition: tox.hxx:443
void AdjustTabStops(SwDoc const &rDoc)
Definition: tox.hxx:556
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
FindContentFrameHint(SwContentFrame *&rpContentFrame, const SwDoc &rDoc, const SwRootFrame &rLayout)
Definition: tox.hxx:58
SwDoc & GetDoc() const
Definition: tox.hxx:181
void SetTemplate(sal_uInt16 nLevel, const OUString &rName)
Definition: tox.hxx:664
MapData m_aData
OUString sText
Definition: tox.hxx:243
bool IsAutoGenerated() const
Definition: tox.hxx:150
sal_uInt16 m_nLevel
Definition: tox.hxx:98
void SetSortAlgorithm(const OUString &rSet)
Definition: tox.hxx:554
virtual void SetTitle(const OUString &rNewTitle) override
const OUString & GetSequenceName() const
Definition: tox.hxx:539
OUString m_aTextReading
Definition: tox.hxx:92
void SetAlternativeText(const OUString &rAlt)
Definition: tox.hxx:580
SwTOOElements GetOLEOptions() const
Definition: tox.hxx:512
auto PrepareJumpToTOXMark(SwDoc const &rDoc, OUString const &rName) -> std::optional< std::pair< SwTOXMark, sal_Int32 >>
Definition: view2.cxx:2170
LanguageType m_eLanguage
Definition: tox.hxx:435
OUString maMSTOCExpression
Definition: tox.hxx:455
const sal_Unicode C_END_PAGE_NUM
Definition: tox.cxx:46
const OUString & GetAlternativeText() const
Definition: tox.hxx:568
SwContentFrame *& m_rpContentFrame
Definition: tox.hxx:55
void Broadcast(const SfxHint &rHint)
void SetPrimaryKey(const OUString &rStr)
Definition: tox.hxx:596
SwTOXElement
Definition: tox.hxx:363
void SetTextReading(const OUString &rStr)
Definition: tox.hxx:608
FormTokenType eTokenType
Definition: tox.hxx:246
OUString sCharStyleName
Definition: tox.hxx:244
virtual bool IsVisible() const
Definition: tox.hxx:563
bool IsFromObjectNames() const
Definition: tox.hxx:530
void SetSequenceName(const OUString &rSet)
Definition: tox.hxx:540
void SetMainEntryCharStyle(const OUString &rSet)
Definition: tox.hxx:501
sal_uInt16 GetLevel() const
Definition: tox.hxx:626
bool m_bAutoGenerated
Definition: tox.hxx:100
void SetCaptionDisplay(SwCaptionDisplay eSet)
Definition: tox.hxx:543
void SetPrimaryKeyReading(const OUString &rStr)
Definition: tox.hxx:614
void SetFromChapter(bool bSet)
Definition: tox.hxx:528
float u
const OUString & GetTypeName() const
Definition: tox.hxx:688
SwTOOElements m_nOLEOptions
Definition: tox.hxx:444
const SwDoc & m_rDoc
Definition: tox.hxx:56
sal_uInt16 nChapterFormat
Definition: tox.hxx:249
sal_uInt16 nAuthorityField
Definition: tox.hxx:251
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
bool IsFromChapter() const
Definition: tox.hxx:527
sal_uInt16 GetLevel() const
Definition: tox.hxx:729
OUString m_aSecondaryKey
Definition: tox.hxx:89
SwForm m_aForm
Definition: tox.hxx:425
const OUString & GetTitle() const
Definition: tox.hxx:702
OUString const & GetTextReading() const
Definition: tox.hxx:644
const SwRootFrame & m_rLayout
Definition: tox.hxx:57
tools::Long SwTwips
Definition: swtypes.hxx:51
SwCaptionDisplay GetCaptionDisplay() const
Definition: tox.hxx:542
OUString m_sSortAlgorithm
Definition: tox.hxx:436
void SetAutoGenerated(bool bSet)
Definition: tox.hxx:151
const OUString & GetSortAlgorithm() const
Definition: tox.hxx:553
void SetTOXForm(const SwForm &rForm)
Definition: tox.hxx:717
const sal_Unicode C_NUM_REPL
Definition: tox.cxx:45
OUString m_aAltText
Definition: tox.hxx:87
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:101
const OUString & GetBookmarkName() const
Definition: tox.hxx:705
TOXTypes m_eType
Definition: tox.hxx:197
void InitCore()
Definition: init.cxx:449
bool IsRelTabPos() const
Definition: tox.hxx:342
void SetTOXName(const OUString &rSet)
Definition: tox.hxx:480
SwTwips nTabStopPosition
Definition: tox.hxx:245
OUString m_aSecondaryKeyReading
Definition: tox.hxx:94
OUString const & GetSecondaryKey() const
Definition: tox.hxx:638
#define SAL_WARN_IF(condition, area, stream)
TOXTypes GetType() const
Definition: tox.hxx:720
SwDoc & m_rDoc
Definition: tox.hxx:195
OUString const & GetStyleNames(sal_uInt16 nLevel) const
Definition: tox.hxx:517
bool mbKeepExpression
Definition: tox.hxx:456
void SetStyleNames(const OUString &rSet, sal_uInt16 nLevel)
Definition: tox.hxx:522
LanguageType GetLanguage() const
Definition: tox.hxx:550
bool IsCommaSeparated() const
Definition: tox.hxx:345
TOXTypes m_eType
Definition: tox.hxx:316
void CollectTextTOXMarksForLayout(std::vector< std::reference_wrapper< SwTextTOXMark >> &rMarks, const SwRootFrame *pLayout) const
Definition: tox.hxx:190
CollectTextTOXMarksForLayoutHint(std::vector< std::reference_wrapper< SwTextTOXMark >> &rMarks, const SwRootFrame *pLayout)
Definition: tox.hxx:67
const SwTOXType * m_pType
Definition: tox.hxx:86
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
void SetBookmarkName(const OUString &bName)
Definition: tox.hxx:585
OUString m_sMainEntryCharStyle
Definition: tox.hxx:430
OUString m_aTemplate[AUTH_TYPE_END+1]
Definition: tox.hxx:314
void EnableKeepExpression()
Definition: tox.hxx:485
WriterListener & operator=(WriterListener const &)=delete
void SetSecondaryKey(const OUString &rStr)
Definition: tox.hxx:602
const OUString & GetMainEntryCharStyle() const
Definition: tox.hxx:500
TOXTypes GetType() const
Definition: tox.hxx:691
SwFormTokenEqualToFormTokenType(FormTokenType _eType)
Definition: tox.hxx:276
void SetProtected(bool bSet)
Definition: tox.hxx:537
bool IsMainEntry() const
Definition: tox.hxx:153
SvxTabAdjust eTabAlign
Definition: tox.hxx:248
SwContentFrame * FindContentFrame(const SwDoc &rDoc, const SwRootFrame &rLayout) const
Definition: tox.hxx:184
OUString m_aBookmarkName
Definition: tox.hxx:99
Left
const SwTextTOXMark * GetTextTOXMark() const
Definition: tox.hxx:158
void SetLevel(sal_uInt16)
Definition: tox.hxx:723
OUString m_aPrimaryKey
Definition: tox.hxx:88
void SetCommaSeparated(bool b)
Definition: tox.hxx:346
Helper class that converts vectors of tokens to strings and vice versa.
Definition: tox.hxx:290
const SwForm & GetTOXForm() const
Definition: tox.hxx:711
void SetSecondaryKeyReading(const OUString &rStr)
Definition: tox.hxx:620
SwCaptionDisplay
Definition: tox.hxx:400
std::vector< std::reference_wrapper< SwTextTOXMark > > & m_rMarks
Definition: tox.hxx:65
void AdjustTabStops(SwDoc const &rDoc)
Definition: tox.cxx:464
void SetMainEntry(bool bSet)
Definition: tox.hxx:154
FormTokenType
Definition: tox.hxx:226
void SetMSTOCExpression(const OUString &rExp)
Definition: tox.hxx:484
void SetFromObjectNames(bool bSet)
Definition: tox.hxx:531
const OUString & GetMSTOCExpression() const
Definition: tox.hxx:483
OUString m_aName
Definition: tox.hxx:196
bool IsLevelFromChapter() const
Definition: tox.hxx:533
const OUString & GetTOXName() const
Definition: tox.hxx:479
SvxTabAdjust
SwFormTokensHelper(const OUString &rStr)
constructor
Definition: tox.cxx:914
OUString m_aPrimaryKeyReading
Definition: tox.hxx:93
OUString m_aName
Definition: tox.hxx:426