37 #include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
38 #include <rtl/strbuf.hxx>
40 #include <osl/diagnose.h>
47 #include <strings.hrc>
48 #include <dialmgr.hxx>
49 #include <svx/svxids.hrc>
58 , m_xLanguageBox(m_xBuilder->weld_widget(
"langbox"))
59 , m_xLanguageLB(new
SvxLanguageBox(m_xBuilder->weld_combo_box(
"lang")))
61 bool bShowSWOptions =
false;
62 bool bOpenSmartTagOptions =
false;
66 const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(_pSet, SID_AUTO_CORRECT_DLG,
false);
68 bShowSWOptions =
true;
70 const SfxBoolItem* pItem2 = SfxItemSet::GetItem<SfxBoolItem>(_pSet, SID_OPEN_SMARTTAGOPTIONS,
false);
72 bOpenSmartTagOptions =
true;
107 nLangList |= SvxLanguageListFlags::CTL;
109 nLangList |= SvxLanguageListFlags::CJK;
113 DBG_ASSERT(nPos != -1,
"listbox entry missing" );
128 if ( bOpenSmartTagOptions )
146 for (
int i = 0;
i < nCount;
i++)
163 if(eNewLang == eLastDialogLanguage)
166 OString sPageId = GetCurPageId();
167 if (sPageId ==
"replace")
173 else if (sPageId ==
"exceptions")
182 :
SfxTabPage(pPage, pController,
"cui/ui/acoroptionspage.ui",
"AutocorrectOptionsPage", &rSet)
183 , m_sInput(
CuiResId(RID_SVXSTR_USE_REPLACE))
184 , m_sDoubleCaps(
CuiResId(RID_SVXSTR_CPTL_STT_WORD))
185 , m_sStartCap(
CuiResId(RID_SVXSTR_CPTL_STT_SENT))
186 , m_sBoldUnderline(
CuiResId(RID_SVXSTR_BOLD_UNDER))
188 , m_sNoDblSpaces(
CuiResId(RID_SVXSTR_NO_DBL_SPACES))
189 , m_sDash(
CuiResId(RID_SVXSTR_DASH))
190 , m_sAccidentalCaps(
CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
191 , m_xCheckLB(m_xBuilder->weld_tree_view(
"checklist"))
204 return std::make_unique<OfaAutocorrOptionsPage>(pPage, pController, *rSet);
207 #define CBCOL_FIRST 0
208 #define CBCOL_SECOND 1
226 bool bReturn = nFlags != pAutoCorrect->
GetFlags();
244 const int nRow =
m_xCheckLB->n_children() - 1;
269 m_xCheckLB->set_toggle( nPos++,
bool(nFlags & ACFlags::CapitalStartSentence) ?
TRISTATE_TRUE : TRISTATE_FALSE );
292 ImpUserData(OUString* pText,
vcl::Font* pFnt)
293 { pString = pText; pFont = pFnt;}
305 std::unique_ptr<weld::MetricSpinButton> m_xPrcntMF;
308 : GenericDialogController(pParent,
"cui/ui/percentdialog.ui",
"PercentDialog")
309 , m_xPrcntMF(m_xBuilder->weld_metric_spin_button(
"margin",
FieldUnit::
PERCENT))
333 DEL_SPACES_AT_STT_END,
334 DEL_SPACES_BETWEEN_LINES,
344 MERGE_SINGLE_LINE_PARA
351 :
SfxTabPage(pPage, pController,
"cui/ui/applyautofmtpage.ui",
"ApplyAutoFmtPage", &rSet)
352 , sDeleteEmptyPara(
CuiResId(RID_SVXSTR_DEL_EMPTY_PARA))
353 , sUseReplaceTbl(
CuiResId(RID_SVXSTR_USE_REPLACE))
354 , sCapitalStartWord(
CuiResId(RID_SVXSTR_CPTL_STT_WORD))
355 , sCapitalStartSentence(
CuiResId(RID_SVXSTR_CPTL_STT_SENT))
356 , sUserStyle(
CuiResId(RID_SVXSTR_USER_STYLE))
357 , sBullet(
CuiResId(RID_SVXSTR_BULLET))
358 , sBoldUnder(
CuiResId(RID_SVXSTR_BOLD_UNDER))
359 , sNoDblSpaces(
CuiResId(RID_SVXSTR_NO_DBL_SPACES))
360 , sCorrectCapsLock(
CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
361 , sDetectURL(
CuiResId(RID_SVXSTR_DETECT_URL))
363 , sRightMargin(
CuiResId(RID_SVXSTR_RIGHT_MARGIN))
366 , sTable(
CuiResId(RID_SVXSTR_CREATE_TABLE))
367 , sReplaceTemplates(
CuiResId(RID_SVXSTR_REPLACE_TEMPLATES))
368 , sDelSpaceAtSttEnd(
CuiResId(RID_SVXSTR_DEL_SPACES_AT_STT_END))
369 , sDelSpaceBetweenLines(
CuiResId(RID_SVXSTR_DEL_SPACES_BETWEEN_LINES))
371 , m_xCheckLB(m_xBuilder->weld_tree_view(
"list"))
372 , m_xEditPB(m_xBuilder->weld_button(
"edit"))
378 std::vector<int> aWidths;
389 const int nRow =
m_xCheckLB->n_children() - 1;
399 delete reinterpret_cast<ImpUserData*
>(
m_xCheckLB->get_id(REPLACE_BULLETS).toInt64());
400 delete reinterpret_cast<ImpUserData*
>(
m_xCheckLB->get_id(APPLY_NUMBERING).toInt64());
401 delete reinterpret_cast<ImpUserData*
>(
m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA).toInt64());
407 return std::make_unique<OfaSwAutoFmtOptionsPage>(pPage, pController, *rAttrSet);
412 bool bModified =
false;
516 if(bModified || nFlags != pAutoCorrect->
GetFlags())
599 OUString
sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
602 pUserData =
new ImpUserData(&
sMargin,
nullptr);
603 sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
604 m_xCheckLB->set_id(MERGE_SINGLE_LINE_PARA, sId);
607 sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData2));
615 m_xEditPB->set_sensitive(rBox.get_selected_id().toInt64() != 0);
626 int nSelEntryPos = m_xCheckLB->get_selected_index();
627 if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
630 ImpUserData* pUserData =
reinterpret_cast<ImpUserData*
>(m_xCheckLB->get_id(nSelEntryPos).toInt64());
632 aMapDlg.
SetChar( (*pUserData->pString)[0] );
636 *pUserData->pFont = aFont;
639 OUString aOUStr( &aChar, 1 );
640 *pUserData->pString = aOUStr;
641 if (nSelEntryPos == REPLACE_BULLETS)
642 m_xCheckLB->set_text(nSelEntryPos, sNum.replaceFirst(
"%1", aOUStr), 2);
644 m_xCheckLB->set_text(nSelEntryPos, sBullet.replaceFirst(
"%1", aOUStr), 2);
647 else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
651 aDlg.GetPrcntFld().set_value(nPercent, FieldUnit::PERCENT);
654 nPercent =
static_cast<sal_uInt16
>(aDlg.GetPrcntFld().get_value(FieldUnit::PERCENT));
656 m_xCheckLB->set_text(nSelEntryPos, sRightMargin.replaceFirst(
"%1", sMargin), 2);
664 :
SfxTabPage(pPage, pController,
"cui/ui/acorreplacepage.ui",
"AcorReplacePage", &rSet)
665 , eLang(eLastDialogLanguage)
666 , bHasSelectionText(false)
668 , bReplaceEditChanged(false)
670 , m_xTextOnlyCB(m_xBuilder->weld_check_button(
"textonly"))
671 , m_xShortED(m_xBuilder->weld_entry(
"origtext"))
672 , m_xReplaceED(m_xBuilder->weld_entry(
"newtext"))
673 , m_xReplaceTLB(m_xBuilder->weld_tree_view(
"tabview"))
674 , m_xNewReplacePB(m_xBuilder->weld_button(
"new"))
675 , m_xReplacePB(m_xBuilder->weld_button(
"replace"))
676 , m_xDeleteReplacePB(m_xBuilder->weld_button(
"delete"))
677 , m_xButtonBox(m_xBuilder->weld_container(
"buttonbox"))
684 auto nMaxWidth =
m_xButtonBox->get_preferred_size().Width();
700 auto nColWidth =
m_xReplaceTLB->get_approximate_digit_width() * 32;
726 return std::make_unique<OfaAutocorrReplacePage>(pPage, pController, *rSet);
731 if(
eLang != eLastDialogLanguage)
738 return DeactivateRC::LeavePage;
749 std::vector<SvxAutocorrWord> aDeleteWords;
750 std::vector<SvxAutocorrWord> aNewWords;
756 aDeleteWords.push_back( aDeleteWord );
759 aNewWords.reserve( rStringChangeList.
aNewEntries.size() );
766 if (bKeepSourceFormatting)
773 aNewWords.push_back( aNewWord );
785 eLang = eNewLanguage;
823 bool bTextOnly =
nullptr == rDouble.
pUserData;
830 OUString
sId = OUString::number(reinterpret_cast<sal_Int64>(rDouble.
pUserData));
848 auto const& elem = rContent[
nIndex];
849 bool bTextOnly = elem.IsTextOnly();
856 OUString
sId = OUString::number(reinterpret_cast<sal_Int64>(
m_xTextOnlyCB.get()));
899 eLastDialogLanguage = eSet;
911 if(!bFirstSelect || !bHasSelectionText)
913 int nEntry = rBox.get_selected_index();
914 OUString sTmpShort(rBox.get_text(nEntry, 0));
917 bool bSameContent = 0 == pCompareClass->compareString(sTmpShort, m_xShortED->get_text());
918 int nStartPos, nEndPos;
919 m_xShortED->get_selection_bounds(nStartPos, nEndPos);
920 if (m_xShortED->get_text() != sTmpShort)
922 m_xShortED->set_text(sTmpShort);
926 m_xShortED->select_region(nStartPos, nEndPos);
929 m_xReplaceED->set_text(rBox.get_text(nEntry, 1));
931 m_xTextOnlyCB->set_active(rBox.get_id(nEntry).isEmpty());
935 bFirstSelect =
false;
938 m_xNewReplacePB->set_sensitive(
false);
939 m_xDeleteReplacePB->set_sensitive(
true);
945 for (
size_t i = 0;
i < rNewArray.size();
i++)
947 if (rNewArray[
i].sShort == sShort)
949 rNewArray.erase(rNewArray.begin() +
i);
955 for (
size_t i = 0;
i < rDeletedArray.size();
i++)
957 if (rDeletedArray[
i].sShort == sShort)
959 rDeletedArray.erase(rDeletedArray.begin() +
i);
965 aNewString.
sShort = sShort;
966 aNewString.
sLong = sLong;
967 rNewArray.push_back(aNewString);
968 if (bKeepSourceFormatting)
975 for (
size_t i = 0;
i < rNewArray.size();
i++)
977 if (rNewArray[
i].sShort == sShort)
979 rNewArray.erase(rNewArray.begin() +
i);
985 for (
size_t i = 0;
i < rDeletedArray.size();
i++)
987 if (rDeletedArray[
i].sShort == sShort)
989 rDeletedArray.erase(rDeletedArray.begin() +
i);
995 aDeletedString.
sShort = sShort;
996 aDeletedString.
sLong = sLong;
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)
1071 m_xReplaceTLB->insert(nPos, sEntry, &sId,
nullptr,
nullptr);
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( pCompareClass->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)
1193 , eLang(eLastDialogLanguage)
1194 , m_xAbbrevED(m_xBuilder->weld_entry(
"abbrev"))
1195 , m_xAbbrevLB(m_xBuilder->weld_tree_view(
"abbrevlist"))
1196 , m_xNewAbbrevPB(m_xBuilder->weld_button(
"newabbrev"))
1197 , m_xDelAbbrevPB(m_xBuilder->weld_button(
"delabbrev"))
1198 , m_xAutoAbbrevCB(m_xBuilder->weld_check_button(
"autoabbrev"))
1199 , m_xDoubleCapsED(m_xBuilder->weld_entry(
"double"))
1200 , m_xDoubleCapsLB(m_xBuilder->weld_tree_view(
"doublelist"))
1201 , m_xNewDoublePB(m_xBuilder->weld_button(
"newdouble"))
1202 , m_xDelDoublePB(m_xBuilder->weld_button(
"deldouble"))
1203 , m_xAutoCapsCB(m_xBuilder->weld_check_button(
"autodouble"))
1238 return std::make_unique<OfaAutocorrExceptPage>(pPage, pController, *rSet);
1243 if(
eLang != eLastDialogLanguage)
1250 return DeactivateRC::LeavePage;
1260 if(eCurLang !=
eLang)
1266 size_t nCount = pWrdList->size();
1268 for( i = nCount; i; )
1270 OUString aString = (*pWrdList)[ --i ];
1274 pWrdList->erase_at(i);
1280 pWrdList->insert(elem);
1289 size_t nCount = pCplList->size();
1291 for( i = nCount; i; )
1293 OUString aString = (*pCplList)[ --i ];
1296 pCplList->erase_at(i);
1302 pCplList->insert(elem);
1315 size_t nCount = pWrdList->size();
1317 for( i = nCount; i; )
1319 OUString aString = (*pWrdList)[ --i ];
1322 pWrdList->erase_at(i);
1326 for( i = 0; i < nCount; ++i )
1337 size_t nCount = pCplList->size();
1338 for(
size_t i = nCount;
i; )
1340 OUString aString = (*pCplList)[ --
i ];
1343 pCplList->erase_at(
i);
1346 sal_Int32 nAbbrevCount =
m_xAbbrevLB->n_children();
1347 for( sal_Int32 ia = 0; ia < nAbbrevCount; ++ia )
1366 eLastDialogLanguage = eSet;
1378 eLang = eNewLanguage;
1399 for(i = 0; i < nCount; i++)
1403 for(i = 0; i < nCount; i++)
1426 for( i = 0; i < pCplList->size(); i++ )
1430 for( i = 0; i < pWrdList->size(); i++ )
1454 return NewDelHdl(&
rEdit);
1493 if (&rBox == m_xAbbrevLB.get())
1495 m_xAbbrevED->set_text(rBox.get_selected_text());
1496 m_xNewAbbrevPB->set_sensitive(
false);
1497 m_xDelAbbrevPB->set_sensitive(
true);
1501 m_xDoubleCapsED->set_text(rBox.get_selected_text());
1502 m_xNewDoublePB->set_sensitive(
false);
1503 m_xDelDoublePB->set_sensitive(
true);
1509 const OUString& sEntry = rEdt.get_text();
1510 bool bEntryLen = !sEntry.isEmpty();
1511 if (&rEdt == m_xAbbrevED.get())
1513 bool bSame =
lcl_FindEntry(*m_xAbbrevLB, sEntry, *pCompareClass);
1514 if(bSame && sEntry != m_xAbbrevLB->get_selected_text())
1515 rEdt.set_text(m_xAbbrevLB->get_selected_text());
1516 m_xNewAbbrevPB->set_sensitive(!bSame && bEntryLen);
1517 m_xDelAbbrevPB->set_sensitive(bSame && bEntryLen);
1521 bool bSame =
lcl_FindEntry(*m_xDoubleCapsLB, sEntry, *pCompareClass);
1522 if(bSame && sEntry != m_xDoubleCapsLB->get_selected_text())
1523 rEdt.set_text(m_xDoubleCapsLB->get_selected_text());
1524 m_xNewDoublePB->set_sensitive(!bSame && bEntryLen);
1525 m_xDelDoublePB->set_sensitive(bSame && bEntryLen);
1536 REPLACE_ANGLE_QUOTES
1549 rCheckLB.
set_text(nRow, rTxt, nTextCol);
1553 :
SfxTabPage(pPage, pController,
"cui/ui/applylocalizedpage.ui",
"ApplyLocalizedPage", &rSet)
1554 , sNonBrkSpace(
CuiResId(RID_SVXSTR_NON_BREAK_SPACE))
1555 , sOrdinal(
CuiResId(RID_SVXSTR_ORDINAL))
1556 , sTransliterateRTL(
CuiResId(RID_SVXSTR_OLD_HUNGARIAN))
1557 , sAngleQuotes(
CuiResId(RID_SVXSTR_ANGLE_QUOTES))
1562 , m_xSingleTypoCB(m_xBuilder->weld_check_button(
"singlereplace"))
1563 , m_xSglStartQuotePB(m_xBuilder->weld_button(
"startsingle"))
1564 , m_xSglStartExFT(m_xBuilder->weld_label(
"singlestartex"))
1565 , m_xSglEndQuotePB(m_xBuilder->weld_button(
"endsingle"))
1566 , m_xSglEndExFT(m_xBuilder->weld_label(
"singleendex"))
1567 , m_xSglStandardPB(m_xBuilder->weld_button(
"defaultsingle"))
1568 , m_xDoubleTypoCB(m_xBuilder->weld_check_button(
"doublereplace"))
1569 , m_xDblStartQuotePB(m_xBuilder->weld_button(
"startdouble"))
1570 , m_xDblStartExFT(m_xBuilder->weld_label(
"doublestartex"))
1571 , m_xDblEndQuotePB(m_xBuilder->weld_button(
"enddouble"))
1572 , m_xDblEndExFT(m_xBuilder->weld_label(
"doubleendex"))
1573 , m_xDblStandardPB(m_xBuilder->weld_button(
"defaultdouble"))
1574 , m_sStandard(m_xSglStartExFT->get_label())
1575 , m_xCheckLB(m_xBuilder->weld_tree_view(
"checklist"))
1576 , m_xSwCheckLB(m_xBuilder->weld_tree_view(
"list"))
1581 bool bShowSWOptions =
false;
1585 bShowSWOptions =
true;
1587 if ( bShowSWOptions )
1590 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?" );
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)
1930 static const sal_uInt16 aKeyCodes[] = {
1939 for(
const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys )
1960 return std::make_unique<OfaAutoCompleteTabPage>(pPage, pController, *rSet);
1965 bool bModified =
false, bCheck;
2051 const OUString* pStr =
2052 &(*m_pAutoCompleteList)[
n]->GetAutoCompleteString();
2053 OUString
sId(OUString::number(reinterpret_cast<sal_Int64>(pStr)));
2074 auto rows = m_xLBEntries->get_selected_rows();
2075 std::sort(rows.begin(), rows.end());
2076 while (!rows.empty())
2078 sal_Int32
nPos = rows.back();
2079 OUString* pStr =
reinterpret_cast<OUString*
>(m_xLBEntries->get_id(nPos).toInt64());
2080 m_xLBEntries->remove(nPos);
2082 m_pAutoCompleteList->erase(&hack);
2089 bool bEnable = rBox.get_active();
2090 if (&rBox == m_xCBActiv.get())
2092 m_xCBAppendSpace->set_sensitive(bEnable);
2093 m_xCBAppendSpace->set_sensitive(bEnable);
2094 m_xCBAsTip->set_sensitive(bEnable);
2095 m_xDCBExpandKey->set_sensitive(bEnable);
2097 else if (&rBox == m_xCBCollect.get())
2098 m_xCBRemoveList->set_sensitive(bEnable);
2109 OStringBuffer sData;
2111 rtl_TextEncoding nEncode = osl_getThreadTextEncoding();
2117 sData.append(
"\015\012");
2119 sData.append(
"\012");
2122 pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
2128 bool bHandled =
false;
2133 DeleteHdl(*m_xPBEntries);
2151 :
SfxTabPage(pPage, pController,
"cui/ui/smarttagoptionspage.ui",
"SmartTagOptionsPage", &rSet)
2152 , m_xMainCB(m_xBuilder->weld_check_button(
"main"))
2153 , m_xSmartTagTypesLB(m_xBuilder->weld_tree_view(
"list"))
2154 , m_xPropertiesPB(m_xBuilder->weld_button(
"properties"))
2173 return std::make_unique<OfaSmartTagOptionsTabPage>(pPage, pController, *rSet);
2180 struct ImplSmartTagLBUserData
2182 OUString maSmartTagType;
2183 uno::Reference< smarttags::XSmartTagRecognizer > mxRec;
2184 sal_Int32 mnSmartTagIdx;
2186 ImplSmartTagLBUserData(
const OUString& rSmartTagType,
2187 uno::Reference< smarttags::XSmartTagRecognizer >
const & xRec,
2188 sal_Int32 nSmartTagIdx ) :
2189 maSmartTagType( rSmartTagType ),
2191 mnSmartTagIdx( nSmartTagIdx ) {}
2201 for (
int i = 0;
i < nCount; ++
i)
2203 const ImplSmartTagLBUserData* pUserData =
reinterpret_cast<ImplSmartTagLBUserData*
>(
m_xSmartTagTypesLB->get_id(
i).toInt64());
2221 for ( sal_uInt32
i = 0;
i < nNumberOfRecognizers; ++
i )
2223 const uno::Reference< smarttags::XSmartTagRecognizer >& xRec = rSmartTagMgr.
GetRecognizer(
i);
2225 const OUString
aName = xRec->getName( aLocale );
2226 const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount();
2228 for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j )
2230 const OUString aSmartTagType = xRec->getSmartTagName(j);
2231 OUString aSmartTagCaption = rSmartTagMgr.
GetSmartTagCaption( aSmartTagType, aLocale );
2233 if ( aSmartTagCaption.isEmpty() )
2234 aSmartTagCaption = aSmartTagType;
2236 const OUString aLBEntry = aSmartTagCaption +
" (" + aName +
")";
2243 m_xSmartTagTypesLB->set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(
new ImplSmartTagLBUserData(aSmartTagType, xRec, j))));
2252 const int nPos = m_xSmartTagTypesLB->get_selected_index();
2253 const ImplSmartTagLBUserData* pUserData =
reinterpret_cast<ImplSmartTagLBUserData*
>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
2254 uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
2255 const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2258 if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2259 xRec->displayPropertyPage( nSmartTagIdx, aLocale );
2266 const bool bEnable = m_xMainCB->get_active();
2267 m_xSmartTagTypesLB->set_sensitive(bEnable);
2268 m_xPropertiesPB->set_sensitive(
false);
2275 SelectHdl(*m_xSmartTagTypesLB);
2282 const int nPos = m_xSmartTagTypesLB->get_selected_index();
2285 const ImplSmartTagLBUserData* pUserData =
reinterpret_cast<ImplSmartTagLBUserData*
>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
2286 uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
2287 const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
2290 if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
2291 m_xPropertiesPB->set_sensitive(
true);
2293 m_xPropertiesPB->set_sensitive(
false);
2305 if ( !pSmartTagMgr )
2308 bool bModifiedSmartTagTypes =
false;
2309 std::vector< OUString > aDisabledSmartTagTypes;
2313 for (
int i = 0;
i < nCount; ++
i)
2315 const ImplSmartTagLBUserData* pUserData =
reinterpret_cast<ImplSmartTagLBUserData*
>(
m_xSmartTagTypesLB->get_id(
i).toInt64());
2319 bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled );
2322 aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType );
2328 if ( bModifiedSmartTagTypes || bModifiedRecognize )
2330 bool bLabelTextWithSmartTags =
m_xMainCB->get_active();
2331 pSmartTagMgr->
WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags :
nullptr,
2332 bModifiedSmartTagTypes ? &aDisabledSmartTagTypes :
nullptr );
2347 if ( !pSmartTagMgr )
virtual void set_text(int row, const OUString &rText, int col=-1)=0
#define LINK(Instance, Class, Member)
OUString sDelSpaceAtSttEnd
sal_Unicode GetEndDoubleQuote() const
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::TreeView > m_xDoubleCapsLB
OUString sReplaceTemplates
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
bool NewDelHdl(const weld::Widget *)
std::unique_ptr< weld::CheckButton > m_xCBAppendSpace
Append space.
std::unique_ptr< weld::CheckButton > m_xAutoCapsCB
static SvxAutoCorrCfg & Get()
virtual ~OfaSwAutoFmtOptionsPage() override
std::unique_ptr< weld::Button > m_xDeleteReplacePB
bool IsAutoCorrFlag(ACFlags nFlag) const
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
OUString sByInputBulletChar
virtual bool FillItemSet(SfxItemSet *rSet) override
Propagates the current settings to the smart tag manager.
#define LANGUAGE_ENGLISH_US
std::unique_ptr< weld::CheckButton > m_xMainCB
std::unique_ptr< weld::Entry > m_xShortED
std::unique_ptr< weld::CheckButton > m_xSingleTypoCB
void ClearListBox()
Clears the m_aSmartTagTypesLB.
OUString sCorrectCapsLock
void NewEntry(const OUString &sShort, const OUString &sLong, bool bKeepSourceFormatting)
virtual void ActivatePage(const SfxItemSet &) override
void CreateEntry(const OUString &rTxt, sal_uInt16 nCol)
LanguageType getLanguageType(bool bResolveSystem=true) const
std::unique_ptr< weld::SpinButton > m_xNFMaxEntries
std::unique_ptr< weld::Button > m_xNewAbbrevPB
const SvStringsISortDtor * GetCplSttExceptList(LanguageType eLang)
static const AllSettings & GetSettings()
virtual void Reset(const SfxItemSet *rSet) override
virtual ~OfaAutoCompleteTabPage() override
constexpr OUStringLiteral PERCENT(u"Percent")
std::unique_ptr< weld::Label > m_xDblStartExFT
std::unique_ptr< weld::ComboBox > m_xDCBExpandKey
virtual ~OfaAutocorrReplacePage() override
void RemoveTabPage(const OString &rName)
std::vector< SvxAutocorrWord > AutocorrWordSetType
std::vector< OUString > aAbbrevStrings
static SfxModule * GetActiveModule(SfxViewFrame *pFrame=nullptr)
sal_uInt16 GetCode() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > VCL_DLLPUBLIC GetSystemClipboard()
OUString sCapitalStartSentence
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
const vcl::Font & GetCharFont() const
static SfxObjectShell * Current()
std::unique_ptr< CollatorWrapper > pCompareClass
virtual void ActivatePage(const SfxItemSet &) override
virtual OUString GetSelectionText(bool bCompleteWords=false)
constexpr sal_uInt16 KEY_SPACE
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
static bool lcl_FindInArray(std::vector< OUString > &rStrings, std::u16string_view rString)
void SetStartSingleQuote(const sal_Unicode cStart)
static LanguageType eLastDialogLanguage
std::unique_ptr< weld::Button > m_xReplacePB
std::unique_ptr< weld::CheckButton > m_xDoubleTypoCB
void InsertEntry(const OUString &rTxt)
std::unique_ptr< weld::Widget > m_xLanguageBox
void RefillReplaceBox(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
std::unique_ptr< weld::Button > m_xSglStandardPB
static bool lcl_FindEntry(weld::TreeView &rLB, const OUString &rEntry, CollatorWrapper const &rCmpClass)
bool IsLabelTextWithSmartTags() const
constexpr sal_uInt16 KEY_END
HashMap_OWString_Interface aMap
OUString sDeleteEmptyPara
std::unique_ptr< weld::TreeView > m_xLBEntries
std::unique_ptr< weld::Label > m_xDblEndExFT
void SaveWrdSttExceptList(LanguageType eLang)
static void CreateEntry(weld::TreeView &rLstBox, const OUString &rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol)
virtual bool FillItemSet(SfxItemSet *rSet) override
OfaAutocorrOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
sal_Unicode GetStartSingleQuote() const
OfaSwAutoFmtOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
std::unique_ptr< SvxLanguageBox > m_xLanguageLB
std::unique_ptr< weld::Entry > m_xReplaceED
virtual bool FillItemSet(SfxItemSet *rSet) override
void SetEndDoubleQuote(const sal_Unicode cEnd)
void SetLanguage(LanguageType eSet)
virtual int n_children() const =0
sal_uInt16 m_nAutoCmpltListCnt
static SfxViewShell * Current()
SvxSwAutoFormatFlags & GetSwFlags()
std::unique_ptr< weld::Label > m_xSglEndExFT
bool NewDelHdl(const weld::Widget *)
sal_uInt16 GetModifier() const
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::unique_ptr< weld::TreeView > m_xCheckLB
#define LANGUAGE_UNDETERMINED
void MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries, LanguageType eLang)
OUString m_sAccidentalCaps
std::unique_ptr< weld::TreeView > m_xCheckLB
For anything but writer.
std::unique_ptr< weld::Button > m_xNewReplacePB
const AutocorrWordSetType & getSortedContent() const
virtual void ActivatePage(const SfxItemSet &) override
OUString sTransliterateRTL
const LanguageTag & GetLanguageTag() const
virtual ~OfaSmartTagOptionsTabPage() override
StringChangeTable aChangesTable
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
OfaAutocorrReplacePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::unique_ptr< weld::Entry > m_xAbbrevED
virtual void Reset(const SfxItemSet *rSet) override
#define DBG_ASSERT(sCon, aError)
OfaQuoteTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
DoubleStringArray aNewEntries
std::unique_ptr< weld::CheckButton > m_xCBActiv
Enable word completion.
std::unique_ptr< weld::Button > m_xPropertiesPB
IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, weld::TreeView &, rBox, void)
virtual ~OfaQuoteTabPage() override
std::vector< OUString > aDoubleCapsStrings
virtual int get_selected_index() const =0
std::unique_ptr< weld::Button > m_xDelDoublePB
void WriteConfiguration(const bool *bLabelTextWithSmartTags, const std::vector< OUString > *pDisabledTypes) const
editeng::SortedAutoCompleteStrings * m_pAutoCompleteList
OfaAutoCorrDlg(weld::Window *pParent, const SfxItemSet *pSet)
virtual void set_toggle(int row, TriState eState, int col=-1)=0
OUString m_sBoldUnderline
SvxAutoCorrect * GetAutoCorrect()
void DeleteEntry(const OUString &sShort, const OUString &sLong)
sal_Unicode GetStartDoubleQuote() const
std::unique_ptr< weld::Button > m_xSglStartQuotePB
virtual void ActivatePage(const SfxItemSet &) override
SvxAutocorrWordList * LoadAutocorrWordList(LanguageType eLang)
std::unique_ptr< weld::TreeView > m_xSwCheckLB
Just for writer.
std::vector< int > m_aReplaceFixedWidths
void * pUserData
CheckBox -> form. Text Bool -> selection text.
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
OfaSmartTagOptionsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
construction via Create()
OUString GetName(vcl::Window *pWindow=nullptr) const
virtual void unselect(int pos)=0
virtual OUString get_text(int row, int col=-1) const =0
const SvStringsISortDtor * GetWrdSttExceptList(LanguageType eLang)
OfaAutocorrExceptPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::unique_ptr< weld::Label > m_xSglStartExFT
void SetAutoCorrFlag(ACFlags nFlag, bool bOn=true)
void SaveCplSttExceptList(LanguageType eLang)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
KeyFuncType GetFunction() const
virtual void Reset(const SfxItemSet *rSet) override
Sets the controls based on the current settings at SmartTagMgr.
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
OUString CuiResId(const char *pKey)
void CopyToClipboard() const
std::unique_ptr< weld::Button > m_xDelAbbrevPB
std::unique_ptr< weld::Button > m_xEditPB
css::uno::Reference< css::smarttags::XSmartTagRecognizer > const & GetRecognizer(sal_uInt32 i) const
virtual void Reset(const SfxItemSet *rSet) override
constexpr sal_uInt16 KEY_RETURN
std::unique_ptr< weld::CheckButton > m_xCBAsTip
Show as tip.
constexpr T & temporary(T &&x)
virtual short run() override
constexpr sal_uInt16 KEY_RIGHT
std::unique_ptr< weld::Button > m_xDblStartQuotePB
std::unique_ptr< weld::CheckButton > m_xCBCollect
Collect words.
void SetEndSingleQuote(const sal_Unicode cEnd)
virtual ~OfaAutoCorrDlg() override
std::unique_ptr< weld::TreeView > m_xAbbrevLB
void RefillReplaceBoxes(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage)
Box filled with new language.
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
void EnableLanguage(bool bEnable)
virtual void Reset(const SfxItemSet *rSet) override
void set_title(const OUString &rTitle)
void SetStartDoubleQuote(const sal_Unicode cStart)
std::vector< DoubleString > DoubleStringArray
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
virtual void select(int pos)=0
SvStringsISortDtor * LoadWrdSttExceptList(LanguageType eLang)
std::unique_ptr< CharClass > pCharClass
virtual ~OfaAutocorrOptionsPage() override
void FillListBox(const SmartTagMgr &rSmartTagMgr)
Inserts items into m_aSmartTagTypesLB.
bool PutText(const OUString &rShort, const OUString &rLong, LanguageType eLang)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
virtual ~OfaAutocorrExceptPage() override
IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox &, void)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::SpinButton > m_xNFMinWordlen
virtual bool FillItemSet(SfxItemSet *rSet) override
DoubleStringArray aDeletedEntries
SvStringsISortDtor * LoadCplSttExceptList(LanguageType eLang)
virtual void Reset(const SfxItemSet *rSet) override
virtual void ActivatePage(const SfxItemSet &) override
sal_Unicode GetEndSingleQuote() const
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual bool FillItemSet(SfxItemSet *rSet) override
bool IsSmartTagTypeEnabled(const OUString &rSmartTagType) const
std::unique_ptr< CollatorWrapper > pCompareClass
Reference< XComponentContext > getProcessComponentContext()
SfxOkDialogController * GetDialogController() const
void SetCharFont(const vcl::Font &rFont)
std::unique_ptr< weld::TreeView > m_xSmartTagTypesLB
void SetLanguage(LanguageType eSet)
void DisableFontSelection()
virtual bool FillItemSet(SfxItemSet *rSet) override
OUString sCapitalStartWord
std::unique_ptr< weld::Button > m_xNewDoublePB
std::unique_ptr< weld::TreeView > m_xReplaceTLB
std::unique_ptr< weld::Button > m_xDblEndQuotePB
void append(TreeIter *pRet=nullptr)
OfaAutoCompleteTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
StringsTable aStringsTable
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
OUString GetSmartTagCaption(const OUString &rSmartTagType, const css::lang::Locale &rLocale) const
virtual void ActivatePage(const SfxItemSet &) override
constexpr sal_uInt16 KEY_DELETE
std::unique_ptr< weld::Button > m_xSglEndQuotePB
vcl::Font aByInputBulletFont
virtual bool HasSelection(bool bText=true) const
std::unique_ptr< weld::Button > m_xDblStandardPB
sal_uInt32 NumberOfRecognizers() const
Smart tag options tab page.
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
std::unique_ptr< weld::Entry > m_xDoubleCapsED
std::map< LanguageType, DoubleStringArray > aDoubleStringTable
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
std::set< OUString > aFormatText
OUString sDelSpaceBetweenLines
static SfxModule * GetModule(SfxToolsModule nSharedLib)
virtual bool FillItemSet(SfxItemSet *rSet) override
virtual void ActivatePage(const SfxItemSet &) override
std::unique_ptr< weld::CheckButton > m_xCBRemoveList
...save the list for later use...
std::unique_ptr< weld::CheckButton > m_xAutoAbbrevCB
std::unique_ptr< weld::Button > m_xPBEntries
constexpr sal_uInt16 KEY_TAB
std::unique_ptr< weld::Container > m_xButtonBox
std::unique_ptr< weld::TreeView > m_xCheckLB
void SetCurPageId(const OString &rName)
OUString ChangeStringExt_Impl(sal_UCS4)
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
std::unique_ptr< weld::CheckButton > m_xTextOnlyCB