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