LibreOffice Module sw (master) 1
toxmgr.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
20#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_TOXMGR_HXX
21#define INCLUDED_SW_SOURCE_UIBASE_INC_TOXMGR_HXX
22
23#include <swdllapi.h>
24#include <tox.hxx>
25#include <authfld.hxx>
26#include <memory>
27#include <optional>
28
29class SwWrtShell;
30class SwForm;
31
32// manager for directory functionality
33//one single method will be sufficient to insert AND update indexes
35{
37 OUString m_aStyleNames[MAXLEVEL];
41 std::optional<OUString>
43 std::optional<OUString>
45 std::unique_ptr<SwForm>
52
61 bool m_bReadonly: 1;
65
66 //TODO: TemplateNames
67 //const String* pTemplateName = 0, ???
68
70 SwTOXDescription & operator= (SwTOXDescription const &) = delete;
71
72public:
73 // single argument ctors shall be explicit.
74 explicit SwTOXDescription(TOXTypes eType) :
75 m_eTOXType(eType),
78 m_nOLEOptions(SwTOOElements::NONE),
79 m_eLanguage(::GetAppLanguage()),
80 m_eCaptionDisplay(CAPTION_COMPLETE),
82 m_bFromObjectNames(false),
83 m_bFromChapter(false),
84 m_bReadonly(true),
85 m_bLevelFromChapter(false),
86 m_bIsAuthSequence(false),
87 m_bSortByDocument(true)
88 {}
89
90 TOXTypes GetTOXType() const { return m_eTOXType;}
91
92 const OUString& GetStyleNames(sal_uInt16 nLvl) const
93 {return m_aStyleNames[nLvl];}
94 void SetStyleNames(const OUString& rSet, sal_uInt16 nLvl)
95 {m_aStyleNames[nLvl] = rSet; }
96
97 const OUString& GetAutoMarkURL() const { return m_sAutoMarkURL;}
98 void SetAutoMarkURL(const OUString& rSet) {m_sAutoMarkURL = rSet;}
99
100 void SetTitle(const OUString& rSet) { m_aTitle = rSet; }
101 std::optional<OUString> const & GetTitle() const {return m_aTitle; }
102
103 void SetTOUName(const OUString& rSet) { m_aTOUName = rSet; }
104 std::optional<OUString> const & GetTOUName() const { return m_aTOUName; }
105
106 void SetForm(const SwForm& rSet) { m_pForm.reset( new SwForm(rSet) );}
107 const SwForm* GetForm() const {return m_pForm.get();}
108
109 void SetContentOptions(SwTOXElement nSet) { m_nContent = nSet;}
110 SwTOXElement GetContentOptions() const { return m_nContent;}
111
112 void SetIndexOptions(SwTOIOptions nSet) { m_nIndexOptions = nSet;}
113 SwTOIOptions GetIndexOptions() const { return m_nIndexOptions;}
114
115 const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;}
116 void SetMainEntryCharStyle(const OUString& rSet) {m_sMainEntryCharStyle = rSet;}
117
118 void SetLevel(sal_uInt8 nSet) {m_nLevel = nSet;}
119 sal_uInt8 GetLevel()const {return m_nLevel; }
120
121 void SetCreateFromObjectNames(bool bSet) { m_bFromObjectNames = bSet;}
122 bool IsCreateFromObjectNames() const {return m_bFromObjectNames;}
123
124 const OUString& GetSequenceName() const {return m_sSequenceName;}
125 void SetSequenceName(const OUString& rSet) {m_sSequenceName = rSet;}
126
127 SwCaptionDisplay GetCaptionDisplay() const { return m_eCaptionDisplay;}
128 void SetCaptionDisplay(SwCaptionDisplay eSet) {m_eCaptionDisplay = eSet;}
129
130 void SetFromChapter(bool bSet) { m_bFromChapter = bSet;}
131 bool IsFromChapter() const {return m_bFromChapter;}
132
133 void SetReadonly(bool bSet){m_bReadonly = bSet;}
134 bool IsReadonly() const {return m_bReadonly;}
135
136 SwTOOElements GetOLEOptions() const {return m_nOLEOptions;}
137 void SetOLEOptions(SwTOOElements nOpt) {m_nOLEOptions = nOpt;}
138
139 bool IsLevelFromChapter() const {return m_bLevelFromChapter;}
140 void SetLevelFromChapter(bool bSet) {m_bLevelFromChapter = bSet;}
141
142 const OUString& GetAuthBrackets() const {return m_sAuthBrackets;}
143 void SetAuthBrackets(const OUString& rSet) {m_sAuthBrackets = rSet;}
144
145 bool IsAuthSequence() const {return m_bIsAuthSequence;}
146 void SetAuthSequence(bool bSet){m_bIsAuthSequence = bSet;}
147
148 bool IsSortByDocument()const {return m_bSortByDocument ;}
149 void SetSortByDocument(bool bSet) {m_bSortByDocument = bSet;}
150
151 void SetSortKeys(SwTOXSortKey eKey1,
152 SwTOXSortKey eKey2,
153 SwTOXSortKey eKey3);
154
155 const SwTOXSortKey& GetSortKey1() const {return m_eSortKey1;}
156 const SwTOXSortKey& GetSortKey2() const {return m_eSortKey2;}
157 const SwTOXSortKey& GetSortKey3() const {return m_eSortKey3;}
158
159 LanguageType GetLanguage() const {return m_eLanguage;}
160 void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;}
161
162 const OUString& GetSortAlgorithm()const {return m_sSortAlgorithm;}
163 void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;}
164
165 void ApplyTo(SwTOXBase& rTOXBase);
166
167};
168
170{
174
175 std::optional<OUString> maPrimKey;
176 std::optional<OUString> maSecKey;
177 std::optional<OUString> maAltStr;
178 std::optional<OUString> maTOUName;
179
180 std::optional<OUString> maPhoneticReadingOfAltStr;
181 std::optional<OUString> maPhoneticReadingOfPrimKey;
182 std::optional<OUString> maPhoneticReadingOfSecKey;
183
186
187public:
188 // single argument ctors shall be explicit.
191 mnLevel(0),
192 mbMainEntry(false)
193 {
194 }
195
197
198 void SetLevel(int nSet) {mnLevel = nSet;}
199 int GetLevel() const {return mnLevel;}
200
201 void SetMainEntry(bool bSet) {mbMainEntry = bSet;}
202 bool IsMainEntry() const {return mbMainEntry;}
203
204 void SetPrimKey(const OUString& rSet) { maPrimKey = rSet; }
205 std::optional<OUString> const & GetPrimKey() const { return maPrimKey; }
206
207 void SetSecKey(const OUString& rSet) { maSecKey = rSet; }
208 std::optional<OUString> const & GetSecKey() const { return maSecKey; }
209
210 void SetAltStr(const OUString& rSet) { maAltStr = rSet; }
211 std::optional<OUString> const & GetAltStr() const { return maAltStr; }
212
213 void SetTOUName(const OUString& rSet) { maTOUName = rSet; }
214 std::optional<OUString> const & GetTOUName() const { return maTOUName; }
215
217 std::optional<OUString> const & GetPhoneticReadingOfAltStr() const { return maPhoneticReadingOfAltStr; }
218
220 std::optional<OUString> const & GetPhoneticReadingOfPrimKey() const { return maPhoneticReadingOfPrimKey; }
221
223 std::optional<OUString> const & GetPhoneticReadingOfSecKey() const { return maPhoneticReadingOfSecKey; }
224};
225
231{
235
236 SAL_DLLPRIVATE sal_uInt16 GetUserTypeID(const OUString& rStr);
237
238public:
239 // single argument ctors shall be explicit.
240 explicit SwTOXMgr(SwWrtShell* pShell);
241
242 // methods for directory marks
243
244 void InsertTOXMark(const SwTOXMarkDescription& rDesc);
245
246 void UpdateTOXMark(const SwTOXMarkDescription& rDesc);
247
248 void DeleteTOXMark();
249 void NextTOXMark(bool bSame=false);
250 void PrevTOXMark(bool bSame=false);
251
252 // get current TOXmarks
253 sal_uInt16 GetTOXMarkCount() const;
254 SwTOXMark* GetTOXMark(sal_uInt16 nId);
255 SwTOXMark* GetCurTOXMark();
256 void SetCurTOXMark(sal_uInt16 nId);
257
258 // methods for directories
259
260 bool UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase, const SfxItemSet* pSet);
261
262 const SwTOXType* GetTOXType(TOXTypes eTyp) const;
263 SwWrtShell * GetShell() { return m_pSh; }
264};
265
266// inlines
267inline sal_uInt16 SwTOXMgr::GetTOXMarkCount() const
268 { return m_aCurMarks.size(); }
269
271 { return m_pCurTOXMark; }
272
273#endif
274
275/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 m_nLevel
Definition: tox.hxx:314
void SetCaptionDisplay(SwCaptionDisplay eSet)
Definition: toxmgr.hxx:128
void SetTitle(const OUString &rSet)
Definition: toxmgr.hxx:100
const OUString & GetSortAlgorithm() const
Definition: toxmgr.hxx:162
const SwForm * GetForm() const
Definition: toxmgr.hxx:107
void SetContentOptions(SwTOXElement nSet)
Definition: toxmgr.hxx:109
void SetTOUName(const OUString &rSet)
Definition: toxmgr.hxx:103
void SetStyleNames(const OUString &rSet, sal_uInt16 nLvl)
Definition: toxmgr.hxx:94
LanguageType GetLanguage() const
Definition: toxmgr.hxx:159
void SetLanguage(LanguageType nLang)
Definition: toxmgr.hxx:160
OUString m_sSortAlgorithm
Definition: toxmgr.hxx:51
std::optional< OUString > m_aTOUName
Definition: toxmgr.hxx:44
void SetLevelFromChapter(bool bSet)
Definition: toxmgr.hxx:140
SwTOXElement GetContentOptions() const
Definition: toxmgr.hxx:110
std::unique_ptr< SwForm > m_pForm
Definition: toxmgr.hxx:46
OUString m_sAutoMarkURL
Definition: toxmgr.hxx:40
SwTOXDescription(SwTOXDescription const &)=delete
void SetForm(const SwForm &rSet)
Definition: toxmgr.hxx:106
bool IsFromChapter() const
Definition: toxmgr.hxx:131
SwCaptionDisplay m_eCaptionDisplay
Definition: toxmgr.hxx:54
sal_uInt8 GetLevel() const
Definition: toxmgr.hxx:119
bool m_bSortByDocument
Definition: toxmgr.hxx:64
OUString m_sAuthBrackets
Definition: toxmgr.hxx:53
bool IsCreateFromObjectNames() const
Definition: toxmgr.hxx:122
bool m_bReadonly
Definition: toxmgr.hxx:61
void SetSequenceName(const OUString &rSet)
Definition: toxmgr.hxx:125
void SetAuthBrackets(const OUString &rSet)
Definition: toxmgr.hxx:143
SwTOIOptions GetIndexOptions() const
Definition: toxmgr.hxx:113
void SetFromChapter(bool bSet)
Definition: toxmgr.hxx:130
void SetAutoMarkURL(const OUString &rSet)
Definition: toxmgr.hxx:98
SwCaptionDisplay GetCaptionDisplay() const
Definition: toxmgr.hxx:127
OUString m_sMainEntryCharStyle
Definition: toxmgr.hxx:39
SwTOXElement m_nContent
Definition: toxmgr.hxx:47
LanguageType m_eLanguage
Definition: toxmgr.hxx:50
std::optional< OUString > const & GetTOUName() const
Definition: toxmgr.hxx:104
const OUString & GetSequenceName() const
Definition: toxmgr.hxx:124
SwTOOElements m_nOLEOptions
Definition: toxmgr.hxx:49
bool m_bLevelFromChapter
Definition: toxmgr.hxx:62
const SwTOXSortKey & GetSortKey3() const
Definition: toxmgr.hxx:157
std::optional< OUString > m_aTitle
Definition: toxmgr.hxx:42
sal_uInt8 m_nLevel
Definition: toxmgr.hxx:58
SwTOIOptions m_nIndexOptions
Definition: toxmgr.hxx:48
SwTOXDescription(TOXTypes eType)
Definition: toxmgr.hxx:74
SwTOXSortKey m_eSortKey1
Definition: toxmgr.hxx:55
const OUString & GetStyleNames(sal_uInt16 nLvl) const
Definition: toxmgr.hxx:92
const OUString & GetAutoMarkURL() const
Definition: toxmgr.hxx:97
void SetSortAlgorithm(const OUString &rSet)
Definition: toxmgr.hxx:163
const SwTOXSortKey & GetSortKey1() const
Definition: toxmgr.hxx:155
std::optional< OUString > const & GetTitle() const
Definition: toxmgr.hxx:101
bool m_bFromObjectNames
Definition: toxmgr.hxx:59
void SetCreateFromObjectNames(bool bSet)
Definition: toxmgr.hxx:121
TOXTypes m_eTOXType
Definition: toxmgr.hxx:36
SwTOXSortKey m_eSortKey2
Definition: toxmgr.hxx:56
void SetIndexOptions(SwTOIOptions nSet)
Definition: toxmgr.hxx:112
bool IsReadonly() const
Definition: toxmgr.hxx:134
const SwTOXSortKey & GetSortKey2() const
Definition: toxmgr.hxx:156
const OUString & GetAuthBrackets() const
Definition: toxmgr.hxx:142
void SetSortByDocument(bool bSet)
Definition: toxmgr.hxx:149
TOXTypes GetTOXType() const
Definition: toxmgr.hxx:90
void SetAuthSequence(bool bSet)
Definition: toxmgr.hxx:146
bool IsSortByDocument() const
Definition: toxmgr.hxx:148
bool IsLevelFromChapter() const
Definition: toxmgr.hxx:139
void SetReadonly(bool bSet)
Definition: toxmgr.hxx:133
void SetLevel(sal_uInt8 nSet)
Definition: toxmgr.hxx:118
const OUString & GetMainEntryCharStyle() const
Definition: toxmgr.hxx:115
bool m_bFromChapter
Definition: toxmgr.hxx:60
SwTOXSortKey m_eSortKey3
Definition: toxmgr.hxx:57
bool IsAuthSequence() const
Definition: toxmgr.hxx:145
OUString m_sSequenceName
Definition: toxmgr.hxx:38
void SetMainEntryCharStyle(const OUString &rSet)
Definition: toxmgr.hxx:116
bool m_bIsAuthSequence
Definition: toxmgr.hxx:63
void SetOLEOptions(SwTOOElements nOpt)
Definition: toxmgr.hxx:137
SwTOOElements GetOLEOptions() const
Definition: toxmgr.hxx:136
void SetPhoneticReadingOfAltStr(const OUString &rSet)
Definition: toxmgr.hxx:216
std::optional< OUString > maTOUName
Definition: toxmgr.hxx:178
SwTOXMarkDescription(SwTOXMarkDescription const &)=delete
std::optional< OUString > const & GetPhoneticReadingOfAltStr() const
Definition: toxmgr.hxx:217
bool IsMainEntry() const
Definition: toxmgr.hxx:202
TOXTypes meTOXType
Definition: toxmgr.hxx:171
std::optional< OUString > maPhoneticReadingOfSecKey
Definition: toxmgr.hxx:182
SwTOXMarkDescription & operator=(SwTOXMarkDescription const &)=delete
void SetPrimKey(const OUString &rSet)
Definition: toxmgr.hxx:204
std::optional< OUString > maPrimKey
Definition: toxmgr.hxx:175
std::optional< OUString > maPhoneticReadingOfPrimKey
Definition: toxmgr.hxx:181
void SetSecKey(const OUString &rSet)
Definition: toxmgr.hxx:207
SwTOXMarkDescription(TOXTypes eType)
Definition: toxmgr.hxx:189
TOXTypes GetTOXType() const
Definition: toxmgr.hxx:196
void SetTOUName(const OUString &rSet)
Definition: toxmgr.hxx:213
void SetPhoneticReadingOfPrimKey(const OUString &rSet)
Definition: toxmgr.hxx:219
std::optional< OUString > maSecKey
Definition: toxmgr.hxx:176
void SetMainEntry(bool bSet)
Definition: toxmgr.hxx:201
std::optional< OUString > const & GetAltStr() const
Definition: toxmgr.hxx:211
int GetLevel() const
Definition: toxmgr.hxx:199
std::optional< OUString > const & GetPhoneticReadingOfPrimKey() const
Definition: toxmgr.hxx:220
std::optional< OUString > const & GetTOUName() const
Definition: toxmgr.hxx:214
std::optional< OUString > maAltStr
Definition: toxmgr.hxx:177
void SetAltStr(const OUString &rSet)
Definition: toxmgr.hxx:210
std::optional< OUString > maPhoneticReadingOfAltStr
Definition: toxmgr.hxx:180
void SetPhoneticReadingOfSecKey(const OUString &rSet)
Definition: toxmgr.hxx:222
std::optional< OUString > const & GetPhoneticReadingOfSecKey() const
Definition: toxmgr.hxx:223
void SetLevel(int nSet)
Definition: toxmgr.hxx:198
std::optional< OUString > const & GetPrimKey() const
Definition: toxmgr.hxx:205
std::optional< OUString > const & GetSecKey() const
Definition: toxmgr.hxx:208
Built on top of SwWrtShell, provides functionality to insert, update or perform other actions on vari...
Definition: toxmgr.hxx:231
SwWrtShell * m_pSh
Definition: toxmgr.hxx:232
SwTOXMark * m_pCurTOXMark
Definition: toxmgr.hxx:233
SwTOXMarks m_aCurMarks
Definition: toxmgr.hxx:234
SwTOXMark * GetCurTOXMark()
Definition: toxmgr.hxx:270
SwWrtShell * GetShell()
Definition: toxmgr.hxx:263
sal_uInt16 GetTOXMarkCount() const
Definition: toxmgr.hxx:267
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
DocumentType eType
LanguageType GetAppLanguage()
Definition: init.cxx:725
NONE
static SfxItemSet & rSet
static LanguageType nLang
Definition: srtdlg.cxx:51
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
SwTOXElement
Definition: tox.hxx:366
SwTOOElements
Definition: tox.hxx:410
SwTOIOptions
Definition: tox.hxx:387
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:46
SwCaptionDisplay
Definition: tox.hxx:403
@ CAPTION_COMPLETE
Definition: tox.hxx:404
TOXTypes
Definition: toxe.hxx:40
unsigned char sal_uInt8