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