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