1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
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>
34 // insert mark for index entry
35 class SwIndexMarkFloatDlg
;
36 class SwIndexMarkModalDlg
;
40 std::shared_ptr
<weld::Dialog
> m_xDialog
;
42 friend class SwIndexMarkFloatDlg
;
43 friend class SwIndexMarkModalDlg
;
47 bool const m_bNewMark
;
50 bool m_bPhoneticED0_ChangedByUser
;
51 bool m_bPhoneticED1_ChangedByUser
;
52 bool m_bPhoneticED2_ChangedByUser
;
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
>
56 m_xExtendedIndexEntrySupplier
;
58 std::unique_ptr
<SwTOXMgr
>
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 std::unique_ptr
<weld::Label
> m_xForSelectedEntry
;
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::Toggleable
&, void );
111 DECL_LINK( PhoneticEDModifyHdl
, weld::Entry
&, void );
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)
116 void UpdateLanguageDependenciesForPhoneticReading();
117 OUString
GetDefaultPhoneticReading( const OUString
& rText
);
119 void UpdateKeyBoxes();
128 SwIndexMarkPane(std::shared_ptr
<weld::Dialog
> xDialog
, weld::Builder
& rBuilder
,
129 bool bNewDlg
, SwWrtShell
* pWrtShell
);
133 void ReInitDlg(SwWrtShell
& rWrtShell
, SwTOXMark
const * pCurTOXMark
= nullptr);
134 bool IsTOXType(const OUString
& rName
) { return m_xTypeDCB
->find_text(rName
) != -1; }
137 class SwIndexMarkFloatDlg final
: public SfxModelessDialogController
139 SwIndexMarkPane m_aContent
;
141 virtual void Activate() override
;
143 SwIndexMarkFloatDlg(SfxBindings
* pBindings
,
144 SfxChildWindow
* pChild
,
145 weld::Window
*pParent
,
146 SfxChildWinInfo
const * pInfo
,
148 void ReInitDlg(SwWrtShell
& rWrtShell
);
151 class SwIndexMarkModalDlg final
: public SfxDialogController
153 SwIndexMarkPane m_aContent
;
155 SwIndexMarkModalDlg(weld::Window
*pParent
, SwWrtShell
& rSh
, SwTOXMark
const * pCurTOXMark
);
156 virtual ~SwIndexMarkModalDlg() override
;
157 virtual short int run() override
;
160 class SwAuthMarkModalDlg
;
162 class SwAuthorMarkPane
164 weld::DialogController
& m_rDialog
;
166 static bool s_bIsFromComponent
;
168 friend class SwAuthMarkModalDlg
;
169 friend class SwAuthMarkFloatDlg
;
172 bool m_bBibAccessInitialized
;
176 OUString m_sColumnTitles
[AUTH_FIELD_END
];
177 OUString m_sFields
[AUTH_FIELD_END
];
179 OUString m_sCreatedEntry
[AUTH_FIELD_END
];
181 css::uno::Reference
< css::container::XNameAccess
> m_xBibAccess
;
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
;
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::Toggleable
&, void);
199 DECL_LINK(IsEditAllowedHdl
, weld::Entry
&, bool);
200 DECL_LINK(IsEntryAllowedHdl
, weld::Entry
&, bool);
201 DECL_LINK(EditModifyHdl
, weld::Entry
&, void);
207 SwAuthorMarkPane(weld::DialogController
& rDialog
, weld::Builder
& rBuilder
, bool bNew
);
208 void ReInitDlg(SwWrtShell
& rWrtShell
);
211 class SwAuthMarkFloatDlg final
: public SfxModelessDialogController
213 SwAuthorMarkPane m_aContent
;
214 virtual void Activate() override
;
216 SwAuthMarkFloatDlg(SfxBindings
* pBindings
,
217 SfxChildWindow
* pChild
,
218 weld::Window
*pParent
,
219 SfxChildWinInfo
const * pInfo
,
221 void ReInitDlg(SwWrtShell
& rWrtShell
);
224 class SwAuthMarkModalDlg final
: public SfxDialogController
226 SwAuthorMarkPane m_aContent
;
230 SwAuthMarkModalDlg(weld::Window
*pParent
, SwWrtShell
& rSh
);
231 virtual short int run() override
;
234 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */