41#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
42#include <rtl/strbuf.hxx>
44#include <osl/diagnose.h>
53#include <svx/svxids.hrc>
62 , m_xLanguageBox(m_xBuilder->weld_widget(
"langbox"))
63 , m_xLanguageLB(new
SvxLanguageBox(m_xBuilder->weld_combo_box(
"lang")))
65 bool bShowSWOptions =
false;
66 bool bOpenSmartTagOptions =
false;
70 const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(_pSet, SID_AUTO_CORRECT_DLG,
false);
72 bShowSWOptions =
true;
74 const SfxBoolItem* pItem2 = SfxItemSet::GetItem<SfxBoolItem>(_pSet, SID_OPEN_SMARTTAGOPTIONS,
false);
76 bOpenSmartTagOptions =
true;
111 nLangList |= SvxLanguageListFlags::CTL;
113 nLangList |= SvxLanguageListFlags::CJK;
132 if ( bOpenSmartTagOptions )
170 OUString sPageId = GetCurPageId();
171 if (sPageId ==
"replace")
177 else if (sPageId ==
"exceptions")
186 :
SfxTabPage(pPage, pController,
"cui/ui/acoroptionspage.ui",
"AutocorrectOptionsPage", &
rSet)
187 , m_sInput(
CuiResId(RID_CUISTR_USE_REPLACE))
188 , m_sDoubleCaps(
CuiResId(RID_CUISTR_CPTL_STT_WORD))
189 , m_sStartCap(
CuiResId(RID_CUISTR_CPTL_STT_SENT))
190 , m_sBoldUnderline(
CuiResId(RID_CUISTR_BOLD_UNDER))
192 , m_sDOI(
CuiResId(RID_CUISTR_DETECT_DOI))
193 , m_sNoDblSpaces(
CuiResId(RID_CUISTR_NO_DBL_SPACES))
194 , m_sDash(
CuiResId(RID_CUISTR_DASH))
195 , m_sAccidentalCaps(
CuiResId(RID_CUISTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
196 , m_xCheckLB(m_xBuilder->weld_tree_view(
"checklist"))
209 return std::make_unique<OfaAutocorrOptionsPage>(pPage, pController, *
rSet);
213#define CBCOL_SECOND 1
232 bool bReturn = nFlags != pAutoCorrect->
GetFlags();
250 const int nRow =
m_xCheckLB->n_children() - 1;
300 ImpUserData(OUString* pText,
vcl::Font* pFnt)
301 { pString = pText; pFont = pFnt;}
313 std::unique_ptr<weld::MetricSpinButton> m_xPrcntMF;
316 : GenericDialogController(pParent,
"cui/ui/percentdialog.ui",
"PercentDialog")
317 , m_xPrcntMF(m_xBuilder->weld_metric_spin_button(
"margin",
FieldUnit::
PERCENT))
333enum OfaAutoFmtOptions
342 DEL_SPACES_AT_STT_END,
343 DEL_SPACES_BETWEEN_LINES,
353 MERGE_SINGLE_LINE_PARA
360 :
SfxTabPage(pPage, pController,
"cui/ui/applyautofmtpage.ui",
"ApplyAutoFmtPage", &
rSet)
361 , sDeleteEmptyPara(
CuiResId(RID_CUISTR_DEL_EMPTY_PARA))
362 , sUseReplaceTbl(
CuiResId(RID_CUISTR_USE_REPLACE))
363 , sCapitalStartWord(
CuiResId(RID_CUISTR_CPTL_STT_WORD))
364 , sCapitalStartSentence(
CuiResId(RID_CUISTR_CPTL_STT_SENT))
365 , sUserStyle(
CuiResId(RID_CUISTR_USER_STYLE))
366 , sBullet(
CuiResId(RID_CUISTR_BULLET))
367 , sBoldUnder(
CuiResId(RID_CUISTR_BOLD_UNDER))
368 , sNoDblSpaces(
CuiResId(RID_CUISTR_NO_DBL_SPACES))
369 , sCorrectCapsLock(
CuiResId(RID_CUISTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
370 , sDetectURL(
CuiResId(RID_CUISTR_DETECT_URL))
371 , sDetectDOI(
CuiResId(RID_CUISTR_DETECT_DOI))
373 , sRightMargin(
CuiResId(RID_CUISTR_RIGHT_MARGIN))
376 , sTable(
CuiResId(RID_CUISTR_CREATE_TABLE))
377 , sReplaceTemplates(
CuiResId(RID_CUISTR_REPLACE_TEMPLATES))
378 , sDelSpaceAtSttEnd(
CuiResId(RID_CUISTR_DEL_SPACES_AT_STT_END))
379 , sDelSpaceBetweenLines(
CuiResId(RID_CUISTR_DEL_SPACES_BETWEEN_LINES))
381 , m_xCheckLB(m_xBuilder->weld_tree_view(
"list"))
382 , m_xEditPB(m_xBuilder->weld_button(
"edit"))
387 std::vector<int> aWidths
400 const int nRow =
m_xCheckLB->n_children() - 1;
410 delete weld::fromId<ImpUserData*>(
m_xCheckLB->get_id(REPLACE_BULLETS));
411 delete weld::fromId<ImpUserData*>(
m_xCheckLB->get_id(APPLY_NUMBERING));
412 delete weld::fromId<ImpUserData*>(
m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA));
418 return std::make_unique<OfaSwAutoFmtOptionsPage>(pPage, pController, *rAttrSet);
423 bool bModified =
false;
533 if(bModified || nFlags != pAutoCorrect->
GetFlags())
622 pUserData =
new ImpUserData(&
sMargin,
nullptr);
635 m_xEditPB->set_sensitive(rBox.get_selected_id().toInt64() != 0);
646 int nSelEntryPos = m_xCheckLB->get_selected_index();
647 if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
650 ImpUserData* pUserData = weld::fromId<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos));
652 aMapDlg.
SetChar( (*pUserData->pString)[0] );
656 *pUserData->pFont = aFont;
659 OUString aOUStr( &aChar, 1 );
660 *pUserData->pString = aOUStr;
661 if (nSelEntryPos == REPLACE_BULLETS)
662 m_xCheckLB->set_text(nSelEntryPos, sNum.replaceFirst(
"%1", aOUStr), 2);
664 m_xCheckLB->set_text(nSelEntryPos, sBullet.replaceFirst(
"%1", aOUStr), 2);
667 else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
671 aDlg.GetPrcntFld().set_value(nPercent, FieldUnit::PERCENT);
674 nPercent =
static_cast<sal_uInt16
>(aDlg.GetPrcntFld().get_value(FieldUnit::PERCENT));
676 m_xCheckLB->set_text(nSelEntryPos, sRightMargin.replaceFirst(
"%1", sMargin), 2);
684 :
SfxTabPage(pPage, pController,
"cui/ui/acorreplacepage.ui",
"AcorReplacePage", &
rSet)
687 , bHasSelectionText(false)
689 , bReplaceEditChanged(false)
691 , m_xTextOnlyCB(m_xBuilder->weld_check_button(
"textonly"))
692 , m_xShortED(m_xBuilder->weld_entry(
"origtext"))
693 , m_xReplaceED(m_xBuilder->weld_entry(
"newtext"))
694 , m_xReplaceTLB(m_xBuilder->weld_tree_view(
"tabview"))
695 , m_xNewReplacePB(m_xBuilder->weld_button(
"new"))
696 , m_xReplacePB(m_xBuilder->weld_button(
"replace"))
697 , m_xDeleteReplacePB(m_xBuilder->weld_button(
"delete"))
698 , m_xButtonBox(m_xBuilder->weld_container(
"buttonbox"))
705 auto nMaxWidth =
m_xButtonBox->get_preferred_size().Width();
720 auto nColWidth =
m_xReplaceTLB->get_approximate_digit_width() * 32;
745 return std::make_unique<OfaAutocorrReplacePage>(pPage, pController, *
rSet);
757 return DeactivateRC::LeavePage;
768 std::vector<SvxAutocorrWord> aDeleteWords;
769 std::vector<SvxAutocorrWord> aNewWords;
775 aDeleteWords.push_back( aDeleteWord );
778 aNewWords.reserve( rStringChangeList.
aNewEntries.size() );
785 if (bKeepSourceFormatting)
793 aNewWords.push_back( aNewWord );
805 eLang = eNewLanguage;
841 DoubleString &rDouble = rArray[nIndex];
842 bool bTextOnly = nullptr == rDouble.pUserData;
844 if (bSWriter || bTextOnly)
849 OUString sId = weld::toId(rDouble.pUserData);
850 m_xReplaceTLB->set_id(rIter, sId);
852 m_xReplaceTLB->set_text(rIter, rDouble.sShort, 0);
853 m_xReplaceTLB->set_text(rIter, rDouble.sLong, 1);
857 aFormatText.insert(rDouble.sShort);
866 m_xReplaceTLB->bulk_insert_for_each(rContent.size(), [
this, rContent](
weld::TreeIter& rIter,
int nIndex) {
867 auto const& elem = rContent[nIndex];
868 bool bTextOnly = elem.IsTextOnly();
870 if (bSWriter || bTextOnly)
875 OUString sId = weld::toId(m_xTextOnlyCB.get());
876 m_xReplaceTLB->set_id(rIter, sId);
878 m_xReplaceTLB->set_text(rIter, elem.GetShort(), 0);
879 m_xReplaceTLB->set_text(rIter, elem.GetLong(), 1);
883 aFormatText.insert(elem.GetShort());
885 },
nullptr, &m_aReplaceFixedWidths);
886 m_xNewReplacePB->set_sensitive(
false);
887 m_xDeleteReplacePB->set_sensitive(
false);
893 bHasSelectionText =
true;
895 m_xReplaceED->set_text(sSelection);
896 m_xTextOnlyCB->set_active(!bSWriter);
897 m_xTextOnlyCB->set_sensitive(bSWriter && !sSelection.isEmpty());
901 m_xTextOnlyCB->set_active(
true);
902 m_xTextOnlyCB->set_sensitive(
false);
930 if(!bFirstSelect || !bHasSelectionText)
932 int nEntry = rBox.get_selected_index();
933 OUString sTmpShort(rBox.get_text(nEntry, 0));
936 bool bSameContent = 0 == maCompareClass.compareString(sTmpShort, m_xShortED->get_text());
937 int nStartPos, nEndPos;
938 m_xShortED->get_selection_bounds(nStartPos, nEndPos);
939 if (m_xShortED->get_text() != sTmpShort)
941 m_xShortED->set_text(sTmpShort);
945 m_xShortED->select_region(nStartPos, nEndPos);
948 m_xReplaceED->set_text(rBox.get_text(nEntry, 1));
950 m_xTextOnlyCB->set_active(rBox.get_id(nEntry).isEmpty());
954 bFirstSelect =
false;
957 m_xNewReplacePB->set_sensitive(
false);
958 m_xDeleteReplacePB->set_sensitive(
true);
964 for (
size_t i = 0;
i < rNewArray.size();
i++)
966 if (rNewArray[
i].sShort == sShort)
968 rNewArray.erase(rNewArray.begin() +
i);
974 for (
size_t i = 0;
i < rDeletedArray.size();
i++)
976 if (rDeletedArray[
i].sShort == sShort)
978 rDeletedArray.erase(rDeletedArray.begin() +
i);
984 rNewArray.push_back(aNewString);
985 if (bKeepSourceFormatting)
992 for (
size_t i = 0;
i < rNewArray.size();
i++)
994 if (rNewArray[
i].sShort == sShort)
996 rNewArray.erase(rNewArray.begin() +
i);
1002 for (
size_t i = 0;
i < rDeletedArray.size();
i++)
1004 if (rDeletedArray[
i].sShort == sShort)
1006 rDeletedArray.erase(rDeletedArray.begin() +
i);
1012 rDeletedArray.push_back(aDeletedString);
1022 return NewDelHdl(&rEdit);
1027 m_aReplaceFixedWidths.clear();
1028 int x,
y, width, height;
1029 if (m_xReplaceED->get_extents_relative_to(*m_xReplaceTLB,
x,
y, width, height))
1031 m_aReplaceFixedWidths.push_back(
x);
1032 m_aReplaceFixedWidths.push_back(width - 1);
1033 m_xReplaceTLB->set_column_fixed_widths(m_aReplaceFixedWidths);
1042 DBG_ASSERT( nEntry != -1,
"no entry selected" );
1055 if (!sEntry.isEmpty() && (!
m_xReplaceED->get_text().isEmpty() ||
1072 for (j = 0; j <
nCount; ++j)
1081 if (bKeepSourceFormatting)
1109 std::unique_ptr<weld::TreeIter> xFirstSel(m_xReplaceTLB->make_iterator());
1110 bool bFirstSelIterSet = m_xReplaceTLB->get_selected(xFirstSel.get());
1111 bool bShort = &rEdt == m_xShortED.get();
1112 const OUString rEntry = rEdt.get_text();
1113 const OUString rRepString = m_xReplaceED->get_text();
1114 OUString aWordStr(pCharClass->lowercase(rEntry));
1118 if(!rEntry.isEmpty())
1120 bool bFound =
false;
1121 bool bTmpSelEntry=
false;
1123 m_xReplaceTLB->all_foreach([
this, &rEntry, &rRepString, &bFound,
1124 &bTmpSelEntry, &bFirstSelIterSet,
1126 OUString aTestStr = m_xReplaceTLB->get_text(rIter, 0);
1127 if( maCompareClass.compareString(rEntry, aTestStr ) == 0 )
1129 if (!rRepString.isEmpty())
1130 bFirstSelect = true;
1131 m_xReplaceTLB->set_cursor(rIter);
1132 m_xReplaceTLB->copy_iterator(rIter, *xFirstSel);
1133 bFirstSelIterSet = true;
1134 m_xNewReplacePB->set_label(sModify);
1140 aTestStr = pCharClass->lowercase( aTestStr );
1141 if( aTestStr.startsWith(aWordStr) && !bTmpSelEntry )
1143 m_xReplaceTLB->scroll_to_row(rIter);
1144 bTmpSelEntry = true;
1151 m_xReplaceTLB->select(-1);
1152 bFirstSelIterSet =
false;
1153 m_xNewReplacePB->set_label(sNew);
1154 if( bReplaceEditChanged )
1155 m_xTextOnlyCB->set_sensitive(
false);
1157 m_xDeleteReplacePB->set_sensitive(bFound);
1159 else if (m_xReplaceTLB->n_children() > 0)
1161 m_xReplaceTLB->scroll_to_row(0);
1167 bReplaceEditChanged =
true;
1168 if (bFirstSelIterSet)
1170 m_xNewReplacePB->set_label(sModify);
1174 const OUString& rShortTxt = m_xShortED->get_text();
1175 bool bEnableNew = !rShortTxt.isEmpty() &&
1176 ( !rRepString.isEmpty() ||
1177 ( bHasSelectionText && bSWriter )) &&
1178 ( !bFirstSelIterSet || rRepString !=
1179 m_xReplaceTLB->get_text(*xFirstSel, 1) );
1182 for (
auto const& elem : aFormatText)
1184 if(elem == rShortTxt)
1191 m_xNewReplacePB->set_sensitive(bEnableNew);
1196 for (
auto const& elem : rStrings)
1207 :
SfxTabPage(pPage, pController,
"cui/ui/acorexceptpage.ui",
"AcorExceptPage", &
rSet)
1210 , m_xAbbrevED(m_xBuilder->weld_entry(
"abbrev"))
1211 , m_xAbbrevLB(m_xBuilder->weld_tree_view(
"abbrevlist"))
1212 , m_xNewAbbrevPB(m_xBuilder->weld_button(
"newabbrev"))
1213 , m_xDelAbbrevPB(m_xBuilder->weld_button(
"delabbrev"))
1214 , m_xAutoAbbrevCB(m_xBuilder->weld_check_button(
"autoabbrev"))
1215 , m_xDoubleCapsED(m_xBuilder->weld_entry(
"double"))
1216 , m_xDoubleCapsLB(m_xBuilder->weld_tree_view(
"doublelist"))
1217 , m_xNewDoublePB(m_xBuilder->weld_button(
"newdouble"))
1218 , m_xDelDoublePB(m_xBuilder->weld_button(
"deldouble"))
1219 , m_xAutoCapsCB(m_xBuilder->weld_check_button(
"autodouble"))
1252 return std::make_unique<OfaAutocorrExceptPage>(pPage, pController, *
rSet);
1264 return DeactivateRC::LeavePage;
1274 if(eCurLang !=
eLang)
1280 size_t nCount = pWrdList->size();
1284 OUString aString = (*pWrdList)[ --
i ];
1288 pWrdList->erase_at(
i);
1294 pWrdList->insert(elem);
1303 size_t nCount = pCplList->size();
1307 OUString aString = (*pCplList)[ --
i ];
1310 pCplList->erase_at(
i);
1316 pCplList->insert(elem);
1329 size_t nCount = pWrdList->size();
1333 OUString aString = (*pWrdList)[ --
i ];
1336 pWrdList->erase_at(
i);
1351 size_t nCount = pCplList->size();
1354 OUString aString = (*pCplList)[ --
i ];
1357 pCplList->erase_at(
i);
1360 sal_Int32 nAbbrevCount =
m_xAbbrevLB->n_children();
1361 for( sal_Int32 ia = 0; ia < nAbbrevCount; ++ia )
1392 eLang = eNewLanguage;
1440 for(
i = 0;
i < pCplList->size();
i++ )
1444 for(
i = 0;
i < pWrdList->size();
i++ )
1468 return NewDelHdl(&rEdit);
1507 if (&rBox == m_xAbbrevLB.get())
1509 m_xAbbrevED->set_text(rBox.get_selected_text());
1510 m_xNewAbbrevPB->set_sensitive(
false);
1511 m_xDelAbbrevPB->set_sensitive(
true);
1515 m_xDoubleCapsED->set_text(rBox.get_selected_text());
1516 m_xNewDoublePB->set_sensitive(
false);
1517 m_xDelDoublePB->set_sensitive(
true);
1523 const OUString& sEntry = rEdt.get_text();
1524 bool bEntryLen = !sEntry.isEmpty();
1525 if (&rEdt == m_xAbbrevED.get())
1527 bool bSame =
lcl_FindEntry(*m_xAbbrevLB, sEntry, maCompareClass);
1528 if(bSame && sEntry != m_xAbbrevLB->get_selected_text())
1529 rEdt.set_text(m_xAbbrevLB->get_selected_text());
1530 m_xNewAbbrevPB->set_sensitive(!bSame && bEntryLen);
1531 m_xDelAbbrevPB->set_sensitive(bSame && bEntryLen);
1535 bool bSame =
lcl_FindEntry(*m_xDoubleCapsLB, sEntry, maCompareClass);
1536 if(bSame && sEntry != m_xDoubleCapsLB->get_selected_text())
1537 rEdt.set_text(m_xDoubleCapsLB->get_selected_text());
1538 m_xNewDoublePB->set_sensitive(!bSame && bEntryLen);
1539 m_xDelDoublePB->set_sensitive(bSame && bEntryLen);
1550 REPLACE_ANGLE_QUOTES
1563 rCheckLB.
set_text(nRow, rTxt, nTextCol);
1567 :
SfxTabPage(pPage, pController,
"cui/ui/applylocalizedpage.ui",
"ApplyLocalizedPage", &
rSet)
1568 , sNonBrkSpace(
CuiResId(RID_CUISTR_NON_BREAK_SPACE))
1569 , sOrdinal(
CuiResId(RID_CUISTR_ORDINAL))
1570 , sTransliterateRTL(
CuiResId(RID_CUISTR_OLD_HUNGARIAN))
1571 , sAngleQuotes(
CuiResId(RID_CUISTR_ANGLE_QUOTES))
1576 , m_xSingleTypoCB(m_xBuilder->weld_check_button(
"singlereplace"))
1577 , m_xSglStartQuotePB(m_xBuilder->weld_button(
"startsingle"))
1578 , m_xSglStartExFT(m_xBuilder->weld_label(
"singlestartex"))
1579 , m_xSglEndQuotePB(m_xBuilder->weld_button(
"endsingle"))
1580 , m_xSglEndExFT(m_xBuilder->weld_label(
"singleendex"))
1581 , m_xSglStandardPB(m_xBuilder->weld_button(
"defaultsingle"))
1582 , m_xDoubleTypoCB(m_xBuilder->weld_check_button(
"doublereplace"))
1583 , m_xDblStartQuotePB(m_xBuilder->weld_button(
"startdouble"))
1584 , m_xDblStartExFT(m_xBuilder->weld_label(
"doublestartex"))
1585 , m_xDblEndQuotePB(m_xBuilder->weld_button(
"enddouble"))
1586 , m_xDblEndExFT(m_xBuilder->weld_label(
"doubleendex"))
1587 , m_xDblStandardPB(m_xBuilder->weld_button(
"defaultdouble"))
1588 , m_sStandard(m_xSglStartExFT->get_label())
1589 , m_xCheckLB(m_xBuilder->weld_tree_view(
"checklist"))
1590 , m_xSwCheckLB(m_xBuilder->weld_tree_view(
"list"))
1595 bool bShowSWOptions =
false;
1599 bShowSWOptions =
true;
1601 if ( bShowSWOptions )
1603 std::vector<int> aWidths
1632 return std::make_unique<OfaQuoteTabPage>(pPage, pController, *rAttrSet);
1650 bool bModified =
false;
1682 bool bReturn = nFlags != pAutoCorrect->
GetFlags();
1708 if( bModified || bReturn )
1801 if (&rBtn == m_xSglEndQuotePB.get())
1803 else if (&rBtn == m_xDblStartQuotePB.get())
1805 else if (&rBtn == m_xDblEndQuotePB.get())
1818 cDlg = cSglStartQuote;
1820 cDlg = pAutoCorrect->
GetQuote(
'\'',
true, eLang);
1823 cDlg = cSglEndQuote;
1825 cDlg = pAutoCorrect->
GetQuote(
'\'',
false, eLang);
1830 cDlg = pAutoCorrect->
GetQuote(
'\"',
true, eLang);
1835 cDlg = pAutoCorrect->
GetQuote(
'\"',
false, eLang);
1838 OSL_FAIL(
"svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" );
1843 aMap.SetChar( cDlg );
1844 aMap.DisableFontSelection();
1852 cSglStartQuote = cNewChar;
1853 m_xSglStartExFT->set_label(ChangeStringExt_Impl(cNewChar));
1856 cSglEndQuote = cNewChar;
1857 m_xSglEndExFT->set_label(ChangeStringExt_Impl(cNewChar));
1860 cStartQuote = cNewChar;
1861 m_xDblStartExFT->set_label(ChangeStringExt_Impl(cNewChar));
1864 cEndQuote = cNewChar;
1865 m_xDblEndExFT->set_label(ChangeStringExt_Impl(cNewChar));
1872 if (&rBtn == m_xDblStandardPB.get())
1875 m_xDblStartExFT->set_label(ChangeStringExt_Impl(0));
1877 m_xDblEndExFT->set_label(ChangeStringExt_Impl(0));
1883 m_xSglStartExFT->set_label(ChangeStringExt_Impl(0));
1885 m_xSglEndExFT->set_label(ChangeStringExt_Impl(0));
1895 sal_UCS4 aStrCodes[32] = { 0,
' ',
'(',
'U',
'+',
'0' };
1896 aStrCodes[0] = cChar;
1899 while( (cChar >> (4*nHexLen)) != 0 )
1901 for(
int i = nHexLen; --
i >= 0;)
1903 sal_UCS4 cHexDigit = ((cChar >> (4*
i)) & 0x0f) +
'0';
1904 if( cHexDigit >
'9' )
1905 cHexDigit +=
'A' - (
'9' + 1);
1906 aStrCodes[ nFullLen++ ] = cHexDigit;
1908 aStrCodes[ nFullLen++ ] =
')';
1910 OUString aOUStr( aStrCodes, nFullLen );
1916 :
SfxTabPage(pPage, pController,
"cui/ui/wordcompletionpage.ui",
1917 "WordCompletionPage", &
rSet)
1918 , m_pAutoCompleteList(nullptr)
1919 , m_nAutoCmpltListCnt(0)
1920 , m_xCBActiv(m_xBuilder->weld_check_button(
"enablewordcomplete"))
1921 , m_xCBAppendSpace(m_xBuilder->weld_check_button(
"appendspace"))
1922 , m_xCBAsTip(m_xBuilder->weld_check_button(
"showastip"))
1923 , m_xCBCollect(m_xBuilder->weld_check_button(
"collectwords"))
1924 , m_xCBRemoveList(m_xBuilder->weld_check_button(
"whenclosing"))
1925 , m_xDCBExpandKey(m_xBuilder->weld_combo_box(
"acceptwith"))
1926 , m_xNFMinWordlen(m_xBuilder->weld_spin_button(
"minwordlen"))
1927 , m_xNFMaxEntries(m_xBuilder->weld_spin_button(
"maxentries"))
1928 , m_xLBEntries(m_xBuilder->weld_tree_view(
"entries"))
1929 , m_xPBEntries(m_xBuilder->weld_button(
"delete"))
1935 if (aPrefSize.
Width() > nMaxWidth)
1943 m_xLBEntries->set_selection_mode(SelectionMode::Multiple);
1946 static const sal_uInt16 aKeyCodes[] = {
1955 for(
const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys )
1976 return std::make_unique<OfaAutoCompleteTabPage>(pPage, pController, *
rSet);
1981 bool bModified =
false, bCheck;
2001 sal_uInt16 nVal =
static_cast<sal_uInt16
>(
m_xNFMinWordlen->get_value());
2005 sal_uInt32 nList =
static_cast<sal_uInt32
>(
m_xNFMaxEntries->get_value());
2066 const OUString* pStr =
2067 &(*m_pAutoCompleteList)[
n]->GetAutoCompleteString();
2089 auto rows = m_xLBEntries->get_selected_rows();
2090 std::sort(rows.begin(), rows.end());
2091 while (!rows.empty())
2093 sal_Int32
nPos = rows.back();
2094 OUString* pStr = weld::fromId<OUString*>(m_xLBEntries->get_id(
nPos));
2095 m_xLBEntries->remove(
nPos);
2097 m_pAutoCompleteList->erase(&hack);
2104 bool bEnable = rBox.get_active();
2105 if (&rBox == m_xCBActiv.get())
2107 m_xCBAppendSpace->set_sensitive(bEnable);
2108 m_xCBAppendSpace->set_sensitive(bEnable);
2109 m_xCBAsTip->set_sensitive(bEnable);
2110 m_xDCBExpandKey->set_sensitive(bEnable);
2112 else if (&rBox == m_xCBCollect.get())
2113 m_xCBRemoveList->set_sensitive(bEnable);
2124 OStringBuffer sData;
2126 rtl_TextEncoding nEncode = osl_getThreadTextEncoding();
2132 pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
2133 pCntnr->CopyToClipboard(
m_xLBEntries->get_clipboard());
2138 bool bHandled =
false;
2143 DeleteHdl(*m_xPBEntries);
2161 :
SfxTabPage(pPage, pController,
"cui/ui/smarttagoptionspage.ui",
"SmartTagOptionsPage", &
rSet)
2162 , m_xMainCB(m_xBuilder->weld_check_button(
"main"))
2163 , m_xSmartTagTypesLB(m_xBuilder->weld_tree_view(
"list"))
2164 , m_xPropertiesPB(m_xBuilder->weld_button(
"properties"))
2183 return std::make_unique<OfaSmartTagOptionsTabPage>(pPage, pController, *
rSet);
2190struct ImplSmartTagLBUserData
2192 OUString maSmartTagType;
2194 sal_Int32 mnSmartTagIdx;
2196 ImplSmartTagLBUserData( OUString aSmartTagType,
2198 sal_Int32 nSmartTagIdx ) :
2199 maSmartTagType(
std::move( aSmartTagType )),
2200 mxRec(
std::move( xRec )),
2201 mnSmartTagIdx( nSmartTagIdx ) {}
2213 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(
m_xSmartTagTypesLB->get_id(
i));
2231 for ( sal_uInt32
i = 0;
i < nNumberOfRecognizers; ++
i )
2235 const OUString
aName = xRec->getName( aLocale );
2236 const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount();
2238 for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j )
2240 const OUString aSmartTagType = xRec->getSmartTagName(j);
2241 OUString aSmartTagCaption = rSmartTagMgr.
GetSmartTagCaption( aSmartTagType, aLocale );
2243 if ( aSmartTagCaption.isEmpty() )
2244 aSmartTagCaption = aSmartTagType;
2246 const OUString aLBEntry = aSmartTagCaption +
" (" +
aName +
")";
2262 const int nPos = m_xSmartTagTypesLB->get_selected_index();
2263 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(
nPos));
2265 const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2268 if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2269 xRec->displayPropertyPage( nSmartTagIdx, aLocale );
2276 const bool bEnable = m_xMainCB->get_active();
2277 m_xSmartTagTypesLB->set_sensitive(bEnable);
2278 m_xPropertiesPB->set_sensitive(
false);
2285 SelectHdl(*m_xSmartTagTypesLB);
2292 const int nPos = m_xSmartTagTypesLB->get_selected_index();
2295 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(
nPos));
2297 const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2300 if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2301 m_xPropertiesPB->set_sensitive(
true);
2303 m_xPropertiesPB->set_sensitive(
false);
2315 if ( !pSmartTagMgr )
2318 bool bModifiedSmartTagTypes =
false;
2319 std::vector< OUString > aDisabledSmartTagTypes;
2325 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(
m_xSmartTagTypesLB->get_id(
i));
2329 bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled );
2332 aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType );
2338 if ( bModifiedSmartTagTypes || bModifiedRecognize )
2340 bool bLabelTextWithSmartTags =
m_xMainCB->get_active();
2341 pSmartTagMgr->
WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags :
nullptr,
2342 bModifiedSmartTagTypes ? &aDisabledSmartTagTypes :
nullptr );
2357 if ( !pSmartTagMgr )
IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, weld::TreeView &, rBox, void)
static bool lcl_FindEntry(weld::TreeView &rLB, const OUString &rEntry, CollatorWrapper const &rCmpClass)
IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox &, void)
static LanguageType eLastDialogLanguage
static bool lcl_FindInArray(std::vector< OUString > &rStrings, std::u16string_view rString)
std::vector< DoubleString > DoubleStringArray
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
sal_Int32 loadDefaultCollator(const css::lang::Locale &rLocale, sal_Int32 nOption)
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
LanguageType getLanguageType(bool bResolveSystem=true) const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::SpinButton > m_xNFMinWordlen
std::unique_ptr< weld::CheckButton > m_xCBAsTip
Show as tip.
void CopyToClipboard() const
virtual ~OfaAutoCompleteTabPage() override
std::unique_ptr< weld::ComboBox > m_xDCBExpandKey
std::unique_ptr< weld::Button > m_xPBEntries
virtual void Reset(const SfxItemSet *rSet) override
sal_uInt16 m_nAutoCmpltListCnt
std::unique_ptr< weld::CheckButton > m_xCBAppendSpace
Append space.
std::unique_ptr< weld::CheckButton > m_xCBRemoveList
...save the list for later use...
std::unique_ptr< weld::SpinButton > m_xNFMaxEntries
virtual void ActivatePage(const SfxItemSet &) override
std::unique_ptr< weld::CheckButton > m_xCBActiv
Enable word completion.
std::unique_ptr< weld::CheckButton > m_xCBCollect
Collect words.
std::unique_ptr< weld::TreeView > m_xLBEntries
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
OfaAutoCompleteTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
editeng::SortedAutoCompleteStrings * m_pAutoCompleteList
std::unique_ptr< weld::Widget > m_xLanguageBox
void EnableLanguage(bool bEnable)
OfaAutoCorrDlg(weld::Window *pParent, const SfxItemSet *pSet)
std::unique_ptr< SvxLanguageBox > m_xLanguageLB
virtual ~OfaAutoCorrDlg() override
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::Button > m_xNewDoublePB
std::unique_ptr< weld::TreeView > m_xAbbrevLB
void SetLanguage(LanguageType eSet)
StringsTable aStringsTable
std::unique_ptr< weld::TreeView > m_xDoubleCapsLB
virtual bool FillItemSet(SfxItemSet *rSet) override
OfaAutocorrExceptPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
bool NewDelHdl(const weld::Widget *)
std::unique_ptr< weld::Entry > m_xDoubleCapsED
std::unique_ptr< weld::Button > m_xDelDoublePB
std::unique_ptr< weld::Button > m_xNewAbbrevPB
std::unique_ptr< weld::CheckButton > m_xAutoCapsCB
virtual void ActivatePage(const SfxItemSet &) override
std::unique_ptr< weld::Entry > m_xAbbrevED
virtual ~OfaAutocorrExceptPage() override
CollatorWrapper maCompareClass
std::unique_ptr< weld::Button > m_xDelAbbrevPB
std::unique_ptr< weld::CheckButton > m_xAutoAbbrevCB
void RefillReplaceBoxes(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage)
Box filled with new language.
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual bool FillItemSet(SfxItemSet *rSet) override
OfaAutocorrOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
virtual void Reset(const SfxItemSet *rSet) override
OUString m_sBoldUnderline
std::unique_ptr< weld::TreeView > m_xCheckLB
void InsertEntry(const OUString &rTxt)
virtual void ActivatePage(const SfxItemSet &) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
OUString m_sAccidentalCaps
virtual ~OfaAutocorrOptionsPage() override
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< weld::CheckButton > m_xTextOnlyCB
CollatorWrapper maCompareClass
std::unique_ptr< weld::TreeView > m_xReplaceTLB
std::vector< int > m_aReplaceFixedWidths
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
void SetLanguage(LanguageType eSet)
StringChangeTable aChangesTable
std::set< OUString > aFormatText
void RefillReplaceBox(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage)
bool NewDelHdl(const weld::Widget *)
std::unique_ptr< weld::Entry > m_xReplaceED
virtual ~OfaAutocorrReplacePage() override
std::unique_ptr< weld::Button > m_xNewReplacePB
std::unique_ptr< weld::Container > m_xButtonBox
void DeleteEntry(const OUString &sShort, const OUString &sLong)
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::Button > m_xReplacePB
virtual void ActivatePage(const SfxItemSet &) override
std::unique_ptr< weld::Button > m_xDeleteReplacePB
std::unique_ptr< weld::Entry > m_xShortED
virtual void Reset(const SfxItemSet *rSet) override
void NewEntry(const OUString &sShort, const OUString &sLong, bool bKeepSourceFormatting)
std::unique_ptr< CharClass > pCharClass
OfaAutocorrReplacePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::map< LanguageType, DoubleStringArray > aDoubleStringTable
OfaQuoteTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
virtual void Reset(const SfxItemSet *rSet) override
virtual ~OfaQuoteTabPage() override
std::unique_ptr< weld::Label > m_xDblStartExFT
static void CreateEntry(weld::TreeView &rLstBox, const OUString &rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol)
std::unique_ptr< weld::Label > m_xDblEndExFT
std::unique_ptr< weld::TreeView > m_xSwCheckLB
Just for writer.
std::unique_ptr< weld::TreeView > m_xCheckLB
For anything but writer.
std::unique_ptr< weld::Label > m_xSglStartExFT
std::unique_ptr< weld::CheckButton > m_xDoubleTypoCB
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
OUString ChangeStringExt_Impl(sal_UCS4)
OUString sTransliterateRTL
std::unique_ptr< weld::Label > m_xSglEndExFT
std::unique_ptr< weld::Button > m_xDblStandardPB
std::unique_ptr< weld::Button > m_xSglEndQuotePB
std::unique_ptr< weld::Button > m_xSglStartQuotePB
std::unique_ptr< weld::CheckButton > m_xSingleTypoCB
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::Button > m_xDblEndQuotePB
std::unique_ptr< weld::Button > m_xDblStartQuotePB
std::unique_ptr< weld::Button > m_xSglStandardPB
virtual void ActivatePage(const SfxItemSet &) override
Smart tag options tab page.
std::unique_ptr< weld::TreeView > m_xSmartTagTypesLB
virtual bool FillItemSet(SfxItemSet *rSet) override
Propagates the current settings to the smart tag manager.
virtual void ActivatePage(const SfxItemSet &) override
void ClearListBox()
Clears the m_aSmartTagTypesLB.
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
void FillListBox(const SmartTagMgr &rSmartTagMgr)
Inserts items into m_aSmartTagTypesLB.
virtual void Reset(const SfxItemSet *rSet) override
Sets the controls based on the current settings at SmartTagMgr.
virtual ~OfaSmartTagOptionsTabPage() override
std::unique_ptr< weld::CheckButton > m_xMainCB
OfaSmartTagOptionsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
construction via Create()
std::unique_ptr< weld::Button > m_xPropertiesPB
vcl::Font aByInputBulletFont
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
OUString sCorrectCapsLock
OfaSwAutoFmtOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
virtual ~OfaSwAutoFmtOptionsPage() override
void CreateEntry(const OUString &rTxt, sal_uInt16 nCol)
OUString sCapitalStartWord
OUString sByInputBulletChar
std::unique_ptr< weld::Button > m_xEditPB
OUString sDelSpaceAtSttEnd
OUString sReplaceTemplates
virtual void ActivatePage(const SfxItemSet &) override
OUString sDelSpaceBetweenLines
OUString sDeleteEmptyPara
std::unique_ptr< weld::TreeView > m_xCheckLB
virtual bool FillItemSet(SfxItemSet *rSet) override
OUString sCapitalStartSentence
virtual void Reset(const SfxItemSet *rSet) override
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
static SfxModule * GetModule(SfxToolsModule nSharedLib)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
static SfxModule * GetActiveModule(SfxViewFrame *pFrame=nullptr)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
void SetCurPageId(const OUString &rName)
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OUString &rName)
SfxOkDialogController * GetDialogController() const
virtual OUString GetSelectionText(bool bCompleteWords=false, bool bOnlyASample=false)
virtual bool HasSelection(bool bText=true) const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
constexpr tools::Long Width() const
bool IsLabelTextWithSmartTags() const
sal_uInt32 NumberOfRecognizers() const
void WriteConfiguration(const bool *bLabelTextWithSmartTags, const std::vector< OUString > *pDisabledTypes) const
bool IsSmartTagTypeEnabled(const OUString &rSmartTagType) const
OUString GetSmartTagCaption(const OUString &rSmartTagType, const css::lang::Locale &rLocale) const
css::uno::Reference< css::smarttags::XSmartTagRecognizer > const & GetRecognizer(sal_uInt32 i) const
static bool IsCTLFontEnabled()
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
const SvStringsISortDtor * GetWordStartExceptList(LanguageType eLang)
const SvStringsISortDtor * GetCplSttExceptList(LanguageType eLang)
void MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries, LanguageType eLang)
bool PutText(const OUString &rShort, const OUString &rLong, LanguageType eLang)
void SetStartSingleQuote(const sal_Unicode cStart)
bool IsAutoCorrFlag(ACFlags nFlag) const
sal_Unicode GetStartSingleQuote() const
void SaveWordStartExceptList(LanguageType eLang)
void SetEndSingleQuote(const sal_Unicode cEnd)
void SaveCplSttExceptList(LanguageType eLang)
sal_Unicode GetEndSingleQuote() const
sal_Unicode GetEndDoubleQuote() const
void SetAutoCorrFlag(ACFlags nFlag, bool bOn=true)
SvStringsISortDtor * LoadCplSttExceptList(LanguageType eLang)
void SetEndDoubleQuote(const sal_Unicode cEnd)
void SetStartDoubleQuote(const sal_Unicode cStart)
SvxSwAutoFormatFlags & GetSwFlags()
sal_Unicode GetStartDoubleQuote() const
SvStringsISortDtor * LoadWordStartExceptList(LanguageType eLang)
SvxAutocorrWordList * LoadAutocorrWordList(LanguageType eLang)
const AutocorrWordSetType & getSortedContent() const
std::vector< SvxAutocorrWord > AutocorrWordSetType
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
virtual short run() override
const vcl::Font & GetCharFont() const
void SetCharFont(const vcl::Font &rFont)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
KeyFuncType GetFunction() const
virtual void set_text(int row, const OUString &rText, int col=-1)=0
virtual OUString get_text(int row, int col=-1) const=0
virtual void set_toggle(int row, TriState eState, int col=-1)=0
virtual int n_children() const=0
void append(TreeIter *pRet=nullptr)
virtual void select(int pos)=0
virtual void unselect(int pos)=0
virtual int get_selected_index() const=0
#define SAL_NEWLINE_STRING
OUString CuiResId(TranslateId aKey)
#define DBG_ASSERT(sCon, aError)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_SPACE
constexpr sal_uInt16 KEY_END
#define LANGUAGE_UNDETERMINED
#define LANGUAGE_ENGLISH_US
#define LINK(Instance, Class, Member)
Reference< XComponentContext > getProcessComponentContext()
constexpr T & temporary(T &&x)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
OUString toId(const void *pValue)
HashMap_OWString_Interface aMap
void * pUserData
CheckBox -> form. Text Bool -> selection text.
DoubleStringArray aNewEntries
DoubleStringArray aDeletedEntries
std::vector< OUString > aAbbrevStrings
std::vector< OUString > aDoubleCapsStrings
constexpr OUStringLiteral PERCENT(u"Percent")