20#include <osl/diagnose.h>
37#include <com/sun/star/awt/XWindow.hpp>
38#include <com/sun/star/container/XNameAccess.hpp>
39#include <com/sun/star/frame/XDispatch.hpp>
40#include <com/sun/star/frame/XDispatchProvider.hpp>
41#include <com/sun/star/frame/XLayoutManager.hpp>
42#include <com/sun/star/beans/PropertyValue.hpp>
43#include <com/sun/star/beans/XPropertySet.hpp>
44#include <com/sun/star/configuration/theDefaultProvider.hpp>
45#include <com/sun/star/frame/ModuleManager.hpp>
46#include <com/sun/star/ui/XUIElement.hpp>
57#include <svx/strings.hrc>
58#include <svx/svxids.hrc>
78#include <officecfg/Office/Common.hxx>
87#define IS_MOBILE (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())
159 std::vector<OUString> aLst = pSrchItem->
GetList();
161 if (aLst.size() > nRememberSize)
162 aLst.resize(nRememberSize);
164 for (
const OUString & s : aLst)
166 rStrLst.push_back(s);
173 DBG_ASSERT( !rStrLst.empty(),
"check in advance");
180 for (
size_t i = 0;
i <
size(); ++
i )
182 (*
this)[
i].pItem = (*this)[
i].pItem->Clone();
188 for (
size_t i = 0;
i <
size(); ++
i )
190 (*
this)[
i].pItem = (*this)[
i].pItem->Clone();
219 nWhich = pItem->
Which();
235 for (
size_t i = 0;
i <
size(); ++
i )
246 for (
size_t i = 0;
i <
size(); ++
i )
248 delete (*
this)[
i].pItem;
249 SrchAttrItemList::clear();
262 delete (*this)[
i].pItem;
269 IS_MOBILE ? OUString(
"svx/ui/findreplacedialog-mobile.ui") : OUString(
"svx/ui/findreplacedialog.ui"),
272 , m_aPresentIdle(
"Bring SvxSearchDialog to Foreground")
276 , bReplaceBackwards(false)
283 , m_xSearchFrame(m_xBuilder->weld_frame(
"searchframe"))
284 , m_xSearchLB(m_xBuilder->weld_combo_box(
"searchterm"))
285 , m_xSearchTmplLB(m_xBuilder->weld_combo_box(
"searchlist"))
286 , m_xSearchAttrText(m_xBuilder->weld_label(
"searchdesc"))
287 , m_xSearchLabel(m_xBuilder->weld_label(
"searchlabel"))
288 , m_xReplaceFrame(m_xBuilder->weld_frame(
"replaceframe"))
289 , m_xReplaceLB(m_xBuilder->weld_combo_box(
"replaceterm"))
290 , m_xReplaceTmplLB(m_xBuilder->weld_combo_box(
"replacelist"))
291 , m_xReplaceAttrText(m_xBuilder->weld_label(
"replacedesc"))
292 , m_xSearchBtn(m_xBuilder->weld_button(
"search"))
293 , m_xBackSearchBtn(m_xBuilder->weld_button(
"backsearch"))
294 , m_xSearchAllBtn(m_xBuilder->weld_button(
"searchall"))
295 , m_xReplaceBtn(m_xBuilder->weld_button(
"replace"))
296 , m_xReplaceAllBtn(m_xBuilder->weld_button(
"replaceall"))
297 , m_xComponentFrame(m_xBuilder->weld_frame(
"componentframe"))
298 , m_xSearchComponent1PB(m_xBuilder->weld_button(
"component1"))
299 , m_xSearchComponent2PB(m_xBuilder->weld_button(
"component2"))
300 , m_xMatchCaseCB(m_xBuilder->weld_check_button(
"matchcase"))
301 , m_xSearchFormattedCB(m_xBuilder->weld_check_button(
"searchformatted"))
302 , m_xWordBtn(m_xBuilder->weld_check_button(
"wholewords"))
303 , m_xCloseBtn(m_xBuilder->weld_button(
"close"))
304 , m_xIncludeDiacritics(m_xBuilder->weld_check_button(
"includediacritics"))
305 , m_xIncludeKashida(m_xBuilder->weld_check_button(
"includekashida"))
306 , m_xOtherOptionsExpander(m_xBuilder->weld_expander(
"OptionsExpander"))
307 , m_xSelectionBtn(m_xBuilder->weld_check_button(
"selection"))
308 , m_xRegExpBtn(m_xBuilder->weld_check_button(
"regexp"))
309 , m_xWildcardBtn(m_xBuilder->weld_check_button(
"wildcard"))
310 , m_xSimilarityBox(m_xBuilder->weld_check_button(
"similarity"))
311 , m_xSimilarityBtn(m_xBuilder->weld_button(
"similaritybtn"))
312 , m_xLayoutBtn(m_xBuilder->weld_check_button(
"layout"))
313 , m_xNotesBtn(m_xBuilder->weld_check_button(
"notes"))
314 , m_xJapMatchFullHalfWidthCB(m_xBuilder->weld_check_button(
"matchcharwidth"))
315 , m_xJapOptionsCB(m_xBuilder->weld_check_button(
"soundslike"))
316 , m_xReplaceBackwardsCB(m_xBuilder->weld_check_button(
"replace_backwards"))
317 , m_xJapOptionsBtn(m_xBuilder->weld_button(
"soundslikebtn"))
318 , m_xAttributeBtn(m_xBuilder->weld_button(
"attributes"))
319 , m_xFormatBtn(m_xBuilder->weld_button(
"format"))
320 , m_xNoFormatBtn(m_xBuilder->weld_button(
"noformat"))
321 , m_xCalcGrid(m_xBuilder->weld_widget(
"calcgrid"))
322 , m_xCalcSearchInFT(m_xBuilder->weld_label(
"searchinlabel"))
323 , m_xCalcSearchInLB(m_xBuilder->weld_combo_box(
"calcsearchin"))
324 , m_xCalcSearchDirFT(m_xBuilder->weld_label(
"searchdir"))
325 , m_xRowsBtn(m_xBuilder->weld_radio_button(
"rows"))
326 , m_xColumnsBtn(m_xBuilder->weld_radio_button(
"cols"))
327 , m_xAllSheetsCB(m_xBuilder->weld_check_button(
"allsheets"))
328 , m_xCalcStrFT(m_xBuilder->weld_label(
"entirecells"))
345 nRememberSize = officecfg::Office::Common::Misc::FindReplaceRememberedSearches::get();
349 auto nTermWidth =
m_xSearchLB->get_approximate_digit_width() * 28;
360 getDialog()->present();
365 PresentTimeoutHdl_Impl(
nullptr);
390 pImpl->aSelectionTimer.SetTimeout( 500 );
391 pImpl->aSelectionTimer.SetInvokeHandler(
434 pImpl->aSelectionTimer.Start();
461 const uno::Reference< frame::XDispatchProvider > xDispatchProv(
xFrame, uno::UNO_QUERY);
463 bool bSearchComponent1 =
false;
464 bool bSearchComponent2 =
false;
465 if(xDispatchProv.is())
467 OUString sTarget(
"_self");
468 pImpl->xCommand1Dispatch = xDispatchProv->queryDispatch(
pImpl->aCommand1URL, sTarget, 0);
469 if (
pImpl->xCommand1Dispatch.is())
470 bSearchComponent1 =
true;
471 pImpl->xCommand2Dispatch = xDispatchProv->queryDispatch(
pImpl->aCommand2URL, sTarget, 0);
472 if (
pImpl->xCommand2Dispatch.is())
473 bSearchComponent2 =
true;
476 if( !(bSearchComponent1 || bSearchComponent2) )
481 uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
483 uno::Sequence< uno::Any > aArgs {
484 Any(OUString(
"/org.openoffice.Office.Common/SearchOptions/")) };
486 uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments(
487 "com.sun.star.configuration.ConfigurationUpdateAccess",
489 uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY);
490 if(xDirectAccess.is())
493 uno::Any aRet = xDirectAccess->getByName(
"ComponentSearchGroupLabel");
496 aRet = xDirectAccess->getByName(
"ComponentSearchCommandLabel1");
499 aRet = xDirectAccess->getByName(
"ComponentSearchCommandLabel2");
504 catch(uno::Exception&){}
569 pImpl->bSaveToModule = b;
583 if (rStr ==
SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND))
590 bool bVal(nSettings & TransliterationFlags::IGNORE_CASE);
592 bVal = bool(nSettings & TransliterationFlags::IGNORE_WIDTH);
689 const uno::Reference< frame::XFrame >
xFrame =
691 uno::Reference< frame::XModuleManager2 > xModuleManager(
692 frame::ModuleManager::create(::comphelper::getProcessComponentContext()));
694 OUString aModuleIdentifier = xModuleManager->identify( xFrame );
697 catch (
const uno::Exception&)
752class ToggleSaveToModule
756 mrDialog(rDialog), mbValue(bValue)
758 mrDialog.SetSaveToModule(mbValue);
761 ~ToggleSaveToModule()
763 mrDialog.SetSaveToModule(!mbValue);
778 ToggleSaveToModule aNoModuleSave(*
this,
false);
811 if (
pSearchItem->GetAppFlag() == SvxSearchApp::CALC )
825 case SvxSearchCellType::FORMULA:
829 case SvxSearchCellType::VALUE:
833 case SvxSearchCellType::NOTE:
865 if (
pSearchItem->GetAppFlag() == SvxSearchApp::DRAW )
909 bool bDisableSearch =
false;
914 bool bText = !bSearchPattern;
926 if ( bSearchPattern )
943 pBase = pStylePool->
Next();
970 if ( !(
pSearchItem->GetSearchString().isEmpty()) && bSetSearch )
978 if ( bSetSearch && !bAttributes )
981 OUString aReplaceTxt =
pSearchItem->GetReplaceString();
986 if ( bSetReplace && !bAttributes )
1007 bDisableSearch =
m_xSearchLB->get_active_text().isEmpty() &&
1012 if ( bDisableSearch )
1051 pImpl->bSaveToModule =
false;
1053 pImpl->bSaveToModule =
true;
1061 if ( !pSSet && !pRSet )
1064 if (
pImpl->pRanges.empty() && pSSet )
1067 bool bSetOptimalLayoutSize =
false;
1076 if ( pSSet->
Count() )
1082 if ( !aDesc.isEmpty() )
1087 bSetOptimalLayoutSize =
true;
1098 if ( pRSet->
Count() )
1104 if ( !aDesc.isEmpty() )
1109 bSetOptimalLayoutSize =
true;
1116 if (bSetOptimalLayoutSize)
1122 ClickHdl_Impl(&rCtrl);
1127 ClickHdl_Impl(&rCtrl);
1132 if ( pCtrl && !
bSet )
1262 if (
pImpl->bSaveToModule )
1268 bool bInclusive = ( m_xLayoutBtn->get_label() == aLayoutStr );
1270 if ( ( &rBtn == m_xSearchBtn.get() ) ||
1271 (&rBtn == m_xBackSearchBtn.get()) ||
1272 ( &rBtn == m_xSearchAllBtn.get() )||
1273 ( &rBtn == m_xReplaceBtn.get() ) ||
1274 ( &rBtn == m_xReplaceAllBtn.get() ) )
1276 if ( m_xLayoutBtn->get_active() && !bInclusive )
1278 pSearchItem->SetSearchString ( m_xSearchTmplLB->get_active_text() );
1279 pSearchItem->SetReplaceString( m_xReplaceTmplLB->get_active_text() );
1283 pSearchItem->SetSearchString ( m_xSearchLB->get_active_text() );
1284 pSearchItem->SetReplaceString( m_xReplaceLB->get_active_text() );
1286 if ( &rBtn == m_xReplaceBtn.get() )
1287 Remember_Impl( m_xReplaceLB->get_active_text(), false );
1290 Remember_Impl( m_xSearchLB->get_active_text(),
true );
1292 if ( &rBtn == m_xReplaceAllBtn.get() )
1293 Remember_Impl( m_xReplaceLB->get_active_text(),
false );
1297 pSearchItem->SetRegExp(
false );
1298 pSearchItem->SetWildcard(
false );
1299 pSearchItem->SetLevenshtein(
false );
1300 if (GetCheckBoxValue(*m_xRegExpBtn))
1301 pSearchItem->SetRegExp(
true );
1302 else if (GetCheckBoxValue(*m_xWildcardBtn))
1303 pSearchItem->SetWildcard(
true );
1304 else if (GetCheckBoxValue(*m_xSimilarityBox))
1305 pSearchItem->SetLevenshtein(
true );
1307 pSearchItem->SetWordOnly(GetCheckBoxValue(*m_xWordBtn));
1309 bool bSetBackwards =
false;
1310 if( &rBtn == m_xBackSearchBtn.get())
1312 bSetBackwards =
true;
1314 else if( &rBtn == m_xReplaceBtn.get())
1316 bSetBackwards = GetCheckBoxValue(*m_xReplaceBackwardsCB);
1317 bReplaceBackwards = GetCheckBoxValue(*m_xReplaceBackwardsCB);
1320 pSearchItem->SetBackward(bSetBackwards);
1322 pSearchItem->SetNotes(GetCheckBoxValue(*m_xNotesBtn));
1323 pSearchItem->SetPattern(GetCheckBoxValue(*m_xLayoutBtn));
1324 pSearchItem->SetSelection(GetCheckBoxValue(*m_xSelectionBtn));
1325 pSearchItem->SetUseAsianOptions(GetCheckBoxValue(*m_xJapOptionsCB));
1327 if( !pSearchItem->IsUseAsianOptions())
1328 nFlags &= TransliterationFlags::IGNORE_CASE |
1329 TransliterationFlags::IGNORE_WIDTH;
1330 if (GetNegatedCheckBoxValue(*m_xIncludeDiacritics))
1331 nFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL;
1332 if (GetNegatedCheckBoxValue(*m_xIncludeKashida))
1333 nFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL;
1334 pSearchItem->SetTransliterationFlags( nFlags );
1338 if ( m_xCalcSearchInLB->get_active() != -1)
1339 pSearchItem->SetCellType(
static_cast<SvxSearchCellType>(m_xCalcSearchInLB->get_active()) );
1341 pSearchItem->SetRowDirection( m_xRowsBtn->get_active() );
1342 pSearchItem->SetAllTables( m_xAllSheetsCB->get_active() );
1343 pSearchItem->SetSearchFormatted( m_xSearchFormattedCB->get_active() );
1346 if ((&rBtn == m_xSearchBtn.get()) || (&rBtn == m_xBackSearchBtn.get()))
1347 pSearchItem->SetCommand( SvxSearchCmd::FIND );
1348 else if ( &rBtn == m_xSearchAllBtn.get() )
1349 pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL );
1350 else if ( &rBtn == m_xReplaceBtn.get() )
1351 pSearchItem->SetCommand( SvxSearchCmd::REPLACE );
1352 else if ( &rBtn == m_xReplaceAllBtn.get() )
1353 pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL );
1356 if ( !bFormat && pSearchItem->GetPattern() )
1359 pSearchList->Clear();
1362 pReplaceList->Clear();
1365 const SfxPoolItem* ppArgs[] = { pSearchItem.get(),
nullptr };
1368 else if ( &rBtn == m_xCloseBtn.get() )
1370 if ( !m_xLayoutBtn->get_active() || bInclusive )
1372 OUString
aStr( m_xSearchLB->get_active_text() );
1374 if ( !
aStr.isEmpty() )
1375 Remember_Impl(
aStr,
true );
1376 aStr = m_xReplaceLB->get_active_text();
1378 if ( !
aStr.isEmpty() )
1379 Remember_Impl(
aStr,
false );
1381 SaveToModule_Impl();
1384 else if (&rBtn == m_xSimilarityBtn.get())
1388 pSearchItem->IsLEVRelaxed(),
1389 pSearchItem->GetLEVOther(),
1390 pSearchItem->GetLEVShorter(),
1391 pSearchItem->GetLEVLonger() ));
1392 if ( executeSubDialog(pDlg.
get()) ==
RET_OK )
1394 pSearchItem->SetLEVRelaxed( pDlg->IsRelaxed() );
1395 pSearchItem->SetLEVOther( pDlg->GetOther() );
1396 pSearchItem->SetLEVShorter( pDlg->GetShorter() );
1397 pSearchItem->SetLEVLonger( pDlg->GetLonger() );
1398 SaveToModule_Impl();
1401 else if (&rBtn == m_xJapOptionsBtn.get())
1407 pSearchItem->GetTransliterationFlags() ));
1408 int nRet = executeSubDialog(aDlg.
get());
1412 pSearchItem->SetTransliterationFlags( nFlags );
1413 ApplyTransliterationFlags_Impl( nFlags );
1416 else if (&rBtn == m_xSearchComponent1PB.get() || &rBtn == m_xSearchComponent2PB.get())
1418 uno::Sequence < beans::PropertyValue > aArgs(2);
1419 beans::PropertyValue* pArgs = aArgs.getArray();
1420 pArgs[0].Name =
"SearchString";
1421 pArgs[0].Value <<= m_xSearchLB->get_active_text();
1422 pArgs[1].Name =
"ParentWindow";
1423 pArgs[1].Value <<=
m_xDialog->GetXWindow();
1424 if (&rBtn == m_xSearchComponent1PB.get())
1426 if ( pImpl->xCommand1Dispatch.is() )
1427 pImpl->xCommand1Dispatch->dispatch(pImpl->aCommand1URL, aArgs);
1431 if ( pImpl->xCommand2Dispatch.is() )
1432 pImpl->xCommand2Dispatch->dispatch(pImpl->aCommand2URL, aArgs);
1441 SetModifyFlag_Impl( &rEd );
1446 bool bAllowEmptySearch = (pSearchItem->GetAppFlag() == SvxSearchApp::CALC);
1448 if (&rEd != m_xSearchLB.get() && &rEd != m_xReplaceLB.get())
1451 sal_Int32 nSrchTxtLen = m_xSearchLB->get_active_text().getLength();
1452 sal_Int32 nReplTxtLen = 0;
1453 if (bAllowEmptySearch)
1454 nReplTxtLen = m_xReplaceLB->get_active_text().getLength();
1455 sal_Int32 nAttrTxtLen = m_xSearchAttrText->get_label().getLength();
1457 if (nSrchTxtLen || nReplTxtLen || nAttrTxtLen)
1459 EnableControl_Impl(*m_xSearchBtn);
1460 EnableControl_Impl(*m_xBackSearchBtn);
1461 EnableControl_Impl(*m_xReplaceBtn);
1462 if (!bWriter || !m_xNotesBtn->get_active())
1464 EnableControl_Impl(*m_xSearchAllBtn);
1465 EnableControl_Impl(*m_xReplaceAllBtn);
1470 m_xComponentFrame->set_sensitive(
false);
1471 m_xSearchBtn->set_sensitive(
false);
1472 m_xBackSearchBtn->set_sensitive(
false);
1473 m_xSearchAllBtn->set_sensitive(
false);
1474 m_xReplaceBtn->set_sensitive(
false);
1475 m_xReplaceAllBtn->set_sensitive(
false);
1481 if ( pImpl->bSaveToModule )
1482 SaveToModule_Impl();
1488 if ( m_xLayoutBtn->get_active() )
1490 if ( !pFamilyController )
1495 switch ( pSearchItem->GetFamily() )
1497 case SfxStyleFamily::Char:
1498 nId = SID_STYLE_FAMILY1;
break;
1500 case SfxStyleFamily::Para:
1501 nId = SID_STYLE_FAMILY2;
break;
1503 case SfxStyleFamily::Frame:
1504 nId = SID_STYLE_FAMILY3;
break;
1506 case SfxStyleFamily::Page:
1507 nId = SID_STYLE_FAMILY4;
break;
1509 case SfxStyleFamily::All:
1513 OSL_FAIL(
"StyleSheetFamily was changed?" );
1517 pFamilyController.reset(
1520 m_xSearchTmplLB->clear();
1521 m_xReplaceTmplLB->clear();
1523 m_xSearchTmplLB->show();
1524 m_xReplaceTmplLB->show();
1525 m_xSearchLB->hide();
1526 m_xReplaceLB->hide();
1528 m_xSearchAttrText->set_label( sDesc );
1529 m_xReplaceAttrText->set_label( sDesc );
1531 if(!sDesc.isEmpty())
1533 if (!m_xReplaceAttrText->get_visible() || !m_xReplaceAttrText->get_visible())
1535 m_xSearchAttrText->show();
1536 m_xReplaceAttrText->show();
1541 m_xFormatBtn->set_sensitive(
false);
1542 m_xNoFormatBtn->set_sensitive(
false);
1543 m_xAttributeBtn->set_sensitive(
false);
1544 m_xSimilarityBox->set_sensitive(
false);
1545 m_xSimilarityBtn->set_sensitive(
false);
1551 pFamilyController.reset();
1554 m_xSearchLB->show();
1555 m_xReplaceLB->show();
1556 m_xSearchTmplLB->hide();
1557 m_xReplaceTmplLB->hide();
1559 m_xSearchAttrText->set_label( BuildAttrText_Impl( sDesc,
true ) );
1560 m_xReplaceAttrText->set_label( BuildAttrText_Impl( sDesc,
false ) );
1562 if(!sDesc.isEmpty())
1564 if (!m_xReplaceAttrText->get_visible() || !m_xReplaceAttrText->get_visible())
1566 m_xSearchAttrText->show();
1567 m_xReplaceAttrText->show();
1572 EnableControl_Impl(*m_xFormatBtn);
1573 EnableControl_Impl(*m_xAttributeBtn);
1574 EnableControl_Impl(*m_xSimilarityBox);
1576 FocusHdl_Impl( bSearch ? *m_xSearchLB : *m_xReplaceLB );
1579 pImpl->bSaveToModule =
false;
1580 FlagHdl_Impl(*m_xLayoutBtn);
1581 pImpl->bSaveToModule =
true;
1586 if ( rStr.isEmpty() )
1597 pArr->erase(pArr->begin() +
nPos);
1606 pArr->insert(pArr->begin(), rStr);
1625 pBase = rPool.
Next();
1631 if ( !aOldSrch.isEmpty() )
1635 if ( !aOldRepl.isEmpty() )
1656 bool bNoSearch =
true;
1658 bool bEnableSearch = bool( SearchOptionFlags::SEARCH &
nOptions );
1666 if ( SearchOptionFlags::SEARCHALL &
nOptions )
1673 if ( SearchOptionFlags::REPLACE &
nOptions )
1688 if ( SearchOptionFlags::REPLACE_ALL &
nOptions )
1702 if ( SearchOptionFlags::WHOLE_WORDS &
nOptions )
1706 if ( SearchOptionFlags::BACKWARDS &
nOptions )
1716 if ( SearchOptionFlags::REG_EXP &
nOptions )
1720 if ( SearchOptionFlags::WILDCARD &
nOptions )
1724 if ( SearchOptionFlags::EXACT &
nOptions )
1728 if ( SearchOptionFlags::SELECTION &
nOptions )
1732 if ( SearchOptionFlags::FAMILIES &
nOptions )
1736 if ( SearchOptionFlags::FORMAT &
nOptions )
1749 if ( SearchOptionFlags::SIMILARITY &
nOptions )
1778 ( SearchOptionFlags::SEARCHALL &
nOptions ) )
1789 ( SearchOptionFlags::REPLACE_ALL &
nOptions ) )
1799 if ( SearchOptionFlags::BACKWARDS &
nOptions )
1846 && ( SearchOptionFlags::FORMAT &
nOptions )
1884 sal_Int32 nTxtLen = m_xSearchAttrText->get_label().getLength();
1886 if (pCtrl == m_xSearchLB.get())
1889 pImpl->bFocusOnSearch =
true;
1890 pCtrl = m_xSearchLB.get();
1894 EnableControl_Impl(*m_xNoFormatBtn);
1896 m_xNoFormatBtn->set_sensitive(
false);
1897 EnableControl_Impl(*m_xAttributeBtn);
1901 pImpl->bFocusOnSearch =
false;
1902 pCtrl = m_xReplaceLB.get();
1905 if (!m_xReplaceAttrText->get_label().isEmpty())
1906 EnableControl_Impl(*m_xNoFormatBtn);
1908 m_xNoFormatBtn->set_sensitive(
false);
1909 m_xAttributeBtn->set_sensitive(
false);
1915 ModifyHdl_Impl(rComboBox);
1917 if (bFormat && nTxtLen)
1918 m_xLayoutBtn->set_label(aLayoutStr);
1929 m_xLayoutBtn->set_label(aLayoutWriterStr);
1933 m_xLayoutBtn->set_label(aLayoutCalcStr);
1935 m_xLayoutBtn->set_label(aStylesStr);
1942 SaveToModule_Impl();
1951 if ( !pSh || pImpl->pRanges.empty() )
1957 aSet.
MergeRange(SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL);
1971 aTxt =
SvxResId( RID_SVXSTR_SEARCH );
1972 pSearchList->Get( aSet );
1976 aTxt =
SvxResId( RID_SVXSTR_REPLACE );
1977 pReplaceList->Get( aSet );
1986 pDlg->SetText( aTxt );
1988 if ( executeSubDialog(pDlg.
get()) !=
RET_OK )
1991 DBG_ASSERT( pDlg->GetOutputItemSet(),
"invalid Output-Set" );
1992 SfxItemSet aOutSet( *pDlg->GetOutputItemSet() );
1997 for( sal_uInt16
n = 0;
n < pList->
Count(); ++
n )
2004 delete pAItem->
pItem;
2010 if( aOutSet.
Count() )
2011 pList->
Put( aOutSet );
2013 PaintAttrText_Impl();
2026 m_xLayoutBtn->set_label( aLayoutCalcStr );
2030 m_xLayoutBtn->set_label( aLayoutWriterStr);
2032 m_xLayoutBtn->set_label( aStylesStr );
2036 m_xLayoutBtn->set_active(
false );
2038 bool bSetOptimalLayoutSize =
false;
2042 pSearchList->Clear();
2043 m_xSearchAttrText->set_label(
"" );
2044 if (m_xSearchAttrText->get_visible())
2046 m_xSearchAttrText->hide();
2047 bSetOptimalLayoutSize =
true;
2052 pReplaceList->Clear();
2053 m_xReplaceAttrText->set_label(
"" );
2054 if (m_xReplaceAttrText->get_visible())
2056 m_xReplaceAttrText->hide();
2057 bSetOptimalLayoutSize =
true;
2061 if (bSetOptimalLayoutSize)
2064 pImpl->bSaveToModule =
false;
2065 TemplateHdl_Impl(*m_xLayoutBtn);
2066 pImpl->bSaveToModule =
true;
2067 m_xNoFormatBtn->set_sensitive(
false);
2072 if ( !pSearchList || pImpl->pRanges.empty() )
2077 executeSubDialog(pDlg.
get());
2078 PaintAttrText_Impl();
2087 if ( pViewShell->
HasSelection( m_xSearchLB->get_visible() ) )
2088 EnableControl_Impl(*m_xSelectionBtn);
2091 m_xSelectionBtn->set_active(
false );
2092 m_xSelectionBtn->set_sensitive(
false);
2100 bool bSrchFlag )
const
2117 MapUnit eMapUnit = MapUnit::MapCM;
2119 switch ( eFieldUnit )
2121 case FieldUnit::MM: eMapUnit = MapUnit::MapMM;
break;
2124 case FieldUnit::KM: eMapUnit = MapUnit::MapCM;
break;
2125 case FieldUnit::TWIP: eMapUnit = MapUnit::MapTwip;
break;
2126 case FieldUnit::POINT:
2127 case FieldUnit::PICA: eMapUnit = MapUnit::MapPoint;
break;
2128 case FieldUnit::INCH:
2129 case FieldUnit::FOOT:
2130 case FieldUnit::MILE: eMapUnit = MapUnit::MapInch;
break;
2131 case FieldUnit::MM_100TH: eMapUnit = MapUnit::Map100thMM;
break;
2136 for ( sal_uInt16
i = 0;
i < pList->
Count(); ++
i )
2140 if ( !rStr.isEmpty() )
2149 if (rStr.endsWith(
", "))
2150 rStr = rStr.copy(0, rStr.lastIndexOf(
","));
2155 else if ( rItem.
nSlot == SID_ATTR_BRUSH_CHAR )
2158 rStr +=
SvxResId( RID_SVXITEMS_BRUSH_CHAR );
2176 if ( !
bFormat && !aDesc.isEmpty() )
2179 bool bSetOptimalLayoutSize =
false;
2187 bSetOptimalLayoutSize =
true;
2198 bSetOptimalLayoutSize =
true;
2204 if (bSetOptimalLayoutSize)
2292 nFlags &= TransliterationFlags::IGNORE_CASE |
2293 TransliterationFlags::IGNORE_WIDTH;
2295 nFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL;
2297 nFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL;
2333 dialog->Initialize( pInfo );
2335 pBindings->
Update( SID_SEARCH_ITEM );
2336 pBindings->
Update( SID_SEARCH_OPTIONS );
2337 pBindings->
Update( SID_SEARCH_SEARCHSET );
2338 pBindings->
Update( SID_SEARCH_REPLACESET );
2339 dialog->bConstruct =
false;
2356 bool bNotFound = rStr ==
SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND);
2358 css::uno::Reference< css::beans::XPropertySet > xPropSet(
2360 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
2361 xPropSet->getPropertyValue(
"LayoutManager") >>= xLayoutManager;
2362 css::uno::Reference< css::ui::XUIElement > xUIElement =
2363 xLayoutManager->getElement(
"private:resource/toolbar/findbar");
2364 if (!xUIElement.is())
2366 css::uno::Reference< css::awt::XWindow > xWindow(
2367 xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW);
2369 for (ToolBox::ImplToolItems::size_type
i = 0; pToolBox &&
i < pToolBox->GetItemCount(); ++
i)
2372 if (pToolBox->GetItemCommand(
id) ==
".uno:SearchLabel")
2375 assert(pSearchLabel);
2383 if (pToolBox->GetItemCommand(
id) ==
".uno:FindText")
2393 xLayoutManager->doLayout();
2403 css::uno::Reference< css::beans::XPropertySet > xPropSet(
2405 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
2406 xPropSet->getPropertyValue(
"LayoutManager") >>= xLayoutManager;
2407 if (!xLayoutManager.is())
2409 css::uno::Reference< css::ui::XUIElement > xUIElement =
2410 xLayoutManager->getElement(
"private:resource/toolbar/findbar");
2411 if (!xUIElement.is())
2413 css::uno::Reference< css::awt::XWindow > xWindow(
2414 xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW);
2416 for (ToolBox::ImplToolItems::size_type
i = 0; pToolBox &&
i < pToolBox->GetItemCount(); ++
i)
2419 if (pToolBox->GetItemCommand(
id) ==
".uno:SearchLabel")
2422 return pSearchLabel ? pSearchLabel->
get_label() : OUString();
2436 sStr =
SvxResId(RID_SVXSTR_SEARCH_END);
2438 sStr =
SvxResId(RID_SVXSTR_SEARCH_START);
2440 sStr =
SvxResId(RID_SVXSTR_SEARCH_END_WRAPPED);
2442 sStr =
SvxResId(RID_SVXSTR_SEARCH_START_WRAPPED);
2444 sStr =
SvxResId(RID_SVXSTR_SEARCH_END_SHEET);
2446 sStr =
SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND);
2448 sStr =
SvxResId(RID_SVXSTR_SEARCH_NAV_ELEMENT_NOT_FOUND);
2450 sStr =
SvxResId(RID_SVXSTR_SEARCH_REMINDER_END_WRAPPED);
2452 sStr =
SvxResId(RID_SVXSTR_SEARCH_REMINDER_START_WRAPPED);
2457 GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
2458 pWrp->getDialog()->SetSearchLabel(sStr);
2469 GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
2470 pWrp->getDialog()->SetSearchLabel(sStr);
SfxApplication * SfxGetpApp()
Reference< XExecutableDialog > m_xDialog
void set_entry_message_type(weld::EntryMessageType eType)
void set_label(const OUString &rLabel)
OUString get_label() const
void Insert(const SearchAttrItem &rItem)
void Put(const SfxItemSet &rSet)
SearchAttrItem & GetObject(sal_uInt16 nPos)
SfxItemSet & Get(SfxItemSet &rSet)
void LeaveRegistrations(std::string_view pFile={}, int nLine=0)
sal_uInt16 EnterRegistrations(std::string_view pFile={}, int nLine=0)
void Update(sal_uInt16 nId)
const SfxPoolItem * ExecuteSynchron(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr)
SfxDispatcher * GetDispatcher() const
void Invalidate(sal_uInt16 nId)
css::uno::Reference< css::frame::XFrame > GetActiveFrame() const
void SetController(std::shared_ptr< SfxDialogController > controller)
virtual SfxChildWinInfo GetInfo() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const SfxPoolItem * GetCurItem() const
sal_uInt16 GetCurPos() const
const SfxPoolItem * NextItem()
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void InvalidateAllItems()
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
void MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo)
void InvalidateItem(sal_uInt16 nWhich)
virtual void ChildWinDispose() override
virtual void Activate() override
FieldUnit GetFieldUnit() const
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
SfxModule * GetModule() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxItemSet & GetItemSet() const
void PutItem(const SfxPoolItem &rItem)
SfxItemPool & GetPool() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
std::vector< OUString > & GetList()
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
SfxStyleSheetBase * Next()
const OUString & GetName() const
virtual bool IsUsed() const
void ToggleChildWindow(sal_uInt16)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxFrame & GetFrame() const
virtual bool HasSelection(bool bText=true) const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
constexpr tools::Long Height() const
static bool IsCTLFontEnabled()
static EFactory ClassifyFactoryByServiceName(std::u16string_view sName)
void SetSearchFormatted(bool bVal)
void SetIgnoreKashida_CTL(bool bVal)
void SetSimilaritySearch(bool bVal)
bool IsSearchFormatted() const
void SetUseWildcard(bool bVal)
bool IsIgnoreKashida_CTL() const
void SetUseAsianOptions(bool bVal)
void SetWholeWordsOnly(bool bVal)
bool IsIgnoreDiacritics_CTL() const
void SetUseRegularExpression(bool bVal)
void SetBackwards(bool bVal)
void SetIgnoreDiacritics_CTL(bool bVal)
void SetSearchForStyles(bool bVal)
virtual VclPtr< VclAbstractDialog > CreateSvxSearchAttributeDialog(weld::Window *pParent, SearchAttrItemList &rLst, const WhichRangesContainer &pWhRanges)=0
virtual VclPtr< SfxAbstractTabDialog > CreateTabItemDialog(weld::Window *pParent, const SfxItemSet &rSet)=0
virtual VclPtr< AbstractSvxJSearchOptionsDialog > CreateSvxJSearchOptionsDialog(weld::Window *pParent, const SfxItemSet &rOptionsSet, TransliterationFlags nInitialFlags)=0
virtual VclPtr< AbstractSvxSearchSimilarityDialog > CreateSvxSearchSimilarityDialog(weld::Window *pParent, bool bRelax, sal_uInt16 nOther, sal_uInt16 nShorter, sal_uInt16 nLonger)=0
static SvxAbstractDialogFactory * Create()
virtual ~SvxSearchDialogWrapper() override
static OUString GetSearchLabel()
SvxSearchDialogWrapper(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo const *pInfo)
std::shared_ptr< SvxSearchDialog > dialog
static void SetSearchLabel(const SearchLabel &rSL)
In this modeless dialog the attributes for a search are configured and a search is started from it.
std::unique_ptr< weld::ComboBox > m_xReplaceTmplLB
SVX_DLLPRIVATE void PaintAttrText_Impl()
std::unique_ptr< weld::Label > m_xReplaceAttrText
std::unique_ptr< weld::Button > m_xSearchComponent2PB
std::unique_ptr< weld::CheckButton > m_xMatchCaseCB
std::vector< OUString > aSearchStrings
virtual void Activate() override
std::unique_ptr< weld::Label > m_xCalcStrFT
std::unique_ptr< weld::CheckButton > m_xSearchFormattedCB
bool m_executingSubDialog
SVX_DLLPRIVATE void Remember_Impl(const OUString &rStr, bool bSearch)
std::unique_ptr< weld::Button > m_xSearchAllBtn
std::unique_ptr< weld::CheckButton > m_xIncludeKashida
SVX_DLLPRIVATE void SaveToModule_Impl()
SVX_DLLPRIVATE void Init_Impl(bool bHasItemSet)
std::unique_ptr< weld::Label > m_xCalcSearchDirFT
SVX_DLLPRIVATE void Construct_Impl()
std::unique_ptr< weld::Button > m_xAttributeBtn
std::unique_ptr< weld::CheckButton > m_xSelectionBtn
std::unique_ptr< weld::CheckButton > m_xJapMatchFullHalfWidthCB
SVX_DLLPRIVATE void InitAttrList_Impl(const SfxItemSet *pSSet, const SfxItemSet *pRSet)
virtual void Close() override
std::unique_ptr< weld::Button > m_xBackSearchBtn
std::unique_ptr< SvxSearchController > pSearchController
std::unique_ptr< weld::Frame > m_xComponentFrame
std::unique_ptr< SvxSearchItem > pSearchItem
std::unique_ptr< weld::CheckButton > m_xSimilarityBox
std::unique_ptr< weld::CheckButton > m_xIncludeDiacritics
friend class SvxSearchController
std::unique_ptr< weld::ComboBox > m_xReplaceLB
std::unique_ptr< weld::Frame > m_xReplaceFrame
std::unique_ptr< SearchAttrItemList > pReplaceList
std::unique_ptr< weld::CheckButton > m_xAllSheetsCB
std::unique_ptr< weld::CheckButton > m_xRegExpBtn
std::unique_ptr< weld::CheckButton > m_xJapOptionsCB
std::unique_ptr< weld::RadioButton > m_xColumnsBtn
std::unique_ptr< SearchDlg_Impl > pImpl
SVX_DLLPRIVATE void EnableControls_Impl(const SearchOptionFlags nFlags)
virtual ~SvxSearchDialog() override
std::unique_ptr< weld::CheckButton > m_xLayoutBtn
std::unique_ptr< weld::ComboBox > m_xCalcSearchInLB
std::unique_ptr< weld::Button > m_xJapOptionsBtn
std::unique_ptr< weld::Expander > m_xOtherOptionsExpander
void SetSearchLabel(const OUString &rStr)
std::unique_ptr< weld::Button > m_xCloseBtn
SVX_DLLPRIVATE void ClickHdl_Impl(const weld::Widget *pCtrl)
SVX_DLLPRIVATE void TemplatesChanged_Impl(SfxStyleSheetBasePool &rPool)
std::unique_ptr< weld::CheckButton > m_xWordBtn
std::unique_ptr< weld::Button > m_xSearchBtn
std::unique_ptr< weld::CheckButton > m_xNotesBtn
std::unique_ptr< SvxSearchController > pOptionsController
SVX_DLLPRIVATE void ShowOptionalControls_Impl()
std::unique_ptr< weld::Button > m_xSimilarityBtn
std::vector< OUString > aReplaceStrings
TransliterationFlags nTransliterationFlags
std::unique_ptr< weld::RadioButton > m_xRowsBtn
SVX_DLLPRIVATE void InitControls_Impl()
virtual void ChildWinDispose() override
void SetSaveToModule(bool b)
std::unique_ptr< weld::CheckButton > m_xWildcardBtn
SVX_DLLPRIVATE bool IsOtherOptionsExpanded() const
SVX_DLLPRIVATE short executeSubDialog(VclAbstractDialog *dialog)
std::unique_ptr< weld::Label > m_xSearchAttrText
std::unique_ptr< weld::Button > m_xFormatBtn
OUString aLayoutWriterStr
std::unique_ptr< weld::Button > m_xNoFormatBtn
std::unique_ptr< weld::Label > m_xCalcSearchInFT
std::unique_ptr< weld::Frame > m_xSearchFrame
SVX_DLLPRIVATE void EnableControl_Impl(const weld::Widget &rCtrl)
std::unique_ptr< weld::ComboBox > m_xSearchLB
SVX_DLLPRIVATE void SetItem_Impl(const SvxSearchItem *pItem)
std::unique_ptr< weld::Button > m_xSearchComponent1PB
std::unique_ptr< weld::Button > m_xReplaceBtn
std::unique_ptr< SvxSearchController > pFamilyController
std::unique_ptr< weld::CheckButton > m_xReplaceBackwardsCB
std::unique_ptr< weld::Button > m_xReplaceAllBtn
SVX_DLLPRIVATE void SetModifyFlag_Impl(const weld::Widget *pCtrl)
SVX_DLLPRIVATE OUString & BuildAttrText_Impl(OUString &rStr, bool bSrchFlag) const
TransliterationFlags GetTransliterationFlags() const
std::unique_ptr< weld::Widget > m_xCalcGrid
std::unique_ptr< weld::ComboBox > m_xSearchTmplLB
std::unique_ptr< weld::Label > m_xSearchLabel
SearchOptionFlags nOptions
SvxSearchDialog(weld::Window *pParent, SfxChildWindow *pChildWin, SfxBindings &rBind)
std::unique_ptr< SearchAttrItemList > pSearchList
SVX_DLLPRIVATE void ApplyTransliterationFlags_Impl(TransliterationFlags nSettings)
virtual SvxSearchItem * Clone(SfxItemPool *pPool=nullptr) const override
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
virtual short Execute()=0
reference_type * get() const
virtual void SetSizePixel(const Size &rNewSize)
virtual Size GetSizePixel() const
virtual int find_text(const OUString &rStr) const=0
virtual void select_entry_region(int nStartPos, int nEndPos)=0
void append_text(const OUString &rStr)
void insert_text(int pos, const OUString &rStr)
virtual void remove(int pos)=0
virtual int get_count() const=0
virtual bool get_active() const=0
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual TransliterationFlags GetTransliterationFlags() const override
#define LINK(Instance, Class, Member)
bool IsJapaneseFindEnabled()
class SvxPropertySetInfoPool
Reference< XComponentContext > getProcessComponentContext()
std::shared_ptr< T > make_shared(Args &&... args)
enumrange< T >::Iterator begin(enumrange< T >)
bool IsInvalidItem(const SfxPoolItem *pItem)
#define RESARRAY_INDEX_NOTFOUND
static void lcl_SetSearchLabelWindow(const OUString &rStr, SfxViewFrame &rViewFrame)
static void ListToStrArr_Impl(sal_uInt16 nId, std::vector< OUString > &rStrLst, weld::ComboBox &rCBox, sal_uInt16 nRememberSize)
static void StrArrToList_Impl(TypedWhichId< SfxStringListItem > nId, const std::vector< OUString > &rStrLst)
IMPL_LINK_NOARG(SvxSearchDialog, PresentTimeoutHdl_Impl, Timer *, void)
SFX_IMPL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper, SID_SEARCH_DLG)
IMPL_LINK(SvxSearchDialog, LBSelectHdl_Impl, weld::ComboBox &, rCtrl, void)
std::vector< SearchAttrItem > SrchAttrItemList
WhichRangesContainer pRanges
uno::Reference< frame::XDispatch > xCommand2Dispatch
uno::Reference< frame::XDispatch > xCommand1Dispatch
Reference< XFrame > xFrame
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)