/src/libreoffice/svx/source/dialog/srchdlg.cxx
Line | Count | Source |
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 | | #include <osl/diagnose.h> |
21 | | #include <vcl/timer.hxx> |
22 | | #include <svl/slstitm.hxx> |
23 | | #include <svl/itemiter.hxx> |
24 | | #include <svl/style.hxx> |
25 | | #include <svl/whiter.hxx> |
26 | | #include <unotools/intlwrapper.hxx> |
27 | | #include <unotools/moduleoptions.hxx> |
28 | | #include <unotools/searchopt.hxx> |
29 | | #include <unotools/syslocale.hxx> |
30 | | #include <sfx2/dispatch.hxx> |
31 | | #include <sfx2/objsh.hxx> |
32 | | #include <sfx2/module.hxx> |
33 | | #include <sfx2/viewsh.hxx> |
34 | | #include <sfx2/basedlgs.hxx> |
35 | | #include <sfx2/viewfrm.hxx> |
36 | | #include <svl/cjkoptions.hxx> |
37 | | #include <svl/ctloptions.hxx> |
38 | | #include <com/sun/star/awt/XWindow.hpp> |
39 | | #include <com/sun/star/container/XNameAccess.hpp> |
40 | | #include <com/sun/star/frame/XDispatch.hpp> |
41 | | #include <com/sun/star/frame/XDispatchProvider.hpp> |
42 | | #include <com/sun/star/frame/XLayoutManager.hpp> |
43 | | #include <com/sun/star/beans/PropertyValue.hpp> |
44 | | #include <com/sun/star/beans/XPropertySet.hpp> |
45 | | #include <com/sun/star/configuration/theDefaultProvider.hpp> |
46 | | #include <com/sun/star/frame/ModuleManager.hpp> |
47 | | #include <com/sun/star/ui/XUIElement.hpp> |
48 | | #include <comphelper/processfactory.hxx> |
49 | | #include <comphelper/scopeguard.hxx> |
50 | | #include <svl/itempool.hxx> |
51 | | |
52 | | #include <sfx2/app.hxx> |
53 | | #include <toolkit/helper/vclunohelper.hxx> |
54 | | |
55 | | #include <svx/srchdlg.hxx> |
56 | | #include <svx/strarray.hxx> |
57 | | |
58 | | #include <svx/strings.hrc> |
59 | | #include <svx/svxids.hrc> |
60 | | |
61 | | #include <svl/srchitem.hxx> |
62 | | #include <svx/pageitem.hxx> |
63 | | #include "srchctrl.hxx" |
64 | | #include <svx/dialmgr.hxx> |
65 | | #include <editeng/brushitem.hxx> |
66 | | #include <tools/resary.hxx> |
67 | | #include <svx/svxdlg.hxx> |
68 | | #include <vcl/toolbox.hxx> |
69 | | #include <o3tl/typed_flags_set.hxx> |
70 | | #include <comphelper/lok.hxx> |
71 | | |
72 | | #include <cstdlib> |
73 | | #include <memory> |
74 | | |
75 | | #include <findtextfield.hxx> |
76 | | |
77 | | #include <svx/labelitemwindow.hxx> |
78 | | #include <svx/xdef.hxx> |
79 | | #include <officecfg/Office/Common.hxx> |
80 | | |
81 | | using namespace com::sun::star::uno; |
82 | | using namespace com::sun::star; |
83 | | using namespace comphelper; |
84 | | |
85 | | |
86 | | static bool IsMobile() |
87 | 0 | { |
88 | 0 | if (!comphelper::LibreOfficeKit::isActive()) |
89 | 0 | return false; |
90 | 0 | SfxViewShell* pCurrent = SfxViewShell::Current(); |
91 | 0 | return pCurrent && pCurrent->isLOKMobilePhone(); |
92 | 0 | } |
93 | | |
94 | | enum class ModifyFlags { |
95 | | NONE = 0x000000, |
96 | | Search = 0x000001, |
97 | | Replace = 0x000002, |
98 | | Word = 0x000004, |
99 | | Exact = 0x000008, |
100 | | Backwards = 0x000010, |
101 | | Selection = 0x000020, |
102 | | Regexp = 0x000040, |
103 | | Layout = 0x000080, |
104 | | Similarity = 0x000100, |
105 | | Formulas = 0x000200, |
106 | | Values = 0x000400, |
107 | | CalcNotes = 0x000800, |
108 | | Rows = 0x001000, |
109 | | Columns = 0x002000, |
110 | | AllTables = 0x004000, |
111 | | Notes = 0x008000, |
112 | | Wildcard = 0x010000 |
113 | | }; |
114 | | namespace o3tl { |
115 | | template<> struct typed_flags<ModifyFlags> : is_typed_flags<ModifyFlags, 0x01ffff> {}; |
116 | | } |
117 | | |
118 | | namespace |
119 | | { |
120 | | bool GetCheckBoxValue(const weld::CheckButton& rBox) |
121 | 0 | { |
122 | 0 | return rBox.get_sensitive() && rBox.get_active(); |
123 | 0 | } |
124 | | |
125 | | bool GetNegatedCheckBoxValue(const weld::CheckButton& rBox) |
126 | 0 | { |
127 | 0 | return rBox.get_sensitive() && !rBox.get_active(); |
128 | 0 | } |
129 | | } |
130 | | |
131 | | struct SearchDlg_Impl |
132 | | { |
133 | | bool bSaveToModule : 1, |
134 | | bFocusOnSearch : 1; |
135 | | WhichRangesContainer pRanges; |
136 | | Timer aSelectionTimer { "svx SearchDlg_Impl aSelectionTimer" }; |
137 | | |
138 | | uno::Reference< frame::XDispatch > xCommand1Dispatch; |
139 | | uno::Reference< frame::XDispatch > xCommand2Dispatch; |
140 | | util::URL aCommand1URL; |
141 | | util::URL aCommand2URL; |
142 | | |
143 | | SearchDlg_Impl() |
144 | 0 | : bSaveToModule(true) |
145 | 0 | , bFocusOnSearch(true) |
146 | 0 | { |
147 | 0 | aCommand1URL.Complete = aCommand1URL.Main = "vnd.sun.search:SearchViaComponent1"; |
148 | 0 | aCommand1URL.Protocol = "vnd.sun.search:"; |
149 | 0 | aCommand1URL.Path = "SearchViaComponent1"; |
150 | 0 | aCommand2URL.Complete = aCommand2URL.Main = "vnd.sun.search:SearchViaComponent2"; |
151 | 0 | aCommand2URL.Protocol = "vnd.sun.search:"; |
152 | 0 | aCommand2URL.Path = "SearchViaComponent2"; |
153 | 0 | } |
154 | | }; |
155 | | |
156 | | static void ListToStrArr_Impl(sal_uInt16 nId, std::vector<OUString>& rStrLst, weld::ComboBox& rCBox, sal_uInt16 nRememberSize) |
157 | 0 | { |
158 | 0 | const SfxStringListItem* pSrchItem = |
159 | 0 | static_cast<const SfxStringListItem*>(SfxGetpApp()->GetItem( nId )); |
160 | |
|
161 | 0 | if (!pSrchItem) |
162 | 0 | return; |
163 | | |
164 | 0 | std::vector<OUString> aLst = pSrchItem->GetList(); |
165 | |
|
166 | 0 | if (aLst.size() > nRememberSize) |
167 | 0 | aLst.resize(nRememberSize); |
168 | |
|
169 | 0 | for (const OUString & s : aLst) |
170 | 0 | { |
171 | 0 | rStrLst.push_back(s); |
172 | 0 | rCBox.append_text(s); |
173 | 0 | } |
174 | 0 | } |
175 | | |
176 | | static void StrArrToList_Impl( TypedWhichId<SfxStringListItem> nId, const std::vector<OUString>& rStrLst ) |
177 | 0 | { |
178 | 0 | DBG_ASSERT( !rStrLst.empty(), "check in advance"); |
179 | 0 | SfxGetpApp()->PutItem( SfxStringListItem( nId, &rStrLst ) ); |
180 | 0 | } |
181 | | |
182 | | SearchAttrItemList::SearchAttrItemList( SearchAttrItemList&& rList ) noexcept : |
183 | 0 | SrchAttrInfoList(std::move(rList)) |
184 | 0 | { |
185 | 0 | } |
186 | | |
187 | | SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) : |
188 | 0 | SrchAttrInfoList(rList) |
189 | 0 | { |
190 | 0 | } |
191 | | |
192 | | SearchAttrItemList::~SearchAttrItemList() |
193 | 0 | { |
194 | 0 | Clear(); |
195 | 0 | } |
196 | | |
197 | | void SearchAttrItemList::Put( const SfxItemSet& rSet ) |
198 | 0 | { |
199 | 0 | if ( !rSet.Count() ) |
200 | 0 | return; |
201 | | |
202 | 0 | SfxItemPool* pPool = rSet.GetPool(); |
203 | |
|
204 | 0 | for (SfxItemIter aIter(rSet); !aIter.IsAtEnd(); aIter.NextItem()) |
205 | 0 | { |
206 | 0 | const sal_uInt16 nWhich(aIter.GetCurWhich()); |
207 | 0 | const sal_uInt16 nSlot(pPool->GetSlotId(nWhich)); |
208 | 0 | emplace_back(nSlot, SfxPoolItemHolder(*pPool, aIter.GetCurItem())); |
209 | 0 | } |
210 | 0 | } |
211 | | |
212 | | |
213 | | SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet ) |
214 | 0 | { |
215 | 0 | SfxItemPool* pPool = rSet.GetPool(); |
216 | |
|
217 | 0 | for ( size_t i = 0; i < size(); ++i ) |
218 | 0 | if ( IsInvalidItem( (*this)[i].aItemPtr.getItem() ) ) |
219 | 0 | rSet.InvalidateItem( pPool->GetWhichIDFromSlotID( (*this)[i].nSlot ) ); |
220 | 0 | else |
221 | 0 | rSet.Put( *(*this)[i].aItemPtr.getItem() ); |
222 | 0 | return rSet; |
223 | 0 | } |
224 | | |
225 | | |
226 | | void SearchAttrItemList::Clear() |
227 | 0 | { |
228 | 0 | SrchAttrInfoList::clear(); |
229 | 0 | } |
230 | | |
231 | | |
232 | | // Deletes the pointer to the items |
233 | | void SearchAttrItemList::Remove(size_t nPos) |
234 | 0 | { |
235 | 0 | size_t nLen = 1; |
236 | 0 | if ( nPos + nLen > size() ) |
237 | 0 | nLen = size() - nPos; |
238 | |
|
239 | 0 | SrchAttrInfoList::erase( begin() + nPos, begin() + nPos + nLen ); |
240 | 0 | } |
241 | | |
242 | | SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind) |
243 | 0 | : SfxModelessDialogController(&rBind, pChildWin, pParent, |
244 | 0 | IsMobile() ? u"svx/ui/findreplacedialog-mobile.ui"_ustr : u"svx/ui/findreplacedialog.ui"_ustr, |
245 | 0 | u"FindReplaceDialog"_ustr) |
246 | 0 | , m_rBindings(rBind) |
247 | 0 | , m_aPresentIdle("Bring SvxSearchDialog to Foreground") |
248 | 0 | , m_bWriter(false) |
249 | 0 | , m_bSearch(true) |
250 | 0 | , m_bFormat(false) |
251 | 0 | , m_bReplaceBackwards(false) |
252 | 0 | , m_nOptions(SearchOptionFlags::ALL) |
253 | 0 | , m_bSet(false) |
254 | 0 | , m_bConstruct(true) |
255 | 0 | , m_nModifyFlag(ModifyFlags::NONE) |
256 | 0 | , m_pReplaceList(new SearchAttrItemList) |
257 | 0 | , m_nTransliterationFlags(TransliterationFlags::NONE) |
258 | 0 | , m_xSearchFrame(m_xBuilder->weld_frame(u"searchframe"_ustr)) |
259 | 0 | , m_xSearchLB(m_xBuilder->weld_combo_box(u"searchterm"_ustr)) |
260 | 0 | , m_xSearchTmplLB(m_xBuilder->weld_combo_box(u"searchlist"_ustr)) |
261 | 0 | , m_xSearchAttrText(m_xBuilder->weld_label(u"searchdesc"_ustr)) |
262 | 0 | , m_xSearchLabel(m_xBuilder->weld_label(u"searchlabel"_ustr)) |
263 | 0 | , m_xSearchIcon(m_xBuilder->weld_image(u"searchicon"_ustr)) |
264 | 0 | , m_xSearchBox(m_xBuilder->weld_container(u"searchbox"_ustr)) |
265 | 0 | , m_xReplaceFrame(m_xBuilder->weld_frame(u"replaceframe"_ustr)) |
266 | 0 | , m_xReplaceLB(m_xBuilder->weld_combo_box(u"replaceterm"_ustr)) |
267 | 0 | , m_xReplaceTmplLB(m_xBuilder->weld_combo_box(u"replacelist"_ustr)) |
268 | 0 | , m_xReplaceAttrText(m_xBuilder->weld_label(u"replacedesc"_ustr)) |
269 | 0 | , m_xSearchBtn(m_xBuilder->weld_button(u"search"_ustr)) |
270 | 0 | , m_xBackSearchBtn(m_xBuilder->weld_button(u"backsearch"_ustr)) |
271 | 0 | , m_xSearchAllBtn(m_xBuilder->weld_button(u"searchall"_ustr)) |
272 | 0 | , m_xReplaceBtn(m_xBuilder->weld_button(u"replace"_ustr)) |
273 | 0 | , m_xReplaceAllBtn(m_xBuilder->weld_button(u"replaceall"_ustr)) |
274 | 0 | , m_xComponentFrame(m_xBuilder->weld_frame(u"componentframe"_ustr)) |
275 | 0 | , m_xSearchComponent1PB(m_xBuilder->weld_button(u"component1"_ustr)) |
276 | 0 | , m_xSearchComponent2PB(m_xBuilder->weld_button(u"component2"_ustr)) |
277 | 0 | , m_xMatchCaseCB(m_xBuilder->weld_check_button(u"matchcase"_ustr)) |
278 | 0 | , m_xSearchFormattedCB(m_xBuilder->weld_check_button(u"searchformatted"_ustr)) |
279 | 0 | , m_xWordBtn(m_xBuilder->weld_check_button(u"wholewords"_ustr)) |
280 | 0 | , m_xCloseBtn(m_xBuilder->weld_button(u"close"_ustr)) |
281 | 0 | , m_xHelpBtn(m_xBuilder->weld_button(u"help"_ustr)) |
282 | 0 | , m_xIncludeDiacritics(m_xBuilder->weld_check_button(u"includediacritics"_ustr)) |
283 | 0 | , m_xIncludeKashida(m_xBuilder->weld_check_button(u"includekashida"_ustr)) |
284 | 0 | , m_xOtherOptionsExpander(m_xBuilder->weld_expander(u"OptionsExpander"_ustr)) |
285 | 0 | , m_xSelectionBtn(m_xBuilder->weld_check_button(u"selection"_ustr)) |
286 | 0 | , m_xRegExpBtn(m_xBuilder->weld_check_button(u"regexp"_ustr)) |
287 | 0 | , m_xWildcardBtn(m_xBuilder->weld_check_button(u"wildcard"_ustr)) |
288 | 0 | , m_xSimilarityBox(m_xBuilder->weld_check_button(u"similarity"_ustr)) |
289 | 0 | , m_xSimilarityBtn(m_xBuilder->weld_button(u"similaritybtn"_ustr)) |
290 | 0 | , m_xLayoutBtn(m_xBuilder->weld_check_button(u"layout"_ustr)) |
291 | 0 | , m_xNotesBtn(m_xBuilder->weld_check_button(u"notes"_ustr)) |
292 | 0 | , m_xJapMatchFullHalfWidthCB(m_xBuilder->weld_check_button(u"matchcharwidth"_ustr)) |
293 | 0 | , m_xJapOptionsCB(m_xBuilder->weld_check_button(u"soundslike"_ustr)) |
294 | 0 | , m_xReplaceBackwardsCB(m_xBuilder->weld_check_button(u"replace_backwards"_ustr)) |
295 | 0 | , m_xJapOptionsBtn(m_xBuilder->weld_button(u"soundslikebtn"_ustr)) |
296 | 0 | , m_xAttributeBtn(m_xBuilder->weld_button(u"attributes"_ustr)) |
297 | 0 | , m_xFormatBtn(m_xBuilder->weld_button(u"format"_ustr)) |
298 | 0 | , m_xNoFormatBtn(m_xBuilder->weld_button(u"noformat"_ustr)) |
299 | 0 | , m_xCalcGrid(m_xBuilder->weld_widget(u"calcgrid"_ustr)) |
300 | 0 | , m_xCalcSearchInFT(m_xBuilder->weld_label(u"searchinlabel"_ustr)) |
301 | 0 | , m_xCalcSearchInLB(m_xBuilder->weld_combo_box(u"calcsearchin"_ustr)) |
302 | 0 | , m_xCalcSearchDirFT(m_xBuilder->weld_label(u"searchdir"_ustr)) |
303 | 0 | , m_xRowsBtn(m_xBuilder->weld_radio_button(u"rows"_ustr)) |
304 | 0 | , m_xColumnsBtn(m_xBuilder->weld_radio_button(u"cols"_ustr)) |
305 | 0 | , m_xAllSheetsCB(m_xBuilder->weld_check_button(u"allsheets"_ustr)) |
306 | 0 | , m_xCalcStrFT(m_xBuilder->weld_label(u"entirecells"_ustr)) |
307 | 0 | { |
308 | 0 | if (comphelper::LibreOfficeKit::isActive()) |
309 | 0 | { |
310 | 0 | m_xCloseBtn->hide(); |
311 | 0 | m_xHelpBtn->hide(); |
312 | 0 | m_xSearchLB->set_entry_text(u""_ustr); |
313 | 0 | m_xReplaceLB->set_entry_text(u""_ustr); |
314 | 0 | } |
315 | |
|
316 | 0 | m_aPresentIdle.SetTimeout(50); |
317 | 0 | m_aPresentIdle.SetInvokeHandler(LINK(this, SvxSearchDialog, PresentTimeoutHdl_Impl)); |
318 | |
|
319 | 0 | m_xSearchTmplLB->make_sorted(); |
320 | 0 | m_xSearchAttrText->hide(); |
321 | |
|
322 | 0 | this->SetSearchLabel(u""_ustr); // hide the message but keep the box height |
323 | | |
324 | | //weird findreplacedialog-mobile.ui case doesn't have searchicon or searchbox |
325 | 0 | if (m_xSearchIcon) |
326 | 0 | m_xSearchIcon->set_size_request(24, 24); // vcl/res/infobar.png is 32x32 - too large here |
327 | |
|
328 | 0 | m_xReplaceTmplLB->make_sorted(); |
329 | 0 | m_xReplaceAttrText->hide(); |
330 | |
|
331 | 0 | m_sCalcStr = m_xCalcStrFT->get_label(); |
332 | | |
333 | | // m_xSimilarityBtn->set_height_request(m_xSimilarityBox->get_preferred_size().Height()); |
334 | | // m_xJapOptionsBtn->set_height_request(m_xJapOptionsCB->get_preferred_size().Height()); |
335 | | |
336 | | //tdf#122322 |
337 | 0 | m_nRememberSize = officecfg::Office::Common::Misc::FindReplaceRememberedSearches::get(); |
338 | 0 | if (m_nRememberSize < 1) |
339 | 0 | m_nRememberSize = 1; //0 crashes with no results found |
340 | |
|
341 | 0 | auto nTermWidth = m_xSearchLB->get_approximate_digit_width() * 28; |
342 | 0 | m_xSearchLB->set_size_request(nTermWidth, -1); |
343 | 0 | m_xSearchTmplLB->set_size_request(nTermWidth, -1); |
344 | 0 | m_xReplaceLB->set_size_request(nTermWidth, -1); |
345 | 0 | m_xReplaceTmplLB->set_size_request(nTermWidth, -1); |
346 | |
|
347 | 0 | Construct_Impl(); |
348 | 0 | } |
349 | | |
350 | | IMPL_LINK_NOARG(SvxSearchDialog, PresentTimeoutHdl_Impl, Timer*, void) |
351 | 0 | { |
352 | 0 | getDialog()->present(); |
353 | 0 | } |
354 | | |
355 | | void SvxSearchDialog::Present() |
356 | 0 | { |
357 | 0 | PresentTimeoutHdl_Impl(nullptr); |
358 | | // tdf#133807 try again in a short timeout |
359 | 0 | m_aPresentIdle.Start(); |
360 | 0 | } |
361 | | |
362 | | void SvxSearchDialog::SetSearchLBEntryTextAndGrabFocus(const OUString& rStr) |
363 | 0 | { |
364 | 0 | m_xSearchLB->set_entry_text(rStr); |
365 | 0 | m_xSearchLB->grab_focus(); |
366 | 0 | } |
367 | | |
368 | | void SvxSearchDialog::ChildWinDispose() |
369 | 0 | { |
370 | 0 | m_rBindings.EnterRegistrations(); |
371 | 0 | m_pSearchController.reset(); |
372 | 0 | m_pOptionsController.reset(); |
373 | 0 | m_pFamilyController.reset(); |
374 | 0 | m_rBindings.LeaveRegistrations(); |
375 | 0 | SfxModelessDialogController::ChildWinDispose(); |
376 | 0 | } |
377 | | |
378 | | SvxSearchDialog::~SvxSearchDialog() |
379 | 0 | { |
380 | 0 | m_aPresentIdle.Stop(); |
381 | 0 | m_pSearchItem.reset(); |
382 | 0 | m_pImpl.reset(); |
383 | 0 | } |
384 | | |
385 | | void SvxSearchDialog::Construct_Impl() |
386 | 0 | { |
387 | 0 | m_pImpl.reset(new SearchDlg_Impl()); |
388 | 0 | m_pImpl->aSelectionTimer.SetTimeout(500); |
389 | 0 | m_pImpl->aSelectionTimer.SetInvokeHandler(LINK(this, SvxSearchDialog, TimeoutHdl_Impl)); |
390 | 0 | EnableControls_Impl( SearchOptionFlags::NONE ); |
391 | | |
392 | | // Store old Text from m_xWordBtn |
393 | 0 | m_sCalcStr += "#"; |
394 | 0 | m_sCalcStr += m_xWordBtn->get_label(); |
395 | |
|
396 | 0 | m_sLayoutStr = SvxResId(RID_SVXSTR_SEARCH_STYLES); |
397 | 0 | m_sLayoutWriterStr = SvxResId(RID_SVXSTR_WRITER_STYLES); |
398 | 0 | m_sLayoutCalcStr = SvxResId(RID_SVXSTR_CALC_STYLES); |
399 | 0 | m_sStylesStr = m_xLayoutBtn->get_label(); |
400 | | |
401 | | // Get stored search-strings from the application |
402 | 0 | ListToStrArr_Impl(SID_SEARCHDLG_SEARCHSTRINGS, m_aSearchStrings, *m_xSearchLB, m_nRememberSize); |
403 | 0 | ListToStrArr_Impl(SID_SEARCHDLG_REPLACESTRINGS, m_aReplaceStrings, *m_xReplaceLB, |
404 | 0 | m_nRememberSize); |
405 | |
|
406 | 0 | InitControls_Impl(); |
407 | | |
408 | | // Get attribute sets only once in constructor() |
409 | 0 | const SfxPoolItem* ppArgs[] = { m_pSearchItem.get(), nullptr }; |
410 | 0 | SfxPoolItemHolder aResult( |
411 | 0 | m_rBindings.GetDispatcher()->Execute(FID_SEARCH_SEARCHSET, SfxCallMode::SLOT, ppArgs)); |
412 | 0 | const SvxSetItem* pSrchSetItem(static_cast<const SvxSetItem*>(aResult.getItem())); |
413 | |
|
414 | 0 | if ( pSrchSetItem ) |
415 | 0 | InitAttrList_Impl( &pSrchSetItem->GetItemSet(), nullptr ); |
416 | |
|
417 | 0 | aResult |
418 | 0 | = m_rBindings.GetDispatcher()->Execute(FID_SEARCH_REPLACESET, SfxCallMode::SLOT, ppArgs); |
419 | 0 | const SvxSetItem* pReplSetItem(static_cast<const SvxSetItem*>(aResult.getItem())); |
420 | |
|
421 | 0 | if ( pReplSetItem ) |
422 | 0 | InitAttrList_Impl( nullptr, &pReplSetItem->GetItemSet() ); |
423 | | |
424 | | // Create controller and update at once |
425 | 0 | m_rBindings.EnterRegistrations(); |
426 | 0 | m_pSearchController.reset(new SvxSearchController(SID_SEARCH_ITEM, m_rBindings, *this)); |
427 | 0 | m_pOptionsController.reset(new SvxSearchController(SID_SEARCH_OPTIONS, m_rBindings, *this)); |
428 | 0 | m_rBindings.LeaveRegistrations(); |
429 | 0 | m_rBindings.GetDispatcher()->Execute(FID_SEARCH_ON, SfxCallMode::SLOT, ppArgs); |
430 | 0 | m_pImpl->aSelectionTimer.Start(); |
431 | |
|
432 | 0 | if(!SvtCJKOptions::IsJapaneseFindEnabled()) |
433 | 0 | { |
434 | 0 | m_xJapOptionsCB->set_active( false ); |
435 | 0 | m_xJapOptionsCB->hide(); |
436 | 0 | m_xJapOptionsBtn->hide(); |
437 | 0 | } |
438 | 0 | if(!SvtCJKOptions::IsCJKFontEnabled()) |
439 | 0 | { |
440 | 0 | m_xJapMatchFullHalfWidthCB->hide(); |
441 | 0 | } |
442 | | // Do not disable and hide the m_xIncludeDiacritics button. |
443 | | // Include Diacritics == Not Ignore Diacritics => A does not match A-Umlaut (Diaeresis). |
444 | | // Confusingly these have negated names (following the UI) but the actual |
445 | | // transliteration is to *ignore* diacritics if "included" (sensitive) is |
446 | | // _not_ checked. |
447 | 0 | if(!SvtCTLOptions::IsCTLFontEnabled()) |
448 | 0 | { |
449 | 0 | m_xIncludeDiacritics->set_active( true ); |
450 | 0 | m_xIncludeKashida->set_active( true ); |
451 | 0 | m_xIncludeKashida->hide(); |
452 | 0 | } |
453 | | //component extension - show component search buttons if the commands |
454 | | // vnd.sun.star::SearchViaComponent1 and 2 are supported |
455 | 0 | const uno::Reference<frame::XFrame> xFrame = m_rBindings.GetActiveFrame(); |
456 | 0 | const uno::Reference< frame::XDispatchProvider > xDispatchProv(xFrame, uno::UNO_QUERY); |
457 | |
|
458 | 0 | bool bSearchComponent1 = false; |
459 | 0 | bool bSearchComponent2 = false; |
460 | 0 | if(xDispatchProv.is()) |
461 | 0 | { |
462 | 0 | OUString sTarget(u"_self"_ustr); |
463 | 0 | m_pImpl->xCommand1Dispatch |
464 | 0 | = xDispatchProv->queryDispatch(m_pImpl->aCommand1URL, sTarget, 0); |
465 | 0 | if (m_pImpl->xCommand1Dispatch.is()) |
466 | 0 | bSearchComponent1 = true; |
467 | 0 | m_pImpl->xCommand2Dispatch |
468 | 0 | = xDispatchProv->queryDispatch(m_pImpl->aCommand2URL, sTarget, 0); |
469 | 0 | if (m_pImpl->xCommand2Dispatch.is()) |
470 | 0 | bSearchComponent2 = true; |
471 | 0 | } |
472 | |
|
473 | 0 | if( !(bSearchComponent1 || bSearchComponent2) ) |
474 | 0 | return; |
475 | | |
476 | 0 | try |
477 | 0 | { |
478 | 0 | uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = |
479 | 0 | configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); |
480 | 0 | uno::Sequence< uno::Any > aArgs { |
481 | 0 | Any(u"/org.openoffice.Office.Common/SearchOptions/"_ustr) }; |
482 | |
|
483 | 0 | uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments( |
484 | 0 | u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr, |
485 | 0 | aArgs); |
486 | 0 | uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY); |
487 | 0 | if(xDirectAccess.is()) |
488 | 0 | { |
489 | 0 | OUString sTemp; |
490 | 0 | uno::Any aRet = xDirectAccess->getByName(u"ComponentSearchGroupLabel"_ustr); |
491 | 0 | aRet >>= sTemp; |
492 | 0 | m_xComponentFrame->set_label(sTemp); |
493 | 0 | aRet = xDirectAccess->getByName(u"ComponentSearchCommandLabel1"_ustr); |
494 | 0 | aRet >>= sTemp; |
495 | 0 | m_xSearchComponent1PB->set_label( sTemp ); |
496 | 0 | aRet = xDirectAccess->getByName(u"ComponentSearchCommandLabel2"_ustr); |
497 | 0 | aRet >>= sTemp; |
498 | 0 | m_xSearchComponent2PB->set_label( sTemp ); |
499 | 0 | } |
500 | 0 | } |
501 | 0 | catch(uno::Exception&){} |
502 | |
|
503 | 0 | if(!m_xSearchComponent1PB->get_label().isEmpty() && bSearchComponent1 ) |
504 | 0 | { |
505 | 0 | m_xComponentFrame->show(); |
506 | 0 | m_xSearchComponent1PB->show(); |
507 | 0 | } |
508 | 0 | if( !m_xSearchComponent2PB->get_label().isEmpty() ) |
509 | 0 | { |
510 | 0 | m_xComponentFrame->show(); |
511 | 0 | m_xSearchComponent2PB->show(); |
512 | 0 | } |
513 | 0 | } |
514 | | |
515 | | void SvxSearchDialog::Close() |
516 | 0 | { |
517 | | // remember strings |
518 | 0 | if (!m_aSearchStrings.empty()) |
519 | 0 | StrArrToList_Impl(SID_SEARCHDLG_SEARCHSTRINGS, m_aSearchStrings); |
520 | |
|
521 | 0 | if (!m_aReplaceStrings.empty()) |
522 | 0 | StrArrToList_Impl(SID_SEARCHDLG_REPLACESTRINGS, m_aReplaceStrings); |
523 | | |
524 | | // save settings to configuration |
525 | 0 | SvtSearchOptions aOpt; |
526 | 0 | aOpt.SetWholeWordsOnly ( m_xWordBtn->get_active() ); |
527 | 0 | aOpt.SetBackwards ( m_xReplaceBackwardsCB->get_active() ); |
528 | 0 | aOpt.SetUseRegularExpression ( m_xRegExpBtn->get_active() ); |
529 | 0 | aOpt.SetUseWildcard ( m_xWildcardBtn->get_active() ); |
530 | 0 | aOpt.SetSearchForStyles ( m_xLayoutBtn->get_active() ); |
531 | 0 | aOpt.SetSimilaritySearch ( m_xSimilarityBox->get_active() ); |
532 | 0 | aOpt.SetUseAsianOptions ( m_xJapOptionsCB->get_active() ); |
533 | 0 | aOpt.SetNotes ( m_xNotesBtn->get_active() ); |
534 | 0 | aOpt.SetIgnoreDiacritics_CTL ( !m_xIncludeDiacritics->get_active() ); |
535 | 0 | aOpt.SetIgnoreKashida_CTL ( !m_xIncludeKashida->get_active() ); |
536 | 0 | aOpt.SetSearchFormatted ( m_xSearchFormattedCB->get_active() ); |
537 | 0 | aOpt.Commit(); |
538 | |
|
539 | 0 | if (IsClosing()) |
540 | 0 | return; |
541 | | |
542 | 0 | const SfxPoolItem* ppArgs[] = { m_pSearchItem.get(), nullptr }; |
543 | 0 | m_rBindings.GetDispatcher()->Execute(FID_SEARCH_OFF, SfxCallMode::SLOT, ppArgs); |
544 | 0 | m_rBindings.Invalidate(SID_SEARCH_DLG); |
545 | |
|
546 | 0 | SfxViewFrame* pViewFrame = SfxViewFrame::Current(); |
547 | 0 | if (pViewFrame) |
548 | 0 | pViewFrame->ToggleChildWindow(SID_SEARCH_DLG); |
549 | 0 | } |
550 | | |
551 | | TransliterationFlags SvxSearchDialog::GetTransliterationFlags() const |
552 | 0 | { |
553 | 0 | if (!m_xMatchCaseCB->get_active()) |
554 | 0 | m_nTransliterationFlags |= TransliterationFlags::IGNORE_CASE; |
555 | 0 | else |
556 | 0 | m_nTransliterationFlags &= ~TransliterationFlags::IGNORE_CASE; |
557 | 0 | if ( !m_xJapMatchFullHalfWidthCB->get_active()) |
558 | 0 | m_nTransliterationFlags |= TransliterationFlags::IGNORE_WIDTH; |
559 | 0 | else |
560 | 0 | m_nTransliterationFlags &= ~TransliterationFlags::IGNORE_WIDTH; |
561 | 0 | return m_nTransliterationFlags; |
562 | 0 | } |
563 | | |
564 | 0 | void SvxSearchDialog::SetSaveToModule(bool b) { m_pImpl->bSaveToModule = b; } |
565 | | |
566 | | void SvxSearchDialog::SetSearchLabel(const OUString& rStr) |
567 | 0 | { |
568 | 0 | m_xSearchLabel->set_label(rStr); |
569 | 0 | if (!rStr.isEmpty()) |
570 | 0 | { |
571 | 0 | m_xSearchLabel->show(); |
572 | 0 | if (m_xSearchIcon) |
573 | 0 | { |
574 | 0 | m_xSearchIcon->show(); |
575 | 0 | const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); |
576 | 0 | if (rStyleSettings.GetDialogColor().IsDark()) |
577 | 0 | m_xSearchBox->set_background(Color(0x00, 0x56, 0x80)); |
578 | 0 | else |
579 | 0 | m_xSearchBox->set_background(Color(0xBD, 0xE5, 0xF8)); // same as InfobarType::INFO |
580 | 0 | } |
581 | 0 | } |
582 | 0 | else |
583 | 0 | { |
584 | 0 | m_xSearchLabel->hide(); |
585 | 0 | if (m_xSearchIcon) |
586 | 0 | { |
587 | 0 | const Size aSize = m_xSearchBox->get_preferred_size(); |
588 | 0 | m_xSearchIcon->hide(); |
589 | 0 | m_xSearchBox->set_size_request(-1, aSize.Height()); |
590 | 0 | m_xSearchBox->set_background(COL_TRANSPARENT); |
591 | 0 | } |
592 | 0 | } |
593 | |
|
594 | 0 | if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND)) |
595 | 0 | m_xSearchLB->set_entry_message_type(weld::EntryMessageType::Error); |
596 | 0 | } |
597 | | |
598 | | void SvxSearchDialog::ApplyTransliterationFlags_Impl( TransliterationFlags nSettings ) |
599 | 0 | { |
600 | 0 | m_nTransliterationFlags = nSettings; |
601 | 0 | bool bVal(nSettings & TransliterationFlags::IGNORE_CASE); |
602 | 0 | m_xMatchCaseCB->set_active( !bVal ); |
603 | 0 | bVal = bool(nSettings & TransliterationFlags::IGNORE_WIDTH); |
604 | 0 | m_xJapMatchFullHalfWidthCB->set_active( !bVal ); |
605 | 0 | } |
606 | | |
607 | | |
608 | | bool SvxSearchDialog::IsOtherOptionsExpanded() const |
609 | 0 | { |
610 | 0 | return m_xReplaceBackwardsCB->get_active() || |
611 | 0 | m_xSelectionBtn->get_active() || |
612 | 0 | m_xRegExpBtn->get_active() || |
613 | 0 | m_xLayoutBtn->get_active() || |
614 | 0 | m_xSimilarityBox->get_active() || |
615 | 0 | m_xJapMatchFullHalfWidthCB->get_active() || |
616 | 0 | m_xJapOptionsCB->get_active() || |
617 | 0 | m_xWildcardBtn->get_active() || |
618 | 0 | m_xNotesBtn->get_active() || |
619 | 0 | m_xIncludeKashida->get_active() || |
620 | 0 | !m_xIncludeDiacritics->get_active();//tdf#138173 |
621 | 0 | } |
622 | | |
623 | | void SvxSearchDialog::Activate() |
624 | 0 | { |
625 | | // apply possible transliteration changes of the SvxSearchItem member |
626 | 0 | if (m_pSearchItem) |
627 | 0 | { |
628 | 0 | m_xMatchCaseCB->set_active(m_pSearchItem->GetExact()); |
629 | 0 | m_xJapMatchFullHalfWidthCB->set_active(!m_pSearchItem->IsMatchFullHalfWidthForms()); |
630 | 0 | } |
631 | |
|
632 | 0 | SfxModelessDialogController::Activate(); |
633 | 0 | } |
634 | | |
635 | | void SvxSearchDialog::InitControls_Impl() |
636 | 0 | { |
637 | | // CaseSensitives AutoComplete |
638 | 0 | m_xSearchLB->set_entry_completion( true, true ); |
639 | 0 | m_xSearchLB->show(); |
640 | 0 | m_xReplaceLB->set_entry_completion( true, true ); |
641 | 0 | m_xReplaceLB->show(); |
642 | |
|
643 | 0 | m_xFormatBtn->set_sensitive(false); |
644 | 0 | m_xAttributeBtn->set_sensitive(false); |
645 | |
|
646 | 0 | m_xSearchLB->connect_changed( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) ); |
647 | 0 | m_xReplaceLB->connect_changed( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) ); |
648 | |
|
649 | 0 | Link<weld::Widget&,void> aLink = LINK( this, SvxSearchDialog, FocusHdl_Impl ); |
650 | 0 | m_xSearchLB->connect_focus_in( aLink ); |
651 | 0 | m_xReplaceLB->connect_focus_in( aLink ); |
652 | |
|
653 | 0 | aLink = LINK( this, SvxSearchDialog, LoseFocusHdl_Impl ); |
654 | 0 | m_xSearchLB->connect_focus_out( aLink ); |
655 | 0 | m_xReplaceLB->connect_focus_out( aLink ); |
656 | |
|
657 | 0 | m_xSearchTmplLB->connect_focus_out( aLink ); |
658 | 0 | m_xReplaceTmplLB->connect_focus_out( aLink ); |
659 | |
|
660 | 0 | Link<weld::Button&,void> aLink2 = LINK( this, SvxSearchDialog, CommandHdl_Impl ); |
661 | 0 | m_xSearchBtn->connect_clicked( aLink2 ); |
662 | 0 | m_xBackSearchBtn->connect_clicked( aLink2 ); |
663 | 0 | m_xSearchAllBtn->connect_clicked( aLink2 ); |
664 | 0 | m_xReplaceBtn->connect_clicked( aLink2 ); |
665 | 0 | m_xReplaceAllBtn->connect_clicked( aLink2 ); |
666 | 0 | m_xCloseBtn->connect_clicked( aLink2 ); |
667 | 0 | m_xSimilarityBtn->connect_clicked( aLink2 ); |
668 | 0 | m_xJapOptionsBtn->connect_clicked( aLink2 ); |
669 | 0 | m_xSearchComponent1PB->connect_clicked( aLink2 ); |
670 | 0 | m_xSearchComponent2PB->connect_clicked( aLink2 ); |
671 | |
|
672 | 0 | Link<weld::Toggleable&,void> aLink3 = LINK( this, SvxSearchDialog, FlagHdl_Impl ); |
673 | 0 | m_xReplaceBackwardsCB->connect_toggled( aLink3 ); |
674 | 0 | m_xWordBtn->connect_toggled( aLink3 ); |
675 | 0 | m_xSelectionBtn->connect_toggled( aLink3 ); |
676 | 0 | m_xMatchCaseCB->connect_toggled( aLink3 ); |
677 | 0 | m_xRegExpBtn->connect_toggled( aLink3 ); |
678 | 0 | m_xWildcardBtn->connect_toggled( aLink3 ); |
679 | 0 | m_xNotesBtn->connect_toggled( aLink3 ); |
680 | 0 | m_xSimilarityBox->connect_toggled( aLink3 ); |
681 | 0 | m_xJapOptionsCB->connect_toggled( aLink3 ); |
682 | 0 | m_xJapMatchFullHalfWidthCB->connect_toggled( aLink3 ); |
683 | 0 | m_xIncludeDiacritics->connect_toggled( aLink3 ); |
684 | 0 | m_xIncludeKashida->connect_toggled( aLink3 ); |
685 | 0 | m_xLayoutBtn->connect_toggled( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) ); |
686 | 0 | m_xFormatBtn->connect_clicked( LINK( this, SvxSearchDialog, FormatHdl_Impl ) ); |
687 | 0 | m_xNoFormatBtn->connect_clicked( |
688 | 0 | LINK( this, SvxSearchDialog, NoFormatHdl_Impl ) ); |
689 | 0 | m_xAttributeBtn->connect_clicked( |
690 | 0 | LINK( this, SvxSearchDialog, AttributeHdl_Impl ) ); |
691 | 0 | } |
692 | | |
693 | | namespace |
694 | | { |
695 | | SvtModuleOptions::EFactory getModule(SfxBindings const & rBindings) |
696 | 0 | { |
697 | 0 | SvtModuleOptions::EFactory eFactory(SvtModuleOptions::EFactory::UNKNOWN_FACTORY); |
698 | 0 | try |
699 | 0 | { |
700 | 0 | const uno::Reference< frame::XFrame > xFrame = |
701 | 0 | rBindings.GetActiveFrame(); |
702 | 0 | uno::Reference< frame::XModuleManager2 > xModuleManager( |
703 | 0 | frame::ModuleManager::create(::comphelper::getProcessComponentContext())); |
704 | |
|
705 | 0 | OUString aModuleIdentifier = xModuleManager->identify( xFrame ); |
706 | 0 | eFactory = SvtModuleOptions::ClassifyFactoryByServiceName(aModuleIdentifier); |
707 | 0 | } |
708 | 0 | catch (const uno::Exception&) |
709 | 0 | { |
710 | 0 | } |
711 | 0 | return eFactory; |
712 | 0 | } |
713 | | } |
714 | | |
715 | | void SvxSearchDialog::ShowOptionalControls_Impl() |
716 | 0 | { |
717 | 0 | DBG_ASSERT(m_pSearchItem, "no search item"); |
718 | |
|
719 | 0 | SvtModuleOptions::EFactory eFactory = getModule(m_rBindings); |
720 | 0 | bool bDrawApp = eFactory == SvtModuleOptions::EFactory::DRAW; |
721 | 0 | bool bWriterApp = |
722 | 0 | eFactory == SvtModuleOptions::EFactory::WRITER || |
723 | 0 | eFactory == SvtModuleOptions::EFactory::WRITERWEB || |
724 | 0 | eFactory == SvtModuleOptions::EFactory::WRITERGLOBAL; |
725 | 0 | bool bCalcApp = eFactory == SvtModuleOptions::EFactory::CALC; |
726 | |
|
727 | 0 | m_xLayoutBtn->set_visible(!bDrawApp); |
728 | 0 | m_xNotesBtn->set_visible(bWriterApp); |
729 | 0 | m_xRegExpBtn->set_visible(!bDrawApp); |
730 | 0 | m_xWildcardBtn->set_visible(bCalcApp); /* TODO:WILDCARD enable for other apps if hey handle it */ |
731 | 0 | m_xReplaceBackwardsCB->show(); |
732 | 0 | m_xSimilarityBox->show(); |
733 | 0 | m_xSimilarityBtn->show(); |
734 | 0 | m_xSelectionBtn->show(); |
735 | 0 | m_xIncludeDiacritics->show(); |
736 | 0 | m_xIncludeKashida->set_visible(SvtCTLOptions::IsCTLFontEnabled()); |
737 | 0 | m_xJapMatchFullHalfWidthCB->set_visible(SvtCJKOptions::IsCJKFontEnabled()); |
738 | 0 | m_xJapOptionsCB->set_visible(SvtCJKOptions::IsJapaneseFindEnabled()); |
739 | 0 | m_xJapOptionsBtn->set_visible(SvtCJKOptions::IsJapaneseFindEnabled()); |
740 | |
|
741 | 0 | if (m_bWriter) |
742 | 0 | { |
743 | 0 | m_xAttributeBtn->show(); |
744 | 0 | m_xFormatBtn->show(); |
745 | 0 | m_xNoFormatBtn->show(); |
746 | 0 | } |
747 | |
|
748 | 0 | if (bCalcApp) |
749 | 0 | { |
750 | 0 | m_xCalcSearchInFT->show(); |
751 | 0 | m_xCalcSearchInLB->show(); |
752 | 0 | m_xCalcSearchDirFT->show(); |
753 | 0 | m_xRowsBtn->show(); |
754 | 0 | m_xColumnsBtn->show(); |
755 | 0 | m_xAllSheetsCB->show(); |
756 | 0 | m_xSearchFormattedCB->show(); |
757 | 0 | } |
758 | 0 | } |
759 | | |
760 | | |
761 | | namespace { |
762 | | |
763 | | class ToggleSaveToModule |
764 | | { |
765 | | public: |
766 | | ToggleSaveToModule(SvxSearchDialog& rDialog, bool bValue) : |
767 | 0 | mrDialog(rDialog), mbValue(bValue) |
768 | 0 | { |
769 | 0 | mrDialog.SetSaveToModule(mbValue); |
770 | 0 | } |
771 | | |
772 | | ~ToggleSaveToModule() |
773 | 0 | { |
774 | 0 | mrDialog.SetSaveToModule(!mbValue); |
775 | 0 | } |
776 | | private: |
777 | | SvxSearchDialog& mrDialog; |
778 | | bool mbValue; |
779 | | }; |
780 | | |
781 | | } |
782 | | |
783 | | void SvxSearchDialog::Init_Impl( bool bSearchPattern ) |
784 | 0 | { |
785 | 0 | DBG_ASSERT(m_pSearchItem, "SearchItem == 0"); |
786 | | |
787 | | // We don't want to save any intermediate state to the module while the |
788 | | // dialog is being initialized. |
789 | 0 | ToggleSaveToModule aNoModuleSave(*this, false); |
790 | 0 | SvtSearchOptions aOpt; |
791 | |
|
792 | 0 | m_bWriter = (m_pSearchItem->GetAppFlag() == SvxSearchApp::WRITER); |
793 | |
|
794 | 0 | if (!(m_nModifyFlag & ModifyFlags::Word)) |
795 | 0 | m_xWordBtn->set_active(m_pSearchItem->GetWordOnly()); |
796 | 0 | if (!(m_nModifyFlag & ModifyFlags::Exact)) |
797 | 0 | m_xMatchCaseCB->set_active(m_pSearchItem->GetExact()); |
798 | 0 | if (!(m_nModifyFlag & ModifyFlags::Backwards)) |
799 | 0 | m_xReplaceBackwardsCB->set_active(m_bReplaceBackwards); //adjustment to replace backwards |
800 | 0 | if (!(m_nModifyFlag & ModifyFlags::Notes)) |
801 | 0 | m_xNotesBtn->set_active(m_pSearchItem->GetNotes()); |
802 | 0 | if (!(m_nModifyFlag & ModifyFlags::Selection)) |
803 | 0 | m_xSelectionBtn->set_active(m_pSearchItem->GetSelection()); |
804 | 0 | if (!(m_nModifyFlag & ModifyFlags::Regexp)) |
805 | 0 | m_xRegExpBtn->set_active(m_pSearchItem->GetRegExp()); |
806 | 0 | if (!(m_nModifyFlag & ModifyFlags::Wildcard)) |
807 | 0 | m_xWildcardBtn->set_active(m_pSearchItem->GetWildcard()); |
808 | 0 | if (!(m_nModifyFlag & ModifyFlags::Layout)) |
809 | 0 | m_xLayoutBtn->set_active(m_pSearchItem->GetPattern()); |
810 | 0 | if (m_xNotesBtn->get_active()) |
811 | 0 | m_xLayoutBtn->set_sensitive(false); |
812 | 0 | m_xSimilarityBox->set_active(m_pSearchItem->IsLevenshtein()); |
813 | 0 | if ( m_xJapOptionsCB->get_visible() ) |
814 | 0 | m_xJapOptionsCB->set_active(m_pSearchItem->IsUseAsianOptions()); |
815 | 0 | m_xIncludeDiacritics->set_active( !aOpt.IsIgnoreDiacritics_CTL() ); |
816 | 0 | if ( m_xIncludeKashida->get_visible() ) |
817 | 0 | m_xIncludeKashida->set_active( !aOpt.IsIgnoreKashida_CTL() ); |
818 | 0 | ApplyTransliterationFlags_Impl(m_pSearchItem->GetTransliterationFlags()); |
819 | |
|
820 | 0 | ShowOptionalControls_Impl(); |
821 | |
|
822 | 0 | if (m_pSearchItem->GetAppFlag() == SvxSearchApp::CALC) |
823 | 0 | { |
824 | 0 | m_xCalcGrid->show(); |
825 | 0 | m_xSearchFormattedCB->set_active( aOpt.IsSearchFormatted() ); |
826 | 0 | Link<weld::Toggleable&,void> aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl ); |
827 | 0 | m_xCalcSearchInLB->connect_changed( LINK( this, SvxSearchDialog, LBSelectHdl_Impl ) ); |
828 | 0 | m_xRowsBtn->connect_toggled( aLink ); |
829 | 0 | m_xColumnsBtn->connect_toggled( aLink ); |
830 | 0 | m_xAllSheetsCB->connect_toggled( aLink ); |
831 | 0 | m_xSearchFormattedCB->connect_toggled( aLink ); |
832 | |
|
833 | 0 | ModifyFlags nModifyFlagCheck; |
834 | 0 | switch (m_pSearchItem->GetCellType()) |
835 | 0 | { |
836 | 0 | case SvxSearchCellType::FORMULA: |
837 | 0 | nModifyFlagCheck = ModifyFlags::Formulas; |
838 | 0 | break; |
839 | | |
840 | 0 | case SvxSearchCellType::VALUE: |
841 | 0 | nModifyFlagCheck = ModifyFlags::Values; |
842 | 0 | break; |
843 | | |
844 | 0 | case SvxSearchCellType::NOTE: |
845 | 0 | nModifyFlagCheck = ModifyFlags::CalcNotes; |
846 | 0 | break; |
847 | | |
848 | 0 | default: |
849 | 0 | std::abort(); // cannot happen |
850 | 0 | } |
851 | 0 | if (!(m_nModifyFlag & nModifyFlagCheck)) |
852 | 0 | m_xCalcSearchInLB->set_active(static_cast<sal_Int32>(m_pSearchItem->GetCellType())); |
853 | |
|
854 | 0 | m_xWordBtn->set_label(m_sCalcStr.getToken(0, '#')); |
855 | |
|
856 | 0 | if (m_pSearchItem->GetRowDirection() && !(m_nModifyFlag & ModifyFlags::Rows)) |
857 | 0 | m_xRowsBtn->set_active(true); |
858 | 0 | else if (!m_pSearchItem->GetRowDirection() && !(m_nModifyFlag & ModifyFlags::Columns)) |
859 | 0 | m_xColumnsBtn->set_active(true); |
860 | |
|
861 | 0 | if (!(m_nModifyFlag & ModifyFlags::AllTables)) |
862 | 0 | m_xAllSheetsCB->set_active(m_pSearchItem->IsAllTables()); |
863 | | |
864 | | // only look for formatting in Writer |
865 | 0 | m_xFormatBtn->hide(); |
866 | 0 | m_xNoFormatBtn->hide(); |
867 | 0 | m_xAttributeBtn->hide(); |
868 | 0 | } |
869 | 0 | else |
870 | 0 | { |
871 | 0 | m_xSearchFormattedCB->hide(); |
872 | 0 | m_xWordBtn->set_label(m_sCalcStr.getToken(1, '#')); |
873 | |
|
874 | 0 | if (m_pSearchItem->GetAppFlag() == SvxSearchApp::DRAW) |
875 | 0 | { |
876 | 0 | m_xSearchAllBtn->hide(); |
877 | |
|
878 | 0 | m_xRegExpBtn->hide(); |
879 | 0 | m_xWildcardBtn->hide(); |
880 | 0 | m_xLayoutBtn->hide(); |
881 | | |
882 | | // only look for formatting in Writer |
883 | 0 | m_xFormatBtn->hide(); |
884 | 0 | m_xNoFormatBtn->hide(); |
885 | 0 | m_xAttributeBtn->hide(); |
886 | 0 | } |
887 | 0 | else |
888 | 0 | { |
889 | 0 | m_xWildcardBtn->hide(); /* TODO:WILDCARD do not hide for other apps if they handle it */ |
890 | |
|
891 | 0 | if (!m_pSearchList) |
892 | 0 | { |
893 | | // Get attribute sets, if it not has been done already |
894 | 0 | const SfxPoolItem* ppArgs[] = { m_pSearchItem.get(), nullptr }; |
895 | 0 | SfxPoolItemHolder aResult(m_rBindings.GetDispatcher()->Execute( |
896 | 0 | FID_SEARCH_SEARCHSET, SfxCallMode::SLOT, ppArgs)); |
897 | 0 | const SvxSetItem* pSrchSetItem(static_cast<const SvxSetItem*>(aResult.getItem())); |
898 | |
|
899 | 0 | if ( pSrchSetItem ) |
900 | 0 | InitAttrList_Impl( &pSrchSetItem->GetItemSet(), nullptr ); |
901 | |
|
902 | 0 | aResult = m_rBindings.GetDispatcher()->Execute(FID_SEARCH_REPLACESET, |
903 | 0 | SfxCallMode::SLOT, ppArgs); |
904 | 0 | const SvxSetItem* pReplSetItem(static_cast<const SvxSetItem*>(aResult.getItem())); |
905 | |
|
906 | 0 | if ( pReplSetItem ) |
907 | 0 | InitAttrList_Impl( nullptr, &pReplSetItem->GetItemSet() ); |
908 | 0 | } |
909 | 0 | } |
910 | 0 | } |
911 | | |
912 | | // similarity search? |
913 | 0 | if (!(m_nModifyFlag & ModifyFlags::Similarity)) |
914 | 0 | m_xSimilarityBox->set_active(m_pSearchItem->IsLevenshtein()); |
915 | 0 | m_bSet = true; |
916 | |
|
917 | 0 | FlagHdl_Impl(*m_xSimilarityBox); |
918 | 0 | FlagHdl_Impl(*m_xJapOptionsCB); |
919 | |
|
920 | 0 | bool bDisableSearch = false; |
921 | 0 | SfxViewShell* pViewShell = SfxViewShell::Current(); |
922 | |
|
923 | 0 | if ( pViewShell ) |
924 | 0 | { |
925 | 0 | bool bText = !bSearchPattern; |
926 | |
|
927 | 0 | if ( pViewShell->HasSelection( bText ) ) |
928 | 0 | EnableControl_Impl(*m_xSelectionBtn); |
929 | 0 | else |
930 | 0 | { |
931 | 0 | m_xSelectionBtn->set_active( false ); |
932 | 0 | m_xSelectionBtn->set_sensitive(false); |
933 | 0 | } |
934 | 0 | } |
935 | | |
936 | | // Pattern Search and there were no AttrSets given |
937 | 0 | if ( bSearchPattern ) |
938 | 0 | { |
939 | 0 | SfxObjectShell* pShell = SfxObjectShell::Current(); |
940 | |
|
941 | 0 | if ( pShell && pShell->GetStyleSheetPool() ) |
942 | 0 | { |
943 | | // Templates designed |
944 | 0 | m_xSearchTmplLB->clear(); |
945 | 0 | m_xReplaceTmplLB->clear(); |
946 | 0 | SfxStyleSheetBasePool* pStylePool = pShell->GetStyleSheetPool(); |
947 | 0 | SfxStyleSheetBase* pBase = pStylePool->First(m_pSearchItem->GetFamily()); |
948 | |
|
949 | 0 | while ( pBase ) |
950 | 0 | { |
951 | 0 | if ( pBase->IsUsed() ) |
952 | 0 | m_xSearchTmplLB->append_text( pBase->GetName() ); |
953 | 0 | m_xReplaceTmplLB->append_text( pBase->GetName() ); |
954 | 0 | pBase = pStylePool->Next(); |
955 | 0 | } |
956 | 0 | m_xSearchTmplLB->set_active_text(m_pSearchItem->GetSearchString()); |
957 | 0 | m_xReplaceTmplLB->set_active_text(m_pSearchItem->GetReplaceString()); |
958 | 0 | } |
959 | 0 | m_xSearchTmplLB->show(); |
960 | |
|
961 | 0 | if (m_bConstruct) |
962 | | // Grab focus only after creating |
963 | 0 | m_xSearchTmplLB->grab_focus(); |
964 | 0 | m_xReplaceTmplLB->show(); |
965 | 0 | m_xSearchLB->hide(); |
966 | 0 | m_xReplaceLB->hide(); |
967 | |
|
968 | 0 | m_xWordBtn->set_sensitive(false); |
969 | 0 | m_xRegExpBtn->set_sensitive(false); |
970 | 0 | m_xWildcardBtn->set_sensitive(false); |
971 | 0 | m_xMatchCaseCB->set_sensitive(false); |
972 | |
|
973 | 0 | bDisableSearch = !m_xSearchTmplLB->get_count(); |
974 | 0 | } |
975 | 0 | else |
976 | 0 | { |
977 | 0 | bool bSetSearch = !(m_nModifyFlag & ModifyFlags::Search); |
978 | 0 | bool bSetReplace = !(m_nModifyFlag & ModifyFlags::Replace); |
979 | |
|
980 | 0 | if (!comphelper::LibreOfficeKit::isActive()) |
981 | 0 | { |
982 | 0 | if (!(m_pSearchItem->GetSearchString().isEmpty()) && bSetSearch) |
983 | 0 | m_xSearchLB->set_entry_text(m_pSearchItem->GetSearchString()); |
984 | 0 | else if (!m_aSearchStrings.empty()) |
985 | 0 | { |
986 | 0 | bool bAttributes = ((m_pSearchList && m_pSearchList->Count()) |
987 | 0 | || (m_pReplaceList && m_pReplaceList->Count())); |
988 | |
|
989 | 0 | if ( bSetSearch && !bAttributes ) |
990 | 0 | m_xSearchLB->set_entry_text(m_aSearchStrings[0]); |
991 | |
|
992 | 0 | OUString aReplaceTxt = m_pSearchItem->GetReplaceString(); |
993 | |
|
994 | 0 | if (!m_aReplaceStrings.empty()) |
995 | 0 | aReplaceTxt = m_aReplaceStrings[0]; |
996 | |
|
997 | 0 | if ( bSetReplace && !bAttributes ) |
998 | 0 | m_xReplaceLB->set_entry_text( aReplaceTxt ); |
999 | 0 | } |
1000 | 0 | } |
1001 | |
|
1002 | 0 | m_xSearchLB->show(); |
1003 | |
|
1004 | 0 | if (m_bConstruct) |
1005 | | // Grab focus only after creating |
1006 | 0 | m_xSearchLB->grab_focus(); |
1007 | 0 | m_xReplaceLB->show(); |
1008 | 0 | m_xSearchTmplLB->hide(); |
1009 | 0 | m_xReplaceTmplLB->hide(); |
1010 | |
|
1011 | 0 | EnableControl_Impl(*m_xRegExpBtn); |
1012 | 0 | EnableControl_Impl(*m_xWildcardBtn); |
1013 | 0 | EnableControl_Impl(*m_xMatchCaseCB); |
1014 | |
|
1015 | 0 | if ( m_xRegExpBtn->get_active() ) |
1016 | 0 | m_xWordBtn->set_sensitive(false); |
1017 | 0 | else |
1018 | 0 | EnableControl_Impl(*m_xWordBtn); |
1019 | |
|
1020 | 0 | bDisableSearch = m_xSearchLB->get_active_text().isEmpty() && |
1021 | 0 | m_xSearchAttrText->get_label().isEmpty(); |
1022 | 0 | } |
1023 | 0 | FocusHdl_Impl(*m_xSearchLB); |
1024 | |
|
1025 | 0 | if ( bDisableSearch ) |
1026 | 0 | { |
1027 | 0 | m_xSearchBtn->set_sensitive(false); |
1028 | 0 | m_xBackSearchBtn->set_sensitive(false); |
1029 | 0 | m_xSearchAllBtn->set_sensitive(false); |
1030 | 0 | m_xReplaceBtn->set_sensitive(false); |
1031 | 0 | m_xReplaceAllBtn->set_sensitive(false); |
1032 | 0 | m_xComponentFrame->set_sensitive(false); |
1033 | 0 | } |
1034 | 0 | else |
1035 | 0 | { |
1036 | 0 | EnableControl_Impl(*m_xSearchBtn); |
1037 | 0 | EnableControl_Impl(*m_xBackSearchBtn); |
1038 | 0 | EnableControl_Impl(*m_xReplaceBtn); |
1039 | 0 | if (!m_bWriter || !m_xNotesBtn->get_active()) |
1040 | 0 | { |
1041 | 0 | EnableControl_Impl(*m_xSearchAllBtn); |
1042 | 0 | EnableControl_Impl(*m_xReplaceAllBtn); |
1043 | 0 | } |
1044 | 0 | if (m_bWriter && m_pSearchItem->GetNotes()) |
1045 | 0 | { |
1046 | 0 | m_xSearchAllBtn->set_sensitive(false); |
1047 | 0 | m_xReplaceAllBtn->set_sensitive(false); |
1048 | 0 | } |
1049 | 0 | } |
1050 | |
|
1051 | 0 | if (!m_xSearchAttrText->get_label().isEmpty()) |
1052 | 0 | EnableControl_Impl(*m_xNoFormatBtn); |
1053 | 0 | else |
1054 | 0 | m_xNoFormatBtn->set_sensitive(false); |
1055 | |
|
1056 | 0 | if (!m_pSearchList) |
1057 | 0 | { |
1058 | 0 | m_xAttributeBtn->set_sensitive(false); |
1059 | 0 | m_xFormatBtn->set_sensitive(false); |
1060 | 0 | } |
1061 | |
|
1062 | 0 | if ( m_xLayoutBtn->get_active() ) |
1063 | 0 | { |
1064 | 0 | m_pImpl->bSaveToModule = false; |
1065 | 0 | TemplateHdl_Impl(*m_xLayoutBtn); |
1066 | 0 | m_pImpl->bSaveToModule = true; |
1067 | 0 | } |
1068 | 0 | } |
1069 | | |
1070 | | |
1071 | | void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet, |
1072 | | const SfxItemSet* pRSet ) |
1073 | 0 | { |
1074 | 0 | if ( !pSSet && !pRSet ) |
1075 | 0 | return; |
1076 | | |
1077 | 0 | if (m_pImpl->pRanges.empty() && pSSet) |
1078 | 0 | m_pImpl->pRanges = pSSet->GetRanges(); |
1079 | |
|
1080 | 0 | bool bSetOptimalLayoutSize = false; |
1081 | | |
1082 | | // See to it that are the texts of the attributes are correct |
1083 | 0 | OUString aDesc; |
1084 | |
|
1085 | 0 | if ( pSSet ) |
1086 | 0 | { |
1087 | 0 | m_pSearchList.reset(new SearchAttrItemList); |
1088 | |
|
1089 | 0 | if ( pSSet->Count() ) |
1090 | 0 | { |
1091 | 0 | m_pSearchList->Put(*pSSet); |
1092 | |
|
1093 | 0 | m_xSearchAttrText->set_label( BuildAttrText_Impl( aDesc, true ) ); |
1094 | |
|
1095 | 0 | if ( !aDesc.isEmpty() ) |
1096 | 0 | { |
1097 | 0 | if (!m_xSearchAttrText->get_visible()) |
1098 | 0 | { |
1099 | 0 | m_xSearchAttrText->show(); |
1100 | 0 | bSetOptimalLayoutSize = true; |
1101 | 0 | } |
1102 | 0 | m_bFormat |= true; |
1103 | 0 | } |
1104 | 0 | } |
1105 | 0 | } |
1106 | |
|
1107 | 0 | if ( pRSet ) |
1108 | 0 | { |
1109 | 0 | m_pReplaceList.reset(new SearchAttrItemList); |
1110 | |
|
1111 | 0 | if ( pRSet->Count() ) |
1112 | 0 | { |
1113 | 0 | m_pReplaceList->Put(*pRSet); |
1114 | |
|
1115 | 0 | m_xReplaceAttrText->set_label( BuildAttrText_Impl( aDesc, false ) ); |
1116 | |
|
1117 | 0 | if ( !aDesc.isEmpty() ) |
1118 | 0 | { |
1119 | 0 | if (!m_xReplaceAttrText->get_visible()) |
1120 | 0 | { |
1121 | 0 | m_xReplaceAttrText->show(); |
1122 | 0 | bSetOptimalLayoutSize = true; |
1123 | 0 | } |
1124 | 0 | m_bFormat |= true; |
1125 | 0 | } |
1126 | 0 | } |
1127 | 0 | } |
1128 | |
|
1129 | 0 | if (bSetOptimalLayoutSize) |
1130 | 0 | m_xDialog->resize_to_request(); |
1131 | 0 | } |
1132 | | |
1133 | | IMPL_LINK( SvxSearchDialog, LBSelectHdl_Impl, weld::ComboBox&, rCtrl, void ) |
1134 | 0 | { |
1135 | 0 | ClickHdl_Impl(&rCtrl); |
1136 | 0 | } |
1137 | | |
1138 | | IMPL_LINK( SvxSearchDialog, FlagHdl_Impl, weld::Toggleable&, rCtrl, void ) |
1139 | 0 | { |
1140 | 0 | ClickHdl_Impl(&rCtrl); |
1141 | 0 | } |
1142 | | |
1143 | | void SvxSearchDialog::ClickHdl_Impl(const weld::Widget* pCtrl) |
1144 | 0 | { |
1145 | 0 | if (pCtrl && !m_bSet) |
1146 | 0 | SetModifyFlag_Impl(pCtrl); |
1147 | 0 | else |
1148 | 0 | m_bSet = false; |
1149 | |
|
1150 | 0 | if (pCtrl == m_xSimilarityBox.get()) |
1151 | 0 | { |
1152 | 0 | bool bIsChecked = m_xSimilarityBox->get_active(); |
1153 | |
|
1154 | 0 | if ( bIsChecked ) |
1155 | 0 | { |
1156 | 0 | m_xSimilarityBtn->set_sensitive(true); |
1157 | 0 | m_xRegExpBtn->set_active( false ); |
1158 | 0 | m_xRegExpBtn->set_sensitive(false); |
1159 | 0 | m_xWildcardBtn->set_active( false ); |
1160 | 0 | m_xWildcardBtn->set_sensitive(false); |
1161 | 0 | EnableControl_Impl(*m_xWordBtn); |
1162 | |
|
1163 | 0 | if ( m_xLayoutBtn->get_active() ) |
1164 | 0 | { |
1165 | 0 | EnableControl_Impl(*m_xMatchCaseCB); |
1166 | 0 | m_xLayoutBtn->set_active( false ); |
1167 | 0 | } |
1168 | 0 | m_xRegExpBtn->set_sensitive(false); |
1169 | 0 | m_xWildcardBtn->set_sensitive(false); |
1170 | 0 | m_xLayoutBtn->set_sensitive(false); |
1171 | 0 | m_xFormatBtn->set_sensitive(false); |
1172 | 0 | m_xNoFormatBtn->set_sensitive(false); |
1173 | 0 | m_xAttributeBtn->set_sensitive(false); |
1174 | 0 | } |
1175 | 0 | else |
1176 | 0 | { |
1177 | 0 | EnableControl_Impl(*m_xRegExpBtn); |
1178 | 0 | EnableControl_Impl(*m_xWildcardBtn); |
1179 | 0 | if (!m_xNotesBtn->get_active()) |
1180 | 0 | EnableControl_Impl(*m_xLayoutBtn); |
1181 | 0 | EnableControl_Impl(*m_xFormatBtn); |
1182 | 0 | EnableControl_Impl(*m_xAttributeBtn); |
1183 | 0 | m_xSimilarityBtn->set_sensitive(false); |
1184 | 0 | } |
1185 | 0 | m_pSearchItem->SetLevenshtein(bIsChecked); |
1186 | 0 | } |
1187 | 0 | else if (pCtrl == m_xNotesBtn.get()) |
1188 | 0 | { |
1189 | 0 | if (m_xNotesBtn->get_active()) |
1190 | 0 | { |
1191 | 0 | m_xLayoutBtn->set_sensitive(false); |
1192 | 0 | m_xSearchAllBtn->set_sensitive(false); |
1193 | 0 | m_xReplaceAllBtn->set_sensitive(false); |
1194 | 0 | } |
1195 | 0 | else |
1196 | 0 | { |
1197 | 0 | EnableControl_Impl(*m_xLayoutBtn); |
1198 | 0 | ModifyHdl_Impl(*m_xSearchLB); |
1199 | 0 | } |
1200 | 0 | } |
1201 | 0 | else |
1202 | 0 | { |
1203 | 0 | if (m_xLayoutBtn->get_active() && !m_bFormat) |
1204 | 0 | { |
1205 | 0 | m_xWordBtn->set_active( false ); |
1206 | 0 | m_xWordBtn->set_sensitive(false); |
1207 | 0 | m_xRegExpBtn->set_active( false ); |
1208 | 0 | m_xRegExpBtn->set_sensitive(false); |
1209 | 0 | m_xWildcardBtn->set_active( false ); |
1210 | 0 | m_xWildcardBtn->set_sensitive(false); |
1211 | 0 | m_xMatchCaseCB->set_active( false ); |
1212 | 0 | m_xMatchCaseCB->set_sensitive(false); |
1213 | 0 | m_xNotesBtn->set_sensitive(false); |
1214 | |
|
1215 | 0 | if ( m_xSearchTmplLB->get_count() ) |
1216 | 0 | { |
1217 | 0 | EnableControl_Impl(*m_xSearchBtn); |
1218 | 0 | EnableControl_Impl(*m_xBackSearchBtn); |
1219 | 0 | EnableControl_Impl(*m_xSearchAllBtn); |
1220 | 0 | EnableControl_Impl(*m_xReplaceBtn); |
1221 | 0 | EnableControl_Impl(*m_xReplaceAllBtn); |
1222 | 0 | } |
1223 | 0 | } |
1224 | 0 | else |
1225 | 0 | { |
1226 | 0 | EnableControl_Impl(*m_xRegExpBtn); |
1227 | 0 | EnableControl_Impl(*m_xWildcardBtn); |
1228 | 0 | EnableControl_Impl(*m_xMatchCaseCB); |
1229 | 0 | EnableControl_Impl(*m_xNotesBtn); |
1230 | |
|
1231 | 0 | if ( m_xRegExpBtn->get_active() ) |
1232 | 0 | { |
1233 | 0 | m_xWordBtn->set_active( false ); |
1234 | 0 | m_xWordBtn->set_sensitive(false); |
1235 | 0 | m_xWildcardBtn->set_active( false ); |
1236 | 0 | m_xWildcardBtn->set_sensitive(false); |
1237 | 0 | m_xSimilarityBox->set_active( false ); |
1238 | 0 | m_xSimilarityBox->set_sensitive(false); |
1239 | 0 | m_xSimilarityBtn->set_sensitive(false); |
1240 | 0 | } |
1241 | 0 | else if ( m_xWildcardBtn->get_active() ) |
1242 | 0 | { |
1243 | 0 | m_xRegExpBtn->set_active( false ); |
1244 | 0 | m_xRegExpBtn->set_sensitive(false); |
1245 | 0 | m_xSimilarityBox->set_active( false ); |
1246 | 0 | m_xSimilarityBox->set_sensitive(false); |
1247 | 0 | m_xSimilarityBtn->set_sensitive(false); |
1248 | 0 | } |
1249 | 0 | else |
1250 | 0 | { |
1251 | 0 | EnableControl_Impl(*m_xWordBtn); |
1252 | 0 | EnableControl_Impl(*m_xSimilarityBox); |
1253 | 0 | } |
1254 | | |
1255 | | // Search-string in place? then enable Buttons |
1256 | 0 | m_bSet = true; |
1257 | 0 | ModifyHdl_Impl(*m_xSearchLB); |
1258 | 0 | } |
1259 | 0 | } |
1260 | |
|
1261 | 0 | if (pCtrl == m_xAllSheetsCB.get()) |
1262 | 0 | { |
1263 | 0 | m_bSet = true; |
1264 | 0 | ModifyHdl_Impl(*m_xSearchLB); |
1265 | 0 | } |
1266 | |
|
1267 | 0 | if (pCtrl == m_xJapOptionsCB.get()) |
1268 | 0 | { |
1269 | 0 | bool bEnableJapOpt = m_xJapOptionsCB->get_active(); |
1270 | 0 | m_xMatchCaseCB->set_sensitive(!bEnableJapOpt ); |
1271 | 0 | m_xJapMatchFullHalfWidthCB->set_sensitive(!bEnableJapOpt ); |
1272 | 0 | m_xJapOptionsBtn->set_sensitive( bEnableJapOpt ); |
1273 | 0 | } |
1274 | |
|
1275 | 0 | if (m_pImpl->bSaveToModule) |
1276 | 0 | SaveToModule_Impl(); |
1277 | 0 | } |
1278 | | |
1279 | | IMPL_LINK(SvxSearchDialog, CommandHdl_Impl, weld::Button&, rBtn, void) |
1280 | 0 | { |
1281 | 0 | bool bInclusive = (m_xLayoutBtn->get_label() == m_sLayoutStr); |
1282 | |
|
1283 | 0 | if ( ( &rBtn == m_xSearchBtn.get() ) || |
1284 | 0 | (&rBtn == m_xBackSearchBtn.get()) || |
1285 | 0 | ( &rBtn == m_xSearchAllBtn.get() )|| |
1286 | 0 | ( &rBtn == m_xReplaceBtn.get() ) || |
1287 | 0 | ( &rBtn == m_xReplaceAllBtn.get() ) ) |
1288 | 0 | { |
1289 | 0 | if ( m_xLayoutBtn->get_active() && !bInclusive ) |
1290 | 0 | { |
1291 | 0 | m_pSearchItem->SetSearchString(m_xSearchTmplLB->get_active_text()); |
1292 | 0 | m_pSearchItem->SetReplaceString(m_xReplaceTmplLB->get_active_text()); |
1293 | 0 | } |
1294 | 0 | else |
1295 | 0 | { |
1296 | 0 | m_pSearchItem->SetSearchString(m_xSearchLB->get_active_text()); |
1297 | 0 | m_pSearchItem->SetReplaceString(m_xReplaceLB->get_active_text()); |
1298 | |
|
1299 | 0 | if ( &rBtn == m_xReplaceBtn.get() ) |
1300 | 0 | Remember_Impl(false); |
1301 | 0 | else |
1302 | 0 | { |
1303 | 0 | Remember_Impl(true); |
1304 | |
|
1305 | 0 | if ( &rBtn == m_xReplaceAllBtn.get() ) |
1306 | 0 | Remember_Impl(false); |
1307 | 0 | } |
1308 | 0 | } |
1309 | |
|
1310 | 0 | m_pSearchItem->SetRegExp(false); |
1311 | 0 | m_pSearchItem->SetWildcard(false); |
1312 | 0 | m_pSearchItem->SetLevenshtein(false); |
1313 | 0 | if (GetCheckBoxValue(*m_xRegExpBtn)) |
1314 | 0 | m_pSearchItem->SetRegExp(true); |
1315 | 0 | else if (GetCheckBoxValue(*m_xWildcardBtn)) |
1316 | 0 | m_pSearchItem->SetWildcard(true); |
1317 | 0 | else if (GetCheckBoxValue(*m_xSimilarityBox)) |
1318 | 0 | m_pSearchItem->SetLevenshtein(true); |
1319 | |
|
1320 | 0 | m_pSearchItem->SetWordOnly(GetCheckBoxValue(*m_xWordBtn)); |
1321 | |
|
1322 | 0 | bool bSetBackwards = false; |
1323 | 0 | if( &rBtn == m_xBackSearchBtn.get()) |
1324 | 0 | { |
1325 | 0 | bSetBackwards = true; |
1326 | 0 | } |
1327 | 0 | else if( &rBtn == m_xReplaceBtn.get()) |
1328 | 0 | { |
1329 | 0 | bSetBackwards = GetCheckBoxValue(*m_xReplaceBackwardsCB); |
1330 | 0 | m_bReplaceBackwards = GetCheckBoxValue(*m_xReplaceBackwardsCB); |
1331 | 0 | } |
1332 | |
|
1333 | 0 | m_pSearchItem->SetBackward(bSetBackwards); |
1334 | |
|
1335 | 0 | m_pSearchItem->SetNotes(GetCheckBoxValue(*m_xNotesBtn)); |
1336 | 0 | m_pSearchItem->SetPattern(GetCheckBoxValue(*m_xLayoutBtn)); |
1337 | 0 | m_pSearchItem->SetSelection(GetCheckBoxValue(*m_xSelectionBtn)); |
1338 | 0 | m_pSearchItem->SetUseAsianOptions(GetCheckBoxValue(*m_xJapOptionsCB)); |
1339 | 0 | TransliterationFlags nFlags = GetTransliterationFlags(); |
1340 | 0 | if (!m_pSearchItem->IsUseAsianOptions()) |
1341 | 0 | nFlags &= TransliterationFlags::IGNORE_CASE | |
1342 | 0 | TransliterationFlags::IGNORE_WIDTH; |
1343 | 0 | if (GetNegatedCheckBoxValue(*m_xIncludeDiacritics)) |
1344 | 0 | nFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL; |
1345 | 0 | if (GetNegatedCheckBoxValue(*m_xIncludeKashida)) |
1346 | 0 | nFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL; |
1347 | 0 | m_pSearchItem->SetTransliterationFlags(nFlags); |
1348 | |
|
1349 | 0 | if (!m_bWriter) |
1350 | 0 | { |
1351 | 0 | if ( m_xCalcSearchInLB->get_active() != -1) |
1352 | 0 | m_pSearchItem->SetCellType( |
1353 | 0 | static_cast<SvxSearchCellType>(m_xCalcSearchInLB->get_active())); |
1354 | |
|
1355 | 0 | m_pSearchItem->SetRowDirection(m_xRowsBtn->get_active()); |
1356 | 0 | m_pSearchItem->SetAllTables(m_xAllSheetsCB->get_active()); |
1357 | 0 | m_pSearchItem->SetSearchFormatted(m_xSearchFormattedCB->get_active()); |
1358 | 0 | } |
1359 | |
|
1360 | 0 | if ((&rBtn == m_xSearchBtn.get()) || (&rBtn == m_xBackSearchBtn.get())) |
1361 | 0 | m_pSearchItem->SetCommand(SvxSearchCmd::FIND); |
1362 | 0 | else if ( &rBtn == m_xSearchAllBtn.get() ) |
1363 | 0 | m_pSearchItem->SetCommand(SvxSearchCmd::FIND_ALL); |
1364 | 0 | else if ( &rBtn == m_xReplaceBtn.get() ) |
1365 | 0 | m_pSearchItem->SetCommand(SvxSearchCmd::REPLACE); |
1366 | 0 | else if ( &rBtn == m_xReplaceAllBtn.get() ) |
1367 | 0 | m_pSearchItem->SetCommand(SvxSearchCmd::REPLACE_ALL); |
1368 | | |
1369 | | // when looking for templates, delete format lists |
1370 | 0 | if (!m_bFormat && m_pSearchItem->GetPattern()) |
1371 | 0 | { |
1372 | 0 | if (m_pSearchList) |
1373 | 0 | m_pSearchList->Clear(); |
1374 | |
|
1375 | 0 | if (m_pReplaceList) |
1376 | 0 | m_pReplaceList->Clear(); |
1377 | 0 | } |
1378 | 0 | m_nModifyFlag = ModifyFlags::NONE; |
1379 | 0 | const SfxPoolItem* ppArgs[] = { m_pSearchItem.get(), nullptr }; |
1380 | 0 | m_rBindings.ExecuteSynchron(FID_SEARCH_NOW, ppArgs); |
1381 | 0 | } |
1382 | 0 | else if ( &rBtn == m_xCloseBtn.get() ) |
1383 | 0 | { |
1384 | 0 | if ( !m_xLayoutBtn->get_active() || bInclusive ) |
1385 | 0 | { |
1386 | 0 | Remember_Impl(true); |
1387 | 0 | Remember_Impl(false); |
1388 | 0 | } |
1389 | 0 | SaveToModule_Impl(); |
1390 | 0 | Close(); |
1391 | 0 | } |
1392 | 0 | else if (&rBtn == m_xSimilarityBtn.get()) |
1393 | 0 | { |
1394 | 0 | SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); |
1395 | 0 | ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog( |
1396 | 0 | m_xDialog.get(), m_pSearchItem->IsLEVRelaxed(), m_pSearchItem->GetLEVOther(), |
1397 | 0 | m_pSearchItem->GetLEVShorter(), m_pSearchItem->GetLEVLonger())); |
1398 | 0 | if ( executeSubDialog(pDlg.get()) == RET_OK ) |
1399 | 0 | { |
1400 | 0 | m_pSearchItem->SetLEVRelaxed(pDlg->IsRelaxed()); |
1401 | 0 | m_pSearchItem->SetLEVOther(pDlg->GetOther()); |
1402 | 0 | m_pSearchItem->SetLEVShorter(pDlg->GetShorter()); |
1403 | 0 | m_pSearchItem->SetLEVLonger(pDlg->GetLonger()); |
1404 | 0 | SaveToModule_Impl(); |
1405 | 0 | } |
1406 | 0 | } |
1407 | 0 | else if (&rBtn == m_xJapOptionsBtn.get()) |
1408 | 0 | { |
1409 | 0 | SfxItemSet aSet( SfxGetpApp()->GetPool() ); |
1410 | 0 | m_pSearchItem->SetTransliterationFlags(GetTransliterationFlags()); |
1411 | 0 | SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); |
1412 | 0 | ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( |
1413 | 0 | m_xDialog.get(), aSet, m_pSearchItem->GetTransliterationFlags())); |
1414 | 0 | int nRet = executeSubDialog(aDlg.get()); |
1415 | 0 | if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true |
1416 | 0 | { |
1417 | 0 | TransliterationFlags nFlags = aDlg->GetTransliterationFlags(); |
1418 | 0 | m_pSearchItem->SetTransliterationFlags(nFlags); |
1419 | 0 | ApplyTransliterationFlags_Impl( nFlags ); |
1420 | 0 | } |
1421 | 0 | } |
1422 | 0 | else if (&rBtn == m_xSearchComponent1PB.get() || &rBtn == m_xSearchComponent2PB.get()) |
1423 | 0 | { |
1424 | 0 | uno::Sequence < beans::PropertyValue > aArgs(2); |
1425 | 0 | beans::PropertyValue* pArgs = aArgs.getArray(); |
1426 | 0 | pArgs[0].Name = "SearchString"; |
1427 | 0 | pArgs[0].Value <<= m_xSearchLB->get_active_text(); |
1428 | 0 | pArgs[1].Name = "ParentWindow"; |
1429 | 0 | pArgs[1].Value <<= m_xDialog->GetXWindow(); |
1430 | 0 | if (&rBtn == m_xSearchComponent1PB.get()) |
1431 | 0 | { |
1432 | 0 | if (m_pImpl->xCommand1Dispatch.is()) |
1433 | 0 | m_pImpl->xCommand1Dispatch->dispatch(m_pImpl->aCommand1URL, aArgs); |
1434 | 0 | } |
1435 | 0 | else |
1436 | 0 | { |
1437 | 0 | if (m_pImpl->xCommand2Dispatch.is()) |
1438 | 0 | m_pImpl->xCommand2Dispatch->dispatch(m_pImpl->aCommand2URL, aArgs); |
1439 | 0 | } |
1440 | 0 | } |
1441 | 0 | } |
1442 | | |
1443 | | |
1444 | | IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, weld::ComboBox&, rEd, void ) |
1445 | 0 | { |
1446 | 0 | if (!m_bSet) |
1447 | 0 | SetModifyFlag_Impl( &rEd ); |
1448 | 0 | else |
1449 | 0 | m_bSet = false; |
1450 | | |
1451 | | // Calc allows searching for empty cells. |
1452 | 0 | bool bAllowEmptySearch = (m_pSearchItem->GetAppFlag() == SvxSearchApp::CALC); |
1453 | |
|
1454 | 0 | if (&rEd != m_xSearchLB.get() && &rEd != m_xReplaceLB.get()) |
1455 | 0 | return; |
1456 | | |
1457 | 0 | sal_Int32 nSrchTxtLen = m_xSearchLB->get_active_text().getLength(); |
1458 | 0 | sal_Int32 nReplTxtLen = 0; |
1459 | 0 | if (bAllowEmptySearch) |
1460 | 0 | nReplTxtLen = m_xReplaceLB->get_active_text().getLength(); |
1461 | 0 | sal_Int32 nAttrTxtLen = m_xSearchAttrText->get_label().getLength(); |
1462 | |
|
1463 | 0 | if (nSrchTxtLen || nReplTxtLen || nAttrTxtLen) |
1464 | 0 | { |
1465 | 0 | EnableControl_Impl(*m_xSearchBtn); |
1466 | 0 | EnableControl_Impl(*m_xBackSearchBtn); |
1467 | 0 | EnableControl_Impl(*m_xReplaceBtn); |
1468 | 0 | if (!m_bWriter || !m_xNotesBtn->get_active()) |
1469 | 0 | { |
1470 | 0 | EnableControl_Impl(*m_xSearchAllBtn); |
1471 | 0 | EnableControl_Impl(*m_xReplaceAllBtn); |
1472 | 0 | } |
1473 | 0 | } |
1474 | 0 | else |
1475 | 0 | { |
1476 | 0 | m_xComponentFrame->set_sensitive(false); |
1477 | 0 | m_xSearchBtn->set_sensitive(false); |
1478 | 0 | m_xBackSearchBtn->set_sensitive(false); |
1479 | 0 | m_xSearchAllBtn->set_sensitive(false); |
1480 | 0 | m_xReplaceBtn->set_sensitive(false); |
1481 | 0 | m_xReplaceAllBtn->set_sensitive(false); |
1482 | 0 | } |
1483 | 0 | } |
1484 | | |
1485 | | IMPL_LINK_NOARG(SvxSearchDialog, TemplateHdl_Impl, weld::Toggleable&, void) |
1486 | 0 | { |
1487 | 0 | if (m_pImpl->bSaveToModule) |
1488 | 0 | SaveToModule_Impl(); |
1489 | |
|
1490 | 0 | if (m_bFormat) |
1491 | 0 | return; |
1492 | 0 | OUString sDesc; |
1493 | |
|
1494 | 0 | if ( m_xLayoutBtn->get_active() ) |
1495 | 0 | { |
1496 | 0 | if (!m_pFamilyController) |
1497 | 0 | { |
1498 | 0 | sal_uInt16 nId = 0; |
1499 | | |
1500 | | // Enable templates controller |
1501 | 0 | switch (m_pSearchItem->GetFamily()) |
1502 | 0 | { |
1503 | 0 | case SfxStyleFamily::Char: |
1504 | 0 | nId = SID_STYLE_FAMILY1; break; |
1505 | | |
1506 | 0 | case SfxStyleFamily::Para: |
1507 | 0 | nId = SID_STYLE_FAMILY2; break; |
1508 | | |
1509 | 0 | case SfxStyleFamily::Frame: |
1510 | 0 | nId = SID_STYLE_FAMILY3; break; |
1511 | | |
1512 | 0 | case SfxStyleFamily::Page: |
1513 | 0 | nId = SID_STYLE_FAMILY4; break; |
1514 | | |
1515 | 0 | case SfxStyleFamily::All: |
1516 | 0 | break; |
1517 | | |
1518 | 0 | default: |
1519 | 0 | OSL_FAIL( "StyleSheetFamily was changed?" ); |
1520 | 0 | } |
1521 | | |
1522 | 0 | m_rBindings.EnterRegistrations(); |
1523 | 0 | m_pFamilyController.reset(new SvxSearchController(nId, m_rBindings, *this)); |
1524 | 0 | m_rBindings.LeaveRegistrations(); |
1525 | 0 | m_xSearchTmplLB->clear(); |
1526 | 0 | m_xReplaceTmplLB->clear(); |
1527 | |
|
1528 | 0 | m_xSearchTmplLB->show(); |
1529 | 0 | m_xReplaceTmplLB->show(); |
1530 | 0 | m_xSearchLB->hide(); |
1531 | 0 | m_xReplaceLB->hide(); |
1532 | |
|
1533 | 0 | m_xSearchAttrText->set_label( sDesc ); |
1534 | 0 | m_xReplaceAttrText->set_label( sDesc ); |
1535 | |
|
1536 | 0 | if(!sDesc.isEmpty()) |
1537 | 0 | { |
1538 | 0 | if (!m_xSearchAttrText->get_visible() || !m_xReplaceAttrText->get_visible()) |
1539 | 0 | { |
1540 | 0 | m_xSearchAttrText->show(); |
1541 | 0 | m_xReplaceAttrText->show(); |
1542 | 0 | m_xDialog->resize_to_request(); |
1543 | 0 | } |
1544 | 0 | } |
1545 | 0 | } |
1546 | 0 | m_xFormatBtn->set_sensitive(false); |
1547 | 0 | m_xNoFormatBtn->set_sensitive(false); |
1548 | 0 | m_xAttributeBtn->set_sensitive(false); |
1549 | 0 | m_xSimilarityBox->set_sensitive(false); |
1550 | 0 | m_xSimilarityBtn->set_sensitive(false); |
1551 | 0 | } |
1552 | 0 | else |
1553 | 0 | { |
1554 | | // Disable templates controller |
1555 | 0 | m_rBindings.EnterRegistrations(); |
1556 | 0 | m_pFamilyController.reset(); |
1557 | 0 | m_rBindings.LeaveRegistrations(); |
1558 | |
|
1559 | 0 | m_xSearchLB->show(); |
1560 | 0 | m_xReplaceLB->show(); |
1561 | 0 | m_xSearchTmplLB->hide(); |
1562 | 0 | m_xReplaceTmplLB->hide(); |
1563 | |
|
1564 | 0 | m_xSearchAttrText->set_label( BuildAttrText_Impl( sDesc, true ) ); |
1565 | 0 | m_xReplaceAttrText->set_label( BuildAttrText_Impl( sDesc, false ) ); |
1566 | |
|
1567 | 0 | if(!sDesc.isEmpty()) |
1568 | 0 | { |
1569 | 0 | if (!m_xSearchAttrText->get_visible() || !m_xReplaceAttrText->get_visible()) |
1570 | 0 | { |
1571 | 0 | m_xSearchAttrText->show(); |
1572 | 0 | m_xReplaceAttrText->show(); |
1573 | 0 | m_xDialog->resize_to_request(); |
1574 | 0 | } |
1575 | 0 | } |
1576 | |
|
1577 | 0 | EnableControl_Impl(*m_xFormatBtn); |
1578 | 0 | EnableControl_Impl(*m_xAttributeBtn); |
1579 | 0 | EnableControl_Impl(*m_xSimilarityBox); |
1580 | |
|
1581 | 0 | FocusHdl_Impl(m_bSearch ? *m_xSearchLB : *m_xReplaceLB); |
1582 | 0 | } |
1583 | 0 | m_bSet = true; |
1584 | 0 | m_pImpl->bSaveToModule = false; |
1585 | 0 | FlagHdl_Impl(*m_xLayoutBtn); |
1586 | 0 | m_pImpl->bSaveToModule = true; |
1587 | 0 | } |
1588 | | |
1589 | | void SvxSearchDialog::Remember_Impl(bool _bSearch) |
1590 | 0 | { |
1591 | 0 | std::vector<OUString>& rArr = _bSearch ? m_aSearchStrings : m_aReplaceStrings; |
1592 | 0 | weld::ComboBox& rListBox = _bSearch ? *m_xSearchLB : *m_xReplaceLB; |
1593 | |
|
1594 | 0 | const OUString sText = rListBox.get_active_text(); |
1595 | 0 | if (sText.isEmpty()) |
1596 | 0 | return; |
1597 | | |
1598 | | // tdf#154818 - rearrange the search items |
1599 | 0 | const int nPos = rListBox.find_text(sText); |
1600 | 0 | if (nPos == 0 && !rArr.empty() && rArr.at(0) == sText) |
1601 | | // nothing to do, is already the first item |
1602 | 0 | return; |
1603 | | |
1604 | 0 | if (nPos != -1) |
1605 | 0 | { |
1606 | 0 | rListBox.remove(nPos); |
1607 | 0 | rArr.erase(rArr.begin() + nPos); |
1608 | 0 | } |
1609 | 0 | else if (rListBox.get_count() >= m_nRememberSize) |
1610 | 0 | { |
1611 | | // delete oldest entry at maximum occupancy (ListBox and Array) |
1612 | 0 | rListBox.remove(m_nRememberSize - 1); |
1613 | 0 | rArr.erase(rArr.begin() + m_nRememberSize - 1); |
1614 | 0 | } |
1615 | |
|
1616 | 0 | rArr.insert(rArr.begin(), sText); |
1617 | 0 | rListBox.insert_text(0, sText); |
1618 | 0 | } |
1619 | | |
1620 | | void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool ) |
1621 | 0 | { |
1622 | 0 | OUString aOldSrch( m_xSearchTmplLB->get_active_text() ); |
1623 | 0 | OUString aOldRepl( m_xReplaceTmplLB->get_active_text() ); |
1624 | 0 | m_xSearchTmplLB->clear(); |
1625 | 0 | m_xReplaceTmplLB->clear(); |
1626 | 0 | m_xSearchTmplLB->freeze(); |
1627 | 0 | m_xReplaceTmplLB->freeze(); |
1628 | 0 | SfxStyleSheetBase* pBase = rPool.First(m_pSearchItem->GetFamily()); |
1629 | |
|
1630 | 0 | while ( pBase ) |
1631 | 0 | { |
1632 | 0 | if ( pBase->IsUsed() ) |
1633 | 0 | m_xSearchTmplLB->append_text( pBase->GetName() ); |
1634 | 0 | m_xReplaceTmplLB->append_text( pBase->GetName() ); |
1635 | 0 | pBase = rPool.Next(); |
1636 | 0 | } |
1637 | 0 | m_xSearchTmplLB->thaw(); |
1638 | 0 | m_xReplaceTmplLB->thaw(); |
1639 | 0 | m_xSearchTmplLB->set_active(0); |
1640 | |
|
1641 | 0 | if ( !aOldSrch.isEmpty() ) |
1642 | 0 | m_xSearchTmplLB->set_active_text( aOldSrch ); |
1643 | 0 | m_xReplaceTmplLB->set_active(0); |
1644 | |
|
1645 | 0 | if ( !aOldRepl.isEmpty() ) |
1646 | 0 | m_xReplaceTmplLB->set_active_text( aOldRepl ); |
1647 | |
|
1648 | 0 | if ( m_xSearchTmplLB->get_count() ) |
1649 | 0 | { |
1650 | 0 | EnableControl_Impl(*m_xSearchBtn); |
1651 | 0 | EnableControl_Impl(*m_xBackSearchBtn); |
1652 | 0 | EnableControl_Impl(*m_xSearchAllBtn); |
1653 | 0 | EnableControl_Impl(*m_xReplaceBtn); |
1654 | 0 | EnableControl_Impl(*m_xReplaceAllBtn); |
1655 | 0 | } |
1656 | 0 | } |
1657 | | |
1658 | | |
1659 | | void SvxSearchDialog::EnableControls_Impl( const SearchOptionFlags nFlags ) |
1660 | 0 | { |
1661 | 0 | if (nFlags == m_nOptions) |
1662 | 0 | return; |
1663 | 0 | else |
1664 | 0 | m_nOptions = nFlags; |
1665 | | |
1666 | 0 | bool bNoSearch = true; |
1667 | |
|
1668 | 0 | bool bEnableSearch = bool(SearchOptionFlags::SEARCH & m_nOptions); |
1669 | 0 | m_xSearchBtn->set_sensitive(bEnableSearch); |
1670 | 0 | m_xBackSearchBtn->set_sensitive(bEnableSearch); |
1671 | |
|
1672 | 0 | if( bEnableSearch ) |
1673 | 0 | bNoSearch = false; |
1674 | |
|
1675 | 0 | if (SearchOptionFlags::SEARCHALL & m_nOptions) |
1676 | 0 | { |
1677 | 0 | m_xSearchAllBtn->set_sensitive(true); |
1678 | 0 | bNoSearch = false; |
1679 | 0 | } |
1680 | 0 | else |
1681 | 0 | m_xSearchAllBtn->set_sensitive(false); |
1682 | 0 | if (SearchOptionFlags::REPLACE & m_nOptions) |
1683 | 0 | { |
1684 | 0 | m_xReplaceBtn->set_sensitive(true); |
1685 | 0 | m_xReplaceFrame->set_sensitive(true); |
1686 | 0 | m_xReplaceLB->set_sensitive(true); |
1687 | 0 | m_xReplaceTmplLB->set_sensitive(true); |
1688 | 0 | bNoSearch = false; |
1689 | 0 | } |
1690 | 0 | else |
1691 | 0 | { |
1692 | 0 | m_xReplaceBtn->set_sensitive(false); |
1693 | 0 | m_xReplaceFrame->set_sensitive(false); |
1694 | 0 | m_xReplaceLB->set_sensitive(false); |
1695 | 0 | m_xReplaceTmplLB->set_sensitive(false); |
1696 | 0 | } |
1697 | 0 | if (SearchOptionFlags::REPLACE_ALL & m_nOptions) |
1698 | 0 | { |
1699 | 0 | m_xReplaceAllBtn->set_sensitive(true); |
1700 | 0 | bNoSearch = false; |
1701 | 0 | } |
1702 | 0 | else |
1703 | 0 | m_xReplaceAllBtn->set_sensitive(false); |
1704 | 0 | m_xComponentFrame->set_sensitive(!bNoSearch); |
1705 | 0 | m_xSearchBtn->set_sensitive( !bNoSearch ); |
1706 | 0 | m_xBackSearchBtn->set_sensitive( !bNoSearch ); |
1707 | 0 | m_xSearchFrame->set_sensitive( !bNoSearch ); |
1708 | 0 | m_xSearchLB->set_sensitive( !bNoSearch ); |
1709 | 0 | m_xNotesBtn->set_sensitive(true); |
1710 | |
|
1711 | 0 | if (SearchOptionFlags::WHOLE_WORDS & m_nOptions) |
1712 | 0 | m_xWordBtn->set_sensitive(true); |
1713 | 0 | else |
1714 | 0 | m_xWordBtn->set_sensitive(false); |
1715 | 0 | if (SearchOptionFlags::BACKWARDS & m_nOptions) |
1716 | 0 | { |
1717 | 0 | m_xBackSearchBtn->set_sensitive(true); |
1718 | 0 | m_xReplaceBackwardsCB->set_sensitive(true); |
1719 | 0 | } |
1720 | 0 | else |
1721 | 0 | { |
1722 | 0 | m_xBackSearchBtn->set_sensitive(false); |
1723 | 0 | m_xReplaceBackwardsCB->set_sensitive(false); |
1724 | 0 | } |
1725 | 0 | if (SearchOptionFlags::REG_EXP & m_nOptions) |
1726 | 0 | m_xRegExpBtn->set_sensitive(true); |
1727 | 0 | else |
1728 | 0 | m_xRegExpBtn->set_sensitive(false); |
1729 | 0 | if (SearchOptionFlags::WILDCARD & m_nOptions) |
1730 | 0 | m_xWildcardBtn->set_sensitive(true); |
1731 | 0 | else |
1732 | 0 | m_xWildcardBtn->set_sensitive(false); |
1733 | 0 | if (SearchOptionFlags::EXACT & m_nOptions) |
1734 | 0 | m_xMatchCaseCB->set_sensitive(true); |
1735 | 0 | else |
1736 | 0 | m_xMatchCaseCB->set_sensitive(false); |
1737 | 0 | if (SearchOptionFlags::SELECTION & m_nOptions) |
1738 | 0 | m_xSelectionBtn->set_sensitive(true); |
1739 | 0 | else |
1740 | 0 | m_xSelectionBtn->set_sensitive(false); |
1741 | 0 | if (SearchOptionFlags::FAMILIES & m_nOptions) |
1742 | 0 | m_xLayoutBtn->set_sensitive(true); |
1743 | 0 | else |
1744 | 0 | m_xLayoutBtn->set_sensitive(false); |
1745 | 0 | if (SearchOptionFlags::FORMAT & m_nOptions) |
1746 | 0 | { |
1747 | 0 | m_xAttributeBtn->set_sensitive(true); |
1748 | 0 | m_xFormatBtn->set_sensitive(true); |
1749 | 0 | m_xNoFormatBtn->set_sensitive(true); |
1750 | 0 | } |
1751 | 0 | else |
1752 | 0 | { |
1753 | 0 | m_xAttributeBtn->set_sensitive(false); |
1754 | 0 | m_xFormatBtn->set_sensitive(false); |
1755 | 0 | m_xNoFormatBtn->set_sensitive(false); |
1756 | 0 | } |
1757 | |
|
1758 | 0 | if (SearchOptionFlags::SIMILARITY & m_nOptions) |
1759 | 0 | { |
1760 | 0 | m_xSimilarityBox->set_sensitive(true); |
1761 | 0 | m_xSimilarityBtn->set_sensitive(true); |
1762 | 0 | } |
1763 | 0 | else |
1764 | 0 | { |
1765 | 0 | m_xSimilarityBox->set_sensitive(false); |
1766 | 0 | m_xSimilarityBtn->set_sensitive(false); |
1767 | 0 | } |
1768 | |
|
1769 | 0 | if (m_pSearchItem) |
1770 | 0 | { |
1771 | 0 | Init_Impl(m_pSearchItem->GetPattern() && (!m_pSearchList || !m_pSearchList->Count())); |
1772 | 0 | if (SvxSearchDialog::IsOtherOptionsExpanded()) |
1773 | 0 | m_xOtherOptionsExpander->set_expanded(true); |
1774 | 0 | } |
1775 | 0 | } |
1776 | | |
1777 | | void SvxSearchDialog::EnableControl_Impl(const weld::Widget& rCtrl) |
1778 | 0 | { |
1779 | 0 | if (m_xSearchBtn.get() == &rCtrl && (SearchOptionFlags::SEARCH & m_nOptions)) |
1780 | 0 | { |
1781 | 0 | m_xComponentFrame->set_sensitive(true); |
1782 | 0 | m_xSearchBtn->set_sensitive(true); |
1783 | 0 | return; |
1784 | 0 | } |
1785 | 0 | if (m_xSearchAllBtn.get() == &rCtrl && (SearchOptionFlags::SEARCHALL & m_nOptions)) |
1786 | 0 | { |
1787 | 0 | m_xSearchAllBtn->set_sensitive(true); |
1788 | 0 | return; |
1789 | 0 | } |
1790 | 0 | if (m_xReplaceBtn.get() == &rCtrl && (SearchOptionFlags::REPLACE & m_nOptions)) |
1791 | 0 | { |
1792 | 0 | m_xReplaceBtn->set_sensitive(true); |
1793 | 0 | return; |
1794 | 0 | } |
1795 | 0 | if (m_xReplaceAllBtn.get() == &rCtrl && (SearchOptionFlags::REPLACE_ALL & m_nOptions)) |
1796 | 0 | { |
1797 | 0 | m_xReplaceAllBtn->set_sensitive(true); |
1798 | 0 | return; |
1799 | 0 | } |
1800 | 0 | if (m_xWordBtn.get() == &rCtrl && (SearchOptionFlags::WHOLE_WORDS & m_nOptions)) |
1801 | 0 | { |
1802 | 0 | m_xWordBtn->set_sensitive(true); |
1803 | 0 | return; |
1804 | 0 | } |
1805 | 0 | if (SearchOptionFlags::BACKWARDS & m_nOptions) |
1806 | 0 | { |
1807 | 0 | if( m_xBackSearchBtn.get() == &rCtrl ) |
1808 | 0 | { |
1809 | 0 | m_xBackSearchBtn->set_sensitive(true); |
1810 | 0 | return; |
1811 | 0 | } |
1812 | 0 | else if ( m_xReplaceBackwardsCB.get() == &rCtrl ) |
1813 | 0 | { |
1814 | 0 | m_xReplaceBackwardsCB->set_sensitive(true); |
1815 | 0 | return; |
1816 | 0 | } |
1817 | 0 | } |
1818 | 0 | if (m_xNotesBtn.get() == &rCtrl) |
1819 | 0 | { |
1820 | 0 | m_xNotesBtn->set_sensitive(true); |
1821 | 0 | return; |
1822 | 0 | } |
1823 | 0 | if (m_xRegExpBtn.get() == &rCtrl && (SearchOptionFlags::REG_EXP & m_nOptions) |
1824 | 0 | && !m_xSimilarityBox->get_active() && !m_xWildcardBtn->get_active()) |
1825 | 0 | { |
1826 | 0 | m_xRegExpBtn->set_sensitive(true); |
1827 | 0 | return; |
1828 | 0 | } |
1829 | 0 | if (m_xWildcardBtn.get() == &rCtrl && (SearchOptionFlags::WILDCARD & m_nOptions) |
1830 | 0 | && !m_xSimilarityBox->get_active() && !m_xRegExpBtn->get_active()) |
1831 | 0 | { |
1832 | 0 | m_xWildcardBtn->set_sensitive(true); |
1833 | 0 | return; |
1834 | 0 | } |
1835 | 0 | if (m_xMatchCaseCB.get() == &rCtrl && (SearchOptionFlags::EXACT & m_nOptions)) |
1836 | 0 | { |
1837 | 0 | if (!m_xJapOptionsCB->get_active()) |
1838 | 0 | m_xMatchCaseCB->set_sensitive(true); |
1839 | 0 | return; |
1840 | 0 | } |
1841 | 0 | if (m_xSelectionBtn.get() == &rCtrl && (SearchOptionFlags::SELECTION & m_nOptions)) |
1842 | 0 | { |
1843 | 0 | m_xSelectionBtn->set_sensitive(true); |
1844 | 0 | return; |
1845 | 0 | } |
1846 | 0 | if (m_xLayoutBtn.get() == &rCtrl && (SearchOptionFlags::FAMILIES & m_nOptions)) |
1847 | 0 | { |
1848 | 0 | m_xLayoutBtn->set_sensitive(true); |
1849 | 0 | return; |
1850 | 0 | } |
1851 | 0 | if (m_xAttributeBtn.get() == &rCtrl && (SearchOptionFlags::FORMAT & m_nOptions) |
1852 | 0 | && m_pSearchList) |
1853 | 0 | { |
1854 | 0 | m_xAttributeBtn->set_sensitive(m_pImpl->bFocusOnSearch); |
1855 | 0 | } |
1856 | 0 | if (m_xFormatBtn.get() == &rCtrl && (SearchOptionFlags::FORMAT & m_nOptions)) |
1857 | 0 | { |
1858 | 0 | m_xFormatBtn->set_sensitive(true); |
1859 | 0 | return; |
1860 | 0 | } |
1861 | 0 | if (m_xNoFormatBtn.get() == &rCtrl && (SearchOptionFlags::FORMAT & m_nOptions)) |
1862 | 0 | { |
1863 | 0 | m_xNoFormatBtn->set_sensitive(true); |
1864 | 0 | return; |
1865 | 0 | } |
1866 | 0 | if (m_xSimilarityBox.get() == &rCtrl && (SearchOptionFlags::SIMILARITY & m_nOptions) |
1867 | 0 | && !m_xRegExpBtn->get_active() && !m_xWildcardBtn->get_active()) |
1868 | 0 | { |
1869 | 0 | m_xSimilarityBox->set_sensitive(true); |
1870 | |
|
1871 | 0 | if ( m_xSimilarityBox->get_active() ) |
1872 | 0 | m_xSimilarityBtn->set_sensitive(true); |
1873 | 0 | } |
1874 | 0 | } |
1875 | | |
1876 | | void SvxSearchDialog::SetItem_Impl( const SvxSearchItem* pItem ) |
1877 | 0 | { |
1878 | | //TODO: save pItem and process later if m_executingSubDialog? |
1879 | 0 | if ( pItem && !m_executingSubDialog ) |
1880 | 0 | { |
1881 | 0 | m_pSearchItem.reset(pItem->Clone()); |
1882 | 0 | Init_Impl(m_pSearchItem->GetPattern() && (!m_pSearchList || !m_pSearchList->Count())); |
1883 | 0 | } |
1884 | 0 | } |
1885 | | |
1886 | | IMPL_LINK(SvxSearchDialog, FocusHdl_Impl, weld::Widget&, rControl, void) |
1887 | 0 | { |
1888 | 0 | sal_Int32 nTxtLen = m_xSearchAttrText->get_label().getLength(); |
1889 | 0 | weld::Widget* pCtrl = &rControl; |
1890 | 0 | if (pCtrl == m_xSearchLB.get()) |
1891 | 0 | { |
1892 | 0 | if (pCtrl->has_focus()) |
1893 | 0 | m_pImpl->bFocusOnSearch = true; |
1894 | 0 | pCtrl = m_xSearchLB.get(); |
1895 | 0 | m_bSearch = true; |
1896 | |
|
1897 | 0 | if( nTxtLen ) |
1898 | 0 | EnableControl_Impl(*m_xNoFormatBtn); |
1899 | 0 | else |
1900 | 0 | m_xNoFormatBtn->set_sensitive(false); |
1901 | 0 | EnableControl_Impl(*m_xAttributeBtn); |
1902 | 0 | } |
1903 | 0 | else |
1904 | 0 | { |
1905 | 0 | m_pImpl->bFocusOnSearch = false; |
1906 | 0 | pCtrl = m_xReplaceLB.get(); |
1907 | 0 | m_bSearch = false; |
1908 | |
|
1909 | 0 | if (!m_xReplaceAttrText->get_label().isEmpty()) |
1910 | 0 | EnableControl_Impl(*m_xNoFormatBtn); |
1911 | 0 | else |
1912 | 0 | m_xNoFormatBtn->set_sensitive(false); |
1913 | 0 | m_xAttributeBtn->set_sensitive(false); |
1914 | 0 | } |
1915 | 0 | m_bSet = true; |
1916 | |
|
1917 | 0 | weld::ComboBox &rComboBox = dynamic_cast<weld::ComboBox&>(*pCtrl); |
1918 | 0 | rComboBox.select_entry_region(0, -1); |
1919 | 0 | ModifyHdl_Impl(rComboBox); |
1920 | |
|
1921 | 0 | if (m_bFormat && nTxtLen) |
1922 | 0 | m_xLayoutBtn->set_label(m_sLayoutStr); |
1923 | 0 | else |
1924 | 0 | { |
1925 | 0 | SvtModuleOptions::EFactory eFactory = getModule(m_rBindings); |
1926 | 0 | bool bWriterApp = |
1927 | 0 | eFactory == SvtModuleOptions::EFactory::WRITER || |
1928 | 0 | eFactory == SvtModuleOptions::EFactory::WRITERWEB || |
1929 | 0 | eFactory == SvtModuleOptions::EFactory::WRITERGLOBAL; |
1930 | 0 | bool bCalcApp = eFactory == SvtModuleOptions::EFactory::CALC; |
1931 | |
|
1932 | 0 | if (bWriterApp) |
1933 | 0 | m_xLayoutBtn->set_label(m_sLayoutWriterStr); |
1934 | 0 | else |
1935 | 0 | { |
1936 | 0 | if (bCalcApp) |
1937 | 0 | m_xLayoutBtn->set_label(m_sLayoutCalcStr); |
1938 | 0 | else |
1939 | 0 | m_xLayoutBtn->set_label(m_sStylesStr); |
1940 | 0 | } |
1941 | 0 | } |
1942 | 0 | } |
1943 | | |
1944 | | IMPL_LINK_NOARG(SvxSearchDialog, LoseFocusHdl_Impl, weld::Widget&, void) |
1945 | 0 | { |
1946 | 0 | SaveToModule_Impl(); |
1947 | 0 | } |
1948 | | |
1949 | | IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, weld::Button&, void) |
1950 | 0 | { |
1951 | 0 | SfxObjectShell* pSh = SfxObjectShell::Current(); |
1952 | |
|
1953 | 0 | DBG_ASSERT( pSh, "no DocShell" ); |
1954 | |
|
1955 | 0 | if (!pSh || m_pImpl->pRanges.empty()) |
1956 | 0 | return; |
1957 | | |
1958 | 0 | SfxItemPool& rPool = pSh->GetPool(); |
1959 | 0 | SfxItemSet aSet(rPool, m_pImpl->pRanges); |
1960 | |
|
1961 | 0 | aSet.MergeRange(SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL); |
1962 | |
|
1963 | 0 | sal_uInt16 nBrushWhich = pSh->GetPool().GetWhichIDFromSlotID(SID_ATTR_BRUSH); |
1964 | 0 | aSet.MergeRange(nBrushWhich, nBrushWhich); |
1965 | |
|
1966 | 0 | aSet.MergeRange(XATTR_FILL_FIRST, XATTR_FILL_LAST); |
1967 | |
|
1968 | 0 | OUString aTxt; |
1969 | | |
1970 | | // ITEM: here we have a problem due to the hand-made ItemSet-like |
1971 | | // SearchAttrItemList. The state 'invalid' seems to be used as unused |
1972 | | // marker. It should be changed to use SfxPoolItemHolder and not need |
1973 | | // that. For now, set by using an own loop to set to that state |
1974 | 0 | SfxWhichIter aIter(aSet); |
1975 | 0 | for ( sal_uInt16 nWh = aIter.FirstWhich(); nWh != 0; nWh = aIter.NextWhich() ) |
1976 | 0 | aSet.InvalidateItem(nWh); |
1977 | 0 | aSet.Put(SvxBrushItem(nBrushWhich)); |
1978 | |
|
1979 | 0 | if (m_bSearch) |
1980 | 0 | { |
1981 | 0 | aTxt = SvxResId( RID_SVXSTR_SEARCH ); |
1982 | 0 | m_pSearchList->Get(aSet); |
1983 | 0 | } |
1984 | 0 | else |
1985 | 0 | { |
1986 | 0 | aTxt = SvxResId( RID_SVXSTR_REPLACE ); |
1987 | 0 | m_pReplaceList->Get(aSet); |
1988 | 0 | } |
1989 | 0 | aSet.DisableItem(SID_ATTR_PARA_MODEL); |
1990 | 0 | aSet.DisableItem(rPool.GetWhichIDFromSlotID(SID_ATTR_PARA_PAGEBREAK)); |
1991 | 0 | aSet.DisableItem(rPool.GetWhichIDFromSlotID(SID_ATTR_PARA_KEEP)); |
1992 | | |
1993 | |
|
1994 | 0 | SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); |
1995 | 0 | ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTabItemDialog(m_xDialog.get(), aSet)); |
1996 | 0 | pDlg->SetText( aTxt ); |
1997 | |
|
1998 | 0 | if ( executeSubDialog(pDlg.get()) != RET_OK ) |
1999 | 0 | return; |
2000 | | |
2001 | 0 | DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" ); |
2002 | 0 | SfxItemSet aOutSet( *pDlg->GetOutputItemSet() ); |
2003 | |
|
2004 | 0 | SearchAttrItemList* pList = m_bSearch ? m_pSearchList.get() : m_pReplaceList.get(); |
2005 | |
|
2006 | 0 | const SfxPoolItem* pItem; |
2007 | 0 | for( sal_uInt16 n = 0; n < pList->Count(); ++n ) |
2008 | 0 | { |
2009 | 0 | SearchAttrInfo* pAItem = &pList->GetObject(n); |
2010 | 0 | if( !IsInvalidItem( pAItem->aItemPtr.getItem() ) && |
2011 | 0 | SfxItemState::SET == aOutSet.GetItemState( |
2012 | 0 | pAItem->aItemPtr.Which(), false, &pItem ) ) |
2013 | 0 | { |
2014 | 0 | pAItem->aItemPtr = SfxPoolItemHolder(*aOutSet.GetPool(), pItem); |
2015 | 0 | aOutSet.ClearItem( pAItem->aItemPtr.Which() ); |
2016 | 0 | } |
2017 | 0 | } |
2018 | |
|
2019 | 0 | if( aOutSet.Count() ) |
2020 | 0 | pList->Put( aOutSet ); |
2021 | |
|
2022 | 0 | PaintAttrText_Impl(); // Set AttributeText in GroupBox |
2023 | 0 | } |
2024 | | |
2025 | | IMPL_LINK_NOARG(SvxSearchDialog, NoFormatHdl_Impl, weld::Button&, void) |
2026 | 0 | { |
2027 | 0 | SvtModuleOptions::EFactory eFactory = getModule(m_rBindings); |
2028 | 0 | bool bWriterApp = |
2029 | 0 | eFactory == SvtModuleOptions::EFactory::WRITER || |
2030 | 0 | eFactory == SvtModuleOptions::EFactory::WRITERWEB || |
2031 | 0 | eFactory == SvtModuleOptions::EFactory::WRITERGLOBAL; |
2032 | 0 | bool bCalcApp = eFactory == SvtModuleOptions::EFactory::CALC; |
2033 | |
|
2034 | 0 | if (bCalcApp) |
2035 | 0 | m_xLayoutBtn->set_label(m_sLayoutCalcStr); |
2036 | 0 | else |
2037 | 0 | { |
2038 | 0 | if (bWriterApp) |
2039 | 0 | m_xLayoutBtn->set_label(m_sLayoutWriterStr); |
2040 | 0 | else |
2041 | 0 | m_xLayoutBtn->set_label(m_sStylesStr); |
2042 | 0 | } |
2043 | |
|
2044 | 0 | m_bFormat = false; |
2045 | 0 | m_xLayoutBtn->set_active( false ); |
2046 | |
|
2047 | 0 | bool bSetOptimalLayoutSize = false; |
2048 | |
|
2049 | 0 | if (m_bSearch) |
2050 | 0 | { |
2051 | 0 | m_pSearchList->Clear(); |
2052 | 0 | m_xSearchAttrText->set_label( u""_ustr ); |
2053 | 0 | if (m_xSearchAttrText->get_visible()) |
2054 | 0 | { |
2055 | 0 | m_xSearchAttrText->hide(); |
2056 | 0 | bSetOptimalLayoutSize = true; |
2057 | 0 | } |
2058 | 0 | } |
2059 | 0 | else |
2060 | 0 | { |
2061 | 0 | m_pReplaceList->Clear(); |
2062 | 0 | m_xReplaceAttrText->set_label( u""_ustr ); |
2063 | 0 | if (m_xReplaceAttrText->get_visible()) |
2064 | 0 | { |
2065 | 0 | m_xReplaceAttrText->hide(); |
2066 | 0 | bSetOptimalLayoutSize = true; |
2067 | 0 | } |
2068 | 0 | } |
2069 | |
|
2070 | 0 | if (bSetOptimalLayoutSize) |
2071 | 0 | m_xDialog->resize_to_request(); |
2072 | |
|
2073 | 0 | m_pImpl->bSaveToModule = false; |
2074 | 0 | TemplateHdl_Impl(*m_xLayoutBtn); |
2075 | 0 | m_pImpl->bSaveToModule = true; |
2076 | 0 | m_xNoFormatBtn->set_sensitive(false); |
2077 | 0 | } |
2078 | | |
2079 | | IMPL_LINK_NOARG(SvxSearchDialog, AttributeHdl_Impl, weld::Button&, void) |
2080 | 0 | { |
2081 | 0 | if (!m_pSearchList || m_pImpl->pRanges.empty()) |
2082 | 0 | return; |
2083 | | |
2084 | 0 | SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); |
2085 | 0 | ScopedVclPtr<VclAbstractDialog> pDlg( |
2086 | 0 | pFact->CreateSvxSearchAttributeDialog(m_xDialog.get(), *m_pSearchList, m_pImpl->pRanges)); |
2087 | 0 | executeSubDialog(pDlg.get()); |
2088 | 0 | PaintAttrText_Impl(); |
2089 | 0 | } |
2090 | | |
2091 | | IMPL_LINK( SvxSearchDialog, TimeoutHdl_Impl, Timer *, pTimer, void ) |
2092 | 0 | { |
2093 | 0 | SfxViewShell* pViewShell = SfxViewShell::Current(); |
2094 | |
|
2095 | 0 | if ( pViewShell ) |
2096 | 0 | { |
2097 | 0 | if ( pViewShell->HasSelection( m_xSearchLB->get_visible() ) ) |
2098 | 0 | EnableControl_Impl(*m_xSelectionBtn); |
2099 | 0 | else |
2100 | 0 | { |
2101 | 0 | m_xSelectionBtn->set_active( false ); |
2102 | 0 | m_xSelectionBtn->set_sensitive(false); |
2103 | 0 | } |
2104 | 0 | } |
2105 | |
|
2106 | 0 | pTimer->Start(); |
2107 | 0 | } |
2108 | | |
2109 | | OUString& SvxSearchDialog::BuildAttrText_Impl( OUString& rStr, |
2110 | | bool bSrchFlag ) const |
2111 | 0 | { |
2112 | 0 | rStr.clear(); |
2113 | |
|
2114 | 0 | SfxObjectShell* pSh = SfxObjectShell::Current(); |
2115 | 0 | DBG_ASSERT( pSh, "no DocShell" ); |
2116 | |
|
2117 | 0 | if ( !pSh ) |
2118 | 0 | return rStr; |
2119 | | |
2120 | 0 | SfxItemPool& rPool = pSh->GetPool(); |
2121 | 0 | SearchAttrItemList* pList = bSrchFlag ? m_pSearchList.get() : m_pReplaceList.get(); |
2122 | |
|
2123 | 0 | if ( !pList ) |
2124 | 0 | return rStr; |
2125 | | |
2126 | | // Metric query |
2127 | 0 | MapUnit eMapUnit = MapUnit::MapCM; |
2128 | 0 | FieldUnit eFieldUnit = pSh->GetModule()->GetFieldUnit(); |
2129 | 0 | switch ( eFieldUnit ) |
2130 | 0 | { |
2131 | 0 | case FieldUnit::MM: eMapUnit = MapUnit::MapMM; break; |
2132 | 0 | case FieldUnit::CM: |
2133 | 0 | case FieldUnit::M: |
2134 | 0 | case FieldUnit::KM: eMapUnit = MapUnit::MapCM; break; |
2135 | 0 | case FieldUnit::TWIP: eMapUnit = MapUnit::MapTwip; break; |
2136 | 0 | case FieldUnit::POINT: |
2137 | 0 | case FieldUnit::PICA: eMapUnit = MapUnit::MapPoint; break; |
2138 | 0 | case FieldUnit::INCH: |
2139 | 0 | case FieldUnit::FOOT: |
2140 | 0 | case FieldUnit::MILE: eMapUnit = MapUnit::MapInch; break; |
2141 | 0 | case FieldUnit::MM_100TH: eMapUnit = MapUnit::Map100thMM; break; |
2142 | 0 | default: ;//prevent warning |
2143 | 0 | } |
2144 | | |
2145 | 0 | IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag()); |
2146 | 0 | for ( sal_uInt16 i = 0; i < pList->Count(); ++i ) |
2147 | 0 | { |
2148 | 0 | const SearchAttrInfo& rItem = pList->GetObject(i); |
2149 | |
|
2150 | 0 | if ( !rStr.isEmpty() ) |
2151 | 0 | rStr += ", "; |
2152 | |
|
2153 | 0 | if ( !IsInvalidItem( rItem.aItemPtr.getItem() ) ) |
2154 | 0 | { |
2155 | 0 | OUString aStr; |
2156 | 0 | rPool.GetPresentation(*rItem.aItemPtr.getItem(), eMapUnit, aStr, aIntlWrapper); |
2157 | 0 | if (aStr.isEmpty()) |
2158 | 0 | { |
2159 | 0 | if (rStr.endsWith(", ")) |
2160 | 0 | rStr = rStr.copy(0, rStr.lastIndexOf(",")); |
2161 | 0 | } |
2162 | 0 | else |
2163 | 0 | rStr += aStr; |
2164 | 0 | } |
2165 | 0 | else if ( rItem.nSlot == SID_ATTR_BRUSH_CHAR ) |
2166 | 0 | { |
2167 | | // Special treatment for text background |
2168 | 0 | rStr += SvxResId( RID_SVXITEMS_BRUSH_CHAR ); |
2169 | 0 | } |
2170 | 0 | else |
2171 | 0 | { |
2172 | 0 | sal_uInt32 nId = SvxAttrNameTable::FindIndex(rItem.nSlot); |
2173 | 0 | if ( RESARRAY_INDEX_NOTFOUND != nId ) |
2174 | 0 | rStr += SvxAttrNameTable::GetString(nId); |
2175 | 0 | } |
2176 | 0 | } |
2177 | 0 | return rStr; |
2178 | 0 | } |
2179 | | |
2180 | | |
2181 | | void SvxSearchDialog::PaintAttrText_Impl() |
2182 | 0 | { |
2183 | 0 | OUString aDesc; |
2184 | 0 | BuildAttrText_Impl(aDesc, m_bSearch); |
2185 | |
|
2186 | 0 | if (!m_bFormat && !aDesc.isEmpty()) |
2187 | 0 | m_bFormat = true; |
2188 | |
|
2189 | 0 | bool bSetOptimalLayoutSize = false; |
2190 | |
|
2191 | 0 | if (m_bSearch) |
2192 | 0 | { |
2193 | 0 | m_xSearchAttrText->set_label( aDesc ); |
2194 | 0 | if (!aDesc.isEmpty() && !m_xSearchAttrText->get_visible()) |
2195 | 0 | { |
2196 | 0 | m_xSearchAttrText->show(); |
2197 | 0 | bSetOptimalLayoutSize = true; |
2198 | 0 | } |
2199 | |
|
2200 | 0 | FocusHdl_Impl(*m_xSearchLB); |
2201 | 0 | } |
2202 | 0 | else |
2203 | 0 | { |
2204 | 0 | m_xReplaceAttrText->set_label( aDesc ); |
2205 | 0 | if (!aDesc.isEmpty() && !m_xReplaceAttrText->get_visible()) |
2206 | 0 | { |
2207 | 0 | m_xReplaceAttrText->show(); |
2208 | 0 | bSetOptimalLayoutSize = true; |
2209 | 0 | } |
2210 | |
|
2211 | 0 | FocusHdl_Impl(*m_xReplaceLB); |
2212 | 0 | } |
2213 | |
|
2214 | 0 | if (bSetOptimalLayoutSize) |
2215 | 0 | m_xDialog->resize_to_request(); |
2216 | 0 | } |
2217 | | |
2218 | | void SvxSearchDialog::SetModifyFlag_Impl( const weld::Widget* pCtrl ) |
2219 | 0 | { |
2220 | 0 | if (m_xSearchLB.get() == pCtrl) |
2221 | 0 | { |
2222 | 0 | m_nModifyFlag |= ModifyFlags::Search; |
2223 | 0 | m_xSearchLB->set_entry_message_type(weld::EntryMessageType::Normal); |
2224 | 0 | if (!SvxSearchDialogWrapper::GetSearchLabel().isEmpty()) |
2225 | 0 | SvxSearchDialogWrapper::SetSearchLabel(u""_ustr); |
2226 | 0 | } |
2227 | 0 | else if ( m_xReplaceLB.get() == pCtrl ) |
2228 | 0 | m_nModifyFlag |= ModifyFlags::Replace; |
2229 | 0 | else if ( m_xWordBtn.get() == pCtrl ) |
2230 | 0 | m_nModifyFlag |= ModifyFlags::Word; |
2231 | 0 | else if ( m_xMatchCaseCB.get() == pCtrl ) |
2232 | 0 | m_nModifyFlag |= ModifyFlags::Exact; |
2233 | 0 | else if ( m_xReplaceBackwardsCB.get() == pCtrl ) |
2234 | 0 | m_nModifyFlag |= ModifyFlags::Backwards; |
2235 | 0 | else if ( m_xNotesBtn.get() == pCtrl ) |
2236 | 0 | m_nModifyFlag |= ModifyFlags::Notes; |
2237 | 0 | else if ( m_xSelectionBtn.get() == pCtrl ) |
2238 | 0 | m_nModifyFlag |= ModifyFlags::Selection; |
2239 | 0 | else if ( m_xRegExpBtn.get() == pCtrl ) |
2240 | 0 | m_nModifyFlag |= ModifyFlags::Regexp; |
2241 | 0 | else if ( m_xWildcardBtn.get() == pCtrl ) |
2242 | 0 | m_nModifyFlag |= ModifyFlags::Wildcard; |
2243 | 0 | else if ( m_xLayoutBtn.get() == pCtrl ) |
2244 | 0 | m_nModifyFlag |= ModifyFlags::Layout; |
2245 | 0 | else if ( m_xSimilarityBox.get() == pCtrl ) |
2246 | 0 | m_nModifyFlag |= ModifyFlags::Similarity; |
2247 | 0 | else if ( m_xCalcSearchInLB.get() == pCtrl ) |
2248 | 0 | { |
2249 | 0 | m_nModifyFlag |= ModifyFlags::Formulas; |
2250 | 0 | m_nModifyFlag |= ModifyFlags::Values; |
2251 | 0 | m_nModifyFlag |= ModifyFlags::CalcNotes; |
2252 | 0 | } |
2253 | 0 | else if ( m_xRowsBtn.get() == pCtrl ) |
2254 | 0 | m_nModifyFlag |= ModifyFlags::Rows; |
2255 | 0 | else if ( m_xColumnsBtn.get() == pCtrl ) |
2256 | 0 | m_nModifyFlag |= ModifyFlags::Columns; |
2257 | 0 | else if ( m_xAllSheetsCB.get() == pCtrl ) |
2258 | 0 | m_nModifyFlag |= ModifyFlags::AllTables; |
2259 | 0 | } |
2260 | | |
2261 | | void SvxSearchDialog::SaveToModule_Impl() |
2262 | 0 | { |
2263 | 0 | if (!m_pSearchItem) |
2264 | 0 | return; |
2265 | | |
2266 | 0 | if ( m_xLayoutBtn->get_active() ) |
2267 | 0 | { |
2268 | 0 | m_pSearchItem->SetSearchString(m_xSearchTmplLB->get_active_text()); |
2269 | 0 | m_pSearchItem->SetReplaceString(m_xReplaceTmplLB->get_active_text()); |
2270 | 0 | } |
2271 | 0 | else |
2272 | 0 | { |
2273 | 0 | m_pSearchItem->SetSearchString(m_xSearchLB->get_active_text()); |
2274 | 0 | m_pSearchItem->SetReplaceString(m_xReplaceLB->get_active_text()); |
2275 | 0 | Remember_Impl(true); |
2276 | 0 | } |
2277 | |
|
2278 | 0 | m_pSearchItem->SetRegExp(false); |
2279 | 0 | m_pSearchItem->SetWildcard(false); |
2280 | 0 | m_pSearchItem->SetLevenshtein(false); |
2281 | 0 | if (GetCheckBoxValue(*m_xRegExpBtn)) |
2282 | 0 | m_pSearchItem->SetRegExp(true); |
2283 | 0 | else if (GetCheckBoxValue(*m_xWildcardBtn)) |
2284 | 0 | m_pSearchItem->SetWildcard(true); |
2285 | 0 | else if (GetCheckBoxValue(*m_xSimilarityBox)) |
2286 | 0 | m_pSearchItem->SetLevenshtein(true); |
2287 | |
|
2288 | 0 | m_pSearchItem->SetWordOnly(GetCheckBoxValue(*m_xWordBtn)); |
2289 | 0 | m_pSearchItem->SetBackward(GetCheckBoxValue(*m_xReplaceBackwardsCB)); |
2290 | 0 | m_pSearchItem->SetNotes(GetCheckBoxValue(*m_xNotesBtn)); |
2291 | 0 | m_pSearchItem->SetPattern(GetCheckBoxValue(*m_xLayoutBtn)); |
2292 | 0 | m_pSearchItem->SetSelection(GetCheckBoxValue(*m_xSelectionBtn)); |
2293 | 0 | m_pSearchItem->SetUseAsianOptions(GetCheckBoxValue(*m_xJapOptionsCB)); |
2294 | |
|
2295 | 0 | SvtSearchOptions aOpt; |
2296 | 0 | aOpt.SetIgnoreDiacritics_CTL(GetNegatedCheckBoxValue(*m_xIncludeDiacritics)); |
2297 | 0 | aOpt.SetIgnoreKashida_CTL(GetNegatedCheckBoxValue(*m_xIncludeKashida)); |
2298 | 0 | aOpt.Commit(); |
2299 | |
|
2300 | 0 | TransliterationFlags nFlags = GetTransliterationFlags(); |
2301 | 0 | if (!m_pSearchItem->IsUseAsianOptions()) |
2302 | 0 | nFlags &= TransliterationFlags::IGNORE_CASE | |
2303 | 0 | TransliterationFlags::IGNORE_WIDTH; |
2304 | 0 | if (GetNegatedCheckBoxValue(*m_xIncludeDiacritics)) |
2305 | 0 | nFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL; |
2306 | 0 | if (GetNegatedCheckBoxValue(*m_xIncludeKashida)) |
2307 | 0 | nFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL; |
2308 | 0 | m_pSearchItem->SetTransliterationFlags(nFlags); |
2309 | |
|
2310 | 0 | if (!m_bWriter) |
2311 | 0 | { |
2312 | 0 | if (m_xCalcSearchInLB->get_active() != -1) |
2313 | 0 | m_pSearchItem->SetCellType( |
2314 | 0 | static_cast<SvxSearchCellType>(m_xCalcSearchInLB->get_active())); |
2315 | |
|
2316 | 0 | m_pSearchItem->SetRowDirection(m_xRowsBtn->get_active()); |
2317 | 0 | m_pSearchItem->SetAllTables(m_xAllSheetsCB->get_active()); |
2318 | 0 | m_pSearchItem->SetSearchFormatted(m_xSearchFormattedCB->get_active()); |
2319 | 0 | } |
2320 | |
|
2321 | 0 | m_pSearchItem->SetCommand(SvxSearchCmd::FIND); |
2322 | 0 | m_nModifyFlag = ModifyFlags::NONE; |
2323 | 0 | const SfxPoolItem* ppArgs[] = { m_pSearchItem.get(), nullptr }; |
2324 | 0 | m_rBindings.GetDispatcher()->Execute(SID_SEARCH_ITEM, SfxCallMode::SLOT, ppArgs); |
2325 | 0 | } |
2326 | | |
2327 | 0 | short SvxSearchDialog::executeSubDialog(VclAbstractDialog * dialog) { |
2328 | 0 | assert(!m_executingSubDialog); |
2329 | 0 | comphelper::ScopeGuard g([this] { m_executingSubDialog = false; }); |
2330 | 0 | m_executingSubDialog = true; |
2331 | 0 | return dialog->Execute(); |
2332 | 0 | } |
2333 | | |
2334 | | SFX_IMPL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper, SID_SEARCH_DLG); |
2335 | | |
2336 | | |
2337 | | SvxSearchDialogWrapper::SvxSearchDialogWrapper( vcl::Window* _pParent, sal_uInt16 nId, |
2338 | | SfxBindings* pBindings, |
2339 | | SfxChildWinInfo const * pInfo ) |
2340 | 0 | : SfxChildWindow( _pParent, nId ) |
2341 | 0 | , dialog(std::make_shared<SvxSearchDialog>(_pParent->GetFrameWeld(), this, *pBindings)) |
2342 | 0 | { |
2343 | 0 | SetController(dialog); |
2344 | 0 | dialog->Initialize( pInfo ); |
2345 | |
|
2346 | 0 | pBindings->Update( SID_SEARCH_ITEM ); |
2347 | 0 | pBindings->Update( SID_SEARCH_OPTIONS ); |
2348 | 0 | pBindings->Update( SID_SEARCH_SEARCHSET ); |
2349 | 0 | pBindings->Update( SID_SEARCH_REPLACESET ); |
2350 | 0 | dialog->m_bConstruct = false; |
2351 | 0 | } |
2352 | | |
2353 | | SvxSearchDialogWrapper::~SvxSearchDialogWrapper () |
2354 | 0 | { |
2355 | 0 | } |
2356 | | |
2357 | | |
2358 | | SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const |
2359 | 0 | { |
2360 | 0 | SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); |
2361 | 0 | aInfo.bVisible = false; |
2362 | 0 | return aInfo; |
2363 | 0 | } |
2364 | | |
2365 | | static void lcl_SetSearchLabelWindow(const OUString& rStr, const SfxViewFrame& rViewFrame) |
2366 | 0 | { |
2367 | 0 | css::uno::Reference< css::beans::XPropertySet > xPropSet( |
2368 | 0 | rViewFrame.GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW); |
2369 | 0 | css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; |
2370 | 0 | xPropSet->getPropertyValue(u"LayoutManager"_ustr) >>= xLayoutManager; |
2371 | 0 | css::uno::Reference< css::ui::XUIElement > xUIElement = |
2372 | 0 | xLayoutManager->getElement(u"private:resource/toolbar/findbar"_ustr); |
2373 | 0 | if (!xUIElement.is()) |
2374 | 0 | return; |
2375 | 0 | css::uno::Reference< css::awt::XWindow > xWindow( |
2376 | 0 | xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); |
2377 | 0 | VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); |
2378 | 0 | for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) |
2379 | 0 | { |
2380 | 0 | ToolBoxItemId id = pToolBox->GetItemId(i); |
2381 | 0 | if (pToolBox->GetItemCommand(id) == ".uno:SearchLabel") |
2382 | 0 | { |
2383 | 0 | LabelItemWindow* pSearchLabel = dynamic_cast<LabelItemWindow*>(pToolBox->GetItemWindow(id)); |
2384 | 0 | assert(pSearchLabel); |
2385 | 0 | pSearchLabel->set_label(rStr, LabelItemWindowType::Info); |
2386 | 0 | pSearchLabel->SetOptimalSize(); |
2387 | 0 | } |
2388 | |
|
2389 | 0 | if (pToolBox->IsFloatingMode() && pToolBox->GetItemCommand(id) == ".uno:FindText") |
2390 | 0 | { |
2391 | 0 | FindTextFieldControl* pFindText = dynamic_cast<FindTextFieldControl*>(pToolBox->GetItemWindow(id)); |
2392 | 0 | assert(pFindText); |
2393 | 0 | if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND)) |
2394 | 0 | pFindText->set_entry_message_type(weld::EntryMessageType::Error); |
2395 | 0 | else if (rStr == SvxResId(RID_SVXSTR_SEARCH_END) || rStr == SvxResId(RID_SVXSTR_SEARCH_START)) |
2396 | 0 | pFindText->set_entry_message_type(weld::EntryMessageType::Warning); |
2397 | 0 | else |
2398 | 0 | pFindText->set_entry_message_type(weld::EntryMessageType::Normal); |
2399 | 0 | } |
2400 | 0 | } |
2401 | 0 | xLayoutManager->doLayout(); |
2402 | 0 | pToolBox->Resize(); |
2403 | 0 | } |
2404 | | |
2405 | | OUString SvxSearchDialogWrapper::GetSearchLabel() |
2406 | 0 | { |
2407 | 0 | SfxViewFrame* pViewFrame = SfxViewFrame::Current(); |
2408 | 0 | if (!pViewFrame) |
2409 | 0 | return OUString(); |
2410 | | |
2411 | 0 | css::uno::Reference< css::beans::XPropertySet > xPropSet( |
2412 | 0 | pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW); |
2413 | 0 | css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; |
2414 | 0 | xPropSet->getPropertyValue(u"LayoutManager"_ustr) >>= xLayoutManager; |
2415 | 0 | if (!xLayoutManager.is()) |
2416 | 0 | return OUString(); |
2417 | 0 | css::uno::Reference< css::ui::XUIElement > xUIElement = |
2418 | 0 | xLayoutManager->getElement(u"private:resource/toolbar/findbar"_ustr); |
2419 | 0 | if (!xUIElement.is()) |
2420 | 0 | return OUString(); |
2421 | 0 | css::uno::Reference< css::awt::XWindow > xWindow( |
2422 | 0 | xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); |
2423 | 0 | VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); |
2424 | 0 | for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) |
2425 | 0 | { |
2426 | 0 | ToolBoxItemId id = pToolBox->GetItemId(i); |
2427 | 0 | if (pToolBox->GetItemCommand(id) == ".uno:SearchLabel") |
2428 | 0 | { |
2429 | 0 | LabelItemWindow* pSearchLabel = dynamic_cast<LabelItemWindow*>(pToolBox->GetItemWindow(id)); |
2430 | 0 | return pSearchLabel ? pSearchLabel->get_label() : OUString(); |
2431 | 0 | } |
2432 | 0 | } |
2433 | 0 | return OUString(); |
2434 | 0 | } |
2435 | | |
2436 | | void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL) |
2437 | 0 | { |
2438 | 0 | SfxViewFrame* pViewFrame = SfxViewFrame::Current(); |
2439 | 0 | if (!pViewFrame) |
2440 | 0 | return; |
2441 | | |
2442 | 0 | OUString sStr; |
2443 | 0 | if (rSL == SearchLabel::End) |
2444 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_END); |
2445 | 0 | else if (rSL == SearchLabel::Start) |
2446 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_START); |
2447 | 0 | else if (rSL == SearchLabel::EndWrapped) |
2448 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_END_WRAPPED); |
2449 | 0 | else if (rSL == SearchLabel::StartWrapped) |
2450 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_START_WRAPPED); |
2451 | 0 | else if (rSL == SearchLabel::EndSheet) |
2452 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_END_SHEET); |
2453 | 0 | else if (rSL == SearchLabel::NotFound) |
2454 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND); |
2455 | 0 | else if (rSL == SearchLabel::NavElementNotFound) |
2456 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_NAV_ELEMENT_NOT_FOUND); |
2457 | 0 | else if (rSL == SearchLabel::ReminderEndWrapped) |
2458 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_REMINDER_END_WRAPPED); |
2459 | 0 | else if (rSL == SearchLabel::ReminderStartWrapped) |
2460 | 0 | sStr = SvxResId(RID_SVXSTR_SEARCH_REMINDER_START_WRAPPED); |
2461 | |
|
2462 | 0 | lcl_SetSearchLabelWindow(sStr, *pViewFrame); |
2463 | |
|
2464 | 0 | if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( pViewFrame-> |
2465 | 0 | GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() ))) |
2466 | 0 | pWrp->getDialog()->SetSearchLabel(sStr); |
2467 | 0 | } |
2468 | | |
2469 | | void SvxSearchDialogWrapper::SetSearchLabel(const OUString& sStr) |
2470 | 0 | { |
2471 | 0 | SfxViewFrame* pViewFrame = SfxViewFrame::Current(); |
2472 | 0 | if (!pViewFrame) |
2473 | 0 | return; |
2474 | | |
2475 | 0 | lcl_SetSearchLabelWindow(sStr, *pViewFrame); |
2476 | 0 | if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( pViewFrame-> |
2477 | 0 | GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() ))) |
2478 | 0 | pWrp->getDialog()->SetSearchLabel(sStr); |
2479 | 0 | } |
2480 | | |
2481 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |