LibreOffice Module sw (master)  1
swuiidxmrk.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_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
21 
22 #include <com/sun/star/container/XNameAccess.hpp>
23 #include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
24 #include <sfx2/basedlgs.hxx>
25 #include <sfx2/childwin.hxx>
26 #include <svx/stddlg.hxx>
27 #include <vcl/weld.hxx>
28 #include <toxe.hxx>
29 #include <memory>
30 
31 class SwWrtShell;
32 class SwTOXMgr;
33 class SwTOXMark;
34 
35 // insert mark for index entry
38 
40 {
41  std::shared_ptr<weld::Dialog> m_xDialog;
42 
43  friend class SwIndexMarkFloatDlg;
44  friend class SwIndexMarkModalDlg;
45 
46  OUString m_aOrgStr;
47  bool m_bDel;
48  bool const m_bNewMark;
50 
54  LanguageType m_nLangForPhoneticReading; //Language of current text used for phonetic reading proposal
55  bool m_bIsPhoneticReadingEnabled; //this value states whether phonetic reading is enabled in principle dependent of global cjk settings and language of current entry
56  css::uno::Reference< css::i18n::XExtendedIndexEntrySupplier >
58 
59  std::unique_ptr<SwTOXMgr>
62 
63  std::unique_ptr<weld::Label> m_xTypeFT;
64  std::unique_ptr<weld::ComboBox> m_xTypeDCB;
65  std::unique_ptr<weld::Button> m_xNewBT;
66  std::unique_ptr<weld::Entry> m_xEntryED;
67  std::unique_ptr<weld::Button> m_xSyncED;
68  std::unique_ptr<weld::Label> m_xPhoneticFT0;
69  std::unique_ptr<weld::Entry> m_xPhoneticED0;
70  std::unique_ptr<weld::Label> m_xKey1FT;
71  std::unique_ptr<weld::ComboBox> m_xKey1DCB;
72  std::unique_ptr<weld::Label> m_xPhoneticFT1;
73  std::unique_ptr<weld::Entry> m_xPhoneticED1;
74  std::unique_ptr<weld::Label> m_xKey2FT;
75  std::unique_ptr<weld::ComboBox> m_xKey2DCB;
76  std::unique_ptr<weld::Label> m_xPhoneticFT2;
77  std::unique_ptr<weld::Entry> m_xPhoneticED2;
78  std::unique_ptr<weld::Label> m_xLevelFT;
79  std::unique_ptr<weld::SpinButton> m_xLevelNF;
80  std::unique_ptr<weld::CheckButton> m_xMainEntryCB;
81  std::unique_ptr<weld::CheckButton> m_xApplyToAllCB;
82  std::unique_ptr<weld::CheckButton> m_xSearchCaseSensitiveCB;
83  std::unique_ptr<weld::CheckButton> m_xSearchCaseWordOnlyCB;
84  std::unique_ptr<weld::Button> m_xOKBT;
85  std::unique_ptr<weld::Button> m_xCloseBT;
86  std::unique_ptr<weld::Button> m_xDelBT;
87  std::unique_ptr<weld::Button> m_xPrevSameBT;
88  std::unique_ptr<weld::Button> m_xNextSameBT;
89  std::unique_ptr<weld::Button> m_xPrevBT;
90  std::unique_ptr<weld::Button> m_xNextBT;
91 
92  void Apply();
93  void InitControls();
94  void InsertMark();
95  void UpdateMark();
96 
97  DECL_LINK(InsertHdl, weld::Button&, void);
98  DECL_LINK(CloseHdl, weld::Button&, void);
99  DECL_LINK(SyncSelectionHdl, weld::Button&, void);
100  DECL_LINK(DelHdl, weld::Button&, void);
101  DECL_LINK( NextHdl, weld::Button&, void );
102  DECL_LINK( NextSameHdl, weld::Button&, void );
103  DECL_LINK( PrevHdl, weld::Button&, void );
104  DECL_LINK( PrevSameHdl, weld::Button&, void );
105  DECL_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
106  DECL_LINK( ModifyEditHdl, weld::Entry&, void );
107  void ModifyHdl(const weld::Widget& rWidget);
108  DECL_LINK( KeyDCBModifyHdl, weld::ComboBox&, void );
109  DECL_LINK( NewUserIdxHdl, weld::Button&, void );
110  DECL_LINK( SearchTypeHdl, weld::ToggleButton&, void );
111  DECL_LINK( PhoneticEDModifyHdl, weld::Entry&, void );
112 
113  //this method updates the values from 'nLangForPhoneticReading' and 'bIsPhoneticReadingEnabled'
114  //it needs to be called ones if this dialog is opened to create a new entry (in InitControls),
115  //or otherwise it has to be called for each changed TOXMark (in UpdateDialog)
117  OUString GetDefaultPhoneticReading( const OUString& rText );
118 
119  void UpdateKeyBoxes();
120 
121  void UpdateDialog();
122  void InsertUpdate();
123 
124  void Activate();
125 
126 public:
127 
128  SwIndexMarkPane(const std::shared_ptr<weld::Dialog>& rDialog, weld::Builder& rBuilder,
129  bool bNewDlg, SwWrtShell& rWrtShell);
130 
132 
133  void ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark const * pCurTOXMark = nullptr);
134  bool IsTOXType(const OUString& rName) { return m_xTypeDCB->find_text(rName) != -1; }
135 };
136 
138 {
140 
141  virtual void Activate() override;
142 public:
143  SwIndexMarkFloatDlg(SfxBindings* pBindings,
144  SfxChildWindow* pChild,
145  weld::Window *pParent,
146  SfxChildWinInfo const * pInfo,
147  bool bNew);
148  void ReInitDlg(SwWrtShell& rWrtShell);
149 };
150 
152 {
154 public:
155  SwIndexMarkModalDlg(weld::Window *pParent, SwWrtShell& rSh, SwTOXMark const * pCurTOXMark);
156  virtual ~SwIndexMarkModalDlg() override;
157  virtual short int run() override;
158 };
159 
160 class SwAuthMarkModalDlg;
161 
163 {
165 
166  static bool bIsFromComponent;
167 
168  friend class SwAuthMarkModalDlg;
169  friend class SwAuthMarkFloatDlg;
170 
171  bool const bNewEntry;
173 
175 
178 
180 
181  css::uno::Reference< css::container::XNameAccess > xBibAccess;
182 
183  std::unique_ptr<weld::RadioButton> m_xFromComponentRB;
184  std::unique_ptr<weld::RadioButton> m_xFromDocContentRB;
185  std::unique_ptr<weld::Label> m_xAuthorFI;
186  std::unique_ptr<weld::Label> m_xTitleFI;
187  std::unique_ptr<weld::Entry> m_xEntryED;
188  std::unique_ptr<weld::ComboBox> m_xEntryLB;
189  std::unique_ptr<weld::Button> m_xActionBT;
190  std::unique_ptr<weld::Button> m_xCloseBT;
191  std::unique_ptr<weld::Button> m_xCreateEntryPB;
192  std::unique_ptr<weld::Button> m_xEditEntryPB;
193 
194  DECL_LINK(InsertHdl, weld::Button&, void);
195  DECL_LINK(CloseHdl, weld::Button&, void);
196  DECL_LINK(CreateEntryHdl, weld::Button&, void);
197  DECL_LINK(CompEntryHdl, weld::ComboBox&, void);
198  DECL_LINK(ChangeSourceHdl, weld::ToggleButton&, void);
199  DECL_LINK(IsEditAllowedHdl, weld::Entry&, bool);
200  DECL_LINK(IsEntryAllowedHdl, weld::Entry&, bool);
201  DECL_LINK(EditModifyHdl, weld::Entry&, void);
202 
203  void InitControls();
204  void Activate();
205 
206 public:
207  SwAuthorMarkPane(weld::DialogController& rDialog, weld::Builder& rBuilder, bool bNew);
208  void ReInitDlg(SwWrtShell& rWrtShell);
209 };
210 
212 {
214  virtual void Activate() override;
215 public:
216  SwAuthMarkFloatDlg(SfxBindings* pBindings,
217  SfxChildWindow* pChild,
218  weld::Window *pParent,
219  SfxChildWinInfo const * pInfo,
220  bool bNew);
221  void ReInitDlg(SwWrtShell& rWrtShell);
222 };
223 
225 {
227 
228  void Apply();
229 public:
231  virtual short int run() override;
232 };
233 
234 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
235 
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Label > m_xTypeFT
Definition: swuiidxmrk.hxx:63
bool bBibAccessInitialized
Definition: swuiidxmrk.hxx:172
std::unique_ptr< weld::RadioButton > m_xFromDocContentRB
Definition: swuiidxmrk.hxx:184
std::unique_ptr< weld::Label > m_xLevelFT
Definition: swuiidxmrk.hxx:78
std::unique_ptr< weld::Label > m_xPhoneticFT0
Definition: swuiidxmrk.hxx:68
void UpdateLanguageDependenciesForPhoneticReading()
Definition: swuiidxmrk.cxx:299
bool IsTOXType(const OUString &rName)
Definition: swuiidxmrk.hxx:134
std::unique_ptr< weld::Label > m_xTitleFI
Definition: swuiidxmrk.hxx:186
std::unique_ptr< weld::Label > m_xAuthorFI
Definition: swuiidxmrk.hxx:185
void ReInitDlg(SwWrtShell &rWrtShell)
Definition: swuiidxmrk.cxx:966
std::unique_ptr< weld::SpinButton > m_xLevelNF
Definition: swuiidxmrk.hxx:79
std::unique_ptr< weld::Entry > m_xEntryED
Definition: swuiidxmrk.hxx:66
std::unique_ptr< weld::Label > m_xPhoneticFT1
Definition: swuiidxmrk.hxx:72
SwAuthMarkFloatDlg(SfxBindings *pBindings, SfxChildWindow *pChild, weld::Window *pParent, SfxChildWinInfo const *pInfo, bool bNew)
virtual short int run() override
Definition: swuiidxmrk.cxx:984
std::unique_ptr< weld::RadioButton > m_xFromComponentRB
Definition: swuiidxmrk.hxx:183
DECL_LINK(InsertHdl, weld::Button &, void)
OUString m_aOrgStr
Definition: swuiidxmrk.hxx:46
void ReInitDlg(SwWrtShell &rWrtShell)
OUString m_sCreatedEntry[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:179
SwWrtShell * m_pSh
Definition: swuiidxmrk.hxx:61
SwAuthorMarkPane m_aContent
Definition: swuiidxmrk.hxx:226
Used by the UI to modify the document model.
Definition: wrtsh.hxx:86
std::unique_ptr< SwTOXMgr > m_pTOXMgr
Definition: swuiidxmrk.hxx:60
OUString m_sFields[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:177
std::unique_ptr< weld::ComboBox > m_xKey2DCB
Definition: swuiidxmrk.hxx:75
void ReInitDlg(SwWrtShell &rWrtShell)
std::unique_ptr< weld::Button > m_xNextSameBT
Definition: swuiidxmrk.hxx:88
std::unique_ptr< weld::Button > m_xOKBT
Definition: swuiidxmrk.hxx:84
std::unique_ptr< weld::ComboBox > m_xEntryLB
Definition: swuiidxmrk.hxx:188
std::unique_ptr< weld::CheckButton > m_xSearchCaseWordOnlyCB
Definition: swuiidxmrk.hxx:83
std::unique_ptr< weld::Button > m_xPrevSameBT
Definition: swuiidxmrk.hxx:87
SwWrtShell * pSh
Definition: swuiidxmrk.hxx:174
bool m_bPhoneticED0_ChangedByUser
Definition: swuiidxmrk.hxx:51
std::unique_ptr< weld::Label > m_xKey2FT
Definition: swuiidxmrk.hxx:74
SwIndexMarkModalDlg(weld::Window *pParent, SwWrtShell &rSh, SwTOXMark const *pCurTOXMark)
Definition: swuiidxmrk.cxx:971
SwAuthorMarkPane m_aContent
Definition: swuiidxmrk.hxx:213
static bool bIsFromComponent
Definition: swuiidxmrk.hxx:166
std::unique_ptr< weld::Button > m_xActionBT
Definition: swuiidxmrk.hxx:189
weld::DialogController & m_rDialog
Definition: swuiidxmrk.hxx:164
virtual short int run() override
bool m_bPhoneticED2_ChangedByUser
Definition: swuiidxmrk.hxx:53
void ReInitDlg(SwWrtShell &rWrtShell, SwTOXMark const *pCurTOXMark=nullptr)
Definition: swuiidxmrk.cxx:933
OUString m_sColumnTitles[AUTH_FIELD_END]
Definition: swuiidxmrk.hxx:176
std::unique_ptr< weld::CheckButton > m_xSearchCaseSensitiveCB
Definition: swuiidxmrk.hxx:82
bool const m_bNewMark
Definition: swuiidxmrk.hxx:48
std::unique_ptr< weld::Button > m_xNewBT
Definition: swuiidxmrk.hxx:65
bool const bNewEntry
Definition: swuiidxmrk.hxx:171
LanguageType m_nLangForPhoneticReading
Definition: swuiidxmrk.hxx:54
std::unique_ptr< weld::CheckButton > m_xApplyToAllCB
Definition: swuiidxmrk.hxx:81
std::unique_ptr< weld::Label > m_xKey1FT
Definition: swuiidxmrk.hxx:70
std::shared_ptr< weld::Dialog > m_xDialog
Definition: swuiidxmrk.hxx:41
std::unique_ptr< weld::Button > m_xPrevBT
Definition: swuiidxmrk.hxx:89
std::unique_ptr< weld::Button > m_xEditEntryPB
Definition: swuiidxmrk.hxx:192
std::unique_ptr< weld::Entry > m_xPhoneticED1
Definition: swuiidxmrk.hxx:73
std::unique_ptr< weld::ComboBox > m_xTypeDCB
Definition: swuiidxmrk.hxx:64
bool m_bPhoneticED1_ChangedByUser
Definition: swuiidxmrk.hxx:52
std::unique_ptr< weld::Button > m_xDelBT
Definition: swuiidxmrk.hxx:86
std::unique_ptr< weld::Button > m_xCloseBT
Definition: swuiidxmrk.hxx:190
std::unique_ptr< weld::Entry > m_xPhoneticED0
Definition: swuiidxmrk.hxx:69
virtual void Activate() override
Definition: swuiidxmrk.cxx:960
DECL_LINK(InsertHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xSyncED
Definition: swuiidxmrk.hxx:67
css::uno::Reference< css::container::XNameAccess > xBibAccess
Definition: swuiidxmrk.hxx:181
SwAuthMarkModalDlg(weld::Window *pParent, SwWrtShell &rSh)
SwIndexMarkFloatDlg(SfxBindings *pBindings, SfxChildWindow *pChild, weld::Window *pParent, SfxChildWinInfo const *pInfo, bool bNew)
Definition: swuiidxmrk.cxx:949
std::unique_ptr< weld::ComboBox > m_xKey1DCB
Definition: swuiidxmrk.hxx:71
SwAuthorMarkPane(weld::DialogController &rDialog, weld::Builder &rBuilder, bool bNew)
std::unique_ptr< weld::CheckButton > m_xMainEntryCB
Definition: swuiidxmrk.hxx:80
std::unique_ptr< weld::Label > m_xPhoneticFT2
Definition: swuiidxmrk.hxx:76
css::uno::Reference< css::i18n::XExtendedIndexEntrySupplier > m_xExtendedIndexEntrySupplier
Definition: swuiidxmrk.hxx:57
virtual void Activate() override
std::unique_ptr< weld::Button > m_xNextBT
Definition: swuiidxmrk.hxx:90
SwIndexMarkPane(const std::shared_ptr< weld::Dialog > &rDialog, weld::Builder &rBuilder, bool bNewDlg, SwWrtShell &rWrtShell)
Definition: swuiidxmrk.cxx:78
SwIndexMarkPane m_aContent
Definition: swuiidxmrk.hxx:153
virtual ~SwIndexMarkModalDlg() override
Definition: swuiidxmrk.cxx:979
OUString GetDefaultPhoneticReading(const OUString &rText)
Definition: swuiidxmrk.cxx:346
void ModifyHdl(const weld::Widget &rWidget)
Definition: swuiidxmrk.cxx:638
std::unique_ptr< weld::Button > m_xCreateEntryPB
Definition: swuiidxmrk.hxx:191
void UpdateKeyBoxes()
Definition: swuiidxmrk.cxx:542
std::unique_ptr< weld::Button > m_xCloseBT
Definition: swuiidxmrk.hxx:85
std::unique_ptr< weld::Entry > m_xEntryED
Definition: swuiidxmrk.hxx:187
SwIndexMarkPane m_aContent
Definition: swuiidxmrk.hxx:139
std::unique_ptr< weld::Entry > m_xPhoneticED2
Definition: swuiidxmrk.hxx:77
bool m_bIsPhoneticReadingEnabled
Definition: swuiidxmrk.hxx:55