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 OString 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_sNoDblSpaces(
CuiResId(RID_CUISTR_NO_DBL_SPACES))
193 , m_sDash(
CuiResId(RID_CUISTR_DASH))
194 , m_sAccidentalCaps(
CuiResId(RID_CUISTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
195 , m_xCheckLB(m_xBuilder->weld_tree_view(
"checklist"))
208 return std::make_unique<OfaAutocorrOptionsPage>(pPage, pController, *
rSet);
212#define CBCOL_SECOND 1
230 bool bReturn = nFlags != pAutoCorrect->
GetFlags();
248 const int nRow =
m_xCheckLB->n_children() - 1;
296 ImpUserData(OUString* pText,
vcl::Font* pFnt)
297 { pString = pText; pFont = pFnt;}
309 std::unique_ptr<weld::MetricSpinButton> m_xPrcntMF;
312 : GenericDialogController(pParent,
"cui/ui/percentdialog.ui",
"PercentDialog")
313 , m_xPrcntMF(m_xBuilder->weld_metric_spin_button(
"margin",
FieldUnit::
PERCENT))
329enum OfaAutoFmtOptions
337 DEL_SPACES_AT_STT_END,
338 DEL_SPACES_BETWEEN_LINES,
348 MERGE_SINGLE_LINE_PARA
355 :
SfxTabPage(pPage, pController,
"cui/ui/applyautofmtpage.ui",
"ApplyAutoFmtPage", &
rSet)
356 , sDeleteEmptyPara(
CuiResId(RID_CUISTR_DEL_EMPTY_PARA))
357 , sUseReplaceTbl(
CuiResId(RID_CUISTR_USE_REPLACE))
358 , sCapitalStartWord(
CuiResId(RID_CUISTR_CPTL_STT_WORD))
359 , sCapitalStartSentence(
CuiResId(RID_CUISTR_CPTL_STT_SENT))
360 , sUserStyle(
CuiResId(RID_CUISTR_USER_STYLE))
361 , sBullet(
CuiResId(RID_CUISTR_BULLET))
362 , sBoldUnder(
CuiResId(RID_CUISTR_BOLD_UNDER))
363 , sNoDblSpaces(
CuiResId(RID_CUISTR_NO_DBL_SPACES))
364 , sCorrectCapsLock(
CuiResId(RID_CUISTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
365 , sDetectURL(
CuiResId(RID_CUISTR_DETECT_URL))
367 , sRightMargin(
CuiResId(RID_CUISTR_RIGHT_MARGIN))
370 , sTable(
CuiResId(RID_CUISTR_CREATE_TABLE))
371 , sReplaceTemplates(
CuiResId(RID_CUISTR_REPLACE_TEMPLATES))
372 , sDelSpaceAtSttEnd(
CuiResId(RID_CUISTR_DEL_SPACES_AT_STT_END))
373 , sDelSpaceBetweenLines(
CuiResId(RID_CUISTR_DEL_SPACES_BETWEEN_LINES))
375 , m_xCheckLB(m_xBuilder->weld_tree_view(
"list"))
376 , m_xEditPB(m_xBuilder->weld_button(
"edit"))
381 std::vector<int> aWidths
394 const int nRow =
m_xCheckLB->n_children() - 1;
404 delete weld::fromId<ImpUserData*>(
m_xCheckLB->get_id(REPLACE_BULLETS));
405 delete weld::fromId<ImpUserData*>(
m_xCheckLB->get_id(APPLY_NUMBERING));
406 delete weld::fromId<ImpUserData*>(
m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA));
412 return std::make_unique<OfaSwAutoFmtOptionsPage>(pPage, pController, *rAttrSet);
417 bool bModified =
false;
521 if(bModified || nFlags != pAutoCorrect->
GetFlags())
607 pUserData =
new ImpUserData(&
sMargin,
nullptr);
620 m_xEditPB->set_sensitive(rBox.get_selected_id().toInt64() != 0);
631 int nSelEntryPos = m_xCheckLB->get_selected_index();
632 if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
635 ImpUserData* pUserData = weld::fromId<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos));
637 aMapDlg.
SetChar( (*pUserData->pString)[0] );
641 *pUserData->pFont = aFont;
644 OUString aOUStr( &aChar, 1 );
645 *pUserData->pString = aOUStr;
646 if (nSelEntryPos == REPLACE_BULLETS)
647 m_xCheckLB->set_text(nSelEntryPos, sNum.replaceFirst(
"%1", aOUStr), 2);
649 m_xCheckLB->set_text(nSelEntryPos, sBullet.replaceFirst(
"%1", aOUStr), 2);
652 else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
656 aDlg.GetPrcntFld().set_value(nPercent, FieldUnit::PERCENT);
659 nPercent =
static_cast<sal_uInt16
>(aDlg.GetPrcntFld().get_value(FieldUnit::PERCENT));
661 m_xCheckLB->set_text(nSelEntryPos, sRightMargin.replaceFirst(
"%1", sMargin), 2);
669 :
SfxTabPage(pPage, pController,
"cui/ui/acorreplacepage.ui",
"AcorReplacePage", &
rSet)
672 , bHasSelectionText(false)
674 , bReplaceEditChanged(false)
676 , m_xTextOnlyCB(m_xBuilder->weld_check_button(
"textonly"))
677 , m_xShortED(m_xBuilder->weld_entry(
"origtext"))
678 , m_xReplaceED(m_xBuilder->weld_entry(
"newtext"))
679 , m_xReplaceTLB(m_xBuilder->weld_tree_view(
"tabview"))
680 , m_xNewReplacePB(m_xBuilder->weld_button(
"new"))
681 , m_xReplacePB(m_xBuilder->weld_button(
"replace"))
682 , m_xDeleteReplacePB(m_xBuilder->weld_button(
"delete"))
683 , m_xButtonBox(m_xBuilder->weld_container(
"buttonbox"))
690 auto nMaxWidth =
m_xButtonBox->get_preferred_size().Width();
705 auto nColWidth =
m_xReplaceTLB->get_approximate_digit_width() * 32;
730 return std::make_unique<OfaAutocorrReplacePage>(pPage, pController, *
rSet);
742 return DeactivateRC::LeavePage;
753 std::vector<SvxAutocorrWord> aDeleteWords;
754 std::vector<SvxAutocorrWord> aNewWords;
760 aDeleteWords.push_back( aDeleteWord );
763 aNewWords.reserve( rStringChangeList.
aNewEntries.size() );
770 if (bKeepSourceFormatting)
778 aNewWords.push_back( aNewWord );
790 eLang = eNewLanguage;
826 DoubleString &rDouble = rArray[nIndex];
827 bool bTextOnly = nullptr == rDouble.pUserData;
829 if (bSWriter || bTextOnly)
834 OUString sId = weld::toId(rDouble.pUserData);
835 m_xReplaceTLB->set_id(rIter, sId);
837 m_xReplaceTLB->set_text(rIter, rDouble.sShort, 0);
838 m_xReplaceTLB->set_text(rIter, rDouble.sLong, 1);
842 aFormatText.insert(rDouble.sShort);
851 m_xReplaceTLB->bulk_insert_for_each(rContent.size(), [
this, rContent](
weld::TreeIter& rIter,
int nIndex) {
852 auto const& elem = rContent[nIndex];
853 bool bTextOnly = elem.IsTextOnly();
855 if (bSWriter || bTextOnly)
860 OUString sId = weld::toId(m_xTextOnlyCB.get());
861 m_xReplaceTLB->set_id(rIter, sId);
863 m_xReplaceTLB->set_text(rIter, elem.GetShort(), 0);
864 m_xReplaceTLB->set_text(rIter, elem.GetLong(), 1);
868 aFormatText.insert(elem.GetShort());
870 },
nullptr, &m_aReplaceFixedWidths);
871 m_xNewReplacePB->set_sensitive(
false);
872 m_xDeleteReplacePB->set_sensitive(
false);
878 bHasSelectionText =
true;
880 m_xReplaceED->set_text(sSelection);
881 m_xTextOnlyCB->set_active(!bSWriter);
882 m_xTextOnlyCB->set_sensitive(bSWriter && !sSelection.isEmpty());
886 m_xTextOnlyCB->set_active(
true);
887 m_xTextOnlyCB->set_sensitive(
false);
915 if(!bFirstSelect || !bHasSelectionText)
917 int nEntry = rBox.get_selected_index();
918 OUString sTmpShort(rBox.get_text(nEntry, 0));
921 bool bSameContent = 0 == maCompareClass.compareString(sTmpShort, m_xShortED->get_text());
922 int nStartPos, nEndPos;
923 m_xShortED->get_selection_bounds(nStartPos, nEndPos);
924 if (m_xShortED->get_text() != sTmpShort)
926 m_xShortED->set_text(sTmpShort);
930 m_xShortED->select_region(nStartPos, nEndPos);
933 m_xReplaceED->set_text(rBox.get_text(nEntry, 1));
935 m_xTextOnlyCB->set_active(rBox.get_id(nEntry).isEmpty());
939 bFirstSelect =
false;
942 m_xNewReplacePB->set_sensitive(
false);
943 m_xDeleteReplacePB->set_sensitive(
true);
949 for (
size_t i = 0;
i < rNewArray.size();
i++)
951 if (rNewArray[
i].sShort == sShort)
953 rNewArray.erase(rNewArray.begin() +
i);
959 for (
size_t i = 0;
i < rDeletedArray.size();
i++)
961 if (rDeletedArray[
i].sShort == sShort)
963 rDeletedArray.erase(rDeletedArray.begin() +
i);
969 rNewArray.push_back(aNewString);
970 if (bKeepSourceFormatting)
977 for (
size_t i = 0;
i < rNewArray.size();
i++)
979 if (rNewArray[
i].sShort == sShort)
981 rNewArray.erase(rNewArray.begin() +
i);
987 for (
size_t i = 0;
i < rDeletedArray.size();
i++)
989 if (rDeletedArray[
i].sShort == sShort)
991 rDeletedArray.erase(rDeletedArray.begin() +
i);
997 rDeletedArray.push_back(aDeletedString);
1007 return NewDelHdl(&rEdit);
1012 m_aReplaceFixedWidths.clear();
1013 int x,
y, width, height;
1014 if (m_xReplaceED->get_extents_relative_to(*m_xReplaceTLB,
x,
y, width, height))
1016 m_aReplaceFixedWidths.push_back(
x);
1017 m_aReplaceFixedWidths.push_back(width - 1);
1018 m_xReplaceTLB->set_column_fixed_widths(m_aReplaceFixedWidths);
1027 DBG_ASSERT( nEntry != -1,
"no entry selected" );
1040 if (!sEntry.isEmpty() && (!
m_xReplaceED->get_text().isEmpty() ||
1057 for (j = 0; j <
nCount; ++j)
1066 if (bKeepSourceFormatting)
1094 std::unique_ptr<weld::TreeIter> xFirstSel(m_xReplaceTLB->make_iterator());
1095 bool bFirstSelIterSet = m_xReplaceTLB->get_selected(xFirstSel.get());
1096 bool bShort = &rEdt == m_xShortED.get();
1097 const OUString rEntry = rEdt.get_text();
1098 const OUString rRepString = m_xReplaceED->get_text();
1099 OUString aWordStr(pCharClass->lowercase(rEntry));
1103 if(!rEntry.isEmpty())
1105 bool bFound =
false;
1106 bool bTmpSelEntry=
false;
1108 m_xReplaceTLB->all_foreach([
this, &rEntry, &rRepString, &bFound,
1109 &bTmpSelEntry, &bFirstSelIterSet,
1111 OUString aTestStr = m_xReplaceTLB->get_text(rIter, 0);
1112 if( maCompareClass.compareString(rEntry, aTestStr ) == 0 )
1114 if (!rRepString.isEmpty())
1115 bFirstSelect = true;
1116 m_xReplaceTLB->set_cursor(rIter);
1117 m_xReplaceTLB->copy_iterator(rIter, *xFirstSel);
1118 bFirstSelIterSet = true;
1119 m_xNewReplacePB->set_label(sModify);
1125 aTestStr = pCharClass->lowercase( aTestStr );
1126 if( aTestStr.startsWith(aWordStr) && !bTmpSelEntry )
1128 m_xReplaceTLB->scroll_to_row(rIter);
1129 bTmpSelEntry = true;
1136 m_xReplaceTLB->select(-1);
1137 bFirstSelIterSet =
false;
1138 m_xNewReplacePB->set_label(sNew);
1139 if( bReplaceEditChanged )
1140 m_xTextOnlyCB->set_sensitive(
false);
1142 m_xDeleteReplacePB->set_sensitive(bFound);
1144 else if (m_xReplaceTLB->n_children() > 0)
1146 m_xReplaceTLB->scroll_to_row(0);
1152 bReplaceEditChanged =
true;
1153 if (bFirstSelIterSet)
1155 m_xNewReplacePB->set_label(sModify);
1159 const OUString& rShortTxt = m_xShortED->get_text();
1160 bool bEnableNew = !rShortTxt.isEmpty() &&
1161 ( !rRepString.isEmpty() ||
1162 ( bHasSelectionText && bSWriter )) &&
1163 ( !bFirstSelIterSet || rRepString !=
1164 m_xReplaceTLB->get_text(*xFirstSel, 1) );
1167 for (
auto const& elem : aFormatText)
1169 if(elem == rShortTxt)
1176 m_xNewReplacePB->set_sensitive(bEnableNew);
1181 for (
auto const& elem : rStrings)
1192 :
SfxTabPage(pPage, pController,
"cui/ui/acorexceptpage.ui",
"AcorExceptPage", &
rSet)
1195 , m_xAbbrevED(m_xBuilder->weld_entry(
"abbrev"))
1196 , m_xAbbrevLB(m_xBuilder->weld_tree_view(
"abbrevlist"))
1197 , m_xNewAbbrevPB(m_xBuilder->weld_button(
"newabbrev"))
1198 , m_xDelAbbrevPB(m_xBuilder->weld_button(
"delabbrev"))
1199 , m_xAutoAbbrevCB(m_xBuilder->weld_check_button(
"autoabbrev"))
1200 , m_xDoubleCapsED(m_xBuilder->weld_entry(
"double"))
1201 , m_xDoubleCapsLB(m_xBuilder->weld_tree_view(
"doublelist"))
1202 , m_xNewDoublePB(m_xBuilder->weld_button(
"newdouble"))
1203 , m_xDelDoublePB(m_xBuilder->weld_button(
"deldouble"))
1204 , m_xAutoCapsCB(m_xBuilder->weld_check_button(
"autodouble"))
1237 return std::make_unique<OfaAutocorrExceptPage>(pPage, pController, *
rSet);
1249 return DeactivateRC::LeavePage;
1259 if(eCurLang !=
eLang)
1265 size_t nCount = pWrdList->size();
1269 OUString aString = (*pWrdList)[ --
i ];
1273 pWrdList->erase_at(
i);
1279 pWrdList->insert(elem);
1288 size_t nCount = pCplList->size();
1292 OUString aString = (*pCplList)[ --
i ];
1295 pCplList->erase_at(
i);
1301 pCplList->insert(elem);
1314 size_t nCount = pWrdList->size();
1318 OUString aString = (*pWrdList)[ --
i ];
1321 pWrdList->erase_at(
i);
1336 size_t nCount = pCplList->size();
1339 OUString aString = (*pCplList)[ --
i ];
1342 pCplList->erase_at(
i);
1345 sal_Int32 nAbbrevCount =
m_xAbbrevLB->n_children();
1346 for( sal_Int32 ia = 0; ia < nAbbrevCount; ++ia )
1377 eLang = eNewLanguage;
1425 for(
i = 0;
i < pCplList->size();
i++ )
1429 for(
i = 0;
i < pWrdList->size();
i++ )
1453 return NewDelHdl(&rEdit);
1492 if (&rBox == m_xAbbrevLB.get())
1494 m_xAbbrevED->set_text(rBox.get_selected_text());
1495 m_xNewAbbrevPB->set_sensitive(
false);
1496 m_xDelAbbrevPB->set_sensitive(
true);
1500 m_xDoubleCapsED->set_text(rBox.get_selected_text());
1501 m_xNewDoublePB->set_sensitive(
false);
1502 m_xDelDoublePB->set_sensitive(
true);
1508 const OUString& sEntry = rEdt.get_text();
1509 bool bEntryLen = !sEntry.isEmpty();
1510 if (&rEdt == m_xAbbrevED.get())
1512 bool bSame =
lcl_FindEntry(*m_xAbbrevLB, sEntry, maCompareClass);
1513 if(bSame && sEntry != m_xAbbrevLB->get_selected_text())
1514 rEdt.set_text(m_xAbbrevLB->get_selected_text());
1515 m_xNewAbbrevPB->set_sensitive(!bSame && bEntryLen);
1516 m_xDelAbbrevPB->set_sensitive(bSame && bEntryLen);
1520 bool bSame =
lcl_FindEntry(*m_xDoubleCapsLB, sEntry, maCompareClass);
1521 if(bSame && sEntry != m_xDoubleCapsLB->get_selected_text())
1522 rEdt.set_text(m_xDoubleCapsLB->get_selected_text());
1523 m_xNewDoublePB->set_sensitive(!bSame && bEntryLen);
1524 m_xDelDoublePB->set_sensitive(bSame && bEntryLen);
1535 REPLACE_ANGLE_QUOTES
1548 rCheckLB.
set_text(nRow, rTxt, nTextCol);
1552 :
SfxTabPage(pPage, pController,
"cui/ui/applylocalizedpage.ui",
"ApplyLocalizedPage", &
rSet)
1553 , sNonBrkSpace(
CuiResId(RID_CUISTR_NON_BREAK_SPACE))
1554 , sOrdinal(
CuiResId(RID_CUISTR_ORDINAL))
1555 , sTransliterateRTL(
CuiResId(RID_CUISTR_OLD_HUNGARIAN))
1556 , sAngleQuotes(
CuiResId(RID_CUISTR_ANGLE_QUOTES))
1561 , m_xSingleTypoCB(m_xBuilder->weld_check_button(
"singlereplace"))
1562 , m_xSglStartQuotePB(m_xBuilder->weld_button(
"startsingle"))
1563 , m_xSglStartExFT(m_xBuilder->weld_label(
"singlestartex"))
1564 , m_xSglEndQuotePB(m_xBuilder->weld_button(
"endsingle"))
1565 , m_xSglEndExFT(m_xBuilder->weld_label(
"singleendex"))
1566 , m_xSglStandardPB(m_xBuilder->weld_button(
"defaultsingle"))
1567 , m_xDoubleTypoCB(m_xBuilder->weld_check_button(
"doublereplace"))
1568 , m_xDblStartQuotePB(m_xBuilder->weld_button(
"startdouble"))
1569 , m_xDblStartExFT(m_xBuilder->weld_label(
"doublestartex"))
1570 , m_xDblEndQuotePB(m_xBuilder->weld_button(
"enddouble"))
1571 , m_xDblEndExFT(m_xBuilder->weld_label(
"doubleendex"))
1572 , m_xDblStandardPB(m_xBuilder->weld_button(
"defaultdouble"))
1573 , m_sStandard(m_xSglStartExFT->get_label())
1574 , m_xCheckLB(m_xBuilder->weld_tree_view(
"checklist"))
1575 , m_xSwCheckLB(m_xBuilder->weld_tree_view(
"list"))
1580 bool bShowSWOptions =
false;
1584 bShowSWOptions =
true;
1586 if ( bShowSWOptions )
1588 std::vector<int> aWidths
1617 return std::make_unique<OfaQuoteTabPage>(pPage, pController, *rAttrSet);
1635 bool bModified =
false;
1667 bool bReturn = nFlags != pAutoCorrect->
GetFlags();
1693 if( bModified || bReturn )
1786 if (&rBtn == m_xSglEndQuotePB.get())
1788 else if (&rBtn == m_xDblStartQuotePB.get())
1790 else if (&rBtn == m_xDblEndQuotePB.get())
1803 cDlg = cSglStartQuote;
1805 cDlg = pAutoCorrect->
GetQuote(
'\'',
true, eLang);
1808 cDlg = cSglEndQuote;
1810 cDlg = pAutoCorrect->
GetQuote(
'\'',
false, eLang);
1815 cDlg = pAutoCorrect->
GetQuote(
'\"',
true, eLang);
1820 cDlg = pAutoCorrect->
GetQuote(
'\"',
false, eLang);
1823 OSL_FAIL(
"svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" );
1828 aMap.SetChar( cDlg );
1829 aMap.DisableFontSelection();
1837 cSglStartQuote = cNewChar;
1838 m_xSglStartExFT->set_label(ChangeStringExt_Impl(cNewChar));
1841 cSglEndQuote = cNewChar;
1842 m_xSglEndExFT->set_label(ChangeStringExt_Impl(cNewChar));
1845 cStartQuote = cNewChar;
1846 m_xDblStartExFT->set_label(ChangeStringExt_Impl(cNewChar));
1849 cEndQuote = cNewChar;
1850 m_xDblEndExFT->set_label(ChangeStringExt_Impl(cNewChar));
1857 if (&rBtn == m_xDblStandardPB.get())
1860 m_xDblStartExFT->set_label(ChangeStringExt_Impl(0));
1862 m_xDblEndExFT->set_label(ChangeStringExt_Impl(0));
1868 m_xSglStartExFT->set_label(ChangeStringExt_Impl(0));
1870 m_xSglEndExFT->set_label(ChangeStringExt_Impl(0));
1880 sal_UCS4 aStrCodes[32] = { 0,
' ',
'(',
'U',
'+',
'0' };
1881 aStrCodes[0] = cChar;
1884 while( (cChar >> (4*nHexLen)) != 0 )
1886 for(
int i = nHexLen; --
i >= 0;)
1888 sal_UCS4 cHexDigit = ((cChar >> (4*
i)) & 0x0f) +
'0';
1889 if( cHexDigit >
'9' )
1890 cHexDigit +=
'A' - (
'9' + 1);
1891 aStrCodes[ nFullLen++ ] = cHexDigit;
1893 aStrCodes[ nFullLen++ ] =
')';
1895 OUString aOUStr( aStrCodes, nFullLen );
1901 :
SfxTabPage(pPage, pController,
"cui/ui/wordcompletionpage.ui",
1902 "WordCompletionPage", &
rSet)
1903 , m_pAutoCompleteList(nullptr)
1904 , m_nAutoCmpltListCnt(0)
1905 , m_xCBActiv(m_xBuilder->weld_check_button(
"enablewordcomplete"))
1906 , m_xCBAppendSpace(m_xBuilder->weld_check_button(
"appendspace"))
1907 , m_xCBAsTip(m_xBuilder->weld_check_button(
"showastip"))
1908 , m_xCBCollect(m_xBuilder->weld_check_button(
"collectwords"))
1909 , m_xCBRemoveList(m_xBuilder->weld_check_button(
"whenclosing"))
1910 , m_xDCBExpandKey(m_xBuilder->weld_combo_box(
"acceptwith"))
1911 , m_xNFMinWordlen(m_xBuilder->weld_spin_button(
"minwordlen"))
1912 , m_xNFMaxEntries(m_xBuilder->weld_spin_button(
"maxentries"))
1913 , m_xLBEntries(m_xBuilder->weld_tree_view(
"entries"))
1914 , m_xPBEntries(m_xBuilder->weld_button(
"delete"))
1920 if (aPrefSize.
Width() > nMaxWidth)
1928 m_xLBEntries->set_selection_mode(SelectionMode::Multiple);
1931 static const sal_uInt16 aKeyCodes[] = {
1940 for(
const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys )
1961 return std::make_unique<OfaAutoCompleteTabPage>(pPage, pController, *
rSet);
1966 bool bModified =
false, bCheck;
2052 const OUString* pStr =
2053 &(*m_pAutoCompleteList)[
n]->GetAutoCompleteString();
2075 auto rows = m_xLBEntries->get_selected_rows();
2076 std::sort(rows.begin(), rows.end());
2077 while (!rows.empty())
2079 sal_Int32
nPos = rows.back();
2080 OUString* pStr = weld::fromId<OUString*>(m_xLBEntries->get_id(
nPos));
2081 m_xLBEntries->remove(
nPos);
2083 m_pAutoCompleteList->erase(&hack);
2090 bool bEnable = rBox.get_active();
2091 if (&rBox == m_xCBActiv.get())
2093 m_xCBAppendSpace->set_sensitive(bEnable);
2094 m_xCBAppendSpace->set_sensitive(bEnable);
2095 m_xCBAsTip->set_sensitive(bEnable);
2096 m_xDCBExpandKey->set_sensitive(bEnable);
2098 else if (&rBox == m_xCBCollect.get())
2099 m_xCBRemoveList->set_sensitive(bEnable);
2110 OStringBuffer sData;
2112 rtl_TextEncoding nEncode = osl_getThreadTextEncoding();
2118 pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
2119 pCntnr->CopyToClipboard(
m_xLBEntries->get_clipboard());
2124 bool bHandled =
false;
2129 DeleteHdl(*m_xPBEntries);
2147 :
SfxTabPage(pPage, pController,
"cui/ui/smarttagoptionspage.ui",
"SmartTagOptionsPage", &
rSet)
2148 , m_xMainCB(m_xBuilder->weld_check_button(
"main"))
2149 , m_xSmartTagTypesLB(m_xBuilder->weld_tree_view(
"list"))
2150 , m_xPropertiesPB(m_xBuilder->weld_button(
"properties"))
2169 return std::make_unique<OfaSmartTagOptionsTabPage>(pPage, pController, *
rSet);
2176struct ImplSmartTagLBUserData
2178 OUString maSmartTagType;
2180 sal_Int32 mnSmartTagIdx;
2182 ImplSmartTagLBUserData( OUString aSmartTagType,
2184 sal_Int32 nSmartTagIdx ) :
2185 maSmartTagType(
std::move( aSmartTagType )),
2186 mxRec(
std::move( xRec )),
2187 mnSmartTagIdx( nSmartTagIdx ) {}
2199 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(
m_xSmartTagTypesLB->get_id(
i));
2217 for ( sal_uInt32
i = 0;
i < nNumberOfRecognizers; ++
i )
2221 const OUString
aName = xRec->getName( aLocale );
2222 const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount();
2224 for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j )
2226 const OUString aSmartTagType = xRec->getSmartTagName(j);
2227 OUString aSmartTagCaption = rSmartTagMgr.
GetSmartTagCaption( aSmartTagType, aLocale );
2229 if ( aSmartTagCaption.isEmpty() )
2230 aSmartTagCaption = aSmartTagType;
2232 const OUString aLBEntry = aSmartTagCaption +
" (" +
aName +
")";
2248 const int nPos = m_xSmartTagTypesLB->get_selected_index();
2249 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(
nPos));
2251 const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2254 if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2255 xRec->displayPropertyPage( nSmartTagIdx, aLocale );
2262 const bool bEnable = m_xMainCB->get_active();
2263 m_xSmartTagTypesLB->set_sensitive(bEnable);
2264 m_xPropertiesPB->set_sensitive(
false);
2271 SelectHdl(*m_xSmartTagTypesLB);
2278 const int nPos = m_xSmartTagTypesLB->get_selected_index();
2281 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(
nPos));
2283 const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2286 if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2287 m_xPropertiesPB->set_sensitive(
true);
2289 m_xPropertiesPB->set_sensitive(
false);
2301 if ( !pSmartTagMgr )
2304 bool bModifiedSmartTagTypes =
false;
2305 std::vector< OUString > aDisabledSmartTagTypes;
2311 const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(
m_xSmartTagTypesLB->get_id(
i));
2315 bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled );
2318 aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType );
2324 if ( bModifiedSmartTagTypes || bModifiedRecognize )
2326 bool bLabelTextWithSmartTags =
m_xMainCB->get_active();
2327 pSmartTagMgr->
WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags :
nullptr,
2328 bModifiedSmartTagTypes ? &aDisabledSmartTagTypes :
nullptr );
2343 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 OString &rName)
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OString &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
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")