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