summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx67
-rw-r--r--cui/source/customize/CustomNotebookbarGenerator.cxx30
-rw-r--r--cui/source/customize/SvxConfigPageHelper.cxx79
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx63
-rw-r--r--cui/source/customize/SvxNotebookbarConfigPage.cxx96
-rw-r--r--cui/source/customize/SvxToolbarConfigPage.cxx107
-rw-r--r--cui/source/customize/acccfg.cxx158
-rw-r--r--cui/source/customize/cfg.cxx386
-rw-r--r--cui/source/customize/cfgutil.cxx352
-rw-r--r--cui/source/customize/eventdlg.cxx6
-rw-r--r--cui/source/customize/macropg.cxx339
-rw-r--r--cui/source/customize/macropg_impl.hxx3
-rw-r--r--cui/source/dialogs/AdditionsDialog.cxx192
-rw-r--r--cui/source/dialogs/DiagramDialog.cxx95
-rw-r--r--cui/source/dialogs/FontFeaturesDialog.cxx127
-rw-r--r--cui/source/dialogs/GraphicTestsDialog.cxx115
-rw-r--r--cui/source/dialogs/ImageViewerDialog.cxx24
-rw-r--r--cui/source/dialogs/QrCodeGenDialog.cxx267
-rw-r--r--cui/source/dialogs/SignSignatureLineDialog.cxx28
-rw-r--r--cui/source/dialogs/SignatureLineDialogBase.cxx8
-rw-r--r--cui/source/dialogs/SpellAttrib.hxx32
-rw-r--r--cui/source/dialogs/SpellDialog.cxx229
-rw-r--r--cui/source/dialogs/about.cxx92
-rw-r--r--cui/source/dialogs/colorpicker.cxx156
-rw-r--r--cui/source/dialogs/cuicharmap.cxx1245
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx88
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx54
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx41
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx58
-rw-r--r--cui/source/dialogs/dlgname.cxx187
-rw-r--r--cui/source/dialogs/fileextcheckdlg.cxx55
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx68
-rw-r--r--cui/source/dialogs/hldocntp.cxx57
-rw-r--r--cui/source/dialogs/hldoctp.cxx17
-rw-r--r--cui/source/dialogs/hlinettp.cxx157
-rw-r--r--cui/source/dialogs/hlmailtp.cxx14
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx57
-rw-r--r--cui/source/dialogs/hltpbase.cxx108
-rw-r--r--cui/source/dialogs/hyphen.cxx21
-rw-r--r--cui/source/dialogs/iconcdlg.cxx42
-rw-r--r--cui/source/dialogs/insdlg.cxx95
-rw-r--r--cui/source/dialogs/insrc.cxx31
-rw-r--r--cui/source/dialogs/linkdlg.cxx76
-rw-r--r--cui/source/dialogs/multipat.cxx21
-rw-r--r--cui/source/dialogs/passwdomdlg.cxx186
-rw-r--r--cui/source/dialogs/pastedlg.cxx4
-rw-r--r--cui/source/dialogs/postdlg.cxx40
-rw-r--r--cui/source/dialogs/screenshotannotationdlg.cxx33
-rw-r--r--cui/source/dialogs/scriptdlg.cxx192
-rw-r--r--cui/source/dialogs/sdrcelldlg.cxx47
-rw-r--r--cui/source/dialogs/showcols.cxx7
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx11
-rw-r--r--cui/source/dialogs/srchxtra.cxx96
-rw-r--r--cui/source/dialogs/thesdlg.cxx17
-rw-r--r--cui/source/dialogs/tipofthedaydlg.cxx98
-rw-r--r--cui/source/dialogs/toolbarmodedlg.cxx30
-rw-r--r--cui/source/dialogs/whatsnew.cxx172
-rw-r--r--cui/source/dialogs/widgettestdlg.cxx57
-rw-r--r--cui/source/dialogs/zoom.cxx34
-rw-r--r--cui/source/factory/cuiexp.cxx46
-rw-r--r--cui/source/factory/cuiresmgr.cxx2
-rw-r--r--cui/source/factory/dlgfact.cxx513
-rw-r--r--cui/source/factory/dlgfact.hxx669
-rw-r--r--cui/source/factory/init.cxx7
-rw-r--r--cui/source/inc/AdditionsDialog.hxx8
-rw-r--r--cui/source/inc/CustomNotebookbarGenerator.hxx4
-rw-r--r--cui/source/inc/DiagramDialog.hxx10
-rw-r--r--cui/source/inc/FontFeatures.hxx17
-rw-r--r--cui/source/inc/FontFeaturesDialog.hxx24
-rw-r--r--cui/source/inc/GraphicsTestsDialog.hxx54
-rw-r--r--cui/source/inc/ImageViewerDialog.hxx20
-rw-r--r--cui/source/inc/QrCodeGenDialog.hxx18
-rw-r--r--cui/source/inc/SignSignatureLineDialog.hxx3
-rw-r--r--cui/source/inc/SignatureLineDialog.hxx4
-rw-r--r--cui/source/inc/SignatureLineDialogBase.hxx3
-rw-r--r--cui/source/inc/SpellDialog.hxx24
-rw-r--r--cui/source/inc/SvxMenuConfigPage.hxx6
-rw-r--r--cui/source/inc/SvxNotebookbarConfigPage.hxx6
-rw-r--r--cui/source/inc/SvxToolbarConfigPage.hxx6
-rw-r--r--cui/source/inc/TextColumnsPage.hxx40
-rw-r--r--cui/source/inc/about.hxx2
-rw-r--r--cui/source/inc/acccfg.hxx7
-rw-r--r--cui/source/inc/align.hxx19
-rw-r--r--cui/source/inc/autocdlg.hxx20
-rw-r--r--cui/source/inc/backgrnd.hxx17
-rw-r--r--cui/source/inc/bbdlg.hxx2
-rw-r--r--cui/source/inc/border.hxx16
-rw-r--r--cui/source/inc/cfg.hxx60
-rw-r--r--cui/source/inc/cfgutil.hxx18
-rw-r--r--cui/source/inc/chardlg.hxx53
-rw-r--r--cui/source/inc/connect.hxx6
-rw-r--r--cui/source/inc/cuifmsearch.hxx7
-rw-r--r--cui/source/inc/cuigaldlg.hxx12
-rw-r--r--cui/source/inc/cuigrfflt.hxx6
-rw-r--r--cui/source/inc/cuihyperdlg.hxx28
-rw-r--r--cui/source/inc/cuioptgenrl.hxx8
-rw-r--r--cui/source/inc/cuitabarea.hxx97
-rw-r--r--cui/source/inc/cuitabline.hxx25
-rw-r--r--cui/source/inc/dbregister.hxx7
-rw-r--r--cui/source/inc/dialmgr.hxx3
-rw-r--r--cui/source/inc/dlgname.hxx119
-rw-r--r--cui/source/inc/fileextcheckdlg.hxx39
-rw-r--r--cui/source/inc/grfpage.hxx20
-rw-r--r--cui/source/inc/hangulhanjadlg.hxx10
-rw-r--r--cui/source/inc/helpids.h49
-rw-r--r--cui/source/inc/hldocntp.hxx5
-rw-r--r--cui/source/inc/hldoctp.hxx4
-rw-r--r--cui/source/inc/hlinettp.hxx30
-rw-r--r--cui/source/inc/hlmailtp.hxx3
-rw-r--r--cui/source/inc/hltpbase.hxx7
-rw-r--r--cui/source/inc/hyphen.hxx4
-rw-r--r--cui/source/inc/iconcdlg.hxx35
-rw-r--r--cui/source/inc/insdlg.hxx10
-rw-r--r--cui/source/inc/insrc.hxx19
-rw-r--r--cui/source/inc/labdlg.hxx8
-rw-r--r--cui/source/inc/linkdlg.hxx3
-rw-r--r--cui/source/inc/macroass.hxx1
-rw-r--r--cui/source/inc/macropg.hxx19
-rw-r--r--cui/source/inc/measure.hxx8
-rw-r--r--cui/source/inc/multipat.hxx14
-rw-r--r--cui/source/inc/newtabledlg.hxx12
-rw-r--r--cui/source/inc/numfmt.hxx10
-rw-r--r--cui/source/inc/numpages.hxx33
-rw-r--r--cui/source/inc/optasian.hxx7
-rw-r--r--cui/source/inc/optdict.hxx3
-rw-r--r--cui/source/inc/optlingu.hxx8
-rw-r--r--cui/source/inc/optpath.hxx4
-rw-r--r--cui/source/inc/page.hxx14
-rw-r--r--cui/source/inc/paragrph.hxx83
-rw-r--r--cui/source/inc/passwdomdlg.hxx9
-rw-r--r--cui/source/inc/postdlg.hxx2
-rw-r--r--cui/source/inc/scriptdlg.hxx12
-rw-r--r--cui/source/inc/sdrcelldlg.hxx4
-rw-r--r--cui/source/inc/securityoptions.hxx (renamed from cui/source/options/securityoptions.hxx)31
-rw-r--r--cui/source/inc/splitcelldlg.hxx2
-rw-r--r--cui/source/inc/srchxtra.hxx4
-rw-r--r--cui/source/inc/swpossizetabpage.hxx17
-rw-r--r--cui/source/inc/tabstpge.hxx8
-rw-r--r--cui/source/inc/textanim.hxx12
-rw-r--r--cui/source/inc/textattr.hxx10
-rw-r--r--cui/source/inc/thesdlg.hxx3
-rw-r--r--cui/source/inc/tipofthedaydlg.hxx6
-rw-r--r--cui/source/inc/toolbarmodedlg.hxx2
-rw-r--r--cui/source/inc/transfrm.hxx29
-rw-r--r--cui/source/inc/treeopt.hxx93
-rw-r--r--cui/source/inc/whatsnew.hxx79
-rw-r--r--cui/source/inc/zoom.hxx6
-rw-r--r--cui/source/options/certpath.cxx10
-rw-r--r--cui/source/options/cfgchart.cxx138
-rw-r--r--cui/source/options/cfgchart.hxx29
-rw-r--r--cui/source/options/connpoolconfig.cxx65
-rw-r--r--cui/source/options/connpooloptions.cxx73
-rw-r--r--cui/source/options/connpooloptions.hxx9
-rw-r--r--cui/source/options/connpoolsettings.cxx10
-rw-r--r--cui/source/options/connpoolsettings.hxx4
-rw-r--r--cui/source/options/dbregister.cxx78
-rw-r--r--cui/source/options/dbregisterednamesconfig.cxx5
-rw-r--r--cui/source/options/dbregistersettings.cxx4
-rw-r--r--cui/source/options/dbregistersettings.hxx7
-rw-r--r--cui/source/options/doclinkdialog.cxx47
-rw-r--r--cui/source/options/doclinkdialog.hxx3
-rw-r--r--cui/source/options/fontsubs.cxx91
-rw-r--r--cui/source/options/fontsubs.hxx13
-rw-r--r--cui/source/options/optaboutconfig.cxx1123
-rw-r--r--cui/source/options/optaboutconfig.hxx57
-rw-r--r--cui/source/options/optaccessibility.cxx71
-rw-r--r--cui/source/options/optaccessibility.hxx12
-rw-r--r--cui/source/options/optasian.cxx92
-rw-r--r--cui/source/options/optbasic.cxx23
-rw-r--r--cui/source/options/optbasic.hxx3
-rw-r--r--cui/source/options/optchart.cxx47
-rw-r--r--cui/source/options/optchart.hxx4
-rw-r--r--cui/source/options/optcolor.cxx451
-rw-r--r--cui/source/options/optcolor.hxx13
-rw-r--r--cui/source/options/optctl.cxx46
-rw-r--r--cui/source/options/optctl.hxx5
-rw-r--r--cui/source/options/optdeepl.cxx78
-rw-r--r--cui/source/options/optdeepl.hxx39
-rw-r--r--cui/source/options/optdict.cxx64
-rw-r--r--cui/source/options/optfltr.cxx333
-rw-r--r--cui/source/options/optfltr.hxx19
-rw-r--r--cui/source/options/optgdlg.cxx754
-rw-r--r--cui/source/options/optgdlg.hxx83
-rw-r--r--cui/source/options/optgenrl.cxx108
-rw-r--r--cui/source/options/opthtml.cxx210
-rw-r--r--cui/source/options/opthtml.hxx19
-rw-r--r--cui/source/options/optinet2.cxx298
-rw-r--r--cui/source/options/optinet2.hxx38
-rw-r--r--cui/source/options/optjava.cxx117
-rw-r--r--cui/source/options/optjava.hxx9
-rw-r--r--cui/source/options/optjsearch.cxx41
-rw-r--r--cui/source/options/optjsearch.hxx2
-rw-r--r--cui/source/options/optlanguagetool.cxx170
-rw-r--r--cui/source/options/optlanguagetool.hxx55
-rw-r--r--cui/source/options/optlingu.cxx349
-rw-r--r--cui/source/options/optopencl.cxx19
-rw-r--r--cui/source/options/optopencl.hxx2
-rw-r--r--cui/source/options/optpath.cxx101
-rw-r--r--cui/source/options/optsave.cxx236
-rw-r--r--cui/source/options/optsave.hxx22
-rw-r--r--cui/source/options/optupdt.cxx370
-rw-r--r--cui/source/options/optupdt.hxx22
-rw-r--r--cui/source/options/personalization.cxx64
-rw-r--r--cui/source/options/personalization.hxx4
-rw-r--r--cui/source/options/sdbcdriverenum.cxx10
-rw-r--r--cui/source/options/sdbcdriverenum.hxx8
-rw-r--r--cui/source/options/securityoptions.cxx107
-rw-r--r--cui/source/options/treeopt.cxx1163
-rw-r--r--cui/source/options/treeopthelper.cxx184
-rw-r--r--cui/source/options/tsaurls.cxx8
-rw-r--r--cui/source/options/webconninfo.cxx10
-rw-r--r--cui/source/tabpages/TextColumnsPage.cxx82
-rw-r--r--cui/source/tabpages/align.cxx163
-rw-r--r--cui/source/tabpages/autocdlg.cxx255
-rw-r--r--cui/source/tabpages/backgrnd.cxx241
-rw-r--r--cui/source/tabpages/bbdlg.cxx13
-rw-r--r--cui/source/tabpages/border.cxx299
-rw-r--r--cui/source/tabpages/chardlg.cxx560
-rw-r--r--cui/source/tabpages/connect.cxx80
-rw-r--r--cui/source/tabpages/grfpage.cxx266
-rw-r--r--cui/source/tabpages/labdlg.cxx29
-rw-r--r--cui/source/tabpages/macroass.cxx41
-rw-r--r--cui/source/tabpages/measure.cxx47
-rw-r--r--cui/source/tabpages/numfmt.cxx142
-rw-r--r--cui/source/tabpages/numpages.cxx792
-rw-r--r--cui/source/tabpages/page.cxx192
-rw-r--r--cui/source/tabpages/paragrph.cxx1012
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx292
-rw-r--r--cui/source/tabpages/tabarea.cxx74
-rw-r--r--cui/source/tabpages/tabline.cxx14
-rw-r--r--cui/source/tabpages/tabstpge.cxx38
-rw-r--r--cui/source/tabpages/textanim.cxx40
-rw-r--r--cui/source/tabpages/textattr.cxx125
-rw-r--r--cui/source/tabpages/tparea.cxx187
-rw-r--r--cui/source/tabpages/tpbitmap.cxx98
-rw-r--r--cui/source/tabpages/tpcolor.cxx178
-rw-r--r--cui/source/tabpages/tpgradnt.cxx145
-rw-r--r--cui/source/tabpages/tphatch.cxx32
-rw-r--r--cui/source/tabpages/tpline.cxx197
-rw-r--r--cui/source/tabpages/tplnedef.cxx27
-rw-r--r--cui/source/tabpages/tplneend.cxx17
-rw-r--r--cui/source/tabpages/tppattern.cxx35
-rw-r--r--cui/source/tabpages/tpshadow.cxx63
-rw-r--r--cui/source/tabpages/tptrans.cxx102
-rw-r--r--cui/source/tabpages/transfrm.cxx183
-rw-r--r--cui/source/util/FontFeatures.cxx30
246 files changed, 13385 insertions, 9729 deletions
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 5b8903f3d199..f7f3295a921d 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -35,7 +35,7 @@
// include search util
#include <com/sun/star/util/SearchFlags.hpp>
#include <com/sun/star/util/SearchAlgorithms2.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/textsearch.hxx>
#include <dialmgr.hxx>
@@ -44,6 +44,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/SetFlagContextHelper.hxx>
#include <comphelper/string.hxx>
+#include <officecfg/Office/Common.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nutil/searchopt.hxx>
#include <sal/log.hxx>
@@ -133,9 +134,8 @@ void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponent
// Add the category of "All commands"
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
- m_xControl->append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- CuiResId(RID_SVXSTR_ALLFUNCTIONS));
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
+ CuiResId(RID_CUISTR_ALLFUNCTIONS));
}
// Separate the "All commands"category from the actual categories
@@ -180,9 +180,7 @@ void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponent
sal_Int16 nGroupID = a.second;
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_FUNCTION, nGroupID));
- m_xControl->append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- rGroupName);
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()), rGroupName);
}
// Separate regular commands from styles and macros
@@ -191,15 +189,14 @@ void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponent
// Add macros category
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, nullptr));
- m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- CuiResId(RID_SVXSTR_MACROS));
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()), CuiResId(RID_CUISTR_MACROS));
// Add styles category
//TODO: last param should contain user data?
m_aGroupInfo.push_back(
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, nullptr));
- m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- CuiResId(RID_SVXSTR_GROUP_STYLES));
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
+ CuiResId(RID_CUISTR_GROUP_STYLES));
}
catch (const css::uno::RuntimeException&)
{
@@ -222,6 +219,7 @@ void CommandCategoryListBox::FillFunctionsList(
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
utl::TextSearch textSearch(m_searchOptions);
+ const bool bInExperimentalMode = officecfg::Office::Common::Misc::ExperimentalMode::get();
for (const auto& rInfo : xCommands)
{
@@ -234,11 +232,17 @@ void CommandCategoryListBox::FillFunctionsList(
= vcl::CommandInfoProvider::GetTooltipForCommand(rInfo.Command, aProperties, m_xFrame);
OUString sPopupLabel = (vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties))
.replaceFirst("~", "");
+ bool bIsExperimental
+ = vcl::CommandInfoProvider::IsExperimental(rInfo.Command, m_sModuleLongName);
+
+ // Hide experimental commands when not in experimental mode
+ bool bHideExperimental = bIsExperimental && !bInExperimentalMode;
// Apply the search filter
- if (!filterTerm.isEmpty() && !textSearch.searchForward(sUIName)
- && !textSearch.searchForward(sLabel) && !textSearch.searchForward(sTooltipLabel)
- && !textSearch.searchForward(sPopupLabel))
+ if (bHideExperimental
+ || (!filterTerm.isEmpty() && !textSearch.searchForward(sUIName)
+ && !textSearch.searchForward(sLabel) && !textSearch.searchForward(sTooltipLabel)
+ && !textSearch.searchForward(sPopupLabel)))
{
continue;
}
@@ -252,9 +256,7 @@ void CommandCategoryListBox::FillFunctionsList(
pGrpInfo->sCommand = rInfo.Command;
pGrpInfo->sLabel = sUIName;
pGrpInfo->sTooltip = sTooltipLabel;
- pFunctionListBox->append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName,
- xImage);
+ pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), sUIName, xImage);
}
}
@@ -293,8 +295,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
const OUString& filterTerm,
SaveInData* pCurrentSaveInData)
{
- SfxGroupInfo_Impl* pInfo
- = reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_active_id().toInt64());
+ SfxGroupInfo_Impl* pInfo = weld::fromId<SfxGroupInfo_Impl*>(m_xControl->get_active_id());
std::vector<std::unique_ptr<weld::TreeIter>> aNodesToExpand;
pFunctionListBox->freeze();
pFunctionListBox->ClearAll();
@@ -310,7 +311,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
for (sal_Int32 nCurPos = 0; nCurPos < nEntryCount; ++nCurPos)
{
SfxGroupInfo_Impl* pCurrentInfo
- = reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos).toInt64());
+ = weld::fromId<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos));
if (!pCurrentInfo) //separator
continue;
@@ -384,11 +385,11 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
OUString sUIName;
if (childGroup->getName() == "user")
{
- sUIName = CuiResId(RID_SVXSTR_MYMACROS);
+ sUIName = CuiResId(RID_CUISTR_MYMACROS);
}
else if (childGroup->getName() == "share")
{
- sUIName = CuiResId(RID_SVXSTR_PRODMACROS);
+ sUIName = CuiResId(RID_CUISTR_PRODMACROS);
}
else
{
@@ -403,9 +404,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0));
std::unique_ptr<weld::TreeIter> xMacroGroup(pFunctionListBox->tree_append(
- OUString::number(
- reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- sUIName));
+ weld::toId(m_aGroupInfo.back().get()), sUIName));
{
// tdf#128010: Do not nag user asking to enable JRE: if it's disabled,
@@ -447,8 +446,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0));
// pIt.sLabel is Name of the style family
std::unique_ptr<weld::TreeIter> xFuncEntry(pFunctionListBox->tree_append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- pIt.sLabel));
+ weld::toId(m_aGroupInfo.back().get()), pIt.sLabel));
const std::vector<SfxStyleInfo_Impl> lStyles = pStylesInfo->getStyles(pIt.sFamily);
@@ -478,9 +476,8 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
m_aGroupInfo.back()->sCommand = pStyle->sCommand;
m_aGroupInfo.back()->sLabel = pStyle->sLabel;
- pFunctionListBox->append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
- sUIName, xFuncEntry.get());
+ pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), sUIName,
+ xFuncEntry.get());
}
// Remove the style group from the list if no children
@@ -539,8 +536,7 @@ void CommandCategoryListBox::addChildren(
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, static_cast<void*>(child.get())));
std::unique_ptr<weld::TreeIter> xNewEntry(pFunctionListBox->tree_append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName,
- parentEntry));
+ weld::toId(m_aGroupInfo.back().get()), sUIName, parentEntry));
addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, pCurrentSaveInData,
rNodesToExpand);
@@ -588,7 +584,7 @@ void CommandCategoryListBox::addChildren(
if (description.isEmpty())
{
- description = CuiResId(RID_SVXSTR_NOMACRODESC);
+ description = CuiResId(RID_CUISTR_NOMACRODESC);
}
OUString* pScriptURI = new OUString(uri);
@@ -602,9 +598,8 @@ void CommandCategoryListBox::addChildren(
m_aGroupInfo.back()->sCommand = uri;
m_aGroupInfo.back()->sLabel = sUIName;
m_aGroupInfo.back()->sHelpText = description;
- pFunctionListBox->append(
- OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName,
- xImage, parentEntry);
+ pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), sUIName, xImage,
+ parentEntry);
}
}
}
diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx
index 392ea3e37a4e..1d013654d8f7 100644
--- a/cui/source/customize/CustomNotebookbarGenerator.cxx
+++ b/cui/source/customize/CustomNotebookbarGenerator.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/frame/ModuleManager.hpp>
#include <unotools/confignode.hxx>
#include <libxml/parser.h>
+#include <o3tl/string_view.hxx>
#define aUIPropertiesCount 3
@@ -73,11 +74,14 @@ static OUString lcl_getAppName(vcl::EnumContext::Application eApp)
static OUString getAppNameRegistryPath()
{
vcl::EnumContext::Application eApp = vcl::EnumContext::Application::Any;
- const Reference<frame::XFrame>& xFrame
- = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
- const Reference<frame::XModuleManager> xModuleManager
- = frame::ModuleManager::create(::comphelper::getProcessComponentContext());
- eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
+
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ {
+ const Reference<frame::XFrame>& xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ const Reference<frame::XModuleManager> xModuleManager
+ = frame::ModuleManager::create(::comphelper::getProcessComponentContext());
+ eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
+ }
OUString sAppName(lcl_getAppName(eApp));
return "org.openoffice.Office.UI.ToolbarMode/Applications/" + sAppName;
@@ -180,14 +184,18 @@ static xmlDocPtr notebookbarXMLParser(const OString& rDocName, const OString& rU
void CustomNotebookbarGenerator::modifyCustomizedUIFile(const Sequence<OUString>& sUIItemProperties)
{
- OString sCustomizedUIPath = getSystemPath(getCustomizedUIPath());
+ const OUString sUIPath = getCustomizedUIPath();
+ if (osl::File(sUIPath).open(osl_File_OpenFlag_Read) != osl::FileBase::E_None)
+ createCustomizedUIFile();
+
+ const OString sCustomizedUIPath = getSystemPath(sUIPath);
for (auto const& aValue : sUIItemProperties)
{
std::vector<OString> aProperties(aUIPropertiesCount);
for (sal_Int32 aIndex = 0; aIndex < aUIPropertiesCount; aIndex++)
{
sal_Int32 nPos = aIndex;
- OUString sToken = aValue.getToken(nPos, ',', nPos);
+ std::u16string_view sToken = o3tl::getToken(aValue, nPos, ',', nPos);
aProperties[aIndex] = OUStringToOString(sToken, RTL_TEXTENCODING_UTF8);
}
xmlDocPtr doc = notebookbarXMLParser(sCustomizedUIPath, aProperties[0], aProperties[1],
@@ -257,16 +265,16 @@ Sequence<OUString> CustomNotebookbarGenerator::getCustomizedUIItem(OUString sNot
return aValues;
}
-void CustomNotebookbarGenerator::setCustomizedUIItem(Sequence<OUString> sUIItemProperties,
- OUString sNotebookbarConfigType)
+void CustomNotebookbarGenerator::setCustomizedUIItem(const Sequence<OUString>& rUIItemProperties,
+ const OUString& rNotebookbarConfigType)
{
OUString aPath = getAppNameRegistryPath();
const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), aPath,
true);
const utl::OConfigurationNode aModesNode = aAppNode.openNode("Modes");
- const utl::OConfigurationNode aModeNode(aModesNode.openNode(sNotebookbarConfigType));
+ const utl::OConfigurationNode aModeNode(aModesNode.openNode(rNotebookbarConfigType));
- css::uno::Any aUIItemProperties(makeAny(sUIItemProperties));
+ css::uno::Any aUIItemProperties(rUIItemProperties);
aModeNode.setNodeValue("UIItemProperties", aUIItemProperties);
aAppNode.commit();
}
diff --git a/cui/source/customize/SvxConfigPageHelper.cxx b/cui/source/customize/SvxConfigPageHelper.cxx
index 527754d5cf5f..59a2cdb64017 100644
--- a/cui/source/customize/SvxConfigPageHelper.cxx
+++ b/cui/source/customize/SvxConfigPageHelper.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/ui/ImageType.hpp>
#include <com/sun/star/ui/ItemType.hpp>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/random.hxx>
#include <svtools/imgdef.hxx>
#include <svtools/miscopt.hxx>
@@ -65,11 +66,11 @@ void SvxConfigPageHelper::InitImageType()
{
theImageType = css::ui::ImageType::COLOR_NORMAL | css::ui::ImageType::SIZE_DEFAULT;
- if (SvtMiscOptions().GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
+ if (SvtMiscOptions::GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
{
theImageType |= css::ui::ImageType::SIZE_LARGE;
}
- else if (SvtMiscOptions().GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32)
+ else if (SvtMiscOptions::GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32)
{
theImageType |= css::ui::ImageType::SIZE_32;
}
@@ -177,7 +178,7 @@ sal_uInt32 SvxConfigPageHelper::generateRandomValue()
OUString SvxConfigPageHelper::generateCustomURL(SvxEntries* entries)
{
- OUString url = OUStringLiteral(ITEM_TOOLBAR_URL) + CUSTOM_TOOLBAR_STR +
+ OUString url = OUString::Concat(ITEM_TOOLBAR_URL) + CUSTOM_TOOLBAR_STR +
// use a random number to minimize possible clash with existing custom toolbars
OUString::number(generateRandomValue(), 16);
@@ -247,7 +248,7 @@ OUString SvxConfigPageHelper::GetUIModuleName(
if (a >>= aSeq)
{
- for (css::beans::PropertyValue const& rProp : std::as_const(aSeq))
+ for (css::beans::PropertyValue const& rProp : aSeq)
{
if (rProp.Name == "ooSetupFactoryUIName")
{
@@ -281,7 +282,7 @@ bool SvxConfigPageHelper::GetMenuItemData(
css::uno::Sequence<css::beans::PropertyValue> aProps;
if (rItemContainer->getByIndex(nIndex) >>= aProps)
{
- for (css::beans::PropertyValue const& rProp : std::as_const(aProps))
+ for (css::beans::PropertyValue const& rProp : aProps)
{
if (rProp.Name == ITEM_DESCRIPTOR_COMMANDURL)
{
@@ -324,7 +325,7 @@ bool SvxConfigPageHelper::GetToolbarItemData(
css::uno::Sequence<css::beans::PropertyValue> aProps;
if (rItemContainer->getByIndex(nIndex) >>= aProps)
{
- for (css::beans::PropertyValue const& rProp : std::as_const(aProps))
+ for (css::beans::PropertyValue const& rProp : aProps)
{
if (rProp.Name == ITEM_DESCRIPTOR_COMMANDURL)
{
@@ -361,29 +362,20 @@ bool SvxConfigPageHelper::GetToolbarItemData(
css::uno::Sequence<css::beans::PropertyValue>
SvxConfigPageHelper::ConvertSvxConfigEntry(const SvxConfigEntry* pEntry)
{
- css::uno::Sequence<css::beans::PropertyValue> aPropSeq(4);
-
- aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
- aPropSeq[0].Value <<= pEntry->GetCommand();
-
- aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
- aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
-
// If the name has not been changed, then the label can be stored
// as an empty string.
// It will be initialised again later using the command to label map.
- aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
- if (!pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty())
- {
- aPropSeq[2].Value <<= OUString();
- }
- else
- {
- aPropSeq[2].Value <<= pEntry->GetName();
- }
-
- aPropSeq[3].Name = ITEM_DESCRIPTOR_STYLE;
- aPropSeq[3].Value <<= static_cast<sal_Int16>(pEntry->GetStyle());
+ OUString sLabel;
+ if (pEntry->HasChangedName() || pEntry->GetCommand().isEmpty())
+ sLabel = pEntry->GetName();
+
+ css::uno::Sequence<css::beans::PropertyValue> aPropSeq{
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, pEntry->GetCommand()),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::DEFAULT),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_LABEL, sLabel),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_STYLE,
+ static_cast<sal_Int16>(pEntry->GetStyle()))
+ };
return aPropSeq;
}
@@ -391,32 +383,21 @@ SvxConfigPageHelper::ConvertSvxConfigEntry(const SvxConfigEntry* pEntry)
css::uno::Sequence<css::beans::PropertyValue>
SvxConfigPageHelper::ConvertToolbarEntry(const SvxConfigEntry* pEntry)
{
- css::uno::Sequence<css::beans::PropertyValue> aPropSeq(5);
-
- aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
- aPropSeq[0].Value <<= pEntry->GetCommand();
-
- aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
- aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
-
// If the name has not been changed, then the label can be stored
// as an empty string.
// It will be initialised again later using the command to label map.
- aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL;
- if (!pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty())
- {
- aPropSeq[2].Value <<= OUString();
- }
- else
- {
- aPropSeq[2].Value <<= pEntry->GetName();
- }
-
- aPropSeq[3].Name = ITEM_DESCRIPTOR_ISVISIBLE;
- aPropSeq[3].Value <<= pEntry->IsVisible();
-
- aPropSeq[4].Name = ITEM_DESCRIPTOR_STYLE;
- aPropSeq[4].Value <<= static_cast<sal_Int16>(pEntry->GetStyle());
+ OUString sLabel;
+ if (pEntry->HasChangedName() || pEntry->GetCommand().isEmpty())
+ sLabel = pEntry->GetName();
+
+ css::uno::Sequence<css::beans::PropertyValue> aPropSeq{
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, pEntry->GetCommand()),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::DEFAULT),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_LABEL, sLabel),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_ISVISIBLE, pEntry->IsVisible()),
+ comphelper::makePropertyValue(ITEM_DESCRIPTOR_STYLE,
+ static_cast<sal_Int16>(pEntry->GetStyle()))
+ };
return aPropSeq;
}
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index 3181a78bbb07..4ee5ce9be0ca 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <sal/log.hxx>
+#include <dlgname.hxx>
#include <vcl/weld.hxx>
#include <vcl/svapp.hxx>
#include <vcl/commandevent.hxx>
@@ -34,8 +35,6 @@
#include <comphelper/processfactory.hxx>
-#include <dlgname.hxx>
-
SvxMenuConfigPage::SvxMenuConfigPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rSet, bool bIsMenuBar)
: SvxConfigPage(pPage, pController, rSet)
@@ -100,8 +99,7 @@ void SvxMenuConfigPage::ListModified()
pEntries->clear();
for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
- pEntries->push_back(
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
+ pEntries->push_back(weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(i)));
GetSaveInData()->SetModified();
GetTopLevelSelection()->SetModified();
@@ -123,7 +121,7 @@ IMPL_LINK(SvxMenuConfigPage, MenuEntriesSizeAllocHdl, const Size&, rSize, void)
SvxMenuConfigPage::~SvxMenuConfigPage()
{
for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
- delete reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
+ delete weld::fromId<SaveInData*>(m_xSaveInListBox->get_id(i));
m_xSaveInListBox->clear();
}
@@ -136,7 +134,7 @@ void SvxMenuConfigPage::Init()
ReloadTopLevelListBox();
- m_xTopLevelListBox->set_active(0);
+ m_xTopLevelListBox->set_active(m_xTopLevelListBox->get_count() ? 0 : -1);
SelectElement();
m_xCommandCategoryListBox->Init(comphelper::getProcessComponentContext(), m_xFrame,
@@ -154,8 +152,7 @@ void SvxMenuConfigPage::UpdateButtonStates()
bool bIsSeparator
= selection != -1
- && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())
- ->IsSeparator();
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(selection))->IsSeparator();
bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && selection != -1);
m_xMoveUpButton->set_sensitive(bIsValidSelection && selection != 0);
@@ -172,8 +169,17 @@ void SvxMenuConfigPage::UpdateButtonStates()
m_xInsertBtn->set_sensitive(pMenuData != nullptr);
- m_xAddCommandButton->set_sensitive(pMenuData != nullptr);
- m_xRemoveCommandButton->set_sensitive(pMenuData != nullptr);
+ SvxConfigEntry* selectedCmd = CreateCommandFromSelection(GetScriptURL());
+
+ m_xAddCommandButton->set_sensitive(
+ pMenuData != nullptr && !IsCommandInMenuList(selectedCmd, pMenuData->GetEntries()));
+
+ delete selectedCmd;
+
+ if (bIsValidSelection)
+ {
+ m_xRemoveCommandButton->set_sensitive(pMenuData != nullptr);
+ }
//Handle the gear button
if (pMenuData && m_bIsMenuBar)
@@ -208,7 +214,7 @@ void SvxMenuConfigPage::DeleteSelectedContent()
// get currently selected menu entry
SvxConfigEntry* pMenuEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
// get currently selected menu
SvxConfigEntry* pMenu = GetTopLevelSelection();
@@ -234,7 +240,7 @@ void SvxMenuConfigPage::DeleteSelectedContent()
short SvxMenuConfigPage::QueryReset()
{
- OUString msg = CuiResId(RID_SVXSTR_CONFIRM_MENU_RESET);
+ OUString msg = CuiResId(RID_CUISTR_CONFIRM_MENU_RESET);
OUString saveInName = m_xSaveInListBox->get_active_text();
@@ -259,7 +265,7 @@ void SvxMenuConfigPage::SelectElement()
rTreeView.bulk_insert_for_each(
pEntries->size(), [this, &rTreeView, pEntries](weld::TreeIter& rIter, int nIdx) {
auto const& entry = (*pEntries)[nIdx];
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
+ OUString sId(weld::toId(entry));
rTreeView.set_id(rIter, sId);
InsertEntryIntoUI(entry, rTreeView, rIter, true);
});
@@ -268,7 +274,7 @@ void SvxMenuConfigPage::SelectElement()
UpdateButtonStates();
}
-IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxMenuConfigPage, GearHdl, const OUString&, rIdent, void)
{
if (rIdent == "menu_gear_add")
{
@@ -291,11 +297,11 @@ IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
SvxConfigEntry* pMenuData = GetTopLevelSelection();
OUString sCurrentName(SvxConfigPageHelper::stripHotKey(pMenuData->GetName()));
- OUString sDesc = CuiResId(RID_SVXSTR_LABEL_NEW_NAME);
+ OUString sDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
SvxNameDialog aNameDialog(GetFrameWeld(), sCurrentName, sDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_MENU);
- aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU));
+ aNameDialog.set_title(CuiResId(RID_CUISTR_RENAME_MENU));
if (aNameDialog.run() == RET_OK)
{
@@ -351,7 +357,7 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, AddCommandHdl, weld::Button&, void)
if (nPos == -1)
return;
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
- SvxConfigEntry* pEntry = reinterpret_cast<SvxConfigEntry*>(rTreeView.get_id(nPos).toInt64());
+ SvxConfigEntry* pEntry = weld::fromId<SvxConfigEntry*>(rTreeView.get_id(nPos));
InsertEntryIntoUI(pEntry, rTreeView, nPos, true);
}
@@ -364,7 +370,7 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, RemoveCommandHdl, weld::Button&, void)
}
}
-IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OUString&, rIdent, void)
{
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
if (rIdent == "insertseparator")
@@ -377,11 +383,11 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
else if (rIdent == "insertsubmenu")
{
OUString aNewName;
- OUString aDesc = CuiResId(RID_SVXSTR_SUBMENU_NAME);
+ OUString aDesc = CuiResId(RID_CUISTR_SUBMENU_NAME);
SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_NAME_SUBMENU);
- aNameDialog.set_title(CuiResId(RID_SVXSTR_ADD_SUBMENU));
+ aNameDialog.set_title(CuiResId(RID_CUISTR_ADD_SUBMENU));
if (aNameDialog.run() == RET_OK)
{
@@ -416,20 +422,20 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
}
}
-IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OUString&, rIdent, void)
{
if (rIdent == "renameItem")
{
int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
- OUString aDesc = CuiResId(RID_SVXSTR_LABEL_NEW_NAME);
+ OUString aDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_MENU_ITEM);
- aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU));
+ aNameDialog.set_title(CuiResId(RID_CUISTR_RENAME_MENU));
if (aNameDialog.run() == RET_OK)
{
@@ -468,7 +474,7 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void)
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT_MENU)));
+ CuiResId(RID_CUISTR_CONFIRM_RESTORE_DEFAULT_MENU)));
// Resetting individual top-level menus is not possible at the moment.
// So we are resetting only if it is a context menu
@@ -522,8 +528,7 @@ IMPL_LINK(SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt,
bool bIsSeparator
= nSelectIndex != -1
- && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())
- ->IsSeparator();
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && nSelectIndex != -1);
std::unique_ptr<weld::Builder> xBuilder(
@@ -535,7 +540,7 @@ IMPL_LINK(SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt,
xContextMenu->set_visible("changeIcon", false);
xContextMenu->set_visible("resetIcon", false);
xContextMenu->set_visible("restoreDefault", false);
- OString sCommand(xContextMenu->popup_at_rect(
+ OUString sCommand(xContextMenu->popup_at_rect(
&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
if (sCommand == "remove")
@@ -574,7 +579,7 @@ IMPL_LINK(SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt,
xContextMenu->set_visible("changeIcon", false);
xContextMenu->set_visible("resetIcon", false);
xContextMenu->set_visible("restoreDefault", false);
- OString sCommand(xContextMenu->popup_at_rect(
+ OUString sCommand(xContextMenu->popup_at_rect(
&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
if (sCommand == "add")
diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx
index 7e93dae121af..7389d05b91d2 100644
--- a/cui/source/customize/SvxNotebookbarConfigPage.cxx
+++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx
@@ -40,14 +40,13 @@
#include <sfx2/notebookbar/SfxNotebookBar.hxx>
#include <unotools/configmgr.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/frame/theUICommandDescription.hpp>
namespace uno = com::sun::star::uno;
namespace frame = com::sun::star::frame;
-namespace lang = com::sun::star::lang;
namespace container = com::sun::star::container;
namespace beans = com::sun::star::beans;
-namespace graphic = com::sun::star::graphic;
static bool isCategoryAvailable(std::u16string_view sClassId, std::u16string_view sUIItemId,
std::u16string_view sActiveCategory, bool& isCategory)
@@ -70,13 +69,13 @@ static OUString charToString(const char* cString)
static OUString getFileName(std::u16string_view aFileName)
{
if (aFileName == u"notebookbar.ui")
- return "Tabbed";
+ return CuiResId(RID_CUISTR_TABBED);
else if (aFileName == u"notebookbar_compact.ui")
- return "TabbedCompact";
+ return CuiResId(RID_CUISTR_TABBED_COMPACT);
else if (aFileName == u"notebookbar_groupedbar_full.ui")
- return "Groupedbar";
+ return CuiResId(RID_CUISTR_GROUPEDBAR);
else if (aFileName == u"notebookbar_groupedbar_compact.ui")
- return "GroupedbarCompact";
+ return CuiResId(RID_CUISTR_GROUPEDBAR_COMPACT);
else
return "None";
}
@@ -106,14 +105,11 @@ SvxNotebookbarConfigPage::SvxNotebookbarConfigPage(weld::Container* pPage,
m_xDescriptionField->set_visible(false);
m_xMoveUpButton->set_visible(false);
m_xMoveDownButton->set_visible(false);
- m_xAddCommandButton->set_visible(false);
- m_xRemoveCommandButton->set_visible(false);
+ m_xCommandButtons->set_visible(false);
m_xLeftFunctionLabel->set_visible(false);
m_xSearchLabel->set_visible(false);
m_xCategoryLabel->set_visible(false);
- m_xInsertBtn->set_visible(false);
- m_xModifyBtn->set_visible(false);
- m_xResetBtn->set_visible(false);
+ m_xCustomizeBox->set_visible(false);
m_xCustomizeLabel->set_visible(false);
weld::TreeView& rCommandCategoryBox = m_xFunctions->get_widget();
@@ -144,7 +140,6 @@ void SvxNotebookbarConfigPage::Init()
m_xTopLevelListBox->clear();
m_xContentsListBox->clear();
m_xSaveInListBox->clear();
- CustomNotebookbarGenerator::createCustomizedUIFile();
OUString sNotebookbarInterface = getFileName(m_sFileName);
OUString sScopeName
@@ -154,7 +149,7 @@ void SvxNotebookbarConfigPage::Init()
m_xSaveInListBox->append(sSaveInListBoxID, sScopeName);
m_xSaveInListBox->set_active_id(sSaveInListBoxID);
- m_xTopLevelListBox->append("NotebookBar", "All Commands");
+ m_xTopLevelListBox->append("NotebookBar", CuiResId(RID_CUISTR_ALL_COMMANDS));
m_xTopLevelListBox->set_active_id("NotebookBar");
SelectElement();
}
@@ -172,7 +167,7 @@ void SvxNotebookbarConfigPage::UpdateButtonStates() {}
short SvxNotebookbarConfigPage::QueryReset()
{
- OUString msg = CuiResId(RID_SVXSTR_CONFIRM_TOOLBAR_RESET);
+ OUString msg = CuiResId(RID_CUISTR_CONFIRM_TOOLBAR_RESET);
OUString saveInName = m_xSaveInListBox->get_active_text();
@@ -183,9 +178,8 @@ short SvxNotebookbarConfigPage::QueryReset()
int nValue = xQueryBox->run();
if (nValue == RET_YES)
{
- OUString sOriginalUIPath = CustomNotebookbarGenerator::getOriginalUIPath();
- OUString sCustomizedUIPath = CustomNotebookbarGenerator::getCustomizedUIPath();
- osl::File::copy(sOriginalUIPath, sCustomizedUIPath);
+ osl::File::remove(CustomNotebookbarGenerator::getCustomizedUIPath());
+
OUString sNotebookbarInterface = getFileName(m_sFileName);
Sequence<OUString> sSequenceEntries;
CustomNotebookbarGenerator::setCustomizedUIItem(sSequenceEntries, sNotebookbarInterface);
@@ -221,7 +215,7 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId
}
OUString aLabel;
- for (auto const& prop : std::as_const(aPropSeq))
+ for (auto const& prop : aPropSeq)
if (prop.Name == "Name")
prop.Value >>= aLabel;
@@ -317,8 +311,9 @@ void SvxNotebookbarConfigPage::searchNodeandAttribute(std::vector<NotebookbarEnt
{
sal_Int32 rPos = 0;
aCategoryEntry.sDisplayName
- = aCurItemEntry.sDisplayName.getToken(rPos, ' ', rPos) + " | "
- + sUIItemId;
+ = OUString::Concat(
+ o3tl::getToken(aCurItemEntry.sDisplayName, rPos, ' ', rPos))
+ + " | " + sUIItemId;
}
aCategoryList.push_back(aCategoryEntry);
aCurItemEntry = aCategoryEntry;
@@ -398,6 +393,13 @@ void SvxNotebookbarConfigPage::SelectElement()
CustomNotebookbarGenerator::getCustomizedUIPath());
xmlDocPtr pDoc = xmlParseFile(sUIFileUIPath.getStr());
if (!pDoc)
+ {
+ sUIFileUIPath = CustomNotebookbarGenerator::getSystemPath(
+ CustomNotebookbarGenerator::getOriginalUIPath());
+ pDoc = xmlParseFile(sUIFileUIPath.getStr());
+ }
+
+ if (!pDoc)
return;
xmlNodePtr pNodePtr = xmlDocGetRootElement(pDoc);
@@ -408,9 +410,8 @@ void SvxNotebookbarConfigPage::SelectElement()
if (m_xTopLevelListBox->get_count() == 1)
{
- for (std::size_t nIdx = 0; nIdx < aCategoryList.size(); nIdx++)
- m_xTopLevelListBox->append(aCategoryList[nIdx].sUIItemId,
- aCategoryList[nIdx].sDisplayName);
+ for (const auto& rCategory : aCategoryList)
+ m_xTopLevelListBox->append(rCategory.sUIItemId, rCategory.sDisplayName);
}
tools::ULong nStart = 0;
if (aEntries[nStart].sClassId == "sfxlo-PriorityHBox"
@@ -423,26 +424,20 @@ void SvxNotebookbarConfigPage::SelectElement()
if (aEntries[nIdx].sClassId == "svtlo-ManagedMenuButton")
{
aTempEntries.push_back(aEntries[nIdx]);
- std::vector<NotebookbarEntries> aGtkEntries;
sal_Int32 rPos = 1;
sActiveCategory = aEntries[nIdx].sUIItemId.getToken(rPos, ':', rPos);
- FillFunctionsList(pNodePtr, aGtkEntries, aCategoryList, sActiveCategory);
- for (std::size_t Idx = 0; Idx < aGtkEntries.size(); Idx++)
- aTempEntries.push_back(aGtkEntries[Idx]);
- aGtkEntries.clear();
+ FillFunctionsList(pNodePtr, aTempEntries, aCategoryList, sActiveCategory);
}
else
aTempEntries.push_back(aEntries[nIdx]);
}
- aEntries = aTempEntries;
- aTempEntries.clear();
+ aEntries = std::move(aTempEntries);
+ static_cast<SvxNotebookbarEntriesListBox*>(m_xContentsListBox.get())->GetTooltipMap().clear();
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
rTreeView.bulk_insert_for_each(
aEntries.size(), [this, &rTreeView, &aEntries](weld::TreeIter& rIter, int nIdx) {
- OUString sId(OUString::number(nIdx));
- rTreeView.set_id(rIter, sId);
if (aEntries[nIdx].sActionName != "Null")
{
if (aEntries[nIdx].sVisibleValue == "True")
@@ -456,6 +451,13 @@ void SvxNotebookbarConfigPage::SelectElement()
}
InsertEntryIntoNotebookbarTabUI(aEntries[nIdx].sClassId, aEntries[nIdx].sDisplayName,
aEntries[nIdx].sActionName, rTreeView, rIter);
+ if (aEntries[nIdx].sClassId != u"GtkSeparatorMenuItem"
+ && aEntries[nIdx].sClassId != u"GtkSeparator")
+ {
+ static_cast<SvxNotebookbarEntriesListBox*>(m_xContentsListBox.get())
+ ->GetTooltipMap()[aEntries[nIdx].sDisplayName]
+ = aEntries[nIdx].sActionName;
+ }
});
aEntries.clear();
@@ -470,6 +472,9 @@ SvxNotebookbarEntriesListBox::SvxNotebookbarEntriesListBox(std::unique_ptr<weld:
m_xControl->connect_toggled(LINK(this, SvxNotebookbarEntriesListBox, CheckButtonHdl));
m_xControl->connect_key_press(Link<const KeyEvent&, bool>());
m_xControl->connect_key_press(LINK(this, SvxNotebookbarEntriesListBox, KeyInputHdl));
+ // remove the inherited connect_query_tooltip then add the new one
+ m_xControl->connect_query_tooltip(Link<const weld::TreeIter&, OUString>());
+ m_xControl->connect_query_tooltip(LINK(this, SvxNotebookbarEntriesListBox, QueryTooltip));
}
SvxNotebookbarEntriesListBox::~SvxNotebookbarEntriesListBox() {}
@@ -481,22 +486,23 @@ static void EditRegistryFile(std::u16string_view sUIItemId, const OUString& sSet
Sequence<OUString> aOldEntries
= CustomNotebookbarGenerator::getCustomizedUIItem(sNotebookbarInterface);
Sequence<OUString> aNewEntries(aOldEntries.getLength() + 1);
+ auto pNewEntries = aNewEntries.getArray();
for (int nIdx = 0; nIdx < aOldEntries.getLength(); nIdx++)
{
sal_Int32 rPos = 0;
- OUString sFirstValue = aOldEntries[nIdx].getToken(rPos, ',', rPos);
+ std::u16string_view sFirstValue = o3tl::getToken(aOldEntries[nIdx], rPos, ',', rPos);
if (sFirstValue == sUIItemId)
{
- aOldEntries[nIdx] = sSetEntry;
+ aOldEntries.getArray()[nIdx] = sSetEntry;
nFlag = 1;
break;
}
- aNewEntries[nIdx] = aOldEntries[nIdx];
+ pNewEntries[nIdx] = aOldEntries[nIdx];
}
if (nFlag == 0)
{
- aNewEntries[aOldEntries.getLength()] = sSetEntry;
+ pNewEntries[aOldEntries.getLength()] = sSetEntry;
CustomNotebookbarGenerator::setCustomizedUIItem(aNewEntries, sNotebookbarInterface);
}
else
@@ -516,8 +522,7 @@ void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow)
else
sVisible = "False";
OUString sSetEntries = sUIItemId + ",visible," + sVisible;
- Sequence<OUString> sSeqOfEntries(1);
- sSeqOfEntries[0] = sSetEntries;
+ Sequence<OUString> sSeqOfEntries{ sSetEntries };
EditRegistryFile(sUIItemId, sSetEntries, sNotebookbarInterface);
CustomNotebookbarGenerator::modifyCustomizedUIFile(sSeqOfEntries);
OUString sUIPath = "modules/s" + m_pPage->GetAppName().toAsciiLowerCase() + "/ui/";
@@ -543,4 +548,19 @@ IMPL_LINK(SvxNotebookbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent,
return SvxMenuEntriesListBox::KeyInputHdl(rKeyEvent);
}
+IMPL_LINK(SvxNotebookbarEntriesListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
+{
+ const OUString& rsCommand = m_aTooltipMap[m_xControl->get_id(rIter)];
+ if (rsCommand.isEmpty())
+ return OUString();
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(m_pPage->GetFrame()));
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rsCommand, aModuleName);
+ OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(rsCommand, aProperties,
+ m_pPage->GetFrame());
+ return CuiResId(RID_CUISTR_COMMANDLABEL) + ": "
+ + m_xControl->get_text(rIter).replaceFirst("~", "") + "\n"
+ + CuiResId(RID_CUISTR_COMMANDNAME) + ": " + rsCommand + "\n"
+ + CuiResId(RID_CUISTR_COMMANDTIP) + ": " + sTooltipLabel.replaceFirst("~", "");
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 57f78dcd6161..1997de819d29 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -27,7 +27,7 @@
#include <sfx2/sfxsids.hrc>
#include <svl/stritem.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <algorithm>
#include <helpids.h>
@@ -38,9 +38,8 @@
#include <SvxConfigPageHelper.hxx>
#include <dialmgr.hxx>
-#include <comphelper/processfactory.hxx>
-
#include <dlgname.hxx>
+#include <comphelper/processfactory.hxx>
SvxToolbarConfigPage::SvxToolbarConfigPage(weld::Container* pPage,
weld::DialogController* pController,
@@ -106,7 +105,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(weld::Container* pPage,
m_aURLToSelect = ITEM_TOOLBAR_URL;
m_aURLToSelect += "standardbar";
- const SfxPoolItem* pItem = rSet.GetItem(rSet.GetPool()->GetWhich(SID_CONFIG));
+ const SfxPoolItem* pItem = rSet.GetItem(SID_CONFIG);
if (pItem)
{
@@ -125,8 +124,7 @@ void SvxToolbarConfigPage::ListModified()
pEntries->clear();
for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
- pEntries->push_back(
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
+ pEntries->push_back(weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(i)));
GetSaveInData()->SetModified();
GetTopLevelSelection()->SetModified();
@@ -140,8 +138,7 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
{
for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
{
- ToolbarSaveInData* pData
- = reinterpret_cast<ToolbarSaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
+ ToolbarSaveInData* pData = weld::fromId<ToolbarSaveInData*>(m_xSaveInListBox->get_id(i));
delete pData;
}
m_xSaveInListBox->clear();
@@ -186,8 +183,7 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
return;
// get currently selected entry
- SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ SvxConfigEntry* pEntry = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
SvxConfigEntry* pToolbar = GetTopLevelSelection();
@@ -246,13 +242,14 @@ void SvxToolbarConfigPage::Init()
ReloadTopLevelListBox();
- sal_Int32 nPos = 0;
+ sal_Int32 nCount = m_xTopLevelListBox->get_count();
+ sal_Int32 nPos = nCount > 0 ? 0 : -1;
+
if (!m_aURLToSelect.isEmpty())
{
- for (sal_Int32 i = 0, nCount = m_xTopLevelListBox->get_count(); i < nCount; ++i)
+ for (sal_Int32 i = 0; i < nCount; ++i)
{
- SvxConfigEntry* pData
- = reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(i).toInt64());
+ SvxConfigEntry* pData = weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_id(i));
if (pData->GetCommand().equals(m_aURLToSelect))
{
@@ -289,13 +286,13 @@ IMPL_LINK_NOARG(SvxToolbarConfigPage, SelectToolbarEntry, weld::TreeView&, void)
UpdateButtonStates();
}
-IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OUString&, rIdent, void)
{
SvxConfigEntry* pCurrentToolbar = GetTopLevelSelection();
if (rIdent == "toolbar_gear_add")
{
- OUString prefix = CuiResId(RID_SVXSTR_NEW_TOOLBAR);
+ OUString prefix = CuiResId(RID_CUISTR_NEW_TOOLBAR);
OUString aNewName
= SvxConfigPageHelper::generateCustomName(prefix, GetSaveInData()->GetEntries());
@@ -317,8 +314,8 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void)
// Where to save the new toolbar? (i.e. Modulewise or documentwise)
int nInsertPos = aNameDialog.m_xSaveInListBox->get_active();
- ToolbarSaveInData* pData = reinterpret_cast<ToolbarSaveInData*>(
- m_xSaveInListBox->get_id(nInsertPos).toInt64());
+ ToolbarSaveInData* pData
+ = weld::fromId<ToolbarSaveInData*>(m_xSaveInListBox->get_id(nInsertPos));
if (GetSaveInData() != pData)
{
@@ -333,7 +330,7 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void)
pData->CreateToolbar(pToolbar);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pToolbar)));
+ OUString sId(weld::toId(pToolbar));
m_xTopLevelListBox->append(sId, pToolbar->GetName());
m_xTopLevelListBox->set_active_id(sId);
SelectElement();
@@ -352,17 +349,17 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void)
else if (rIdent == "toolbar_gear_rename")
{
sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
- SvxConfigEntry* pToolbar = reinterpret_cast<SvxConfigEntry*>(
- m_xTopLevelListBox->get_id(nSelectionPos).toInt64());
+ SvxConfigEntry* pToolbar
+ = weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos));
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
//Rename the toolbar
OUString sCurrentName(SvxConfigPageHelper::stripHotKey(pToolbar->GetName()));
- OUString sDesc = CuiResId(RID_SVXSTR_LABEL_NEW_NAME);
+ OUString sDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
SvxNameDialog aNameDialog(GetFrameWeld(), sCurrentName, sDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_TOOLBAR);
- aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_TOOLBAR));
+ aNameDialog.set_title(CuiResId(RID_CUISTR_RENAME_TOOLBAR));
if (aNameDialog.run() == RET_OK)
{
@@ -376,7 +373,7 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void)
// have to use remove and insert to change the name
m_xTopLevelListBox->remove(nSelectionPos);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pToolbar)));
+ OUString sId(weld::toId(pToolbar));
m_xTopLevelListBox->insert(nSelectionPos, sNewName, &sId, nullptr, nullptr);
m_xTopLevelListBox->set_active_id(sId);
}
@@ -429,7 +426,7 @@ IMPL_LINK_NOARG(SvxToolbarConfigPage, RemoveCommandHdl, weld::Button&, void)
DeleteSelectedContent();
}
-IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OUString&, rIdent, void)
{
if (rIdent == "insertseparator")
{
@@ -454,7 +451,7 @@ IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OString&, rIdent, void)
}
}
-IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OUString&, rIdent, void)
{
bool bNeedsApply = false;
@@ -471,14 +468,14 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
{
int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
- OUString aDesc = CuiResId(RID_SVXSTR_LABEL_NEW_NAME);
+ OUString aDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc);
aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM);
- aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_TOOLBAR));
+ aNameDialog.set_title(CuiResId(RID_CUISTR_RENAME_TOOLBAR));
if (aNameDialog.run() == RET_OK)
{
@@ -497,7 +494,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
{
int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
SvxIconSelectorDialog aIconDialog(GetFrameWeld(), GetSaveInData()->GetImageManager(),
GetSaveInData()->GetParentImageManager());
@@ -508,8 +505,6 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
if (newgraphic.is())
{
- css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq(1);
-
css::uno::Sequence<OUString> aURLSeq{ pEntry->GetCommand() };
if (!pEntry->GetBackupGraphic().is())
@@ -524,7 +519,9 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
}
}
- aGraphicSeq[0] = newgraphic;
+ css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq{
+ newgraphic
+ };
try
{
GetSaveInData()->GetImageManager()->replaceImages(
@@ -532,7 +529,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
m_xContentsListBox->remove(nActEntry);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
m_xContentsListBox->insert(nActEntry, sId);
m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible() ? TRISTATE_TRUE
: TRISTATE_FALSE);
@@ -554,12 +551,11 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
{
int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
-
- css::uno::Reference<css::graphic::XGraphic> backup = pEntry->GetBackupGraphic();
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
- css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq(1);
- aGraphicSeq[0] = backup;
+ css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq{
+ pEntry->GetBackupGraphic()
+ };
css::uno::Sequence<OUString> aURLSeq{ pEntry->GetCommand() };
@@ -570,7 +566,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
m_xContentsListBox->remove(nActEntry);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
m_xContentsListBox->insert(nActEntry, sId);
m_xContentsListBox->set_toggle(nActEntry,
pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
@@ -593,7 +589,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
{
int nActEntry = m_xContentsListBox->get_selected_index();
SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
@@ -621,7 +617,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
m_xContentsListBox->remove(nActEntry);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
m_xContentsListBox->insert(nActEntry, sId);
m_xContentsListBox->set_toggle(nActEntry,
pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
@@ -656,11 +652,11 @@ IMPL_LINK_NOARG(SvxToolbarConfigPage, ResetToolbarHdl, weld::Button&, void)
sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
SvxConfigEntry* pToolbar
- = reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos).toInt64());
+ = weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos));
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT)));
+ CuiResId(RID_CUISTR_CONFIRM_RESTORE_DEFAULT)));
if (xQueryBox->run() == RET_YES)
{
ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
@@ -678,8 +674,7 @@ void SvxToolbarConfigPage::UpdateButtonStates()
bool bIsSeparator
= selection != -1
- && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())
- ->IsSeparator();
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(selection))->IsSeparator();
bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && selection != -1);
m_xMoveUpButton->set_sensitive(bIsValidSelection);
@@ -697,7 +692,7 @@ void SvxToolbarConfigPage::UpdateButtonStates()
short SvxToolbarConfigPage::QueryReset()
{
- OUString msg = CuiResId(RID_SVXSTR_CONFIRM_TOOLBAR_RESET);
+ OUString msg = CuiResId(RID_CUISTR_CONFIRM_TOOLBAR_RESET);
OUString saveInName = m_xSaveInListBox->get_active_text();
@@ -752,7 +747,7 @@ void SvxToolbarConfigPage::SelectElement()
SvxEntries* pEntries = pToolbar->GetEntries();
for (auto const& entry : *pEntries)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
+ OUString sId(weld::toId(entry));
m_xContentsListBox->insert(i, sId);
if (entry->IsBinding() && !entry->IsSeparator())
m_xContentsListBox->set_toggle(i, entry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
@@ -776,8 +771,7 @@ void SvxToolbarConfigPage::AddFunction(int nTarget)
if (nNewLBEntry == -1)
return;
- SvxConfigEntry* pEntry
- = reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nNewLBEntry).toInt64());
+ SvxConfigEntry* pEntry = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nNewLBEntry));
if (pEntry->IsBinding()) //TODO sep ?
{
@@ -812,8 +806,7 @@ SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox() {}
void SvxToolbarEntriesListBox::ChangedVisibility(int nRow)
{
- SvxConfigEntry* pEntryData
- = reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64());
+ SvxConfigEntry* pEntryData = weld::fromId<SvxConfigEntry*>(m_xControl->get_id(nRow));
if (pEntryData->IsBinding())
{
@@ -839,8 +832,7 @@ IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, boo
if (rKeyEvent.GetKeyCode() == KEY_SPACE)
{
int nRow = m_xControl->get_selected_index();
- SvxConfigEntry* pEntryData
- = reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64());
+ SvxConfigEntry* pEntryData = weld::fromId<SvxConfigEntry*>(m_xControl->get_id(nRow));
if (pEntryData->IsBinding() && !pEntryData->IsSeparator())
{
m_xControl->set_toggle(nRow, m_xControl->get_toggle(nRow) == TRISTATE_TRUE
@@ -871,8 +863,7 @@ IMPL_LINK(SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEv
bool bIsSeparator
= nSelectIndex != -1
- && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())
- ->IsSeparator();
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && nSelectIndex != -1);
std::unique_ptr<weld::Builder> xBuilder(
@@ -884,7 +875,7 @@ IMPL_LINK(SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEv
xContextMenu->set_visible("changeIcon", bIsValidSelection && !bIsSeparator);
xContextMenu->set_visible("resetIcon", bIsValidSelection && !bIsSeparator);
xContextMenu->set_visible("restoreDefault", bIsValidSelection && !bIsSeparator);
- OString sCommand(xContextMenu->popup_at_rect(
+ OUString sCommand(xContextMenu->popup_at_rect(
&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
if (sCommand == "remove")
@@ -924,7 +915,7 @@ IMPL_LINK(SvxToolbarConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCE
xContextMenu->set_visible("changeIcon", false);
xContextMenu->set_visible("resetIcon", false);
xContextMenu->set_visible("restoreDefault", false);
- OString sCommand(xContextMenu->popup_at_rect(
+ OUString sCommand(xContextMenu->popup_at_rect(
&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
if (sCommand == "add")
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index a8e780a6b008..027ac72968e8 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -61,13 +61,17 @@
#include <svtools/acceleratorexecute.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <config_features.h>
+
+#include <com/sun/star/frame/LayoutManager.hpp>
+
// namespaces
using namespace css;
-constexpr OUStringLiteral FOLDERNAME_UICONFIG = u"Configurations2";
+constexpr OUString FOLDERNAME_UICONFIG = u"Configurations2"_ustr;
-constexpr OUStringLiteral MEDIATYPE_PROPNAME = u"MediaType";
+constexpr OUString MEDIATYPE_PROPNAME = u"MediaType"_ustr;
const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_F2,
@@ -182,10 +186,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_MOD1 | KEY_X,
KEY_MOD1 | KEY_Y,
KEY_MOD1 | KEY_Z,
+ KEY_MOD1 | KEY_NUMBERSIGN,
+ KEY_MOD1 | KEY_COLON,
KEY_MOD1 | KEY_SEMICOLON,
+ KEY_MOD1 | KEY_QUOTELEFT,
KEY_MOD1 | KEY_QUOTERIGHT,
KEY_MOD1 | KEY_BRACKETLEFT,
KEY_MOD1 | KEY_BRACKETRIGHT,
+ KEY_MOD1 | KEY_RIGHTCURLYBRACKET,
KEY_MOD1 | KEY_POINT,
KEY_MOD1 | KEY_COMMA,
KEY_MOD1 | KEY_TILDE,
@@ -264,10 +272,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_SHIFT | KEY_MOD1 | KEY_X,
KEY_SHIFT | KEY_MOD1 | KEY_Y,
KEY_SHIFT | KEY_MOD1 | KEY_Z,
+ KEY_SHIFT | KEY_MOD1 | KEY_NUMBERSIGN,
+ KEY_SHIFT | KEY_MOD1 | KEY_COLON,
KEY_SHIFT | KEY_MOD1 | KEY_SEMICOLON,
+ KEY_SHIFT | KEY_MOD1 | KEY_QUOTELEFT,
KEY_SHIFT | KEY_MOD1 | KEY_QUOTERIGHT,
KEY_SHIFT | KEY_MOD1 | KEY_BRACKETLEFT,
KEY_SHIFT | KEY_MOD1 | KEY_BRACKETRIGHT,
+ KEY_SHIFT | KEY_MOD1 | KEY_RIGHTCURLYBRACKET,
KEY_SHIFT | KEY_MOD1 | KEY_POINT,
KEY_SHIFT | KEY_MOD1 | KEY_COMMA,
KEY_SHIFT | KEY_MOD1 | KEY_TILDE,
@@ -342,10 +354,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_MOD2 | KEY_X,
KEY_MOD2 | KEY_Y,
KEY_MOD2 | KEY_Z,
+ KEY_MOD2 | KEY_NUMBERSIGN,
+ KEY_MOD2 | KEY_COLON,
KEY_MOD2 | KEY_SEMICOLON,
+ KEY_MOD2 | KEY_QUOTELEFT,
KEY_MOD2 | KEY_QUOTERIGHT,
KEY_MOD2 | KEY_BRACKETLEFT,
KEY_MOD2 | KEY_BRACKETRIGHT,
+ KEY_MOD2 | KEY_RIGHTCURLYBRACKET,
KEY_MOD2 | KEY_POINT,
KEY_MOD2 | KEY_COMMA,
KEY_MOD2 | KEY_TILDE,
@@ -418,10 +434,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_SHIFT | KEY_MOD2 | KEY_X,
KEY_SHIFT | KEY_MOD2 | KEY_Y,
KEY_SHIFT | KEY_MOD2 | KEY_Z,
+ KEY_SHIFT | KEY_MOD2 | KEY_NUMBERSIGN,
+ KEY_SHIFT | KEY_MOD2 | KEY_COLON,
KEY_SHIFT | KEY_MOD2 | KEY_SEMICOLON,
+ KEY_SHIFT | KEY_MOD2 | KEY_QUOTELEFT,
KEY_SHIFT | KEY_MOD2 | KEY_QUOTERIGHT,
KEY_SHIFT | KEY_MOD2 | KEY_BRACKETLEFT,
KEY_SHIFT | KEY_MOD2 | KEY_BRACKETRIGHT,
+ KEY_SHIFT | KEY_MOD2 | KEY_RIGHTCURLYBRACKET,
KEY_SHIFT | KEY_MOD2 | KEY_POINT,
KEY_SHIFT | KEY_MOD2 | KEY_COMMA,
KEY_SHIFT | KEY_MOD2 | KEY_TILDE,
@@ -495,13 +515,18 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_MOD1 | KEY_MOD2 | KEY_X,
KEY_MOD1 | KEY_MOD2 | KEY_Y,
KEY_MOD1 | KEY_MOD2 | KEY_Z,
+ KEY_MOD1 | KEY_MOD2 | KEY_NUMBERSIGN,
+ KEY_MOD1 | KEY_MOD2 | KEY_COLON,
KEY_MOD1 | KEY_MOD2 | KEY_SEMICOLON,
+ KEY_MOD1 | KEY_MOD2 | KEY_QUOTELEFT,
KEY_MOD1 | KEY_MOD2 | KEY_QUOTERIGHT,
KEY_MOD1 | KEY_MOD2 | KEY_BRACKETLEFT,
KEY_MOD1 | KEY_MOD2 | KEY_BRACKETRIGHT,
+ KEY_MOD1 | KEY_MOD2 | KEY_RIGHTCURLYBRACKET,
KEY_MOD1 | KEY_MOD2 | KEY_POINT,
KEY_MOD1 | KEY_MOD2 | KEY_COMMA,
KEY_MOD1 | KEY_MOD2 | KEY_TILDE,
+ KEY_MOD1 | KEY_MOD2 | KEY_EQUAL,
KEY_MOD1 | KEY_MOD2 | KEY_F1,
KEY_MOD1 | KEY_MOD2 | KEY_F2,
@@ -570,10 +595,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_X,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_Y,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_Z,
+ KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_NUMBERSIGN,
+ KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_COLON,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_SEMICOLON,
+ KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_QUOTELEFT,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_QUOTERIGHT,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_BRACKETLEFT,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_BRACKETRIGHT,
+ KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_RIGHTCURLYBRACKET,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_POINT,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_COMMA,
KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_TILDE,
@@ -648,10 +677,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_MOD3 | KEY_X,
KEY_MOD3 | KEY_Y,
KEY_MOD3 | KEY_Z,
+ KEY_MOD2 | KEY_NUMBERSIGN,
+ KEY_MOD3 | KEY_COLON,
KEY_MOD3 | KEY_SEMICOLON,
+ KEY_MOD3 | KEY_QUOTELEFT,
KEY_MOD3 | KEY_QUOTERIGHT,
KEY_MOD3 | KEY_BRACKETLEFT,
KEY_MOD3 | KEY_BRACKETRIGHT,
+ KEY_MOD3 | KEY_RIGHTCURLYBRACKET,
KEY_MOD3 | KEY_POINT,
KEY_MOD3 | KEY_COMMA,
KEY_MOD3 | KEY_TILDE,
@@ -730,10 +763,14 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
KEY_SHIFT | KEY_MOD3 | KEY_X,
KEY_SHIFT | KEY_MOD3 | KEY_Y,
KEY_SHIFT | KEY_MOD3 | KEY_Z,
+ KEY_SHIFT | KEY_MOD3 | KEY_NUMBERSIGN,
+ KEY_SHIFT | KEY_MOD3 | KEY_COLON,
KEY_SHIFT | KEY_MOD3 | KEY_SEMICOLON,
+ KEY_SHIFT | KEY_MOD3 | KEY_QUOTELEFT,
KEY_SHIFT | KEY_MOD3 | KEY_QUOTERIGHT,
KEY_SHIFT | KEY_MOD3 | KEY_BRACKETLEFT,
KEY_SHIFT | KEY_MOD3 | KEY_BRACKETRIGHT,
+ KEY_SHIFT | KEY_MOD3 | KEY_RIGHTCURLYBRACKET,
KEY_SHIFT | KEY_MOD3 | KEY_POINT,
KEY_SHIFT | KEY_MOD3 | KEY_COMMA,
KEY_SHIFT | KEY_MOD3 | KEY_TILDE,
@@ -774,7 +811,7 @@ const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1,
#endif
};
-const sal_uInt16 KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY);
+const sal_uInt16 KEYCODE_ARRAY_SIZE = std::size(KEYCODE_ARRAY);
/** select the entry, which match the current key input ... excepting
keys, which are used for the dialog itself.
@@ -786,23 +823,24 @@ IMPL_LINK(SfxAcceleratorConfigPage, KeyInputHdl, const KeyEvent&, rKey, bool)
sal_uInt16 nMod1 = aCode1.GetModifier();
// is it related to our list box ?
- if ((nCode1 != KEY_DOWN) && (nCode1 != KEY_UP) && (nCode1 != KEY_LEFT) && (nCode1 != KEY_RIGHT)
- && (nCode1 != KEY_PAGEUP) && (nCode1 != KEY_PAGEDOWN))
+ if ((nCode1 == KEY_DOWN) || (nCode1 == KEY_UP) || (nCode1 == KEY_LEFT) || (nCode1 == KEY_RIGHT)
+ || (nCode1 == KEY_PAGEUP) || (nCode1 == KEY_PAGEDOWN))
+ // no - handle it as normal dialog input
+ return false;
+
+ for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
{
- for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
+ TAccInfo* pUserData = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
+ if (pUserData)
{
- TAccInfo* pUserData = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
- if (pUserData)
- {
- sal_uInt16 nCode2 = pUserData->m_aKey.GetCode();
- sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier();
+ sal_uInt16 nCode2 = pUserData->m_aKey.GetCode();
+ sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier();
- if (nCode1 == nCode2 && nMod1 == nMod2)
- {
- m_xEntriesBox->select(i);
- m_xEntriesBox->scroll_to_row(i);
- return true;
- }
+ if (nCode1 == nCode2 && nMod1 == nMod2)
+ {
+ m_xEntriesBox->select(i);
+ m_xEntriesBox->scroll_to_row(i);
+ return true;
}
}
}
@@ -815,16 +853,16 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(weld::Container* pPage,
weld::DialogController* pController,
const SfxItemSet& aSet)
: SfxTabPage(pPage, pController, "cui/ui/accelconfigpage.ui", "AccelConfigPage", &aSet)
+#if HAVE_FEATURE_SCRIPTING
, m_pMacroInfoItem()
- , aLoadAccelConfigStr(CuiResId(RID_SVXSTR_LOADACCELCONFIG))
- , aSaveAccelConfigStr(CuiResId(RID_SVXSTR_SAVEACCELCONFIG))
+#endif
+ , aLoadAccelConfigStr(CuiResId(RID_CUISTR_LOADACCELCONFIG))
+ , aSaveAccelConfigStr(CuiResId(RID_CUISTR_SAVEACCELCONFIG))
, aFilterAllStr(SfxResId(STR_SFX_FILTERNAME_ALL))
- , aFilterCfgStr(CuiResId(RID_SVXSTR_FILTERNAME_CFG))
+ , aFilterCfgStr(CuiResId(RID_CUISTR_FILTERNAME_CFG))
, m_bStylesInfoInitialized(false)
- , m_xGlobal()
- , m_xModule()
- , m_xAct()
- , m_aUpdateDataTimer("UpdateDataTimer")
+ , m_aUpdateDataTimer("SfxAcceleratorConfigPage UpdateDataTimer")
+ , m_aFillGroupIdle("SfxAcceleratorConfigPage m_aFillGroupIdle")
, m_xEntriesBox(m_xBuilder->weld_tree_view("shortcuts"))
, m_xOfficeButton(m_xBuilder->weld_radio_button("office"))
, m_xModuleButton(m_xBuilder->weld_radio_button("module"))
@@ -839,16 +877,16 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(weld::Container* pPage,
, m_xResetButton(m_xBuilder->weld_button("reset"))
{
Size aSize(m_xEntriesBox->get_approximate_digit_width() * 40,
- m_xEntriesBox->get_height_rows(12));
+ m_xEntriesBox->get_height_rows(10));
m_xEntriesBox->set_size_request(aSize.Width(), aSize.Height());
aSize = Size(m_xEntriesBox->get_approximate_digit_width() * 19,
- m_xEntriesBox->get_height_rows(10));
+ m_xEntriesBox->get_height_rows(9));
m_xGroupLBox->set_size_request(aSize.Width(), aSize.Height());
aSize = Size(m_xEntriesBox->get_approximate_digit_width() * 21,
- m_xEntriesBox->get_height_rows(10));
+ m_xEntriesBox->get_height_rows(9));
m_xFunctionBox->set_size_request(aSize.Width(), aSize.Height());
aSize = Size(m_xEntriesBox->get_approximate_digit_width() * 20,
- m_xEntriesBox->get_height_rows(10));
+ m_xEntriesBox->get_height_rows(9));
m_xKeyBox->set_size_request(aSize.Width(), aSize.Height());
// install handler functions
@@ -862,8 +900,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(weld::Container* pPage,
m_xLoadButton->connect_clicked(LINK(this, SfxAcceleratorConfigPage, Load));
m_xSaveButton->connect_clicked(LINK(this, SfxAcceleratorConfigPage, Save));
m_xResetButton->connect_clicked(LINK(this, SfxAcceleratorConfigPage, Default));
- m_xOfficeButton->connect_clicked(LINK(this, SfxAcceleratorConfigPage, RadioHdl));
- m_xModuleButton->connect_clicked(LINK(this, SfxAcceleratorConfigPage, RadioHdl));
+ m_xOfficeButton->connect_toggled(LINK(this, SfxAcceleratorConfigPage, RadioHdl));
m_xSearchEdit->connect_changed(LINK(this, SfxAcceleratorConfigPage, SearchUpdateHdl));
m_xSearchEdit->connect_focus_out(LINK(this, SfxAcceleratorConfigPage, FocusOut_Impl));
@@ -879,8 +916,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(weld::Container* pPage,
auto nNewTab = nMaxWidth + 5; // additional space
// initialize Entriesbox
- std::vector<int> aWidths;
- aWidths.push_back(nNewTab);
+ std::vector<int> aWidths{ nNewTab };
m_xEntriesBox->set_column_fixed_widths(aWidths);
//Initialize search util
@@ -895,12 +931,10 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(weld::Container* pPage,
m_xKeyBox->make_sorted();
m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SfxAcceleratorConfigPage, ImplUpdateDataHdl));
- m_aUpdateDataTimer.SetDebugName("SfxAcceleratorConfigPage UpdateDataTimer");
m_aUpdateDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
m_aFillGroupIdle.SetInvokeHandler(LINK(this, SfxAcceleratorConfigPage, TimeOut_Impl));
m_aFillGroupIdle.SetPriority(TaskPriority::HIGHEST);
- m_aFillGroupIdle.SetDebugName("SfxAcceleratorConfigPage m_aFillGroupIdle");
}
SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
@@ -910,7 +944,7 @@ SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
// free memory - remove all dynamic user data
for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
{
- TAccInfo* pUserData = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+ TAccInfo* pUserData = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
delete pUserData;
}
}
@@ -995,7 +1029,7 @@ void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfigu
if (sKey.isEmpty())
continue;
TAccInfo* pEntry = new TAccInfo(i1, 0 /*nListPos*/, aKey);
- m_xEntriesBox->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), sKey);
+ m_xEntriesBox->append(weld::toId(pEntry), sKey);
int nPos = m_xEntriesBox->n_children() - 1;
m_xEntriesBox->set_text(nPos, OUString(), 1);
m_xEntriesBox->set_sensitive(nPos, true);
@@ -1019,7 +1053,7 @@ void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfigu
m_xEntriesBox->set_text(nPos, sLabel, 1);
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
pEntry->m_bIsConfigurable = true;
pEntry->m_sCommand = sCommand;
@@ -1037,7 +1071,7 @@ void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfigu
continue;
// Hardcoded function mapped so no ID possible and mark entry as not changeable
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
pEntry->m_bIsConfigurable = false;
m_xEntriesBox->set_sensitive(nPos, false);
@@ -1054,7 +1088,7 @@ void SfxAcceleratorConfigPage::Apply(const uno::Reference<ui::XAcceleratorConfig
// physical ones!
for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
{
- TAccInfo* pUserData = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+ TAccInfo* pUserData = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
OUString sCommand;
awt::KeyEvent aAWTKey;
@@ -1133,7 +1167,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, ChangeHdl, weld::Button&, void)
if (nPos == -1)
return;
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
OUString sNewCommand = m_xFunctionBox->GetCurCommand();
OUString sLabel = m_xFunctionBox->GetCurLabel();
if (sLabel.isEmpty())
@@ -1152,7 +1186,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RemoveHdl, weld::Button&, void)
if (nPos == -1)
return;
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
// remove function name from selected entry
m_xEntriesBox->set_text(nPos, OUString(), 1);
@@ -1165,7 +1199,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
{
if (&rListBox == m_xEntriesBox.get())
{
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_selected_id().toInt64());
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_selected_id());
OUString sPossibleNewCommand = m_xFunctionBox->GetCurCommand();
@@ -1207,7 +1241,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
m_xChangeButton->set_sensitive(false);
// #i36994 First selected can return null!
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_selected_id().toInt64());
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_selected_id());
if (pEntry)
{
OUString sPossibleNewCommand = m_xFunctionBox->GetCurCommand();
@@ -1226,12 +1260,10 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
{
for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
{
- TAccInfo* pUserData
- = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+ TAccInfo* pUserData = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
if (pUserData && pUserData->m_sCommand == sPossibleNewCommand)
{
- m_xKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pUserData)),
- pUserData->m_aKey.GetName());
+ m_xKeyBox->append(weld::toId(pUserData), pUserData->m_aKey.GetName());
}
}
}
@@ -1241,7 +1273,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
{
// goto selected "key" entry of the key box
int nP2 = -1;
- TAccInfo* pU2 = reinterpret_cast<TAccInfo*>(m_xKeyBox->get_selected_id().toInt64());
+ TAccInfo* pU2 = weld::fromId<TAccInfo*>(m_xKeyBox->get_selected_id());
if (pU2)
nP2 = MapKeyCodeToPos(pU2->m_aKey);
if (nP2 != -1)
@@ -1253,7 +1285,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
}
}
-IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RadioHdl, weld::Button&, void)
+IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RadioHdl, weld::Toggleable&, void)
{
uno::Reference<ui::XAcceleratorConfiguration> xOld = m_xAct;
@@ -1312,9 +1344,8 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, void
// don't forget to release the storage afterwards!
uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
embed::StorageFactory::create(m_xContext));
- uno::Sequence<uno::Any> lArgs(2);
- lArgs[0] <<= sCfgName;
- lArgs[1] <<= css::embed::ElementModes::READ;
+ uno::Sequence<uno::Any> lArgs{ uno::Any(sCfgName),
+ uno::Any(css::embed::ElementModes::READ) };
xRootStorage.set(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY_THROW);
uno::Reference<embed::XStorage> xUIConfig
@@ -1383,9 +1414,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, void
{
uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
embed::StorageFactory::create(m_xContext));
- uno::Sequence<uno::Any> lArgs(2);
- lArgs[0] <<= sCfgName;
- lArgs[1] <<= embed::ElementModes::WRITE;
+ uno::Sequence<uno::Any> lArgs{ uno::Any(sCfgName), uno::Any(embed::ElementModes::WRITE) };
xRootStorage.set(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY_THROW);
@@ -1455,6 +1484,7 @@ void SfxAcceleratorConfigPage::StartFileDialog(StartFileDialogType nType, const
m_pFileDlg->AddFilter(aFilterAllStr, FILEDIALOG_FILTER_ALL);
m_pFileDlg->AddFilter(aFilterCfgStr, "*.cfg");
m_pFileDlg->SetCurrentFilter(aFilterCfgStr);
+ m_pFileDlg->SetContext(sfx2::FileDialogHelper::AcceleratorConfig);
Link<sfx2::FileDialogHelper*, void> aDlgClosedLink
= bSave ? LINK(this, SfxAcceleratorConfigPage, SaveHdl)
@@ -1468,6 +1498,13 @@ bool SfxAcceleratorConfigPage::FillItemSet(SfxItemSet*)
try
{
m_xAct->store();
+ css::uno::Reference<css::beans::XPropertySet> xFrameProps(m_xFrame,
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::frame::XLayoutManager> xLayoutManager;
+ xFrameProps->getPropertyValue("LayoutManager") >>= xLayoutManager;
+ css::uno::Reference<css::beans::XPropertySet> xLayoutProps(xLayoutManager,
+ css::uno::UNO_QUERY_THROW);
+ xLayoutProps->setPropertyValue("RefreshContextToolbarToolTip", css::uno::Any(true));
}
catch (const uno::RuntimeException&)
{
@@ -1505,12 +1542,15 @@ void SfxAcceleratorConfigPage::Reset(const SfxItemSet* rSet)
RadioHdl(*m_xOfficeButton);
- const SfxPoolItem* pMacroItem = nullptr;
- if (SfxItemState::SET == rSet->GetItemState(SID_MACROINFO, true, &pMacroItem))
+#if HAVE_FEATURE_SCRIPTING
+ if (const SfxMacroInfoItem* pMacroItem = rSet->GetItemIfSet(SID_MACROINFO))
{
- m_pMacroInfoItem = &dynamic_cast<const SfxMacroInfoItem&>(*pMacroItem);
+ m_pMacroInfoItem = pMacroItem;
m_xGroupLBox->SelectMacro(m_pMacroInfoItem);
}
+#else
+ (void)rSet;
+#endif
}
sal_Int32 SfxAcceleratorConfigPage::MapKeyCodeToPos(const vcl::KeyCode& aKey) const
@@ -1518,7 +1558,7 @@ sal_Int32 SfxAcceleratorConfigPage::MapKeyCodeToPos(const vcl::KeyCode& aKey) co
sal_uInt16 nCode1 = aKey.GetCode() + aKey.GetModifier();
for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
{
- TAccInfo* pUserData = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+ TAccInfo* pUserData = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
if (pUserData)
{
sal_uInt16 nCode2 = pUserData->m_aKey.GetCode() + pUserData->m_aKey.GetModifier();
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 6f70d87124e2..ff5702121755 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -24,16 +24,19 @@
#include <stdlib.h>
#include <typeinfo>
+#include <utility>
#include <vcl/stdtext.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <vcl/event.hxx>
#include <vcl/graph.hxx>
+#include <vcl/graphicfilter.hxx>
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/weld.hxx>
#include <vcl/decoview.hxx>
#include <vcl/virdev.hxx>
+#include <sfx2/minfitem.hxx>
#include <sfx2/sfxhelp.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/filedlghelper.hxx>
@@ -41,7 +44,7 @@
#include <svl/stritem.hxx>
#include <rtl/ustrbuf.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <algorithm>
@@ -87,7 +90,9 @@
#include <com/sun/star/util/thePathSettings.hpp>
#include <comphelper/documentinfo.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/processfactory.hxx>
+#include <config_features.h>
namespace uno = com::sun::star::uno;
namespace frame = com::sun::star::frame;
@@ -212,18 +217,29 @@ SvxConfigDialog::SvxConfigDialog(weld::Window * pParent, const SfxItemSet* pInSe
AddTabPage("keyboard", CreateKeyboardConfigPage, nullptr);
AddTabPage("events", CreateSvxEventConfigPage, nullptr);
- const SfxPoolItem* pItem =
- pInSet->GetItem( pInSet->GetPool()->GetWhich( SID_CONFIG ) );
-
- if ( pItem )
+ if (const SfxPoolItem* pItem = pInSet->GetItem(SID_CONFIG))
{
OUString text = static_cast<const SfxStringItem*>(pItem)->GetValue();
-
if (text.startsWith( ITEM_TOOLBAR_URL ) )
- {
SetCurPageId("toolbars");
- }
+ else if (text.startsWith( ITEM_EVENT_URL) )
+ SetCurPageId("events");
+ }
+#if HAVE_FEATURE_SCRIPTING
+ else if (pInSet->GetItemIfSet(SID_MACROINFO))
+ {
+ // for the "assign" button in the Basic Macros chooser automatically switch
+ // to the keyboard tab in which this macro will be pre-selected for assigning
+ // to a keystroke
+ SetCurPageId("keyboard");
}
+#endif
+}
+
+void SvxConfigDialog::ActivatePage(const OUString& rPage)
+{
+ SfxTabDialogController::ActivatePage(rPage);
+ GetResetButton()->set_visible(rPage != "keyboard");
}
void SvxConfigDialog::SetFrame(const css::uno::Reference<css::frame::XFrame>& xFrame)
@@ -241,7 +257,7 @@ void SvxConfigDialog::SetFrame(const css::uno::Reference<css::frame::XFrame>& xF
RemoveTabPage("keyboard");
}
-void SvxConfigDialog::PageCreated(const OString &rId, SfxTabPage& rPage)
+void SvxConfigDialog::PageCreated(const OUString &rId, SfxTabPage& rPage)
{
if (rId == "menus" || rId == "keyboard" || rId == "notebookbar"
|| rId == "toolbars" || rId == "contextmenus")
@@ -265,21 +281,19 @@ void SvxConfigDialog::PageCreated(const OString &rId, SfxTabPage& rPage)
uno::Reference< css::ui::XImageManager>* SaveInData::xDefaultImgMgr = nullptr;
SaveInData::SaveInData(
- const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr,
- const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr,
+ uno::Reference< css::ui::XUIConfigurationManager > xParentCfgMgr,
const OUString& aModuleId,
bool isDocConfig )
:
bModified( false ),
bDocConfig( isDocConfig ),
bReadOnly( false ),
- m_xCfgMgr( xCfgMgr ),
- m_xParentCfgMgr( xParentCfgMgr )
+ m_xCfgMgr(std::move( xCfgMgr )),
+ m_xParentCfgMgr(std::move( xParentCfgMgr )),
+ m_aSeparatorSeq{ comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE,
+ css::ui::ItemType::SEPARATOR_LINE) }
{
- m_aSeparatorSeq.realloc( 1 );
- m_aSeparatorSeq[0].Name = ITEM_DESCRIPTOR_TYPE;
- m_aSeparatorSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;
-
if ( bDocConfig )
{
uno::Reference< css::ui::XUIConfigurationPersistence >
@@ -478,7 +492,7 @@ void SaveInData::LoadSubMenus( const uno::Reference< container::XIndexAccess >&
if ( a >>= aPropSeq )
{
OUString aMenuLabel;
- for ( const beans::PropertyValue& prop : std::as_const(aPropSeq) )
+ for (const beans::PropertyValue& prop : aPropSeq)
{
if ( bContextMenu )
{
@@ -602,8 +616,9 @@ void MenuSaveInData::Apply(
sal_Int32 nIndex = aPropValueSeq.getLength();
aPropValueSeq.realloc( nIndex + 1 );
- aPropValueSeq[nIndex].Name = m_aDescriptorContainer;
- aPropValueSeq[nIndex].Value <<= xSubMenuBar;
+ auto pPropValueSeq = aPropValueSeq.getArray();
+ pPropValueSeq[nIndex].Name = m_aDescriptorContainer;
+ pPropValueSeq[nIndex].Value <<= xSubMenuBar;
rMenuBar->insertByIndex(
rMenuBar->getCount(), uno::Any( aPropValueSeq ));
ApplyMenu( xSubMenuBar, rFactory, entryData );
@@ -630,8 +645,9 @@ void SaveInData::ApplyMenu(
sal_Int32 nIndex = aPropValueSeq.getLength();
aPropValueSeq.realloc( nIndex + 1 );
- aPropValueSeq[nIndex].Name = ITEM_DESCRIPTOR_CONTAINER;
- aPropValueSeq[nIndex].Value <<= xSubMenuBar;
+ auto pPropValueSeq = aPropValueSeq.getArray();
+ pPropValueSeq[nIndex].Name = ITEM_DESCRIPTOR_CONTAINER;
+ pPropValueSeq[nIndex].Value <<= xSubMenuBar;
rMenuBar->insertByIndex(
rMenuBar->getCount(), uno::Any( aPropValueSeq ));
@@ -707,7 +723,7 @@ OUString ContextMenuSaveInData::GetUIName( const OUString& rResourceURL )
catch ( const css::uno::Exception& )
{}
- for ( const auto& aProp : std::as_const(aProps) )
+ for (const auto& aProp : aProps)
{
if ( aProp.Name == ITEM_DESCRIPTOR_UINAME )
{
@@ -735,7 +751,7 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
catch ( const css::lang::IllegalArgumentException& )
{}
- for ( const auto& aElement : std::as_const(aElementsInfo) )
+ for (const auto& aElement : aElementsInfo)
{
OUString aUrl;
for ( const auto& aElementProp : aElement )
@@ -783,7 +799,7 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
catch ( const css::lang::IllegalArgumentException& )
{}
- for ( const auto& aElement : std::as_const(aParentElementsInfo) )
+ for (const auto& aElement : aParentElementsInfo)
{
OUString aUrl;
for ( const auto& aElementProp : aElement )
@@ -929,6 +945,7 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(std::unique_ptr<weld::TreeView> xCo
m_xControl->enable_toggle_buttons(weld::ColumnToggleType::Check);
CreateDropDown();
m_xControl->connect_key_press(LINK(this, SvxMenuEntriesListBox, KeyInputHdl));
+ m_xControl->connect_query_tooltip(LINK(this, SvxMenuEntriesListBox, QueryTooltip));
}
SvxMenuEntriesListBox::~SvxMenuEntriesListBox()
@@ -960,6 +977,21 @@ IMPL_LINK(SvxMenuEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
return true;
}
+IMPL_LINK(SvxMenuEntriesListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
+{
+ SvxConfigEntry *pEntry = weld::fromId<SvxConfigEntry*>(m_xControl->get_id(rIter));
+ if (!pEntry || pEntry->GetCommand().isEmpty())
+ return OUString();
+ const OUString sCommand(pEntry->GetCommand());
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(m_pPage->GetFrame()));
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand, aModuleName);
+ OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sCommand, aProperties,
+ m_pPage->GetFrame());
+ return CuiResId(RID_CUISTR_COMMANDLABEL) + ": " + pEntry->GetName().replaceFirst("~", "") + "\n" +
+ CuiResId(RID_CUISTR_COMMANDNAME) + ": " + sCommand + "\n" +
+ CuiResId(RID_CUISTR_COMMANDTIP) + ": " + sTooltipLabel.replaceFirst("~", "");
+}
+
/******************************************************************************
*
* SvxConfigPage is the abstract base class on which the Menu and Toolbar
@@ -969,7 +1001,7 @@ IMPL_LINK(SvxMenuEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
*****************************************************************************/
SvxConfigPage::SvxConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/menuassignpage.ui", "MenuAssignPage", &rSet)
- , m_aUpdateDataTimer("UpdateDataTimer")
+ , m_aUpdateDataTimer( "SvxConfigPage UpdateDataTimer" )
, bInitialised(false)
, pCurrentSaveInData(nullptr)
, m_xCommandCategoryListBox(new CommandCategoryListBox(m_xBuilder->weld_combo_box("commandcategorylist")))
@@ -985,9 +1017,11 @@ SvxConfigPage::SvxConfigPage(weld::Container* pPage, weld::DialogController* pCo
, m_xMoveUpButton(m_xBuilder->weld_button("up"))
, m_xMoveDownButton(m_xBuilder->weld_button("down"))
, m_xSaveInListBox(m_xBuilder->weld_combo_box("savein"))
+ , m_xCustomizeBox(m_xBuilder->weld_widget("customizebox"))
, m_xInsertBtn(m_xBuilder->weld_menu_button("insert"))
, m_xModifyBtn(m_xBuilder->weld_menu_button("modify"))
, m_xResetBtn(m_xBuilder->weld_button("defaultsbtn"))
+ , m_xCommandButtons(m_xBuilder->weld_widget("arrowgrid"))
, m_xAddCommandButton(m_xBuilder->weld_button("add"))
, m_xRemoveCommandButton(m_xBuilder->weld_button("remove"))
{
@@ -1001,7 +1035,6 @@ SvxConfigPage::SvxConfigPage(weld::Container* pPage, weld::DialogController* pCo
m_xDescriptionField->set_size_request(aSize.Width(), m_xDescriptionField->get_height_rows(3));
m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SvxConfigPage, ImplUpdateDataHdl));
- m_aUpdateDataTimer.SetDebugName( "SvxConfigPage UpdateDataTimer" );
m_aUpdateDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
m_xSearchEdit->connect_changed(LINK(this, SvxConfigPage, SearchUpdateHdl));
@@ -1018,6 +1051,12 @@ IMPL_LINK_NOARG(SvxConfigPage, SelectElementHdl, weld::ComboBox&, void)
SvxConfigPage::~SvxConfigPage()
{
+ int cnt = m_xSaveInListBox->get_count();
+ for(int i=0; i < cnt; ++i)
+ {
+ SaveInData *pData = weld::fromId<SaveInData*>(m_xSaveInListBox->get_id(i));
+ delete pData;
+ }
}
void SvxConfigPage::Reset( const SfxItemSet* )
@@ -1067,7 +1106,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
if ( pModuleData != nullptr )
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pModuleData)));
+ OUString sId(weld::toId(pModuleData));
m_xSaveInListBox->append(sId, utl::ConfigManager::getProductName() + " " + aModuleName);
}
@@ -1098,7 +1137,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
if ( !pDocData->IsReadOnly() )
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDocData)));
+ OUString sId(weld::toId(pDocData));
m_xSaveInListBox->append(sId, aTitle);
}
}
@@ -1164,7 +1203,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
DBG_UNHANDLED_EXCEPTION("cui.customize");
}
- for ( uno::Reference < frame::XFrame > const & xf : std::as_const(aFrameList) )
+ for (uno::Reference<frame::XFrame> const& xf : aFrameList)
{
if ( xf.is() && xf != m_xFrame )
{
@@ -1207,7 +1246,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
if ( pData && !pData->IsReadOnly() )
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ OUString sId(weld::toId(pData));
m_xSaveInListBox->append(sId, aTitle2);
}
}
@@ -1254,8 +1293,11 @@ OUString SvxConfigPage::GetFrameWithDefaultAndIdentify( uno::Reference< frame::X
_inout_rxFrame = xDesktop->getCurrentFrame();
}
- if ( !_inout_rxFrame.is() && SfxViewFrame::Current() )
- _inout_rxFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
+ if ( !_inout_rxFrame.is())
+ {
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ _inout_rxFrame = pViewFrame->GetFrame().GetFrameInterface();
+ }
if ( !_inout_rxFrame.is() )
{
@@ -1277,7 +1319,7 @@ OUString SvxConfigPage::GetScriptURL() const
{
OUString result;
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id().toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id());
if (pData)
{
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT ) ||
@@ -1305,7 +1347,7 @@ bool SvxConfigPage::FillItemSet( SfxItemSet* )
OUString sId = m_xSaveInListBox->get_id(i);
if (sId != notebookbarTabScope)
{
- SaveInData* pData = reinterpret_cast<SaveInData*>(sId.toInt64());
+ SaveInData* pData = weld::fromId<SaveInData*>(sId);
result = pData->Apply();
}
}
@@ -1316,7 +1358,7 @@ IMPL_LINK_NOARG(SvxConfigPage, SelectSaveInLocation, weld::ComboBox&, void)
{
OUString sId = m_xSaveInListBox->get_active_id();
if (sId != notebookbarTabScope)
- pCurrentSaveInData = reinterpret_cast<SaveInData*>(sId.toInt64());
+ pCurrentSaveInData = weld::fromId<SaveInData*>(sId);
Init();
}
@@ -1329,7 +1371,7 @@ void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry const * pToSelect )
{
for (auto const& entryData : *GetSaveInData()->GetEntries())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
+ OUString sId(weld::toId(entryData));
m_xTopLevelListBox->append(sId, SvxConfigPageHelper::stripHotKey(entryData->GetName()));
if (entryData == pToSelect)
@@ -1363,7 +1405,7 @@ void SvxConfigPage::AddSubMenusToUI(
{
OUString subMenuTitle = OUString::Concat(rBaseTitle) + aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey(entryData->GetName());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
+ OUString sId(weld::toId(entryData));
m_xTopLevelListBox->append(sId, subMenuTitle);
AddSubMenusToUI( subMenuTitle, entryData );
@@ -1395,18 +1437,14 @@ SvxEntries* SvxConfigPage::FindParentForChild(
return nullptr;
}
-int SvxConfigPage::AddFunction(int nTarget, bool bAllowDuplicates)
+SvxConfigEntry *SvxConfigPage::CreateCommandFromSelection(const OUString &aURL)
{
- OUString aURL = GetScriptURL();
- SvxConfigEntry* pParent = GetTopLevelSelection();
+ OUString aDisplayName;
- if ( aURL.isEmpty() || pParent == nullptr )
- {
- return -1;
+ if ( aURL.isEmpty() ) {
+ return nullptr;
}
- OUString aDisplayName;
-
auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aURL, m_aModuleId);
if ( typeid(*pCurrentSaveInData) == typeid(ContextMenuSaveInData) )
@@ -1416,30 +1454,64 @@ int SvxConfigPage::AddFunction(int nTarget, bool bAllowDuplicates)
else
aDisplayName = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
- SvxConfigEntry* pNewEntryData =
+ SvxConfigEntry* toret =
new SvxConfigEntry( aDisplayName, aURL, false, /*bParentData*/false );
- pNewEntryData->SetUserDefined();
+
+ toret->SetUserDefined();
if ( aDisplayName.isEmpty() )
- pNewEntryData->SetName( GetSelectedDisplayName() );
+ toret->SetName( GetSelectedDisplayName() );
- // check that this function is not already in the menu
- if ( !bAllowDuplicates )
+ return toret;
+}
+
+bool SvxConfigPage::IsCommandInMenuList(const SvxConfigEntry *pEntryData,
+ const SvxEntries *pEntries)
+{
+ bool toret = false;
+
+ if ( pEntries != nullptr
+ && pEntryData != nullptr )
{
- for (auto const& entry : *pParent->GetEntries())
+ for (auto const& entry : *pEntries)
{
- if ( entry->GetCommand() == pNewEntryData->GetCommand() )
- {
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Info, VclButtonsType::Ok, CuiResId(RID_SVXSTR_MNUCFG_ALREADY_INCLUDED)));
- xBox->run();
- delete pNewEntryData;
- return -1;
- }
+ if ( entry->GetCommand() == pEntryData->GetCommand() )
+ {
+ toret = true;
+ break;
+ }
}
}
- return AppendEntry(pNewEntryData, nTarget);
+ return toret;
+}
+
+int SvxConfigPage::AddFunction(int nTarget, bool bAllowDuplicates)
+{
+ int toret = -1;
+ OUString aURL = GetScriptURL();
+ SvxConfigEntry* pParent = GetTopLevelSelection();
+
+ if ( aURL.isEmpty() || pParent == nullptr )
+ {
+ return -1;
+ }
+
+
+ SvxConfigEntry * pNewEntryData = CreateCommandFromSelection( aURL );
+
+ // check that this function is not already in the menu
+ if ( !bAllowDuplicates
+ && IsCommandInMenuList( pNewEntryData, pParent->GetEntries() )
+ )
+ {
+ delete pNewEntryData;
+ } else {
+ toret = AppendEntry( pNewEntryData, nTarget );
+ }
+
+ UpdateButtonStates();
+ return toret;
}
int SvxConfigPage::AppendEntry(
@@ -1458,7 +1530,7 @@ int SvxConfigPage::AppendEntry(
int nCurEntry =
nTarget != -1 ? nTarget : m_xContentsListBox->get_selected_index();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
+ OUString sId(weld::toId(pNewEntryData));
if (nCurEntry == -1 || nCurEntry == m_xContentsListBox->n_children() - 1)
{
@@ -1469,7 +1541,7 @@ int SvxConfigPage::AppendEntry(
else
{
SvxConfigEntry* pEntryData =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nCurEntry).toInt64());
+ weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nCurEntry));
SvxEntries::iterator iter = pEntries->begin();
SvxEntries::const_iterator end = pEntries->end();
@@ -1511,7 +1583,7 @@ namespace
template<typename itertype> void TmplInsertEntryIntoUI(SvxConfigEntry* pNewEntryData, weld::TreeView& rTreeView, itertype& rIter, SaveInData* pSaveInData,
VirtualDevice& rDropDown, bool bMenu)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
+ OUString sId(weld::toId(pNewEntryData));
rTreeView.set_id(rIter, sId);
@@ -1581,13 +1653,20 @@ IMPL_LINK_NOARG(SvxConfigPage, SelectFunctionHdl, weld::TreeView&, void)
}
else
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id().toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id());
if (pData)
{
- OUString aLabel = CuiResId(RID_SVXSTR_COMMANDLABEL) + ": " + pData->sLabel + "\n";
- OUString aName = CuiResId(RID_SVXSTR_COMMANDNAME) + ": " + pData->sCommand + "\n";
- OUString aTip = CuiResId(RID_SVXSTR_COMMANDTIP) + ": " + pData->sTooltip;
- m_xDescriptionField->set_text(aLabel + aName + aTip);
+ bool bIsExperimental
+ = vcl::CommandInfoProvider::IsExperimental(pData->sCommand, m_aModuleId);
+
+ OUString aExperimental = "\n" + CuiResId(RID_CUISTR_COMMANDEXPERIMENTAL);
+ OUString aLabel = CuiResId(RID_CUISTR_COMMANDLABEL) + ": " + pData->sLabel + "\n";
+ OUString aName = CuiResId(RID_CUISTR_COMMANDNAME) + ": " + pData->sCommand + "\n";
+ OUString aTip = CuiResId(RID_CUISTR_COMMANDTIP) + ": " + pData->sTooltip;
+ if (bIsExperimental)
+ m_xDescriptionField->set_text(aLabel + aName + aTip + aExperimental);
+ else
+ m_xDescriptionField->set_text(aLabel + aName + aTip);
}
}
}
@@ -1599,6 +1678,8 @@ IMPL_LINK_NOARG(SvxConfigPage, SelectFunctionHdl, weld::TreeView&, void)
m_xDescriptionField->set_text("");
}
+
+ UpdateButtonStates();
}
IMPL_LINK_NOARG(SvxConfigPage, ImplUpdateDataHdl, Timer*, void)
@@ -1670,32 +1751,30 @@ bool SvxConfigPage::MoveEntryData(int nSourceEntry, int nTargetEntry)
SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
SvxConfigEntry* pSourceData =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSourceEntry).toInt64());
+ weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSourceEntry));
SvxConfigEntry* pTargetData =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nTargetEntry).toInt64());
+ weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nTargetEntry));
- if ( pSourceData != nullptr && pTargetData != nullptr )
- {
- // remove the source entry from our list
- SvxConfigPageHelper::RemoveEntry( pEntries, pSourceData );
+ if ( pSourceData == nullptr || pTargetData == nullptr )
+ return false;
- SvxEntries::iterator iter = pEntries->begin();
- SvxEntries::const_iterator end = pEntries->end();
+ // remove the source entry from our list
+ SvxConfigPageHelper::RemoveEntry( pEntries, pSourceData );
- // advance the iterator to the position of the target entry
- while (*iter != pTargetData && ++iter != end) ;
+ SvxEntries::iterator iter = pEntries->begin();
+ SvxEntries::const_iterator end = pEntries->end();
- // insert the source entry at the position after the target
- pEntries->insert( ++iter, pSourceData );
+ // advance the iterator to the position of the target entry
+ while (*iter != pTargetData && ++iter != end) ;
- GetSaveInData()->SetModified();
- GetTopLevelSelection()->SetModified();
+ // insert the source entry at the position after the target
+ pEntries->insert( ++iter, pSourceData );
- return true;
- }
+ GetSaveInData()->SetModified();
+ GetTopLevelSelection()->SetModified();
- return false;
+ return true;
}
SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
@@ -1716,7 +1795,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
mpEntries.reset( new SvxEntries );
for (auto const& entry : *entries)
{
- m_xMenuListBox->append(OUString::number(reinterpret_cast<sal_uInt64>(entry)),
+ m_xMenuListBox->append(weld::toId(entry),
SvxConfigPageHelper::stripHotKey(entry->GetName()));
mpEntries->push_back(entry);
if (entry == selection)
@@ -1729,7 +1808,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
if ( bCreateMenu )
{
// Generate custom name for new menu
- OUString prefix = CuiResId( RID_SVXSTR_NEW_MENU );
+ OUString prefix = CuiResId( RID_CUISTR_NEW_MENU );
OUString newname = SvxConfigPageHelper::generateCustomName( prefix, entries );
OUString newurl = SvxConfigPageHelper::generateCustomMenuURL( mpEntries.get() );
@@ -1740,7 +1819,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
pNewEntryData->SetUserDefined();
pNewEntryData->SetMain();
- m_sNewMenuEntryId = OUString::number(reinterpret_cast<sal_uInt64>(pNewEntryData));
+ m_sNewMenuEntryId = weld::toId(pNewEntryData);
m_xMenuListBox->append(m_sNewMenuEntryId,
SvxConfigPageHelper::stripHotKey(pNewEntryData->GetName()));
m_xMenuListBox->select(m_xMenuListBox->n_children() - 1);
@@ -1756,7 +1835,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
// hide name label and textfield
m_xMenuBox->hide();
// change the title
- m_xDialog->set_title(CuiResId(RID_SVXSTR_MOVE_MENU));
+ m_xDialog->set_title(CuiResId(RID_CUISTR_MOVE_MENU));
}
m_xMenuListBox->connect_changed(LINK(this, SvxMainMenuOrganizerDialog, SelectHdl));
@@ -1779,7 +1858,7 @@ IMPL_LINK_NOARG(SvxMainMenuOrganizerDialog, ModifyHdl, weld::Entry&, void)
return;
}
- SvxConfigEntry* pNewEntryData = reinterpret_cast<SvxConfigEntry*>(m_sNewMenuEntryId.toUInt64());
+ SvxConfigEntry* pNewEntryData = weld::fromId<SvxConfigEntry*>(m_sNewMenuEntryId);
pNewEntryData->SetName(m_xMenuNameEdit->get_text());
const int nNewMenuPos = m_xMenuListBox->find_id(m_sNewMenuEntryId);
@@ -1836,14 +1915,14 @@ SvxConfigEntry* SvxMainMenuOrganizerDialog::GetSelectedEntry()
const int nSelected(m_xMenuListBox->get_selected_index());
if (nSelected == -1)
return nullptr;
- return reinterpret_cast<SvxConfigEntry*>(m_xMenuListBox->get_id(nSelected).toUInt64());
+ return weld::fromId<SvxConfigEntry*>(m_xMenuListBox->get_id(nSelected));
}
-SvxConfigEntry::SvxConfigEntry( const OUString& rDisplayName,
- const OUString& rCommandURL, bool bPopup, bool bParentData )
+SvxConfigEntry::SvxConfigEntry( OUString aDisplayName,
+ OUString aCommandURL, bool bPopup, bool bParentData )
: nId( 1 )
- , aLabel(rDisplayName)
- , aCommand(rCommandURL)
+ , aLabel(std::move(aDisplayName))
+ , aCommand(std::move(aCommandURL))
, bPopUp(bPopup)
, bStrEdited( false )
, bIsUserDefined( false )
@@ -1922,7 +2001,7 @@ sal_Int32 ToolbarSaveInData::GetSystemStyle( const OUString& rResourceURL )
if ( a >>= aProps )
{
- for ( beans::PropertyValue const & prop : std::as_const(aProps) )
+ for (beans::PropertyValue const& prop : aProps)
{
if ( prop.Name == ITEM_DESCRIPTOR_STYLE )
{
@@ -2012,7 +2091,7 @@ void ToolbarSaveInData::SetSystemStyle(
if ( a >>= aProps )
{
- for ( beans::PropertyValue& prop : aProps )
+ for ( beans::PropertyValue& prop : asNonConstRange(aProps) )
{
if ( prop.Name == ITEM_DESCRIPTOR_STYLE )
{
@@ -2049,7 +2128,7 @@ OUString ToolbarSaveInData::GetSystemUIName( const OUString& rResourceURL )
if ( a >>= aProps )
{
- for ( beans::PropertyValue const & prop : std::as_const(aProps) )
+ for (beans::PropertyValue const& prop : aProps)
{
if ( prop.Name == ITEM_DESCRIPTOR_UINAME )
{
@@ -2076,7 +2155,7 @@ OUString ToolbarSaveInData::GetSystemUIName( const OUString& rResourceURL )
uno::Sequence< beans::PropertyValue > aPropSeq;
if ( a >>= aPropSeq )
{
- for ( beans::PropertyValue const & prop : std::as_const(aPropSeq) )
+ for (beans::PropertyValue const& prop : aPropSeq)
{
if ( prop.Name == ITEM_DESCRIPTOR_LABEL )
{
@@ -2349,8 +2428,9 @@ void ToolbarSaveInData::ApplyToolbar(
sal_Int32 nIndex = aPropValueSeq.getLength();
aPropValueSeq.realloc( nIndex + 1 );
- aPropValueSeq[nIndex].Name = m_aDescriptorContainer;
- aPropValueSeq[nIndex].Value <<= xSubMenuBar;
+ auto pPropValueSeq = aPropValueSeq.getArray();
+ pPropValueSeq[nIndex].Name = m_aDescriptorContainer;
+ pPropValueSeq[nIndex].Value <<= xSubMenuBar;
rToolbarBar->insertByIndex(
rToolbarBar->getCount(), uno::Any( aPropValueSeq ));
@@ -2510,9 +2590,10 @@ void ToolbarSaveInData::RestoreToolbar( SvxConfigEntry* pToolbar )
// After reloading, ensure that the icon is reset of each entry
// in the toolbar
uno::Sequence< OUString > aURLSeq( 1 );
+ auto pURLSeq = aURLSeq.getArray();
for (auto const& entry : *pToolbar->GetEntries())
{
- aURLSeq[ 0 ] = entry->GetCommand();
+ pURLSeq[ 0 ] = entry->GetCommand();
try
{
@@ -2576,7 +2657,7 @@ void ToolbarSaveInData::LoadToolbar(
uno::Sequence< beans::PropertyValue > aPropSeq;
if ( a >>= aPropSeq )
{
- for ( beans::PropertyValue const & prop : std::as_const(aPropSeq) )
+ for (beans::PropertyValue const& prop : aPropSeq)
{
if ( prop.Name == "Name" )
{
@@ -2612,7 +2693,6 @@ void ToolbarSaveInData::LoadToolbar(
SvxNewToolbarDialog::SvxNewToolbarDialog(weld::Window* pWindow, const OUString& rName)
: GenericDialogController(pWindow, "cui/ui/newtoolbardialog.ui", "NewToolbarDialog")
, m_xEdtName(m_xBuilder->weld_entry("edit"))
- , m_xBtnOK(m_xBuilder->weld_button("ok"))
, m_xSaveInListBox(m_xBuilder->weld_combo_box("savein"))
{
m_xEdtName->set_text(rName);
@@ -2629,11 +2709,11 @@ SvxNewToolbarDialog::~SvxNewToolbarDialog()
*
*******************************************************************************/
SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow,
- const uno::Reference< css::ui::XImageManager >& rXImageManager,
- const uno::Reference< css::ui::XImageManager >& rXParentImageManager)
+ uno::Reference< css::ui::XImageManager > xImageManager,
+ uno::Reference< css::ui::XImageManager > xParentImageManager)
: GenericDialogController(pWindow, "cui/ui/iconselectordialog.ui", "IconSelector")
- , m_xImageManager(rXImageManager)
- , m_xParentImageManager(rXParentImageManager)
+ , m_xImageManager(std::move(xImageManager))
+ , m_xParentImageManager(std::move(xParentImageManager))
, m_xTbSymbol(new ValueSet(m_xBuilder->weld_scrolled_window("symbolswin", true)))
, m_xTbSymbolWin(new weld::CustomWeld(*m_xBuilder, "symbolsToolbar", *m_xTbSymbol))
, m_xFtNote(m_xBuilder->weld_label("noteLabel"))
@@ -2693,9 +2773,8 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow,
uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
css::embed::FileSystemStorageFactory::create( xComponentContext ) );
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= aDirectory;
- aArgs[ 1 ] <<= css::embed::ElementModes::READWRITE;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(aDirectory),
+ uno::Any(css::embed::ElementModes::READWRITE) };
uno::Reference< css::embed::XStorage > xStorage(
xStorageFactory->createInstanceWithArguments( aArgs ), uno::UNO_QUERY );
@@ -2717,9 +2796,10 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow,
}
uno::Sequence< OUString > name( 1 );
+ auto pname = name.getArray();
for (auto const& elem : aImageInfo1)
{
- name[ 0 ] = elem.first;
+ pname[ 0 ] = elem.first;
uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( SvxConfigPageHelper::GetImageType(), name );
if ( graphics.hasElements() )
{
@@ -2751,7 +2831,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow,
// large growth factor, expecting many entries
for (auto const& elem : aImageInfo)
{
- name[ 0 ] = elem.first;
+ pname[ 0 ] = elem.first;
uno::Sequence< uno::Reference< graphic::XGraphic> > graphics;
try
@@ -2828,6 +2908,7 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, ImportHdl, weld::Button&, void)
sfx2::FileDialogHelper aImportDialog(
css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
FileDialogFlags::Graphic | FileDialogFlags::MultiSelection, m_xDialog.get());
+ aImportDialog.SetContext(sfx2::FileDialogHelper::IconImport);
// disable the link checkbox in the dialog
uno::Reference< css::ui::dialogs::XFilePickerControlAccess >
@@ -2839,8 +2920,9 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, ImportHdl, weld::Button&, void)
false);
}
- aImportDialog.SetCurrentFilter(
- "PNG - Portable Network Graphic");
+ GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
+ sal_uInt16 nFilter = rFilter.GetImportFormatNumberForShortName(u"png");
+ aImportDialog.SetCurrentFilter(rFilter.GetImportFormatName(nFilter));
if ( ERRCODE_NONE == aImportDialog.Execute() )
{
@@ -2851,7 +2933,7 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, ImportHdl, weld::Button&, void)
IMPL_LINK_NOARG(SvxIconSelectorDialog, DeleteHdl, weld::Button&, void)
{
- OUString message = CuiResId( RID_SVXSTR_DELETE_ICON_CONFIRM );
+ OUString message = CuiResId( RID_CUISTR_DELETE_ICON_CONFIRM );
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::OkCancel,
@@ -2861,8 +2943,7 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, DeleteHdl, weld::Button&, void)
sal_uInt16 nId = m_xTbSymbol->GetSelectedItemId();
- OUString aSelImageText = m_xTbSymbol->GetItemText( nId );
- uno::Sequence< OUString > URLs { aSelImageText };
+ uno::Sequence<OUString> URLs { m_xTbSymbol->GetItemText(nId) };
m_xTbSymbol->RemoveItem(nId);
m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
if ( m_xImportedImageManager->isModified() )
@@ -2874,13 +2955,8 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, DeleteHdl, weld::Button&, void)
bool SvxIconSelectorDialog::ReplaceGraphicItem(
const OUString& aURL )
{
- uno::Sequence< OUString > URLs(1);
- uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
-
uno::Reference< graphic::XGraphic > xGraphic;
- uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
- aMediaProps[0].Name = "URL";
- aMediaProps[0].Value <<= aURL;
+ uno::Sequence< beans::PropertyValue > aMediaProps{ comphelper::makePropertyValue("URL", aURL) };
css::awt::Size aSize;
bool bOK = false;
@@ -2916,7 +2992,6 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
size_t nPos = nId - 1;
assert(nPos == m_xTbSymbol->GetItemPos(nId));
m_xTbSymbol->RemoveItem(nId);
- aMediaProps[0].Value <<= aURL;
Image aImage( xGraphic );
if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
@@ -2929,9 +3004,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
m_aGraphics[nPos] = Graphic(aImage.GetBitmapEx()).GetXGraphic();
- URLs[0] = aURL;
- aImportGraph[ 0 ] = xGraphic;
- m_xImportedImageManager->replaceImages( SvxConfigPageHelper::GetImageType(), URLs, aImportGraph );
+ m_xImportedImageManager->replaceImages( SvxConfigPageHelper::GetImageType(), { aURL }, { xGraphic } );
m_xImportedImageManager->store();
bResult = true;
@@ -2949,10 +3022,10 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
namespace
{
- OUString ReplaceIconName(const OUString& rMessage)
+ OUString ReplaceIconName(std::u16string_view rMessage)
{
OUString name;
- OUString message = CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING );
+ OUString message = CuiResId( RID_CUISTR_REPLACE_ICON_WARNING );
OUString placeholder("%ICONNAME" );
sal_Int32 pos = message.indexOf( placeholder );
if ( pos != -1 )
@@ -2968,13 +3041,13 @@ namespace
private:
std::unique_ptr<weld::MessageDialog> m_xQueryBox;
public:
- SvxIconReplacementDialog(weld::Window *pParent, const OUString& rMessage, bool bYestoAll)
+ SvxIconReplacementDialog(weld::Window *pParent, std::u16string_view rMessage, bool bYestoAll)
: m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::NONE, ReplaceIconName(rMessage)))
{
- m_xQueryBox->set_title(CuiResId(RID_SVXSTR_REPLACE_ICON_CONFIRM));
+ m_xQueryBox->set_title(CuiResId(RID_CUISTR_REPLACE_ICON_CONFIRM));
m_xQueryBox->add_button(GetStandardText(StandardButtonType::Yes), 2);
if (bYestoAll)
- m_xQueryBox->add_button(CuiResId(RID_SVXSTR_YESTOALL), 5);
+ m_xQueryBox->add_button(CuiResId(RID_CUISTR_YESTOALL), 5);
m_xQueryBox->add_button(GetStandardText(StandardButtonType::No), 4);
m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), 6);
m_xQueryBox->set_default_response(2);
@@ -2986,7 +3059,7 @@ namespace
void SvxIconSelectorDialog::ImportGraphics(
const uno::Sequence< OUString >& rPaths )
{
- uno::Sequence< OUString > rejected( rPaths.getLength() );
+ std::vector< OUString > rejected( rPaths.getLength() );
sal_Int32 rejectedCount = 0;
sal_uInt16 ret = 0;
@@ -3075,7 +3148,7 @@ void SvxIconSelectorDialog::ImportGraphics(
fPath = OUString::Concat(rPaths[0].subView(8)) + "/";
for ( sal_Int32 i = 0; i < rejectedCount; ++i )
{
- message.append(fPath).append(rejected[i]).append("\n");
+ message.append(fPath + rejected[i] + "\n");
}
SvxIconChangeDialog aDialog(m_xDialog.get(), message.makeStringAndClear());
@@ -3086,11 +3159,8 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
{
bool result = false;
- uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
- aMediaProps[0].Name = "URL";
+ uno::Sequence< beans::PropertyValue > aMediaProps{ comphelper::makePropertyValue("URL", aURL) };
- uno::Reference< graphic::XGraphic > xGraphic;
- aMediaProps[0].Value <<= aURL;
try
{
uno::Reference< beans::XPropertySet > props =
@@ -3098,7 +3168,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
uno::Any a = props->getPropertyValue("SizePixel");
- xGraphic = m_xGraphProvider->queryGraphic( aMediaProps );
+ uno::Reference< graphic::XGraphic > xGraphic = m_xGraphProvider->queryGraphic( aMediaProps );
if ( xGraphic.is() )
{
bool bOK = true;
@@ -3122,8 +3192,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
m_xTbSymbol->InsertItem(m_aGraphics.size(), aImage, aURL);
uno::Sequence<OUString> aImportURL { aURL };
- uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
- aImportGraph[ 0 ] = xGraphic;
+ uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph{ xGraphic };
m_xImportedImageManager->insertImages( SvxConfigPageHelper::GetImageType(), aImportURL, aImportGraph );
if ( m_xImportedImageManager->isModified() )
{
@@ -3164,39 +3233,16 @@ SvxIconChangeDialog::SvxIconChangeDialog(weld::Window *pWindow, const OUString&
}
SvxConfigPageFunctionDropTarget::SvxConfigPageFunctionDropTarget(SvxConfigPage&rPage, weld::TreeView& rTreeView)
- : DropTargetHelper(rTreeView.get_drop_target())
+ : weld::ReorderingDropTarget(rTreeView)
, m_rPage(rPage)
- , m_rTreeView(rTreeView)
-{
-}
-
-sal_Int8 SvxConfigPageFunctionDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
{
- // to enable the autoscroll when we're close to the edges
- m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
- return DND_ACTION_MOVE;
}
-sal_Int8 SvxConfigPageFunctionDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
+sal_Int8 SvxConfigPageFunctionDropTarget::ExecuteDrop(const ExecuteDropEvent& rEvt)
{
- weld::TreeView* pSource = m_rTreeView.get_drag_source();
- // only dragging within the same widget allowed
- if (!pSource || pSource != &m_rTreeView)
- return DND_ACTION_NONE;
-
- std::unique_ptr<weld::TreeIter> xSource(m_rTreeView.make_iterator());
- if (!m_rTreeView.get_selected(xSource.get()))
- return DND_ACTION_NONE;
-
- std::unique_ptr<weld::TreeIter> xTarget(m_rTreeView.make_iterator());
- int nTargetPos = -1;
- if (m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true))
- nTargetPos = m_rTreeView.get_iter_index_in_parent(*xTarget);
- m_rTreeView.move_subtree(*xSource, nullptr, nTargetPos);
-
+ sal_Int8 nRet = weld::ReorderingDropTarget::ExecuteDrop(rEvt);
m_rPage.ListModified();
-
- return DND_ACTION_NONE;
+ return nRet;;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 4d17928b3b39..3a2cdbc1b05e 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -49,11 +49,16 @@
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <dialmgr.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <vcl/help.hxx>
#include <vcl/svapp.hxx>
+#include <o3tl/string_view.hxx>
+
+#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/Context.hxx>
+#include <unotools/viewoptions.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -74,7 +79,9 @@ const char CMDURL_STYLEPROT_ONLY[] = ".uno:StyleApply?";
const char CMDURL_SPART_ONLY [] = "Style:string=";
const char CMDURL_FPART_ONLY [] = "FamilyName:string=";
-constexpr OUStringLiteral STYLEPROP_UINAME = u"DisplayName";
+constexpr OUString STYLEPROP_UINAME = u"DisplayName"_ustr;
+constexpr OUString MACRO_SELECTOR_CONFIGNAME = u"MacroSelectorDialog"_ustr;
+constexpr OUString LAST_RUN_MACRO_INFO = u"LastRunMacro"_ustr;
OUString SfxStylesInfo_Impl::generateCommand(
std::u16string_view sFamily, std::u16string_view sStyle)
@@ -239,7 +246,7 @@ std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const OUString& s
OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
if (pData)
{
if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
@@ -259,7 +266,7 @@ OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
OUString CuiConfigFunctionListBox::GetCurCommand() const
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
if (!pData)
return OUString();
return pData->sCommand;
@@ -267,7 +274,7 @@ OUString CuiConfigFunctionListBox::GetCurCommand() const
OUString CuiConfigFunctionListBox::GetCurLabel() const
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
if (!pData)
return OUString();
if (!pData->sLabel.isEmpty())
@@ -291,12 +298,12 @@ CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
IMPL_LINK(CuiConfigFunctionListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter));
if (!pData)
return OUString();
- OUString aLabel = CuiResId(RID_SVXSTR_COMMANDLABEL) + ": ";
- OUString aName = CuiResId(RID_SVXSTR_COMMANDNAME) + ": ";
- OUString aTip = CuiResId(RID_SVXSTR_COMMANDTIP) + ": ";
+ OUString aLabel = CuiResId(RID_CUISTR_COMMANDLABEL) + ": ";
+ OUString aName = CuiResId(RID_CUISTR_COMMANDNAME) + ": ";
+ OUString aTip = CuiResId(RID_CUISTR_COMMANDTIP) + ": ";
return aLabel + pData->sLabel + "\n" + aName + pData->sCommand+ "\n" + aTip + pData->sTooltip;
}
@@ -333,7 +340,7 @@ void CuiConfigFunctionListBox::ClearAll()
OUString CuiConfigFunctionListBox::GetSelectedScriptURI() const
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
return *static_cast<OUString*>(pData->pObject);
return OUString();
@@ -343,19 +350,19 @@ struct SvxConfigGroupBoxResource_Impl
{
OUString m_sMyMacros;
OUString m_sProdMacros;
- OUString m_sMacros;
OUString m_sDlgMacros;
OUString m_aStrGroupStyles;
+ OUString m_aStrGroupSidebarDecks;
SvxConfigGroupBoxResource_Impl();
};
SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() :
- m_sMyMacros(CuiResId(RID_SVXSTR_MYMACROS)),
- m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
- m_sMacros(CuiResId(RID_SVXSTR_BASICMACROS)),
- m_sDlgMacros(CuiResId(RID_SVXSTR_PRODMACROS)),
- m_aStrGroupStyles(CuiResId(RID_SVXSTR_GROUP_STYLES))
+ m_sMyMacros(CuiResId(RID_CUISTR_MYMACROS)),
+ m_sProdMacros(CuiResId(RID_CUISTR_PRODMACROS)),
+ m_sDlgMacros(CuiResId(RID_CUISTR_PRODMACROS)),
+ m_aStrGroupStyles(CuiResId(RID_CUISTR_GROUP_STYLES)),
+ m_aStrGroupSidebarDecks(CuiResId(RID_CUISTR_GROUP_SIDEBARDECKS))
{
}
@@ -462,27 +469,21 @@ void CuiConfigGroupListBox::ClearAll()
m_xTreeView->clear();
}
-void CuiConfigGroupListBox::InitModule()
+sal_Int32 CuiConfigGroupListBox::InitModule()
{
try
{
+ // return the number of added groups
css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW);
css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
sal_Int32 c1 = lGroups.getLength();
sal_Int32 i1 = 0;
-
- if ( c1 )
- {
- // Add All Commands category
- aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
- m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
- CuiResId(RID_SVXSTR_ALLFUNCTIONS));
- }
+ sal_Int32 nAddedGroups = 0;
for (i1=0; i1<c1; ++i1)
{
- sal_Int16& rGroupID = lGroups[i1];
- OUString sGroupID = OUString::number(rGroupID);
+ sal_Int16 nGroupID = lGroups[i1];
+ OUString sGroupID = OUString::number(nGroupID);
OUString sGroupName ;
try
@@ -494,19 +495,21 @@ void CuiConfigGroupListBox::InitModule()
catch(const css::container::NoSuchElementException&)
{ continue; }
- aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, rGroupID ) );
- m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
- sGroupName);
+ aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, nGroupID ) );
+ m_xTreeView->append(weld::toId(aArr.back().get()), sGroupName);
+ nAddedGroups++;
}
+ return nAddedGroups;
}
catch(const css::uno::RuntimeException&)
{ throw; }
catch(const css::uno::Exception&)
{}
+ return 0;
}
void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
- const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand)
+ const weld::TreeIter* pParentEntry)
{
try {
if ( xRootNode->hasChildNodes() )
@@ -568,7 +571,8 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
theChild->acquire();
bool bChildOnDemand = false;
- if ( !bCheapChildrenOnDemand && theChild->hasChildNodes() )
+
+ if ( theChild->hasChildNodes() )
{
const Sequence< Reference< browse::XBrowseNode > > grandchildren =
theChild->getChildNodes();
@@ -582,21 +586,13 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
}
}
}
- else
- {
- /* i30923 - Would be nice if there was a better
- * way to determine if a basic lib had children
- * without having to ask for them (which forces
- * the library to be loaded */
- bChildOnDemand = true;
- }
OUString aImage = GetImage(theChild, m_xContext, bIsRootNode);
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
0, static_cast<void *>( theChild.get())));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+ OUString sId(weld::toId(aArr.back().get()));
m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, bChildOnDemand, m_xScratchIter.get());
m_xTreeView->set_image(*m_xScratchIter, aImage);
}
@@ -621,7 +617,7 @@ void CuiConfigGroupListBox::FillFunctionsList(const css::uno::Sequence<DispatchI
pGrpInfo->sCommand = rInfo.Command;
pGrpInfo->sLabel = sUIName;
pGrpInfo->sTooltip = vcl::CommandInfoProvider::GetTooltipForCommand(rInfo.Command, aProperties, m_xFrame);
- m_pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(pGrpInfo)), sUIName);
+ m_pFunctionListBox->append(weld::toId(pGrpInfo), sUIName);
}
m_pFunctionListBox->thaw();
}
@@ -636,6 +632,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
m_xContext = xContext;
m_xFrame = xFrame;
+ sal_Int32 nAddedGroups = 0;
if( bEventMode )
{
m_sModuleLongName = sModuleLongName;
@@ -643,7 +640,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
m_xUICmdDescription = css::frame::theUICommandDescription::get( m_xContext );
- InitModule();
+ nAddedGroups = InitModule();
}
SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
@@ -660,7 +657,21 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
// TODO exception handling
}
+ m_xTreeView->thaw();
+ m_xTreeView->make_sorted();
+ m_xTreeView->make_unsorted();
+ m_xTreeView->freeze();
+
+ // add All Commands to the top
+ if ( bEventMode && nAddedGroups )
+ {
+ aArr.insert(aArr.begin(), std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
+ OUString sId(weld::toId(aArr.front().get()));
+ OUString s(CuiResId(RID_CUISTR_ALLFUNCTIONS));
+ m_xTreeView->insert(nullptr, 0, &s, &sId, nullptr, nullptr, false, nullptr);
+ }
+ // add application macros to the end
if ( rootNode.is() )
{
if ( bEventMode )
@@ -672,24 +683,29 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
static_cast<void *>(rootNode.get())));
OUString aTitle(xImp->m_sDlgMacros);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+ OUString sId(weld::toId(aArr.back().get()));
m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, nullptr);
}
else
{
//We are only showing scripts not slot APIs so skip
//Root node and show location nodes
- FillScriptList(rootNode, nullptr, false);
+ FillScriptList(rootNode, nullptr);
}
}
- // add styles
+ // add styles and sidebar decks to the end
if ( bEventMode )
{
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
OUString sStyle(xImp->m_aStrGroupStyles);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+ OUString sId(weld::toId(aArr.back().get()));
m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, true, nullptr);
+
+ aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SIDEBARDECKS, 0));
+ OUString sSidebarDecks(xImp->m_aStrGroupSidebarDecks);
+ sId = weld::toId(aArr.back().get());
+ m_xTreeView->insert(nullptr, -1, &sSidebarDecks, &sId, nullptr, nullptr, false, nullptr);
}
m_xTreeView->thaw();
@@ -823,7 +839,7 @@ void CuiConfigGroupListBox::GroupSelected()
if (!m_xTreeView->get_selected(xIter.get()))
return;
- SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
+ SfxGroupInfo_Impl *pInfo = weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter));
m_pFunctionListBox->freeze();
m_pFunctionListBox->ClearAll();
@@ -835,7 +851,7 @@ void CuiConfigGroupListBox::GroupSelected()
bool bValidIter = m_xTreeView->get_iter_first(*xIter);
while (bValidIter)
{
- SfxGroupInfo_Impl *pCurrentInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
+ SfxGroupInfo_Impl *pCurrentInfo = weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter));
if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
{
css::uno::Sequence< css::frame::DispatchInformation > lCommands;
@@ -908,7 +924,7 @@ void CuiConfigGroupListBox::GroupSelected()
m_pFunctionListBox->aArr.back()->sLabel = childNode->getName();
m_pFunctionListBox->aArr.back()->sHelpText = description;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
+ OUString sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
m_pFunctionListBox->append(sId, childNode->getName(), aImage);
}
}
@@ -933,13 +949,37 @@ void CuiConfigGroupListBox::GroupSelected()
m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, pStyle));
m_pFunctionListBox->aArr.back()->sCommand = pStyle->sCommand;
m_pFunctionListBox->aArr.back()->sLabel = pStyle->sLabel;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
+ OUString sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
m_pFunctionListBox->append(sId, pStyle->sLabel);
}
}
break;
}
+ case SfxCfgKind::GROUP_SIDEBARDECKS:
+ {
+ sfx2::sidebar::ResourceManager aResourceManager;
+ sfx2::sidebar::Context aContext(m_sModuleLongName, OUString());
+ sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks;
+ aResourceManager.GetMatchingDecks(aDecks, aContext, false, m_xFrame->getController());
+
+ for (auto const& rDeck : aDecks)
+ {
+ const OUString sCommand = ".uno:SidebarDeck." + rDeck.msId;
+ m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(
+ SfxCfgKind::GROUP_SIDEBARDECKS, 0,
+ nullptr));
+ m_pFunctionListBox->aArr.back()->sCommand = sCommand;
+ m_pFunctionListBox->aArr.back()->sLabel = rDeck.msId;
+ m_pFunctionListBox->aArr.back()->sTooltip =
+ vcl::CommandInfoProvider::GetCommandShortcut(sCommand, m_xFrame);
+ m_pFunctionListBox->append(weld::toId(m_pFunctionListBox->aArr.back().get()),
+ rDeck.msId);
+ }
+
+ break;
+ }
+
default:
// Do nothing, the list box will stay empty
SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind) );
@@ -957,7 +997,7 @@ void CuiConfigGroupListBox::GroupSelected()
*/
IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, bool)
{
- SfxGroupInfo_Impl *pInfo = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
+ SfxGroupInfo_Impl *pInfo = weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter));
switch ( pInfo->nKind )
{
case SfxCfgKind::GROUP_SCRIPTCONTAINER:
@@ -966,7 +1006,7 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, boo
{
Reference< browse::XBrowseNode > rootNode(
static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
- FillScriptList(rootNode, &rIter, true /* i30923 */ );
+ FillScriptList(rootNode, &rIter);
}
break;
}
@@ -980,7 +1020,7 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, boo
{
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(lStyleFamily);
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily ));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+ OUString sId(weld::toId(aArr.back().get()));
m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, false, nullptr);
}
}
@@ -994,29 +1034,24 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, boo
return true;
}
+#if HAVE_FEATURE_SCRIPTING
void CuiConfigGroupListBox::SelectMacro( const SfxMacroInfoItem *pItem )
{
- SelectMacro( pItem->GetBasicManager()->GetName(),
- pItem->GetQualifiedName() );
-}
-
-void CuiConfigGroupListBox::SelectMacro( std::u16string_view rBasic,
- const OUString& rMacro )
-{
- const OUString aBasicName(OUString::Concat(rBasic) + " " + xImp->m_sMacros);
+ auto const rMacro = pItem->GetQualifiedName();
sal_Int32 nIdx {rMacro.lastIndexOf('.')};
- const OUString aMethod( rMacro.copy(nIdx+1) );
- OUString aLib;
- OUString aModule;
+ const std::u16string_view aMethod( rMacro.subView(nIdx + 1) );
+ std::u16string_view aLib;
+ std::u16string_view aModule;
if ( nIdx>0 )
{
// string contains at least 2 tokens
nIdx = rMacro.lastIndexOf('.', nIdx);
- if (nIdx>=0)
+ if (nIdx != -1)
{
// string contains at least 3 tokens
- aLib = rMacro.getToken( 0, '.' );
- aModule = rMacro.getToken( 0, '.', ++nIdx );
+ aLib = o3tl::getToken(rMacro, 0, '.' );
+ sal_Int32 nIdx2 = nIdx + 1;
+ aModule = o3tl::getToken(rMacro, 0, '.', nIdx2 );
}
}
@@ -1027,48 +1062,65 @@ void CuiConfigGroupListBox::SelectMacro( std::u16string_view rBasic,
do
{
OUString aEntryBas = m_xTreeView->get_text(*xIter);
- if (aEntryBas == aBasicName)
+ if (aEntryBas == xImp->m_sDlgMacros)
{
m_xTreeView->expand_row(*xIter);
- std::unique_ptr<weld::TreeIter> xLibIter = m_xTreeView->make_iterator(xIter.get());
- if (m_xTreeView->get_iter_first(*xLibIter))
+ std::unique_ptr<weld::TreeIter> xLocationIter = m_xTreeView->make_iterator(xIter.get());
+ if (m_xTreeView->iter_children(*xLocationIter))
{
do
{
- OUString aEntryLib = m_xTreeView->get_text(*xLibIter);
- if (aEntryLib == aLib)
+ m_xTreeView->expand_row(*xLocationIter);
+ std::unique_ptr<weld::TreeIter> xLibIter = m_xTreeView->make_iterator(xLocationIter.get());
+ if (m_xTreeView->iter_children(*xLibIter))
{
- m_xTreeView->expand_row(*xLibIter);
- std::unique_ptr<weld::TreeIter> xModIter = m_xTreeView->make_iterator(xLibIter.get());
- if (m_xTreeView->get_iter_first(*xModIter))
+ do
{
- do
+ OUString aEntryLib = m_xTreeView->get_text(*xLibIter);
+ if (aEntryLib == aLib)
{
- OUString aEntryMod = m_xTreeView->get_text(*xModIter);
- if ( aEntryMod == aModule )
+ m_xTreeView->expand_row(*xLibIter);
+ std::unique_ptr<weld::TreeIter> xModIter = m_xTreeView->make_iterator(xLibIter.get());
+ if (m_xTreeView->iter_children(*xModIter))
{
- m_xTreeView->expand_row(*xModIter);
- m_xTreeView->scroll_to_row(*xModIter);
- m_xTreeView->select(*xModIter);
- for (int i = 0, nCount = m_pFunctionListBox->n_children(); i < nCount; ++i)
+ do
{
- OUString aEntryMethod = m_pFunctionListBox->get_text(i);
- if (aEntryMethod == aMethod)
+ OUString aEntryMod = m_xTreeView->get_text(*xModIter);
+ if ( aEntryMod == aModule )
{
- m_pFunctionListBox->select(i);
- m_pFunctionListBox->scroll_to_row(i);
- return;
+ m_xTreeView->expand_row(*xModIter);
+ m_xTreeView->scroll_to_row(*xModIter);
+ m_xTreeView->select(*xModIter);
+ GroupSelected();
+ for (int i = 0, nCount = m_pFunctionListBox->n_children(); i < nCount; ++i)
+ {
+ OUString aEntryMethod = m_pFunctionListBox->get_text(i);
+ if (aEntryMethod == aMethod)
+ {
+ m_pFunctionListBox->select(i);
+ m_pFunctionListBox->scroll_to_row(i);
+ return;
+ }
+ }
+ m_xTreeView->collapse_row(*xModIter);
}
- }
+ } while (m_xTreeView->iter_next_sibling(*xModIter));
}
- } while (m_xTreeView->iter_next_sibling(*xModIter));
- }
+ m_xTreeView->collapse_row(*xLibIter);
+ }
+ } while (m_xTreeView->iter_next_sibling(*xLibIter));
}
- } while (m_xTreeView->iter_next_sibling(*xLibIter));
+ m_xTreeView->collapse_row(*xLocationIter);
+ } while (m_xTreeView->iter_next_sibling(*xLocationIter));
}
+ // If the macro can't be located, preselect the "Application Macros" category:
+ m_xTreeView->scroll_to_row(*xIter);
+ m_xTreeView->select(*xIter);
+ return;
}
} while (m_xTreeView->iter_next_sibling(*xIter));
}
+#endif
/*
* Implementation of SvxScriptSelectorDialog
@@ -1084,21 +1136,18 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
, m_xCategories(new CuiConfigGroupListBox(m_xBuilder->weld_tree_view("categories")))
, m_xCommands(new CuiConfigFunctionListBox(m_xBuilder->weld_tree_view("commands")))
, m_xLibraryFT(m_xBuilder->weld_label("libraryft"))
- , m_xCategoryFT(m_xBuilder->weld_label("categoryft"))
, m_xMacronameFT(m_xBuilder->weld_label("macronameft"))
- , m_xCommandsFT(m_xBuilder->weld_label("commandsft"))
, m_xOKButton(m_xBuilder->weld_button("ok"))
, m_xCancelButton(m_xBuilder->weld_button("cancel"))
, m_xDescriptionText(m_xBuilder->weld_text_view("description"))
+ , m_xDescriptionFrame(m_xBuilder->weld_frame("descriptionframe"))
{
m_xCancelButton->show();
m_xDialogDescription->show();
m_xOKButton->show();
m_xLibraryFT->set_visible(true);
- m_xCategoryFT->set_visible(false);
m_xMacronameFT->set_visible(true);
- m_xCommandsFT->set_visible(false);
const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
m_xCategories->SetFunctionListBox(m_xCommands.get());
@@ -1126,7 +1175,14 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
m_aStylesInfo.init(aModuleName, xModel);
m_xCategories->SetStylesInfo(&m_aStylesInfo);
+ // The following call is a workaround to make scroll_to_row work as expected in kf5/x11
+ m_xDialog->resize_to_request();
+
+ LoadLastUsedMacro();
UpdateUI();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ m_xDescriptionFrame->hide();
}
SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
@@ -1161,7 +1217,7 @@ IMPL_LINK(SvxScriptSelectorDialog, ContextMenuHdl, const CommandEvent&, rCEvt, b
xDropMenu->set_active("alphabetically", xTreeView.get_sort_order());
xDropMenu->set_active("properorder", !xTreeView.get_sort_order());
- OString sCommand(xPopup->popup_at_rect(&xTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+ OUString sCommand(xPopup->popup_at_rect(&xTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
if (sCommand == "alphabetically")
{
xTreeView.make_sorted();
@@ -1189,7 +1245,6 @@ SvxScriptSelectorDialog::UpdateUI()
{
OUString sMessage = m_xCommands->GetHelpText();
m_xDescriptionText->set_text(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
-
m_xOKButton->set_sensitive(true);
}
else
@@ -1207,6 +1262,7 @@ IMPL_LINK(SvxScriptSelectorDialog, ClickHdl, weld::Button&, rButton, void)
}
else if (&rButton == m_xOKButton.get())
{
+ SaveLastUsedMacro();
m_xDialog->response(RET_OK);
}
}
@@ -1214,7 +1270,7 @@ IMPL_LINK(SvxScriptSelectorDialog, ClickHdl, weld::Button&, rButton, void)
void
SvxScriptSelectorDialog::SetRunLabel()
{
- m_xOKButton->set_label(CuiResId(RID_SVXSTR_SELECTOR_RUN));
+ m_xOKButton->set_label(CuiResId(RID_CUISTR_SELECTOR_RUN));
}
OUString
@@ -1225,7 +1281,7 @@ SvxScriptSelectorDialog::GetScriptURL() const
std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
if (m_xCommands->get_selected(xIter.get()))
{
- SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter).toInt64());
+ SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter));
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
|| ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
|| ( pData->nKind == SfxCfgKind::GROUP_STYLES )
@@ -1238,4 +1294,100 @@ SvxScriptSelectorDialog::GetScriptURL() const
return result;
}
+void
+SvxScriptSelectorDialog::SaveLastUsedMacro()
+{
+ // Gets the current selection in the dialog as a series of selected entries
+ OUString sMacroInfo;
+ sMacroInfo = m_xCommands->get_selected_text();
+ weld::TreeView& xCategories = m_xCategories->get_widget();
+ std::unique_ptr<weld::TreeIter> xIter = xCategories.make_iterator();
+
+ if (!xCategories.get_selected(xIter.get()))
+ return;
+
+ do
+ {
+ sMacroInfo = xCategories.get_text(*xIter) + "|" + sMacroInfo;
+ } while (xCategories.iter_parent(*xIter));
+
+ SvtViewOptions( EViewType::Dialog, MACRO_SELECTOR_CONFIGNAME ).SetUserItem(
+ LAST_RUN_MACRO_INFO, Any(sMacroInfo));
+}
+
+void
+SvxScriptSelectorDialog::LoadLastUsedMacro()
+{
+ SvtViewOptions aDlgOpt( EViewType::Dialog, MACRO_SELECTOR_CONFIGNAME );
+ if (!aDlgOpt.Exists())
+ return;
+
+ OUString sMacroInfo;
+ aDlgOpt.GetUserItem(LAST_RUN_MACRO_INFO) >>= sMacroInfo;
+ if (sMacroInfo.isEmpty())
+ return;
+
+ // Counts how many entries exist in the macro info string
+ sal_Int16 nInfoParts = 0;
+ sal_Int16 nLastIndex = sMacroInfo.indexOf('|');
+ if (nLastIndex > -1)
+ {
+ nInfoParts = 1;
+ while ( nLastIndex != -1 )
+ {
+ nInfoParts++;
+ nLastIndex = sMacroInfo.indexOf('|', nLastIndex + 1);
+ }
+ }
+
+ weld::TreeView& xCategories = m_xCategories->get_widget();
+ std::unique_ptr<weld::TreeIter> xIter = xCategories.make_iterator();
+ if (!xCategories.get_iter_first(*xIter))
+ return;
+
+ // Expand the nodes in the category tree
+ OUString sNodeToExpand;
+ bool bIsIterValid;
+ sal_Int16 nOpenedNodes = 0;
+ for (sal_Int16 i=0; i<nInfoParts - 1; i++)
+ {
+ sNodeToExpand = sMacroInfo.getToken(i, '|');
+ bIsIterValid = true;
+ while (bIsIterValid && xCategories.get_text(*xIter) != sNodeToExpand)
+ bIsIterValid = xCategories.iter_next_sibling(*xIter);
+
+ if (bIsIterValid)
+ {
+ xCategories.expand_row(*xIter);
+ nOpenedNodes++;
+ }
+ if (xCategories.iter_has_child(*xIter))
+ (void)xCategories.iter_children(*xIter);
+ else if (nOpenedNodes < nInfoParts - 1)
+ // If the number of levels in the tree is smaller than the
+ // number of parts in the macro info string, then return
+ return;
+ }
+ xCategories.select(*xIter);
+ xCategories.scroll_to_row(*xIter);
+ m_xCategories->GroupSelected();
+
+ // Select the macro in the command tree
+ weld::TreeView& xCommands = m_xCommands->get_widget();
+ xIter = xCommands.make_iterator();
+ if (!xCommands.get_iter_first(*xIter))
+ return;
+
+ OUString sMacroName = sMacroInfo.getToken(nInfoParts - 1, '|');
+ bIsIterValid = true;
+ while (bIsIterValid && xCommands.get_text(*xIter) != sMacroName)
+ bIsIterValid = xCommands.iter_next_sibling(*xIter);
+
+ if (bIsIterValid)
+ {
+ xCommands.scroll_to_row(*xIter);
+ xCommands.select(*xIter);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index 72cd08b168fa..755fd16b416a 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/document/XEventsSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp>
@@ -44,6 +44,7 @@ SvxEventConfigPage::SvxEventConfigPage(weld::Container* pPage, weld::DialogContr
mpImpl->xEventLB = m_xBuilder->weld_tree_view("events");
mpImpl->xAssignPB = m_xBuilder->weld_button("macro");
mpImpl->xDeletePB = m_xBuilder->weld_button("delete");
+ mpImpl->xDeleteAllPB = m_xBuilder->weld_button("deleteall");
mpImpl->xAssignComponentPB = m_xBuilder->weld_button("component");
mpImpl->xEventLB->set_size_request(mpImpl->xEventLB->get_approximate_digit_width() * 70,
@@ -123,7 +124,6 @@ IMPL_LINK_NOARG( SvxEventConfigPage, SelectHdl_Impl, weld::ComboBox&, void )
{
bool bApp = m_xSaveInListBox->get_active_id().toBoolean();
- mpImpl->xEventLB->freeze();
if (bApp)
{
SetReadOnly( false );
@@ -155,8 +155,6 @@ IMPL_LINK_NOARG( SvxEventConfigPage, SelectHdl_Impl, weld::ComboBox&, void )
SetReadOnly( isReadonly );
SvxMacroTabPage_::DisplayAppEvents( false );
}
-
- mpImpl->xEventLB->thaw();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index b6e4694dddac..79197be4bf43 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -20,22 +20,25 @@
#include <macropg.hxx>
#include <svl/eitem.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <bitmaps.hlst>
#include <cfgutil.hxx>
#include <dialmgr.hxx>
#include <helpids.h>
#include <headertablistbox.hxx>
#include "macropg_impl.hxx"
+#include <o3tl/safeint.hxx>
#include <svl/macitem.hxx>
#include <svx/svxids.hrc>
#include <strings.hrc>
#include <comphelper/namedvaluecollection.hxx>
+#include <o3tl/string_view.hxx>
+#include <utility>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-const char aVndSunStarUNO[] = "vnd.sun.star.UNO:";
+constexpr OUString aVndSunStarUNO = u"vnd.sun.star.UNO:"_ustr;
SvxMacroTabPage_Impl::SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet )
: bReadOnly(false)
@@ -58,19 +61,20 @@ MacroEventListBox::MacroEventListBox(std::unique_ptr<weld::TreeView> xTreeView)
// and it is not read only
void SvxMacroTabPage_::EnableButtons()
{
+ mpImpl->xDeleteAllPB->set_sensitive(m_nAssignedEvents != 0);
int nEvent = mpImpl->xEventLB->get_selected_index();
- if (nEvent != -1)
- {
- mpImpl->xDeletePB->set_sensitive( !mpImpl->bReadOnly );
- mpImpl->xAssignPB->set_sensitive( !mpImpl->bReadOnly );
- if( mpImpl->xAssignComponentPB )
- mpImpl->xAssignComponentPB->set_sensitive( !mpImpl->bReadOnly );
- }
+ const EventPair* pEventPair = nEvent == -1 ? nullptr : LookupEvent(mpImpl->xEventLB->get_id(nEvent));
+ const bool bAssigned = pEventPair && !pEventPair->second.isEmpty();
+ mpImpl->xDeletePB->set_sensitive(!mpImpl->bReadOnly && bAssigned);
+ mpImpl->xAssignPB->set_sensitive(!mpImpl->bReadOnly);
+ if (mpImpl->xAssignComponentPB)
+ mpImpl->xAssignComponentPB->set_sensitive( !mpImpl->bReadOnly );
}
SvxMacroTabPage_::SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription,
- const OString& rID, const SfxItemSet& rAttrSet)
+ const OUString& rID, const SfxItemSet& rAttrSet)
: SfxTabPage(pPage, pController, rUIXMLDescription, rID, &rAttrSet)
+ , m_nAssignedEvents(0)
, bDocModified(false)
, bAppEvents(false)
, bInitialized(false)
@@ -88,81 +92,81 @@ void SvxMacroTabPage_::InitResources()
// Note: the order here controls the order in which the events are displayed in the UI!
// the event name to UI string mappings for App Events
- aDisplayNames.emplace_back( "OnStartApp", RID_SVXSTR_EVENT_STARTAPP );
- aDisplayNames.emplace_back( "OnCloseApp", RID_SVXSTR_EVENT_CLOSEAPP );
- aDisplayNames.emplace_back( "OnCreate", RID_SVXSTR_EVENT_CREATEDOC );
- aDisplayNames.emplace_back( "OnNew", RID_SVXSTR_EVENT_NEWDOC );
- aDisplayNames.emplace_back( "OnLoadFinished", RID_SVXSTR_EVENT_LOADDOCFINISHED );
- aDisplayNames.emplace_back( "OnLoad", RID_SVXSTR_EVENT_OPENDOC );
- aDisplayNames.emplace_back( "OnPrepareUnload", RID_SVXSTR_EVENT_PREPARECLOSEDOC );
- aDisplayNames.emplace_back( "OnUnload", RID_SVXSTR_EVENT_CLOSEDOC ) ;
- aDisplayNames.emplace_back( "OnViewCreated", RID_SVXSTR_EVENT_VIEWCREATED );
- aDisplayNames.emplace_back( "OnPrepareViewClosing", RID_SVXSTR_EVENT_PREPARECLOSEVIEW );
- aDisplayNames.emplace_back( "OnViewClosed", RID_SVXSTR_EVENT_CLOSEVIEW ) ;
- aDisplayNames.emplace_back( "OnFocus", RID_SVXSTR_EVENT_ACTIVATEDOC );
- aDisplayNames.emplace_back( "OnUnfocus", RID_SVXSTR_EVENT_DEACTIVATEDOC );
- aDisplayNames.emplace_back( "OnSave", RID_SVXSTR_EVENT_SAVEDOC );
- aDisplayNames.emplace_back( "OnSaveDone", RID_SVXSTR_EVENT_SAVEDOCDONE );
- aDisplayNames.emplace_back( "OnSaveFailed", RID_SVXSTR_EVENT_SAVEDOCFAILED );
- aDisplayNames.emplace_back( "OnSaveAs", RID_SVXSTR_EVENT_SAVEASDOC );
- aDisplayNames.emplace_back( "OnSaveAsDone", RID_SVXSTR_EVENT_SAVEASDOCDONE );
- aDisplayNames.emplace_back( "OnSaveAsFailed", RID_SVXSTR_EVENT_SAVEASDOCFAILED );
- aDisplayNames.emplace_back( "OnCopyTo", RID_SVXSTR_EVENT_COPYTODOC );
- aDisplayNames.emplace_back( "OnCopyToDone", RID_SVXSTR_EVENT_COPYTODOCDONE );
- aDisplayNames.emplace_back( "OnCopyToFailed", RID_SVXSTR_EVENT_COPYTODOCFAILED );
- aDisplayNames.emplace_back( "OnPrint", RID_SVXSTR_EVENT_PRINTDOC );
- aDisplayNames.emplace_back( "OnModifyChanged", RID_SVXSTR_EVENT_MODIFYCHANGED );
- aDisplayNames.emplace_back( "OnTitleChanged", RID_SVXSTR_EVENT_TITLECHANGED );
+ aDisplayNames.emplace_back( "OnStartApp", RID_CUISTR_EVENT_STARTAPP );
+ aDisplayNames.emplace_back( "OnCloseApp", RID_CUISTR_EVENT_CLOSEAPP );
+ aDisplayNames.emplace_back( "OnCreate", RID_CUISTR_EVENT_CREATEDOC );
+ aDisplayNames.emplace_back( "OnNew", RID_CUISTR_EVENT_NEWDOC );
+ aDisplayNames.emplace_back( "OnLoadFinished", RID_CUISTR_EVENT_LOADDOCFINISHED );
+ aDisplayNames.emplace_back( "OnLoad", RID_CUISTR_EVENT_OPENDOC );
+ aDisplayNames.emplace_back( "OnPrepareUnload", RID_CUISTR_EVENT_PREPARECLOSEDOC );
+ aDisplayNames.emplace_back( "OnUnload", RID_CUISTR_EVENT_CLOSEDOC ) ;
+ aDisplayNames.emplace_back( "OnViewCreated", RID_CUISTR_EVENT_VIEWCREATED );
+ aDisplayNames.emplace_back( "OnPrepareViewClosing", RID_CUISTR_EVENT_PREPARECLOSEVIEW );
+ aDisplayNames.emplace_back( "OnViewClosed", RID_CUISTR_EVENT_CLOSEVIEW ) ;
+ aDisplayNames.emplace_back( "OnFocus", RID_CUISTR_EVENT_ACTIVATEDOC );
+ aDisplayNames.emplace_back( "OnUnfocus", RID_CUISTR_EVENT_DEACTIVATEDOC );
+ aDisplayNames.emplace_back( "OnSave", RID_CUISTR_EVENT_SAVEDOC );
+ aDisplayNames.emplace_back( "OnSaveDone", RID_CUISTR_EVENT_SAVEDOCDONE );
+ aDisplayNames.emplace_back( "OnSaveFailed", RID_CUISTR_EVENT_SAVEDOCFAILED );
+ aDisplayNames.emplace_back( "OnSaveAs", RID_CUISTR_EVENT_SAVEASDOC );
+ aDisplayNames.emplace_back( "OnSaveAsDone", RID_CUISTR_EVENT_SAVEASDOCDONE );
+ aDisplayNames.emplace_back( "OnSaveAsFailed", RID_CUISTR_EVENT_SAVEASDOCFAILED );
+ aDisplayNames.emplace_back( "OnCopyTo", RID_CUISTR_EVENT_COPYTODOC );
+ aDisplayNames.emplace_back( "OnCopyToDone", RID_CUISTR_EVENT_COPYTODOCDONE );
+ aDisplayNames.emplace_back( "OnCopyToFailed", RID_CUISTR_EVENT_COPYTODOCFAILED );
+ aDisplayNames.emplace_back( "OnPrint", RID_CUISTR_EVENT_PRINTDOC );
+ aDisplayNames.emplace_back( "OnModifyChanged", RID_CUISTR_EVENT_MODIFYCHANGED );
+ aDisplayNames.emplace_back( "OnTitleChanged", RID_CUISTR_EVENT_TITLECHANGED );
// application specific events
- aDisplayNames.emplace_back( "OnMailMerge", RID_SVXSTR_EVENT_MAILMERGE );
- aDisplayNames.emplace_back( "OnMailMergeFinished", RID_SVXSTR_EVENT_MAILMERGE_END );
- aDisplayNames.emplace_back( "OnFieldMerge", RID_SVXSTR_EVENT_FIELDMERGE );
- aDisplayNames.emplace_back( "OnFieldMergeFinished", RID_SVXSTR_EVENT_FIELDMERGE_FINISHED );
- aDisplayNames.emplace_back( "OnPageCountChange", RID_SVXSTR_EVENT_PAGECOUNTCHANGE );
- aDisplayNames.emplace_back( "OnSubComponentOpened", RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED );
- aDisplayNames.emplace_back( "OnSubComponentClosed", RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED );
- aDisplayNames.emplace_back( "OnSelect", RID_SVXSTR_EVENT_SELECTIONCHANGED );
- aDisplayNames.emplace_back( "OnDoubleClick", RID_SVXSTR_EVENT_DOUBLECLICK );
- aDisplayNames.emplace_back( "OnRightClick", RID_SVXSTR_EVENT_RIGHTCLICK );
- aDisplayNames.emplace_back( "OnCalculate", RID_SVXSTR_EVENT_CALCULATE );
- aDisplayNames.emplace_back( "OnChange", RID_SVXSTR_EVENT_CONTENTCHANGED );
+ aDisplayNames.emplace_back( "OnMailMerge", RID_CUISTR_EVENT_MAILMERGE );
+ aDisplayNames.emplace_back( "OnMailMergeFinished", RID_CUISTR_EVENT_MAILMERGE_END );
+ aDisplayNames.emplace_back( "OnFieldMerge", RID_CUISTR_EVENT_FIELDMERGE );
+ aDisplayNames.emplace_back( "OnFieldMergeFinished", RID_CUISTR_EVENT_FIELDMERGE_FINISHED );
+ aDisplayNames.emplace_back( "OnPageCountChange", RID_CUISTR_EVENT_PAGECOUNTCHANGE );
+ aDisplayNames.emplace_back( "OnSubComponentOpened", RID_CUISTR_EVENT_SUBCOMPONENT_OPENED );
+ aDisplayNames.emplace_back( "OnSubComponentClosed", RID_CUISTR_EVENT_SUBCOMPONENT_CLOSED );
+ aDisplayNames.emplace_back( "OnSelect", RID_CUISTR_EVENT_SELECTIONCHANGED );
+ aDisplayNames.emplace_back( "OnDoubleClick", RID_CUISTR_EVENT_DOUBLECLICK );
+ aDisplayNames.emplace_back( "OnRightClick", RID_CUISTR_EVENT_RIGHTCLICK );
+ aDisplayNames.emplace_back( "OnCalculate", RID_CUISTR_EVENT_CALCULATE );
+ aDisplayNames.emplace_back( "OnChange", RID_CUISTR_EVENT_CONTENTCHANGED );
// the event name to UI string mappings for forms & dialogs
- aDisplayNames.emplace_back( "approveAction", RID_SVXSTR_EVENT_APPROVEACTIONPERFORMED );
- aDisplayNames.emplace_back( "actionPerformed", RID_SVXSTR_EVENT_ACTIONPERFORMED );
- aDisplayNames.emplace_back( "changed", RID_SVXSTR_EVENT_CHANGED );
- aDisplayNames.emplace_back( "textChanged", RID_SVXSTR_EVENT_TEXTCHANGED );
- aDisplayNames.emplace_back( "itemStateChanged", RID_SVXSTR_EVENT_ITEMSTATECHANGED );
- aDisplayNames.emplace_back( "focusGained", RID_SVXSTR_EVENT_FOCUSGAINED );
- aDisplayNames.emplace_back( "focusLost", RID_SVXSTR_EVENT_FOCUSLOST );
- aDisplayNames.emplace_back( "keyPressed", RID_SVXSTR_EVENT_KEYTYPED );
- aDisplayNames.emplace_back( "keyReleased", RID_SVXSTR_EVENT_KEYUP );
- aDisplayNames.emplace_back( "mouseEntered", RID_SVXSTR_EVENT_MOUSEENTERED );
- aDisplayNames.emplace_back( "mouseDragged", RID_SVXSTR_EVENT_MOUSEDRAGGED );
- aDisplayNames.emplace_back( "mouseMoved", RID_SVXSTR_EVENT_MOUSEMOVED );
- aDisplayNames.emplace_back( "mousePressed", RID_SVXSTR_EVENT_MOUSEPRESSED );
- aDisplayNames.emplace_back( "mouseReleased", RID_SVXSTR_EVENT_MOUSERELEASED );
- aDisplayNames.emplace_back( "mouseExited", RID_SVXSTR_EVENT_MOUSEEXITED );
- aDisplayNames.emplace_back( "approveReset", RID_SVXSTR_EVENT_APPROVERESETTED );
- aDisplayNames.emplace_back( "resetted", RID_SVXSTR_EVENT_RESETTED );
- aDisplayNames.emplace_back( "approveSubmit", RID_SVXSTR_EVENT_SUBMITTED );
- aDisplayNames.emplace_back( "approveUpdate", RID_SVXSTR_EVENT_BEFOREUPDATE );
- aDisplayNames.emplace_back( "updated", RID_SVXSTR_EVENT_AFTERUPDATE );
- aDisplayNames.emplace_back( "loaded", RID_SVXSTR_EVENT_LOADED );
- aDisplayNames.emplace_back( "reloading", RID_SVXSTR_EVENT_RELOADING );
- aDisplayNames.emplace_back( "reloaded", RID_SVXSTR_EVENT_RELOADED );
- aDisplayNames.emplace_back( "unloading", RID_SVXSTR_EVENT_UNLOADING );
- aDisplayNames.emplace_back( "unloaded", RID_SVXSTR_EVENT_UNLOADED );
- aDisplayNames.emplace_back( "confirmDelete", RID_SVXSTR_EVENT_CONFIRMDELETE );
- aDisplayNames.emplace_back( "approveRowChange", RID_SVXSTR_EVENT_APPROVEROWCHANGE );
- aDisplayNames.emplace_back( "rowChanged", RID_SVXSTR_EVENT_ROWCHANGE );
- aDisplayNames.emplace_back( "approveCursorMove", RID_SVXSTR_EVENT_POSITIONING );
- aDisplayNames.emplace_back( "cursorMoved", RID_SVXSTR_EVENT_POSITIONED );
- aDisplayNames.emplace_back( "approveParameter", RID_SVXSTR_EVENT_APPROVEPARAMETER );
- aDisplayNames.emplace_back( "errorOccured", RID_SVXSTR_EVENT_ERROROCCURRED );
- aDisplayNames.emplace_back( "adjustmentValueChanged", RID_SVXSTR_EVENT_ADJUSTMENTVALUECHANGED );
+ aDisplayNames.emplace_back( "approveAction", RID_CUISTR_EVENT_APPROVEACTIONPERFORMED );
+ aDisplayNames.emplace_back( "actionPerformed", RID_CUISTR_EVENT_ACTIONPERFORMED );
+ aDisplayNames.emplace_back( "changed", RID_CUISTR_EVENT_CHANGED );
+ aDisplayNames.emplace_back( "textChanged", RID_CUISTR_EVENT_TEXTCHANGED );
+ aDisplayNames.emplace_back( "itemStateChanged", RID_CUISTR_EVENT_ITEMSTATECHANGED );
+ aDisplayNames.emplace_back( "focusGained", RID_CUISTR_EVENT_FOCUSGAINED );
+ aDisplayNames.emplace_back( "focusLost", RID_CUISTR_EVENT_FOCUSLOST );
+ aDisplayNames.emplace_back( "keyPressed", RID_CUISTR_EVENT_KEYTYPED );
+ aDisplayNames.emplace_back( "keyReleased", RID_CUISTR_EVENT_KEYUP );
+ aDisplayNames.emplace_back( "mouseEntered", RID_CUISTR_EVENT_MOUSEENTERED );
+ aDisplayNames.emplace_back( "mouseDragged", RID_CUISTR_EVENT_MOUSEDRAGGED );
+ aDisplayNames.emplace_back( "mouseMoved", RID_CUISTR_EVENT_MOUSEMOVED );
+ aDisplayNames.emplace_back( "mousePressed", RID_CUISTR_EVENT_MOUSEPRESSED );
+ aDisplayNames.emplace_back( "mouseReleased", RID_CUISTR_EVENT_MOUSERELEASED );
+ aDisplayNames.emplace_back( "mouseExited", RID_CUISTR_EVENT_MOUSEEXITED );
+ aDisplayNames.emplace_back( "approveReset", RID_CUISTR_EVENT_APPROVERESETTED );
+ aDisplayNames.emplace_back( "resetted", RID_CUISTR_EVENT_RESETTED );
+ aDisplayNames.emplace_back( "approveSubmit", RID_CUISTR_EVENT_SUBMITTED );
+ aDisplayNames.emplace_back( "approveUpdate", RID_CUISTR_EVENT_BEFOREUPDATE );
+ aDisplayNames.emplace_back( "updated", RID_CUISTR_EVENT_AFTERUPDATE );
+ aDisplayNames.emplace_back( "loaded", RID_CUISTR_EVENT_LOADED );
+ aDisplayNames.emplace_back( "reloading", RID_CUISTR_EVENT_RELOADING );
+ aDisplayNames.emplace_back( "reloaded", RID_CUISTR_EVENT_RELOADED );
+ aDisplayNames.emplace_back( "unloading", RID_CUISTR_EVENT_UNLOADING );
+ aDisplayNames.emplace_back( "unloaded", RID_CUISTR_EVENT_UNLOADED );
+ aDisplayNames.emplace_back( "confirmDelete", RID_CUISTR_EVENT_CONFIRMDELETE );
+ aDisplayNames.emplace_back( "approveRowChange", RID_CUISTR_EVENT_APPROVEROWCHANGE );
+ aDisplayNames.emplace_back( "rowChanged", RID_CUISTR_EVENT_ROWCHANGE );
+ aDisplayNames.emplace_back( "approveCursorMove", RID_CUISTR_EVENT_POSITIONING );
+ aDisplayNames.emplace_back( "cursorMoved", RID_CUISTR_EVENT_POSITIONED );
+ aDisplayNames.emplace_back( "approveParameter", RID_CUISTR_EVENT_APPROVEPARAMETER );
+ aDisplayNames.emplace_back( "errorOccured", RID_CUISTR_EVENT_ERROROCCURRED );
+ aDisplayNames.emplace_back( "adjustmentValueChanged", RID_CUISTR_EVENT_ADJUSTMENTVALUECHANGED );
}
// the following method is called when the user clicks OK
@@ -268,32 +272,31 @@ bool SvxMacroTabPage_::IsReadOnly() const
namespace
{
- OUString GetEventDisplayText(const OUString &rURL)
+ std::u16string_view GetEventDisplayText(std::u16string_view rURL)
{
- if (rURL.isEmpty())
- return OUString();
- sal_Int32 nIndex = rURL.indexOf(aVndSunStarUNO);
- bool bUNO = nIndex == 0;
- OUString aPureMethod;
+ if (rURL.empty())
+ return std::u16string_view();
+ bool bUNO = o3tl::starts_with(rURL, aVndSunStarUNO);
+ std::u16string_view aPureMethod;
if (bUNO)
{
- aPureMethod = rURL.copy(strlen(aVndSunStarUNO));
+ aPureMethod = rURL.substr(aVndSunStarUNO.getLength());
}
else
{
- aPureMethod = rURL.copy(strlen("vnd.sun.star.script:"));
- aPureMethod = aPureMethod.copy( 0, aPureMethod.indexOf( '?' ) );
+ aPureMethod = rURL.substr(strlen("vnd.sun.star.script:"));
+ aPureMethod = aPureMethod.substr( 0, aPureMethod.find( '?' ) );
}
return aPureMethod;
}
- OUString GetEventDisplayImage(const OUString &rURL)
+ OUString GetEventDisplayImage(std::u16string_view rURL)
{
- if (rURL.isEmpty())
+ if (rURL.empty())
return OUString();
- sal_Int32 nIndex = rURL.indexOf(aVndSunStarUNO);
+ size_t nIndex = rURL.find(aVndSunStarUNO);
bool bUNO = nIndex == 0;
- return bUNO ? OUString(RID_SVXBMP_COMPONENT) : OUString(RID_SVXBMP_MACRO);
+ return bUNO ? RID_SVXBMP_COMPONENT : RID_SVXBMP_MACRO;
}
}
@@ -304,6 +307,7 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents)
mpImpl->xEventLB->freeze();
mpImpl->xEventLB->clear();
+ m_nAssignedEvents = 0;
EventsHash* eventsHash;
Reference< container::XNameReplace> nameReplace;
if(bAppEvents)
@@ -319,7 +323,10 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents)
// have to use the original XNameReplace since the hash iterators do
// not guarantee the order in which the elements are returned
if(!nameReplace.is())
+ {
+ mpImpl->xEventLB->thaw();
return;
+ }
for (auto const& displayableEvent : aDisplayNames)
{
@@ -340,7 +347,10 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents)
int nRow = mpImpl->xEventLB->n_children();
mpImpl->xEventLB->append(sEventName, displayName);
mpImpl->xEventLB->set_image(nRow, GetEventDisplayImage(eventURL), 1);
- mpImpl->xEventLB->set_text(nRow, GetEventDisplayText(eventURL), 2);
+ mpImpl->xEventLB->set_text(nRow, OUString(GetEventDisplayText(eventURL)), 2);
+
+ if (!eventURL.isEmpty())
+ ++m_nAssignedEvents;
}
mpImpl->xEventLB->thaw();
@@ -370,20 +380,37 @@ IMPL_LINK_NOARG( SvxMacroTabPage_, SelectEvent_Impl, weld::TreeView&, void)
IMPL_LINK( SvxMacroTabPage_, AssignDeleteHdl_Impl, weld::Button&, rBtn, void )
{
- GenericHandler_Impl(this, &rBtn);
+ GenericHandler_Impl(&rBtn);
}
IMPL_LINK_NOARG( SvxMacroTabPage_, DoubleClickHdl_Impl, weld::TreeView&, bool)
{
- GenericHandler_Impl(this, nullptr);
+ GenericHandler_Impl(nullptr);
return true;
}
+const EventPair* SvxMacroTabPage_::LookupEvent(const OUString& rEventName)
+{
+ const EventPair* pRet = nullptr;
+ if (bAppEvents)
+ {
+ EventsHash::iterator h_it = m_appEventsHash.find(rEventName);
+ if (h_it != m_appEventsHash.end() )
+ pRet = &h_it->second;
+ }
+ else
+ {
+ EventsHash::iterator h_it = m_docEventsHash.find(rEventName);
+ if (h_it != m_docEventsHash.end() )
+ pRet = &h_it->second;
+ }
+ return pRet;
+}
+
// handler for double click on the listbox, and for the assign/delete buttons
-void SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::Button* pBtn)
+void SvxMacroTabPage_::GenericHandler_Impl(const weld::Button* pBtn)
{
- SvxMacroTabPage_Impl* pImpl = pThis->mpImpl.get();
- weld::TreeView& rListBox = *pImpl->xEventLB;
+ weld::TreeView& rListBox = *mpImpl->xEventLB;
int nEntry = rListBox.get_selected_index();
if (nEntry == -1)
{
@@ -391,95 +418,125 @@ void SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::
return;
}
- const bool bAssEnabled = pBtn != pImpl->xDeletePB.get() && pImpl->xAssignPB->get_sensitive();
+ const bool bAssEnabled = pBtn != mpImpl->xDeletePB.get() && mpImpl->xAssignPB->get_sensitive();
OUString sEventName = rListBox.get_id(nEntry);
OUString sEventURL;
OUString sEventType;
- if(pThis->bAppEvents)
+ if (const EventPair* pEventPair = LookupEvent(sEventName))
{
- EventsHash::iterator h_it = pThis->m_appEventsHash.find(sEventName);
- if(h_it != pThis->m_appEventsHash.end() )
- {
- sEventType = h_it->second.first;
- sEventURL = h_it->second.second;
- }
- }
- else
- {
- EventsHash::iterator h_it = pThis->m_docEventsHash.find(sEventName);
- if(h_it != pThis->m_docEventsHash.end() )
- {
- sEventType = h_it->second.first;
- sEventURL = h_it->second.second;
- }
+ sEventType = pEventPair->first;
+ sEventURL = pEventPair->second;
}
+ if (!sEventURL.isEmpty())
+ --m_nAssignedEvents;
+
bool bDoubleClick = (pBtn == nullptr);
bool bUNOAssigned = sEventURL.startsWith( aVndSunStarUNO );
- if( pBtn == pImpl->xDeletePB.get() )
+ if (pBtn == mpImpl->xDeletePB.get())
{
// delete pressed
sEventType = "Script" ;
sEventURL.clear();
- if(!pThis->bAppEvents)
- pThis->bDocModified = true;
+ if (!bAppEvents)
+ bDocModified = true;
}
else if ( ( ( pBtn != nullptr )
- && ( pBtn == pImpl->xAssignComponentPB.get() )
+ && ( pBtn == mpImpl->xAssignComponentPB.get() )
)
|| ( bDoubleClick
&& bUNOAssigned
)
)
{
- AssignComponentDialog aAssignDlg(pThis->GetFrameWeld(), sEventURL);
+ AssignComponentDialog aAssignDlg(GetFrameWeld(), sEventURL);
short ret = aAssignDlg.run();
if( ret )
{
sEventType = "UNO";
sEventURL = aAssignDlg.getURL();
- if(!pThis->bAppEvents)
- pThis->bDocModified = true;
+ if (!bAppEvents)
+ bDocModified = true;
}
}
else if( bAssEnabled )
{
// assign pressed
- SvxScriptSelectorDialog aDlg(pThis->GetFrameWeld(), pThis->GetFrame());
+ SvxScriptSelectorDialog aDlg(GetFrameWeld(), GetFrame());
short ret = aDlg.run();
if ( ret )
{
sEventType = "Script";
sEventURL = aDlg.GetScriptURL();
- if(!pThis->bAppEvents)
- pThis->bDocModified = true;
+ if (!bAppEvents)
+ bDocModified = true;
}
}
// update the hashes
- if(pThis->bAppEvents)
+ if (bAppEvents)
{
- EventsHash::iterator h_it = pThis->m_appEventsHash.find(sEventName);
+ EventsHash::iterator h_it = m_appEventsHash.find(sEventName);
h_it->second.first = sEventType;
h_it->second.second = sEventURL;
}
else
{
- EventsHash::iterator h_it = pThis->m_docEventsHash.find(sEventName);
+ EventsHash::iterator h_it = m_docEventsHash.find(sEventName);
h_it->second.first = sEventType;
h_it->second.second = sEventURL;
}
+ if (!sEventURL.isEmpty())
+ ++m_nAssignedEvents;
+
rListBox.set_image(nEntry, GetEventDisplayImage(sEventURL), 1);
- rListBox.set_text(nEntry, GetEventDisplayText(sEventURL), 2);
+ rListBox.set_text(nEntry, OUString(GetEventDisplayText(sEventURL)), 2);
rListBox.select(nEntry );
rListBox.scroll_to_row(nEntry);
- pThis->EnableButtons();
+ EnableButtons();
+}
+
+IMPL_LINK_NOARG(SvxMacroTabPage_, DeleteAllHdl_Impl, weld::Button&, void)
+{
+ OUString sEventType = "Script" ;
+ OUString sEmptyString;
+
+ mpImpl->xEventLB->all_foreach([this, &sEventType, &sEmptyString](weld::TreeIter& rEntry) {
+ weld::TreeView& rListBox = *mpImpl->xEventLB;
+ OUString sEventName = rListBox.get_id(rEntry);
+ // update the hashes
+ if (bAppEvents)
+ {
+ EventsHash::iterator h_it = m_appEventsHash.find(sEventName);
+ assert(h_it != m_appEventsHash.end());
+ h_it->second.first = sEventType;
+ h_it->second.second = sEmptyString;
+ }
+ else
+ {
+ EventsHash::iterator h_it = m_docEventsHash.find(sEventName);
+ assert(h_it != m_docEventsHash.end());
+ h_it->second.first = sEventType;
+ h_it->second.second = sEmptyString;
+ }
+
+ rListBox.set_image(rEntry, sEmptyString, 1);
+ rListBox.set_text(rEntry, sEmptyString, 2);
+ return false;
+ });
+
+ if (!bAppEvents)
+ bDocModified = true;
+
+ m_nAssignedEvents = 0;
+
+ EnableButtons();
}
// pass in the XNameReplace.
@@ -492,14 +549,17 @@ void SvxMacroTabPage_::InitAndSetHandler( const Reference< container::XNameRepla
Link<weld::Button&,void> aLnk(LINK(this, SvxMacroTabPage_, AssignDeleteHdl_Impl ));
mpImpl->xDeletePB->connect_clicked(aLnk);
mpImpl->xAssignPB->connect_clicked(aLnk);
+ mpImpl->xDeleteAllPB->connect_clicked(LINK(this, SvxMacroTabPage_, DeleteAllHdl_Impl));
if( mpImpl->xAssignComponentPB )
mpImpl->xAssignComponentPB->connect_clicked( aLnk );
mpImpl->xEventLB->connect_row_activated( LINK(this, SvxMacroTabPage_, DoubleClickHdl_Impl ) );
mpImpl->xEventLB->connect_changed( LINK( this, SvxMacroTabPage_, SelectEvent_Impl ));
- std::vector<int> aWidths;
- aWidths.push_back(mpImpl->xEventLB->get_approximate_digit_width() * 32);
- aWidths.push_back(mpImpl->xEventLB->get_checkbox_column_width());
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(mpImpl->xEventLB->get_approximate_digit_width() * 32),
+ mpImpl->xEventLB->get_checkbox_column_width()
+ };
mpImpl->xEventLB->set_column_fixed_widths(aWidths);
mpImpl->xEventLB->show();
@@ -542,7 +602,7 @@ void SvxMacroTabPage_::InitAndSetHandler( const Reference< container::XNameRepla
// returns the two props EventType & Script for a given event name
Any SvxMacroTabPage_::GetPropsByName( const OUString& eventName, EventsHash& eventsHash )
{
- const std::pair< OUString, OUString >& rAssignedEvent( eventsHash[ eventName ] );
+ const EventPair& rAssignedEvent(eventsHash[eventName]);
Any aReturn;
::comphelper::NamedValueCollection aProps;
@@ -558,7 +618,7 @@ Any SvxMacroTabPage_::GetPropsByName( const OUString& eventName, EventsHash& eve
// converts the Any returned by GetByName into a pair which can be stored in
// the EventHash
-std::pair< OUString, OUString > SvxMacroTabPage_::GetPairFromAny( const Any& aAny )
+EventPair SvxMacroTabPage_::GetPairFromAny( const Any& aAny )
{
Sequence< beans::PropertyValue > props;
OUString type, url;
@@ -583,6 +643,7 @@ SvxMacroTabPage::SvxMacroTabPage(weld::Container* pPage, weld::DialogController*
mpImpl->xEventLB->get_height_rows(9));
mpImpl->xAssignPB = m_xBuilder->weld_button("assign");
mpImpl->xDeletePB = m_xBuilder->weld_button("delete");
+ mpImpl->xDeleteAllPB = m_xBuilder->weld_button("deleteall");
mpImpl->xAssignComponentPB = m_xBuilder->weld_button("component");
SetFrame( _rxDocumentFrame );
@@ -619,9 +680,9 @@ IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, weld::Button&, void)
m_xDialog->response(RET_OK);
}
-AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, const OUString& rURL)
+AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, OUString aURL)
: GenericDialogController(pParent, "cui/ui/assigncomponentdialog.ui", "AssignComponent")
- , maURL( rURL )
+ , maURL(std::move( aURL ))
, mxMethodEdit(m_xBuilder->weld_entry("methodEntry"))
, mxOKButton(m_xBuilder->weld_button("ok"))
{
@@ -630,7 +691,7 @@ AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, const OUStri
OUString aMethodName;
if( maURL.startsWith( aVndSunStarUNO ) )
{
- aMethodName = maURL.copy( strlen(aVndSunStarUNO) );
+ aMethodName = maURL.copy( aVndSunStarUNO.getLength() );
}
mxMethodEdit->set_text(aMethodName);
mxMethodEdit->select_region(0, -1);
diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx
index 2a36d0f5cada..1073e4bb36ff 100644
--- a/cui/source/customize/macropg_impl.hxx
+++ b/cui/source/customize/macropg_impl.hxx
@@ -30,6 +30,7 @@ public:
std::unique_ptr<weld::Button> xAssignPB;
std::unique_ptr<weld::Button> xAssignComponentPB;
std::unique_ptr<weld::Button> xDeletePB;
+ std::unique_ptr<weld::Button> xDeleteAllPB;
std::unique_ptr<weld::TreeView> xEventLB;
bool bReadOnly;
bool bIDEDialogMode;
@@ -46,7 +47,7 @@ private:
DECL_LINK(ButtonHandler, weld::Button&, void);
public:
- AssignComponentDialog(weld::Window* pParent, const OUString& rURL);
+ AssignComponentDialog(weld::Window* pParent, OUString aURL);
virtual ~AssignComponentDialog() override;
const OUString& getURL() const { return maURL; }
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index c41e6c262d0e..4d39ad937664 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -12,7 +12,6 @@
#include <algorithm>
#include <cmath>
-#include <string_view>
#include <config_folders.h>
@@ -30,7 +29,7 @@
#include <rtl/bootstrap.hxx>
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/processfactory.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
@@ -52,21 +51,17 @@
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <orcus/json_document_tree.hpp>
+#include <orcus/json_parser.hpp>
#include <orcus/config.hpp>
-#include <orcus/pstring.hpp>
+
+#include <bitmaps.hlst>
#define PAGE_SIZE 30
using namespace css;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::XComponentContext;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::Exception;
-using ::com::sun::star::graphic::GraphicProvider;
-using ::com::sun::star::graphic::XGraphicProvider;
using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::graphic::XGraphic;
using namespace com::sun::star;
using namespace ::com::sun::star::uno;
@@ -131,7 +126,15 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd
if (rResponse.empty())
return;
- aJsonDoc.load(rResponse, aConfig);
+ try
+ {
+ aJsonDoc.load(rResponse, aConfig);
+ }
+ catch (const orcus::parse_error&)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "Invalid JSON file from the extensions API");
+ return;
+ }
auto aDocumentRoot = aJsonDoc.get_document_root();
if (aDocumentRoot.type() != orcus::json::node_t::object)
@@ -149,62 +152,37 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd
try
{
AdditionInfo aNewAddition = {
- OStringToOUString(std::string_view(arrayElement.child("id").string_value().get()),
+ OStringToOUString(arrayElement.child("id").string_value(), RTL_TEXTENCODING_UTF8),
+ OStringToOUString(arrayElement.child("name").string_value(), RTL_TEXTENCODING_UTF8),
+ OStringToOUString(arrayElement.child("author").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(std::string_view(arrayElement.child("name").string_value().get()),
+ OStringToOUString(arrayElement.child("url").string_value(), RTL_TEXTENCODING_UTF8),
+ OStringToOUString(arrayElement.child("screenshotURL").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(
- std::string_view(arrayElement.child("author").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(std::string_view(arrayElement.child("url").string_value().get()),
+ OStringToOUString(arrayElement.child("extensionIntroduction").string_value(),
+ RTL_TEXTENCODING_UTF8),
+ OStringToOUString(arrayElement.child("extensionDescription").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- std::string_view(arrayElement.child("screenshotURL").string_value().get()),
+ arrayElement.child("releases").child(0).child("compatibility").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- std::string_view(
- arrayElement.child("extensionIntroduction").string_value().get()),
+ arrayElement.child("releases").child(0).child("releaseName").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- std::string_view(
- arrayElement.child("extensionDescription").string_value().get()),
+ arrayElement.child("releases").child(0).child("license").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(std::string_view(arrayElement.child("releases")
- .child(0)
- .child("compatibility")
- .string_value()
- .get()),
+ OStringToOUString(arrayElement.child("commentNumber").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(std::string_view(arrayElement.child("releases")
- .child(0)
- .child("releaseName")
- .string_value()
- .get()),
+ OStringToOUString(arrayElement.child("commentURL").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(std::string_view(arrayElement.child("releases")
- .child(0)
- .child("license")
- .string_value()
- .get()),
+ OStringToOUString(arrayElement.child("rating").string_value(),
+ RTL_TEXTENCODING_UTF8),
+ OStringToOUString(arrayElement.child("downloadNumber").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- std::string_view(arrayElement.child("commentNumber").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(
- std::string_view(arrayElement.child("commentURL").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(
- std::string_view(arrayElement.child("rating").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(
- std::string_view(arrayElement.child("downloadNumber").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(std::string_view(arrayElement.child("releases")
- .child(0)
- .child("downloadURL")
- .string_value()
- .get()),
- RTL_TEXTENCODING_UTF8)
+ arrayElement.child("releases").child(0).child("downloadURL").string_value(),
+ RTL_TEXTENCODING_UTF8)
};
aAdditions.push_back(aNewAddition);
@@ -247,7 +225,7 @@ bool getPreviewFile(const AdditionInfo& aAdditionInfo, OUString& sPreviewFile)
return true;
}
-void LoadImage(const OUString& rPreviewFile, std::shared_ptr<AdditionsItem> pCurrentItem)
+void LoadImage(std::u16string_view rPreviewFile, std::shared_ptr<AdditionsItem> pCurrentItem)
{
const sal_Int8 Margin = 6;
@@ -297,6 +275,11 @@ SearchAndParseThread::SearchAndParseThread(AdditionsDialog* pDialog, const bool
, m_bExecute(true)
, m_bIsFirstLoading(isFirstLoading)
{
+ // if we are running a UITest, e.g. UITest_sw_options then
+ // don't attempt to downloading anything
+ static const bool bUITest = getenv("LIBO_TEST_UNIT");
+
+ m_bUITest = bUITest;
}
SearchAndParseThread::~SearchAndParseThread() {}
@@ -306,7 +289,8 @@ void SearchAndParseThread::Append(AdditionInfo& additionInfo)
if (!m_bExecute)
return;
OUString aPreviewFile;
- bool bResult = getPreviewFile(additionInfo, aPreviewFile); // info vector json data
+ bool bResult
+ = !m_bUITest && getPreviewFile(additionInfo, aPreviewFile); // info vector json data
if (!bResult)
{
@@ -365,7 +349,7 @@ void SearchAndParseThread::Search()
void SearchAndParseThread::CheckInstalledExtensions()
{
- uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> xAllPackages
+ const uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> xAllPackages
= m_pAdditionsDialog->getInstalledExtensions();
if (!xAllPackages.hasElements())
@@ -399,7 +383,7 @@ void SearchAndParseThread::CheckInstalledExtensions()
SolarMutexGuard aGuard;
rInfo->m_xButtonInstall->set_sensitive(false);
rInfo->m_xButtonInstall->set_label(
- CuiResId(RID_SVXSTR_ADDITIONS_INSTALLEDBUTTON));
+ CuiResId(RID_CUISTR_ADDITIONS_INSTALLEDBUTTON));
}
}
}
@@ -411,16 +395,16 @@ void SearchAndParseThread::execute()
{
OUString sProgress;
if (m_bIsFirstLoading)
- sProgress = CuiResId(RID_SVXSTR_ADDITIONS_LOADING);
+ sProgress = CuiResId(RID_CUISTR_ADDITIONS_LOADING);
else
- sProgress = CuiResId(RID_SVXSTR_ADDITIONS_SEARCHING);
+ sProgress = CuiResId(RID_CUISTR_ADDITIONS_SEARCHING);
m_pAdditionsDialog->SetProgress(
sProgress); // Loading or searching according to being first call or not
if (m_bIsFirstLoading)
{
- std::string sResponse = ucbGet(m_pAdditionsDialog->m_sURL);
+ std::string sResponse = !m_bUITest ? ucbGet(m_pAdditionsDialog->m_sURL) : "";
parseResponse(sResponse, m_pAdditionsDialog->m_aAllExtensionsVector);
std::sort(m_pAdditionsDialog->m_aAllExtensionsVector.begin(),
m_pAdditionsDialog->m_aAllExtensionsVector.end(),
@@ -442,10 +426,9 @@ void SearchAndParseThread::execute()
AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag)
: GenericDialogController(pParent, "cui/ui/additionsdialog.ui", "AdditionsDialog")
- , m_aSearchDataTimer("SearchDataTimer")
+ , m_aSearchDataTimer("AdditionsDialog SearchDataTimer")
, m_xEntrySearch(m_xBuilder->weld_entry("entrySearch"))
, m_xButtonClose(m_xBuilder->weld_button("buttonClose"))
- , m_xMenuButtonSettings(m_xBuilder->weld_menu_button("buttonGear"))
, m_xContentWindow(m_xBuilder->weld_scrolled_window("contentWindow"))
, m_xContentGrid(m_xBuilder->weld_container("contentGrid"))
, m_xLabelProgress(m_xBuilder->weld_label("labelProgress"))
@@ -455,7 +438,6 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditio
m_xGearBtn->set_item_active("gear_sort_voting", true);
m_aSearchDataTimer.SetInvokeHandler(LINK(this, AdditionsDialog, ImplUpdateDataHdl));
- m_aSearchDataTimer.SetDebugName("AdditionsDialog SearchDataTimer");
m_aSearchDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
m_xEntrySearch->connect_changed(LINK(this, AdditionsDialog, SearchUpdateHdl));
@@ -466,19 +448,43 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditio
m_nMaxItemCount = PAGE_SIZE; // Dialog initialization item count
m_nCurrentListItemCount = 0; // First, there is no item on the list.
- OUString titlePrefix = CuiResId(RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX);
+ OUString titlePrefix = CuiResId(RID_CUISTR_ADDITIONS_DIALOG_TITLE_PREFIX);
if (!m_sTag.isEmpty())
- {
- this->set_title(titlePrefix + ": " + sAdditionsTag);
+ { // tdf#142564 localize extension category names
+ OUString sDialogTitle = "";
+ if (sAdditionsTag == "Templates")
+ {
+ sDialogTitle = CuiResId(RID_CUISTR_ADDITIONS_TEMPLATES);
+ }
+ else if (sAdditionsTag == "Dictionary")
+ {
+ sDialogTitle = CuiResId(RID_CUISTR_ADDITIONS_DICTIONARY);
+ }
+ else if (sAdditionsTag == "Gallery")
+ {
+ sDialogTitle = CuiResId(RID_CUISTR_ADDITIONS_GALLERY);
+ }
+ else if (sAdditionsTag == "Icons")
+ {
+ sDialogTitle = CuiResId(RID_CUISTR_ADDITIONS_ICONS);
+ }
+ else if (sAdditionsTag == "Color Palette")
+ {
+ sDialogTitle = CuiResId(RID_CUISTR_ADDITIONS_PALETTES);
+ }
+ this->set_title(sDialogTitle);
}
else
{
this->set_title(titlePrefix);
m_sTag = "allextensions"; // Means empty parameter
}
- //FIXME: Temporary URL
- OUString rURL = "https://libreoffice.yusufketen.com/api/" + m_sTag + ".json";
- m_sURL = rURL;
+
+ OUString sEncodedURLPart = INetURLObject::encode(m_sTag, INetURLObject::PART_PCHAR,
+ INetURLObject::EncodeMechanism::All);
+
+ //FIXME: Temporary URL - v0 is not using actual api
+ m_sURL = "https://extensions.libreoffice.org/api/v0/" + sEncodedURLPart + ".json";
m_xExtensionManager
= deployment::ExtensionManager::get(::comphelper::getProcessComponentContext());
@@ -598,19 +604,15 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial
, m_xLinkButtonWebsite(m_xBuilder->weld_link_button("btnWebsite"))
, m_xLabelName(m_xBuilder->weld_label("lbName"))
, m_xLabelAuthor(m_xBuilder->weld_label("labelAuthor"))
- , m_xLabelDesc(m_xBuilder->weld_label("labelDesc")) // no change (print description)
, m_xLabelDescription(m_xBuilder->weld_label("labelDescription"))
, m_xLabelLicense(m_xBuilder->weld_label("lbLicenseText"))
, m_xLabelVersion(m_xBuilder->weld_label("lbVersionText"))
- , m_xLabelComments(m_xBuilder->weld_label("labelComments")) // no change
, m_xLinkButtonComments(m_xBuilder->weld_link_button("linkButtonComments"))
, m_xImageVoting1(m_xBuilder->weld_image("imageVoting1"))
, m_xImageVoting2(m_xBuilder->weld_image("imageVoting2"))
, m_xImageVoting3(m_xBuilder->weld_image("imageVoting3"))
, m_xImageVoting4(m_xBuilder->weld_image("imageVoting4"))
, m_xImageVoting5(m_xBuilder->weld_image("imageVoting5"))
- , m_xLabelNoVoting(m_xBuilder->weld_label("votingLabel"))
- , m_xImageDownloadNumber(m_xBuilder->weld_image("imageDownloadNumber"))
, m_xLabelDownloadNumber(m_xBuilder->weld_label("labelDownloadNumber"))
, m_xButtonShowMore(m_xBuilder->weld_button("buttonShowMore"))
, m_pParentDialog(pParentDialog)
@@ -629,8 +631,8 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial
if (additionInfo.sName.getLength() > maxExtensionNameLength)
{
- OUString sShortName = additionInfo.sName.copy(0, maxExtensionNameLength - 3);
- sExtensionName = sShortName + "...";
+ std::u16string_view sShortName = additionInfo.sName.subView(0, maxExtensionNameLength - 3);
+ sExtensionName = OUString::Concat(sShortName) + "...";
}
else
{
@@ -643,19 +645,19 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial
switch (std::isnan(aExtensionRating) ? 0 : int(std::clamp(aExtensionRating, 0.0, 5.0)))
{
case 5:
- m_xImageVoting5->set_from_icon_name("cmd/sc_stars-full.png");
+ m_xImageVoting5->set_from_icon_name(RID_SVXBMP_STARS_FULL);
[[fallthrough]];
case 4:
- m_xImageVoting4->set_from_icon_name("cmd/sc_stars-full.png");
+ m_xImageVoting4->set_from_icon_name(RID_SVXBMP_STARS_FULL);
[[fallthrough]];
case 3:
- m_xImageVoting3->set_from_icon_name("cmd/sc_stars-full.png");
+ m_xImageVoting3->set_from_icon_name(RID_SVXBMP_STARS_FULL);
[[fallthrough]];
case 2:
- m_xImageVoting2->set_from_icon_name("cmd/sc_stars-full.png");
+ m_xImageVoting2->set_from_icon_name(RID_SVXBMP_STARS_FULL);
[[fallthrough]];
case 1:
- m_xImageVoting1->set_from_icon_name("cmd/sc_stars-full.png");
+ m_xImageVoting1->set_from_icon_name(RID_SVXBMP_STARS_FULL);
break;
}
@@ -665,7 +667,7 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial
if (!additionInfo.sAuthorName.equalsIgnoreAsciiCase("null"))
m_xLabelAuthor->set_label(additionInfo.sAuthorName);
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xLabelLicense->set_label(additionInfo.sLicense);
m_xLabelVersion->set_label(">=" + additionInfo.sCompatibleVersion);
m_xLinkButtonComments->set_label(additionInfo.sCommentNumber);
@@ -690,21 +692,21 @@ bool AdditionsItem::getExtensionFile(OUString& sExtensionFile)
rtl::Bootstrap::expandMacros(userFolder);
userFolder += "/user/additions/" + m_sExtensionID + "/";
- OUString aExtesionsFile(INetURLObject(m_sDownloadURL).getName());
- OUString aExtesionsURL = m_sDownloadURL;
+ OUString aExtensionsFile(INetURLObject(m_sDownloadURL).getName());
+ OUString aExtensionsURL = m_sDownloadURL;
try
{
osl::Directory::createPath(userFolder);
- if (!xFileAccess->exists(userFolder + aExtesionsFile))
- ucbDownload(aExtesionsURL, userFolder, aExtesionsFile);
+ if (!xFileAccess->exists(userFolder + aExtensionsFile))
+ ucbDownload(aExtensionsURL, userFolder, aExtensionsFile);
}
catch (const uno::Exception&)
{
return false;
}
- sExtensionFile = userFolder + aExtesionsFile;
+ sExtensionFile = userFolder + aExtensionsFile;
return true;
}
@@ -743,14 +745,14 @@ IMPL_LINK_NOARG(AdditionsItem, ShowMoreHdl, weld::Button&, void)
IMPL_LINK_NOARG(AdditionsItem, InstallHdl, weld::Button&, void)
{
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLING));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLING));
m_xButtonInstall->set_sensitive(false);
OUString aExtensionFile;
bool bResult = getExtensionFile(aExtensionFile); // info vector json data
if (!bResult)
{
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xButtonInstall->set_sensitive(true);
SAL_INFO("cui.dialogs", "Couldn't get the extension file.");
@@ -763,36 +765,36 @@ IMPL_LINK_NOARG(AdditionsItem, InstallHdl, weld::Button&, void)
{
m_pParentDialog->m_xExtensionManager->addExtension(
aExtensionFile, uno::Sequence<beans::NamedValue>(), "user", xAbortChannel, pCmdEnv);
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLEDBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLEDBUTTON));
}
catch (const ucb::CommandFailedException)
{
TOOLS_WARN_EXCEPTION("cui.dialogs", "");
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xButtonInstall->set_sensitive(true);
}
catch (const ucb::CommandAbortedException)
{
TOOLS_WARN_EXCEPTION("cui.dialogs", "");
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xButtonInstall->set_sensitive(true);
}
catch (const deployment::DeploymentException)
{
TOOLS_WARN_EXCEPTION("cui.dialogs", "");
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xButtonInstall->set_sensitive(true);
}
catch (const lang::IllegalArgumentException)
{
TOOLS_WARN_EXCEPTION("cui.dialogs", "");
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xButtonInstall->set_sensitive(true);
}
catch (const css::uno::Exception)
{
TOOLS_WARN_EXCEPTION("cui.dialogs", "");
- m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
m_xButtonInstall->set_sensitive(true);
}
}
@@ -845,7 +847,7 @@ void TmpRepositoryCommandEnv::update(uno::Any const& /*Status */) {}
void TmpRepositoryCommandEnv::pop() {}
-IMPL_LINK(AdditionsDialog, GearHdl, const OString&, rIdent, void)
+IMPL_LINK(AdditionsDialog, GearHdl, const OUString&, rIdent, void)
{
if (rIdent == "gear_sort_voting")
{
diff --git a/cui/source/dialogs/DiagramDialog.cxx b/cui/source/dialogs/DiagramDialog.cxx
index 97ae0ca3d80d..b63d6cb6e313 100644
--- a/cui/source/dialogs/DiagramDialog.cxx
+++ b/cui/source/dialogs/DiagramDialog.cxx
@@ -10,20 +10,24 @@
#include <DiagramDialog.hxx>
#include <comphelper/dispatchcommand.hxx>
-#include <svx/DiagramDataInterface.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdundo.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <svx/diagram/datamodel.hxx>
+#include <svx/diagram/IDiagramHelper.hxx>
-DiagramDialog::DiagramDialog(weld::Window* pWindow,
- std::shared_ptr<DiagramDataInterface> pDiagramData)
+DiagramDialog::DiagramDialog(weld::Window* pWindow, SdrObjGroup& rDiagram)
: GenericDialogController(pWindow, "cui/ui/diagramdialog.ui", "DiagramDialog")
- , mpDiagramData(pDiagramData)
- , mpBtnOk(m_xBuilder->weld_button("btnOk"))
+ , m_rDiagram(rDiagram)
+ , m_nUndos(0)
, mpBtnCancel(m_xBuilder->weld_button("btnCancel"))
, mpBtnAdd(m_xBuilder->weld_button("btnAdd"))
, mpBtnRemove(m_xBuilder->weld_button("btnRemove"))
, mpTreeDiagram(m_xBuilder->weld_tree_view("treeDiagram"))
, mpTextAdd(m_xBuilder->weld_text_view("textAdd"))
{
+ mpBtnCancel->connect_clicked(LINK(this, DiagramDialog, OnAddCancel));
mpBtnAdd->connect_clicked(LINK(this, DiagramDialog, OnAddClick));
mpBtnRemove->connect_clicked(LINK(this, DiagramDialog, OnRemoveClick));
@@ -37,12 +41,51 @@ DiagramDialog::DiagramDialog(weld::Window* pWindow,
});
}
+IMPL_LINK_NOARG(DiagramDialog, OnAddCancel, weld::Button&, void)
+{
+ // If the user cancels the dialog, undo all changes done so far. It may
+ // even be feasible to then delete the redo-stack, since it stays
+ // available (?) - but it does no harm either...
+ while (0 != m_nUndos)
+ {
+ comphelper::dispatchCommand(".uno:Undo", {});
+ m_nUndos--;
+ }
+
+ m_xDialog->response(RET_CANCEL);
+}
+
IMPL_LINK_NOARG(DiagramDialog, OnAddClick, weld::Button&, void)
{
+ if (!m_rDiagram.isDiagram())
+ return;
+
OUString sText = mpTextAdd->get_text();
- if (!sText.isEmpty())
+ const std::shared_ptr< svx::diagram::IDiagramHelper >& pDiagramHelper(m_rDiagram.getDiagramHelper());
+
+ if (pDiagramHelper && !sText.isEmpty())
{
- OUString sNodeId = mpDiagramData->addNode(sText);
+ SdrModel& rDrawModel(m_rDiagram.getSdrModelFromSdrObject());
+ const bool bUndo(rDrawModel.IsUndoEnabled());
+ svx::diagram::DiagramDataStatePtr aStartState;
+
+ if (bUndo)
+ {
+ // rescue all start state Diagram-defining data
+ aStartState = pDiagramHelper->extractDiagramDataState();
+ }
+
+ OUString sNodeId = pDiagramHelper->addNode(sText);
+
+ if (bUndo)
+ {
+ // create undo action. That will internally secure the
+ // current Diagram-defining data as end state
+ rDrawModel.AddUndo(
+ rDrawModel.GetSdrUndoFactory().CreateUndoDiagramModelData(m_rDiagram, aStartState));
+ m_nUndos++;
+ }
+
std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator());
mpTreeDiagram->insert(nullptr, -1, &sText, &sNodeId, nullptr, nullptr, false, pEntry.get());
mpTreeDiagram->select(*pEntry);
@@ -52,11 +95,35 @@ IMPL_LINK_NOARG(DiagramDialog, OnAddClick, weld::Button&, void)
IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void)
{
+ if (!m_rDiagram.isDiagram())
+ return;
+
std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator());
- if (mpTreeDiagram->get_selected(pEntry.get()))
+ const std::shared_ptr< svx::diagram::IDiagramHelper >& pDiagramHelper(m_rDiagram.getDiagramHelper());
+
+ if (pDiagramHelper && mpTreeDiagram->get_selected(pEntry.get()))
{
- if (mpDiagramData->removeNode(mpTreeDiagram->get_id(*pEntry)))
+ SdrModel& rDrawModel(m_rDiagram.getSdrModelFromSdrObject());
+ const bool bUndo(rDrawModel.IsUndoEnabled());
+ svx::diagram::DiagramDataStatePtr aStartState;
+
+ if (bUndo)
{
+ // rescue all start state Diagram-defining data
+ aStartState = pDiagramHelper->extractDiagramDataState();
+ }
+
+ if (pDiagramHelper->removeNode(mpTreeDiagram->get_id(*pEntry)))
+ {
+ if (bUndo)
+ {
+ // create undo action. That will internally secure the
+ // current Diagram-defining data as end state
+ rDrawModel.AddUndo(rDrawModel.GetSdrUndoFactory().CreateUndoDiagramModelData(
+ m_rDiagram, aStartState));
+ m_nUndos++;
+ }
+
mpTreeDiagram->remove(*pEntry);
comphelper::dispatchCommand(".uno:RegenerateDiagram", {});
}
@@ -65,7 +132,15 @@ IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void)
void DiagramDialog::populateTree(const weld::TreeIter* pParent, const OUString& rParentId)
{
- auto aItems = mpDiagramData->getChildren(rParentId);
+ if (!m_rDiagram.isDiagram())
+ return;
+
+ const std::shared_ptr< svx::diagram::IDiagramHelper >& pDiagramHelper(m_rDiagram.getDiagramHelper());
+
+ if (!pDiagramHelper)
+ return;
+
+ auto aItems = pDiagramHelper->getChildren(rParentId);
for (auto& aItem : aItems)
{
std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator());
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx
index fae448b6a283..e9aba0a6e409 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -10,20 +10,25 @@
#include <FontFeaturesDialog.hxx>
#include <rtl/ustrbuf.hxx>
+#include <utility>
#include <vcl/font/FeatureParser.hxx>
-#include <vcl/virdev.hxx>
-#include <svtools/colorcfg.hxx>
+#include <FontFeatures.hxx>
#include <unordered_set>
using namespace css;
namespace cui
{
-FontFeaturesDialog::FontFeaturesDialog(weld::Window* pParent, OUString const& rFontName)
+FontFeaturesDialog::FontFeaturesDialog(weld::Window* pParent, OUString aFontName)
: GenericDialogController(pParent, "cui/ui/fontfeaturesdialog.ui", "FontFeaturesDialog")
- , m_sFontName(rFontName)
+ , m_sFontName(std::move(aFontName))
, m_xContentWindow(m_xBuilder->weld_scrolled_window("contentWindow"))
+ , m_xContentBox(m_xBuilder->weld_container("contentBox"))
, m_xContentGrid(m_xBuilder->weld_container("contentGrid"))
+ , m_xStylisticSetsBox(m_xBuilder->weld_container("stylisticSetsBox"))
+ , m_xStylisticSetsGrid(m_xBuilder->weld_container("stylisticSetsGrid"))
+ , m_xCharacterVariantsBox(m_xBuilder->weld_container("characterVariantsBox"))
+ , m_xCharacterVariantsGrid(m_xBuilder->weld_container("characterVariantsGrid"))
, m_xPreviewWindow(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWindow))
{
initialize();
@@ -50,75 +55,95 @@ static sal_Int32 makeEnumComboBox(weld::ComboBox& rNameBox,
void FontFeaturesDialog::initialize()
{
ScopedVclPtrInstance<VirtualDevice> aVDev(*Application::GetDefaultDevice(),
- DeviceFormat::DEFAULT, DeviceFormat::DEFAULT);
- aVDev->SetOutputSizePixel(Size(10, 10));
-
- vcl::Font aFont = aVDev->GetFont();
- aFont.SetFamilyName(m_sFontName);
- aVDev->SetFont(aFont);
-
- std::vector<vcl::font::Feature> rFontFeatures;
-
- if (!aVDev->GetFontFeatures(rFontFeatures))
- return;
+ DeviceFormat::WITH_ALPHA);
+ std::vector<vcl::font::Feature> rFontFeatures = getFontFeatureList(m_sFontName, *aVDev);
std::unordered_set<sal_uInt32> aDoneFeatures;
std::vector<vcl::font::Feature> rFilteredFontFeatures;
for (vcl::font::Feature const& rFontFeature : rFontFeatures)
{
- sal_uInt32 nFontFeatureCode = rFontFeature.m_aID.m_aFeatureCode;
+ sal_uInt32 nFontFeatureCode = rFontFeature.m_nCode;
if (!aDoneFeatures.insert(nFontFeatureCode).second)
continue;
rFilteredFontFeatures.push_back(rFontFeature);
}
- fillGrid(rFilteredFontFeatures);
+ int nRowHeight = fillGrid(rFilteredFontFeatures);
+ auto nFeaturesHeight = m_xContentBox->get_preferred_size().Height()
+ + m_xStylisticSetsBox->get_preferred_size().Height()
+ + m_xCharacterVariantsBox->get_preferred_size().Height();
m_xContentWindow->set_size_request(
- -1, std::min(std::max(m_xContentWindow->get_preferred_size().Height(),
- m_xContentGrid->get_preferred_size().Height()),
+ -1, std::min(std::max(m_xContentWindow->get_preferred_size().Height(), nFeaturesHeight),
static_cast<tools::Long>(300L)));
+ if (nRowHeight)
+ {
+ // tdf#141333 use row height + the 6 px spacing of contentGrid
+ m_xContentWindow->vadjustment_set_step_increment(nRowHeight + 6);
+ }
+
updateFontPreview();
}
-void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures)
+int FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures)
{
+ int nRowHeight(0);
+
vcl::font::FeatureParser aParser(m_sFontName);
auto aExistingFeatures = aParser.getFeaturesMap();
- sal_Int32 i = 0;
+ sal_Int32 nIdx, nStylisticSets(0), nCharacterVariants(0), nOtherFeatures(0);
for (vcl::font::Feature const& rFontFeature : rFontFeatures)
{
- sal_uInt32 nFontFeatureCode = rFontFeature.m_aID.m_aFeatureCode;
+ sal_uInt32 nFontFeatureCode = rFontFeature.m_nCode;
vcl::font::FeatureDefinition aDefinition;
if (rFontFeature.m_aDefinition)
aDefinition = rFontFeature.m_aDefinition;
if (!aDefinition)
- aDefinition = { nFontFeatureCode, nullptr };
+ aDefinition = { nFontFeatureCode, "" };
- m_aFeatureItems.emplace_back(m_xContentGrid.get());
+ if (rFontFeature.isStylisticSet())
+ {
+ nIdx = nStylisticSets++;
+ m_xStylisticSetsBox->set_visible(true);
+ m_aFeatureItems.emplace_back(
+ std::make_unique<FontFeatureItem>(m_xStylisticSetsGrid.get()));
+ }
+ else if (rFontFeature.isCharacterVariant())
+ {
+ nIdx = nCharacterVariants++;
+ m_xCharacterVariantsBox->set_visible(true);
+ m_aFeatureItems.emplace_back(
+ std::make_unique<FontFeatureItem>(m_xCharacterVariantsGrid.get()));
+ }
+ else
+ {
+ nIdx = nOtherFeatures++;
+ m_xContentBox->set_visible(true);
+ m_aFeatureItems.emplace_back(std::make_unique<FontFeatureItem>(m_xContentGrid.get()));
+ }
- uint32_t nValue = 0;
+ int32_t nValue = 0;
if (aExistingFeatures.find(nFontFeatureCode) != aExistingFeatures.end())
nValue = aExistingFeatures.at(nFontFeatureCode);
else
nValue = aDefinition.getDefault();
- FontFeatureItem& aCurrentItem = m_aFeatureItems.back();
+ FontFeatureItem& aCurrentItem = *m_aFeatureItems.back();
aCurrentItem.m_aFeatureCode = nFontFeatureCode;
aCurrentItem.m_nDefault = aDefinition.getDefault();
- sal_Int32 nGridPositionX = (i % 2) * 2;
- sal_Int32 nGridPositionY = i / 2;
+ sal_Int32 nGridPositionX = (nIdx % 2) * 2;
+ sal_Int32 nGridPositionY = nIdx / 2;
aCurrentItem.m_xContainer->set_grid_left_attach(nGridPositionX);
aCurrentItem.m_xContainer->set_grid_top_attach(nGridPositionY);
Link<weld::ComboBox&, void> aComboBoxSelectHandler
= LINK(this, FontFeaturesDialog, ComboBoxSelectedHdl);
- Link<weld::ToggleButton&, void> aCheckBoxToggleHandler
+ Link<weld::Toggleable&, void> aCheckBoxToggleHandler
= LINK(this, FontFeaturesDialog, CheckBoxToggledHdl);
if (aDefinition.getType() == vcl::font::FeatureParameterType::ENUM)
@@ -134,14 +159,28 @@ void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFe
}
else
{
- aCurrentItem.m_xCheck->set_active(nValue > 0);
+ if (nValue < 0)
+ {
+ aCurrentItem.m_xCheck->set_state(TRISTATE_INDET);
+ aCurrentItem.m_aTriStateEnabled.bTriStateEnabled = true;
+ aCurrentItem.m_aTriStateEnabled.eState = TRISTATE_INDET;
+ }
+ else
+ {
+ aCurrentItem.m_xCheck->set_state(nValue > 0 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ aCurrentItem.m_aTriStateEnabled.bTriStateEnabled = false;
+ aCurrentItem.m_aTriStateEnabled.eState = aCurrentItem.m_xCheck->get_state();
+ }
aCurrentItem.m_xCheck->set_label(aDefinition.getDescription());
- aCurrentItem.m_xCheck->connect_toggled(aCheckBoxToggleHandler);
+ aCurrentItem.m_aToggleHdl = aCheckBoxToggleHandler;
aCurrentItem.m_xCheck->show();
}
- i++;
+ nRowHeight
+ = std::max<int>(nRowHeight, aCurrentItem.m_xContainer->get_preferred_size().Height());
}
+
+ return nRowHeight;
}
void FontFeaturesDialog::updateFontPreview()
@@ -159,7 +198,14 @@ void FontFeaturesDialog::updateFontPreview()
m_aPreviewWindow.SetFont(rPreviewFont, rPreviewFontCJK, rPreviewFontCTL);
}
-IMPL_LINK_NOARG(FontFeaturesDialog, CheckBoxToggledHdl, weld::ToggleButton&, void)
+IMPL_LINK(FontFeatureItem, CheckBoxToggledHdl, weld::Toggleable&, rToggle, void)
+{
+ m_aTriStateEnabled.ButtonToggled(rToggle);
+ m_aTriStateEnabled.bTriStateEnabled = false;
+ m_aToggleHdl.Call(rToggle);
+}
+
+IMPL_LINK_NOARG(FontFeaturesDialog, CheckBoxToggledHdl, weld::Toggleable&, void)
{
updateFontPreview();
}
@@ -175,11 +221,12 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
OUStringBuffer sNameSuffix;
bool bFirst = true;
- for (const FontFeatureItem& rItem : m_aFeatureItems)
+ for (const auto& rEntry : m_aFeatureItems)
{
+ const FontFeatureItem& rItem(*rEntry);
if (rItem.m_xCheck->get_visible())
{
- if (sal_uInt32(rItem.m_xCheck->get_active()) != rItem.m_nDefault)
+ if (rItem.m_xCheck->get_state() != TRISTATE_INDET)
{
if (!bFirst)
sNameSuffix.append(vcl::font::FeatureSeparator);
@@ -187,7 +234,7 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
bFirst = false;
sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
- if (!rItem.m_xCheck->get_active())
+ if (rItem.m_xCheck->get_state() == TRISTATE_FALSE)
sNameSuffix.append("=0");
}
}
@@ -201,16 +248,14 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
else
bFirst = false;
- sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
- sNameSuffix.append("=");
- sNameSuffix.append(OUString::number(nSelection));
+ sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode) + "="
+ + OUString::number(nSelection));
}
}
}
sResultFontName = vcl::font::trimFontNameFeatures(m_sFontName);
if (!sNameSuffix.isEmpty())
- sResultFontName
- += OUStringChar(vcl::font::FeaturePrefix) + sNameSuffix.makeStringAndClear();
+ sResultFontName += OUStringChar(vcl::font::FeaturePrefix) + sNameSuffix;
return sResultFontName;
}
diff --git a/cui/source/dialogs/GraphicTestsDialog.cxx b/cui/source/dialogs/GraphicTestsDialog.cxx
new file mode 100644
index 000000000000..ad0c25aab1f5
--- /dev/null
+++ b/cui/source/dialogs/GraphicTestsDialog.cxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <comphelper/backupfilehelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/DirectoryHelper.hxx>
+#include <osl/file.hxx>
+#include <svx/FileExportedDialog.hxx>
+#include <unotools/ZipPackageHelper.hxx>
+#include <GraphicsTestsDialog.hxx>
+#include <vcl/test/GraphicsRenderTests.hxx>
+#include <svl/svlresid.hxx>
+#include <svl/svl.hrc>
+#include <vcl/svapp.hxx>
+
+#include <dialmgr.hxx>
+#include <strings.hrc>
+#include <ImageViewerDialog.hxx>
+
+GraphicTestEntry::GraphicTestEntry(weld::Container* pParent, weld::Dialog* pDialog,
+ OUString aTestName, OUString aTestStatus, Bitmap aTestBitmap)
+ : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/graphictestentry.ui"))
+ , m_xContainer(m_xBuilder->weld_container("gptestbox"))
+ , m_xTestLabel(m_xBuilder->weld_label("gptestlabel"))
+ , m_xTestButton(m_xBuilder->weld_button("gptestbutton"))
+ , m_xResultBitmap(aTestBitmap)
+{
+ m_xParentDialog = pDialog;
+ m_xTestLabel->set_label(aTestName);
+ m_xTestButton->set_label(aTestStatus);
+ m_xTestButton->set_tooltip_text(aTestName);
+ m_xTestButton->set_background(
+ aTestStatus == SvlResId(GRTSTR_PASSED)
+ ? COL_LIGHTGREEN
+ : aTestStatus == SvlResId(GRTSTR_QUIRKY)
+ ? COL_YELLOW
+ : aTestStatus == SvlResId(GRTSTR_FAILED) ? COL_LIGHTRED : COL_LIGHTGRAY);
+ m_xTestButton->connect_clicked(LINK(this, GraphicTestEntry, HandleResultViewRequest));
+ m_xContainer->show();
+}
+
+IMPL_LINK(GraphicTestEntry, HandleResultViewRequest, weld::Button&, rButton, void)
+{
+ if (rButton.get_label() == SvlResId(GRTSTR_SKIPPED))
+ {
+ return;
+ }
+ ImageViewerDialog m_ImgVwDialog(m_xParentDialog, BitmapEx(m_xResultBitmap),
+ rButton.get_tooltip_text());
+ m_ImgVwDialog.run();
+}
+
+GraphicsTestsDialog::GraphicsTestsDialog(weld::Container* pParent)
+ : GenericDialogController(pParent, "cui/ui/graphictestdlg.ui", "GraphicTestsDialog")
+ , m_xResultLog(m_xBuilder->weld_text_view("gptest_txtVW"))
+ , m_xDownloadResults(m_xBuilder->weld_button("gptest_downld"))
+ , m_xContainerBox(m_xBuilder->weld_box("gptest_box"))
+{
+ OUString userProfile = comphelper::BackupFileHelper::getUserProfileURL();
+ m_xZipFileUrl = userProfile + "/GraphicTestResults.zip";
+ m_xCreateFolderUrl = userProfile + "/GraphicTestResults";
+ osl::Directory::create(m_xCreateFolderUrl);
+ m_xDownloadResults->connect_clicked(LINK(this, GraphicsTestsDialog, HandleDownloadRequest));
+}
+
+short GraphicsTestsDialog::run()
+{
+ GraphicsRenderTests aTestObject;
+ aTestObject.run(true);
+ OUString aResultLog
+ = aTestObject.getResultString(true) + "\n" + CuiResId(RID_CUISTR_CLICK_RESULT);
+ m_xResultLog->set_text(aResultLog);
+ sal_Int32 nTestNumber = 0;
+ for (VclTestResult& test : aTestObject.getTestResults())
+ {
+ auto xGpTest = std::make_unique<GraphicTestEntry>(m_xContainerBox.get(), m_xDialog.get(),
+ test.getTestName(), test.getStatus(true),
+ test.getBitmap());
+ m_xContainerBox->reorder_child(xGpTest->get_widget(), nTestNumber++);
+ m_xGraphicTestEntries.push_back(std::move(xGpTest));
+ }
+ return GenericDialogController::run();
+}
+
+IMPL_LINK_NOARG(GraphicsTestsDialog, HandleDownloadRequest, weld::Button&, void)
+{
+ osl::File::remove(m_xZipFileUrl); // Remove the previous export
+ try
+ {
+ utl::ZipPackageHelper aZipHelper(comphelper::getProcessComponentContext(), m_xZipFileUrl);
+ aZipHelper.addFolderWithContent(aZipHelper.getRootFolder(), m_xCreateFolderUrl);
+ aZipHelper.savePackage();
+ }
+ catch (const std::exception&)
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(
+ Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Warning,
+ VclButtonsType::Ok, CuiResId(RID_CUISTR_ZIPFAIL)));
+ xBox->run();
+ return;
+ }
+ FileExportedDialog aDialog(m_xDialog.get(), CuiResId(RID_CUISTR_SAVED));
+ aDialog.run();
+}
+
+GraphicsTestsDialog::~GraphicsTestsDialog()
+{
+ comphelper::DirectoryHelper::deleteDirRecursively(m_xCreateFolderUrl);
+}
diff --git a/cui/source/dialogs/ImageViewerDialog.cxx b/cui/source/dialogs/ImageViewerDialog.cxx
new file mode 100644
index 000000000000..b245c8c08b60
--- /dev/null
+++ b/cui/source/dialogs/ImageViewerDialog.cxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/virdev.hxx>
+#include <ImageViewerDialog.hxx>
+
+ImageViewerDialog::ImageViewerDialog(weld::Dialog* pParent, BitmapEx aBitmap, OUString atitle)
+ : GenericDialogController(pParent, "cui/ui/imageviewer.ui", "ImageViewerDialog")
+ , m_xDisplayImage(m_xBuilder->weld_image("ImgVW_mainImage"))
+{
+ m_xDialog->set_title(atitle);
+ aBitmap.Scale(Size(300, 300), BmpScaleFlag::Fast);
+ ScopedVclPtr<VirtualDevice> m_pVirDev = m_xDisplayImage->create_virtual_device();
+ m_pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel());
+ m_pVirDev->DrawBitmapEx(Point(0, 0), aBitmap);
+ m_xDisplayImage->set_image(m_pVirDev.get());
+ m_pVirDev.disposeAndClear();
+}
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index 28bbfabcf845..d99290404629 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -10,6 +10,7 @@
#include <QrCodeGenDialog.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <tools/stream.hxx>
#include <dialmgr.hxx>
#include <strings.hrc>
@@ -17,21 +18,40 @@
#include <utility>
#include <vcl/svapp.hxx>
-#if ENABLE_QRCODEGEN
-#if defined(SYSTEM_QRCODEGEN)
-#include <qrcodegen/QrCode.hpp>
-#else
-#include <QrCode.hpp>
+#if ENABLE_ZXING
+#include <ZXVersion.h>
+#include <rtl/strbuf.hxx>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
+#include <BarcodeFormat.h>
+#include <BitMatrix.h>
+#include <MultiFormatWriter.h>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+#if HAVE_ZXING_TOSVG
+#include <BitMatrixIO.h>
#endif
+
+#if ZXING_VERSION_MAJOR < 2
+#include <TextUtfEncoding.h>
#endif
+#endif // ENABLE_ZXING
+
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/graphic/GraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/drawing/QRCode.hpp>
-#include <com/sun/star/drawing/QRCodeErrorCorrection.hpp>
+#include <com/sun/star/drawing/BarCode.hpp>
+#include <com/sun/star/drawing/BarCodeErrorCorrection.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -52,29 +72,118 @@ using namespace css::container;
using namespace css::frame;
using namespace css::io;
using namespace css::lang;
-using namespace css::frame;
using namespace css::sheet;
using namespace css::text;
using namespace css::drawing;
using namespace css::graphic;
-#if ENABLE_QRCODEGEN
-using namespace qrcodegen;
+
+namespace
+{
+#if ENABLE_ZXING
+// Implementation adapted from the answer: https://stackoverflow.com/questions/10789059/create-qr-code-in-vector-image/60638350#60638350
+#if !HAVE_ZXING_TOSVG
+OString ConvertToSVGFormat(const ZXing::BitMatrix& bitmatrix)
+{
+ OStringBuffer sb;
+ const int width = bitmatrix.width();
+ const int height = bitmatrix.height();
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 "
+ + OString::number(width) + " " + OString::number(height)
+ + "\" stroke=\"none\">\n"
+ "<path d=\"");
+ for (int i = 0; i < height; ++i)
+ {
+ for (int j = 0; j < width; ++j)
+ {
+ if (bitmatrix.get(j, i))
+ {
+ sb.append("M" + OString::number(j) + "," + OString::number(i) + "h1v1h-1z");
+ }
+ }
+ }
+ sb.append("\"/>\n</svg>");
+ return sb.toString();
+}
#endif
+std::string GetBarCodeType(int type)
+{
+ switch (type)
+ {
+ case 1:
+ return "Code128";
+ default:
+ return "QRCode";
+ }
+}
+
+OString GenerateQRCode(std::u16string_view aQRText, tools::Long aQRECC, int aQRBorder, int aQRType)
+{
+ // Associated ZXing error correction levels (0-8) to our constants arbitrarily.
+ int bqrEcc = 1;
+
+ switch (aQRECC)
+ {
+ case css::drawing::BarCodeErrorCorrection::LOW:
+ {
+ bqrEcc = 1;
+ break;
+ }
+ case css::drawing::BarCodeErrorCorrection::MEDIUM:
+ {
+ bqrEcc = 3;
+ break;
+ }
+ case css::drawing::BarCodeErrorCorrection::QUARTILE:
+ {
+ bqrEcc = 5;
+ break;
+ }
+ case css::drawing::BarCodeErrorCorrection::HIGH:
+ {
+ bqrEcc = 7;
+ break;
+ }
+ }
+
+ OString o = OUStringToOString(aQRText, RTL_TEXTENCODING_UTF8);
+ std::string QRText(o);
+ ZXing::BarcodeFormat format = ZXing::BarcodeFormatFromString(GetBarCodeType(aQRType));
+ auto writer = ZXing::MultiFormatWriter(format).setMargin(aQRBorder).setEccLevel(bqrEcc);
+ writer.setEncoding(ZXing::CharacterSet::UTF8);
+#if ZXING_VERSION_MAJOR >= 2
+ ZXing::BitMatrix bitmatrix = writer.encode(QRText, 0, 0);
+#else
+ ZXing::BitMatrix bitmatrix = writer.encode(ZXing::TextUtfEncoding::FromUtf8(QRText), 0, 0);
+#endif
+#if HAVE_ZXING_TOSVG
+ return OString(ZXing::ToSVG(bitmatrix));
+#else
+ return ConvertToSVGFormat(bitmatrix);
+#endif
+}
+#endif
+
+} // anonymous namespace
+
QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel,
bool bEditExisting)
: GenericDialogController(pParent, "cui/ui/qrcodegen.ui", "QrCodeGenDialog")
, m_xModel(std::move(xModel))
- , m_xEdittext(m_xBuilder->weld_entry("edit_text"))
+ , m_xEdittext(m_xBuilder->weld_text_view("edit_text"))
, m_xECC{ m_xBuilder->weld_radio_button("button_low"),
m_xBuilder->weld_radio_button("button_medium"),
m_xBuilder->weld_radio_button("button_quartile"),
m_xBuilder->weld_radio_button("button_high") }
- , m_xSpinBorder(m_xBuilder->weld_spin_button("edit_border"))
-#if ENABLE_QRCODEGEN
+ , m_xSpinBorder(m_xBuilder->weld_spin_button("edit_margin"))
+ , m_xComboType(m_xBuilder->weld_combo_box("choose_type"))
+#if ENABLE_ZXING
, mpParent(pParent)
#endif
{
+ m_xEdittext->set_size_request(m_xEdittext->get_approximate_digit_width() * 28,
+ m_xEdittext->get_height_rows(6));
if (!bEditExisting)
{
// TODO: This only works in Writer doc. Should also work in shapes
@@ -93,15 +202,17 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
Reference<XPropertySet> xProps(xIndexAccess->getByIndex(0), UNO_QUERY_THROW);
// Read properties from selected QR Code
- css::drawing::QRCode aQRCode;
- xProps->getPropertyValue("QRCodeProperties") >>= aQRCode;
+ css::drawing::BarCode aBarCode;
+ xProps->getPropertyValue("BarCodeProperties") >>= aBarCode;
- m_xEdittext->set_text(aQRCode.Payload);
+ m_xEdittext->set_text(aBarCode.Payload);
//Get Error Correction Constant from selected QR Code
- GetErrorCorrection(aQRCode.ErrorCorrection);
+ GetErrorCorrection(aBarCode.ErrorCorrection);
+
+ m_xSpinBorder->set_value(aBarCode.Border);
- m_xSpinBorder->set_value(aQRCode.Border);
+ m_xComboType->set_active(aBarCode.Type);
// Mark this as existing shape
m_xExistingShapeProperties = xProps;
@@ -109,7 +220,7 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
short QrCodeGenDialog::run()
{
-#if ENABLE_QRCODEGEN
+#if ENABLE_ZXING
short nRet;
while (true)
{
@@ -121,11 +232,11 @@ short QrCodeGenDialog::run()
Apply();
break;
}
- catch (const qrcodegen::data_too_long&)
+ catch (const std::exception&)
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
mpParent, VclMessageType::Warning, VclButtonsType::Ok,
- CuiResId(RID_SVXSTR_QRCODEDATALONG)));
+ CuiResId(RID_CUISTR_QRCODEDATALONG)));
xBox->run();
}
}
@@ -138,11 +249,42 @@ short QrCodeGenDialog::run()
#endif
}
+bool QrCodeGenDialog::runAsync(const std::shared_ptr<QrCodeGenDialog>& rController,
+ const std::function<void(sal_Int32)>& rFunc)
+{
+#if ENABLE_ZXING
+
+ weld::GenericDialogController::runAsync(rController, [rController, rFunc](sal_Int32 nResult) {
+ if (nResult == RET_OK)
+ {
+ try
+ {
+ rController->Apply();
+ }
+ catch (const std::exception&)
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
+ rController->GetParent(), VclMessageType::Warning, VclButtonsType::Ok,
+ CuiResId(RID_CUISTR_QRCODEDATALONG)));
+ xBox->run();
+ }
+ }
+
+ rFunc(nResult);
+ });
+#else
+ (void)rController;
+ (void)rFunc;
+#endif
+ return true;
+}
+
void QrCodeGenDialog::Apply()
{
-#if ENABLE_QRCODEGEN
- css::drawing::QRCode aQRCode;
- aQRCode.Payload = m_xEdittext->get_text();
+#if ENABLE_ZXING
+ css::drawing::BarCode aBarCode;
+ aBarCode.Payload = m_xEdittext->get_text();
+ aBarCode.Type = m_xComboType->get_active();
bool bLowECCActive(m_xECC[0]->get_active());
bool bMediumECCActive(m_xECC[1]->get_active());
@@ -150,36 +292,36 @@ void QrCodeGenDialog::Apply()
if (bLowECCActive)
{
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::LOW;
+ aBarCode.ErrorCorrection = css::drawing::BarCodeErrorCorrection::LOW;
}
else if (bMediumECCActive)
{
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::MEDIUM;
+ aBarCode.ErrorCorrection = css::drawing::BarCodeErrorCorrection::MEDIUM;
}
else if (bQuartileECCActive)
{
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::QUARTILE;
+ aBarCode.ErrorCorrection = css::drawing::BarCodeErrorCorrection::QUARTILE;
}
else
{
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::HIGH;
+ aBarCode.ErrorCorrection = css::drawing::BarCodeErrorCorrection::HIGH;
}
- aQRCode.Border = m_xSpinBorder->get_value();
+ aBarCode.Border = m_xSpinBorder->get_value();
// Read svg and replace placeholder texts
- OUString aSvgImage = GenerateQRCode(aQRCode.Payload, aQRCode.ErrorCorrection, aQRCode.Border);
+ OString aSvgImage = GenerateQRCode(aBarCode.Payload, aBarCode.ErrorCorrection, aBarCode.Border,
+ aBarCode.Type);
// Insert/Update graphic
SvMemoryStream aSvgStream(4096, 4096);
- aSvgStream.WriteOString(OUStringToOString(aSvgImage, RTL_TEXTENCODING_UTF8));
+ aSvgStream.WriteOString(aSvgImage);
Reference<XInputStream> xInputStream(new utl::OSeekableInputStreamWrapper(aSvgStream));
Reference<XComponentContext> xContext(comphelper::getProcessComponentContext());
Reference<XGraphicProvider> xProvider = css::graphic::GraphicProvider::create(xContext);
- Sequence<PropertyValue> aMediaProperties(1);
- aMediaProperties[0].Name = "InputStream";
- aMediaProperties[0].Value <<= xInputStream;
+ Sequence<PropertyValue> aMediaProperties{ comphelper::makePropertyValue("InputStream",
+ xInputStream) };
Reference<XGraphic> xGraphic(xProvider->queryGraphic(aMediaProperties));
bool bIsExistingQRCode = m_xExistingShapeProperties.is();
@@ -194,7 +336,7 @@ void QrCodeGenDialog::Apply()
xShapeProps->setPropertyValue("Graphic", Any(xGraphic));
// Set QRCode properties
- xShapeProps->setPropertyValue("QRCodeProperties", Any(aQRCode));
+ xShapeProps->setPropertyValue("BarCodeProperties", Any(aBarCode));
if (bIsExistingQRCode)
return;
@@ -263,73 +405,26 @@ void QrCodeGenDialog::Apply()
#endif
}
-OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, tools::Long aQRECC, int aQRBorder)
-{
-#if ENABLE_QRCODEGEN
- //Select ECC:: value from aQrECC
- qrcodegen::QrCode::Ecc bqrEcc = qrcodegen::QrCode::Ecc::LOW;
-
- switch (aQRECC)
- {
- case 1:
- {
- bqrEcc = qrcodegen::QrCode::Ecc::LOW;
- break;
- }
- case 2:
- {
- bqrEcc = qrcodegen::QrCode::Ecc::MEDIUM;
- break;
- }
- case 3:
- {
- bqrEcc = qrcodegen::QrCode::Ecc::QUARTILE;
- break;
- }
- case 4:
- {
- bqrEcc = qrcodegen::QrCode::Ecc::HIGH;
- break;
- }
- }
-
- //OuString to char* qrtext
- OString o = OUStringToOString(aQRText, RTL_TEXTENCODING_UTF8);
- const char* qrtext = o.pData->buffer;
-
- // From QR Code library
- qrcodegen::QrCode qr0 = qrcodegen::QrCode::encodeText(qrtext, bqrEcc);
- std::string svg = qr0.toSvgString(aQRBorder);
- //cstring to OUString
- return OUString::createFromAscii(svg.c_str());
-#else
- (void)aQRText;
- (void)aQRECC;
- (void)aQRBorder;
- return OUString();
-#endif
-}
-
void QrCodeGenDialog::GetErrorCorrection(tools::Long ErrorCorrection)
{
switch (ErrorCorrection)
{
- case css::drawing::QRCodeErrorCorrection::LOW:
+ case css::drawing::BarCodeErrorCorrection::LOW:
{
m_xECC[0]->set_active(true);
break;
}
- case css::drawing::QRCodeErrorCorrection::MEDIUM:
+ case css::drawing::BarCodeErrorCorrection::MEDIUM:
{
m_xECC[1]->set_active(true);
break;
}
- case css::drawing::QRCodeErrorCorrection::QUARTILE:
+ case css::drawing::BarCodeErrorCorrection::QUARTILE:
{
m_xECC[2]->set_active(true);
break;
}
- case css::drawing::QRCodeErrorCorrection::HIGH:
+ case css::drawing::BarCodeErrorCorrection::HIGH:
{
m_xECC[3]->set_active(true);
break;
diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index 58a4fd317065..d3e0bfb5b65e 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -17,6 +17,8 @@
#include <comphelper/graphicmimetype.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
+#include <sfx2/filedlghelper.hxx>
#include <sfx2/objsh.hxx>
#include <svx/xoutbmp.hxx>
#include <utility>
@@ -31,7 +33,6 @@
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/security/CertificateKind.hpp>
#include <com/sun/star/security/XCertificate.hpp>
-#include <com/sun/star/ui/dialogs/FilePicker.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
@@ -40,8 +41,6 @@ using namespace css;
using namespace css::uno;
using namespace css::beans;
using namespace css::frame;
-using namespace css::io;
-using namespace css::lang;
using namespace css::frame;
using namespace css::text;
using namespace css::graphic;
@@ -121,8 +120,10 @@ SignSignatureLineDialog::SignSignatureLineDialog(weld::Widget* pParent, Referenc
IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void)
{
Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
- Reference<XFilePicker3> xFilePicker
- = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_PREVIEW);
+ sfx2::FileDialogHelper aHelper(TemplateDescription::FILEOPEN_PREVIEW, FileDialogFlags::NONE,
+ m_xDialog.get());
+ aHelper.SetContext(sfx2::FileDialogHelper::SignatureLine);
+ Reference<XFilePicker3> xFilePicker = aHelper.GetFilePicker();
if (!xFilePicker->execute())
return;
@@ -131,9 +132,8 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void)
return;
Reference<XGraphicProvider> xProvider = GraphicProvider::create(xContext);
- Sequence<PropertyValue> aMediaProperties(1);
- aMediaProperties[0].Name = "URL";
- aMediaProperties[0].Value <<= aSelectedFiles[0];
+ Sequence<PropertyValue> aMediaProperties{ comphelper::makePropertyValue("URL",
+ aSelectedFiles[0]) };
m_xSignatureImage = xProvider->queryGraphic(aMediaProperties);
m_sOriginalImageBtnLabel = m_xBtnLoadImage->get_label();
@@ -145,7 +145,7 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void)
IMPL_LINK_NOARG(SignSignatureLineDialog, clearImage, weld::Button&, void)
{
- m_xSignatureImage.set(nullptr);
+ m_xSignatureImage.clear();
m_xBtnLoadImage->set_label(m_sOriginalImageBtnLabel);
ValidateFields();
}
@@ -154,7 +154,7 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
{
// Document needs to be saved before selecting a certificate
SfxObjectShell* pShell = SfxObjectShell::Current();
- if (!pShell->PrepareForSigning(m_xDialog.get()))
+ if (!pShell || !pShell->PrepareForSigning(m_xDialog.get()))
return;
Reference<XCertificate> xSignCertificate
@@ -191,6 +191,12 @@ void SignSignatureLineDialog::Apply()
}
SfxObjectShell* pShell = SfxObjectShell::Current();
+ if (!pShell)
+ {
+ SAL_WARN("cui.dialogs", "No SfxObjectShell!");
+ return;
+ }
+
Reference<XGraphic> xValidGraphic = getSignedGraphic(true);
Reference<XGraphic> xInvalidGraphic = getSignedGraphic(false);
pShell->SignSignatureLine(m_xDialog.get(), m_aSignatureLineId, m_xSelectedCertifate,
@@ -205,7 +211,7 @@ css::uno::Reference<css::graphic::XGraphic> SignSignatureLineDialog::getSignedGr
aSvgImage = aSvgImage.replaceAll("[SIGNER_TITLE]", getCDataString(m_aSuggestedSignerTitle));
OUString aIssuerLine
- = CuiResId(RID_SVXSTR_SIGNATURELINE_SIGNED_BY)
+ = CuiResId(RID_CUISTR_SIGNATURELINE_SIGNED_BY)
.replaceFirst("%1", svx::SignatureLineHelper::getSignerName(m_xSelectedCertifate));
aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", getCDataString(aIssuerLine));
if (bValid)
diff --git a/cui/source/dialogs/SignatureLineDialogBase.cxx b/cui/source/dialogs/SignatureLineDialogBase.cxx
index 4e591124bc44..fb154c34319d 100644
--- a/cui/source/dialogs/SignatureLineDialogBase.cxx
+++ b/cui/source/dialogs/SignatureLineDialogBase.cxx
@@ -18,7 +18,7 @@ using namespace css::uno;
using namespace css::frame;
SignatureLineDialogBase::SignatureLineDialogBase(weld::Widget* pParent, Reference<XModel> xModel,
- const OUString& rUIFile, const OString& rDialogId)
+ const OUString& rUIFile, const OUString& rDialogId)
: GenericDialogController(pParent, rUIFile, rDialogId)
, m_xModel(std::move(xModel))
{
@@ -26,10 +26,8 @@ SignatureLineDialogBase::SignatureLineDialogBase(weld::Widget* pParent, Referenc
short SignatureLineDialogBase::run()
{
- short nRet = GenericDialogController::run();
- if (nRet == RET_OK)
- Apply();
- return nRet;
+ assert(false && "these dialogs are async now");
+ return -1;
}
OUString SignatureLineDialogBase::getCDataString(std::u16string_view rString)
diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx
index c086fe3d086a..cdc0cf26661e 100644
--- a/cui/source/dialogs/SpellAttrib.hxx
+++ b/cui/source/dialogs/SpellAttrib.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <utility>
namespace svx{
struct SpellErrorDescription
@@ -37,21 +38,21 @@ struct SpellErrorDescription
OUString sRuleId;
SpellErrorDescription( bool bGrammar,
- const OUString& rText,
- const css::lang::Locale& rLocale,
+ OUString aText,
+ css::lang::Locale _aLocale,
const css::uno::Sequence< OUString >& rSuggestions,
- css::uno::Reference< css::linguistic2::XProofreader > const & rxGrammarChecker,
+ css::uno::Reference< css::linguistic2::XProofreader > _xGrammarChecker,
const OUString* pDialogTitle = nullptr,
const OUString* pExplanation = nullptr,
const OUString* pRuleId = nullptr,
const OUString* pExplanationURL = nullptr ) :
bIsGrammarError( bGrammar ),
- sErrorText( rText ),
+ sErrorText(std::move( aText )),
sDialogTitle( ),
sExplanation( ),
sExplanationURL( ),
- aLocale( rLocale ),
- xGrammarChecker( rxGrammarChecker ),
+ aLocale(std::move( _aLocale )),
+ xGrammarChecker(std::move( _xGrammarChecker )),
aSuggestions( rSuggestions )
{
if( pDialogTitle )
@@ -86,16 +87,15 @@ struct SpellErrorDescription
css::uno::Sequence<css::uno::Any> toSequence() const
{
- css::uno::Sequence<css::uno::Any> aEntries(9);
- aEntries[0] <<= bIsGrammarError;
- aEntries[1] <<= sErrorText;
- aEntries[2] <<= sDialogTitle;
- aEntries[3] <<= sExplanation;
- aEntries[4] <<= sExplanationURL;
- aEntries[5] <<= aLocale;
- aEntries[6] <<= xGrammarChecker;
- aEntries[7] <<= aSuggestions;
- aEntries[8] <<= sRuleId;
+ css::uno::Sequence<css::uno::Any> aEntries{ css::uno::Any(bIsGrammarError),
+ css::uno::Any(sErrorText),
+ css::uno::Any(sDialogTitle),
+ css::uno::Any(sExplanation),
+ css::uno::Any(sExplanationURL),
+ css::uno::Any(aLocale),
+ css::uno::Any(xGrammarChecker),
+ css::uno::Any(aSuggestions),
+ css::uno::Any(sRuleId) };
return aEntries;
}
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 5ad37af93487..9dd877f80cf9 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -26,6 +26,7 @@
#include <svl/undo.hxx>
#include <tools/debug.hxx>
#include <unotools/lingucfg.hxx>
+#include <editeng/editund2.hxx>
#include <editeng/colritem.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/langitem.hxx>
@@ -50,6 +51,7 @@
#include <SpellDialog.hxx>
#include <optlingu.hxx>
#include <treeopt.hxx>
+#include <svtools/colorcfg.hxx>
#include <svtools/langtab.hxx>
#include <sal/log.hxx>
#include <i18nlangtag/languagetag.hxx>
@@ -160,6 +162,7 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
: SfxModelessDialogController (_pBindings, pChildWindow,
pParent, "cui/ui/spellingdialog.ui", "SpellingDialog")
, aDialogUndoLink(LINK (this, SpellDialog, DialogUndoHdl))
+ , m_pInitHdlEvent(nullptr)
, bFocusLocked(true)
, rParent(*pChildWindow)
, pImpl( new SpellDialog_Impl )
@@ -171,7 +174,7 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
, m_xExplainFT(m_xBuilder->weld_label("explain"))
, m_xExplainLink(m_xBuilder->weld_link_button("explainlink"))
, m_xNotInDictFT(m_xBuilder->weld_label("notindictft"))
- , m_xSentenceED(new SentenceEditWindow_Impl)
+ , m_xSentenceED(new SentenceEditWindow_Impl(m_xBuilder->weld_scrolled_window("scrolledwindow", true)))
, m_xSuggestionFT(m_xBuilder->weld_label("suggestionsft"))
, m_xSuggestionLB(m_xBuilder->weld_tree_view("suggestionslb"))
, m_xIgnorePB(m_xBuilder->weld_button("ignore"))
@@ -218,11 +221,19 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
//InitHdl wants to use virtual methods, so it
//can't be called during the ctor, so init
//it on next event cycle post-ctor
- Application::PostUserEvent(LINK(this, SpellDialog, InitHdl));
+ m_pInitHdlEvent = Application::PostUserEvent(LINK(this, SpellDialog, InitHdl));
}
SpellDialog::~SpellDialog()
{
+ if (m_xOptionsDlg)
+ {
+ m_xOptionsDlg->response(RET_CANCEL);
+ m_xOptionsDlg.reset();
+ }
+
+ if (m_pInitHdlEvent)
+ Application::RemoveUserEvent(m_pInitHdlEvent);
if (pImpl)
{
// save possibly modified user-dictionaries
@@ -246,7 +257,7 @@ void SpellDialog::Init_Impl()
m_xUndoPB->connect_clicked(LINK( this, SpellDialog, UndoHdl ) );
m_xAutoCorrPB->connect_clicked( LINK( this, SpellDialog, ExtClickHdl ) );
- m_xCheckGrammarCB->connect_clicked( LINK( this, SpellDialog, CheckGrammarHdl ));
+ m_xCheckGrammarCB->connect_toggled( LINK( this, SpellDialog, CheckGrammarHdl ));
m_xOptionsPB->connect_clicked( LINK( this, SpellDialog, ExtClickHdl ) );
m_xSuggestionLB->connect_row_activated( LINK( this, SpellDialog, DoubleClickChangeHdl ) );
@@ -351,6 +362,11 @@ void SpellDialog::SpellContinue_Impl(std::unique_ptr<UndoChangeGroupGuard>* pGua
//then GetNextSentence() has to be called followed again by MarkNextError()
//MarkNextError is not initially called if the UndoEdit mode is active
bool bNextSentence = false;
+ if (!m_xSentenceED)
+ {
+ return;
+ }
+
if(!((!m_xSentenceED->IsUndoEditMode() && m_xSentenceED->MarkNextError( bIgnoreCurrentError, xSpell )) ||
( bNextSentence = GetNextSentence_Impl(pGuard, bUseSavedSentence, m_xSentenceED->IsUndoEditMode()) && m_xSentenceED->MarkNextError( false, xSpell ))))
return;
@@ -364,16 +380,10 @@ void SpellDialog::SpellContinue_Impl(std::unique_ptr<UndoChangeGroupGuard>* pGua
{
m_xNotInDictFT.get(),
m_xSentenceED->GetDrawingArea(),
- m_xLanguageFT.get(),
- nullptr
+ m_xLanguageFT.get()
};
- sal_Int32 nIdx = 0;
- do
- {
- aControls[nIdx]->set_sensitive(true);
- }
- while(aControls[++nIdx]);
-
+ for (weld::Widget* pWidget : aControls)
+ pWidget->set_sensitive(true);
}
if( bNextSentence )
{
@@ -387,6 +397,7 @@ void SpellDialog::SpellContinue_Impl(std::unique_ptr<UndoChangeGroupGuard>* pGua
*/
IMPL_LINK_NOARG( SpellDialog, InitHdl, void*, void)
{
+ m_pInitHdlEvent = nullptr;
m_xDialog->freeze();
//show or hide AutoCorrect depending on the modules abilities
m_xAutoCorrPB->set_visible(rParent.HasAutoCorrection());
@@ -401,7 +412,9 @@ IMPL_LINK_NOARG( SpellDialog, InitHdl, void*, void)
InitUserDicts();
LockFocusChanges(true);
- if( m_xChangePB->get_sensitive() )
+ if(m_xSentenceED->IsEnabled())
+ m_xSentenceED->GrabFocus();
+ else if( m_xChangePB->get_sensitive() )
m_xChangePB->grab_focus();
else if( m_xIgnorePB->get_sensitive() )
m_xIgnorePB->grab_focus();
@@ -448,7 +461,7 @@ IMPL_LINK( SpellDialog, ExtClickHdl, weld::Button&, rBtn, void )
}
}
-IMPL_LINK_NOARG(SpellDialog, CheckGrammarHdl, weld::Button&, void)
+IMPL_LINK_NOARG(SpellDialog, CheckGrammarHdl, weld::Toggleable&, void)
{
rParent.SetGrammarChecking(m_xCheckGrammarCB->get_active());
Impl_Restore(true);
@@ -456,19 +469,22 @@ IMPL_LINK_NOARG(SpellDialog, CheckGrammarHdl, weld::Button&, void)
void SpellDialog::StartSpellOptDlg_Impl()
{
- SfxItemSet aSet( SfxGetpApp()->GetPool(), svl::Items<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK>{});
- SfxSingleTabDialogController aDlg(m_xDialog.get(), &aSet, "cui/ui/spelloptionsdialog.ui", "SpellOptionsDialog");
+ auto xSet = std::make_shared<SfxItemSetFixed<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK>>( SfxGetpApp()->GetPool() );
+ m_xOptionsDlg = std::make_shared<SfxSingleTabDialogController>(
+ m_xDialog.get(), xSet.get(), "content", "cui/ui/spelloptionsdialog.ui", "SpellOptionsDialog");
- std::unique_ptr<SfxTabPage> xPage = SvxLinguTabPage::Create(aDlg.get_content_area(), &aDlg, &aSet);
+ std::unique_ptr<SfxTabPage> xPage = SvxLinguTabPage::Create(m_xOptionsDlg->get_content_area(), m_xOptionsDlg.get(), xSet.get());
static_cast<SvxLinguTabPage*>(xPage.get())->HideGroups( GROUP_MODULES );
- aDlg.SetTabPage(std::move(xPage));
- if (RET_OK == aDlg.run())
- {
- InitUserDicts();
- const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
- if(pOutSet)
- OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet);
- }
+ m_xOptionsDlg->SetTabPage(std::move(xPage));
+ weld::GenericDialogController::runAsync(m_xOptionsDlg, [this, xSet] (sal_uInt32 nResult) {
+ if (RET_OK == nResult)
+ {
+ InitUserDicts();
+ const SfxItemSet* pOutSet = m_xOptionsDlg->GetOutputItemSet();
+ if(pOutSet)
+ OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet);
+ }
+ });
}
namespace
@@ -713,8 +729,7 @@ void SpellDialog::Close()
// section - in that case, the cursor can move from the editable field to
// the protected area, and the slots get disabled because of
// SfxDisableFlags::SwOnProtectedCursor (see FN_SPELL_GRAMMAR_DIALOG in .sdi).
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (pViewFrame)
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
pViewFrame->ToggleChildWindow(rParent.GetType());
}
@@ -828,15 +843,15 @@ int SpellDialog::InitUserDicts()
IMPL_LINK_NOARG(SpellDialog, AddToDictClickHdl, weld::Button&, void)
{
- AddToDictionaryExecute(OString::number(1));
+ AddToDictionaryExecute(OUString::number(1));
}
-IMPL_LINK(SpellDialog, AddToDictSelectHdl, const OString&, rIdent, void)
+IMPL_LINK(SpellDialog, AddToDictSelectHdl, const OUString&, rIdent, void)
{
AddToDictionaryExecute(rIdent);
}
-void SpellDialog::AddToDictionaryExecute(const OString& rItemId)
+void SpellDialog::AddToDictionaryExecute(const OUString& rItemId)
{
auto xGuard(std::make_unique<UndoChangeGroupGuard>(*m_xSentenceED));
@@ -904,7 +919,10 @@ IMPL_LINK_NOARG(SpellDialog, ModifyHdl, LinkParamNone*, void)
IMPL_LINK_NOARG(SpellDialog, CancelHdl, weld::Button&, void)
{
//apply changes and ignored text parts first - if there are any
- rParent.ApplyChangedSentence(m_xSentenceED->CreateSpellPortions(), false);
+ if (m_xSentenceED->IsModified())
+ {
+ rParent.ApplyChangedSentence(m_xSentenceED->CreateSpellPortions(), false);
+ }
Close();
}
@@ -942,7 +960,7 @@ void SpellDialog::Activate()
void SpellDialog::Deactivate()
{
- SfxModelessDialogController::Activate();
+ SfxModelessDialogController::Deactivate();
ToplevelFocusChanged();
}
@@ -966,15 +984,11 @@ void SpellDialog::InvalidateDialog()
m_xChangePB.get(),
m_xChangeAllPB.get(),
m_xAutoCorrPB.get(),
- m_xUndoPB.get(),
- nullptr
+ m_xUndoPB.get()
};
- sal_Int16 i = 0;
- while(aDisableArr[i])
- {
- aDisableArr[i]->set_sensitive(false);
- i++;
- }
+ for (weld::Widget* pWidget : aDisableArr)
+ pWidget->set_sensitive(false);
+
SfxModelessDialogController::Deactivate();
}
@@ -1067,7 +1081,7 @@ bool SpellDialog::GetNextSentence_Impl(std::unique_ptr<UndoChangeGroupGuard>* pG
}
if (elem.bIsField)
- m_xSentenceED->SetAttrib(SvxBackgroundColorItem(COL_LIGHTGRAY, EE_CHAR_BKGCOLOR), nStartPosition, nEndPosition);
+ m_xSentenceED->SetAttrib(SvxColorItem(COL_LIGHTGRAY, EE_CHAR_BKGCOLOR), nStartPosition, nEndPosition);
m_xSentenceED->SetAttrib(SvxLanguageItem(elem.eLanguage, EE_CHAR_LANGUAGE), nStartPosition, nEndPosition);
nStartPosition = nEndPosition;
}
@@ -1116,13 +1130,15 @@ bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasRe
return bRet;
}
-SentenceEditWindow_Impl::SentenceEditWindow_Impl()
- : m_pSpellDialog(nullptr)
+SentenceEditWindow_Impl::SentenceEditWindow_Impl(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow)
+ : m_xScrolledWindow(std::move(xScrolledWindow))
+ , m_pSpellDialog(nullptr)
, m_pToolbar(nullptr)
, m_nErrorStart(0)
, m_nErrorEnd(0)
, m_bIsUndoEditMode(false)
{
+ m_xScrolledWindow->connect_vadjustment_changed(LINK(this, SentenceEditWindow_Impl, ScrollHdl));
}
void SentenceEditWindow_Impl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
@@ -1133,6 +1149,90 @@ void SentenceEditWindow_Impl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
WeldEditView::SetDrawingArea(pDrawingArea);
// tdf#132288 don't merge equal adjacent attributes
m_xEditEngine->DisableAttributeExpanding();
+
+ m_xEditEngine->SetStatusEventHdl(LINK(this, SentenceEditWindow_Impl, EditStatusHdl));
+
+ SetDocumentColor(pDrawingArea);
+}
+
+void SentenceEditWindow_Impl::SetDocumentColor(weld::DrawingArea* pDrawingArea)
+{
+ if (!pDrawingArea || !m_xEditView || !m_xEditEngine)
+ return;
+ // tdf#142631 use document background color in this widget
+ Color aBgColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+ OutputDevice& rDevice = pDrawingArea->get_ref_device();
+ rDevice.SetBackground(aBgColor);
+ m_xEditView->SetBackgroundColor(aBgColor);
+ m_xEditEngine->SetBackgroundColor(aBgColor);
+}
+
+void SentenceEditWindow_Impl::StyleUpdated()
+{
+ SetDocumentColor(GetDrawingArea());
+ WeldEditView::StyleUpdated();
+}
+
+IMPL_LINK_NOARG(SentenceEditWindow_Impl, EditStatusHdl, EditStatus&, void)
+{
+ SetScrollBarRange();
+ DoScroll();
+}
+
+IMPL_LINK_NOARG(SentenceEditWindow_Impl, ScrollHdl, weld::ScrolledWindow&, void)
+{
+ DoScroll();
+}
+
+void SentenceEditWindow_Impl::DoScroll()
+{
+ if (m_xEditView)
+ {
+ auto currentDocPos = m_xEditView->GetVisArea().Top();
+ auto nDiff = currentDocPos - m_xScrolledWindow->vadjustment_get_value();
+ // we expect SetScrollBarRange callback to be triggered by Scroll
+ // to set where we ended up
+ m_xEditView->Scroll(0, nDiff);
+ }
+}
+
+void SentenceEditWindow_Impl::EditViewScrollStateChange()
+{
+ // editengine height has changed or editview scroll pos has changed
+ SetScrollBarRange();
+}
+
+void SentenceEditWindow_Impl::SetScrollBarRange()
+{
+ EditEngine *pEditEngine = GetEditEngine();
+ if (!pEditEngine)
+ return;
+ if (!m_xScrolledWindow)
+ return;
+ EditView* pEditView = GetEditView();
+ if (!pEditView)
+ return;
+
+ int nVUpper = pEditEngine->GetTextHeight();
+ int nVCurrentDocPos = pEditView->GetVisArea().Top();
+ const Size aOut(pEditView->GetOutputArea().GetSize());
+ int nVStepIncrement = aOut.Height() * 2 / 10;
+ int nVPageIncrement = aOut.Height() * 8 / 10;
+ int nVPageSize = aOut.Height();
+
+ /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
+ effectively...
+
+ lower = gtk_adjustment_get_lower
+ upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
+
+ and requires that upper > lower or the deceleration animation never ends
+ */
+ nVPageSize = std::min(nVPageSize, nVUpper);
+
+ m_xScrolledWindow->vadjustment_configure(nVCurrentDocPos, 0, nVUpper,
+ nVStepIncrement, nVPageIncrement, nVPageSize);
+ m_xScrolledWindow->set_vpolicy(nVUpper > nVPageSize ? VclPolicyType::ALWAYS : VclPolicyType::NEVER);
}
SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
@@ -1160,7 +1260,10 @@ namespace
void ExtractErrorDescription(const EECharAttrib& rEECharAttrib, SpellErrorDescription& rSpellErrorDescription)
{
css::uno::Sequence<css::uno::Any> aSequence;
- static_cast<const SfxGrabBagItem*>(rEECharAttrib.pAttr)->GetGrabBag().find("SpellErrorDescription")->second >>= aSequence;
+ const auto pGrabBag = static_cast<const SfxGrabBagItem*>(rEECharAttrib.pAttr)->GetGrabBag();
+ const auto iter = pGrabBag.find("SpellErrorDescription");
+ assert(iter != pGrabBag.end());
+ iter->second >>= aSequence;
rSpellErrorDescription.fromSequence(aSequence);
}
}
@@ -1484,6 +1587,8 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt)
//start position
if (!IsUndoEditMode() && bIsErrorActive)
{
+ aAttribList.clear();
+ m_xEditEngine->GetCharAttribs(0, aAttribList);
const EECharAttrib* pFontColor = FindCharAttrib(nCursor, EE_CHAR_COLOR, aAttribList);
const EECharAttrib* pErrorAttrib = FindCharAttrib(m_nErrorStart, EE_CHAR_GRABBAG, aAttribList);
if (pFontColor && pErrorAttrib)
@@ -1515,7 +1620,7 @@ void SentenceEditWindow_Impl::Init(weld::Toolbar* pToolbar)
m_pToolbar->connect_clicked(LINK(this,SentenceEditWindow_Impl,ToolbarHdl));
}
-IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OString&, rCurItemId, void)
+IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OUString&, rCurItemId, void)
{
if (rCurItemId == "paste")
{
@@ -1524,9 +1629,9 @@ IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OString&, rCurItemId, void)
}
else if (rCurItemId == "insert")
{
- if (vcl::GetGetSpecialCharsFunction())
+ if (auto pImplFncGetSpecialChars = vcl::GetGetSpecialCharsFunction())
{
- OUString aChars = vcl::GetGetSpecialCharsFunction()(GetDrawingArea(), m_xEditEngine->GetStandardFont(0));
+ OUString aChars = pImplFncGetSpecialChars(GetDrawingArea(), m_xEditEngine->GetStandardFont(0));
if (!aChars.isEmpty())
{
ESelection aCurrentSelection(m_xEditView->GetSelection());
@@ -1664,8 +1769,12 @@ void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_Int32 nStart, sal_Int32 nEnd,
m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_WEIGHT_CJK);
m_xEditEngine->RemoveAttribs(aAll, false, EE_CHAR_WEIGHT_CTL);
+ // tdf#116566 Use color defined in the current Color Scheme
+ Color aSpellErrorCollor = svtools::ColorConfig().GetColorValue(svtools::SPELL).nColor;
+ Color aGrammarErrorCollor = svtools::ColorConfig().GetColorValue(svtools::GRAMMAR).nColor;
+
SfxItemSet aSet(m_xEditEngine->GetEmptyItemSet());
- aSet.Put(SvxColorItem(bGrammarError ? COL_LIGHTBLUE : COL_LIGHTRED, EE_CHAR_COLOR));
+ aSet.Put(SvxColorItem(bGrammarError ? aGrammarErrorCollor : aSpellErrorCollor, EE_CHAR_COLOR));
aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT_CJK));
aSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL));
@@ -1680,6 +1789,8 @@ void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_Int32 nStart, sal_Int32 nEnd,
if (!bCurrentSelectionInRange)
{
m_xEditView->SetSelection(ESelection(0, nStart));
+ // tdf#157148 ensure current location is auto-scrolled to be visible
+ m_xEditView->ShowCursor();
}
Invalidate();
@@ -1813,7 +1924,7 @@ void SentenceEditWindow_Impl::SetAlternatives( const Reference< XSpellAlternativ
aLocale = xAlt->getLocale();
aAlts = xAlt->getAlternatives();
}
- SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, nullptr);
+ SpellErrorDescription aDesc( false, aWord, std::move(aLocale), aAlts, nullptr);
SfxGrabBagItem aSpellErrorDescription(EE_CHAR_GRABBAG);
aSpellErrorDescription.GetGrabBag()["SpellErrorDescription"] <<= aDesc.toSequence();
SetAttrib(aSpellErrorDescription, m_nErrorStart, m_nErrorEnd);
@@ -1942,7 +2053,6 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
aPortion1.eLanguage = eLang;
aPortion1.sText = m_xEditEngine->GetText(ESelection(0, nStart, 0, aStart->nPosition));
-
bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end();
if( bIsIgnoreError )
{
@@ -1974,7 +2084,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
aPortion2.sText = aLeftOverText.makeStringAndClear();
aRet.push_back( aPortion2 );
}
- else
+ else if (!aLeftOverText.isEmpty() && !aRet.empty())
{ // we just need to append the left-over text to the last portion (which had no errors)
aRet[ aRet.size() - 1 ].sText += aLeftOverText;
}
@@ -1986,7 +2096,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
void SentenceEditWindow_Impl::Undo()
{
- SfxUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
+ EditUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
DBG_ASSERT(GetUndoActionCount(), "no undo actions available" );
if(!GetUndoActionCount())
return;
@@ -2005,13 +2115,13 @@ void SentenceEditWindow_Impl::Undo()
void SentenceEditWindow_Impl::ResetUndo()
{
- SfxUndoManager& rUndo = m_xEditEngine->GetUndoManager();
+ EditUndoManager& rUndo = m_xEditEngine->GetUndoManager();
rUndo.Clear();
}
void SentenceEditWindow_Impl::AddUndoAction( std::unique_ptr<SfxUndoAction> pAction )
{
- SfxUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
+ EditUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
rUndoMgr.AddUndoAction(std::move(pAction));
GetSpellDialog()->m_xUndoPB->set_sensitive(true);
}
@@ -2060,15 +2170,10 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
pSpellDialog->m_xLanguageLB->get_widget(),
pSpellDialog->m_xAddToDictMB.get(),
pSpellDialog->m_xAddToDictPB.get(),
- pSpellDialog->m_xAutoCorrPB.get(),
- nullptr
+ pSpellDialog->m_xAutoCorrPB.get()
};
- sal_Int32 nIdx = 0;
- do
- {
- aControls[nIdx]->set_sensitive(false);
- }
- while(aControls[++nIdx]);
+ for (weld::Widget* pWidget : aControls)
+ pWidget->set_sensitive(false);
//remove error marks
ESelection aAll(0, 0, 0, EE_TEXTPOS_ALL);
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 12d1927b5ccd..ce82e418cf9e 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -17,13 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
+
#include <about.hxx>
#include <osl/process.h> //osl_getProcessLocale
+#include <rtl/bootstrap.hxx>
#include <sal/log.hxx> //SAL_WARN
+#include <vcl/graph.hxx> //Graphic
#include <vcl/settings.hxx> //GetSettings
#include <vcl/svapp.hxx> //Application::
-#include <vcl/virdev.hxx> //VirtualDevice
#include <vcl/weld.hxx>
#include <unotools/resmgr.hxx> //Translate
@@ -76,7 +81,7 @@ AboutDialog::AboutDialog(weld::Window *pParent)
m_pBuildLabel->set_uri("https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h="
+ sbuildId);
m_pBuildLabel->set_label(sbuildId.getLength() > nMaxChar ? sbuildId.replaceAt(
- nMaxChar, sbuildId.getLength() - nMaxChar, "...")
+ nMaxChar, sbuildId.getLength() - nMaxChar, u"...")
: sbuildId);
} else {
m_pBuildCaption->hide();
@@ -100,24 +105,24 @@ AboutDialog::AboutDialog(weld::Window *pParent)
? "shell/logo_inverted"
: "shell/logo",
aBackgroundBitmap, nWidth * 0.8)) {
- ScopedVclPtr<VirtualDevice> m_pVirDev =
- m_pBrandImage->create_virtual_device();
- m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel());
- m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap);
- m_pBrandImage->set_image(m_pVirDev.get());
- m_pVirDev.disposeAndClear();
+ // Eliminate white background when Skia is disabled by not drawing the
+ // background bitmap to a VirtualDevice. On most platforms, non-Skia
+ // VirtualDevices will be filled with a solid color when drawing
+ // the bitmap.
+ Graphic aGraphic(aBackgroundBitmap);
+ m_pBrandImage->set_image(aGraphic.GetXGraphic());
}
if (SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, nWidth * 0.9)) {
- ScopedVclPtr<VirtualDevice> m_pVirDev =
- m_pAboutImage->create_virtual_device();
- m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel());
- m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap);
- m_pAboutImage->set_image(m_pVirDev.get());
- m_pVirDev.disposeAndClear();
+ // Eliminate white background when Skia is disabled by not drawing the
+ // background bitmap to a VirtualDevice. On most platforms, non-Skia
+ // VirtualDevices will be filled with a solid color when drawing
+ // the bitmap.
+ Graphic aGraphic(aBackgroundBitmap);
+ m_pAboutImage->set_image(aGraphic.GetXGraphic());
}
// Links
- m_pCreditsButton->set_uri(CuiResId(RID_SVXSTR_ABOUT_CREDITS_URL));
+ m_pCreditsButton->set_uri(officecfg::Office::Common::Menus::CreditsURL::get());
OUString sURL(officecfg::Office::Common::Help::StartCenter::InfoURL::get());
localizeWebserviceURI(sURL);
@@ -136,23 +141,16 @@ AboutDialog::AboutDialog(weld::Window *pParent)
AboutDialog::~AboutDialog() {}
-bool AboutDialog::IsStringValidGitHash(const OUString &hash) {
- for (int i = 0; i < hash.getLength(); i++) {
- if (!std::isxdigit(hash[i])) {
- return false;
- }
- }
- return true;
+bool AboutDialog::IsStringValidGitHash(std::u16string_view hash) {
+ return std::all_of(hash.begin(), hash.end(),
+ [](auto &rSymbol) { return std::isxdigit(rSymbol); });
}
OUString AboutDialog::GetVersionString() {
- OUString sVersion = CuiResId("%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX");
-
-#ifdef _WIN64
- sVersion += " (x64)";
-#elif defined(_WIN32)
- sVersion += " (x86)";
-#endif
+ OUString arch;
+ auto const ok = rtl::Bootstrap::get("_ARCH", arch);
+ assert(ok); (void) ok;
+ OUString sVersion = CuiResId(TranslateId(nullptr, "%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX")) + " (" + arch + ")";
#if HAVE_FEATURE_COMMUNITY_FLAVOR
sVersion += " / LibreOffice Community";
@@ -192,9 +190,9 @@ OUString AboutDialog::GetLocaleString(const bool bLocalized) {
Application::GetSettings().GetUILanguageTag().getBcp47();
OUString sUILocaleStr;
if (bLocalized)
- sUILocaleStr = CuiResId(RID_SVXSTR_ABOUT_UILOCALE);
+ sUILocaleStr = CuiResId(RID_CUISTR_ABOUT_UILOCALE);
else
- sUILocaleStr = Translate::get(RID_SVXSTR_ABOUT_UILOCALE, Translate::Create("cui", LanguageTag("en-US")));
+ sUILocaleStr = Translate::get(RID_CUISTR_ABOUT_UILOCALE, Translate::Create("cui", LanguageTag("en-US")));
if (sUILocaleStr.indexOf("$LOCALE") == -1) {
SAL_WARN("cui.dialogs", "translated uilocale string in translations "
@@ -216,14 +214,11 @@ OUString AboutDialog::GetMiscString() {
sMisc = EXTRA_BUILDID "\n";
}
- OUString aCalcMode = "Calc: "; // Calc calculation mode
+ OUString aCalcMode; // Calc calculation mode
#if HAVE_FEATURE_OPENCL
- bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled();
- if (bOpenCL)
- aCalcMode += "CL";
-#else
- const bool bOpenCL = false;
+ if (openclwrapper::GPUEnv::isOpenCLEnabled())
+ aCalcMode += " CL";
#endif
static const bool bThreadingProhibited =
@@ -231,32 +226,31 @@ OUString AboutDialog::GetMiscString() {
bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation::
UseThreadedCalculationForFormulaGroups::get();
- if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) {
- if (!aCalcMode.endsWith(" "))
- aCalcMode += " ";
- aCalcMode += "threaded";
+ if (!bThreadingProhibited && bThreadedCalc) {
+ aCalcMode += " threaded";
}
if (officecfg::Office::Calc::Defaults::Sheet::JumboSheets::get())
{
- if (!aCalcMode.endsWith(" "))
- aCalcMode += " ";
- aCalcMode += "Jumbo";
+ aCalcMode += " Jumbo";
}
- sMisc += aCalcMode;
+
+ if (aCalcMode.isEmpty())
+ aCalcMode = " default";
+ sMisc += "Calc:" + aCalcMode;
return sMisc;
}
OUString AboutDialog::GetCopyrightString() {
- OUString sVendorTextStr(CuiResId(RID_SVXSTR_ABOUT_VENDOR));
+ OUString sVendorTextStr(CuiResId(RID_CUISTR_ABOUT_VENDOR));
OUString aCopyrightString =
- sVendorTextStr + "\n" + CuiResId(RID_SVXSTR_ABOUT_COPYRIGHT) + "\n";
+ sVendorTextStr + "\n" + CuiResId(RID_CUISTR_ABOUT_COPYRIGHT) + "\n";
if (utl::ConfigManager::getProductName() == "LibreOffice")
- aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_BASED_ON);
+ aCopyrightString += CuiResId(RID_CUISTR_ABOUT_BASED_ON);
else
- aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_DERIVED);
+ aCopyrightString += CuiResId(RID_CUISTR_ABOUT_DERIVED);
return aCopyrightString;
}
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index a341c193c890..290025929d5a 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -19,18 +19,21 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/awt/XWindow.hpp>
-#include <cppuhelper/compbase.hxx>
+
+#include <comphelper/propertyvalue.hxx>
+#include <comphelper/compbase.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/basemutex.hxx>
#include <vcl/customweld.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
#include <vcl/weld.hxx>
+#include <sfx2/basedlgs.hxx>
#include <svx/hexcolorcontrol.hxx>
#include <basegfx/color/bcolortools.hxx>
#include <cmath>
@@ -197,6 +200,7 @@ class ColorFieldControl : public weld::CustomWidgetController
public:
ColorFieldControl()
: meMode( DefaultMode )
+ , mnBaseValue(USHRT_MAX)
, mdX( -1.0 )
, mdY( -1.0 )
, mbMouseCaptured(false)
@@ -226,7 +230,7 @@ public:
void UpdatePosition();
void Modify();
- void SetValues(Color aColor, ColorMode eMode, double x, double y);
+ void SetValues(sal_uInt16 nBaseValue, ColorMode eMode, double x, double y);
double GetX() const { return mdX;}
double GetY() const { return mdY;}
@@ -234,7 +238,7 @@ public:
private:
ColorMode meMode;
- Color maColor;
+ sal_uInt16 mnBaseValue;
double mdX;
double mdY;
bool mbMouseCaptured;
@@ -303,11 +307,6 @@ void ColorFieldControl::UpdateBitmap()
sal_uInt8* pRGB_Vert = maRGB_Vert.data();
sal_uInt16* pPercent_Vert = maPercent_Vert.data();
- Color aBitmapColor(maColor);
-
- sal_uInt16 nHue, nSat, nBri;
- maColor.RGBtoHSB(nHue, nSat, nBri);
-
// this has been unlooped for performance reason, please do not merge back!
sal_uInt16 y = nHeight,x;
@@ -317,40 +316,43 @@ void ColorFieldControl::UpdateBitmap()
case HUE:
while (y--)
{
- nBri = pPercent_Vert[y];
+ sal_uInt16 nBri = pPercent_Vert[y];
x = nWidth;
while (x--)
{
- nSat = pPercent_Horiz[x];
- mxBitmap->DrawPixel(Point(x,y), Color::HSBtoRGB(nHue, nSat, nBri));
+ sal_uInt16 nSat = pPercent_Horiz[x];
+ mxBitmap->DrawPixel(Point(x,y), Color::HSBtoRGB(mnBaseValue, nSat, nBri));
}
}
break;
case SATURATION:
while (y--)
{
- nBri = pPercent_Vert[y];
+ sal_uInt16 nBri = pPercent_Vert[y];
x = nWidth;
while (x--)
{
- nHue = pGrad_Horiz[x];
- mxBitmap->DrawPixel(Point(x,y), Color::HSBtoRGB(nHue, nSat, nBri));
+ sal_uInt16 nHue = pGrad_Horiz[x];
+ mxBitmap->DrawPixel(Point(x,y), Color::HSBtoRGB(nHue, mnBaseValue, nBri));
}
}
break;
case BRIGHTNESS:
while (y--)
{
- nSat = pPercent_Vert[y];
+ sal_uInt16 nSat = pPercent_Vert[y];
x = nWidth;
while (x--)
{
- nHue = pGrad_Horiz[x];
- mxBitmap->DrawPixel(Point(x,y), Color::HSBtoRGB(nHue, nSat, nBri));
+ sal_uInt16 nHue = pGrad_Horiz[x];
+ mxBitmap->DrawPixel(Point(x,y), Color::HSBtoRGB(nHue, nSat, mnBaseValue));
}
}
break;
case RED:
+ {
+ Color aBitmapColor;
+ aBitmapColor.SetRed(mnBaseValue);
while (y--)
{
aBitmapColor.SetGreen(pRGB_Vert[y]);
@@ -362,7 +364,11 @@ void ColorFieldControl::UpdateBitmap()
}
}
break;
+ }
case GREEN:
+ {
+ Color aBitmapColor;
+ aBitmapColor.SetGreen(mnBaseValue);
while (y--)
{
aBitmapColor.SetRed(pRGB_Vert[y]);
@@ -374,7 +380,11 @@ void ColorFieldControl::UpdateBitmap()
}
}
break;
+ }
case BLUE:
+ {
+ Color aBitmapColor;
+ aBitmapColor.SetBlue(mnBaseValue);
while (y--)
{
aBitmapColor.SetGreen(pRGB_Vert[y]);
@@ -386,9 +396,12 @@ void ColorFieldControl::UpdateBitmap()
}
}
break;
+ }
}
}
+constexpr int nCenterOffset = 5;
+
void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
{
if (!mxBitmap)
@@ -415,8 +428,8 @@ void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
nY = aSize.Height() - 1;
Point aPos = maPosition;
- maPosition.setX( nX - 5 );
- maPosition.setY( nY - 5 );
+ maPosition.setX( nX - nCenterOffset );
+ maPosition.setY( nY - nCenterOffset );
Invalidate(tools::Rectangle(aPos, Size(11, 11)));
Invalidate(tools::Rectangle(maPosition, Size(11, 11)));
@@ -424,8 +437,6 @@ void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
{
mdX = double(nX) / double(aSize.Width() - 1.0);
mdY = double(aSize.Height() - 1.0 - nY) / double(aSize.Height() - 1.0);
-
- maColor = mxBitmap->GetPixel(Point(nX, nY));
}
}
@@ -460,20 +471,21 @@ void ColorFieldControl::Paint(vcl::RenderContext& rRenderContext, const tools::R
if (!mxBitmap)
UpdateBitmap();
- if (mxBitmap)
- {
- Size aSize(GetOutputSizePixel());
- rRenderContext.DrawOutDev(Point(0, 0), aSize, Point(0, 0), aSize, *mxBitmap);
- }
+ if (!mxBitmap)
+ return;
+
+ Size aSize(GetOutputSizePixel());
+ rRenderContext.DrawOutDev(Point(0, 0), aSize, Point(0, 0), aSize, *mxBitmap);
// draw circle around current color
- if (maColor.IsDark())
- rRenderContext.SetLineColor( COL_WHITE );
+ Point aPos(maPosition.X() + nCenterOffset, maPosition.Y() + nCenterOffset);
+ Color aColor = mxBitmap->GetPixel(aPos);
+ if (aColor.IsDark())
+ rRenderContext.SetLineColor(COL_WHITE);
else
- rRenderContext.SetLineColor( COL_BLACK );
+ rRenderContext.SetLineColor(COL_BLACK);
rRenderContext.SetFillColor();
-
rRenderContext.DrawEllipse(::tools::Rectangle(maPosition, Size(11, 11)));
}
@@ -489,13 +501,13 @@ void ColorFieldControl::Modify()
maModifyHdl.Call( *this );
}
-void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, double y )
+void ColorFieldControl::SetValues(sal_uInt16 nBaseValue, ColorMode eMode, double x, double y)
{
- bool bUpdateBitmap = (maColor!= aColor) || (meMode != eMode);
- if( !(bUpdateBitmap || (mdX != x) || (mdY != y)) )
+ bool bUpdateBitmap = (mnBaseValue != nBaseValue) || (meMode != eMode);
+ if (!bUpdateBitmap && mdX == x && mdY == y)
return;
- maColor = aColor;
+ mnBaseValue = nBaseValue;
meMode = eMode;
mdX = x;
mdY = y;
@@ -727,7 +739,7 @@ void ColorSliderControl::SetValue(const Color& rColor, ColorMode eMode, double d
namespace {
-class ColorPickerDialog : public weld::GenericDialogController
+class ColorPickerDialog : public SfxDialogController
{
private:
ColorFieldControl m_aColorField;
@@ -773,7 +785,7 @@ public:
DECL_LINK(ColorModifyMetricHdl, weld::MetricSpinButton&, void);
DECL_LINK(ColorModifySpinHdl, weld::SpinButton&, void);
DECL_LINK(ColorModifyEditHdl, weld::Entry&, void);
- DECL_LINK(ModeModifyHdl, weld::ToggleButton&, void);
+ DECL_LINK(ModeModifyHdl, weld::Toggleable&, void);
Color GetColor() const;
@@ -790,7 +802,7 @@ private:
}
ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, Color nColor, sal_Int16 nDialogMode)
- : GenericDialogController(pParent, "cui/ui/colorpickerdialog.ui", "ColorPicker")
+ : SfxDialogController(pParent, "cui/ui/colorpickerdialog.ui", "ColorPicker")
, m_xColorField(new weld::CustomWeld(*m_xBuilder, "colorField", m_aColorField))
, m_xColorSlider(new weld::CustomWeld(*m_xBuilder, "colorSlider", m_aColorSlider))
, m_xColorPreview(new weld::CustomWeld(*m_xBuilder, "preview", m_aColorPreview))
@@ -840,7 +852,7 @@ ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, Color nColor, sal_In
m_xEDHex->connect_changed(LINK(this, ColorPickerDialog, ColorModifyEditHdl));
- Link<weld::ToggleButton&,void> aLink2 = LINK( this, ColorPickerDialog, ModeModifyHdl );
+ Link<weld::Toggleable&,void> aLink2 = LINK( this, ColorPickerDialog, ModeModifyHdl );
m_xRBRed->connect_toggled( aLink2 );
m_xRBGreen->connect_toggled( aLink2 );
m_xRBBlue->connect_toggled( aLink2 );
@@ -883,7 +895,9 @@ void ColorPickerDialog::update_color( UpdateFlags n )
sal_uInt8 nGreen = toInt(mdGreen,255.0);
sal_uInt8 nBlue = toInt(mdBlue,255.0);
- Color aColor(nRed, nGreen, nBlue);
+ sal_uInt16 nHue = toInt(mdHue, 1.0);
+ sal_uInt16 nSat = toInt(mdSat, 100.0);
+ sal_uInt16 nBri = toInt(mdBri, 100.0);
if (n & UpdateFlags::RGB) // update RGB
{
@@ -902,9 +916,9 @@ void ColorPickerDialog::update_color( UpdateFlags n )
if (n & UpdateFlags::HSB ) // update HSB
{
- m_xMFHue->set_value(toInt(mdHue, 1.0), FieldUnit::DEGREE);
- m_xMFSaturation->set_value(toInt( mdSat, 100.0), FieldUnit::PERCENT);
- m_xMFBrightness->set_value(toInt( mdBri, 100.0), FieldUnit::PERCENT);
+ m_xMFHue->set_value(nHue, FieldUnit::DEGREE);
+ m_xMFSaturation->set_value(nSat, FieldUnit::PERCENT);
+ m_xMFBrightness->set_value(nBri, FieldUnit::PERCENT);
}
if (n & UpdateFlags::ColorChooser ) // update Color Chooser 1
@@ -912,26 +926,28 @@ void ColorPickerDialog::update_color( UpdateFlags n )
switch( meMode )
{
case HUE:
- m_aColorField.SetValues(aColor, meMode, mdSat, mdBri);
+ m_aColorField.SetValues(nHue, meMode, mdSat, mdBri);
break;
case SATURATION:
- m_aColorField.SetValues(aColor, meMode, mdHue / 360.0, mdBri);
+ m_aColorField.SetValues(nSat, meMode, mdHue / 360.0, mdBri);
break;
case BRIGHTNESS:
- m_aColorField.SetValues(aColor, meMode, mdHue / 360.0, mdSat);
+ m_aColorField.SetValues(nBri, meMode, mdHue / 360.0, mdSat);
break;
case RED:
- m_aColorField.SetValues(aColor, meMode, mdBlue, mdGreen);
+ m_aColorField.SetValues(nRed, meMode, mdBlue, mdGreen);
break;
case GREEN:
- m_aColorField.SetValues(aColor, meMode, mdBlue, mdRed);
+ m_aColorField.SetValues(nGreen, meMode, mdBlue, mdRed);
break;
case BLUE:
- m_aColorField.SetValues(aColor, meMode, mdRed, mdGreen);
+ m_aColorField.SetValues(nBlue, meMode, mdRed, mdGreen);
break;
}
}
+ Color aColor(nRed, nGreen, nBlue);
+
if (n & UpdateFlags::ColorSlider) // update Color Chooser 2
{
switch (meMode)
@@ -1120,7 +1136,7 @@ IMPL_LINK(ColorPickerDialog, ColorModifySpinHdl, weld::SpinButton&, rEdit, void)
}
-IMPL_LINK_NOARG(ColorPickerDialog, ModeModifyHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ColorPickerDialog, ModeModifyHdl, weld::Toggleable&, void)
{
ColorMode eMode = HUE;
@@ -1205,12 +1221,11 @@ void ColorPickerDialog::setColorComponent( ColorComponent nComp, double dValue )
}
}
-typedef ::cppu::WeakComponentImplHelper< XServiceInfo, XExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase;
+typedef ::comphelper::WeakComponentImplHelper< XServiceInfo, XExecutableDialog, XAsynchronousExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase;
namespace {
-class ColorPicker : protected ::cppu::BaseMutex, // Struct for right initialization of mutex member! Must be first of baseclasses.
- public ColorPickerBase
+class ColorPicker : public ColorPickerBase
{
public:
explicit ColorPicker();
@@ -1231,6 +1246,10 @@ public:
virtual void SAL_CALL setTitle( const OUString& aTitle ) override;
virtual sal_Int16 SAL_CALL execute( ) override;
+ // XAsynchronousExecutableDialog
+ virtual void SAL_CALL setDialogTitle( const OUString& aTitle ) override;
+ virtual void SAL_CALL startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) override;
+
private:
Color mnColor;
sal_Int16 mnMode;
@@ -1247,12 +1266,11 @@ com_sun_star_cui_ColorPicker_get_implementation(
}
-constexpr OUStringLiteral gsColorKey( u"Color" );
+constexpr OUString gsColorKey( u"Color"_ustr );
constexpr OUStringLiteral gsModeKey( u"Mode" );
ColorPicker::ColorPicker()
- : ColorPickerBase( m_aMutex )
- , mnColor( 0 )
+ : mnColor( 0 )
, mnMode( 0 )
{
}
@@ -1279,15 +1297,14 @@ sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName )
Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( )
{
- return { "com.sun.star.ui.dialogs.ColorPicker" };
+ return { "com.sun.star.ui.dialogs.ColorPicker",
+ "com.sun.star.ui.dialogs.AsynchronousColorPicker" };
}
// XPropertyAccess
Sequence< PropertyValue > SAL_CALL ColorPicker::getPropertyValues( )
{
- Sequence< PropertyValue > props(1);
- props[0].Name = gsColorKey;
- props[0].Value <<= mnColor;
+ Sequence< PropertyValue > props{ comphelper::makePropertyValue(gsColorKey, mnColor) };
return props;
}
@@ -1320,6 +1337,25 @@ sal_Int16 SAL_CALL ColorPicker::execute()
return ret;
}
+// XAsynchronousExecutableDialog
+void SAL_CALL ColorPicker::setDialogTitle( const OUString& )
+{
+}
+
+void SAL_CALL ColorPicker::startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener )
+{
+ std::shared_ptr<ColorPickerDialog> xDlg = std::make_shared<ColorPickerDialog>(Application::GetFrameWeld(mxParent), mnColor, mnMode);
+ rtl::Reference<ColorPicker> xThis(this);
+ weld::DialogController::runAsync(xDlg, [xThis=std::move(xThis), xDlg, xListener] (sal_Int32 nResult) {
+ if (nResult)
+ xThis->mnColor = xDlg->GetColor();
+
+ sal_Int16 nRet = static_cast<sal_Int16>(nResult);
+ css::ui::dialogs::DialogClosedEvent aEvent( *xThis, nRet );
+ xListener->dialogClosed( aEvent );
+ });
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
deleted file mode 100644
index 83931f69e9e2..000000000000
--- a/cui/source/dialogs/cuicharmap.cxx
+++ /dev/null
@@ -1,1245 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <stdio.h>
-
-#include <vcl/svapp.hxx>
-#include <svl/eitem.hxx>
-#include <svl/intitem.hxx>
-#include <svl/itempool.hxx>
-
-#include <rtl/textenc.h>
-#include <svx/ucsubset.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/fontcharmap.hxx>
-#include <vcl/virdev.hxx>
-#include <svl/stritem.hxx>
-#include <o3tl/temporary.hxx>
-#include <officecfg/Office/Common.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/dispatchcommand.hxx>
-
-#include <dialmgr.hxx>
-#include <cui/cuicharmap.hxx>
-#include <sfx2/app.hxx>
-#include <svx/svxids.hrc>
-#include <editeng/editids.hrc>
-#include <editeng/fontitem.hxx>
-#include <strings.hrc>
-#include <unicode/uchar.h>
-#include <unicode/utypes.h>
-
-using namespace css;
-
-SvxCharacterMap::SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet,
- const css::uno::Reference<css::frame::XFrame>& rFrame)
- : SfxDialogController(pParent, "cui/ui/specialcharacters.ui", "SpecialCharactersDialog")
- , m_xVirDev(VclPtr<VirtualDevice>::Create())
- , isSearchMode(true)
- , m_xFrame(rFrame)
- , mxContext(comphelper::getProcessComponentContext())
- , m_aRecentCharView{SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev)}
- , m_aFavCharView{SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev),
- SvxCharView(m_xVirDev)}
- , m_aShowChar(m_xVirDev)
- , m_xOKBtn(m_xFrame.is() ? m_xBuilder->weld_button("insert") : m_xBuilder->weld_button("ok"))
- , m_xFontText(m_xBuilder->weld_label("fontft"))
- , m_xFontLB(m_xBuilder->weld_combo_box("fontlb"))
- , m_xSubsetText(m_xBuilder->weld_label("subsetft"))
- , m_xSubsetLB(m_xBuilder->weld_combo_box("subsetlb"))
- , m_xSearchText(m_xBuilder->weld_entry("search"))
- , m_xHexCodeText(m_xBuilder->weld_entry("hexvalue"))
- , m_xDecimalCodeText(m_xBuilder->weld_entry("decimalvalue"))
- , m_xFavouritesBtn(m_xBuilder->weld_button("favbtn"))
- , m_xCharName(m_xBuilder->weld_label("charname"))
- , m_xRecentGrid(m_xBuilder->weld_widget("viewgrid"))
- , m_xFavGrid(m_xBuilder->weld_widget("favgrid"))
- , m_xShowChar(new weld::CustomWeld(*m_xBuilder, "showchar", m_aShowChar))
- , m_xRecentCharView{std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar1", m_aRecentCharView[0]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar2", m_aRecentCharView[1]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar3", m_aRecentCharView[2]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar4", m_aRecentCharView[3]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar5", m_aRecentCharView[4]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar6", m_aRecentCharView[5]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar7", m_aRecentCharView[6]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar8", m_aRecentCharView[7]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar9", m_aRecentCharView[8]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar10", m_aRecentCharView[9]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar11", m_aRecentCharView[10]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar12", m_aRecentCharView[11]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar13", m_aRecentCharView[12]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar14", m_aRecentCharView[13]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar15", m_aRecentCharView[14]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "viewchar16", m_aRecentCharView[15])}
- , m_xFavCharView{std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar1", m_aFavCharView[0]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar2", m_aFavCharView[1]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar3", m_aFavCharView[2]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar4", m_aFavCharView[3]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar5", m_aFavCharView[4]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar6", m_aFavCharView[5]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar7", m_aFavCharView[6]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar8", m_aFavCharView[7]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar9", m_aFavCharView[8]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar10", m_aFavCharView[9]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar11", m_aFavCharView[10]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar12", m_aFavCharView[11]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar13", m_aFavCharView[12]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar14", m_aFavCharView[13]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar15", m_aFavCharView[14]),
- std::make_unique<weld::CustomWeld>(*m_xBuilder, "favchar16", m_aFavCharView[15])}
- , m_xShowSet(new SvxShowCharSet(m_xBuilder->weld_scrolled_window("showscroll", true), m_xVirDev))
- , m_xShowSetArea(new weld::CustomWeld(*m_xBuilder, "showcharset", *m_xShowSet))
- , m_xSearchSet(new SvxSearchCharSet(m_xBuilder->weld_scrolled_window("searchscroll", true), m_xVirDev))
- , m_xSearchSetArea(new weld::CustomWeld(*m_xBuilder, "searchcharset", *m_xSearchSet))
-{
- m_aShowChar.SetCentered(true);
- m_xFontLB->make_sorted();
- //lock the size request of this widget to the width of all possible entries
- fillAllSubsets(*m_xSubsetLB);
- m_xSubsetLB->set_size_request(m_xSubsetLB->get_preferred_size().Width(), -1);
- m_xCharName->set_size_request(m_aShowChar.get_preferred_size().Width(), m_xCharName->get_text_height() * 4);
- //lock the size request of this widget to the width of the original .ui string
- m_xHexCodeText->set_size_request(m_xHexCodeText->get_preferred_size().Width(), -1);
- //so things don't jump around if all the children are hidden
- m_xRecentGrid->set_size_request(-1, m_aRecentCharView[0].get_preferred_size().Height());
- m_xFavGrid->set_size_request(-1, m_aFavCharView[0].get_preferred_size().Height());
-
- init();
-
- const SfxInt32Item* pCharItem = SfxItemSet::GetItem<SfxInt32Item>(pSet, SID_ATTR_CHAR, false);
- if ( pCharItem )
- SetChar( pCharItem->GetValue() );
-
- const SfxBoolItem* pDisableItem = SfxItemSet::GetItem<SfxBoolItem>(pSet, FN_PARAM_2, false);
- if ( pDisableItem && pDisableItem->GetValue() )
- DisableFontSelection();
-
- const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pSet, SID_ATTR_CHAR_FONT, false);
- const SfxStringItem* pFontNameItem = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_FONT_NAME, false);
- if ( pFontItem )
- {
- vcl::Font aTmpFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetFontSize() );
- aTmpFont.SetCharSet( pFontItem->GetCharSet() );
- aTmpFont.SetPitch( pFontItem->GetPitch() );
- SetCharFont( aTmpFont );
- }
- else if ( pFontNameItem )
- {
- vcl::Font aTmpFont( GetCharFont() );
- aTmpFont.SetFamilyName( pFontNameItem->GetValue() );
- SetCharFont( aTmpFont );
- }
-
- m_xOutputSet.reset(new SfxAllItemSet(pSet ? *pSet->GetPool() : SfxGetpApp()->GetPool()));
- m_xShowSet->Show();
- m_xSearchSet->Hide();
-}
-
-short SvxCharacterMap::run()
-{
- if( SvxShowCharSet::getSelectedChar() == ' ')
- {
- m_xOKBtn->set_sensitive(false);
- setFavButtonState(OUString(), OUString());
- }
- else
- {
- sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
- // using the new UCS4 constructor
- OUString aOUStr( &cChar, 1 );
- m_aShowChar.SetText(aOUStr);
-
- setFavButtonState(aOUStr, m_aShowChar.GetFont().GetFamilyName());
- m_xOKBtn->set_sensitive(true);
- }
-
- return SfxDialogController::run();
-}
-
-void SvxCharacterMap::SetChar( sal_UCS4 c )
-{
- m_xShowSet->SelectCharacter( c );
- setFavButtonState(OUString(&c, 1), aFont.GetFamilyName());
-}
-
-sal_UCS4 SvxCharacterMap::GetChar() const
-{
- return m_aShowChar.GetText().iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
-}
-
-void SvxCharacterMap::DisableFontSelection()
-{
- m_xFontText->set_sensitive(false);
- m_xFontLB->set_sensitive(false);
-}
-
-
-void SvxCharacterMap::getRecentCharacterList()
-{
- //retrieve recent character list
- const css::uno::Sequence< OUString > rRecentCharList( officecfg::Office::Common::RecentCharacters::RecentCharacterList::get() );
- for (OUString const & s : rRecentCharList)
- {
- maRecentCharList.push_back(s);
- }
-
- //retrieve recent character font list
- const css::uno::Sequence< OUString > rRecentCharFontList( officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::get() );
- for (OUString const & s : rRecentCharFontList)
- {
- maRecentCharFontList.push_back(s);
- }
-}
-
-
-void SvxCharacterMap::getFavCharacterList()
-{
- maFavCharList.clear();
- maFavCharFontList.clear();
- //retrieve recent character list
- const css::uno::Sequence< OUString > rFavCharList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::get() );
- for (const OUString& s : rFavCharList)
- {
- maFavCharList.push_back(s);
- }
-
- //retrieve recent character font list
- const css::uno::Sequence< OUString > rFavCharFontList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::get() );
- for (const OUString& s : rFavCharFontList)
- {
- maFavCharFontList.push_back(s);
- }
-}
-
-
-void SvxCharacterMap::updateRecentCharControl()
-{
- int i = 0;
- for ( std::deque< OUString >::iterator it = maRecentCharList.begin(), it2 = maRecentCharFontList.begin();
- it != maRecentCharList.end() && it2 != maRecentCharFontList.end();
- ++it, ++it2, i++)
- {
- m_aRecentCharView[i].SetText(*it);
- vcl::Font rFont = m_aRecentCharView[i].GetFont();
- rFont.SetFamilyName( *it2 );
- m_aRecentCharView[i].SetFont(rFont);
- m_aRecentCharView[i].Show();
- }
-
- for(; i < 16 ; i++)
- {
- m_aRecentCharView[i].SetText(OUString());
- m_aRecentCharView[i].Hide();
- }
-}
-
-void SvxCharacterMap::updateRecentCharacterList(const OUString& sTitle, const OUString& rFont)
-{
- auto itChar = std::find(maRecentCharList.begin(), maRecentCharList.end(), sTitle);
-
- auto itChar2 = std::find(maRecentCharFontList.begin(), maRecentCharFontList.end(), rFont);
-
- // if recent char to be added is already in list, remove it
- if( itChar != maRecentCharList.end() && itChar2 != maRecentCharFontList.end() )
- {
- maRecentCharList.erase( itChar );
- maRecentCharFontList.erase( itChar2);
- }
-
- if (maRecentCharList.size() == 16)
- {
- maRecentCharList.pop_back();
- maRecentCharFontList.pop_back();
- }
-
- maRecentCharList.push_front(sTitle);
- maRecentCharFontList.push_front(rFont);
-
- css::uno::Sequence< OUString > aRecentCharList(maRecentCharList.size());
- css::uno::Sequence< OUString > aRecentCharFontList(maRecentCharFontList.size());
-
- for (size_t i = 0; i < maRecentCharList.size(); ++i)
- {
- aRecentCharList[i] = maRecentCharList[i];
- aRecentCharFontList[i] = maRecentCharFontList[i];
- }
-
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext));
- officecfg::Office::Common::RecentCharacters::RecentCharacterList::set(aRecentCharList, batch);
- officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::set(aRecentCharFontList, batch);
- batch->commit();
-
- updateRecentCharControl();
-}
-
-
-void SvxCharacterMap::updateFavCharacterList(const OUString& sTitle, const OUString& rFont)
-{
- auto itChar = std::find(maFavCharList.begin(), maFavCharList.end(), sTitle);
-
- auto itChar2 = std::find(maFavCharFontList.begin(), maFavCharFontList.end(), rFont);
-
- // if Fav char to be added is already in list, remove it
- if( itChar != maFavCharList.end() && itChar2 != maFavCharFontList.end() )
- {
- maFavCharList.erase( itChar );
- maFavCharFontList.erase( itChar2);
- }
-
- if (maFavCharList.size() == 16)
- {
- maFavCharList.pop_back();
- maFavCharFontList.pop_back();
- }
-
- maFavCharList.push_back(sTitle);
- maFavCharFontList.push_back(rFont);
-
- css::uno::Sequence< OUString > aFavCharList(maFavCharList.size());
- css::uno::Sequence< OUString > aFavCharFontList(maFavCharFontList.size());
-
- for (size_t i = 0; i < maFavCharList.size(); ++i)
- {
- aFavCharList[i] = maFavCharList[i];
- aFavCharFontList[i] = maFavCharFontList[i];
- }
-
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext));
- officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::set(aFavCharList, batch);
- officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::set(aFavCharFontList, batch);
- batch->commit();
-}
-
-
-void SvxCharacterMap::updateFavCharControl()
-{
- int i = 0;
- for ( std::deque< OUString >::iterator it = maFavCharList.begin(), it2 = maFavCharFontList.begin();
- it != maFavCharList.end() && it2 != maFavCharFontList.end();
- ++it, ++it2, i++)
- {
- m_aFavCharView[i].SetText(*it);
- vcl::Font rFont = m_aFavCharView[i].GetFont();
- rFont.SetFamilyName( *it2 );
- m_aFavCharView[i].SetFont(rFont);
- m_aFavCharView[i].Show();
- }
-
- for(; i < 16 ; i++)
- {
- m_aFavCharView[i].SetText(OUString());
- m_aFavCharView[i].Hide();
- }
- m_xShowSet->getFavCharacterList();
- m_xSearchSet->getFavCharacterList();
-}
-
-void SvxCharacterMap::deleteFavCharacterFromList(const OUString& sTitle, const OUString& rFont)
-{
- auto itChar = std::find(maFavCharList.begin(), maFavCharList.end(), sTitle);
-
- auto itChar2 = std::find(maFavCharFontList.begin(), maFavCharFontList.end(), rFont);
-
- // if Fav char to be added is already in list, remove it
- if( itChar != maFavCharList.end() && itChar2 != maFavCharFontList.end() )
- {
- maFavCharList.erase( itChar );
- maFavCharFontList.erase( itChar2);
- }
-
- css::uno::Sequence< OUString > aFavCharList(maFavCharList.size());
- css::uno::Sequence< OUString > aFavCharFontList(maFavCharFontList.size());
-
- for (size_t i = 0; i < maFavCharList.size(); ++i)
- {
- aFavCharList[i] = maFavCharList[i];
- aFavCharFontList[i] = maFavCharFontList[i];
- }
-
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext));
- officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::set(aFavCharList, batch);
- officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::set(aFavCharFontList, batch);
- batch->commit();
-}
-
-void SvxCharacterMap::init()
-{
- aFont = m_xVirDev->GetFont();
- aFont.SetTransparent( true );
- aFont.SetFamily( FAMILY_DONTKNOW );
- aFont.SetPitch( PITCH_DONTKNOW );
- aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
-
- OUString aDefStr( aFont.GetFamilyName() );
- OUString aLastName;
- int nCount = m_xVirDev->GetDevFontCount();
- std::vector<weld::ComboBoxEntry> aEntries;
- aEntries.reserve(nCount);
- for (int i = 0; i < nCount; ++i)
- {
- OUString aFontName( m_xVirDev->GetDevFont( i ).GetFamilyName() );
- if (aFontName != aLastName)
- {
- aLastName = aFontName;
- aEntries.emplace_back(aFontName, OUString::number(i));
- }
- }
- m_xFontLB->insert_vector(aEntries, true);
- // the font may not be in the list =>
- // try to find a font name token in list and select found font,
- // else select topmost entry
- bool bFound = (m_xFontLB->find_text(aDefStr) == -1);
- if (!bFound)
- {
- sal_Int32 nIndex = 0;
- do
- {
- OUString aToken = aDefStr.getToken(0, ';', nIndex);
- if (m_xFontLB->find_text(aToken) != -1)
- {
- aDefStr = aToken;
- bFound = true;
- break;
- }
- }
- while ( nIndex >= 0 );
- }
-
- if (bFound)
- m_xFontLB->set_active_text(aDefStr);
- else if (m_xFontLB->get_count() )
- m_xFontLB->set_active(0);
- FontSelectHdl(*m_xFontLB);
- if (m_xSubsetLB->get_count())
- m_xSubsetLB->set_active(0);
-
- m_xFontLB->connect_changed(LINK( this, SvxCharacterMap, FontSelectHdl));
- m_xSubsetLB->connect_changed(LINK( this, SvxCharacterMap, SubsetSelectHdl));
- m_xOKBtn->connect_clicked(LINK(this, SvxCharacterMap, InsertClickHdl));
- m_xOKBtn->show();
-
- m_xShowSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) );
- m_xShowSet->SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) );
- m_xShowSet->SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) );
- m_xShowSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) );
- m_xShowSet->SetFavClickHdl( LINK( this, SvxCharacterMap, FavClickHdl ) );
-
- m_xSearchSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, SearchCharDoubleClickHdl ) );
- m_xSearchSet->SetSelectHdl( LINK( this, SvxCharacterMap, SearchCharSelectHdl ) );
- m_xSearchSet->SetHighlightHdl( LINK( this, SvxCharacterMap, SearchCharHighlightHdl ) );
- m_xSearchSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, SearchCharPreSelectHdl ) );
- m_xSearchSet->SetFavClickHdl( LINK( this, SvxCharacterMap, FavClickHdl ) );
-
- m_xDecimalCodeText->connect_changed( LINK( this, SvxCharacterMap, DecimalCodeChangeHdl ) );
- m_xHexCodeText->connect_changed( LINK( this, SvxCharacterMap, HexCodeChangeHdl ) );
- m_xFavouritesBtn->connect_clicked( LINK(this, SvxCharacterMap, FavSelectHdl));
-
- // tdf#117038 set the buttons width to its max possible width so it doesn't
- // make layout change when the label changes
- m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_REMOVE_FAVORITES));
- auto nMaxWidth = m_xFavouritesBtn->get_preferred_size().Width();
- m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_ADD_FAVORITES));
- nMaxWidth = std::max(nMaxWidth, m_xFavouritesBtn->get_preferred_size().Width());
- m_xFavouritesBtn->set_size_request(nMaxWidth, -1);
-
- if( SvxShowCharSet::getSelectedChar() == ' ')
- {
- m_xOKBtn->set_sensitive(false);
- }
- else
- {
- sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
- // using the new UCS4 constructor
- OUString aOUStr( &cChar, 1 );
- m_aShowChar.SetText(aOUStr);
-
- setFavButtonState(aOUStr, aDefStr);
- m_xOKBtn->set_sensitive(true);
- }
-
- getRecentCharacterList();
- updateRecentCharControl();
-
- getFavCharacterList();
- updateFavCharControl();
-
- bool bHasInsert = m_xFrame.is();
-
- for(int i = 0; i < 16; i++)
- {
- m_aRecentCharView[i].SetHasInsert(bHasInsert);
- m_aRecentCharView[i].setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
- m_aRecentCharView[i].setClearClickHdl(LINK(this,SvxCharacterMap, RecentClearClickHdl));
- m_aRecentCharView[i].setClearAllClickHdl(LINK(this,SvxCharacterMap, RecentClearAllClickHdl));
- m_aFavCharView[i].SetHasInsert(bHasInsert);
- m_aFavCharView[i].setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
- m_aFavCharView[i].setClearClickHdl(LINK(this,SvxCharacterMap, FavClearClickHdl));
- m_aFavCharView[i].setClearAllClickHdl(LINK(this,SvxCharacterMap, FavClearAllClickHdl));
- }
-
- setCharName(90);
-
- m_xSearchText->connect_focus_in(LINK( this, SvxCharacterMap, SearchFieldGetFocusHdl ));
- m_xSearchText->connect_changed(LINK(this, SvxCharacterMap, SearchUpdateHdl));
-}
-
-bool SvxCharacterMap::isFavChar(const OUString& sTitle, const OUString& rFont)
-{
- auto isFavCharTitleExists = std::any_of(maFavCharList.begin(),
- maFavCharList.end(),
- [sTitle] (const OUString & a) { return a == sTitle; });
-
- auto isFavCharFontExists = std::any_of(maFavCharFontList.begin(),
- maFavCharFontList.end(),
- [rFont] (const OUString & a) { return a == rFont; });
-
- // if Fav char to be added is already in list, remove it
- return isFavCharTitleExists && isFavCharFontExists;
-}
-
-
-void SvxCharacterMap::setFavButtonState(const OUString& sTitle, const OUString& rFont)
-{
- if(sTitle.isEmpty() || rFont.isEmpty())
- {
- m_xFavouritesBtn->set_sensitive(false);
- return;
- }
- else
- m_xFavouritesBtn->set_sensitive(true);
-
- if (isFavChar(sTitle, rFont))
- {
- m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_REMOVE_FAVORITES));
- }
- else
- {
- if(maFavCharList.size() == 16)
- {
- m_xFavouritesBtn->set_sensitive(false);
- }
-
- m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_ADD_FAVORITES));
- }
-}
-
-
-void SvxCharacterMap::SetCharFont( const vcl::Font& rFont )
-{
- // first get the underlying info in order to get font names
- // like "Times New Roman;Times" resolved
- vcl::Font aTmp(m_xVirDev->GetFontMetric(rFont));
-
- if (aTmp.GetFamilyName() == "StarSymbol" && m_xFontLB->find_text(aTmp.GetFamilyName()) == -1)
- {
- //if for some reason, like font in an old document, StarSymbol is requested and it's not available, then
- //try OpenSymbol instead
- aTmp.SetFamilyName("OpenSymbol");
- }
-
- if (m_xFontLB->find_text(aTmp.GetFamilyName()) == -1)
- return;
-
- m_xFontLB->set_active_text(aTmp.GetFamilyName());
- aFont = aTmp;
- FontSelectHdl(*m_xFontLB);
- if (m_xSubsetLB->get_count())
- m_xSubsetLB->set_active(0);
-}
-
-void SvxCharacterMap::fillAllSubsets(weld::ComboBox& rListBox)
-{
- SubsetMap aAll(nullptr);
- std::vector<weld::ComboBoxEntry> aEntries;
- for (auto & subset : aAll.GetSubsetMap())
- aEntries.emplace_back(subset.GetName());
- rListBox.insert_vector(aEntries, true);
-}
-
-void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph)
-{
- if(sGlyph.isEmpty())
- return;
-
- if (m_xFrame.is()) {
- uno::Sequence<beans::PropertyValue> aArgs(2);
- aArgs[0].Name = "Symbols";
- aArgs[0].Value <<= sGlyph;
-
- aArgs[1].Name = "FontName";
- aArgs[1].Value <<= aFont.GetFamilyName();
- comphelper::dispatchCommand(".uno:InsertSymbol", m_xFrame, aArgs);
-
- updateRecentCharacterList(sGlyph, aFont.GetFamilyName());
-
- } else {
- sal_UCS4 cChar = sGlyph.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
- const SfxItemPool* pPool = m_xOutputSet->GetPool();
- m_xOutputSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), sGlyph ) );
- m_xOutputSet->Put( SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
- aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) );
- m_xOutputSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), aFont.GetFamilyName() ) );
- m_xOutputSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), cChar ) );
- }
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, weld::ComboBox&, void)
-{
- const sal_uInt32 nFont = m_xFontLB->get_active_id().toUInt32();
- aFont = m_xVirDev->GetDevFont(nFont);
- aFont.SetWeight( WEIGHT_DONTKNOW );
- aFont.SetItalic( ITALIC_NONE );
- aFont.SetWidthType( WIDTH_DONTKNOW );
- aFont.SetPitch( PITCH_DONTKNOW );
- aFont.SetFamily( FAMILY_DONTKNOW );
-
- // notify children using this font
- m_xShowSet->SetFont( aFont );
- m_xSearchSet->SetFont( aFont );
- m_aShowChar.SetFont( aFont );
-
- // setup unicode subset listbar with font specific subsets,
- // hide unicode subset listbar for symbol fonts
- // TODO: get info from the Font once it provides it
- pSubsetMap.reset();
- m_xSubsetLB->clear();
-
- bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL);
- if (bNeedSubset)
- {
- FontCharMapRef xFontCharMap = m_xShowSet->GetFontCharMap();
- pSubsetMap.reset(new SubsetMap( xFontCharMap ));
-
- // update subset listbox for new font's unicode subsets
- for (auto const& subset : pSubsetMap->GetSubsetMap())
- {
- m_xSubsetLB->append(OUString::number(reinterpret_cast<sal_uInt64>(&subset)), subset.GetName());
- // NOTE: subset must live at least as long as the selected font
- }
-
- if (m_xSubsetLB->get_count() <= 1)
- bNeedSubset = false;
- }
-
- m_xSubsetText->set_sensitive(bNeedSubset);
- m_xSubsetLB->set_sensitive(bNeedSubset);
-
- if (isSearchMode)
- {
- // tdf#137294 do this after modifying m_xSubsetLB sensitivity to
- // restore insensitive for the search case
- SearchUpdateHdl(*m_xSearchText);
- SearchCharHighlightHdl(m_xSearchSet.get());
- }
-
- // tdf#118304 reselect current glyph to see if its still there in new font
- selectCharByCode(Radix::hexadecimal);
-}
-
-void SvxCharacterMap::toggleSearchView(bool state)
-{
- isSearchMode = state;
- m_xHexCodeText->set_editable(!state);
- m_xDecimalCodeText->set_editable(!state);
- m_xSubsetLB->set_sensitive(!state);
-
- if(state)
- {
- m_xSearchSet->Show();
- m_xShowSet->Hide();
- }
- else
- {
- m_xSearchSet->Hide();
- m_xShowSet->Show();
- }
-}
-
-void SvxCharacterMap::setCharName(sal_UCS4 nDecimalValue)
-{
- /* get the character name */
- UErrorCode errorCode = U_ZERO_ERROR;
- // icu has a private uprv_getMaxCharNameLength function which returns the max possible
- // length of this property. Unicode 3.2 max char name length was 83
- char buffer[100];
- u_charName(nDecimalValue, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
- if (U_SUCCESS(errorCode))
- m_xCharName->set_label(OUString::createFromAscii(buffer));
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl, weld::ComboBox&, void)
-{
- const sal_Int32 nPos = m_xSubsetLB->get_active();
- const Subset* pSubset = reinterpret_cast<const Subset*>(m_xSubsetLB->get_active_id().toUInt64());
-
- if( pSubset && !isSearchMode)
- {
- sal_UCS4 cFirst = pSubset->GetRangeMin();
- m_xShowSet->SelectCharacter( cFirst );
-
- setFavButtonState(OUString(&cFirst, 1), aFont.GetFamilyName());
- m_xSubsetLB->set_active(nPos);
- }
- else if( pSubset && isSearchMode)
- {
- m_xSearchSet->SelectCharacter( pSubset );
-
- const Subset* curSubset = nullptr;
- if( pSubsetMap )
- curSubset = pSubsetMap->GetSubsetByUnicode( m_xSearchSet->GetSelectCharacter() );
- if( curSubset )
- m_xSubsetLB->set_active_text(curSubset->GetName());
- else
- m_xSubsetLB->set_active(-1);
-
- sal_UCS4 sChar = m_xSearchSet->GetSelectCharacter();
- setFavButtonState(OUString(&sChar, 1), aFont.GetFamilyName());
- }
-}
-
-IMPL_LINK(SvxCharacterMap, RecentClearClickHdl, SvxCharView*, rView, void)
-{
- const OUString& sTitle = rView->GetText();
- auto itChar = std::find(maRecentCharList.begin(), maRecentCharList.end(), sTitle);
-
- OUString sFont = rView->GetFont().GetFamilyName();
- auto itChar2 = std::find(maRecentCharFontList.begin(), maRecentCharFontList.end(), sFont);
-
- // if recent char to be added is already in list, remove it
- if( itChar != maRecentCharList.end() && itChar2 != maRecentCharFontList.end() )
- {
- maRecentCharList.erase( itChar );
- maRecentCharFontList.erase( itChar2);
- }
-
- css::uno::Sequence< OUString > aRecentCharList(maRecentCharList.size());
- css::uno::Sequence< OUString > aRecentCharFontList(maRecentCharFontList.size());
-
- for (size_t i = 0; i < maRecentCharList.size(); ++i)
- {
- aRecentCharList[i] = maRecentCharList[i];
- aRecentCharFontList[i] = maRecentCharFontList[i];
- }
-
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext));
- officecfg::Office::Common::RecentCharacters::RecentCharacterList::set(aRecentCharList, batch);
- officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::set(aRecentCharFontList, batch);
- batch->commit();
-
- updateRecentCharControl();
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, RecentClearAllClickHdl, SvxCharView*, void)
-{
- css::uno::Sequence< OUString > aRecentCharList(0);
- css::uno::Sequence< OUString > aRecentCharFontList(0);
-
- maRecentCharList.clear();
- maRecentCharFontList.clear();
-
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext));
- officecfg::Office::Common::RecentCharacters::RecentCharacterList::set(aRecentCharList, batch);
- officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::set(aRecentCharFontList, batch);
- batch->commit();
-
- updateRecentCharControl();
-}
-
-IMPL_LINK(SvxCharacterMap, FavClearClickHdl, SvxCharView*, rView, void)
-{
- deleteFavCharacterFromList(rView->GetText(), rView->GetFont().GetFamilyName());
- updateFavCharControl();
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, FavClearAllClickHdl, SvxCharView*, void)
-{
- css::uno::Sequence< OUString > aFavCharList(0);
- css::uno::Sequence< OUString > aFavCharFontList(0);
-
- maFavCharList.clear();
- maFavCharFontList.clear();
-
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext));
- officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::set(aFavCharList, batch);
- officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::set(aFavCharFontList, batch);
- batch->commit();
-
- updateFavCharControl();
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SearchFieldGetFocusHdl, weld::Widget&, void)
-{
- m_xOKBtn->set_sensitive(false);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, weld::Entry&, void)
-{
- if (!m_xSearchText->get_text().isEmpty())
- {
- m_xSearchSet->ClearPreviousData();
- OUString aKeyword = m_xSearchText->get_text();
-
- toggleSearchView(true);
-
- FontCharMapRef xFontCharMap = m_xSearchSet->GetFontCharMap();
-
- sal_UCS4 sChar = xFontCharMap->GetFirstChar();
- while(sChar != xFontCharMap->GetLastChar())
- {
- UErrorCode errorCode = U_ZERO_ERROR;
- char buffer[100];
- u_charName(sChar, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
- if (U_SUCCESS(errorCode))
- {
- OUString sName = OUString::createFromAscii(buffer);
- if(!sName.isEmpty() && sName.toAsciiLowerCase().indexOf(aKeyword.toAsciiLowerCase()) >= 0)
- m_xSearchSet->AppendCharToList(sChar);
- }
- sChar = xFontCharMap->GetNextChar(sChar);
- }
- //for last char
- UErrorCode errorCode = U_ZERO_ERROR;
- char buffer[100];
- u_charName(sChar, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
- if (U_SUCCESS(errorCode))
- {
- OUString sName = OUString::createFromAscii(buffer);
- if(!sName.isEmpty() && sName.toAsciiLowerCase().indexOf(aKeyword.toAsciiLowerCase()) >= 0)
- m_xSearchSet->AppendCharToList(sChar);
- }
- }
- else
- {
- toggleSearchView(false);
- }
-}
-
-
-IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void)
-{
- rView->GrabFocus();
-
- m_aShowChar.SetText( rView->GetText() );
- m_aShowChar.SetFont(rView->GetFont());
- m_aShowChar.Invalidate();
-
- setFavButtonState(rView->GetText(), rView->GetFont().GetFamilyName());//check state
-
- // Get the hexadecimal code
- OUString charValue = rView->GetText();
- sal_UCS4 cChar = charValue.iterateCodePoints(&o3tl::temporary(sal_Int32(1)), -1);
- OUString aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
-
- // Get the decimal code
- OUString aDecimalText = OUString::number(cChar);
-
- m_xHexCodeText->set_text(aHexText);
- m_xDecimalCodeText->set_text(aDecimalText);
- setCharName(cChar);
-
- rView->Invalidate();
- m_xOKBtn->set_sensitive(true);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, CharDoubleClickHdl, SvxShowCharSet*, void)
-{
- sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
- // using the new UCS4 constructor
- OUString aOUStr( &cChar, 1 );
- setFavButtonState(aOUStr, aFont.GetFamilyName());
- insertCharToDoc(aOUStr);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SearchCharDoubleClickHdl, SvxShowCharSet*, void)
-{
- sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
- // using the new UCS4 constructor
- OUString aOUStr( &cChar, 1 );
- setFavButtonState(aOUStr, aFont.GetFamilyName());
- insertCharToDoc(aOUStr);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl, SvxShowCharSet*, void)
-{
- m_xOKBtn->set_sensitive(true);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SearchCharSelectHdl, SvxShowCharSet*, void)
-{
- m_xOKBtn->set_sensitive(true);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, InsertClickHdl, weld::Button&, void)
-{
- OUString sChar = m_aShowChar.GetText();
- insertCharToDoc(sChar);
- // Need to update recent character list, when OK button does not insert
- if(!m_xFrame.is())
- updateRecentCharacterList(sChar, aFont.GetFamilyName());
- m_xDialog->response(RET_OK);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, FavSelectHdl, weld::Button&, void)
-{
- if (m_xFavouritesBtn->get_label().match(CuiResId(RID_SVXSTR_ADD_FAVORITES)))
- {
- updateFavCharacterList(m_aShowChar.GetText(), m_aShowChar.GetFont().GetFamilyName());
- setFavButtonState(m_aShowChar.GetText(), m_aShowChar.GetFont().GetFamilyName());
- }
- else
- {
- deleteFavCharacterFromList(m_aShowChar.GetText(), m_aShowChar.GetFont().GetFamilyName());
- m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_ADD_FAVORITES));
- m_xFavouritesBtn->set_sensitive(false);
- }
-
- updateFavCharControl();
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, FavClickHdl, SvxShowCharSet*, void)
-{
- getFavCharacterList();
- updateFavCharControl();
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void)
-{
- OUString aText;
- sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
- bool bSelect = (cChar > 0);
-
- // show char sample
- if ( bSelect )
- {
- // using the new UCS4 constructor
- aText = OUString( &cChar, 1 );
- // Get the hexadecimal code
- OUString aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
- // Get the decimal code
- OUString aDecimalText = OUString::number(cChar);
- setCharName(cChar);
-
- // Update the hex and decimal codes only if necessary
- if (!m_xHexCodeText->get_text().equalsIgnoreAsciiCase(aHexText))
- m_xHexCodeText->set_text(aHexText);
- if (m_xDecimalCodeText->get_text() != aDecimalText)
- m_xDecimalCodeText->set_text( aDecimalText );
-
- const Subset* pSubset = nullptr;
- if( pSubsetMap )
- pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
- if( pSubset )
- m_xSubsetLB->set_active_text(pSubset->GetName());
- else
- m_xSubsetLB->set_active(-1);
- }
-
- m_aShowChar.SetText( aText );
- m_aShowChar.SetFont( aFont );
- m_aShowChar.Invalidate();
-
- setFavButtonState(aText, aFont.GetFamilyName());
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void)
-{
- OUString aText;
- sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
- bool bSelect = (cChar > 0);
-
- // show char sample
- if ( bSelect )
- {
- aText = OUString( &cChar, 1 );
- // Get the hexadecimal code
- OUString aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
- // Get the decimal code
- OUString aDecimalText = OUString::number(cChar);
- setCharName(cChar);
-
- // Update the hex and decimal codes only if necessary
- if (!m_xHexCodeText->get_text().equalsIgnoreAsciiCase(aHexText))
- m_xHexCodeText->set_text(aHexText);
- if (m_xDecimalCodeText->get_text() != aDecimalText)
- m_xDecimalCodeText->set_text( aDecimalText );
-
- const Subset* pSubset = nullptr;
- if( pSubsetMap )
- pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
- if( pSubset )
- m_xSubsetLB->set_active_text(pSubset->GetName());
- else
- m_xSubsetLB->set_active(-1);
- }
-
- if(m_xSearchSet->HasFocus())
- {
- m_aShowChar.SetText( aText );
- m_aShowChar.SetFont( aFont );
- m_aShowChar.Invalidate();
-
- setFavButtonState(aText, aFont.GetFamilyName());
- }
-}
-
-void SvxCharacterMap::selectCharByCode(Radix radix)
-{
- OUString aCodeString;
- switch(radix)
- {
- case Radix::decimal:
- aCodeString = m_xDecimalCodeText->get_text();
- break;
- case Radix::hexadecimal:
- aCodeString = m_xHexCodeText->get_text();
- break;
- }
- // Convert the code back to a character using the appropriate radix
- sal_UCS4 cChar = aCodeString.toUInt32(static_cast<sal_Int16> (radix));
- // Use FontCharMap::HasChar(sal_UCS4 cChar) to see if the desired character is in the font
- FontCharMapRef xFontCharMap = m_xShowSet->GetFontCharMap();
- if (xFontCharMap->HasChar(cChar))
- // Select the corresponding character
- SetChar(cChar);
- else {
- m_xCharName->set_label(CuiResId(RID_SVXSTR_MISSING_CHAR));
- m_aShowChar.SetText(" ");
- switch(radix)
- {
- case Radix::decimal:
- m_xHexCodeText->set_text(OUString::number(cChar, 16));
- break;
- case Radix::hexadecimal:
- m_xDecimalCodeText->set_text(OUString::number(cChar));
- break;
- }
- }
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, DecimalCodeChangeHdl, weld::Entry&, void)
-{
- selectCharByCode(Radix::decimal);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, HexCodeChangeHdl, weld::Entry&, void)
-{
- selectCharByCode(Radix::hexadecimal);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl, SvxShowCharSet*, void)
-{
- // adjust subset selection
- if( pSubsetMap )
- {
- sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
-
- setFavButtonState(OUString(&cChar, 1), aFont.GetFamilyName());
- const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
- if( pSubset )
- m_xSubsetLB->set_active_text(pSubset->GetName());
- }
-
- m_xOKBtn->set_sensitive(true);
-}
-
-IMPL_LINK_NOARG(SvxCharacterMap, SearchCharPreSelectHdl, SvxShowCharSet*, void)
-{
- // adjust subset selection
- if( pSubsetMap )
- {
- sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
-
- setFavButtonState(OUString(&cChar, 1), aFont.GetFamilyName());
- const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
- if( pSubset )
- m_xSubsetLB->set_active_text(pSubset->GetName());
- }
-
- m_xOKBtn->set_sensitive(true);
-}
-
-// class SvxShowText =====================================================
-SvxShowText::SvxShowText(const VclPtr<VirtualDevice>& rVirDev)
- : m_xVirDev(rVirDev)
- , mnY(0)
- , mbCenter(false)
-{
-}
-
-void SvxShowText::SetDrawingArea(weld::DrawingArea* pDrawingArea)
-{
- CustomWidgetController::SetDrawingArea(pDrawingArea);
- vcl::Font aFont = m_xVirDev->GetFont();
- Size aFontSize(aFont.GetFontSize().Width() * 5, aFont.GetFontSize().Height() * 5);
- aFont.SetFontSize(aFontSize);
- m_xVirDev->Push(PUSH_ALLFONT);
- m_xVirDev->SetFont(aFont);
- pDrawingArea->set_size_request(m_xVirDev->approximate_digit_width() + 2 * 12,
- m_xVirDev->LogicToPixel(aFontSize).Height() * 2);
- m_xVirDev->Pop();
-}
-
-void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
-{
- rRenderContext.SetFont(m_aFont);
-
- Color aTextCol = rRenderContext.GetTextColor();
- Color aFillCol = rRenderContext.GetFillColor();
-
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Color aWindowTextColor(rStyleSettings.GetDialogTextColor());
- const Color aWindowColor(rStyleSettings.GetWindowColor());
- rRenderContext.SetTextColor(aWindowTextColor);
- rRenderContext.SetFillColor(aWindowColor);
-
- const OUString aText = GetText();
-
- Size aSize(GetOutputSizePixel());
- tools::Long nAvailWidth = aSize.Width();
- tools::Long nWinHeight = aSize.Height();
-
- bool bGotBoundary = true;
- bool bShrankFont = false;
- vcl::Font aOrigFont(rRenderContext.GetFont());
- Size aFontSize(aOrigFont.GetFontSize());
- ::tools::Rectangle aBoundRect;
-
- for (tools::Long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 5)
- {
- if (!rRenderContext.GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty())
- {
- bGotBoundary = false;
- break;
- }
- if (!mbCenter)
- break;
- //only shrink in the single glyph large view mode
- tools::Long nTextWidth = aBoundRect.GetWidth();
- if (nAvailWidth > nTextWidth)
- break;
- vcl::Font aFont(aOrigFont);
- aFontSize.setHeight( nFontHeight );
- aFont.SetFontSize(aFontSize);
- rRenderContext.SetFont(aFont);
- mnY = (nWinHeight - rRenderContext.GetTextHeight()) / 2;
- bShrankFont = true;
- }
-
- Point aPoint(2, mnY);
- // adjust position using ink boundary if possible
- if (!bGotBoundary)
- aPoint.setX( (aSize.Width() - rRenderContext.GetTextWidth(aText)) / 2 );
- else
- {
- // adjust position before it gets out of bounds
- aBoundRect += aPoint;
-
- // shift back vertically if needed
- int nYLDelta = aBoundRect.Top();
- int nYHDelta = aSize.Height() - aBoundRect.Bottom();
- if( nYLDelta <= 0 )
- aPoint.AdjustY( -(nYLDelta - 1) );
- else if( nYHDelta <= 0 )
- aPoint.AdjustY(nYHDelta - 1 );
-
- if (mbCenter)
- {
- // move glyph to middle of cell
- aPoint.setX( -aBoundRect.Left() + (aSize.Width() - aBoundRect.GetWidth()) / 2 );
- }
- else
- {
- // shift back horizontally if needed
- int nXLDelta = aBoundRect.Left();
- int nXHDelta = aSize.Width() - aBoundRect.Right();
- if( nXLDelta <= 0 )
- aPoint.AdjustX( -(nXLDelta - 1) );
- else if( nXHDelta <= 0 )
- aPoint.AdjustX(nXHDelta - 1 );
- }
- }
-
- rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), aSize));
- rRenderContext.DrawText(aPoint, aText);
- rRenderContext.SetTextColor(aTextCol);
- rRenderContext.SetFillColor(aFillCol);
- if (bShrankFont)
- rRenderContext.SetFont(aOrigFont);
-}
-
-void SvxShowText::SetFont( const vcl::Font& rFont )
-{
- tools::Long nWinHeight = GetOutputSizePixel().Height();
-
- m_aFont = rFont;
- m_aFont.SetWeight(WEIGHT_NORMAL);
- m_aFont.SetAlignment(ALIGN_TOP);
- m_aFont.SetFontSize(m_xVirDev->PixelToLogic(Size(0, nWinHeight / 2)));
- m_aFont.SetTransparent(true);
-
- m_xVirDev->Push(PUSH_ALLFONT);
- m_xVirDev->SetFont(m_aFont);
- mnY = (nWinHeight - m_xVirDev->GetTextHeight()) / 2;
- m_xVirDev->Pop();
-
- Invalidate();
-}
-
-void SvxShowText::Resize()
-{
- SetFont(GetFont()); //force recalculation of size
-}
-
-void SvxShowText::SetText(const OUString& rText)
-{
- m_sText = rText;
- Invalidate();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index de7681fa7d79..eff48a747fe7 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -31,12 +31,11 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <svx/svxdlg.hxx>
+#include <o3tl/string_view.hxx>
using namespace css::uno;
-using namespace css::i18n;
using namespace ::svxform;
using namespace css::sdbc;
-using namespace css::util;
#define MAX_HISTORY_ENTRIES 50
@@ -47,15 +46,14 @@ void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor )
m_pSearchEngine->SetProgressHandler(LINK(this, FmSearchDialog, OnSearchProgress));
// some layout changes according to available CJK options
- SvtCJKOptions aCJKOptions;
- if (!aCJKOptions.IsJapaneseFindEnabled())
+ if (!SvtCJKOptions::IsJapaneseFindEnabled())
{
// hide the options for the japanese search
m_pSoundsLikeCJK->hide();
m_pSoundsLikeCJKSettings->hide();
}
- if (!aCJKOptions.IsCJKFontEnabled())
+ if (!SvtCJKOptions::IsCJKFontEnabled())
{
m_pHalfFullFormsCJK->hide();
@@ -160,15 +158,15 @@ FmSearchDialog::~FmSearchDialog()
m_pSearchEngine.reset();
}
-void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText)
+void FmSearchDialog::Init(std::u16string_view strVisibleFields, const OUString& sInitialText)
{
//the initialization of all the Controls
- m_prbSearchForText->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
- m_prbSearchForNull->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
- m_prbSearchForNotNull->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+ m_prbSearchForText->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
+ m_prbSearchForNull->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
+ m_prbSearchForNotNull->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
- m_prbAllFields->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
- m_prbSingleField->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+ m_prbAllFields->connect_toggled(LINK(this, FmSearchDialog, OnToggledFieldRadios));
+ m_prbSingleField->connect_toggled(LINK(this, FmSearchDialog, OnToggledFieldRadios));
m_pbSearchAgain->connect_clicked(LINK(this, FmSearchDialog, OnClickedSearchAgain));
m_ppbApproxSettings->connect_clicked(LINK(this, FmSearchDialog, OnClickedSpecialSettings));
@@ -193,22 +191,22 @@ void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sIni
// fill the listboxes
// method of field comparison
- const char* const aResIds[] = {
+ const TranslateId aResIds[] = {
RID_STR_SEARCH_ANYWHERE,
RID_STR_SEARCH_BEGINNING,
RID_STR_SEARCH_END,
RID_STR_SEARCH_WHOLE
};
- for (auto pResId : aResIds)
+ for (auto const & pResId : aResIds)
m_plbPosition->append_text(CuiResId(pResId));
m_plbPosition->set_active(MATCHING_ANYWHERE);
// the field listbox
- if (!strVisibleFields.isEmpty())
+ if (!strVisibleFields.empty())
{
sal_Int32 nPos {0};
do {
- m_plbField->append_text(strVisibleFields.getToken(0, ';', nPos));
+ m_plbField->append_text(OUString(o3tl::getToken(strVisibleFields, 0, ';', nPos)));
} while (nPos>=0);
}
@@ -240,24 +238,29 @@ short FmSearchDialog::run()
return nRet;
}
-IMPL_LINK(FmSearchDialog, OnClickedFieldRadios, weld::Button&, rButton, void)
+IMPL_LINK(FmSearchDialog, OnToggledSearchRadio, weld::Toggleable&, rButton, void)
{
- if ((&rButton == m_prbSearchForText.get()) || (&rButton == m_prbSearchForNull.get()) || (&rButton == m_prbSearchForNotNull.get()))
+ if (!rButton.get_active())
+ return;
+ EnableSearchForDependees(true);
+}
+
+IMPL_LINK(FmSearchDialog, OnToggledFieldRadios, weld::Toggleable&, rButton, void)
+{
+ if (!rButton.get_active())
+ return;
+
+ // en- or disable field list box accordingly
+ if (m_prbSingleField->get_active())
{
- EnableSearchForDependees(true);
+ m_plbField->set_sensitive(true);
+ m_pSearchEngine->RebuildUsedFields(m_plbField->get_active());
}
else
- // en- or disable field list box accordingly
- if (&rButton == m_prbSingleField.get())
- {
- m_plbField->set_sensitive(true);
- m_pSearchEngine->RebuildUsedFields(m_plbField->get_active());
- }
- else
- {
- m_plbField->set_sensitive(false);
- m_pSearchEngine->RebuildUsedFields(-1);
- }
+ {
+ m_plbField->set_sensitive(false);
+ m_pSearchEngine->RebuildUsedFields(-1);
+ }
}
IMPL_LINK_NOARG(FmSearchDialog, OnClickedSearchAgain, weld::Button&, void)
@@ -307,15 +310,20 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, weld::Button&, rButton, void
if (m_ppbApproxSettings.get() == &rButton)
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(m_xDialog.get(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
+
+ VclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(m_xDialog.get(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(),
m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ));
- if (pDlg->Execute() == RET_OK)
+ pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult){
+
+ if (nResult == RET_OK)
{
m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() );
m_pSearchEngine->SetLevOther( pDlg->GetOther() );
m_pSearchEngine->SetLevShorter(pDlg->GetShorter() );
m_pSearchEngine->SetLevLonger( pDlg->GetLonger() );
}
+ pDlg->disposeOnce();
+ });
}
else if (m_pSoundsLikeCJKSettings.get() == &rButton)
{
@@ -364,7 +372,7 @@ IMPL_LINK_NOARG(FmSearchDialog, OnFieldSelected, weld::ComboBox&, void)
m_arrContextFields[nCurrentContext] = m_plbField->get_active_text();
}
-IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, weld::ToggleButton&, rBox, void)
+IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, weld::Toggleable&, rBox, void)
{
bool bChecked = rBox.get_active();
@@ -437,7 +445,7 @@ IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, weld::ToggleButton&, rBox, void)
bool bEnable = ( m_prbSearchForText->get_active()
&& !m_pSoundsLikeCJK->get_active()
)
- || !SvtCJKOptions().IsJapaneseFindEnabled();
+ || !SvtCJKOptions::IsJapaneseFindEnabled();
m_pcbCase->set_sensitive(bEnable);
m_pHalfFullFormsCJK->set_sensitive(bEnable);
@@ -531,7 +539,7 @@ void FmSearchDialog::EnableSearchForDependees(bool bEnable)
bEnable = bEnable && bSearchingForText;
- bool bEnableRedundants = !m_pSoundsLikeCJK->get_active() || !SvtCJKOptions().IsJapaneseFindEnabled();
+ bool bEnableRedundants = !m_pSoundsLikeCJK->get_active() || !SvtCJKOptions::IsJapaneseFindEnabled();
m_pcmbSearchText->set_sensitive(bEnable);
m_pftPosition->set_sensitive(bEnable && !m_pcbWildCard->get_active());
@@ -596,7 +604,7 @@ IMPL_LINK(FmSearchDialog, OnSearchProgress, const FmSearchProgress*, pProgress,
case FmSearchProgress::State::Error:
case FmSearchProgress::State::NothingFound:
{
- const char* pErrorId = (FmSearchProgress::State::Error == pProgress->aSearchState)
+ TranslateId pErrorId = (FmSearchProgress::State::Error == pProgress->aSearchState)
? RID_STR_SEARCH_GENERAL_ERROR
: RID_STR_SEARCH_NORECORD;
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
@@ -638,19 +646,19 @@ void FmSearchDialog::LoadParams()
nInitialField = 0;
m_plbField->set_active(nInitialField);
OnFieldSelected(*m_plbField);
- // all fields/single field (AFTER selecting the field because OnClickedFieldRadios expects a valid value there)
+ // all fields/single field (AFTER selecting the field because OnToggledFieldRadios expects a valid value there)
if (aParams.bAllFields)
{
m_prbSingleField->set_active(false);
m_prbAllFields->set_active(true);
- OnClickedFieldRadios(*m_prbAllFields);
- // OnClickedFieldRadios also calls to RebuildUsedFields
+ OnToggledFieldRadios(*m_prbAllFields);
+ // OnToggledFieldRadios also calls to RebuildUsedFields
}
else
{
m_prbAllFields->set_active(false);
m_prbSingleField->set_active(true);
- OnClickedFieldRadios(*m_prbSingleField);
+ OnToggledFieldRadios(*m_prbSingleField);
}
m_plbPosition->set_active(aParams.nPosition);
@@ -708,7 +716,7 @@ void FmSearchDialog::LoadParams()
case 2: m_prbSearchForNotNull->set_active(true); break;
default: m_prbSearchForText->set_active(true); break;
}
- OnClickedFieldRadios(*m_prbSearchForText);
+ OnToggledFieldRadios(*m_prbSearchForText);
}
void FmSearchDialog::SaveParams() const
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 186a63096d65..9a1a2e26a4ed 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -24,12 +24,14 @@
#include <algorithm>
#include <cassert>
+#include <utility>
#include <vcl/errinf.hxx>
#include <ucbhelper/content.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <avmedia/mediawindow.hxx>
#include <unotools/pathoptions.hxx>
+#include <sfx2/filedlghelper.hxx>
#include <sfx2/opengrf.hxx>
#include <vcl/graphicfilter.hxx>
#include <svx/gallery1.hxx>
@@ -45,12 +47,13 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/ContentCreationException.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
#include <dialmgr.hxx>
#include <strings.hrc>
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
+#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
using namespace ::ucbhelper;
using namespace ::cppu;
@@ -63,11 +66,11 @@ using namespace ::com::sun::star::uno;
SearchThread::SearchThread(SearchProgress* pProgress,
TPGalleryThemeProperties* pBrowser,
- const INetURLObject& rStartURL)
+ INetURLObject aStartURL)
: Thread("cuiSearchThread")
, mpProgress(pProgress)
, mpBrowser(pBrowser)
- , maStartURL(rStartURL)
+ , maStartURL(std::move(aStartURL))
{
}
@@ -186,9 +189,9 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL,
}
}
-SearchProgress::SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL)
+SearchProgress::SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, INetURLObject aStartURL)
: GenericDialogController(pParent, "cui/ui/gallerysearchprogress.ui", "GallerySearchProgress")
- , startUrl_(rStartURL)
+ , startUrl_(std::move(aStartURL))
, m_pTabPage(pTabPage)
, m_xFtSearchDir(m_xBuilder->weld_label("dir"))
, m_xFtSearchType(m_xBuilder->weld_label("file"))
@@ -333,11 +336,7 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void)
if( !aRemoveEntries[ i ] )
aRemainingVector.push_back( m_pTabPage->aFoundList[i] );
- m_pTabPage->aFoundList.clear();
-
- for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
- m_pTabPage->aFoundList.push_back( aRemainingVector[ i ] );
-
+ std::swap(m_pTabPage->aFoundList, aRemainingVector);
aRemainingVector.clear();
// refill list box
@@ -346,10 +345,8 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void)
aRemainingVector.push_back(m_pTabPage->m_xLbxFound->get_text(i));
m_pTabPage->m_xLbxFound->clear();
-
for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
m_pTabPage->m_xLbxFound->append_text(aRemainingVector[i]);
-
aRemainingVector.clear();
m_pTabPage->m_xLbxFound->thaw();
@@ -460,7 +457,7 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, weld::Button&, void)
if ((pInfo->GetId() == nId) && (pInfo->GetThemeName() != m_pThm->GetName()))
{
- OUString aStr = CuiResId( RID_SVXSTR_GALLERY_ID_EXISTS ) +
+ OUString aStr = CuiResId( RID_CUISTR_GALLERY_ID_EXISTS ) +
" (" + pInfo->GetThemeName() + ")";
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
@@ -490,12 +487,12 @@ GalleryThemeProperties::GalleryThemeProperties(weld::Widget* pParent,
OUString aText = m_xDialog->get_title().replaceFirst( "%1", pData->pTheme->GetName() );
if (pData->pTheme->IsReadOnly())
- aText += " " + CuiResId( RID_SVXSTR_GALLERY_READONLY );
+ aText += " " + CuiResId( RID_CUISTR_GALLERY_READONLY );
m_xDialog->set_title(aText);
}
-void GalleryThemeProperties::PageCreated(const OString& rId, SfxTabPage &rPage)
+void GalleryThemeProperties::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "general")
static_cast<TPGalleryThemeGeneral&>( rPage ).SetXChgData( pData );
@@ -521,7 +518,7 @@ void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
GalleryTheme* pThm = pData->pTheme;
OUString aOutStr( OUString::number(pThm->GetObjectCount()) );
- OUString aObjStr( CuiResId( RID_SVXSTR_GALLERYPROPS_OBJECT ) );
+ OUString aObjStr( CuiResId( RID_CUISTR_GALLERYPROPS_OBJECT ) );
OUString aAccess;
OUString aType( SvxResId( RID_SVXSTR_GALLERYPROPS_GALTHEME ) );
bool bReadOnly = pThm->IsReadOnly();
@@ -531,7 +528,7 @@ void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
m_xEdtMSName->set_sensitive(!bReadOnly);
if( pThm->IsReadOnly() )
- aType += CuiResId( RID_SVXSTR_GALLERY_READONLY );
+ aType += CuiResId( RID_CUISTR_GALLERY_READONLY );
m_xFtMSShowType->set_label(aType);
m_xFtMSShowPath->set_label(pThm->getThemeURL().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
@@ -581,6 +578,7 @@ std::unique_ptr<SfxTabPage> TPGalleryThemeGeneral::Create(weld::Container* pPage
TPGalleryThemeProperties::TPGalleryThemeProperties(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/galleryfilespage.ui", "GalleryFilesPage", &rSet)
, pData(nullptr)
+ , aPreviewTimer("cui TPGalleryThemeProperties aPreviewTimer")
, bEntriesFound(false)
, bInputAllowed(true)
, bTakeAll(false)
@@ -613,7 +611,7 @@ void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData )
m_xCbbFileType->connect_changed(LINK(this, TPGalleryThemeProperties, SelectFileTypeHdl));
m_xLbxFound->connect_row_activated(LINK(this, TPGalleryThemeProperties, DClickFoundHdl));
m_xLbxFound->connect_changed(LINK(this, TPGalleryThemeProperties, SelectFoundHdl));
- m_xLbxFound->append_text(CuiResId(RID_SVXSTR_GALLERY_NOFILES));
+ m_xLbxFound->append_text(CuiResId(RID_CUISTR_GALLERY_NOFILES));
m_xLbxFound->show();
FillFilterList();
@@ -623,7 +621,7 @@ void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData )
m_xCbxPreview->set_sensitive(false);
}
-void TPGalleryThemeProperties::StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult )
+void TPGalleryThemeProperties::StartSearchFiles( std::u16string_view _rFolderURL, short _nDlgResult )
{
if ( RET_OK == _nDlgResult )
{
@@ -709,7 +707,7 @@ void TPGalleryThemeProperties::FillFilterList()
#if HAVE_FEATURE_AVMEDIA
// media filters
- static constexpr OUStringLiteral aWildcard = u"*.";
+ static constexpr OUString aWildcard = u"*."_ustr;
::avmedia::FilterNameVector aFilters= ::avmedia::MediaWindow::getMediaFilters();
for(const std::pair<OUString,OUString> & aFilter : aFilters)
@@ -758,9 +756,9 @@ void TPGalleryThemeProperties::FillFilterList()
{
if ( !aExtensions.isEmpty() )
aExtensions += ";";
- aExtensions += aWildcard + aFilter.second.getToken( 0, ';', nIndex );
+ aExtensions += OUString::Concat(aWildcard) + o3tl::getToken(aFilter.second, 0, ';', nIndex );
}
- }
+ }
#endif
#if defined(_WIN32)
@@ -769,7 +767,7 @@ void TPGalleryThemeProperties::FillFilterList()
#endif
std::unique_ptr<FilterEntry> pFilterEntry(new FilterEntry);
- pFilterEntry->aFilterName = CuiResId(RID_SVXSTR_GALLERY_ALLFILES);
+ pFilterEntry->aFilterName = CuiResId(RID_CUISTR_GALLERY_ALLFILES);
pFilterEntry->aFilterName = addExtension(pFilterEntry->aFilterName, aExtensions);
m_xCbbFileType->insert_text(0, pFilterEntry->aFilterName);
m_xCbbFileType->set_active(0);
@@ -816,7 +814,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void)
{
// setup folder picker
css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- xFolderPicker = FolderPicker::create(xContext);
+ xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld());
OUString aDlgPathName( SvtPathOptions().GetGraphicPath() );
xFolderPicker->setDisplayDirectory(aDlgPathName);
@@ -848,7 +846,7 @@ void TPGalleryThemeProperties::TakeFiles()
{
auto xTakeProgress = std::make_shared<TakeProgress>(GetFrameWeld(), this);
xTakeProgress->LaunchThread();
- weld::DialogController::runAsync(xTakeProgress, [=](sal_Int32 /*nResult*/) {
+ weld::DialogController::runAsync(xTakeProgress, [](sal_Int32 /*nResult*/) {
/* no postprocessing needed, pTakeProgress
will be disposed in TakeProgress::CleanupHdl */
});
@@ -856,7 +854,7 @@ void TPGalleryThemeProperties::TakeFiles()
}
}
-IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickPreviewHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickPreviewHdl, weld::Toggleable&, void)
{
if ( !bInputAllowed )
return;
@@ -911,7 +909,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickTakeHdl, weld::Button&, void)
if (!m_xLbxFound->count_selected_rows() || !bEntriesFound)
{
- SvxOpenGraphicDialog aDlg(CuiResId(RID_SVXSTR_KEY_GALLERY_DIR), GetFrameWeld());
+ SvxOpenGraphicDialog aDlg(CuiResId(RID_CUISTR_KEY_GALLERY_DIR), GetFrameWeld());
aDlg.EnableLink(false);
aDlg.AsLink(false);
@@ -993,7 +991,7 @@ void TPGalleryThemeProperties::EndSearchProgressHdl(sal_Int32 /*nResult*/)
}
else
{
- m_xLbxFound->append_text(CuiResId(RID_SVXSTR_GALLERY_NOFILES));
+ m_xLbxFound->append_text(CuiResId(RID_CUISTR_GALLERY_NOFILES));
m_xBtnTakeAll->set_sensitive(false);
m_xCbxPreview->set_sensitive(false);
bEntriesFound = false;
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index 2e162b4b3f4a..69896cd53c0d 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -57,14 +57,14 @@ void CuiGraphicPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const ::
const Size aGraphicSize(rRenderContext.LogicToPixel(maPreview.GetPrefSize(), maPreview.GetPrefMapMode()));
const Point aGraphicPosition((aOutputSize.Width() - aGraphicSize.Width() ) >> 1,
(aOutputSize.Height() - aGraphicSize.Height() ) >> 1);
- maPreview.StartAnimation(&rRenderContext, aGraphicPosition, aGraphicSize);
+ maPreview.StartAnimation(rRenderContext, aGraphicPosition, aGraphicSize);
}
else
{
const Size aGraphicSize(maPreview.GetSizePixel());
const Point aGraphicPosition((aOutputSize.Width() - aGraphicSize.Width()) >> 1,
(aOutputSize.Height() - aGraphicSize.Height()) >> 1);
- maPreview.Draw(&rRenderContext, aGraphicPosition, aGraphicSize);
+ maPreview.Draw(rRenderContext, aGraphicPosition, aGraphicSize);
}
}
@@ -124,9 +124,10 @@ void CuiGraphicPreviewWindow::Resize()
}
GraphicFilterDialog::GraphicFilterDialog(weld::Window* pParent,
- const OUString& rUIXMLDescription, const OString& rID,
+ const OUString& rUIXMLDescription, const OUString& rID,
const Graphic& rGraphic)
: GenericDialogController(pParent, rUIXMLDescription, rID)
+ , maTimer("cui GraphicFilterDialog maTimer")
, maModifyHdl(LINK(this, GraphicFilterDialog, ImplModifyHdl))
, mxPreview(new weld::CustomWeld(*m_xBuilder, "preview", maPreview))
{
@@ -175,7 +176,7 @@ GraphicFilterMosaic::GraphicFilterMosaic(weld::Window* pParent, const Graphic& r
mxMtrWidth->grab_focus();
}
-IMPL_LINK_NOARG(GraphicFilterMosaic, CheckBoxModifyHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(GraphicFilterMosaic, CheckBoxModifyHdl, weld::Toggleable&, void)
{
GetModifyHdl().Call(nullptr);
}
@@ -191,8 +192,8 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
Graphic aRet;
tools::Long nTileWidth = static_cast<tools::Long>(mxMtrWidth->get_value(FieldUnit::PIXEL));
tools::Long nTileHeight = static_cast<tools::Long>(mxMtrHeight->get_value(FieldUnit::PIXEL));
- const Size aSize( std::max( FRound( nTileWidth * fScaleX ), tools::Long(1) ),
- std::max( FRound( nTileHeight * fScaleY ), tools::Long(1) ) );
+ const Size aSize( std::max( basegfx::fround<tools::Long>( nTileWidth * fScaleX ), tools::Long(1) ),
+ std::max( basegfx::fround<tools::Long>( nTileHeight * fScaleY ), tools::Long(1) ) );
if( rGraphic.IsAnimated() )
{
@@ -269,14 +270,14 @@ GraphicFilterSolarize::GraphicFilterSolarize(weld::Window* pParent, const Graphi
, mxMtrThreshold(m_xBuilder->weld_metric_spin_button("value", FieldUnit::PERCENT))
, mxCbxInvert(m_xBuilder->weld_check_button("invert"))
{
- mxMtrThreshold->set_value(FRound(cGreyThreshold / 2.55), FieldUnit::PERCENT);
+ mxMtrThreshold->set_value(basegfx::fround(cGreyThreshold / 2.55), FieldUnit::PERCENT);
mxMtrThreshold->connect_value_changed(LINK(this, GraphicFilterSolarize, EditModifyHdl));
mxCbxInvert->set_active(bInvert);
mxCbxInvert->connect_toggled(LINK(this, GraphicFilterSolarize, CheckBoxModifyHdl));
}
-IMPL_LINK_NOARG(GraphicFilterSolarize, CheckBoxModifyHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(GraphicFilterSolarize, CheckBoxModifyHdl, weld::Toggleable&, void)
{
GetModifyHdl().Call(nullptr);
}
@@ -289,7 +290,7 @@ IMPL_LINK_NOARG(GraphicFilterSolarize, EditModifyHdl, weld::MetricSpinButton&, v
Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, double, double )
{
Graphic aRet;
- sal_uInt8 nGreyThreshold = static_cast<sal_uInt8>(FRound(mxMtrThreshold->get_value(FieldUnit::PERCENT) * 2.55));
+ sal_uInt8 nGreyThreshold = basegfx::fround<sal_uInt8>(mxMtrThreshold->get_value(FieldUnit::PERCENT) * 2.55);
if( rGraphic.IsAnimated() )
{
@@ -361,7 +362,7 @@ GraphicFilterPoster::GraphicFilterPoster(weld::Window* pParent, const Graphic& r
: GraphicFilterDialog(pParent, "cui/ui/posterdialog.ui", "PosterDialog", rGraphic)
, mxNumPoster(m_xBuilder->weld_spin_button("value"))
{
- mxNumPoster->set_range(2, rGraphic.GetBitmapEx().GetBitCount());
+ mxNumPoster->set_range(2, vcl::pixelFormatBitCount(rGraphic.GetBitmapEx().getPixelFormat()));
mxNumPoster->set_value(nPosterCount);
mxNumPoster->connect_value_changed(LINK(this, GraphicFilterPoster, EditModifyHdl));
}
@@ -430,21 +431,21 @@ GraphicFilterEmboss::~GraphicFilterEmboss()
Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic, double, double )
{
Graphic aRet;
- sal_uInt16 nAzim, nElev;
+ Degree100 nAzim, nElev;
switch (maCtlLight.GetActualRP())
{
default: OSL_FAIL("svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" );
[[fallthrough]];
- case RectPoint::LT: nAzim = 4500; nElev = 4500; break;
- case RectPoint::MT: nAzim = 9000; nElev = 4500; break;
- case RectPoint::RT: nAzim = 13500; nElev = 4500; break;
- case RectPoint::LM: nAzim = 0; nElev = 4500; break;
- case RectPoint::MM: nAzim = 0; nElev = 9000; break;
- case RectPoint::RM: nAzim = 18000; nElev = 4500; break;
- case RectPoint::LB: nAzim = 31500; nElev = 4500; break;
- case RectPoint::MB: nAzim = 27000; nElev = 4500; break;
- case RectPoint::RB: nAzim = 22500; nElev = 4500; break;
+ case RectPoint::LT: nAzim = 4500_deg100; nElev = 4500_deg100; break;
+ case RectPoint::MT: nAzim = 9000_deg100; nElev = 4500_deg100; break;
+ case RectPoint::RT: nAzim = 13500_deg100; nElev = 4500_deg100; break;
+ case RectPoint::LM: nAzim = 0_deg100; nElev = 4500_deg100; break;
+ case RectPoint::MM: nAzim = 0_deg100; nElev = 9000_deg100; break;
+ case RectPoint::RM: nAzim = 18000_deg100; nElev = 4500_deg100; break;
+ case RectPoint::LB: nAzim = 31500_deg100; nElev = 4500_deg100; break;
+ case RectPoint::MB: nAzim = 27000_deg100; nElev = 4500_deg100; break;
+ case RectPoint::RB: nAzim = 22500_deg100; nElev = 4500_deg100; break;
}
if( rGraphic.IsAnimated() )
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index f4da049c61cb..4fec600441fd 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -58,7 +58,7 @@ void SvxHlinkCtrl::dispose()
::SfxControllerItem::dispose();
}
-void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+void SvxHlinkCtrl::StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState )
{
if (!(eState == SfxItemState::DEFAULT && pParent))
@@ -79,13 +79,15 @@ void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
}
}
+// tdf#90496 - remember last used view in hyperlink dialog
+OUString SvxHpLinkDlg::msRememberedPageId("internet");
+
//# #
//# Hyperlink - Dialog #
//# #
SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent)
: SfxModelessDialogController(pBindings, pChild, pParent, "cui/ui/hyperlinkdialog.ui", "HyperlinkDialog")
, pSet ( nullptr )
- , pExampleSet ( nullptr )
, maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this )
, mbIsHTMLDoc ( false )
, m_xIconCtrl(m_xBuilder->weld_notebook("tabcontrol"))
@@ -101,25 +103,35 @@ SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld:
// ItemSet
if ( pSet )
{
- pExampleSet = new SfxItemSet( *pSet );
+ pExampleSet.reset(new SfxItemSet( *pSet ));
pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
}
// Buttons
m_xOKBtn->show();
- m_xApplyBtn->show();
m_xCancelBtn->show();
- m_xHelpBtn->show();
- m_xResetBtn->show();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ m_xApplyBtn->hide();
+ m_xHelpBtn->hide();
+ m_xResetBtn->hide();
+ }
+ else
+ {
+ m_xApplyBtn->show();
+ m_xHelpBtn->show();
+ m_xResetBtn->show();
+ }
mbGrabFocus = true;
// set OK/Cancel - button
- m_xCancelBtn->set_label(CuiResId(RID_SVXSTR_HYPDLG_CLOSEBUT));
+ m_xCancelBtn->set_label(CuiResId(RID_CUISTR_HYPDLG_CLOSEBUT));
// create itemset for tabpages
- mpItemSet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), svl::Items<SID_HYPERLINK_GETLINK,
- SID_HYPERLINK_SETLINK>{} );
+ mpItemSet = std::make_unique<SfxItemSetFixed<SID_HYPERLINK_GETLINK,
+ SID_HYPERLINK_SETLINK>>( SfxGetpApp()->GetPool());
SvxHyperlinkItem aItem(SID_HYPERLINK_GETLINK);
mpItemSet->Put(aItem);
@@ -135,7 +147,8 @@ SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld:
AddTabPage("newdocument", SvxHyperlinkNewDocTp::Create);
}
- SetCurPageId("internet");
+ // tdf#90496 - remember last used view in hyperlink dialog
+ SetCurPageId(msRememberedPageId);
// Init Dialog
Start();
@@ -150,6 +163,8 @@ SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld:
SvxHpLinkDlg::~SvxHpLinkDlg()
{
+ mbGrabFocus = false; // don't do any grab if tear-down moves focus around during destruction
+
// delete config item, so the base class (SfxModelessDialogController) can not load it on the next start
SvtViewOptions aViewOpt( EViewType::TabDialog, OUString::number(SID_HYPERLINK_DIALOG) );
aViewOpt.Delete();
@@ -176,30 +191,25 @@ void SvxHpLinkDlg::Close()
{
if (IsClosing())
return;
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (pViewFrame)
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
pViewFrame->ToggleChildWindow(SID_HYPERLINK_DIALOG);
}
void SvxHpLinkDlg::Apply()
{
- SfxItemSet aItemSet( SfxGetpApp()->GetPool(), svl::Items<SID_HYPERLINK_GETLINK,
- SID_HYPERLINK_SETLINK>{} );
+ SfxItemSetFixed<SID_HYPERLINK_GETLINK, SID_HYPERLINK_SETLINK> aItemSet( SfxGetpApp()->GetPool() );
SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>(
GetTabPage( GetCurPageId() ) );
- if ( pCurrentPage->AskApply() )
- {
- pCurrentPage->FillItemSet( &aItemSet );
+ pCurrentPage->FillItemSet( &aItemSet );
- const SvxHyperlinkItem *aItem = aItemSet.GetItem(SID_HYPERLINK_SETLINK);
- if ( !aItem->GetURL().isEmpty() )
- GetDispatcher()->ExecuteList(SID_HYPERLINK_SETLINK,
- SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { aItem });
+ const SvxHyperlinkItem *aItem = aItemSet.GetItem(SID_HYPERLINK_SETLINK);
+ if ( !aItem->GetURL().isEmpty() )
+ GetDispatcher()->ExecuteList(SID_HYPERLINK_SETLINK,
+ SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { aItem });
- static_cast<SvxHyperlinkTabPageBase*>( GetTabPage( GetCurPageId() ) )->DoApply();
- }
+ static_cast<SvxHyperlinkTabPageBase*>( GetTabPage( GetCurPageId() ) )->DoApply();
}
/// Click on OK button
@@ -226,7 +236,7 @@ IMPL_LINK_NOARG(SvxHpLinkDlg, ClickApplyHdl_Impl, weld::Button&, void)
|************************************************************************/
void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
{
- OString sPageId("internet");
+ OUString sPageId("internet");
OUString aStrURL(pItem->GetURL());
INetURLObject aURL(aStrURL);
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index ffa540bbca5b..09b6158fde00 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -19,13 +19,16 @@
#include <dlgname.hxx>
+#include <comphelper/string.hxx>
+
/*************************************************************************
|*
|* Dialog for editing a name
|*
\************************************************************************/
-SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc)
+SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc,
+ const OUString& rTitle)
: GenericDialogController(pParent, "cui/ui/namedialog.ui", "NameDialog")
, m_xEdtName(m_xBuilder->weld_entry("name_entry"))
, m_xFtDescription(m_xBuilder->weld_label("description_label"))
@@ -36,14 +39,16 @@ SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const
m_xEdtName->select_region(0, -1);
ModifyHdl(*m_xEdtName);
m_xEdtName->connect_changed(LINK(this, SvxNameDialog, ModifyHdl));
+ if (!rTitle.isEmpty())
+ set_title(rTitle);
}
IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry&, void)
{
- // Do not allow empty names
+ // Do not allow empty names, unless custom CheckNameHdl is specified
bool bEnable;
if (m_aCheckNameHdl.IsSet())
- bEnable = !m_xEdtName->get_text().isEmpty() && m_aCheckNameHdl.Call(*this);
+ bEnable = m_aCheckNameHdl.Call(*this);
else
bEnable = !m_xEdtName->get_text().isEmpty();
m_xBtnOK->set_sensitive(bEnable);
@@ -57,6 +62,28 @@ IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry&, void)
m_xEdtName->set_tooltip_text(rTip);
}
+SvxNumberDialog::SvxNumberDialog(weld::Window* pParent, const OUString& rDesc, sal_Int64 nValue,
+ sal_Int64 nMin, sal_Int64 nMax)
+ : GenericDialogController(pParent, "cui/ui/numberdialog.ui", "NumberDialog")
+ , m_xEdtNumber(m_xBuilder->weld_spin_button("number_spinbtn"))
+ , m_xFtDescription(m_xBuilder->weld_label("description_label"))
+{
+ m_xFtDescription->set_label(rDesc);
+ m_xEdtNumber->set_min(nMin);
+ m_xEdtNumber->set_max(nMax);
+ m_xEdtNumber->set_value(nValue);
+}
+
+SvxDecimalNumberDialog::SvxDecimalNumberDialog(weld::Window* pParent, const OUString& rDesc,
+ double fValue)
+ : GenericDialogController(pParent, "cui/ui/numberdialog.ui", "NumberDialog")
+ , m_xEdtNumber(m_xBuilder->weld_formatted_spin_button("number_spinbtn"))
+ , m_xFtDescription(m_xBuilder->weld_label("description_label"))
+{
+ m_xFtDescription->set_label(rDesc);
+ m_xEdtNumber->GetFormatter().SetValue(fValue);
+}
+
// #i68101#
// Dialog for editing Object Name
// plus uniqueness-callback-linkHandler
@@ -87,10 +114,14 @@ IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, weld::Entry&, void)
// Dialog for editing Object Title and Description
SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle,
- const OUString& rDescription)
+ const OUString& rDescription,
+ bool const isDecorative)
: GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog")
+ , m_xTitleFT(m_xBuilder->weld_label("object_title_label"))
, m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry"))
+ , m_xDescriptionFT(m_xBuilder->weld_label("desc_label"))
, m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry"))
+ , m_xDecorativeCB(m_xBuilder->weld_check_button("decorative"))
{
//lock height to initial height
m_xEdtDescription->set_size_request(-1, m_xEdtDescription->get_text_height() * 5);
@@ -100,6 +131,154 @@ SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const
// activate title
m_xEdtTitle->select_region(0, -1);
+
+ m_xDecorativeCB->set_active(isDecorative);
+ m_xDecorativeCB->connect_toggled(LINK(this, SvxObjectTitleDescDialog, DecorativeHdl));
+ DecorativeHdl(*m_xDecorativeCB);
+}
+
+IMPL_LINK_NOARG(SvxObjectTitleDescDialog, DecorativeHdl, weld::Toggleable&, void)
+{
+ bool const bEnable(!m_xDecorativeCB->get_active());
+ m_xEdtTitle->set_sensitive(bEnable);
+ m_xTitleFT->set_sensitive(bEnable);
+ m_xEdtDescription->set_sensitive(bEnable);
+ m_xDescriptionFT->set_sensitive(bEnable);
+}
+
+SvxListDialog::SvxListDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "cui/ui/listdialog.ui", "ListDialog")
+ , m_aMode(ListMode::String)
+ , m_xList(m_xBuilder->weld_tree_view("assignlist"))
+ , m_xAddBtn(m_xBuilder->weld_button("addbtn"))
+ , m_xRemoveBtn(m_xBuilder->weld_button("removebtn"))
+ , m_xEditBtn(m_xBuilder->weld_button("editbtn"))
+{
+ m_xList->set_size_request(m_xList->get_approximate_digit_width() * 54,
+ m_xList->get_height_rows(6));
+ m_xAddBtn->connect_clicked(LINK(this, SvxListDialog, AddHdl_Impl));
+ m_xRemoveBtn->connect_clicked(LINK(this, SvxListDialog, RemoveHdl_Impl));
+ m_xEditBtn->connect_clicked(LINK(this, SvxListDialog, EditHdl_Impl));
+ m_xList->connect_changed(LINK(this, SvxListDialog, SelectHdl_Impl));
+ m_xList->connect_row_activated(LINK(this, SvxListDialog, DblClickHdl_Impl));
+
+ SelectionChanged();
+}
+
+SvxListDialog::~SvxListDialog() {}
+
+IMPL_LINK_NOARG(SvxListDialog, AddHdl_Impl, weld::Button&, void)
+{
+ SvxNameDialog aNameDlg(m_xDialog.get(), "", "");
+
+ if (!aNameDlg.run())
+ return;
+ OUString sNewText = comphelper::string::strip(aNameDlg.GetName(), ' ');
+ if (!sNewText.isEmpty())
+ {
+ m_xList->insert_text(-1, sNewText);
+ m_xList->select(-1);
+ }
+}
+
+IMPL_LINK_NOARG(SvxListDialog, EditHdl_Impl, weld::Button&, void) { EditEntry(); }
+
+IMPL_LINK_NOARG(SvxListDialog, SelectHdl_Impl, weld::TreeView&, void) { SelectionChanged(); }
+
+IMPL_LINK_NOARG(SvxListDialog, DblClickHdl_Impl, weld::TreeView&, bool)
+{
+ EditEntry();
+ return true;
}
+IMPL_LINK_NOARG(SvxListDialog, RemoveHdl_Impl, weld::Button&, void)
+{
+ int nPos = m_xList->get_selected_index();
+ if (nPos == -1)
+ return;
+ m_xList->remove(nPos);
+ int nCount = m_xList->n_children();
+ if (nCount)
+ {
+ if (nPos >= nCount)
+ nPos = nCount - 1;
+ m_xList->select(nPos);
+ }
+ SelectionChanged();
+}
+
+void SvxListDialog::SelectionChanged()
+{
+ bool bEnable = m_xList->get_selected_index() != -1;
+ m_xRemoveBtn->set_sensitive(bEnable);
+ m_xEditBtn->set_sensitive(bEnable);
+}
+
+std::vector<OUString> SvxListDialog::GetEntries()
+{
+ int nCount = m_xList->n_children();
+ std::vector<OUString> aList;
+ aList.reserve(nCount);
+ for (int i = 0; i < nCount; ++i)
+ aList.push_back(m_xList->get_text(i));
+ return aList;
+}
+
+void SvxListDialog::SetEntries(std::vector<OUString> const& rEntries)
+{
+ m_xList->clear();
+ for (auto const& sEntry : rEntries)
+ {
+ m_xList->append_text(sEntry);
+ }
+ SelectionChanged();
+}
+
+void SvxListDialog::EditEntry()
+{
+ int nPos = m_xList->get_selected_index();
+ if (nPos == -1)
+ return;
+
+ OUString sOldText(m_xList->get_selected_text());
+ OUString sNewText;
+
+ if (m_aMode == ListMode::String)
+ {
+ SvxNameDialog aNameDlg(m_xDialog.get(), sOldText, "");
+ if (!aNameDlg.run())
+ return;
+ sNewText = comphelper::string::strip(aNameDlg.GetName(), ' ');
+ }
+ else if (m_aMode == ListMode::Int16 || m_aMode == ListMode::Int32 || m_aMode == ListMode::Int64)
+ {
+ sal_Int64 nMin = m_aMode == ListMode::Int16
+ ? SAL_MIN_INT16
+ : m_aMode == ListMode::Int32 ? SAL_MIN_INT32 : SAL_MIN_INT64;
+ sal_Int64 nMax = m_aMode == ListMode::Int16
+ ? SAL_MAX_INT16
+ : m_aMode == ListMode::Int32 ? SAL_MAX_INT32 : SAL_MAX_INT64;
+ SvxNumberDialog aNumberDlg(m_xDialog.get(), "", sOldText.toInt64(), nMin, nMax);
+ if (!aNumberDlg.run())
+ return;
+ sNewText = OUString::number(aNumberDlg.GetNumber());
+ }
+ else if (m_aMode == ListMode::Double)
+ {
+ SvxDecimalNumberDialog aNumberDlg(m_xDialog.get(), "", sOldText.toDouble());
+ if (!aNumberDlg.run())
+ return;
+ sNewText = OUString::number(aNumberDlg.GetNumber());
+ }
+
+ if (!sNewText.isEmpty() && sNewText != sOldText)
+ {
+ m_xList->remove(nPos);
+ m_xList->insert_text(nPos, sNewText);
+ m_xList->select(nPos);
+ }
+}
+
+void SvxListDialog::SetMode(ListMode aMode) { m_aMode = aMode; };
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/fileextcheckdlg.cxx b/cui/source/dialogs/fileextcheckdlg.cxx
new file mode 100644
index 000000000000..732f8367436a
--- /dev/null
+++ b/cui/source/dialogs/fileextcheckdlg.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <officecfg/Office/Common.hxx>
+#include <vcl/fileregistration.hxx>
+
+#include <fileextcheckdlg.hxx>
+
+FileExtCheckDialog::FileExtCheckDialog(weld::Window* pParent, const OUString& sTitle,
+ const OUString& sMsg)
+ : GenericDialogController(pParent, "cui/ui/fileextcheckdialog.ui", "FileExtCheckDialog")
+ , m_pText(m_xBuilder->weld_label("lbText"))
+ , m_pPerformCheck(m_xBuilder->weld_check_button("cbPerformCheck"))
+ , m_pOk(m_xBuilder->weld_button("btnOk"))
+{
+ m_pPerformCheck->set_active(true);
+ m_pOk->connect_clicked(LINK(this, FileExtCheckDialog, OnOkClick));
+ m_xDialog->set_title(sTitle);
+ m_pText->set_label(sMsg);
+}
+
+FileExtCheckDialog::~FileExtCheckDialog()
+{
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::PerformFileExtCheck::set(m_pPerformCheck->get_active(),
+ xChanges);
+ xChanges->commit();
+}
+
+IMPL_LINK_NOARG(FileExtCheckDialog, OnOkClick, weld::Button&, void)
+{
+ vcl::fileregistration::LaunchRegistrationUI();
+ FileExtCheckDialog::response(RET_OK);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 76c6bdd000a7..fb25df938e17 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -28,8 +28,8 @@
#include <osl/diagnose.h>
#include <tools/debug.hxx>
#include <i18nlangtag/languagetag.hxx>
-#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/weldutils.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
#include <com/sun/star/lang/NoSupportException.hpp>
@@ -68,7 +68,7 @@ namespace svx
FontSwitch( OutputDevice& _rDev, const vcl::Font& _rTemporaryFont )
:m_rDev( _rDev )
{
- m_rDev.Push( PushFlags::FONT );
+ m_rDev.Push( vcl::PushFlags::FONT );
m_rDev.SetFont( _rTemporaryFont );
}
~FontSwitch() COVERITY_NOEXCEPT_FALSE
@@ -193,14 +193,18 @@ namespace svx
class RubyRadioButton
{
public:
- RubyRadioButton(std::unique_ptr<weld::RadioButton> xControl);
+ RubyRadioButton(std::unique_ptr<weld::RadioButton> xControl, std::unique_ptr<weld::Image> xImage);
void init(const OUString& rPrimaryText, const OUString& rSecondaryText, const PseudoRubyText::RubyPosition& rPosition);
- void set_sensitive(bool sensitive) { m_xControl->set_sensitive(sensitive); }
+ void set_sensitive(bool sensitive)
+ {
+ m_xControl->set_sensitive(sensitive);
+ m_xImage->set_sensitive(sensitive);
+ }
void set_active(bool active) { m_xControl->set_active(active); }
bool get_active() const { return m_xControl->get_active(); }
- void connect_clicked(const Link<weld::Button&, void>& rLink) { m_xControl->connect_clicked(rLink); }
+ void connect_toggled(const Link<weld::Toggleable&, void>& rLink) { m_xControl->connect_toggled(rLink); }
private:
Size GetOptimalSize() const;
@@ -208,16 +212,17 @@ namespace svx
ScopedVclPtr<VirtualDevice> m_xVirDev;
std::unique_ptr<weld::RadioButton> m_xControl;
+ std::unique_ptr<weld::Image> m_xImage;
PseudoRubyText m_aRubyText;
};
- RubyRadioButton::RubyRadioButton(std::unique_ptr<weld::RadioButton> xControl)
+ RubyRadioButton::RubyRadioButton(std::unique_ptr<weld::RadioButton> xControl, std::unique_ptr<weld::Image> xImage)
: m_xVirDev(xControl->create_virtual_device())
, m_xControl(std::move(xControl))
+ , m_xImage(std::move(xImage))
{
// expand the point size of the desired font to the equivalent pixel size
- if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice()))
- pDefaultDevice->SetPointFont(*m_xVirDev, m_xControl->get_font());
+ weld::SetPointFont(*m_xVirDev, m_xControl->get_font());
}
void RubyRadioButton::init( const OUString& rPrimaryText, const OUString& rSecondaryText, const PseudoRubyText::RubyPosition& rPosition )
@@ -228,7 +233,7 @@ namespace svx
Paint(*m_xVirDev);
- m_xControl->set_image(m_xVirDev.get());
+ m_xImage->set_image(m_xVirDev.get());
}
void RubyRadioButton::Paint(vcl::RenderContext& rRenderContext)
@@ -261,7 +266,7 @@ namespace svx
Size minimumSize;
minimumSize.setHeight( aPrimarySize.Height() + aSecondarySize.Height() + 5 );
- minimumSize.setWidth( aPrimarySize.Width() + aSecondarySize.Width() + 5 );
+ minimumSize.setWidth(std::max(aPrimarySize.Width(), aSecondarySize.Width()) + 5 );
return minimumSize;
}
@@ -431,10 +436,14 @@ namespace svx
, m_xHanjaBracketed(m_xBuilder->weld_radio_button("hanjabracket"))
, m_xWordInput(m_xBuilder->weld_entry("wordinput"))
, m_xOriginalWord(m_xBuilder->weld_label("originalword"))
- , m_xHanjaAbove(new RubyRadioButton(m_xBuilder->weld_radio_button("hanja_above")))
- , m_xHanjaBelow(new RubyRadioButton(m_xBuilder->weld_radio_button("hanja_below")))
- , m_xHangulAbove(new RubyRadioButton(m_xBuilder->weld_radio_button("hangul_above")))
- , m_xHangulBelow(new RubyRadioButton(m_xBuilder->weld_radio_button("hangul_below")))
+ , m_xHanjaAbove(new RubyRadioButton(m_xBuilder->weld_radio_button("hanja_above"),
+ m_xBuilder->weld_image("hanja_above_img")))
+ , m_xHanjaBelow(new RubyRadioButton(m_xBuilder->weld_radio_button("hanja_below"),
+ m_xBuilder->weld_image("hanja_below_img")))
+ , m_xHangulAbove(new RubyRadioButton(m_xBuilder->weld_radio_button("hangul_above"),
+ m_xBuilder->weld_image("hangul_above_img")))
+ , m_xHangulBelow(new RubyRadioButton(m_xBuilder->weld_radio_button("hangul_below"),
+ m_xBuilder->weld_image("hangul_below_img")))
, m_xHangulOnly(m_xBuilder->weld_check_button("hangulonly"))
, m_xHanjaOnly(m_xBuilder->weld_check_button("hanjaonly"))
, m_xReplaceByChar(m_xBuilder->weld_check_button("replacebychar"))
@@ -442,8 +451,8 @@ namespace svx
m_xSuggestions->set_size_request(m_xOriginalWord->get_approximate_digit_width() * 42,
m_xOriginalWord->get_text_height() * 5);
- const OUString sHangul(CuiResId(RID_SVXSTR_HANGUL));
- const OUString sHanja(CuiResId(RID_SVXSTR_HANJA));
+ const OUString sHangul(CuiResId(RID_CUISTR_HANGUL));
+ const OUString sHanja(CuiResId(RID_CUISTR_HANJA));
m_xHanjaAbove->init( sHangul, sHanja, PseudoRubyText::eAbove );
m_xHanjaBelow->init( sHangul, sHanja, PseudoRubyText::eBelow );
m_xHangulAbove->init( sHanja, sHangul, PseudoRubyText::eAbove );
@@ -517,18 +526,18 @@ namespace svx
m_xFind->connect_clicked(rHdl);
}
- void HangulHanjaConversionDialog::SetConversionFormatChangedHdl( const Link<weld::Button&,void>& rHdl )
+ void HangulHanjaConversionDialog::SetConversionFormatChangedHdl( const Link<weld::Toggleable&,void>& rHdl )
{
- m_xSimpleConversion->connect_clicked( rHdl );
- m_xHangulBracketed->connect_clicked( rHdl );
- m_xHanjaBracketed->connect_clicked( rHdl );
- m_xHanjaAbove->connect_clicked( rHdl );
- m_xHanjaBelow->connect_clicked( rHdl );
- m_xHangulAbove->connect_clicked( rHdl );
- m_xHangulBelow->connect_clicked( rHdl );
+ m_xSimpleConversion->connect_toggled( rHdl );
+ m_xHangulBracketed->connect_toggled( rHdl );
+ m_xHanjaBracketed->connect_toggled( rHdl );
+ m_xHanjaAbove->connect_toggled( rHdl );
+ m_xHanjaBelow->connect_toggled( rHdl );
+ m_xHangulAbove->connect_toggled( rHdl );
+ m_xHangulBelow->connect_toggled( rHdl );
}
- void HangulHanjaConversionDialog::SetClickByCharacterHdl( const Link<weld::ToggleButton&,void>& _rHdl )
+ void HangulHanjaConversionDialog::SetClickByCharacterHdl( const Link<weld::Toggleable&,void>& _rHdl )
{
m_aClickByCharacterLink = _rHdl;
}
@@ -548,14 +557,14 @@ namespace svx
m_xReplaceAll->set_sensitive( m_bDocumentMode && bSameLen );
}
- IMPL_LINK(HangulHanjaConversionDialog, ClickByCharacterHdl, weld::ToggleButton&, rBox, void)
+ IMPL_LINK(HangulHanjaConversionDialog, ClickByCharacterHdl, weld::Toggleable&, rBox, void)
{
m_aClickByCharacterLink.Call(rBox);
bool bByCharacter = rBox.get_active();
m_xSuggestions->DisplayListBox( !bByCharacter );
}
- IMPL_LINK(HangulHanjaConversionDialog, OnConversionDirectionClicked, weld::ToggleButton&, rBox, void)
+ IMPL_LINK(HangulHanjaConversionDialog, OnConversionDirectionClicked, weld::Toggleable&, rBox, void)
{
weld::CheckButton* pOtherBox = nullptr;
if (&rBox == m_xHangulOnly.get())
@@ -613,8 +622,7 @@ namespace svx
pNewDefButton = m_xFind.get();
}
- pOldDefButton->set_has_default(false);
- pNewDefButton->set_has_default(true);
+ m_xDialog->change_default_widget(pOldDefButton, pNewDefButton);
}
OUString HangulHanjaConversionDialog::GetCurrentSuggestion( ) const
@@ -1422,7 +1430,7 @@ namespace svx
HangulHanjaEditDictDialog::HangulHanjaEditDictDialog(weld::Window* pParent, HHDictList& _rDictList, sal_uInt32 nSelDict)
: GenericDialogController(pParent, "cui/ui/hangulhanjaeditdictdialog.ui", "HangulHanjaEditDictDialog")
- , m_aEditHintText ( CuiResId(RID_SVXSTR_EDITHINT) )
+ , m_aEditHintText ( CuiResId(RID_CUISTR_EDITHINT) )
, m_rDictList ( _rDictList )
, m_nCurrentDict ( 0xFFFFFFFF )
, m_nTopPos ( 0 )
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 3a582764f40e..d58077a431f4 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -19,14 +19,14 @@
#include <hldocntp.hxx>
#include <osl/file.hxx>
+#include <sfx2/filedlghelper.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/docfilt.hxx>
#include <svl/stritem.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/Sequence.h>
-#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Exception.hpp>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <tools/urlobj.hxx>
@@ -36,14 +36,13 @@
#include <unotools/ucbhelper.hxx>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <cuihyperdlg.hxx>
#include <dialmgr.hxx>
#include <strings.hrc>
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
@@ -61,13 +60,13 @@ struct DocumentTypeData
{
OUString aStrURL;
OUString aStrExt;
- DocumentTypeData (const OUString& aURL, const OUString& aExt) : aStrURL(aURL), aStrExt(aExt)
+ DocumentTypeData (OUString aURL, OUString aExt) : aStrURL(std::move(aURL)), aStrExt(std::move(aExt))
{}
};
}
-bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, const OUString& rBase, INetURLObject& aURLObject ) const
+bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, std::u16string_view rBase, INetURLObject& aURLObject ) const
{
bool bIsValidURL = !rPath.isEmpty();
if ( bIsValidURL )
@@ -93,7 +92,7 @@ bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, const OUStri
{
sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
if (nPos != -1)
- aURLObject.SetExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
+ aURLObject.SetExtension(weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos))->aStrExt);
}
}
@@ -137,7 +136,7 @@ SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
if (m_xLbDocTypes)
{
for (sal_Int32 n = 0, nEntryCount = m_xLbDocTypes->n_children(); n < nEntryCount; ++n)
- delete reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(n).toInt64());
+ delete weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(n));
m_xLbDocTypes = nullptr;
}
}
@@ -157,7 +156,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList()
{
weld::WaitObject aWaitObj(mpDialog->getDialog());
- std::vector<SvtDynMenuEntry> aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( EDynamicMenuType::NewMenu ) );
+ std::vector<SvtDynMenuEntry> aDynamicMenuEntries( SvtDynamicMenuOptions::GetMenu( EDynamicMenuType::NewMenu ) );
for ( const SvtDynMenuEntry & rDynamicMenuEntry : aDynamicMenuEntries )
{
@@ -185,7 +184,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList()
OUString aStrDefExt(pFilter->GetDefaultExtension());
DocumentTypeData *pTypeData = new DocumentTypeData(aDocumentUrl, aStrDefExt.copy(2));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pTypeData)));
+ OUString sId(weld::toId(pTypeData));
m_xLbDocTypes->append(sId, aTitleName);
}
}
@@ -199,7 +198,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList()
|*
|************************************************************************/
-void SvxHyperlinkNewDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+void SvxHyperlinkNewDocTp::GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
{
@@ -235,25 +234,6 @@ void SvxHyperlinkNewDocTp::SetInitFocus()
m_xCbbPath->grab_focus();
}
-/*************************************************************************
-|*
-|* Ask page whether an insert is possible
-|*
-\************************************************************************/
-bool SvxHyperlinkNewDocTp::AskApply()
-{
- INetURLObject aINetURLObject;
- bool bRet = ImplGetURLObject(m_xCbbPath->get_active_text(), m_xCbbPath->GetBaseURL(), aINetURLObject);
- if ( !bRet )
- {
- std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(),
- VclMessageType::Warning, VclButtonsType::Ok,
- CuiResId(RID_SVXSTR_HYPDLG_NOVALIDFILENAME)));
- xWarn->run();
- }
- return bRet;
-}
-
namespace
{
struct ExecuteInfo
@@ -293,12 +273,12 @@ IMPL_STATIC_LINK(SvxHyperlinkNewDocTp, DispatchDocument, void*, p, void)
SfxStringItem aFlags (SID_OPTIONS, aStrFlags);
// open url
- const SfxPoolItem* pReturn = xExecuteInfo->pDispatcher->ExecuteList(
- SID_OPENDOC, SfxCallMode::SYNCHRON,
- { &aName, &aFlags, &aFrame, &aReferer });
+ const SfxPoolItemHolder aResult(xExecuteInfo->pDispatcher->ExecuteList(
+ SID_OPENDOC, SfxCallMode::SYNCHRON,
+ { &aName, &aFlags, &aFrame, &aReferer }));
// save new doc
- const SfxViewFrameItem *pItem = dynamic_cast<const SfxViewFrameItem*>( pReturn ); // SJ: pReturn is NULL if the Hyperlink
+ const SfxViewFrameItem *pItem = dynamic_cast<const SfxViewFrameItem*>(aResult.getItem()); // aResult is NULL if the Hyperlink
if ( pItem ) // creation is cancelled #106216#
{
pViewFrame = pItem->GetFrame();
@@ -306,7 +286,6 @@ IMPL_STATIC_LINK(SvxHyperlinkNewDocTp, DispatchDocument, void*, p, void)
{
SfxStringItem aNewName( SID_FILE_NAME, xExecuteInfo->aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
SfxUnoFrameItem aDocFrame( SID_FILLFRAME, pViewFrame->GetFrame().GetFrameInterface() );
- fprintf(stderr, "is there a frame int %p\n", pViewFrame->GetFrame().GetFrameInterface().get() );
pViewFrame->GetDispatcher()->ExecuteList(
SID_SAVEASDOC, SfxCallMode::SYNCHRON,
{ &aNewName }, { &aDocFrame });
@@ -367,7 +346,7 @@ void SvxHyperlinkNewDocTp::DoApply()
{
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE)));
+ CuiResId(RID_CUISTR_HYPERDLG_QUERYOVERWRITE)));
bCreate = xWarn->run() == RET_YES;
}
}
@@ -387,7 +366,7 @@ void SvxHyperlinkNewDocTp::DoApply()
if (nPos == -1)
nPos = 0;
pExecuteInfo->aURL = aURL;
- pExecuteInfo->aStrDocName = reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrURL;
+ pExecuteInfo->aStrDocName = weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos))->aStrURL;
// current document
pExecuteInfo->xFrame = GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface();
@@ -405,7 +384,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, weld::Button&, void)
{
DisableClose( true );
uno::Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- uno::Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
+ uno::Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, mpDialog->getDialog());
OUString aStrURL;
OUString aTempStrURL( m_xCbbPath->get_active_text() );
@@ -451,7 +430,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, weld::Button&, void)
{
// get private-url
const sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
- aNewURL.setExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
+ aNewURL.setExtension(weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos))->aStrExt);
}
if( aNewURL.GetProtocol() == INetProtocol::File )
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 8bfe89465962..a1c1454b69de 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -26,7 +26,6 @@
#include <hlmarkwn_def.hxx>
char const sHash[] = "#";
-char const sFileScheme[] = INET_FILE_SCHEME;
/*************************************************************************
|*
@@ -128,14 +127,14 @@ OUString SvxHyperlinkDocTp::GetCurrentURL () const
|* retrieve and prepare data from dialog-fields
|*
|************************************************************************/
-void SvxHyperlinkDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+void SvxHyperlinkDocTp::GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
{
// get data from standard-fields
rStrURL = GetCurrentURL();
- if( rStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
+ if( rStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
rStrURL.clear();
GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode );
@@ -174,7 +173,7 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, weld::Button&, void)
css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE,
mpDialog->getDialog() );
OUString aOldURL( GetCurrentURL() );
- if( aOldURL.startsWithIgnoreAsciiCase( sFileScheme ) )
+ if( aOldURL.startsWithIgnoreAsciiCase( INET_FILE_SCHEME ) )
{
OUString aPath;
osl::FileBase::getSystemPathFromFileURL(aOldURL, aPath);
@@ -210,14 +209,14 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, weld::Button&, void)
if ( GetPathType ( maStrURL ) == EPathType::ExistsFile ||
maStrURL.isEmpty() ||
- maStrURL.equalsIgnoreAsciiCase( sFileScheme ) ||
+ maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ||
maStrURL.startsWith( sHash ) )
{
mxMarkWnd->SetError( LERR_NOERROR );
weld::WaitObject aWait(mpDialog->getDialog());
- if ( maStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
+ if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
mxMarkWnd->RefreshTree ( "" );
else
mxMarkWnd->RefreshTree ( maStrURL );
@@ -250,11 +249,11 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, void)
{
if ( IsMarkWndVisible() && ( GetPathType( maStrURL )== EPathType::ExistsFile ||
maStrURL.isEmpty() ||
- maStrURL.equalsIgnoreAsciiCase( sFileScheme ) ) )
+ maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) )
{
weld::WaitObject aWait(mpDialog->getDialog());
- if ( maStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
+ if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
mxMarkWnd->RefreshTree ( "" );
else
mxMarkWnd->RefreshTree ( maStrURL );
@@ -305,7 +304,7 @@ void SvxHyperlinkDocTp::SetMarkStr ( const OUString& aStrMark )
|* retrieve kind of pathstr
|*
|************************************************************************/
-SvxHyperlinkDocTp::EPathType SvxHyperlinkDocTp::GetPathType ( const OUString& rStrPath )
+SvxHyperlinkDocTp::EPathType SvxHyperlinkDocTp::GetPathType ( std::u16string_view rStrPath )
{
INetURLObject aURL( rStrPath, INetProtocol::File );
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 0ed40de94df8..610cdd8aea5e 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -17,14 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/string_view.hxx>
#include <unotools/useroptions.hxx>
#include <svl/adrparse.hxx>
#include <hlinettp.hxx>
#include <hlmarkwn_def.hxx>
-constexpr OUStringLiteral sAnonymous = u"anonymous";
-char const sFTPScheme[] = INET_FTP_SCHEME;
/*************************************************************************
|*
@@ -37,15 +36,8 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp(weld::Container* pParent,
: SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinkinternetpage.ui", "HyperlinkInternetPage",
pItemSet)
, m_bMarkWndOpen(false)
- , m_xRbtLinktypInternet(xBuilder->weld_radio_button("linktyp_internet"))
- , m_xRbtLinktypFTP(xBuilder->weld_radio_button("linktyp_ftp"))
, m_xCbbTarget(new SvxHyperURLBox(xBuilder->weld_combo_box("target")))
, m_xFtTarget(xBuilder->weld_label("target_label"))
- , m_xFtLogin(xBuilder->weld_label("login_label"))
- , m_xEdLogin(xBuilder->weld_entry("login"))
- , m_xFtPassword(xBuilder->weld_label("password_label"))
- , m_xEdPassword(xBuilder->weld_entry("password"))
- , m_xCbAnonymous(xBuilder->weld_check_button("anonymous"))
{
// gtk_size_group_set_ignore_hidden, "Measuring the size of hidden widgets
// ... they will report a size of 0 nowadays, and thus, their size will
@@ -63,15 +55,7 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp(weld::Container* pParent,
SetExchangeSupport ();
- // set defaults
- m_xRbtLinktypInternet->set_active(true);
-
// set handlers
- Link<weld::Button&, void> aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) );
- m_xRbtLinktypInternet->connect_clicked( aLink );
- m_xRbtLinktypFTP->connect_clicked( aLink );
- m_xCbAnonymous->connect_clicked( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) );
- m_xEdLogin->connect_changed( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) );
m_xCbbTarget->connect_focus_out( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) );
m_xCbbTarget->connect_changed( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) );
maTimer.SetInvokeHandler ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) );
@@ -91,19 +75,6 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL)
INetURLObject aURL(rStrURL);
OUString aStrScheme(GetSchemeFromURL(rStrURL));
- // set additional controls for FTP: Username / Password
- if (aStrScheme.startsWith(sFTPScheme))
- {
- if ( aURL.GetUser().toAsciiLowerCase().startsWith( sAnonymous ) )
- setAnonymousFTPUser();
- else
- setFTPUser(aURL.GetUser(), aURL.GetPass());
-
- //do not show password and user in url
- if(!aURL.GetUser().isEmpty() || !aURL.GetPass().isEmpty() )
- aURL.SetUserAndPass("", "");
- }
-
// set URL-field
// Show the scheme, #72740
if ( aURL.GetProtocol() != INetProtocol::NotValid )
@@ -114,38 +85,13 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL)
SetScheme(aStrScheme);
}
-void SvxHyperlinkInternetTp::setAnonymousFTPUser()
-{
- m_xEdLogin->set_text(sAnonymous);
- SvAddressParser aAddress(SvtUserOptions().GetEmail());
- m_xEdPassword->set_text(aAddress.Count() ? aAddress.GetEmailAddress(0) : OUString());
-
- m_xFtLogin->set_sensitive(false);
- m_xFtPassword->set_sensitive(false);
- m_xEdLogin->set_sensitive(false);
- m_xEdPassword->set_sensitive(false);
- m_xCbAnonymous->set_active(true);
-}
-
-void SvxHyperlinkInternetTp::setFTPUser(const OUString& rUser, const OUString& rPassword)
-{
- m_xEdLogin->set_text(rUser);
- m_xEdPassword->set_text(rPassword);
-
- m_xFtLogin->set_sensitive(true);
- m_xFtPassword->set_sensitive(true);
- m_xEdLogin->set_sensitive(true);
- m_xEdPassword->set_sensitive(true);
- m_xCbAnonymous->set_active(false);
-}
-
/*************************************************************************
|*
|* retrieve and prepare data from dialog-fields
|*
|************************************************************************/
-void SvxHyperlinkInternetTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+void SvxHyperlinkInternetTp::GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
{
@@ -158,17 +104,7 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const
// erase leading and trailing whitespaces
OUString aStrURL(m_xCbbTarget->get_active_text().trim());
- INetURLObject aURL(aStrURL);
-
- if( aURL.GetProtocol() == INetProtocol::NotValid )
- {
- aURL.SetSmartProtocol( GetSmartProtocolFromButtons() );
- aURL.SetSmartURL(aStrURL);
- }
-
- // username and password for ftp-url
- if( aURL.GetProtocol() == INetProtocol::Ftp && !m_xEdLogin->get_text().isEmpty() )
- aURL.SetUserAndPass ( m_xEdLogin->get_text(), m_xEdPassword->get_text() );
+ INetURLObject aURL(aStrURL, GetSmartProtocolFromButtons());
if ( aURL.GetProtocol() != INetProtocol::NotValid )
return aURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
@@ -223,44 +159,14 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, void)
RefreshMarkWindow();
}
-/*************************************************************************
-|*
-|* Contents of editfield "Login" modified
-|*
-|************************************************************************/
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, weld::Entry&, void)
-{
- OUString aStrLogin ( m_xEdLogin->get_text() );
- if ( aStrLogin.equalsIgnoreAsciiCase( sAnonymous ) )
- {
- m_xCbAnonymous->set_active(true);
- ClickAnonymousHdl_Impl(*m_xCbAnonymous);
- }
-}
-
-void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme)
+void SvxHyperlinkInternetTp::SetScheme(std::u16string_view rScheme)
{
- //if rScheme is empty or unknown the default behaviour is like it where HTTP
- bool bFTP = rScheme.startsWith(sFTPScheme);
- bool bInternet = !bFTP;
-
- //update protocol button selection:
- m_xRbtLinktypFTP->set_active(bFTP);
- m_xRbtLinktypInternet->set_active(bInternet);
-
//update target:
RemoveImproperProtocol(rScheme);
m_xCbbTarget->SetSmartProtocol( GetSmartProtocolFromButtons() );
- //show/hide special fields for FTP:
- m_xFtLogin->set_visible( bFTP );
- m_xFtPassword->set_visible( bFTP );
- m_xEdLogin->set_visible( bFTP );
- m_xEdPassword->set_visible( bFTP );
- m_xCbAnonymous->set_visible( bFTP );
-
//update 'link target in document'-window and opening-button
- if (rScheme.startsWith(INET_HTTP_SCHEME) || rScheme.isEmpty())
+ if (o3tl::starts_with(rScheme, INET_HTTP_SCHEME) || rScheme.empty())
{
if ( m_bMarkWndOpen )
ShowMarkWnd ();
@@ -293,62 +199,13 @@ void SvxHyperlinkInternetTp::RemoveImproperProtocol(std::u16string_view aProperS
}
}
-OUString SvxHyperlinkInternetTp::GetSchemeFromButtons() const
+INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons()
{
- if( m_xRbtLinktypFTP->get_active() )
- return INET_FTP_SCHEME;
- return INET_HTTP_SCHEME;
-}
-
-INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const
-{
- if( m_xRbtLinktypFTP->get_active() )
- {
- return INetProtocol::Ftp;
- }
return INetProtocol::Http;
}
/*************************************************************************
|*
-|* Click on Radiobutton : Internet or FTP
-|*
-|************************************************************************/
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, weld::Button&, void)
-{
- OUString aScheme = GetSchemeFromButtons();
- SetScheme(aScheme);
-}
-
-/*************************************************************************
-|*
-|* Click on Checkbox : Anonymous user
-|*
-|************************************************************************/
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, weld::Button&, void)
-{
- // disable login-editfields if checked
- if ( m_xCbAnonymous->get_active() )
- {
- if ( m_xEdLogin->get_text().toAsciiLowerCase().startsWith( sAnonymous ) )
- {
- maStrOldUser.clear();
- maStrOldPassword.clear();
- }
- else
- {
- maStrOldUser = m_xEdLogin->get_text();
- maStrOldPassword = m_xEdPassword->get_text();
- }
-
- setAnonymousFTPUser();
- }
- else
- setFTPUser(maStrOldUser, maStrOldPassword);
-}
-
-/*************************************************************************
-|*
|* Combobox Target lost the focus
|*
|************************************************************************/
@@ -359,7 +216,7 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl, weld::Widget&,
void SvxHyperlinkInternetTp::RefreshMarkWindow()
{
- if (m_xRbtLinktypInternet->get_active() && IsMarkWndVisible())
+ if (IsMarkWndVisible())
{
weld::WaitObject aWait(mpDialog->getDialog());
OUString aStrURL( CreateAbsoluteURL() );
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index 521af033b422..2d25bed91747 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -37,7 +37,6 @@ SvxHyperlinkMailTp::SvxHyperlinkMailTp(weld::Container* pParent, SvxHpLinkDlg* p
: SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinkmailpage.ui", "HyperlinkMailPage", pItemSet)
, m_xCbbReceiver(new SvxHyperURLBox(xBuilder->weld_combo_box("receiver")))
, m_xBtAdrBook(xBuilder->weld_button("addressbook"))
- , m_xFtSubject(xBuilder->weld_label("subject_label"))
, m_xEdSubject(xBuilder->weld_entry("subject"))
{
m_xCbbReceiver->SetSmartProtocol(INetProtocol::Mailto);
@@ -109,7 +108,7 @@ void SvxHyperlinkMailTp::FillDlgFields(const OUString& rStrURL)
|* retrieve and prepare data from dialog-fields
|*
|************************************************************************/
-void SvxHyperlinkMailTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+void SvxHyperlinkMailTp::GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
{
@@ -120,13 +119,7 @@ void SvxHyperlinkMailTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrNa
OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const
{
OUString aStrURL = m_xCbbReceiver->get_active_text();
- INetURLObject aURL(aStrURL);
-
- if( aURL.GetProtocol() == INetProtocol::NotValid )
- {
- aURL.SetSmartProtocol( INetProtocol::Mailto );
- aURL.SetSmartURL(aStrURL);
- }
+ INetURLObject aURL(aStrURL, INetProtocol::Mailto);
// subject for EMail-url
if( aURL.GetProtocol() == INetProtocol::Mailto )
@@ -216,8 +209,7 @@ IMPL_LINK_NOARG(SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, weld::ComboBox&, v
|************************************************************************/
IMPL_STATIC_LINK_NOARG(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, weld::Button&, void)
{
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if( pViewFrame )
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
{
SfxItemPool &rPool = pViewFrame->GetPool();
SfxRequest aReq(SID_VIEW_DATA_SOURCE_BROWSER, SfxCallMode::SLOT, rPool);
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index cdc1039cab18..cf90450450ad 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -18,6 +18,8 @@
*/
#include <dialmgr.hxx>
+#include <o3tl/any.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <unotools/viewoptions.hxx>
#include <vcl/graph.hxx>
@@ -39,6 +41,8 @@
#include <hltpbase.hxx>
#include <hlmarkwn_def.hxx>
+#include <stack>
+
using namespace ::com::sun::star;
namespace {
@@ -75,25 +79,33 @@ SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd(weld::Window* pParentDialog, SvxHyperlink
mxBtApply->connect_clicked( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) );
mxBtClose->connect_clicked( LINK ( this, SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl ) );
mxLbTree->connect_row_activated( LINK ( this, SvxHlinkDlgMarkWnd, DoubleClickApplyHdl_Impl ) );
+
+ // tdf#149935 - remember last used position and size
+ SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id());
+ if (aDlgOpt.Exists())
+ m_xDialog->set_window_state(aDlgOpt.GetWindowState());
}
SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd()
{
ClearTree();
+ // tdf#149935 - remember last used position and size
+ SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id());
+ aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::PosSize));
}
void SvxHlinkDlgMarkWnd::ErrorChanged()
{
if (mnError == LERR_NOENTRIES)
{
- OUString aStrMessage = CuiResId( RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES );
+ OUString aStrMessage = CuiResId( RID_CUISTR_HYPDLG_ERR_LERR_NOENTRIES );
mxError->set_label(aStrMessage);
mxError->show();
mxLbTree->hide();
}
else if (mnError == LERR_DOCNOTOPEN)
{
- OUString aStrMessage = CuiResId( RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN );
+ OUString aStrMessage = CuiResId( RID_CUISTR_HYPDLG_ERR_LERR_DOCNOTOPEN );
mxError->set_label(aStrMessage);
mxError->show();
mxLbTree->hide();
@@ -122,7 +134,12 @@ sal_uInt16 SvxHlinkDlgMarkWnd::SetError( sal_uInt16 nError)
// Move window
void SvxHlinkDlgMarkWnd::MoveTo(const Point& rNewPos)
{
- m_xDialog->window_move(rNewPos.X(), rNewPos.Y());
+ // tdf#149935 - remember last used position and size
+ SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id());
+ if (aDlgOpt.Exists())
+ m_xDialog->set_window_state(aDlgOpt.GetWindowState());
+ else
+ m_xDialog->window_move(rNewPos.X(), rNewPos.Y());
}
namespace
@@ -155,9 +172,9 @@ namespace
}
}
-#define TG_SETTING_MANAGER "TargetInDocument"
-#define TG_SETTING_LASTMARK "LastSelectedMark"
-#define TG_SETTING_LASTPATH "LastSelectedPath"
+constexpr OUString TG_SETTING_MANAGER = u"TargetInDocument"_ustr;
+constexpr OUString TG_SETTING_LASTMARK = u"LastSelectedMark"_ustr;
+constexpr OUString TG_SETTING_LASTPATH = u"LastSelectedPath"_ustr;
void SvxHlinkDlgMarkWnd::RestoreLastSelection()
{
@@ -236,9 +253,7 @@ bool SvxHlinkDlgMarkWnd::RefreshFromDoc(const OUString& aURL)
{
try
{
- uno::Sequence< beans::PropertyValue > aArg(1);
- aArg.getArray()[0].Name = "Hidden";
- aArg.getArray()[0].Value <<= true;
+ uno::Sequence< beans::PropertyValue > aArg { comphelper::makePropertyValue("Hidden", true) };
xComp = xDesktop->loadComponentFromURL( aURL, "_blank", 0, aArg );
}
catch( const io::IOException& )
@@ -291,9 +306,9 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
const sal_Int32 nLinks = aNames.getLength();
const OUString* pNames = aNames.getConstArray();
- const OUString aProp_LinkDisplayName( "LinkDisplayName" );
- const OUString aProp_LinkTarget( "com.sun.star.document.LinkTarget" );
- const OUString aProp_LinkDisplayBitmap( "LinkDisplayBitmap" );
+ static constexpr OUStringLiteral aProp_LinkDisplayName( u"LinkDisplayName" );
+ static constexpr OUStringLiteral aProp_LinkTarget( u"com.sun.star.document.LinkTarget" );
+ static constexpr OUStringLiteral aProp_LinkDisplayBitmap( u"LinkDisplayBitmap" );
for( sal_Int32 i = 0; i < nLinks; i++ )
{
uno::Any aAny;
@@ -331,7 +346,7 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
// create userdata
TargetData *pData = new TargetData ( aLink, bIsTarget );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ OUString sId(weld::toId(pData));
std::unique_ptr<weld::TreeIter> xEntry(mxLbTree->make_iterator());
if (pParentEntry)
@@ -350,8 +365,7 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
// get the headings outline level
aAny = xTarget->getPropertyValue("OutlineLevel");
- sal_Int32 nOutlineLevel;
- aAny >>= nOutlineLevel;
+ sal_Int32 nOutlineLevel = *o3tl::doAccess<sal_Int32>(aAny);
// pop until the top of stack entry has an outline level less than
// the to be inserted heading outline level
@@ -365,7 +379,7 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
// push if the inserted entry is a child
if (nOutlineLevel > aHeadingsParentEntryStack.top().second)
aHeadingsParentEntryStack.push(
- std::pair(std::move(xEntry), nOutlineLevel));
+ std::pair(mxLbTree->make_iterator(xEntry.get()), nOutlineLevel));
}
else
{
@@ -418,7 +432,7 @@ void SvxHlinkDlgMarkWnd::ClearTree()
while (bEntry)
{
- TargetData* pUserData = reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+ TargetData* pUserData = weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
delete pUserData;
bEntry = mxLbTree->iter_next(*xEntry);
@@ -436,7 +450,7 @@ std::unique_ptr<weld::TreeIter> SvxHlinkDlgMarkWnd::FindEntry (std::u16string_vi
while (bEntry && !bFound)
{
- TargetData* pUserData = reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+ TargetData* pUserData = weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
if (aStrName == pUserData->aUStrLinkname)
bFound = true;
else
@@ -455,8 +469,7 @@ bool SvxHlinkDlgMarkWnd::SelectEntry(std::u16string_view aStrMark)
std::unique_ptr<weld::TreeIter> xEntry = FindEntry(aStrMark);
if (!xEntry)
return false;
- mxLbTree->select(*xEntry);
- mxLbTree->scroll_to_row(*xEntry);
+ mxLbTree->set_cursor(*xEntry);
return true;
}
@@ -473,7 +486,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, weld::Button&, void)
bool bEntry = mxLbTree->get_cursor(xEntry.get());
if (bEntry)
{
- TargetData* pData = reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+ TargetData* pData = weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
if (pData->bIsTarget)
{
mpParent->SetMarkStr(pData->aUStrLinkname);
@@ -488,7 +501,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, weld::Button&, void)
bool bEntry = mxLbTree->get_cursor(xEntry.get());
if (bEntry)
{
- TargetData* pUserData = reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+ TargetData* pUserData = weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
OUString sLastSelectedMark = pUserData->aUStrLinkname;
std::deque<OUString> aLastSelectedPath;
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 5e95ed6c5e6b..7f2230e1d87a 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -37,8 +37,7 @@
#include <strings.hrc>
#include <dialmgr.hxx>
#include <bitmaps.hlst>
-
-using namespace ::ucbhelper;
+#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
namespace {
@@ -56,7 +55,7 @@ OUString CreateUiNameFromURL( const OUString& aStrURL )
{
//remove password from name
INetURLObject aTmpURL(aURLObj);
- aTmpURL.SetPass("");
+ aTmpURL.SetPass(u"");
aStrUiURL = aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous );
}
break;
@@ -105,7 +104,7 @@ sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase(weld::Container* pParent,
SvxHpLinkDlg* pDlg,
const OUString& rUIXMLDescription,
- const OString& rID,
+ const OUString& rID,
const SfxItemSet* pItemSet)
: IconChoicePage(pParent, rUIXMLDescription, rID, pItemSet)
, mxCbbFrame(xBuilder->weld_combo_box("frame"))
@@ -118,6 +117,7 @@ SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase(weld::Container* pParent,
, mbIsCloseDisabled( false )
, mpDialog( pDlg )
, mbStdControlsInit( false )
+ , maTimer("cui SvxHyperlinkTabPageBase maTimer")
{
// create bookmark-window
}
@@ -143,15 +143,15 @@ void SvxHyperlinkTabPageBase::InitStdControls ()
SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr;
if ( pFrame )
{
- std::unique_ptr<TargetList> pList(new TargetList);
- SfxFrame::GetDefaultTargetList(*pList);
- if( !pList->empty() )
+ TargetList aList;
+ SfxFrame::GetDefaultTargetList(aList);
+ if( !aList.empty() )
{
- size_t nCount = pList->size();
+ size_t nCount = aList.size();
size_t i;
for ( i = 0; i < nCount; i++ )
{
- mxCbbFrame->append_text( pList->at( i ) );
+ mxCbbFrame->append_text( aList.at( i ) );
}
}
}
@@ -239,9 +239,9 @@ void SvxHyperlinkTabPageBase::FillStandardDlgFields ( const SvxHyperlinkItem* pH
mxCbbFrame->set_active(nPos);
// Form
- OUString aStrFormText = CuiResId( RID_SVXSTR_HYPERDLG_FROM_TEXT );
+ OUString aStrFormText = CuiResId( RID_CUISTR_HYPERDLG_FROM_TEXT );
- OUString aStrFormButton = CuiResId( RID_SVXSTR_HYPERDLG_FORM_BUTTON );
+ OUString aStrFormButton = CuiResId( RID_CUISTR_HYPERDLG_FORM_BUTTON );
if( pHyperlinkItem->GetInsertMode() & HLINK_HTMLMODE )
{
@@ -291,13 +291,6 @@ void SvxHyperlinkTabPageBase::DoApply ()
// default-implementation : do nothing
}
-// Ask page whether an insert is possible
-bool SvxHyperlinkTabPageBase::AskApply ()
-{
- // default-implementation
- return true;
-}
-
// This method would be called from bookmark-window to set new mark-string
void SvxHyperlinkTabPageBase::SetMarkStr ( const OUString& /*aStrMark*/ )
{
@@ -328,8 +321,8 @@ void SvxHyperlinkTabPageBase::DisableClose(bool _bDisable)
// Click on imagebutton : Script
IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button&, void)
{
- SvxHyperlinkItem *pHyperlinkItem = const_cast<SvxHyperlinkItem*>(static_cast<const SvxHyperlinkItem *>(
- GetItemSet().GetItem (SID_HYPERLINK_GETLINK)));
+ SvxHyperlinkItem *pHyperlinkItem = const_cast<SvxHyperlinkItem*>(
+ GetItemSet().GetItem (SID_HYPERLINK_GETLINK));
if (!pHyperlinkItem || pHyperlinkItem->GetMacroEvents() == HyperDialogEvent::NONE)
return;
@@ -341,26 +334,24 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button&, voi
aItem.SetMacroTable( *pMacroTbl );
// create empty itemset for macro-dlg
- std::unique_ptr<SfxItemSet> pItemSet( new SfxItemSet(SfxGetpApp()->GetPool(),
- svl::Items<SID_ATTR_MACROITEM,
- SID_ATTR_MACROITEM>{} ) );
- pItemSet->Put ( aItem );
+ SfxItemSetFixed<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM> aItemSet( SfxGetpApp()->GetPool() );
+ aItemSet.Put ( aItem );
DisableClose( true );
- SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, *pItemSet);
+ SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, aItemSet);
// add events
SfxMacroTabPage *pMacroPage = aDlg.GetTabPage();
if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOverObject )
- pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT1),
+ pMacroPage->AddEvent( CuiResId(RID_CUISTR_HYPDLG_MACROACT1),
SvMacroItemId::OnMouseOver );
if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseClickObject )
- pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT2),
+ pMacroPage->AddEvent( CuiResId(RID_CUISTR_HYPDLG_MACROACT2),
SvMacroItemId::OnClick);
if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOutObject )
- pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT3),
+ pMacroPage->AddEvent( CuiResId(RID_CUISTR_HYPDLG_MACROACT3),
SvMacroItemId::OnMouseOut);
// execute dlg
short nRet = aDlg.run();
@@ -379,16 +370,16 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button&, voi
// Get Macro-Infos
HyperDialogEvent SvxHyperlinkTabPageBase::GetMacroEvents() const
{
- const SvxHyperlinkItem *pHyperlinkItem = static_cast<const SvxHyperlinkItem *>(
- GetItemSet().GetItem (SID_HYPERLINK_GETLINK));
+ const SvxHyperlinkItem *pHyperlinkItem =
+ GetItemSet().GetItem (SID_HYPERLINK_GETLINK);
return pHyperlinkItem ? pHyperlinkItem->GetMacroEvents() : HyperDialogEvent();
}
SvxMacroTableDtor* SvxHyperlinkTabPageBase::GetMacroTable()
{
- const SvxHyperlinkItem *pHyperlinkItem = static_cast<const SvxHyperlinkItem *>(
- GetItemSet().GetItem (SID_HYPERLINK_GETLINK));
+ const SvxHyperlinkItem *pHyperlinkItem =
+ GetItemSet().GetItem (SID_HYPERLINK_GETLINK);
return const_cast<SvxMacroTableDtor*>(pHyperlinkItem->GetMacroTable());
}
@@ -453,19 +444,52 @@ void SvxHyperlinkTabPageBase::Reset( const SfxItemSet& rItemSet)
// Set dialog-fields from create-itemset
maStrInitURL.clear();
- const SvxHyperlinkItem *pHyperlinkItem = static_cast<const SvxHyperlinkItem *>(
- rItemSet.GetItem (SID_HYPERLINK_GETLINK));
+ const SvxHyperlinkItem *pHyperlinkItem =
+ rItemSet.GetItem (SID_HYPERLINK_GETLINK);
if ( pHyperlinkItem )
{
+ // tdf#146576 - propose clipboard content when inserting a hyperlink
+ OUString aStrURL(pHyperlinkItem->GetURL());
+ // Store initial URL
+ maStrInitURL = aStrURL;
+ if (aStrURL.isEmpty())
+ {
+ if (auto xClipboard = GetSystemClipboard())
+ {
+ if (auto xTransferable = xClipboard->getContents())
+ {
+ css::datatransfer::DataFlavor aFlavor;
+ SotExchange::GetFormatDataFlavor(SotClipboardFormatId::STRING, aFlavor);
+ if (xTransferable->isDataFlavorSupported(aFlavor))
+ {
+ OUString aClipBoardContent;
+ try
+ {
+ if (xTransferable->getTransferData(aFlavor) >>= aClipBoardContent)
+ {
+ INetURLObject aURL;
+ aURL.SetSmartURL(aClipBoardContent);
+ if (!aURL.HasError())
+ aStrURL
+ = aURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous);
+ }
+ }
+ // tdf#158345: Opening Hyperlink dialog leads to crash
+ // MimeType = "text/plain;charset=utf-16"
+ catch(const css::datatransfer::UnsupportedFlavorException&)
+ {
+ }
+ }
+ }
+ }
+ }
+
// set dialog-fields
FillStandardDlgFields (pHyperlinkItem);
// set all other fields
- FillDlgFields ( pHyperlinkItem->GetURL() );
-
- // Store initial URL
- maStrInitURL = pHyperlinkItem->GetURL();
+ FillDlgFields(aStrURL);
}
}
@@ -475,7 +499,7 @@ bool SvxHyperlinkTabPageBase::FillItemSet( SfxItemSet* rOut)
OUString aStrURL, aStrName, aStrIntName, aStrFrame;
SvxLinkInsertMode eMode;
- GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode);
+ GetCurrentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode);
if ( aStrName.isEmpty() ) //automatically create a visible name if the link is created without name
aStrName = CreateUiNameFromURL(aStrURL);
@@ -494,8 +518,8 @@ void SvxHyperlinkTabPageBase::ActivatePage( const SfxItemSet& rItemSet )
{
// Set dialog-fields from input-itemset
- const SvxHyperlinkItem *pHyperlinkItem = static_cast<const SvxHyperlinkItem *>(
- rItemSet.GetItem (SID_HYPERLINK_GETLINK));
+ const SvxHyperlinkItem *pHyperlinkItem =
+ rItemSet.GetItem (SID_HYPERLINK_GETLINK);
if ( pHyperlinkItem )
{
@@ -518,7 +542,7 @@ DeactivateRC SvxHyperlinkTabPageBase::DeactivatePage( SfxItemSet* _pSet)
OUString aStrURL, aStrName, aStrIntName, aStrFrame;
SvxLinkInsertMode eMode;
- GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode);
+ GetCurrentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode);
HyperDialogEvent nEvents = GetMacroEvents();
SvxMacroTableDtor* pTable = GetMacroTable();
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index f7b6549fc042..10ad1d9bba5b 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -27,6 +27,7 @@
#include <sal/log.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <tools/debug.hxx>
+#include <utility>
#define HYPH_POS_CHAR '='
@@ -158,11 +159,11 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl()
}
// 2) remove all hyphenation positions from the start that are not considered by the core
- const OUString aSearchRange( aTxt.copy( 0, nPos1 ) );
- sal_Int32 nPos2 = aSearchRange.lastIndexOf( '-' ); // the '-' position the core will use by default
- if (nPos2 != -1 )
+ const std::u16string_view aSearchRange( aTxt.subView( 0, nPos1 ) );
+ size_t nPos2 = aSearchRange.rfind( '-' ); // the '-' position the core will use by default
+ if (nPos2 != std::u16string_view::npos && nPos2 != 0)
{
- OUString aLeft( aSearchRange.copy( 0, nPos2 ) );
+ OUString aLeft( aSearchRange.substr( 0, nPos2 ) );
nPos = 0;
while (nPos != -1)
{
@@ -170,6 +171,8 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl()
aLeft = aLeft.replaceFirst( aTmp, "", &nPos );
if (nPos != -1)
++m_nHyphenationPositionsOffset;
+ if (nPos >= aLeft.getLength()) // tdf#158837
+ break;
}
aTxt = aTxt.replaceAt( 0, nPos2, aLeft );
}
@@ -263,7 +266,7 @@ bool SvxHyphenWordDialog::SelLeft()
DBG_ASSERT(i <= aTxt.getLength(), "index out of range");
if (aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR ))
{
- aTxt = aTxt.replaceAt( i, 1, OUString( CUR_HYPH_POS_CHAR ) );
+ aTxt = aTxt.replaceAt( i, 1, rtl::OUStringChar( CUR_HYPH_POS_CHAR ) );
m_nOldPos = i;
m_xWordEdit->set_text(aTxt);
@@ -286,7 +289,7 @@ bool SvxHyphenWordDialog::SelRight()
{
if (aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR ))
{
- aTxt = aTxt.replaceAt( i, 1, OUString( CUR_HYPH_POS_CHAR ) );
+ aTxt = aTxt.replaceAt( i, 1, rtl::OUStringChar( CUR_HYPH_POS_CHAR ) );
m_nOldPos = i;
m_xWordEdit->set_text(aTxt);
@@ -402,13 +405,13 @@ IMPL_LINK_NOARG(SvxHyphenWordDialog, GetFocusHdl_Impl, weld::Widget&, void)
// class SvxHyphenWordDialog ---------------------------------------------
SvxHyphenWordDialog::SvxHyphenWordDialog(
- const OUString &rWord, LanguageType nLang,
- weld::Window* pParent,
+ OUString aWord, LanguageType nLang,
+ weld::Widget* pParent,
uno::Reference< linguistic2::XHyphenator > const &xHyphen,
SvxSpellWrapper* pWrapper)
: SfxDialogController(pParent, "cui/ui/hyphenate.ui", "HyphenateDialog")
, m_pHyphWrapper(pWrapper)
- , m_aActWord(rWord)
+ , m_aActWord(std::move(aWord))
, m_nActLanguage(nLang)
, m_nMaxHyphenationPos(0)
, m_nOldPos(0)
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index e166c7475381..9bda9d215dcf 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -18,6 +18,7 @@
*/
#include <iconcdlg.hxx>
+#include <comphelper/lok.hxx>
#include <cuihyperdlg.hxx>
#include <cassert>
@@ -31,7 +32,7 @@
\**********************************************************************/
IconChoicePage::IconChoicePage(weld::Container* pParent,
- const OUString& rUIXMLDescription, const OString& rID,
+ const OUString& rUIXMLDescription, const OUString& rID,
const SfxItemSet* pItemSet)
: xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
, xContainer(xBuilder->weld_container(rID))
@@ -70,7 +71,7 @@ bool IconChoicePage::QueryClose()
| add new page
|
\**********************************************************************/
-void SvxHpLinkDlg::AddTabPage(const OString& rId, CreatePage pCreateFunc /* != 0 */)
+void SvxHpLinkDlg::AddTabPage(const OUString& rId, CreatePage pCreateFunc /* != 0 */)
{
weld::Container* pPage = m_xIconCtrl->get_page(rId);
maPageList.emplace_back(new IconChoicePageData(rId, pCreateFunc(pPage, this, pSet)));
@@ -83,9 +84,9 @@ void SvxHpLinkDlg::AddTabPage(const OString& rId, CreatePage pCreateFunc /* != 0
| Show / Hide page or button
|
\**********************************************************************/
-void SvxHpLinkDlg::ShowPage(const OString& rId)
+void SvxHpLinkDlg::ShowPage(const OUString& rId)
{
- OString sOldPageId = GetCurPageId();
+ OUString sOldPageId = GetCurPageId();
bool bInvalidate = sOldPageId != rId;
if (bInvalidate)
{
@@ -104,7 +105,7 @@ void SvxHpLinkDlg::ShowPage(const OString& rId)
| select a page
|
\**********************************************************************/
-IMPL_LINK(SvxHpLinkDlg, ChosePageHdl_Impl, const OString&, rId, void)
+IMPL_LINK(SvxHpLinkDlg, ChosePageHdl_Impl, const OUString&, rId, void)
{
if (rId != msCurrentPageId)
{
@@ -148,7 +149,11 @@ void SvxHpLinkDlg::ActivatePageImpl()
pData->xPage->ActivatePage( *pExampleSet );
m_xDialog->set_help_id(pData->xPage->GetHelpId());
- m_xResetBtn->show();
+ // tdf#90496 - remember last used view in hyperlink dialog
+ msRememberedPageId = msCurrentPageId;
+
+ if (!comphelper::LibreOfficeKit::isActive())
+ m_xResetBtn->show();
}
void SvxHpLinkDlg::DeActivatePageImpl ()
@@ -163,7 +168,7 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
IconChoicePage * pPage = pData->xPage.get();
if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
- pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+ pExampleSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
if ( pSet )
{
@@ -187,10 +192,10 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
if ( !pExampleSet )
{
SfxItemPool* pPool = pPage->GetItemSet().GetPool();
- pExampleSet =
- new SfxItemSet( *pPool, GetInputRanges( *pPool ) );
+ pExampleSet.reset(
+ new SfxItemSet( *pPool, GetInputRanges( *pPool ) ) );
}
- nRet = pPage->DeactivatePage( pExampleSet );
+ nRet = pPage->DeactivatePage( pExampleSet.get() );
}
else
nRet = pPage->DeactivatePage( nullptr );
@@ -226,7 +231,7 @@ void SvxHpLinkDlg::ResetPageImpl ()
|
\**********************************************************************/
-const sal_uInt16* SvxHpLinkDlg::GetInputRanges( const SfxItemPool& )
+WhichRangesContainer SvxHpLinkDlg::GetInputRanges( const SfxItemPool& )
{
if ( pSet )
{
@@ -234,13 +239,10 @@ const sal_uInt16* SvxHpLinkDlg::GetInputRanges( const SfxItemPool& )
return pSet->GetRanges();
}
- if ( pRanges )
- return pRanges.get();
-
- pRanges.reset(new sal_uInt16[1]);
- pRanges[0] = 0;
+ if ( !pRanges.empty() )
+ return pRanges;
- return pRanges.get();
+ return WhichRangesContainer();
}
@@ -252,7 +254,7 @@ void SvxHpLinkDlg::SetInputSet( const SfxItemSet* pInSet )
if ( !bSet && !pExampleSet && !pOutSet )
{
- pExampleSet = new SfxItemSet( *pSet );
+ pExampleSet.reset(new SfxItemSet( *pSet ));
pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
}
}
@@ -283,7 +285,7 @@ void SvxHpLinkDlg::Start()
|
\**********************************************************************/
-IconChoicePageData* SvxHpLinkDlg::GetPageData ( std::string_view rId )
+IconChoicePageData* SvxHpLinkDlg::GetPageData ( std::u16string_view rId )
{
IconChoicePageData *pRet = nullptr;
for (const auto & pData : maPageList)
@@ -303,7 +305,7 @@ IconChoicePageData* SvxHpLinkDlg::GetPageData ( std::string_view rId )
|
\**********************************************************************/
-void SvxHpLinkDlg::SwitchPage( const OString& rId )
+void SvxHpLinkDlg::SwitchPage( const OUString& rId )
{
m_xIconCtrl->set_current_page(rId);
}
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index d22837c7b4eb..e4c1c6687768 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -27,7 +27,9 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <insdlg.hxx>
#include <dialmgr.hxx>
@@ -39,7 +41,8 @@
#include <tools/urlobj.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <utility>
#include <vcl/image.hxx>
#include <vcl/weld.hxx>
#include <vcl/svapp.hxx>
@@ -48,13 +51,13 @@
#include <sfx2/frmdescr.hxx>
#include <sfx2/viewsh.hxx>
#include <comphelper/seqstream.hxx>
+#include <sfx2/viewfrm.hxx>
#include <strings.hrc>
using namespace ::com::sun::star;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::ui::dialogs;
bool InsertObjectDialog_Impl::IsCreateNew() const
@@ -68,10 +71,10 @@ uno::Reference< io::XInputStream > InsertObjectDialog_Impl::GetIconIfIconified(
}
InsertObjectDialog_Impl::InsertObjectDialog_Impl(weld::Window* pParent,
- const OUString& rUIXMLDescription, const OString& rID,
- const css::uno::Reference < css::embed::XStorage >& xStorage)
+ const OUString& rUIXMLDescription, const OUString& rID,
+ css::uno::Reference < css::embed::XStorage > xStorage)
: GenericDialogController(pParent, rUIXMLDescription, rID)
- , m_xStorage( xStorage )
+ , m_xStorage(std::move( xStorage ))
, aCnt( m_xStorage )
{
}
@@ -85,12 +88,13 @@ IMPL_LINK_NOARG(SvInsertOleDlg, DoubleClickHdl, weld::TreeView&, bool)
IMPL_LINK_NOARG(SvInsertOleDlg, BrowseHdl, weld::Button&, void)
{
sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
+ aHelper.SetContext(sfx2::FileDialogHelper::InsertOLE);
const Reference< XFilePicker3 >& xFilePicker = aHelper.GetFilePicker();
// add filter
try
{
- xFilePicker->appendFilter(CuiResId(RID_SVXSTR_FILTER_ALL), "*.*");
+ xFilePicker->appendFilter(CuiResId(RID_CUISTR_FILTER_ALL), "*.*");
}
catch( const IllegalArgumentException& )
{
@@ -105,8 +109,11 @@ IMPL_LINK_NOARG(SvInsertOleDlg, BrowseHdl, weld::Button&, void)
}
}
-IMPL_LINK_NOARG(SvInsertOleDlg, RadioHdl, weld::Button&, void)
+IMPL_LINK(SvInsertOleDlg, RadioHdl, weld::Toggleable&, rButton, void)
{
+ if (!rButton.get_active())
+ return;
+
if (m_xRbNewObject->get_active())
{
m_xObjectTypeFrame->show();
@@ -137,9 +144,9 @@ SvInsertOleDlg::SvInsertOleDlg(weld::Window* pParent, const Reference<embed::XSt
m_xLbObjecttype->get_height_rows(6));
m_xLbObjecttype->connect_row_activated(LINK(this, SvInsertOleDlg, DoubleClickHdl));
m_xBtnFilepath->connect_clicked(LINK( this, SvInsertOleDlg, BrowseHdl));
- Link<weld::Button&,void> aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
- m_xRbNewObject->connect_clicked( aLink );
- m_xRbObjectFromfile->connect_clicked( aLink );
+ Link<weld::Toggleable&,void> aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
+ m_xRbNewObject->connect_toggled( aLink );
+ m_xRbObjectFromfile->connect_toggled( aLink );
m_xRbNewObject->set_active(true);
}
@@ -185,10 +192,31 @@ short SvInsertOleDlg::run()
if ( xDialogCreator.is() )
{
aName = aCnt.CreateUniqueObjectName();
+
+ uno::Reference<task::XStatusIndicator> xProgress;
+ OUString aProgressText;
+ if (SfxViewFrame* pFrame = SfxViewFrame::Current())
+ {
+ // Have a current frame, create a matching progressbar, but don't start it yet.
+ uno::Reference<frame::XFrame> xFrame
+ = pFrame->GetFrame().GetFrameInterface();
+ uno::Reference<task::XStatusIndicatorFactory> xProgressFactory(
+ xFrame, uno::UNO_QUERY);
+ if (xProgressFactory.is())
+ {
+ xProgress = xProgressFactory->createStatusIndicator();
+ if (xProgress)
+ {
+ aProgressText = CuiResId(RID_CUISTR_OLE_INSERT);
+ }
+ }
+ }
+
const embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog(
m_xStorage,
aName,
- uno::Sequence < beans::PropertyValue >() );
+ {comphelper::makePropertyValue("StatusIndicator", xProgress),
+ comphelper::makePropertyValue("StatusIndicatorText", aProgressText)} );
OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" );
m_xObj = aNewInf.Object;
@@ -259,23 +287,44 @@ short SvInsertOleDlg::run()
if ( !aFileName.isEmpty() )
{
- // create MediaDescriptor for file to create object from
- uno::Sequence < beans::PropertyValue > aMedium( 2 );
- aMedium[0].Name = "URL";
- aMedium[0].Value <<= aFileName;
-
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
uno::Reference< task::XInteractionHandler2 > xInteraction(
task::InteractionHandler::createWithParent(xContext, nullptr) );
- aMedium[1].Name = "InteractionHandler";
- aMedium[1].Value <<= xInteraction;
+ // create MediaDescriptor for file to create object from
+ uno::Sequence < beans::PropertyValue > aMedium{
+ comphelper::makePropertyValue("URL", aFileName),
+ comphelper::makePropertyValue("InteractionHandler", xInteraction)
+ };
// create object from media descriptor
+
+ uno::Reference<task::XStatusIndicator> xProgress;
+ if (SfxViewFrame* pFrame = SfxViewFrame::Current())
+ {
+ // Have a current frame, create visual indication that insert is in progress.
+ uno::Reference<frame::XFrame> xFrame = pFrame->GetFrame().GetFrameInterface();
+ uno::Reference<task::XStatusIndicatorFactory> xProgressFactory(xFrame, uno::UNO_QUERY);
+ if (xProgressFactory.is())
+ {
+ xProgress = xProgressFactory->createStatusIndicator();
+ if (xProgress)
+ {
+ OUString aOleInsert(CuiResId(RID_CUISTR_OLE_INSERT));
+ xProgress->start(aOleInsert, 100);
+ }
+ }
+ }
+
if ( bLink )
m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName );
else
m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
+
+ if (xProgress.is())
+ {
+ xProgress->end();
+ }
}
if ( !m_xObj.is() )
@@ -358,9 +407,9 @@ void SfxInsertFloatingFrameDialog::Init()
m_xNMMarginHeight = m_xBuilder->weld_spin_button("height");
m_xCBMarginHeightDefault = m_xBuilder->weld_check_button("defaultheight");
- Link<weld::Button&, void> aLink(LINK(this, SfxInsertFloatingFrameDialog, CheckHdl));
- m_xCBMarginWidthDefault->connect_clicked(aLink);
- m_xCBMarginHeightDefault->connect_clicked(aLink);
+ Link<weld::Toggleable&, void> aLink(LINK(this, SfxInsertFloatingFrameDialog, CheckHdl));
+ m_xCBMarginWidthDefault->connect_toggled(aLink);
+ m_xCBMarginHeightDefault->connect_toggled(aLink);
m_xCBMarginWidthDefault->set_active(true);
m_xCBMarginHeightDefault->set_active(true);
@@ -545,7 +594,7 @@ short SfxInsertFloatingFrameDialog::run()
return nRet;
}
-IMPL_LINK(SfxInsertFloatingFrameDialog, CheckHdl, weld::Button&, rButton, void)
+IMPL_LINK(SfxInsertFloatingFrameDialog, CheckHdl, weld::Toggleable&, rButton, void)
{
weld::CheckButton& rCB = dynamic_cast<weld::CheckButton&>(rButton);
if (&rCB == m_xCBMarginWidthDefault.get())
@@ -573,7 +622,7 @@ IMPL_LINK_NOARG( SfxInsertFloatingFrameDialog, OpenHdl, weld::Button&, void)
SfxFilterFlags::NONE, SfxFilterFlags::NONE, m_xDialog.get());
// set the title
- aFileDlg.SetTitle(CuiResId(RID_SVXSTR_SELECT_FILE_IFRAME));
+ aFileDlg.SetTitle(CuiResId(RID_CUISTR_SELECT_FILE_IFRAME));
// show the dialog
if ( aFileDlg.Execute() == ERRCODE_NONE )
diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx
index 862963275df8..6c09c8ce4560 100644
--- a/cui/source/dialogs/insrc.cxx
+++ b/cui/source/dialogs/insrc.cxx
@@ -31,29 +31,44 @@ sal_uInt16 SvxInsRowColDlg::getInsertCount() const
return m_xCountEdit->get_value();
}
-SvxInsRowColDlg::SvxInsRowColDlg(weld::Window* pParent, bool bColumn, const OString& rHelpId)
+SvxInsRowColDlg::SvxInsRowColDlg(weld::Window* pParent, bool bColumn, const OUString& rHelpId)
: GenericDialogController(pParent, "cui/ui/insertrowcolumn.ui", "InsertRowColumnDialog")
, m_xCountEdit(m_xBuilder->weld_spin_button("insert_number"))
, m_xBeforeBtn(m_xBuilder->weld_radio_button("insert_before"))
, m_xAfterBtn(m_xBuilder->weld_radio_button("insert_after"))
{
- m_xDialog->set_title(bColumn ? CuiResId(RID_SVXSTR_COL) : CuiResId(RID_SVXSTR_ROW));
+ m_xDialog->set_title(bColumn ? CuiResId(RID_CUISTR_COL) : CuiResId(RID_CUISTR_ROW));
// tdf#119293
if (bColumn) {
- m_xBeforeBtn->set_label(CuiResId(RID_SVXSTR_INSERTCOL_BEFORE));
- m_xAfterBtn->set_label(CuiResId(RID_SVXSTR_INSERTCOL_AFTER));
+ m_xBeforeBtn->set_label(CuiResId(RID_CUISTR_INSERTCOL_BEFORE));
+ m_xAfterBtn->set_label(CuiResId(RID_CUISTR_INSERTCOL_AFTER));
} else {
- m_xBeforeBtn->set_label(CuiResId(RID_SVXSTR_INSERTROW_BEFORE));
- m_xAfterBtn->set_label(CuiResId(RID_SVXSTR_INSERTROW_AFTER));
+ m_xBeforeBtn->set_label(CuiResId(RID_CUISTR_INSERTROW_BEFORE));
+ m_xAfterBtn->set_label(CuiResId(RID_CUISTR_INSERTROW_AFTER));
}
m_xDialog->set_help_id(rHelpId);
}
-short SvxInsRowColDlg::Execute()
+short SvxAbstractInsRowColDlg_Impl::Execute()
{
- return run();
+ return m_xDlg->run();
+}
+
+bool SvxAbstractInsRowColDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+ return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
+bool SvxAbstractInsRowColDlg_Impl::isInsertBefore() const
+{
+ return m_xDlg->isInsertBefore();
+}
+
+sal_uInt16 SvxAbstractInsRowColDlg_Impl::getInsertCount() const
+{
+ return m_xDlg->getInsertCount();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 764d29e0c191..b31c5d74a783 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -18,24 +18,26 @@
*/
#include <linkdlg.hxx>
+#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <vcl/idle.hxx>
#include <vcl/timer.hxx>
#include <vcl/weld.hxx>
-#include <vcl/window.hxx>
+#include <vcl/weldutils.hxx>
#include <strings.hrc>
+#include <sfx2/filedlghelper.hxx>
#include <sfx2/linkmgr.hxx>
#include <sfx2/linksrc.hxx>
#include <sfx2/lnkbase.hxx>
#include <sfx2/objsh.hxx>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <comphelper/processfactory.hxx>
#include <dialmgr.hxx>
@@ -95,17 +97,18 @@ SvBaseLinksDlg::SvBaseLinksDlg(weld::Window * pParent, LinkManager* pMgr, bool b
, m_xVirDev(VclPtr<VirtualDevice>::Create())
{
// expand the point size of the desired font to the equivalent pixel size
- if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice()))
- pDefaultDevice->SetPointFont(*m_xVirDev, m_xTbLinks->get_font());
+ weld::SetPointFont(*m_xVirDev, m_xTbLinks->get_font());
m_xTbLinks->set_size_request(m_xTbLinks->get_approximate_digit_width() * 90,
m_xTbLinks->get_height_rows(12));
m_xTbLinks->set_selection_mode(SelectionMode::Multiple);
- std::vector<int> aWidths;
- aWidths.push_back(m_xTbLinks->get_approximate_digit_width() * 30);
- aWidths.push_back(m_xTbLinks->get_approximate_digit_width() * 20);
- aWidths.push_back(m_xTbLinks->get_approximate_digit_width() * 20);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xTbLinks->get_approximate_digit_width() * 30),
+ o3tl::narrowing<int>(m_xTbLinks->get_approximate_digit_width() * 20),
+ o3tl::narrowing<int>(m_xTbLinks->get_approximate_digit_width() * 20)
+ };
m_xTbLinks->set_column_fixed_widths(aWidths);
// UpdateTimer for DDE-/Grf-links, which are waited for
@@ -114,8 +117,8 @@ SvBaseLinksDlg::SvBaseLinksDlg(weld::Window * pParent, LinkManager* pMgr, bool b
m_xTbLinks->connect_changed( LINK( this, SvBaseLinksDlg, LinksSelectHdl ) );
m_xTbLinks->connect_row_activated( LINK( this, SvBaseLinksDlg, LinksDoubleClickHdl ) );
- m_xRbAutomatic->connect_clicked( LINK( this, SvBaseLinksDlg, AutomaticClickHdl ) );
- m_xRbManual->connect_clicked( LINK( this, SvBaseLinksDlg, ManualClickHdl ) );
+ m_xRbAutomatic->connect_toggled( LINK( this, SvBaseLinksDlg, ToggleHdl ) );
+ m_xRbManual->connect_toggled( LINK( this, SvBaseLinksDlg, ToggleHdl ) );
m_xPbUpdateNow->connect_clicked( LINK( this, SvBaseLinksDlg, UpdateNowClickHdl ) );
m_xPbChangeSource->connect_clicked( LINK( this, SvBaseLinksDlg, ChangeSourceClickHdl ) );
if(!bHtmlMode)
@@ -146,7 +149,7 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* pSvTabListBox)
{
// possibly deselect old entries in case of multi-selection
int nSelEntry = pSvTabListBox->get_selected_index();
- SvBaseLink* pLink = reinterpret_cast<SvBaseLink*>(pSvTabListBox->get_id(nSelEntry).toInt64());
+ SvBaseLink* pLink = weld::fromId<SvBaseLink*>(pSvTabListBox->get_id(nSelEntry));
SvBaseLinkObjectType nObjectType = pLink->GetObjType();
if(!isClientFileType(nObjectType))
{
@@ -158,7 +161,7 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* pSvTabListBox)
std::vector<int> aRows = pSvTabListBox->get_selected_rows();
for (auto nEntry : aRows)
{
- pLink = reinterpret_cast<SvBaseLink*>(pSvTabListBox->get_id(nEntry).toInt64());
+ pLink = weld::fromId<SvBaseLink*>(pSvTabListBox->get_id(nEntry));
DBG_ASSERT(pLink, "Where is the Link?");
if (!pLink)
continue;
@@ -222,22 +225,26 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, LinksDoubleClickHdl, weld::TreeView&, bool )
return true;
}
-IMPL_LINK_NOARG( SvBaseLinksDlg, AutomaticClickHdl, weld::Button&, void )
+IMPL_LINK(SvBaseLinksDlg, ToggleHdl, weld::Toggleable&, rButton, void)
{
- int nPos;
- SvBaseLink* pLink = GetSelEntry( &nPos );
- if( pLink && !isClientFileType( pLink->GetObjType() ) &&
- SfxLinkUpdateMode::ALWAYS != pLink->GetUpdateMode() )
- SetType( *pLink, nPos, SfxLinkUpdateMode::ALWAYS );
-}
+ if (!rButton.get_active())
+ return;
-IMPL_LINK_NOARG( SvBaseLinksDlg, ManualClickHdl, weld::Button&, void )
-{
int nPos;
SvBaseLink* pLink = GetSelEntry( &nPos );
- if( pLink && !isClientFileType( pLink->GetObjType() ) &&
- SfxLinkUpdateMode::ONCALL != pLink->GetUpdateMode())
- SetType( *pLink, nPos, SfxLinkUpdateMode::ONCALL );
+
+ if (m_xRbAutomatic->get_active())
+ {
+ if( pLink && !isClientFileType( pLink->GetObjType() ) &&
+ SfxLinkUpdateMode::ALWAYS != pLink->GetUpdateMode() )
+ SetType( *pLink, nPos, SfxLinkUpdateMode::ALWAYS );
+ }
+ else
+ {
+ if( pLink && !isClientFileType( pLink->GetObjType() ) &&
+ SfxLinkUpdateMode::ONCALL != pLink->GetUpdateMode())
+ SetType( *pLink, nPos, SfxLinkUpdateMode::ONCALL );
+ }
}
IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, weld::Button&, void)
@@ -248,7 +255,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, weld::Button&, void)
std::vector<int> aRows = m_xTbLinks->get_selected_rows();
for (int nFndPos : aRows)
{
- aLnkArr.push_back( reinterpret_cast<SvBaseLink*>( m_xTbLinks->get_id(nFndPos).toInt64() ) );
+ aLnkArr.push_back( weld::fromId<SvBaseLink*>( m_xTbLinks->get_id(nFndPos) ) );
aPosArr.push_back( nFndPos );
}
@@ -274,7 +281,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, weld::Button&, void)
SetManager( pNewMgr );
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(aLnkArr[0]));
+ OUString sId = weld::toId(aLnkArr[0]);
int nE = m_xTbLinks->find_id(sId);
if (nE == -1)
nE = m_xTbLinks->get_selected_index();
@@ -294,11 +301,12 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, weld::Button&, void)
{
try
{
- uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(comphelper::getProcessComponentContext());
+ uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = sfx2::createFolderPicker(
+ comphelper::getProcessComponentContext(), m_xDialog.get());
OUString sType, sFile, sLinkName;
OUString sFilter;
- SvBaseLink* pLink = reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(aRows[0]).toInt64());
+ SvBaseLink* pLink = weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(aRows[0]));
sfx2::LinkManager::GetDisplayNames( pLink, &sType, &sFile );
INetURLObject aUrl(sFile);
if(aUrl.GetProtocol() == INetProtocol::File)
@@ -314,7 +322,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, weld::Button&, void)
for (auto nRow : aRows)
{
- pLink = reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nRow).toInt64());
+ pLink = weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nRow));
DBG_ASSERT(pLink,"Where is the link?");
if (!pLink)
continue;
@@ -401,7 +409,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, weld::Button&, void )
SvBaseLinkMemberList aLinkList;
for (auto nRow : aRows)
{
- SvBaseLink* pLink = reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nRow).toInt64());
+ SvBaseLink* pLink = weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nRow));
if (pLink)
aLinkList.push_back(pLink);
}
@@ -444,7 +452,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, UpdateWaitingHdl, Timer*, void )
m_xTbLinks->freeze();
for (int nPos = m_xTbLinks->n_children(); nPos; --nPos)
{
- tools::SvRef<SvBaseLink> xLink( reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nPos).toInt64()) );
+ tools::SvRef<SvBaseLink> xLink( weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nPos)) );
if( xLink.is() )
{
OUString sCur( ImplGetStateStr( *xLink ) ),
@@ -575,7 +583,7 @@ void SvBaseLinksDlg::InsertEntry(const SvBaseLink& rLink, int nPos, bool bSelect
nPos = m_xTbLinks->n_children();
m_xTbLinks->insert(nPos);
m_xTbLinks->set_text(nPos, aTxt, 0);
- m_xTbLinks->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(&rLink)));
+ m_xTbLinks->set_id(nPos, weld::toId(&rLink));
if( SvBaseLinkObjectType::ClientGraphic == rLink.GetObjType() )
m_xTbLinks->set_text(nPos, sFilter, 1);
else
@@ -593,7 +601,7 @@ SvBaseLink* SvBaseLinksDlg::GetSelEntry(int* pPos)
{
if (pPos)
*pPos = nPos;
- return reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nPos).toInt64());
+ return weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nPos));
}
return nullptr;
}
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 249a116b1d5e..e385a6ccface 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <osl/file.hxx>
+#include <sfx2/filedlghelper.hxx>
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -29,12 +30,12 @@
#include <strings.hrc>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <unotools/pathoptions.hxx>
+#include <o3tl/string_view.hxx>
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
@@ -87,7 +88,7 @@ void SvxMultiPathDialog::AppendEntry(const OUString& rText, const OUString& rId)
IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void)
{
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
+ Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get());
if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
return;
@@ -117,7 +118,7 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void)
IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void)
{
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
+ Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get());
if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
return;
@@ -261,16 +262,16 @@ OUString SvxPathSelectDialog::GetPath() const
return sNewPath.makeStringAndClear();
}
-void SvxMultiPathDialog::SetPath( const OUString& rPath )
+void SvxMultiPathDialog::SetPath( std::u16string_view rPath )
{
- if ( !rPath.isEmpty() )
+ if ( !rPath.empty() )
{
const sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER;
int nCount = 0;
sal_Int32 nIndex = 0;
do
{
- const OUString sPath = rPath.getToken( 0, cDelim, nIndex );
+ const OUString sPath( o3tl::getToken(rPath, 0, cDelim, nIndex ) );
OUString sSystemPath;
bool bIsSystemPath =
osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
@@ -291,14 +292,14 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath )
SelectHdl_Impl(*m_xRadioLB);
}
-void SvxPathSelectDialog::SetPath(const OUString& rPath)
+void SvxPathSelectDialog::SetPath(std::u16string_view rPath)
{
- if ( !rPath.isEmpty() )
+ if ( !rPath.empty() )
{
sal_Int32 nIndex = 0;
do
{
- const OUString sPath = rPath.getToken( 0, SVT_SEARCHPATH_DELIMITER, nIndex );
+ const OUString sPath( o3tl::getToken(rPath, 0, SVT_SEARCHPATH_DELIMITER, nIndex ) );
OUString sSystemPath;
bool bIsSystemPath =
osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index 9c06e961498e..a7e95a29f3b4 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -17,50 +17,72 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sfx2/objsh.hxx>
+#include <svl/PasswordHelper.hxx>
#include <vcl/svapp.hxx>
+#include <officecfg/Office/Common.hxx>
#include <passwdomdlg.hxx>
#include <strings.hrc>
#include <dialmgr.hxx>
IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button&, void)
{
- bool bInvalidState = !m_xOpenReadonlyCB->get_active() &&
+ bool bInvalidState = !m_xOpenReadonlyCB->get_active() && !m_bAllowEmpty &&
m_xPasswdToOpenED->get_text().isEmpty() &&
m_xPasswdToModifyED->get_text().isEmpty();
if (bInvalidState)
{
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
+ m_xErrorBox.reset(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok,
m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2));
- xErrorBox->run();
+ m_xErrorBox->runAsync(m_xErrorBox, [](sal_Int32 /*nResult*/) {});
}
- else // check for mismatched passwords...
+ else // check for mismatched passwords and password policy
{
+ if (m_oPasswordPolicy)
+ {
+ if (!SvPasswordHelper::PasswordMeetsPolicy(m_xPasswdToOpenED->get_text(),
+ m_oPasswordPolicy))
+ {
+ m_xPasswdToOpenED->grab_focus();
+ return;
+ }
+
+ if (m_xOpenReadonlyCB->get_active()
+ && !SvPasswordHelper::PasswordMeetsPolicy(m_xPasswdToModifyED->get_text(),
+ m_oPasswordPolicy))
+ {
+ m_xPasswdToModifyED->grab_focus();
+ return;
+ }
+ }
+
const bool bToOpenMatch = m_xPasswdToOpenED->get_text() == m_xReenterPasswdToOpenED->get_text();
const bool bToModifyMatch = m_xPasswdToModifyED->get_text() == m_xReenterPasswdToModifyED->get_text();
const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
if (nMismatch > 0)
{
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
+ m_xErrorBox.reset(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok,
nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch));
- xErrorBox->run();
-
- weld::Entry* pEdit = !bToOpenMatch ? m_xPasswdToOpenED.get() : m_xPasswdToModifyED.get();
- weld::Entry* pRepeatEdit = !bToOpenMatch? m_xReenterPasswdToOpenED.get() : m_xReenterPasswdToModifyED.get();
- if (nMismatch == 1)
- {
- pEdit->set_text( "" );
- pRepeatEdit->set_text( "" );
- }
- else if (nMismatch == 2)
+ m_xErrorBox->runAsync(m_xErrorBox, [this, bToOpenMatch, nMismatch](sal_Int32 /*nResult*/)
{
- m_xPasswdToOpenED->set_text( "" );
- m_xReenterPasswdToOpenED->set_text( "" );
- m_xPasswdToModifyED->set_text( "" );
- m_xReenterPasswdToModifyED->set_text( "" );
- }
- pEdit->grab_focus();
+ weld::Entry* pEdit = !bToOpenMatch ? m_xPasswdToOpenED.get() : m_xPasswdToModifyED.get();
+ weld::Entry* pRepeatEdit = !bToOpenMatch? m_xReenterPasswdToOpenED.get() : m_xReenterPasswdToModifyED.get();
+ if (nMismatch == 1)
+ {
+ pEdit->set_text( "" );
+ pRepeatEdit->set_text( "" );
+ }
+ else if (nMismatch == 2)
+ {
+ m_xPasswdToOpenED->set_text( "" );
+ m_xReenterPasswdToOpenED->set_text( "" );
+ m_xPasswdToModifyED->set_text( "" );
+ m_xReenterPasswdToModifyED->set_text( "" );
+ }
+ pEdit->grab_focus();
+ });
}
else
{
@@ -71,24 +93,57 @@ IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button&, void)
IMPL_LINK(PasswordToOpenModifyDialog, ChangeHdl, weld::Entry&, rEntry, void)
{
+ auto aPasswordText = rEntry.get_text();
+
weld::Label* pIndicator = nullptr;
- int nLength = rEntry.get_text().getLength();
+ weld::LevelBar* pLevelBar = nullptr;
if (&rEntry == m_xPasswdToOpenED.get())
+ {
pIndicator = m_xPasswdToOpenInd.get();
+ pLevelBar = m_xPasswdToOpenBar.get();
+ }
else if (&rEntry == m_xReenterPasswdToOpenED.get())
+ {
pIndicator = m_xReenterPasswdToOpenInd.get();
+ }
else if (&rEntry == m_xPasswdToModifyED.get())
+ {
pIndicator = m_xPasswdToModifyInd.get();
+ pLevelBar = m_xPasswdToModifyBar.get();
+ }
else if (&rEntry == m_xReenterPasswdToModifyED.get())
+ {
pIndicator = m_xReenterPasswdToModifyInd.get();
+ }
assert(pIndicator);
- pIndicator->set_visible(nLength >= m_nMaxPasswdLen);
+
+ bool bPasswordMeetsPolicy
+ = SvPasswordHelper::PasswordMeetsPolicy(aPasswordText, m_oPasswordPolicy);
+ if (pLevelBar)
+ {
+ rEntry.set_message_type(bPasswordMeetsPolicy ? weld::EntryMessageType::Normal
+ : weld::EntryMessageType::Error);
+ pIndicator->set_visible(!bPasswordMeetsPolicy);
+ }
+
+ // if password doesn't meet policy cap the percentage at 70%
+ if (pLevelBar)
+ pLevelBar->set_percentage(
+ std::min(SvPasswordHelper::GetPasswordStrengthPercentage(aPasswordText),
+ bPasswordMeetsPolicy ? std::numeric_limits<double>::max() : 70.0));
+
+ if (m_nMaxPasswdLen)
+ {
+ int nLength = aPasswordText.getLength();
+ pIndicator->set_visible(nLength >= m_nMaxPasswdLen);
+ }
}
PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify)
: SfxDialogController(pParent, "cui/ui/password.ui", "PasswordDialog")
, m_xPasswdToOpenED(m_xBuilder->weld_entry("newpassEntry"))
, m_xPasswdToOpenInd(m_xBuilder->weld_label("newpassIndicator"))
+ , m_xPasswdToOpenBar(m_xBuilder->weld_level_bar("passlevelbar"))
, m_xReenterPasswdToOpenED(m_xBuilder->weld_entry("confirmpassEntry"))
, m_xReenterPasswdToOpenInd(m_xBuilder->weld_label("confirmpassIndicator"))
, m_xOptionsExpander(m_xBuilder->weld_expander("expander"))
@@ -97,33 +152,59 @@ PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(weld::Window * pParent, s
, m_xPasswdToModifyFT(m_xBuilder->weld_label("label7"))
, m_xPasswdToModifyED(m_xBuilder->weld_entry("newpassroEntry"))
, m_xPasswdToModifyInd(m_xBuilder->weld_label("newpassroIndicator"))
+ , m_xPasswdToModifyBar(m_xBuilder->weld_level_bar("ropasslevelbar"))
, m_xReenterPasswdToModifyFT(m_xBuilder->weld_label("label8"))
, m_xReenterPasswdToModifyED(m_xBuilder->weld_entry("confirmropassEntry"))
, m_xReenterPasswdToModifyInd(m_xBuilder->weld_label("confirmropassIndicator"))
- , m_aOneMismatch( CuiResId( RID_SVXSTR_ONE_PASSWORD_MISMATCH ) )
- , m_aTwoMismatch( CuiResId( RID_SVXSTR_TWO_PASSWORDS_MISMATCH ) )
- , m_aInvalidStateForOkButton( CuiResId( RID_SVXSTR_INVALID_STATE_FOR_OK_BUTTON ) )
- , m_aInvalidStateForOkButton_v2( CuiResId( RID_SVXSTR_INVALID_STATE_FOR_OK_BUTTON_V2 ) )
+ , m_aOneMismatch( CuiResId( RID_CUISTR_ONE_PASSWORD_MISMATCH ) )
+ , m_aTwoMismatch( CuiResId( RID_CUISTR_TWO_PASSWORDS_MISMATCH ) )
+ , m_aInvalidStateForOkButton( CuiResId( RID_CUISTR_INVALID_STATE_FOR_OK_BUTTON ) )
+ , m_aInvalidStateForOkButton_v2( CuiResId( RID_CUISTR_INVALID_STATE_FOR_OK_BUTTON_V2 ) )
+ , m_oPasswordPolicy(officecfg::Office::Common::Security::Scripting::PasswordPolicy::get())
, m_nMaxPasswdLen(nMaxPasswdLen)
, m_bIsPasswordToModify( bIsPasswordToModify )
+ , m_bAllowEmpty( false )
{
m_xOk->connect_clicked(LINK(this, PasswordToOpenModifyDialog, OkBtnClickHdl));
-
- if (nMaxPasswdLen)
+ m_xPasswdToOpenED->connect_changed(LINK(this, PasswordToOpenModifyDialog, ChangeHdl));
+ m_xPasswdToModifyED->connect_changed(LINK(this, PasswordToOpenModifyDialog, ChangeHdl));
+ if(m_oPasswordPolicy || nMaxPasswdLen)
{
- OUString aIndicatorTemplate(CuiResId(RID_SVXSTR_PASSWORD_LEN_INDICATOR).replaceFirst("%1", OUString::number(nMaxPasswdLen)));
- m_xPasswdToOpenED->set_max_length( nMaxPasswdLen );
- m_xPasswdToOpenED->connect_changed(LINK(this, PasswordToOpenModifyDialog, ChangeHdl));
- m_xPasswdToOpenInd->set_label(aIndicatorTemplate);
- m_xReenterPasswdToOpenED->set_max_length( nMaxPasswdLen );
m_xReenterPasswdToOpenED->connect_changed(LINK(this, PasswordToOpenModifyDialog, ChangeHdl));
- m_xReenterPasswdToOpenInd->set_label(aIndicatorTemplate);
- m_xPasswdToModifyED->set_max_length( nMaxPasswdLen );
- m_xPasswdToModifyED->connect_changed(LINK(this, PasswordToOpenModifyDialog, ChangeHdl));
- m_xPasswdToModifyInd->set_label(aIndicatorTemplate);
- m_xReenterPasswdToModifyED->set_max_length( nMaxPasswdLen );
m_xReenterPasswdToModifyED->connect_changed(LINK(this, PasswordToOpenModifyDialog, ChangeHdl));
- m_xReenterPasswdToModifyInd->set_label(aIndicatorTemplate);
+
+ OUString aIndicatorText{};
+ OUString aMaxPassLengthIndicator{ CuiResId(RID_CUISTR_PASSWORD_LEN_INDICATOR)
+ .replaceFirst("%1",
+ OUString::number(nMaxPasswdLen)) };
+ if (m_oPasswordPolicy && nMaxPasswdLen)
+ {
+ aIndicatorText
+ = officecfg::Office::Common::Security::Scripting::PasswordPolicyErrorMessage::get()
+ + "\n" + aMaxPassLengthIndicator;
+ }
+ else if (m_oPasswordPolicy)
+ {
+ aIndicatorText
+ = officecfg::Office::Common::Security::Scripting::PasswordPolicyErrorMessage::get();
+ }
+ else if (nMaxPasswdLen)
+ {
+ aIndicatorText = aMaxPassLengthIndicator;
+ }
+
+ m_xPasswdToOpenInd->set_label(aIndicatorText);
+ m_xReenterPasswdToOpenInd->set_label(aMaxPassLengthIndicator);
+ m_xPasswdToModifyInd->set_label(aIndicatorText);
+ m_xReenterPasswdToModifyInd->set_label(aMaxPassLengthIndicator);
+
+ if (nMaxPasswdLen)
+ {
+ m_xPasswdToOpenED->set_max_length(nMaxPasswdLen);
+ m_xReenterPasswdToOpenED->set_max_length(nMaxPasswdLen);
+ m_xPasswdToModifyED->set_max_length(nMaxPasswdLen);
+ m_xReenterPasswdToModifyED->set_max_length(nMaxPasswdLen);
+ }
}
m_xPasswdToOpenED->grab_focus();
@@ -131,11 +212,32 @@ PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(weld::Window * pParent, s
m_xOptionsExpander->set_sensitive(bIsPasswordToModify);
if (!bIsPasswordToModify)
m_xOptionsExpander->hide();
+ else if (SfxObjectShell* pSh = SfxObjectShell::Current())
+ {
+ if (pSh->IsLoadReadonly())
+ {
+ m_xOpenReadonlyCB->set_active(true);
+ m_xOptionsExpander->set_expanded(true);
+ }
+ }
- m_xOpenReadonlyCB->connect_clicked(LINK(this, PasswordToOpenModifyDialog, ReadonlyOnOffHdl));
+ m_xOpenReadonlyCB->connect_toggled(LINK(this, PasswordToOpenModifyDialog, ReadonlyOnOffHdl));
ReadonlyOnOffHdl(*m_xOpenReadonlyCB);
}
+PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog()
+{
+ if (m_xErrorBox)
+ {
+ m_xErrorBox->response(RET_CANCEL);
+ }
+}
+
+void PasswordToOpenModifyDialog::AllowEmpty()
+{
+ m_bAllowEmpty = true;
+}
+
OUString PasswordToOpenModifyDialog::GetPasswordToOpen() const
{
const bool bPasswdOk =
@@ -159,7 +261,7 @@ bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const
return m_xOpenReadonlyCB->get_active();
}
-IMPL_LINK_NOARG(PasswordToOpenModifyDialog, ReadonlyOnOffHdl, weld::Button&, void)
+IMPL_LINK_NOARG(PasswordToOpenModifyDialog, ReadonlyOnOffHdl, weld::Toggleable&, void)
{
bool bEnable = m_xOpenReadonlyCB->get_active();
m_xPasswdToModifyED->set_sensitive(bEnable);
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index d86d277cc34f..423637e9d9e9 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -85,7 +85,7 @@ void SvPasteObjectDialog::PreGetFormat( const TransferableDataHelper &rHelper )
TransferableObjectDescriptor aDesc;
if (rHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
{
- (void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor(
+ (void)rHelper.GetTransferableObjectDescriptor(
SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc);
}
const DataFlavorExVector* pFormats = &rHelper.GetDataFlavorExVector();
@@ -204,7 +204,7 @@ SotClipboardFormatId SvPasteObjectDialog::GetFormat( const TransferableDataHelpe
TransferableObjectDescriptor aDesc;
if (rHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
{
- (void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor(
+ (void)rHelper.GetTransferableObjectDescriptor(
SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc);
}
const DataFlavorExVector* pFormats = &rHelper.GetDataFlavorExVector();
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index fe9f2e065bf3..1bcb6b7a0156 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -52,30 +52,24 @@ SvxPostItDialog::SvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreS
m_xOKBtn->connect_clicked( LINK( this, SvxPostItDialog, OKHdl ) );
bool bNew = true;
- sal_uInt16 nWhich = 0;
m_xPrevBtn->set_visible(bPrevNext);
m_xNextBtn->set_visible(bPrevNext);
- nWhich = m_rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR );
OUString aAuthorStr, aDateStr;
- if (m_rSet.GetItemState( nWhich ) >= SfxItemState::DEFAULT)
+ if (m_rSet.GetItemState( SID_ATTR_POSTIT_AUTHOR ) >= SfxItemState::DEFAULT)
{
bNew = false;
- const SvxPostItAuthorItem& rAuthor =
- static_cast<const SvxPostItAuthorItem&>(m_rSet.Get(nWhich));
+ const SvxPostItAuthorItem& rAuthor = m_rSet.Get(SID_ATTR_POSTIT_AUTHOR);
aAuthorStr = rAuthor.GetValue();
}
else
aAuthorStr = SvtUserOptions().GetID();
- nWhich = m_rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE );
-
- if (m_rSet.GetItemState( nWhich ) >= SfxItemState::DEFAULT)
+ if (m_rSet.GetItemState( SID_ATTR_POSTIT_DATE ) >= SfxItemState::DEFAULT)
{
- const SvxPostItDateItem& rDate =
- static_cast<const SvxPostItDateItem&>(m_rSet.Get( nWhich ));
+ const SvxPostItDateItem& rDate = m_rSet.Get( SID_ATTR_POSTIT_DATE );
aDateStr = rDate.GetValue();
}
else
@@ -84,13 +78,10 @@ SvxPostItDialog::SvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreS
aDateStr = rLocaleWrapper.getDate( Date( Date::SYSTEM ) );
}
- nWhich = m_rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT );
-
OUString aTextStr;
- if (m_rSet.GetItemState( nWhich ) >= SfxItemState::DEFAULT)
+ if (m_rSet.GetItemState( SID_ATTR_POSTIT_TEXT ) >= SfxItemState::DEFAULT)
{
- const SvxPostItTextItem& rText =
- static_cast<const SvxPostItTextItem&>(m_rSet.Get( nWhich ));
+ const SvxPostItTextItem& rText = m_rSet.Get( SID_ATTR_POSTIT_TEXT );
aTextStr = rText.GetValue();
}
@@ -116,15 +107,9 @@ void SvxPostItDialog::ShowLastAuthor(std::u16string_view rAuthor, std::u16string
m_xLastEditFT->set_label( sTxt );
}
-const sal_uInt16* SvxPostItDialog::GetRanges()
+WhichRangesContainer SvxPostItDialog::GetRanges()
{
- static const sal_uInt16 pRanges[] =
- {
- SID_ATTR_POSTIT_AUTHOR,
- SID_ATTR_POSTIT_TEXT,
- 0
- };
- return pRanges;
+ return WhichRangesContainer(svl::Items<SID_ATTR_POSTIT_AUTHOR, SID_ATTR_POSTIT_TEXT>);
}
void SvxPostItDialog::EnableTravel(bool bNext, bool bPrev)
@@ -168,12 +153,9 @@ IMPL_LINK_NOARG(SvxPostItDialog, OKHdl, weld::Button&, void)
{
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
m_xOutSet.reset(new SfxItemSet(m_rSet));
- m_xOutSet->Put( SvxPostItAuthorItem(SvtUserOptions().GetID(),
- m_rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ) ) );
- m_xOutSet->Put( SvxPostItDateItem(rLocaleWrapper.getDate( Date( Date::SYSTEM ) ),
- m_rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ) ) );
- m_xOutSet->Put( SvxPostItTextItem(m_xEditED->get_text(),
- m_rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ) ) );
+ m_xOutSet->Put( SvxPostItAuthorItem(SvtUserOptions().GetID(), SID_ATTR_POSTIT_AUTHOR ) );
+ m_xOutSet->Put( SvxPostItDateItem(rLocaleWrapper.getDate( Date( Date::SYSTEM ) ), SID_ATTR_POSTIT_DATE ) );
+ m_xOutSet->Put( SvxPostItTextItem(m_xEditED->get_text(), SID_ATTR_POSTIT_TEXT ) );
m_xDialog->response(RET_OK);
}
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index fd378f7686f1..fca03c02d42d 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -35,7 +35,7 @@
#include <vcl/bitmapex.hxx>
#include <vcl/customweld.hxx>
#include <vcl/event.hxx>
-#include <vcl/pngwrite.hxx>
+#include <vcl/filter/PngImageWriter.hxx>
#include <vcl/svapp.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/virdev.hxx>
@@ -200,11 +200,9 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
: mpParentWindow(pParent),
mrParentDialog(rParentDialog),
mxVirtualBufferDevice(nullptr),
- maAllChildren(),
mpHilighted(nullptr),
- maSelected(),
maPicture(this),
- maSaveAsText(CuiResId(RID_SVXSTR_SAVE_SCREENSHOT_AS))
+ maSaveAsText(CuiResId(RID_CUISTR_SAVE_SCREENSHOT_AS))
{
VclPtr<VirtualDevice> xParentDialogSurface(rParentDialog.screenshot());
maParentDialogSize = xParentDialogSurface->GetOutputSizePixel();
@@ -234,7 +232,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
maDimmedDialogBitmap.Adjust(-15, 0, 0, 0, 0);
// init paint buffering VirtualDevice
- mxVirtualBufferDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
+ mxVirtualBufferDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::WITHOUT_ALPHA);
mxVirtualBufferDevice->SetOutputSizePixel(maParentDialogSize);
mxVirtualBufferDevice->SetFillColor(COL_TRANSPARENT);
@@ -254,7 +252,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
if (mxText)
{
mxText->set_size_request(400, mxText->get_height_rows(10));
- OUString aHelpId = OStringToOUString( mrParentDialog.get_help_id(), RTL_TEXTENCODING_UTF8 );
+ OUString aHelpId = mrParentDialog.get_help_id();
Size aSizeCm = Application::GetDefaultDevice()->PixelToLogic(maParentDialogSize, MapMode(MapUnit::MapCM));
maMainMarkupText = lcl_ParagraphWithImage( aHelpId, aSizeCm );
mxText->set_text( maMainMarkupText );
@@ -278,10 +276,11 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&,
// 'save screenshot...' pressed, offer to save maParentDialogBitmap
// as PNG image, use *.id file name as screenshot file name offering
// get a suggestion for the filename from buildable name
- OString aDerivedFileName = mrParentDialog.get_buildable_name();
+ OUString aDerivedFileName = mrParentDialog.get_buildable_name();
auto xFileDlg = std::make_unique<sfx2::FileDialogHelper>(ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
FileDialogFlags::NONE, mpParentWindow);
+ xFileDlg->SetContext(sfx2::FileDialogHelper::ScreenshotAnnotation);
const uno::Reference< ui::dialogs::XFilePicker3 > xFilePicker = xFileDlg->GetFilePicker();
@@ -294,7 +293,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&,
xFilePicker->appendFilter("*.png", "*.png");
xFilePicker->setCurrentFilter("*.png");
- xFilePicker->setDefaultName(OStringToOUString(aDerivedFileName, RTL_TEXTENCODING_UTF8));
+ xFilePicker->setDefaultName(aDerivedFileName);
xFilePicker->setMultiSelectionMode(false);
if (xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK)
@@ -322,7 +321,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&,
if (aCurrentExtension.isEmpty())
{
- aConfirmedURL.setExtension("png");
+ aConfirmedURL.setExtension(u"png");
}
// open stream
@@ -342,8 +341,8 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&,
mxVirtualBufferDevice->GetOutputSizePixel()));
// write as PNG
- vcl::PNGWriter aPNGWriter(aTargetBitmap);
- aPNGWriter.Write(aNew);
+ vcl::PngImageWriter aPNGWriter(aNew);
+ aPNGWriter.write(aTargetBitmap);
}
weld::ScreenShotEntry* ScreenshotAnnotationDlg_Impl::CheckHit(const basegfx::B2IPoint& rPosition)
@@ -439,10 +438,9 @@ void ScreenshotAnnotationDlg_Impl::RepaintToBuffer(
bUseDimmed ? maDimmedDialogBitmap : maParentDialogBitmap);
// get various options
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
- const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
- const bool bIsAntiAliasing(aSvtOptionsDrawinglayer.IsAntiAliasing());
+ const Color aHilightColor(SvtOptionsDrawinglayer::getHilightColor());
+ const double fTransparence(SvtOptionsDrawinglayer::GetTransparentSelectionPercent() * 0.01);
+ const bool bIsAntiAliasing(SvtOptionsDrawinglayer::IsAntiAliasing());
const AntialiasingFlags nOldAA(mxVirtualBufferDevice->GetAntialiasing());
if (bIsAntiAliasing)
@@ -548,10 +546,7 @@ bool ScreenshotAnnotationDlg_Impl::MouseButtonUp()
OUStringBuffer aBookmarks(maMainMarkupText);
for (auto&& rCandidate : maSelected)
- {
- OUString aHelpId = OStringToOUString( rCandidate->GetHelpId(), RTL_TEXTENCODING_UTF8 );
- aBookmarks.append(lcl_Bookmark( aHelpId ));
- }
+ aBookmarks.append(lcl_Bookmark(rCandidate->GetHelpId()));
mxText->set_text( aBookmarks.makeStringAndClear() );
bRepaint = true;
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 824aaa0c81d8..67bb456b7d61 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -46,13 +46,15 @@
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <comphelper/lok.hxx>
#include <comphelper/SetFlagContextHelper.hxx>
#include <comphelper/documentinfo.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/string_view.hxx>
#include <svtools/imagemgr.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace css::uno;
@@ -62,7 +64,7 @@ using namespace css::document;
void SvxScriptOrgDialog::delUserData(const weld::TreeIter& rIter)
{
- SFEntry* pUserData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rIter).toInt64());
+ SFEntry* pUserData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rIter));
if (pUserData)
{
delete pUserData;
@@ -74,7 +76,7 @@ void SvxScriptOrgDialog::delUserData(const weld::TreeIter& rIter)
}
}
-void SvxScriptOrgDialog::deleteTree(weld::TreeIter& rIter)
+void SvxScriptOrgDialog::deleteTree(const weld::TreeIter& rIter)
{
delUserData(rIter);
std::unique_ptr<weld::TreeIter> xIter = m_xScriptsBox->make_iterator(&rIter);
@@ -126,9 +128,6 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
Sequence< Reference< browse::XBrowseNode > > children;
- OUString userStr("user");
- OUString const shareStr("share");
-
try
{
Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get(xCtx);
@@ -148,22 +147,20 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
}
Reference<XModel> xDocumentModel;
- for ( const Reference< browse::XBrowseNode >& childNode : std::as_const(children) )
+ for (const Reference<browse::XBrowseNode>& childNode : children)
{
bool app = false;
OUString uiName = childNode->getName();
OUString factoryURL;
- if ( uiName == userStr || uiName == shareStr )
+ if (uiName == "user")
{
app = true;
- if ( uiName == userStr )
- {
- uiName = m_sMyMacros;
- }
- else
- {
- uiName = m_sProdMacros;
- }
+ uiName = m_sMyMacros;
+ }
+ else if (uiName == "share")
+ {
+ app = true;
+ uiName = m_sProdMacros;
}
else
{
@@ -181,7 +178,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
} catch(const uno::Exception&)
{}
- for ( const beans::PropertyValue& prop : std::as_const(moduleDescr))
+ for (const beans::PropertyValue& prop : moduleDescr)
{
if ( prop.Name == "ooSetupFactoryEmptyDocumentURL" )
{
@@ -195,7 +192,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
Reference< browse::XBrowseNode > langEntries =
getLangNodeFromRootNode( childNode, language );
- insertEntry( uiName, app ? OUString(RID_CUIBMP_HARDDISK) : OUString(RID_CUIBMP_DOC),
+ insertEntry( uiName, app ? RID_CUIBMP_HARDDISK : RID_CUIBMP_DOC,
nullptr, true, std::make_unique< SFEntry >( langEntries, xDocumentModel ), factoryURL, false );
}
@@ -281,7 +278,7 @@ void SvxScriptOrgDialog::RequestSubEntries(const weld::TreeIter& rRootEntry, Ref
// if we catch an exception in getChildNodes then no entries are added
}
- for ( const Reference< browse::XBrowseNode >& childNode : std::as_const(children) )
+ for (const Reference<browse::XBrowseNode>& childNode : children)
{
OUString name( childNode->getName() );
if ( childNode->getType() != browse::BrowseNodeTypes::SCRIPT)
@@ -297,9 +294,9 @@ void SvxScriptOrgDialog::RequestSubEntries(const weld::TreeIter& rRootEntry, Ref
void SvxScriptOrgDialog::insertEntry(const OUString& rText, const OUString& rBitmap,
const weld::TreeIter* pParent, bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData,
- const OUString& factoryURL, bool bSelect)
+ std::u16string_view factoryURL, bool bSelect)
{
- if (rBitmap == RID_CUIBMP_DOC && !factoryURL.isEmpty())
+ if (rBitmap == RID_CUIBMP_DOC && !factoryURL.empty())
{
OUString aImage = SvFileInformationManager::GetFileImageId(INetURLObject(factoryURL));
insertEntry(rText, aImage, pParent, bChildrenOnDemand, std::move(aUserData), bSelect);
@@ -312,7 +309,7 @@ void SvxScriptOrgDialog::insertEntry(
const OUString& rText, const OUString& rBitmap, const weld::TreeIter* pParent,
bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData, bool bSelect)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aUserData.release()))); // XXX possible leak
+ OUString sId(weld::toId(aUserData.release())); // XXX possible leak
m_xScriptsBox->insert(pParent, -1, &rText, &sId, nullptr, nullptr,
bChildrenOnDemand, m_xScratchIter.get());
m_xScriptsBox->set_image(*m_xScratchIter, rBitmap);
@@ -325,7 +322,7 @@ void SvxScriptOrgDialog::insertEntry(
IMPL_LINK(SvxScriptOrgDialog, ExpandingHdl, const weld::TreeIter&, rIter, bool)
{
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rIter).toInt64());
+ SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rIter));
Reference< browse::XBrowseNode > node;
Reference< XModel > model;
@@ -369,20 +366,21 @@ CuiInputDialog::CuiInputDialog(weld::Window * pParent, InputDialogMode nMode)
// ScriptOrgDialog ------------------------------------------------------------
-SvxScriptOrgDialog::SvxScriptOrgDialog(weld::Window* pParent, const OUString& language)
+SvxScriptOrgDialog::SvxScriptOrgDialog(weld::Window* pParent, OUString language)
: SfxDialogController(pParent, "cui/ui/scriptorganizer.ui", "ScriptOrganizerDialog")
- , m_sLanguage(language)
- , m_delErrStr(CuiResId(RID_SVXSTR_DELFAILED))
- , m_delErrTitleStr(CuiResId(RID_SVXSTR_DELFAILED_TITLE))
- , m_delQueryStr(CuiResId(RID_SVXSTR_DELQUERY))
- , m_delQueryTitleStr(CuiResId(RID_SVXSTR_DELQUERY_TITLE))
- , m_createErrStr(CuiResId(RID_SVXSTR_CREATEFAILED))
- , m_createDupStr(CuiResId(RID_SVXSTR_CREATEFAILEDDUP))
- , m_createErrTitleStr(CuiResId(RID_SVXSTR_CREATEFAILED_TITLE))
- , m_renameErrStr(CuiResId(RID_SVXSTR_RENAMEFAILED))
- , m_renameErrTitleStr(CuiResId(RID_SVXSTR_RENAMEFAILED_TITLE))
- , m_sMyMacros(CuiResId(RID_SVXSTR_MYMACROS))
- , m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS))
+ , m_pParent(pParent)
+ , m_sLanguage(std::move(language))
+ , m_delErrStr(CuiResId(RID_CUISTR_DELFAILED))
+ , m_delErrTitleStr(CuiResId(RID_CUISTR_DELFAILED_TITLE))
+ , m_delQueryStr(CuiResId(RID_CUISTR_DELQUERY))
+ , m_delQueryTitleStr(CuiResId(RID_CUISTR_DELQUERY_TITLE))
+ , m_createErrStr(CuiResId(RID_CUISTR_CREATEFAILED))
+ , m_createDupStr(CuiResId(RID_CUISTR_CREATEFAILEDDUP))
+ , m_createErrTitleStr(CuiResId(RID_CUISTR_CREATEFAILED_TITLE))
+ , m_renameErrStr(CuiResId(RID_CUISTR_RENAMEFAILED))
+ , m_renameErrTitleStr(CuiResId(RID_CUISTR_RENAMEFAILED_TITLE))
+ , m_sMyMacros(CuiResId(RID_CUISTR_MYMACROS))
+ , m_sProdMacros(CuiResId(RID_CUISTR_PRODMACROS))
, m_xScriptsBox(m_xBuilder->weld_tree_view("scripts"))
, m_xScratchIter(m_xScriptsBox->make_iterator())
, m_xRunButton(m_xBuilder->weld_button("ok"))
@@ -528,7 +526,7 @@ IMPL_LINK_NOARG(SvxScriptOrgDialog, ScriptSelectHdl, weld::TreeView&, void)
if (!m_xScriptsBox->get_selected(xIter.get()))
return;
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xIter).toInt64());
+ SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(*xIter));
Reference< browse::XBrowseNode > node;
if (userData)
@@ -556,7 +554,7 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
std::unique_ptr<weld::TreeIter> xIter = m_xScriptsBox->make_iterator();
if (!m_xScriptsBox->get_selected(xIter.get()))
return;
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xIter).toInt64());
+ SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(*xIter));
if (!userData)
return;
@@ -600,7 +598,7 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
bool bParent = m_xScriptsBox->iter_parent(*xParentIter);
while (bParent && !mspNode.is() )
{
- SFEntry* mspUserData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xParentIter).toInt64());
+ SFEntry* mspUserData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(*xParentIter));
mspNode.set( mspUserData->GetNode() , UNO_QUERY );
bParent = m_xScriptsBox->iter_parent(*xParentIter);
}
@@ -621,19 +619,19 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
}
catch ( reflection::InvocationTargetException& ite )
{
- SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), css::uno::Any(ite));
+ SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, css::uno::Any(ite));
}
catch ( provider::ScriptFrameworkErrorException& ite )
{
- SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), css::uno::Any(ite));
+ SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, css::uno::Any(ite));
}
catch ( RuntimeException& re )
{
- SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), css::uno::Any(re));
+ SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, css::uno::Any(re));
}
catch ( Exception& e )
{
- SvxScriptErrorDialog::ShowAsyncErrorDialog(getDialog(), css::uno::Any(e));
+ SvxScriptErrorDialog::ShowAsyncErrorDialog(m_pParent, css::uno::Any(e));
}
}
StoreCurrentSelection();
@@ -677,7 +675,7 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode(const weld::TreeIter& rEntry)
{
Reference< browse::XBrowseNode > node;
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rEntry).toInt64());
+ SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rEntry));
if (userData)
{
node = userData->GetNode();
@@ -688,7 +686,7 @@ Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode(const weld::T
Reference< XModel > SvxScriptOrgDialog::getModel(const weld::TreeIter& rEntry)
{
Reference< XModel > model;
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rEntry).toInt64());
+ SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rEntry));
if ( userData )
{
model = userData->GetModel();
@@ -696,7 +694,7 @@ Reference< XModel > SvxScriptOrgDialog::getModel(const weld::TreeIter& rEntry)
return model;
}
-void SvxScriptOrgDialog::createEntry(weld::TreeIter& rEntry)
+void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
{
Reference< browse::XBrowseNode > aChildNode;
@@ -753,9 +751,9 @@ void SvxScriptOrgDialog::createEntry(weld::TreeIter& rEntry)
if(extnPos>0)
extn = nodeName.copy(extnPos);
}
- for( const Reference< browse::XBrowseNode >& n : std::as_const(childNodes) )
+ for (const Reference<browse::XBrowseNode>& n : childNodes)
{
- if (aNewName+extn == n->getName())
+ if (Concat2View(aNewName+extn) == n->getName())
{
bFound = true;
break;
@@ -780,9 +778,9 @@ void SvxScriptOrgDialog::createEntry(weld::TreeIter& rEntry)
{
OUString aUserSuppliedName = aNewDlg.GetObjectName();
bValid = true;
- for( const Reference< browse::XBrowseNode >& n : std::as_const(childNodes) )
+ for (const Reference<browse::XBrowseNode>& n : childNodes)
{
- if (aUserSuppliedName+extn == n->getName())
+ if (Concat2View(aUserSuppliedName+extn) == n->getName())
{
bValid = false;
OUString aError = m_createErrStr + m_createDupStr;
@@ -810,15 +808,13 @@ void SvxScriptOrgDialog::createEntry(weld::TreeIter& rEntry)
// open up parent node (which ensures it's loaded)
m_xScriptsBox->expand_row(rEntry);
- Sequence< Any > args( 1 );
- args[ 0 ] <<= aNewName;
- Sequence< Any > outArgs( 0 );
+ Sequence< Any > args{ Any(aNewName) };
+ Sequence< Any > outArgs;
Sequence< sal_Int16 > outIndex;
try
{
Any aResult = xInv->invoke( "Creatable", args, outIndex, outArgs );
- Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY );
- aChildNode = newNode;
+ aChildNode.set(aResult, UNO_QUERY);
}
catch( Exception const & )
@@ -851,7 +847,7 @@ void SvxScriptOrgDialog::createEntry(weld::TreeIter& rEntry)
// loaded, this will prevent RequestingChildren ( called
// from vcl via RequestingChildren ) from
// creating new ( duplicate ) children
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rEntry).toInt64());
+ SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rEntry));
if ( userData && !userData->isLoaded() )
{
userData->setLoaded();
@@ -892,15 +888,13 @@ void SvxScriptOrgDialog::renameEntry(const weld::TreeIter& rEntry)
aNewName = aNewDlg.GetObjectName();
- Sequence< Any > args( 1 );
- args[ 0 ] <<= aNewName;
- Sequence< Any > outArgs( 0 );
+ Sequence< Any > args{ Any(aNewName) };
+ Sequence< Any > outArgs;
Sequence< sal_Int16 > outIndex;
try
{
Any aResult = xInv->invoke( "Renamable", args, outIndex, outArgs );
- Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY );
- aChildNode = newNode;
+ aChildNode.set(aResult, UNO_QUERY);
}
catch( Exception const & )
@@ -926,7 +920,7 @@ void SvxScriptOrgDialog::renameEntry(const weld::TreeIter& rEntry)
}
}
-void SvxScriptOrgDialog::deleteEntry(weld::TreeIter& rEntry)
+void SvxScriptOrgDialog::deleteEntry(const weld::TreeIter& rEntry)
{
bool result = false;
Reference< browse::XBrowseNode > node = getBrowseNode(rEntry);
@@ -1034,8 +1028,7 @@ void SvxScriptOrgDialog::StoreCurrentSelection()
aDescription = ";" + aDescription;
}
while (bEntry);
- OUString sDesc( aDescription );
- m_lastSelection[ m_sLanguage ] = sDesc;
+ m_lastSelection[m_sLanguage] = aDescription;
}
void SvxScriptOrgDialog::RestorePreviousSelection()
@@ -1048,7 +1041,7 @@ void SvxScriptOrgDialog::RestorePreviousSelection()
sal_Int32 nIndex = 0;
while (nIndex != -1)
{
- OUString aTmp( aStoredEntry.getToken( 0, ';', nIndex ) );
+ std::u16string_view aTmp( o3tl::getToken(aStoredEntry, 0, ';', nIndex ) );
bool bTmpEntry;
if (!xEntry)
@@ -1080,21 +1073,24 @@ void SvxScriptOrgDialog::RestorePreviousSelection()
}
if (xEntry)
+ {
m_xScriptsBox->set_cursor(*xEntry);
+ ScriptSelectHdl(*m_xScriptsBox);
+ }
}
namespace {
OUString ReplaceString(
const OUString& source,
- const OUString& token,
- const OUString& value )
+ std::u16string_view token,
+ std::u16string_view value )
{
sal_Int32 pos = source.indexOf( token );
- if ( pos != -1 && !value.isEmpty() )
+ if ( pos != -1 && !value.empty() )
{
- return source.replaceAt( pos, token.getLength(), value );
+ return source.replaceAt( pos, token.size(), value );
}
else
{
@@ -1104,26 +1100,26 @@ OUString ReplaceString(
OUString FormatErrorString(
const OUString& unformatted,
- const OUString& language,
- const OUString& script,
- const OUString& line,
+ std::u16string_view language,
+ std::u16string_view script,
+ std::u16string_view line,
std::u16string_view type,
std::u16string_view message )
{
- OUString result = unformatted.copy( 0 );
+ OUString result = unformatted;
- result = ReplaceString(result, "%LANGUAGENAME", language );
- result = ReplaceString(result, "%SCRIPTNAME", script );
- result = ReplaceString(result, "%LINENUMBER", line );
+ result = ReplaceString(result, u"%LANGUAGENAME", language );
+ result = ReplaceString(result, u"%SCRIPTNAME", script );
+ result = ReplaceString(result, u"%LINENUMBER", line );
if ( !type.empty() )
{
- result += "\n\n" + CuiResId(RID_SVXSTR_ERROR_TYPE_LABEL) + " " + type;
+ result += "\n\n" + CuiResId(RID_CUISTR_ERROR_TYPE_LABEL) + " " + type;
}
if ( !message.empty() )
{
- result += "\n\n" + CuiResId(RID_SVXSTR_ERROR_MESSAGE_LABEL) + " " + message;
+ result += "\n\n" + CuiResId(RID_CUISTR_ERROR_MESSAGE_LABEL) + " " + message;
}
return result;
@@ -1132,7 +1128,7 @@ OUString FormatErrorString(
OUString GetErrorMessage(
const provider::ScriptErrorRaisedException& eScriptError )
{
- OUString unformatted = CuiResId( RID_SVXSTR_ERROR_AT_LINE );
+ OUString unformatted = CuiResId( RID_CUISTR_ERROR_AT_LINE );
OUString unknown("UNKNOWN");
OUString language = unknown;
@@ -1157,11 +1153,11 @@ OUString GetErrorMessage(
if ( eScriptError.lineNum != -1 )
{
line = OUString::number( eScriptError.lineNum );
- unformatted = CuiResId( RID_SVXSTR_ERROR_AT_LINE );
+ unformatted = CuiResId( RID_CUISTR_ERROR_AT_LINE );
}
else
{
- unformatted = CuiResId( RID_SVXSTR_ERROR_RUNNING );
+ unformatted = CuiResId( RID_CUISTR_ERROR_RUNNING );
}
return FormatErrorString(
@@ -1171,7 +1167,7 @@ OUString GetErrorMessage(
OUString GetErrorMessage(
const provider::ScriptExceptionRaisedException& eScriptException )
{
- OUString unformatted = CuiResId( RID_SVXSTR_EXCEPTION_AT_LINE );
+ OUString unformatted = CuiResId( RID_CUISTR_EXCEPTION_AT_LINE );
OUString unknown("UNKNOWN");
OUString language = unknown;
@@ -1197,11 +1193,11 @@ OUString GetErrorMessage(
if ( eScriptException.lineNum != -1 )
{
line = OUString::number( eScriptException.lineNum );
- unformatted = CuiResId( RID_SVXSTR_EXCEPTION_AT_LINE );
+ unformatted = CuiResId( RID_CUISTR_EXCEPTION_AT_LINE );
}
else
{
- unformatted = CuiResId( RID_SVXSTR_EXCEPTION_RUNNING );
+ unformatted = CuiResId( RID_CUISTR_EXCEPTION_RUNNING );
}
if ( !eScriptException.exceptionType.isEmpty() )
@@ -1216,7 +1212,7 @@ OUString GetErrorMessage(
OUString GetErrorMessage(
const provider::ScriptFrameworkErrorException& sError )
{
- OUString unformatted = CuiResId( RID_SVXSTR_FRAMEWORK_ERROR_RUNNING );
+ OUString unformatted = CuiResId( RID_CUISTR_FRAMEWORK_ERROR_RUNNING );
OUString language("UNKNOWN");
@@ -1234,9 +1230,8 @@ OUString GetErrorMessage(
}
if ( sError.errorType == provider::ScriptFrameworkErrorType::NOTSUPPORTED )
{
- message =
- CuiResId( RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED );
- message = ReplaceString(message, "%LANGUAGENAME", language );
+ message = CuiResId(RID_CUISTR_ERROR_LANG_NOT_SUPPORTED);
+ message = ReplaceString(message, u"%LANGUAGENAME", language );
}
else
@@ -1244,7 +1239,7 @@ OUString GetErrorMessage(
message = sError.Message;
}
return FormatErrorString(
- unformatted, language, script, OUString(), std::u16string_view(), message );
+ unformatted, language, script, u"", std::u16string_view(), message );
}
OUString GetErrorMessage( const css::uno::Any& aException )
@@ -1299,12 +1294,11 @@ OUString GetErrorMessage( const css::uno::Any& aException )
void SvxScriptErrorDialog::ShowAsyncErrorDialog( weld::Window* pParent, css::uno::Any const & aException )
{
SolarMutexGuard aGuard;
- OUString sMessage = GetErrorMessage( aException );
// Pass a copy of the message to the ShowDialog method as the
// SvxScriptErrorDialog may be deleted before ShowDialog is called
DialogData* pData = new DialogData;
- pData->sMessage = sMessage;
+ pData->sMessage = GetErrorMessage(aException);
pData->pParent = pParent;
Application::PostUserEvent(
LINK( nullptr, SvxScriptErrorDialog, ShowDialog ),
@@ -1317,12 +1311,18 @@ IMPL_STATIC_LINK( SvxScriptErrorDialog, ShowDialog, void*, p, void )
OUString message = xData->sMessage;
if ( message.isEmpty() )
- message = CuiResId( RID_SVXSTR_ERROR_TITLE );
+ message = CuiResId( RID_CUISTR_ERROR_TITLE );
+
+ std::shared_ptr<weld::MessageDialog> xBox;
+ xBox.reset(Application::CreateMessageDialog(
+ xData->pParent,
+ VclMessageType::Warning,
+ VclButtonsType::Ok,
+ message));
+
+ xBox->set_title(CuiResId(RID_CUISTR_ERROR_TITLE));
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(xData->pParent,
- VclMessageType::Warning, VclButtonsType::Ok, message));
- xBox->set_title(CuiResId(RID_SVXSTR_ERROR_TITLE));
- xBox->run();
+ xBox->runAsync(xBox, [](sal_Int32 /*nResult*/) {});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx
index fda8b4ce1385..6b10e5c688e3 100644
--- a/cui/source/dialogs/sdrcelldlg.cxx
+++ b/cui/source/dialogs/sdrcelldlg.cxx
@@ -21,11 +21,16 @@
#include <cuitabarea.hxx>
#include <svx/svdmodel.hxx>
#include <border.hxx>
+#include <paragrph.hxx>
+#include <svl/intitem.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svx/flagsdef.hxx>
+#include <svx/svxids.hrc>
#include <svx/dialogs.hrc>
-SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel)
- : SfxTabDialogController(pParent, "cui/ui/formatcellsdialog.ui", "FormatCellsDialog", pAttr)
- , mrOutAttrs(*pAttr)
+SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet& rAttr, const SdrModel& rModel, bool bStyle)
+ : SfxTabDialogController(pParent, "cui/ui/formatcellsdialog.ui", "FormatCellsDialog", &rAttr, bStyle)
+ , mrOutAttrs(rAttr)
, mpColorTab(rModel.GetColorList())
, mnColorTabState ( ChangeType::NONE )
, mpGradientList(rModel.GetGradientList())
@@ -37,10 +42,32 @@ SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemS
AddTabPage("effects", RID_SVXPAGE_CHAR_EFFECTS);
AddTabPage("border", RID_SVXPAGE_BORDER );
AddTabPage("area", RID_SVXPAGE_AREA);
- AddTabPage("shadow", SvxShadowTabPage::Create, nullptr);
+
+ if (bStyle)
+ {
+ AddTabPage("position", RID_SVXPAGE_CHAR_POSITION);
+ AddTabPage("highlight", RID_SVXPAGE_BKG);
+ AddTabPage("indentspacing", RID_SVXPAGE_STD_PARAGRAPH);
+ AddTabPage("alignment", SvxParaAlignTabPage::Create, SvxParaAlignTabPage::GetSdrRanges);
+ RemoveTabPage("shadow");
+ }
+ else
+ {
+ RemoveTabPage("position");
+ RemoveTabPage("highlight");
+ RemoveTabPage("indentspacing");
+ RemoveTabPage("alignment");
+ AddTabPage("shadow", SvxShadowTabPage::Create, nullptr);
+ RemoveStandardButton();
+ }
+
+ if (bStyle && SvtCJKOptions::IsAsianTypographyEnabled())
+ AddTabPage("asian", RID_SVXPAGE_PARA_ASIAN);
+ else
+ RemoveTabPage("asian");
}
-void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SvxFormatCellsDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "area")
{
@@ -62,6 +89,16 @@ void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
static_cast<SvxShadowTabPage&>(rPage).SetColorList( mpColorTab );
static_cast<SvxShadowTabPage&>(rPage).SetColorChgd( &mnColorTabState );
}
+ else if (rId == "alignment")
+ {
+ static_cast<SvxParaAlignTabPage&>(rPage).EnableSdrVertAlign();
+ }
+ else if (rId == "highlight")
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR)));
+ rPage.PageCreated(aSet);
+ }
else
SfxTabDialogController::PageCreated(rId, rPage);
}
diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx
index a567a84010dc..ae468b02009a 100644
--- a/cui/source/dialogs/showcols.cxx
+++ b/cui/source/dialogs/showcols.cxx
@@ -19,14 +19,13 @@
#include <showcols.hxx>
-#include <osl/diagnose.h>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/types.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-#define CUIFM_PROP_HIDDEN "Hidden"
-#define CUIFM_PROP_LABEL "Label"
+constexpr OUString CUIFM_PROP_HIDDEN = u"Hidden"_ustr;
+constexpr OUStringLiteral CUIFM_PROP_LABEL = u"Label";
FmShowColsDialog::FmShowColsDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/showcoldialog.ui", "ShowColDialog")
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index f58b8cc0ece5..14146b44c373 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -28,9 +28,8 @@ SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical,
, mnMaxVertical(nMaxVertical)
, mnMaxHorizontal(nMaxHorizontal)
{
- m_xHorzBox->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
- m_xPropCB->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
- m_xVertBox->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
+ m_xHorzBox->connect_toggled(LINK(this, SvxSplitTableDlg, ToggleHdl));
+ m_xVertBox->connect_toggled(LINK(this, SvxSplitTableDlg, ToggleHdl));
if (mnMaxVertical < 2)
{
@@ -51,9 +50,11 @@ SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical,
}
}
-IMPL_LINK(SvxSplitTableDlg, ClickHdl, weld::Button&, rButton, void)
+IMPL_LINK(SvxSplitTableDlg, ToggleHdl, weld::Toggleable&, rButton, void)
{
- const bool bIsVert = &rButton == m_xVertBox.get();
+ if (!rButton.get_active())
+ return;
+ const bool bIsVert = m_xVertBox->get_active();
tools::Long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
m_xPropCB->set_sensitive(!bIsVert);
m_xCountEdit->set_max(nMax);
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 513501700970..f8080f537775 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -49,10 +49,9 @@ SvxSearchFormatDialog::SvxSearchFormatDialog(weld::Window* pParent, const SfxIte
AddTabPage("background", SvxBkgTabPage::Create, nullptr);
// remove asian tabpages if necessary
- SvtCJKOptions aCJKOptions;
- if ( !aCJKOptions.IsDoubleLinesEnabled() )
+ if ( !SvtCJKOptions::IsDoubleLinesEnabled() )
RemoveTabPage("asianlayout");
- if ( !aCJKOptions.IsAsianTypographyEnabled() )
+ if ( !SvtCJKOptions::IsAsianTypographyEnabled() )
RemoveTabPage("labelTP_PARA_ASIAN");
}
@@ -60,14 +59,12 @@ SvxSearchFormatDialog::~SvxSearchFormatDialog()
{
}
-void SvxSearchFormatDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
+void SvxSearchFormatDialog::PageCreated(const OUString& rId, SfxTabPage& rPage)
{
if (rId == "font")
{
const FontList* pApm_pFontList = nullptr;
- SfxObjectShell* pSh = SfxObjectShell::Current();
-
- if ( pSh )
+ if (SfxObjectShell* pSh = SfxObjectShell::Current())
{
const SvxFontListItem* pFLItem = static_cast<const SvxFontListItem*>(
pSh->GetItem( SID_ATTR_CHAR_FONTLIST ));
@@ -105,7 +102,7 @@ void SvxSearchFormatDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
}
SvxSearchAttributeDialog::SvxSearchAttributeDialog(weld::Window* pParent,
- SearchAttrItemList& rLst, const sal_uInt16* pWhRanges)
+ SearchAttrItemList& rLst, const WhichRangesContainer& pWhRanges)
: GenericDialogController(pParent, "cui/ui/searchattrdialog.ui", "SearchAttrDialog")
, rList(rLst)
, m_xAttrLB(m_xBuilder->weld_tree_view("treeview"))
@@ -120,42 +117,44 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog(weld::Window* pParent,
SfxObjectShell* pSh = SfxObjectShell::Current();
DBG_ASSERT( pSh, "No DocShell" );
-
- SfxItemPool& rPool = pSh->GetPool();
- SfxItemSet aSet( rPool, pWhRanges );
- SfxWhichIter aIter( aSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while ( nWhich )
+ if (pSh)
{
- sal_uInt16 nSlot = rPool.GetSlotId( nWhich );
- if ( nSlot >= SID_SVX_START )
+ SfxItemPool& rPool = pSh->GetPool();
+ SfxItemSet aSet( rPool, pWhRanges );
+ SfxWhichIter aIter( aSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while ( nWhich )
{
- bool bChecked = false, bFound = false;
- for ( sal_uInt16 i = 0; !bFound && i < rList.Count(); ++i )
+ sal_uInt16 nSlot = rPool.GetSlotId( nWhich );
+ if ( nSlot >= SID_SVX_START )
{
- if ( nSlot == rList[i].nSlot )
+ bool bChecked = false, bFound = false;
+ for ( sal_uInt16 i = 0; !bFound && i < rList.Count(); ++i )
{
- bFound = true;
- if ( IsInvalidItem( rList[i].pItem ) )
- bChecked = true;
+ if ( nSlot == rList[i].nSlot )
+ {
+ bFound = true;
+ if ( IsInvalidItem( rList[i].aItemPtr.getItem() ) )
+ bChecked = true;
+ }
}
- }
- // item resources are in svx
- sal_uInt32 nId = SvxAttrNameTable::FindIndex(nSlot);
- if (RESARRAY_INDEX_NOTFOUND != nId)
- {
- m_xAttrLB->append();
- const int nRow = m_xAttrLB->n_children() - 1;
- m_xAttrLB->set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xAttrLB->set_text(nRow, SvxAttrNameTable::GetString(nId), 0);
- m_xAttrLB->set_id(nRow, OUString::number(nSlot));
+ // item resources are in svx
+ sal_uInt32 nId = SvxAttrNameTable::FindIndex(nSlot);
+ if (RESARRAY_INDEX_NOTFOUND != nId)
+ {
+ m_xAttrLB->append();
+ const int nRow = m_xAttrLB->n_children() - 1;
+ m_xAttrLB->set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xAttrLB->set_text(nRow, SvxAttrNameTable::GetString(nId), 0);
+ m_xAttrLB->set_id(nRow, OUString::number(nSlot));
+ }
+ else
+ SAL_WARN( "cui.dialogs", "no resource for slot id " << static_cast<sal_Int32>(nSlot) );
}
- else
- SAL_WARN( "cui.dialogs", "no resource for slot id " << static_cast<sal_Int32>(nSlot) );
+ nWhich = aIter.NextWhich();
}
- nWhich = aIter.NextWhich();
}
m_xAttrLB->make_sorted();
@@ -168,28 +167,24 @@ SvxSearchAttributeDialog::~SvxSearchAttributeDialog()
IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, weld::Button&, void)
{
- SearchAttrItem aInvalidItem;
- aInvalidItem.pItem = INVALID_POOL_ITEM;
+ DBG_ASSERT( SfxObjectShell::Current(), "No DocShell" );
+ SfxItemPool& rPool(SfxObjectShell::Current()->GetPool());
for (int i = 0, nCount = m_xAttrLB->n_children(); i < nCount; ++i)
{
- sal_uInt16 nSlot = m_xAttrLB->get_id(i).toUInt32();
- bool bChecked = m_xAttrLB->get_toggle(i) == TRISTATE_TRUE;
+ const sal_uInt16 nSlot(m_xAttrLB->get_id(i).toUInt32());
+ const bool bChecked(TRISTATE_TRUE == m_xAttrLB->get_toggle(i));
sal_uInt16 j;
for ( j = rList.Count(); j; )
{
- SearchAttrItem& rItem = rList[ --j ];
+ SearchAttrInfo& rItem = rList[ --j ];
if( rItem.nSlot == nSlot )
{
if( bChecked )
- {
- if( !IsInvalidItem( rItem.pItem ) )
- delete rItem.pItem;
- rItem.pItem = INVALID_POOL_ITEM;
- }
- else if( IsInvalidItem( rItem.pItem ) )
- rItem.pItem = nullptr;
+ rItem.aItemPtr = SfxPoolItemHolder(rPool, INVALID_POOL_ITEM);
+ else if( IsInvalidItem( rItem.aItemPtr.getItem() ) )
+ rItem.aItemPtr = SfxPoolItemHolder();
j = 1;
break;
}
@@ -197,14 +192,13 @@ IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, weld::Button&, void)
if ( !j && bChecked )
{
- aInvalidItem.nSlot = nSlot;
- rList.Insert( aInvalidItem );
+ rList.Insert( { nSlot, SfxPoolItemHolder(rPool, INVALID_POOL_ITEM) });
}
}
// remove invalid items (pItem == NULL)
for ( sal_uInt16 n = rList.Count(); n; )
- if ( !rList[ --n ].pItem )
+ if ( !rList[ --n ].aItemPtr.getItem() )
rList.Remove( n );
m_xDialog->response(RET_OK);
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 19580b007616..ea98a44a3c9e 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -165,8 +165,8 @@ void SvxThesaurusDialog::LookUp_Impl()
m_xAlternativesCT->set_visible(m_bWordFound);
m_xNotFound->set_visible(!m_bWordFound);
- if (m_bWordFound)
- Application::PostUserEvent(LINK(this, SvxThesaurusDialog, SelectFirstHdl_Impl));
+ if (m_bWordFound && !m_nSelectFirstEvent)
+ m_nSelectFirstEvent = Application::PostUserEvent(LINK(this, SvxThesaurusDialog, SelectFirstHdl_Impl));
if (m_xWordCB->find_text(aText) == -1)
m_xWordCB->append_text(aText);
@@ -217,13 +217,15 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, weld::TreeView&,
//! workaround to set the selection since calling SelectEntryPos within
//! the double click handler does not work
- Application::PostUserEvent(LINK(this, SvxThesaurusDialog, SelectFirstHdl_Impl));
+ if (!m_nSelectFirstEvent)
+ m_nSelectFirstEvent = Application::PostUserEvent(LINK(this, SvxThesaurusDialog, SelectFirstHdl_Impl));
return true;
}
IMPL_LINK_NOARG(SvxThesaurusDialog, SelectFirstHdl_Impl, void *, void)
{
+ m_nSelectFirstEvent = nullptr;
if (m_xAlternativesCT->n_children() >= 2)
{
m_xAlternativesCT->select(1); // pos 0 is a 'header' that is not selectable
@@ -240,7 +242,6 @@ SvxThesaurusDialog::SvxThesaurusDialog(
LanguageType nLanguage)
: SfxDialogController(pParent, "cui/ui/thesaurus.ui", "ThesaurusDialog")
, m_aModifyIdle("cui SvxThesaurusDialog LookUp Modify")
- , aLookUpText()
, nLookUpLanguage(LANGUAGE_NONE)
, m_bWordFound(false)
, m_xLeftBtn(m_xBuilder->weld_button("left"))
@@ -250,6 +251,7 @@ SvxThesaurusDialog::SvxThesaurusDialog(
, m_xReplaceEdit(m_xBuilder->weld_entry("replaceed"))
, m_xLangLB(m_xBuilder->weld_combo_box("langcb"))
, m_xReplaceBtn(m_xBuilder->weld_button("ok"))
+ , m_nSelectFirstEvent(nullptr)
{
m_aModifyIdle.SetInvokeHandler( LINK( this, SvxThesaurusDialog, ModifyTimer_Hdl ) );
m_aModifyIdle.SetPriority( TaskPriority::LOWEST );
@@ -313,10 +315,17 @@ SvxThesaurusDialog::SvxThesaurusDialog(
// disable controls if service is missing
if (!xThesaurus.is())
m_xDialog->set_sensitive(false);
+ else
+ m_xWordCB->grab_focus();
}
SvxThesaurusDialog::~SvxThesaurusDialog()
{
+ if (m_nSelectFirstEvent)
+ {
+ Application::RemoveUserEvent(m_nSelectFirstEvent);
+ m_nSelectFirstEvent = nullptr;
+ }
}
IMPL_LINK_NOARG(SvxThesaurusDialog, ReplaceBtnHdl_Impl, weld::Button&, void)
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index 2404052271e6..40bb606130f2 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -25,8 +25,9 @@
#include <vcl/commandinfoprovider.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/help.hxx>
+#include <vcl/window.hxx>
+#include <vcl/ImageTree.hxx>
-#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/util/URL.hpp>
@@ -38,12 +39,18 @@
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/resmgr.hxx>
#include <unotools/configmgr.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <bitmaps.hlst>
+
+//size of preview
+const Size ThumbSize(150, 150);
TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog")
+ , m_xParent(pParent ? pParent->GetXWindow() : nullptr)
, m_pText(m_xBuilder->weld_label("lbText"))
, m_pShowTip(m_xBuilder->weld_check_button("cbShowTip"))
, m_pNext(m_xBuilder->weld_button("btnNext"))
@@ -52,25 +59,56 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
{
m_pShowTip->set_active(officecfg::Office::Common::Misc::ShowTipOfTheDay::get());
m_pNext->connect_clicked(LINK(this, TipOfTheDayDialog, OnNextClick));
-
m_nCurrentTip = officecfg::Office::Common::Misc::LastTipOfTheDayID::get();
+ m_pPreview->set_size_request(ThumbSize.Width(), ThumbSize.Height());
+
+ if (m_xParent.is())
+ {
+ VclPtr<vcl::Window> xVclWin(VCLUnoHelper::GetWindow(m_xParent));
+ if (xVclWin != nullptr)
+ xVclWin->AddEventListener(LINK(this, TipOfTheDayDialog, Terminated));
+ }
const auto t0 = std::chrono::system_clock::now().time_since_epoch();
- m_nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count() / 24;
- if (m_nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get())
+ sal_Int32 nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count() / 24;
+ //show next tip after one day
+ if (nDay > officecfg::Office::Common::Misc::LastTipOfTheDayShown::get())
m_nCurrentTip++;
+ // save this time to the config now instead of in the dtor otherwise we
+ // end up with multiple copies of this dialog every time we open a new
+ // document if the first one isn't closed
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::LastTipOfTheDayShown::set(nDay, xChanges);
+ xChanges->commit();
+
UpdateTip();
}
+IMPL_LINK(TipOfTheDayDialog, Terminated, VclWindowEvent&, rEvent, void)
+{
+ if (rEvent.GetId() == VclEventId::ObjectDying)
+ {
+ m_xParent.clear();
+ TipOfTheDayDialog::response(RET_OK);
+ }
+}
+
TipOfTheDayDialog::~TipOfTheDayDialog()
{
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::LastTipOfTheDayShown::set(m_nDay, xChanges);
officecfg::Office::Common::Misc::LastTipOfTheDayID::set(m_nCurrentTip, xChanges);
officecfg::Office::Common::Misc::ShowTipOfTheDay::set(m_pShowTip->get_active(), xChanges);
xChanges->commit();
+
+ if (m_xParent.is())
+ {
+ VclPtr<vcl::Window> xVclWin(VCLUnoHelper::GetWindow(m_xParent));
+ if (xVclWin != nullptr)
+ xVclWin->RemoveEventListener(LINK(this, TipOfTheDayDialog, Terminated));
+ }
}
static bool file_exists(const OUString& fileName)
@@ -81,17 +119,30 @@ static bool file_exists(const OUString& fileName)
void TipOfTheDayDialog::UpdateTip()
{
- constexpr sal_Int32 nNumberOfTips = SAL_N_ELEMENTS(TIPOFTHEDAY_STRINGARRAY);
+ constexpr sal_Int32 nNumberOfTips = std::size(TIPOFTHEDAY_STRINGARRAY);
- if ((m_nCurrentTip >= nNumberOfTips) || (m_nCurrentTip < 0))
- m_nCurrentTip = 0;
+ for (;;)
+ {
+ if ((m_nCurrentTip >= nNumberOfTips) || (m_nCurrentTip < 0))
+ m_nCurrentTip = 0;
+ if (std::get<1>(TIPOFTHEDAY_STRINGARRAY[m_nCurrentTip])
+ == "svx/ui/safemodedialog/SafeModeDialog"
+ && !officecfg::Office::Common::Misc::OfferSafeMode::get())
+ {
+ ++m_nCurrentTip;
+ }
+ else
+ {
+ break;
+ }
+ }
//title
m_xDialog->set_title(CuiResId(STR_TITLE)
.replaceFirst("%CURRENT", OUString::number(m_nCurrentTip + 1))
.replaceFirst("%TOTAL", OUString::number(nNumberOfTips)));
- auto[sTip, sLink, sImage] = TIPOFTHEDAY_STRINGARRAY[m_nCurrentTip];
+ auto[sTip, sLink, sImage, nType] = TIPOFTHEDAY_STRINGARRAY[m_nCurrentTip];
// text
//replace MOD1 & MOD2 shortcuts depending on platform
@@ -113,8 +164,7 @@ void TipOfTheDayDialog::UpdateTip()
{
m_pLink->set_visible(false);
//show the link only if the UNO command is available in the current module
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (pViewFrame)
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
{
const auto xFrame = pViewFrame->GetFrame().GetFrameInterface();
const css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(
@@ -171,11 +221,29 @@ void TipOfTheDayDialog::UpdateTip()
OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/tipoftheday/");
rtl::Bootstrap::expandMacros(aURL);
OUString aImageName = sImage;
- // use default image if none is available with the number
- if (aImageName.isEmpty() || !file_exists(aURL + aImageName))
- aImageName = "tipoftheday.png";
Graphic aGraphic;
- GraphicFilter::LoadGraphic(aURL + aImageName, OUString(), aGraphic);
+
+ if (!aImageName.isEmpty() && file_exists(aURL + aImageName))
+ GraphicFilter::LoadGraphic(aURL + aImageName, OUString(), aGraphic);
+ else
+ {
+ const OUString sModuleImage[5]
+ = { RID_SVXBMP_TOTD_WRITER, RID_SVXBMP_TOTD_CALC, RID_SVXBMP_TOTD_DRAW,
+ RID_SVXBMP_TOTD_IMPRESS, RID_SVXBMP_TOTD_SOFFICE };
+ const OUString aIconTheme
+ = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+ BitmapEx aBmpEx;
+ ImageTree::get().loadImage(sModuleImage[nType], aIconTheme, aBmpEx, true,
+ ImageLoadFlags::IgnoreDarkTheme);
+ aGraphic = aBmpEx;
+ }
+
+ if (!aGraphic.IsAnimated())
+ {
+ BitmapEx aBmpEx(aGraphic.GetBitmapEx());
+ if (aBmpEx.Scale(ThumbSize))
+ aGraphic = aBmpEx;
+ }
m_aPreview.SetPreview(aGraphic);
}
diff --git a/cui/source/dialogs/toolbarmodedlg.cxx b/cui/source/dialogs/toolbarmodedlg.cxx
index 4f5df939e948..54918e7fdcd4 100644
--- a/cui/source/dialogs/toolbarmodedlg.cxx
+++ b/cui/source/dialogs/toolbarmodedlg.cxx
@@ -67,11 +67,9 @@ static OUString GetCurrentApp()
static OUString GetCurrentMode()
{
OUString sResult;
- if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ if (SfxViewFrame::Current())
{
- const auto xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
const auto xContext = comphelper::getProcessComponentContext();
- const auto xModuleManager = css::frame::ModuleManager::create(xContext);
const utl::OConfigurationTreeRoot aAppNode(
xContext, "org.openoffice.Office.UI.ToolbarMode/Applications/" + GetCurrentApp(), true);
if (aAppNode.isValid())
@@ -96,12 +94,12 @@ ToolbarmodeDialog::ToolbarmodeDialog(weld::Window* pParent)
(m_xBuilder->weld_radio_button("rbButton9")) }
, m_pInfoLabel(m_xBuilder->weld_label("lbInfo"))
{
- static_assert(SAL_N_ELEMENTS(m_pRadioButtons) == SAL_N_ELEMENTS(TOOLBARMODES_ARRAY));
+ static_assert(SAL_N_ELEMENTS(m_pRadioButtons) == std::size(TOOLBARMODES_ARRAY));
- Link<weld::ToggleButton&, void> aLink = LINK(this, ToolbarmodeDialog, SelectToolbarmode);
+ Link<weld::Toggleable&, void> aLink = LINK(this, ToolbarmodeDialog, SelectToolbarmode);
const OUString sCurrentMode = GetCurrentMode();
- for (tools::ULong i = 0; i < SAL_N_ELEMENTS(m_pRadioButtons); i++)
+ for (std::size_t i = 0; i < std::size(m_pRadioButtons); ++i)
{
m_pRadioButtons[i]->connect_toggled(aLink);
if (sCurrentMode == std::get<1>(TOOLBARMODES_ARRAY[i]))
@@ -112,7 +110,7 @@ ToolbarmodeDialog::ToolbarmodeDialog(weld::Window* pParent)
}
}
- m_pApply->set_label(CuiResId(RID_SVXSTR_UI_APPLYALL).replaceFirst("%MODULE", GetCurrentApp()));
+ m_pApply->set_label(CuiResId(RID_CUISTR_UI_APPLYALL).replaceFirst("%MODULE", GetCurrentApp()));
m_pApply->connect_clicked(LINK(this, ToolbarmodeDialog, OnApplyClick));
m_pApplyAll->connect_clicked(LINK(this, ToolbarmodeDialog, OnApplyClick));
@@ -133,7 +131,7 @@ static bool file_exists(const OUString& fileName)
int ToolbarmodeDialog::GetActiveRadioButton()
{
- for (tools::ULong i = 0; i < SAL_N_ELEMENTS(m_pRadioButtons); i++)
+ for (std::size_t i = 0; i < std::size(m_pRadioButtons); ++i)
{
if (m_pRadioButtons[i]->get_active())
return i;
@@ -161,7 +159,7 @@ void ToolbarmodeDialog::UpdateImage(std::u16string_view sFileName)
}
}
-IMPL_LINK_NOARG(ToolbarmodeDialog, SelectToolbarmode, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(ToolbarmodeDialog, SelectToolbarmode, weld::Toggleable&, void)
{
const int i = GetActiveRadioButton();
if (i > -1)
@@ -181,7 +179,7 @@ IMPL_LINK(ToolbarmodeDialog, OnApplyClick, weld::Button&, rButton, void)
if (&rButton == m_pApplyAll.get())
{
std::shared_ptr<comphelper::ConfigurationChanges> aBatch(
- comphelper::ConfigurationChanges::create(::comphelper::getProcessComponentContext()));
+ comphelper::ConfigurationChanges::create());
officecfg::Office::UI::ToolbarMode::ActiveWriter::set(sCmd, aBatch);
officecfg::Office::UI::ToolbarMode::ActiveCalc::set(sCmd, aBatch);
officecfg::Office::UI::ToolbarMode::ActiveImpress::set(sCmd, aBatch);
@@ -189,21 +187,19 @@ IMPL_LINK(ToolbarmodeDialog, OnApplyClick, weld::Button&, rButton, void)
aBatch->commit();
OUString sCurrentApp = GetCurrentApp();
- if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ if (SfxViewFrame::Current())
{
- const auto xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
const auto xContext = comphelper::getProcessComponentContext();
- const auto xModuleManager = css::frame::ModuleManager::create(xContext);
const utl::OConfigurationTreeRoot aAppNode(
xContext, "org.openoffice.Office.UI.ToolbarMode/Applications/", true);
if (sCurrentApp != "Writer")
- aAppNode.setNodeValue("Writer/Active", css::uno::makeAny(sCmd));
+ aAppNode.setNodeValue("Writer/Active", css::uno::Any(sCmd));
if (sCurrentApp != "Calc")
- aAppNode.setNodeValue("Calc/Active", css::uno::makeAny(sCmd));
+ aAppNode.setNodeValue("Calc/Active", css::uno::Any(sCmd));
if (sCurrentApp != "Impress")
- aAppNode.setNodeValue("Impress/Active", css::uno::makeAny(sCmd));
+ aAppNode.setNodeValue("Impress/Active", css::uno::Any(sCmd));
if (sCurrentApp != "Draw")
- aAppNode.setNodeValue("Draw/Active", css::uno::makeAny(sCmd));
+ aAppNode.setNodeValue("Draw/Active", css::uno::Any(sCmd));
aAppNode.commit();
};
}
diff --git a/cui/source/dialogs/whatsnew.cxx b/cui/source/dialogs/whatsnew.cxx
new file mode 100644
index 000000000000..31ad380d8cf9
--- /dev/null
+++ b/cui/source/dialogs/whatsnew.cxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <whatsnew.hxx>
+#include <whatsnew.hrc>
+
+#include <dialmgr.hxx>
+#include <comphelper/DirectoryHelper.hxx>
+#include <rtl/bootstrap.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/gdimtf.hxx>
+
+constexpr tools::Long TEXT_HEIGHT(120);
+constexpr tools::Long PROGRESS_DOTSIZE(24);
+constexpr tools::Long PROGRESS_DOTSPACING(4);
+
+WhatsNewDialog::WhatsNewDialog(weld::Window* pParent, const bool bWelcome)
+ : GenericDialogController(pParent, "cui/ui/whatsnewdialog.ui", "WhatsNewDialog")
+ , m_bWelcome(bWelcome)
+ , m_aPreview()
+ , m_aProgress()
+ , m_pPrevBtn(m_xBuilder->weld_button("btnPrev"))
+ , m_pNextBtn(m_xBuilder->weld_button("btnNext"))
+ , m_pProgress(new weld::CustomWeld(*m_xBuilder, "imProgress", m_aProgress))
+ , m_pImage(new weld::CustomWeld(*m_xBuilder, "imNews", m_aPreview))
+{
+ if (m_bWelcome)
+ m_xDialog->set_title(CuiResId(STR_WELCOME));
+ m_pPrevBtn->set_sensitive(false);
+
+ m_pPrevBtn->connect_clicked(LINK(this, WhatsNewDialog, OnPrevClick));
+ m_pNextBtn->connect_clicked(LINK(this, WhatsNewDialog, OnNextClick));
+
+ m_nNumberOfNews = m_bWelcome ? std::size(WELCOME_STRINGARRAY) : std::size(WHATSNEW_STRINGARRAY);
+ m_nCurrentNews = 0;
+ m_pNextBtn->set_sensitive(m_nNumberOfNews > 1);
+ m_pProgress->set_size_request(m_nNumberOfNews * (PROGRESS_DOTSIZE + PROGRESS_DOTSPACING),
+ PROGRESS_DOTSIZE + 1);
+
+ LoadImage();
+}
+
+WhatsNewDialog::~WhatsNewDialog() {}
+
+void WhatsNewDialog::LoadImage()
+{
+ if (m_nCurrentNews < m_nNumberOfNews)
+ {
+ auto[sText, sImage] = m_bWelcome ? WELCOME_STRINGARRAY[m_nCurrentNews]
+ : WHATSNEW_STRINGARRAY[m_nCurrentNews];
+ OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/whatsnew/");
+ rtl::Bootstrap::expandMacros(aURL);
+
+ const bool bFileExists = comphelper::DirectoryHelper::fileExists(aURL + sImage);
+ if (!sImage.isEmpty() && bFileExists)
+ m_aPreview.Update(aURL + sImage, CuiResId(sText));
+
+ m_aProgress.Update(m_nCurrentNews, m_nNumberOfNews);
+ }
+}
+
+IMPL_LINK_NOARG(WhatsNewDialog, OnPrevClick, weld::Button&, void)
+{
+ m_nCurrentNews--;
+ if (m_nCurrentNews == 0)
+ m_pPrevBtn->set_sensitive(false);
+ m_pNextBtn->set_sensitive(true);
+ LoadImage();
+}
+
+IMPL_LINK_NOARG(WhatsNewDialog, OnNextClick, weld::Button&, void)
+{
+ m_nCurrentNews++;
+ if (m_nCurrentNews == m_nNumberOfNews - 1)
+ m_pNextBtn->set_sensitive(false);
+ m_pPrevBtn->set_sensitive(true);
+ LoadImage();
+}
+
+void WhatsNewImg::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
+ const StyleSettings rSettings(Application::GetSettings().GetStyleSettings());
+
+ //clear
+ rRenderContext.SetBackground(Wallpaper(rSettings.GetDialogColor()));
+ rRenderContext.Erase();
+
+ //background image
+ Graphic aGraphic;
+ GraphicFilter::LoadGraphic(m_sImage, OUString(), aGraphic);
+ const Size aGraphicSize(aGraphic.GetSizePixel());
+
+ if (aGraphic.IsAnimated())
+ aGraphic.StartAnimation(rRenderContext, Point(), aGraphicSize);
+ else
+ aGraphic.Draw(rRenderContext, Point(), aGraphicSize);
+
+ tools::Rectangle aRect(Point(0, aGraphicSize.Height() - TEXT_HEIGHT),
+ Size(aGraphicSize.Width(), TEXT_HEIGHT));
+
+ //transparent text background
+ ScopedVclPtrInstance<VirtualDevice> aVDev;
+ GDIMetaFile aMetafile;
+
+ aMetafile.Record(aVDev.get());
+ aMetafile.SetPrefSize(aRect.GetSize());
+ aVDev->SetOutputSize(aRect.GetSize());
+ aVDev->SetBackground(Color(0x10, 0x68, 0x02));
+ aVDev->Erase();
+ aMetafile.Stop();
+
+ Gradient aVCLGradient;
+ aVCLGradient.SetStyle(css::awt::GradientStyle_LINEAR);
+ aVCLGradient.SetStartColor(COL_GRAY);
+ aVCLGradient.SetEndColor(COL_GRAY);
+ aVCLGradient.SetStartIntensity(33);
+ aVCLGradient.SetEndIntensity(66);
+
+ rRenderContext.DrawTransparent(aMetafile, aRect.TopLeft(), aRect.GetSize(), aVCLGradient);
+
+ //text
+ vcl::Font aFont = rRenderContext.GetFont();
+ const Size aFontSize = aFont.GetFontSize();
+ aFont.SetFontSize(Size(0, 24));
+ aFont.SetColor(COL_WHITE);
+ aFont.SetWeight(WEIGHT_BOLD);
+ rRenderContext.SetFont(aFont);
+
+ DrawTextFlags nDrawTextStyle(DrawTextFlags::MultiLine | DrawTextFlags::WordBreak
+ | DrawTextFlags::EndEllipsis);
+ const bool bIsRTL = rRenderContext.GetTextIsRTL(m_sText, 0, m_sText.getLength());
+ if (bIsRTL)
+ nDrawTextStyle |= DrawTextFlags::Right;
+
+ aRect.shrink(6);
+ aRect.setWidth(rRenderContext.GetOutputSizePixel().Width() - 12);
+ rRenderContext.DrawText(aRect, m_sText, nDrawTextStyle);
+
+ aFont.SetFontSize(aFontSize);
+ aFont.SetWeight(WEIGHT_NORMAL);
+ rRenderContext.SetFont(aFont);
+}
+
+void WhatsNewProgress::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
+ const StyleSettings rSettings(Application::GetSettings().GetStyleSettings());
+ rRenderContext.SetBackground(rSettings.GetDialogColor());
+ rRenderContext.Erase();
+ rRenderContext.SetAntialiasing(AntialiasingFlags::Enable);
+
+ tools::Rectangle aRect(Point(0, 0), Size(PROGRESS_DOTSIZE, PROGRESS_DOTSIZE));
+ for (sal_Int32 i = 0; i < m_nTotal; i++)
+ {
+ if (i == m_nCurrent)
+ rRenderContext.SetFillColor(rSettings.GetAccentColor());
+ else
+ rRenderContext.SetFillColor(COL_WHITE);
+ rRenderContext.DrawEllipse(aRect);
+
+ aRect.AdjustLeft(PROGRESS_DOTSIZE + PROGRESS_DOTSPACING);
+ aRect.AdjustRight(PROGRESS_DOTSIZE + PROGRESS_DOTSPACING);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file
diff --git a/cui/source/dialogs/widgettestdlg.cxx b/cui/source/dialogs/widgettestdlg.cxx
new file mode 100644
index 000000000000..51ecef3105d0
--- /dev/null
+++ b/cui/source/dialogs/widgettestdlg.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#include <widgettestdlg.hxx>
+#include <bitmaps.hlst>
+
+WidgetTestDialog::WidgetTestDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "cui/ui/widgettestdialog.ui", "WidgetTestDialog")
+{
+ m_xOKButton = m_xBuilder->weld_button("ok_btn");
+ m_xCancelButton = m_xBuilder->weld_button("cancel_btn");
+ m_xTreeView = m_xBuilder->weld_tree_view("contenttree");
+ m_xTreeView2 = m_xBuilder->weld_tree_view("contenttree2");
+
+ m_xOKButton->connect_clicked(LINK(this, WidgetTestDialog, OkHdl));
+ m_xCancelButton->connect_clicked(LINK(this, WidgetTestDialog, CancelHdl));
+
+ FillTreeView();
+}
+
+WidgetTestDialog::~WidgetTestDialog() {}
+
+IMPL_LINK_NOARG(WidgetTestDialog, OkHdl, weld::Button&, void) { m_xDialog->response(RET_OK); }
+
+IMPL_LINK_NOARG(WidgetTestDialog, CancelHdl, weld::Button&, void)
+{
+ m_xDialog->response(RET_CANCEL);
+}
+
+void WidgetTestDialog::FillTreeView()
+{
+ OUString aImage1(RID_SVXBMP_CELL_LR);
+ OUString aImage2(RID_SVXBMP_SHADOW_BOT_LEFT);
+
+ for (size_t nCount = 0; nCount < 4; nCount++)
+ {
+ OUString sText = OUString::Concat("Test ") + OUString::Concat(OUString::number(nCount));
+ std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
+ m_xTreeView->insert(nullptr, -1, &sText, &sText, nullptr, nullptr, false, xEntry.get());
+ m_xTreeView->set_image(*xEntry, (nCount % 2 == 0) ? aImage1 : aImage2);
+
+ m_xTreeView2->append();
+ m_xTreeView2->set_image(nCount, (nCount % 2 == 0) ? aImage1 : aImage2);
+ m_xTreeView2->set_text(nCount, "First Column", 0);
+ m_xTreeView2->set_text(
+ nCount, OUString::Concat("Row ") + OUString::Concat(OUString::number(nCount)), 1);
+ m_xTreeView2->set_id(nCount, OUString::number(nCount));
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx
index 54b40e55857f..7bef6a5b9860 100644
--- a/cui/source/dialogs/zoom.cxx
+++ b/cui/source/dialogs/zoom.cxx
@@ -138,14 +138,14 @@ SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet)
, m_xBookModeChk(m_xBuilder->weld_check_button("bookmode"))
, m_xOKBtn(m_xBuilder->weld_button("ok"))
{
- Link<weld::ToggleButton&, void> aLink = LINK(this, SvxZoomDialog, UserHdl);
+ Link<weld::Toggleable&, void> aLink = LINK(this, SvxZoomDialog, UserHdl);
m_x100Btn->connect_toggled(aLink);
m_xOptimalBtn->connect_toggled(aLink);
m_xPageWidthBtn->connect_toggled(aLink);
m_xWholePageBtn->connect_toggled(aLink);
m_xUserBtn->connect_toggled(aLink);
- Link<weld::ToggleButton&, void> aViewLayoutLink = LINK(this, SvxZoomDialog, ViewLayoutUserHdl);
+ Link<weld::Toggleable&, void> aViewLayoutLink = LINK(this, SvxZoomDialog, ViewLayoutUserHdl);
m_xAutomaticBtn->connect_toggled(aViewLayoutLink);
m_xSingleBtn->connect_toggled(aViewLayoutLink);
m_xColumnsBtn->connect_toggled(aViewLayoutLink);
@@ -154,7 +154,7 @@ SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet)
= LINK(this, SvxZoomDialog, ViewLayoutSpinHdl);
m_xColumnsEdit->connect_value_changed(aViewLayoutSpinLink);
- Link<weld::ToggleButton&, void> aViewLayoutCheckLink
+ Link<weld::Toggleable&, void> aViewLayoutCheckLink
= LINK(this, SvxZoomDialog, ViewLayoutCheckHdl);
m_xBookModeChk->connect_toggled(aViewLayoutCheckLink);
@@ -168,9 +168,7 @@ SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet)
// maybe get the old value first
const SfxUInt16Item* pOldUserItem = nullptr;
- SfxObjectShell* pShell = SfxObjectShell::Current();
-
- if (pShell)
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
pOldUserItem = pShell->GetItem(SID_ATTR_ZOOM_USER);
if (pOldUserItem)
@@ -185,7 +183,7 @@ SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet)
SetLimits(nMin, nMax);
m_xUserEdit->set_value(nValue, FieldUnit::PERCENT);
- const SfxPoolItem& rItem = m_rSet.Get(m_rSet.GetPool()->GetWhich(SID_ATTR_ZOOM));
+ const SfxPoolItem& rItem = m_rSet.Get(SID_ATTR_ZOOM);
if (auto pZoomItem = dynamic_cast<const SvxZoomItem*>(&rItem))
{
@@ -228,11 +226,8 @@ SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet)
SetFactor(nZoom);
}
- const SfxPoolItem* pPoolViewLayoutItem = nullptr;
- if (SfxItemState::SET == m_rSet.GetItemState(SID_ATTR_VIEWLAYOUT, false, &pPoolViewLayoutItem))
+ if (const SvxViewLayoutItem* pViewLayoutItem = m_rSet.GetItemIfSet(SID_ATTR_VIEWLAYOUT, false))
{
- const SvxViewLayoutItem* pViewLayoutItem
- = static_cast<const SvxViewLayoutItem*>(pPoolViewLayoutItem);
const sal_uInt16 nColumns = pViewLayoutItem->GetValue();
const bool bBookMode = pViewLayoutItem->IsBookMode();
@@ -269,11 +264,11 @@ SvxZoomDialog::SvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet)
else
{
// hide view layout related controls:
- m_xViewFrame->set_sensitive(false);
+ m_xViewFrame->set_visible(false);
}
}
-IMPL_LINK_NOARG(SvxZoomDialog, UserHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxZoomDialog, UserHdl, weld::Toggleable&, void)
{
m_bModified = true;
@@ -296,7 +291,7 @@ IMPL_LINK_NOARG(SvxZoomDialog, SpinHdl, weld::MetricSpinButton&, void)
m_bModified = true;
}
-IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutUserHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutUserHdl, weld::Toggleable&, void)
{
m_bModified = true;
@@ -332,7 +327,7 @@ IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutSpinHdl, weld::SpinButton&, void)
m_bModified = true;
}
-IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutCheckHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxZoomDialog, ViewLayoutCheckHdl, weld::Toggleable&, void)
{
if (!m_xColumnsBtn->get_active())
return;
@@ -344,9 +339,8 @@ IMPL_LINK_NOARG(SvxZoomDialog, OKHdl, weld::Button&, void)
{
if (m_bModified)
{
- SvxZoomItem aZoomItem(SvxZoomType::PERCENT, 0, m_rSet.GetPool()->GetWhich(SID_ATTR_ZOOM));
- SvxViewLayoutItem aViewLayoutItem(0, false,
- m_rSet.GetPool()->GetWhich(SID_ATTR_VIEWLAYOUT));
+ SvxZoomItem aZoomItem(SvxZoomType::PERCENT, 0, SID_ATTR_ZOOM);
+ SvxViewLayoutItem aViewLayoutItem(0, false, SID_ATTR_VIEWLAYOUT);
sal_uInt16 nFactor = GetFactor();
@@ -388,9 +382,7 @@ IMPL_LINK_NOARG(SvxZoomDialog, OKHdl, weld::Button&, void)
m_pOutSet->Put(aViewLayoutItem);
// memorize value from the UserEdit beyond the dialog
- SfxObjectShell* pShell = SfxObjectShell::Current();
-
- if (pShell)
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
{
sal_uInt16 nZoomValue
= static_cast<sal_uInt16>(m_xUserEdit->get_value(FieldUnit::PERCENT));
diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx
index 06557be56779..28b83f6a8780 100644
--- a/cui/source/factory/cuiexp.cxx
+++ b/cui/source/factory/cuiexp.cxx
@@ -19,18 +19,50 @@
#include "dlgfact.hxx"
#include <sal/types.h>
+#include <cppuhelper/supportsservice.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
-namespace cui
+/// anonymous implementation namespace
+namespace
{
-static AbstractDialogFactory_Impl* GetFactory()
+class GetCreateDialogFactoryService
+ : public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::lang::XUnoTunnel>
{
- static AbstractDialogFactory_Impl* pFactory = new AbstractDialogFactory_Impl;
- return pFactory;
-}
-}
+public:
+ // css::lang::XServiceInfo:
+ virtual OUString SAL_CALL getImplementationName() override
+ {
+ return "com.sun.star.cui.GetCreateDialogFactoryService";
+ }
+ virtual sal_Bool SAL_CALL supportsService(const OUString& serviceName) override
+ {
+ return cppu::supportsService(this, serviceName);
+ }
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
+ {
+ return { "com.sun.star.cui.GetCreateDialogFactoryService" };
+ }
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL
+ getSomething(const ::css::uno::Sequence<::sal_Int8>& /*aIdentifier*/) override
+ {
+ // Noting that we have to return a pointer to **VclAbstractDialogFactory** otherwise
+ // the dynamic_casting on the other end will fail on Windows (possibly because of the virtual base involved).
+ static VclAbstractDialogFactory* pFactory = new AbstractDialogFactory_Impl;
+ return reinterpret_cast<sal_Int64>(pFactory);
+ }
+};
+
+} // closing anonymous implementation namespace
extern "C" {
-SAL_DLLPUBLIC_EXPORT VclAbstractDialogFactory* CreateDialogFactory() { return ::cui::GetFactory(); }
+SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_cui_GetCreateDialogFactoryService(css::uno::XComponentContext*,
+ css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new GetCreateDialogFactoryService);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/cuiresmgr.cxx b/cui/source/factory/cuiresmgr.cxx
index ae22515bd261..2b58e5854f6e 100644
--- a/cui/source/factory/cuiresmgr.cxx
+++ b/cui/source/factory/cuiresmgr.cxx
@@ -20,6 +20,6 @@
#include <dialmgr.hxx>
#include <unotools/resmgr.hxx>
-OUString CuiResId(const char* pKey) { return Translate::get(pKey, Translate::Create("cui")); }
+OUString CuiResId(TranslateId aKey) { return Translate::get(aKey, Translate::Create("cui")); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index d371224ffa20..9c422c4f71a6 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -18,11 +18,13 @@
*/
#include <config_extensions.h>
+#include <config_wasm_strip.h>
#include <align.hxx>
#include "dlgfact.hxx"
#include <about.hxx>
+#include <whatsnew.hxx>
#include <sfx2/app.hxx>
#include <sfx2/basedlgs.hxx>
#include <sfx2/pageids.hxx>
@@ -31,7 +33,7 @@
#include <numfmt.hxx>
#include <splitcelldlg.hxx>
#include <cuiimapwnd.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
#include <srchxtra.hxx>
#include <textanim.hxx>
#include <autocdlg.hxx>
@@ -46,7 +48,6 @@
#include <cuisrchdlg.hxx>
#include <cuitbxform.hxx>
#include <optdict.hxx>
-#include <dlgname.hxx>
#include <multipat.hxx>
#include <cuihyperdlg.hxx>
#include <cuifmsearch.hxx>
@@ -88,8 +89,11 @@
#include <hyphen.hxx>
#include <thesdlg.hxx>
#include <tipofthedaydlg.hxx>
+#include <widgettestdlg.hxx>
#include <toolbarmodedlg.hxx>
#include <DiagramDialog.hxx>
+#include <fileextcheckdlg.hxx>
+#include <TextColumnsPage.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
@@ -98,207 +102,57 @@ using namespace ::com::sun::star::container;
using ::com::sun::star::uno::Reference;
using namespace svx;
-// AbstractTabDialog implementations just forwards everything to the dialog
-short CuiAbstractController_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short CuiAbstractSingleTabController_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractHangulHanjaConversionDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractFmShowColsDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractAdditionsDialog, weld::GenericDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractDiagramDialog, DiagramDialog)
+IMPL_ABSTDLG_CLASS(AbstractFmInputRecordNoDialog)
+IMPL_ABSTDLG_CLASS(AbstractFmSearchDialog)
+IMPL_ABSTDLG_CLASS(AbstractFmShowColsDialog)
+IMPL_ABSTDLG_CLASS(AbstractGalleryIdDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractGraphicFilterDialog, GraphicFilterDialog)
+IMPL_ABSTDLG_CLASS(AbstractHangulHanjaConversionDialog)
+IMPL_ABSTDLG_CLASS(AbstractInsertObjectDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractLinksDialog, SvBaseLinksDlg)
+IMPL_ABSTDLG_CLASS(AbstractScreenshotAnnotationDlg)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSignatureLineDialog, SignatureLineDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSignSignatureLineDialog, SignSignatureLineDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxCharacterMapDialog, SvxCharacterMap)
+IMPL_ABSTDLG_CLASS(AbstractSecurityOptionsDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxHpLinkDlg)
+IMPL_ABSTDLG_CLASS(AbstractSvxJSearchOptionsDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxMultiPathDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxNameDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxNewDictionaryDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxObjectNameDialog, SvxObjectNameDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxObjectTitleDescDialog, SvxObjectTitleDescDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxPathSelectDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxPostItDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxSearchSimilarityDialog,SvxSearchSimilarityDialog)
+IMPL_ABSTDLG_CLASS(AbstractSvxZoomDialog)
+IMPL_ABSTDLG_CLASS(AbstractTitleDialog)
+IMPL_ABSTDLG_CLASS(AbstractURLDlg)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractPasswordToOpenModifyDialog,weld::DialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractQrCodeGenDialog,QrCodeGenDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractPasteDialog,SfxDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractScriptSelectorDialog,SfxDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSpellDialog,SfxDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxAreaTabDialog,SfxTabDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxCaptionDialog,SfxTabDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxTransformTabDialog,SfxTabDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractThesaurusDialog,SfxDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractControllerAsync,weld::DialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractTabController,SfxTabDialogController)
+IMPL_ABSTDLG_CLASS(CuiAbstractController)
+IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractSingleTabController, SfxSingleTabDialogController)
+IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractWidgetTestControllerAsync,weld::GenericDialogController)
short AbstractHyphenWordDialog_Impl::Execute()
{
+#if !ENABLE_WASM_STRIP_HUNSPELL
return m_xDlg->run();
-}
-
-short AbstractThesaurusDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractThesaurusDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractSvxZoomDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractTitleDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractScriptSelectorDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScriptSelectorDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractGalleryIdDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractURLDlg_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxSearchSimilarityDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxTransformTabDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractSvxTransformTabDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractSvxCaptionDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractSvxCaptionDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractSvxJSearchOptionsDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractFmInputRecordNoDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxNewDictionaryDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxNameDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-// #i68101#
-short AbstractSvxObjectNameDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxObjectTitleDescDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxMultiPathDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxPathSelectDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxHpLinkDlg_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractFmSearchDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractGraphicFilterDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxAreaTabDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractSvxAreaTabDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractPasteDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractPasteDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractInsertObjectDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractLinksDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSpellDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool AbstractSpellDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractSvxPostItDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractPasswordToOpenModifyDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSvxCharacterMapDialog_Impl::Execute()
-{
- return m_xDlg->run();
+#else
+ return 0;
+#endif
}
const SfxItemSet* AbstractSvxCharacterMapDialog_Impl::GetOutputItemSet() const
@@ -311,37 +165,7 @@ void AbstractSvxCharacterMapDialog_Impl::SetText(const OUString& rStr)
m_xDlg->set_title(rStr);
}
-short AbstractSignatureLineDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractSignSignatureLineDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractQrCodeGenDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractScreenshotAnnotationDlg_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short CuiAbstractTabController_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-bool CuiAbstractTabController_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
- return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-void CuiAbstractTabController_Impl::SetCurPageId( const OString &rName )
+void CuiAbstractTabController_Impl::SetCurPageId( const OUString &rName )
{
m_xDlg->SetCurPageId( rName );
}
@@ -351,7 +175,7 @@ const SfxItemSet* CuiAbstractTabController_Impl::GetOutputItemSet() const
return m_xDlg->GetOutputItemSet();
}
-const sal_uInt16* CuiAbstractTabController_Impl::GetInputRanges(const SfxItemPool& pItem )
+WhichRangesContainer CuiAbstractTabController_Impl::GetInputRanges(const SfxItemPool& pItem )
{
return m_xDlg->GetInputRanges( pItem );
}
@@ -367,12 +191,12 @@ void CuiAbstractTabController_Impl::SetText( const OUString& rStr )
m_xDlg->set_title(rStr);
}
-std::vector<OString> CuiAbstractTabController_Impl::getAllPageUIXMLDescriptions() const
+std::vector<OUString> CuiAbstractTabController_Impl::getAllPageUIXMLDescriptions() const
{
return m_xDlg->getAllPageUIXMLDescriptions();
}
-bool CuiAbstractTabController_Impl::selectPageByUIXMLDescription(const OString& rUIXMLDescription)
+bool CuiAbstractTabController_Impl::selectPageByUIXMLDescription(const OUString& rUIXMLDescription)
{
return m_xDlg->selectPageByUIXMLDescription(rUIXMLDescription);
}
@@ -382,7 +206,7 @@ BitmapEx CuiAbstractTabController_Impl::createScreenshot() const
return m_xDlg->createScreenshot();
}
-OString CuiAbstractTabController_Impl::GetScreenshotId() const
+OUString CuiAbstractTabController_Impl::GetScreenshotId() const
{
return m_xDlg->GetScreenshotId();
}
@@ -447,12 +271,12 @@ void AbstractHangulHanjaConversionDialog_Impl::SetChangeAllHdl( const Link<weld:
m_xDlg->SetChangeAllHdl(rHdl);
}
-void AbstractHangulHanjaConversionDialog_Impl::SetClickByCharacterHdl( const Link<weld::ToggleButton&,void>& _rHdl )
+void AbstractHangulHanjaConversionDialog_Impl::SetClickByCharacterHdl( const Link<weld::Toggleable&,void>& _rHdl )
{
m_xDlg->SetClickByCharacterHdl(_rHdl );
}
-void AbstractHangulHanjaConversionDialog_Impl::SetConversionFormatChangedHdl(const Link<weld::Button&,void>& rHdl)
+void AbstractHangulHanjaConversionDialog_Impl::SetConversionFormatChangedHdl(const Link<weld::Toggleable&,void>& rHdl)
{
m_xDlg->SetConversionFormatChangedHdl(rHdl);
}
@@ -642,7 +466,7 @@ bool AbstractSvxSearchSimilarityDialog_Impl::IsRelaxed()
}
// AbstractSvxTransformTabDialog implementations just forwards everything to the dialog
-void AbstractSvxTransformTabDialog_Impl::SetCurPageId( const OString& rName )
+void AbstractSvxTransformTabDialog_Impl::SetCurPageId( const OUString& rName )
{
m_xDlg->SetCurPageId( rName );
}
@@ -652,7 +476,7 @@ const SfxItemSet* AbstractSvxTransformTabDialog_Impl::GetOutputItemSet() const
return m_xDlg->GetOutputItemSet();
}
-const sal_uInt16* AbstractSvxTransformTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+WhichRangesContainer AbstractSvxTransformTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
{
return m_xDlg->GetInputRanges( pItem );
}
@@ -674,7 +498,7 @@ void AbstractSvxTransformTabDialog_Impl::SetValidateFramePosLink( const Link<Svx
}
// AbstractSvxCaptionDialog implementations just forwards everything to the dialog
-void AbstractSvxCaptionDialog_Impl::SetCurPageId( const OString& rName )
+void AbstractSvxCaptionDialog_Impl::SetCurPageId( const OUString& rName )
{
m_xDlg->SetCurPageId(rName);
}
@@ -684,7 +508,7 @@ const SfxItemSet* AbstractSvxCaptionDialog_Impl::GetOutputItemSet() const
return m_xDlg->GetOutputItemSet();
}
-const sal_uInt16* AbstractSvxCaptionDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+WhichRangesContainer AbstractSvxCaptionDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
{
return m_xDlg->GetInputRanges( pItem );
}
@@ -724,18 +548,18 @@ tools::Long AbstractFmInputRecordNoDialog_Impl::GetValue() const
return m_xDlg->GetNewDictionary();
}
-void AbstractSvxNameDialog_Impl::GetName(OUString& rName)
+OUString AbstractSvxNameDialog_Impl::GetName()
{
- rName = m_xDlg->GetName();
+ return m_xDlg->GetName();
}
-void AbstractSvxNameDialog_Impl::SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately )
+void AbstractSvxNameDialog_Impl::SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink )
{
aCheckNameHdl = rLink;
if( rLink.IsSet() )
- m_xDlg->SetCheckNameHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameHdl), bCheckImmediately );
+ m_xDlg->SetCheckNameHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameHdl) );
else
- m_xDlg->SetCheckNameHdl( Link<SvxNameDialog&,bool>(), bCheckImmediately );
+ m_xDlg->SetCheckNameHdl( Link<SvxNameDialog&,bool>() );
}
void AbstractSvxNameDialog_Impl::SetCheckNameTooltipHdl( const Link<AbstractSvxNameDialog&,OUString>& rLink)
@@ -747,12 +571,12 @@ void AbstractSvxNameDialog_Impl::SetCheckNameTooltipHdl( const Link<AbstractSvxN
m_xDlg->SetCheckNameTooltipHdl( Link<SvxNameDialog&,OUString>());
}
-void AbstractSvxNameDialog_Impl::SetEditHelpId(const OString& rHelpId)
+void AbstractSvxNameDialog_Impl::SetEditHelpId(const OUString& rHelpId)
{
m_xDlg->SetEditHelpId(rHelpId);
}
-void AbstractSvxNameDialog_Impl::SetHelpId(const OString& rHelpId)
+void AbstractSvxNameDialog_Impl::SetHelpId(const OUString& rHelpId)
{
m_xDlg->set_help_id(rHelpId);
}
@@ -772,9 +596,9 @@ IMPL_LINK_NOARG(AbstractSvxNameDialog_Impl, CheckNameTooltipHdl, SvxNameDialog&,
return aCheckNameTooltipHdl.Call(*this);
}
-void AbstractSvxObjectNameDialog_Impl::GetName(OUString& rName)
+OUString AbstractSvxObjectNameDialog_Impl::GetName()
{
- rName = m_xDlg->GetName();
+ return m_xDlg->GetName();
}
void AbstractSvxObjectNameDialog_Impl::SetCheckNameHdl(const Link<AbstractSvxObjectNameDialog&,bool>& rLink)
@@ -796,14 +620,19 @@ IMPL_LINK_NOARG(AbstractSvxObjectNameDialog_Impl, CheckNameHdl, SvxObjectNameDia
return aCheckNameHdl.Call(*this);
}
-void AbstractSvxObjectTitleDescDialog_Impl::GetTitle(OUString& rTitle)
+OUString AbstractSvxObjectTitleDescDialog_Impl::GetTitle()
{
- rTitle = m_xDlg->GetTitle();
+ return m_xDlg->GetTitle();
}
-void AbstractSvxObjectTitleDescDialog_Impl::GetDescription(OUString& rDescription)
+OUString AbstractSvxObjectTitleDescDialog_Impl::GetDescription()
{
- rDescription = m_xDlg->GetDescription();
+ return m_xDlg->GetDescription();
+}
+
+bool AbstractSvxObjectTitleDescDialog_Impl::IsDecorative()
+{
+ return m_xDlg->IsDecorative();
}
OUString AbstractSvxMultiPathDialog_Impl::GetPath() const
@@ -867,7 +696,7 @@ Graphic AbstractGraphicFilterDialog_Impl::GetFilteredGraphic(const Graphic& rGra
}
// AbstractSvxAreaTabDialog implementations just forwards everything to the dialog
-void AbstractSvxAreaTabDialog_Impl::SetCurPageId( const OString& rName )
+void AbstractSvxAreaTabDialog_Impl::SetCurPageId( const OUString& rName )
{
m_xDlg->SetCurPageId( rName );
}
@@ -877,7 +706,7 @@ const SfxItemSet* AbstractSvxAreaTabDialog_Impl::GetOutputItemSet() const
return m_xDlg->GetOutputItemSet();
}
-const sal_uInt16* AbstractSvxAreaTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+WhichRangesContainer AbstractSvxAreaTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
{
return m_xDlg->GetInputRanges( pItem );
}
@@ -980,52 +809,64 @@ bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const
return m_xDlg->IsRecommendToOpenReadonly();
}
+void AbstractPasswordToOpenModifyDialog_Impl::Response(sal_Int32 nResult)
+{
+ m_xDlg->response(nResult);
+}
+
+void AbstractPasswordToOpenModifyDialog_Impl::AllowEmpty()
+{
+ m_xDlg->AllowEmpty();
+}
+
// Create dialogs with simplest interface
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog(weld::Window* pParent, sal_uInt32 nResId)
{
- std::unique_ptr<OfaTreeOptionsDialog> xDlg;
switch ( nResId )
{
- case SID_OPTIONS_TREEDIALOG :
case SID_OPTIONS_DATABASES :
+ {
+ Reference< frame::XFrame > xFrame;
+ auto xDlg = std::make_shared<OfaTreeOptionsDialog>(pParent, xFrame, /*bActivateLastSelection*/false);
+ xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
+ return VclPtr<CuiAbstractControllerAsync_Impl>::Create(std::move(xDlg));
+ }
+ case SID_OPTIONS_TREEDIALOG :
case SID_LANGUAGE_OPTIONS :
{
bool bActivateLastSelection = false;
if (nResId == SID_OPTIONS_TREEDIALOG)
bActivateLastSelection = true;
Reference< frame::XFrame > xFrame;
- xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, xFrame, bActivateLastSelection);
- if (nResId == SID_OPTIONS_DATABASES)
- {
- xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
- }
- else if (nResId == SID_LANGUAGE_OPTIONS)
+ auto xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, xFrame, bActivateLastSelection);
+ if (nResId == SID_LANGUAGE_OPTIONS)
{
//open the tab page "tools/options/languages"
xDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE);
}
+ return VclPtr<CuiAbstractController_Impl>::Create(std::move(xDlg));
}
break;
+
default:
- break;
+ assert(false);
+ return nullptr;
}
-
- if (xDlg)
- return VclPtr<CuiAbstractController_Impl>::Create(std::move(xDlg));
- return nullptr;
}
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Window* pParent, const Reference< frame::XFrame >& rxFrame,
- sal_uInt32 nResId, const OUString& rParameter )
+ sal_uInt32 nResId, sal_uInt16 nPageId, const OUString& rParameter)
{
std::unique_ptr<OfaTreeOptionsDialog> xDlg;
if (SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId)
{
// only activate last page if we don't want to activate a special page
- bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() );
+ bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() && !nPageId);
xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, rxFrame, bActivateLastSelection);
if ( nResId == SID_OPTIONS_DATABASES )
xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
+ else if (nPageId)
+ xDlg->ActivatePage(nPageId);
else if ( !rParameter.isEmpty() )
xDlg->ActivatePage( rParameter );
}
@@ -1035,6 +876,16 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Wi
return nullptr;
}
+VclPtr<AbstractSecurityOptionsDialog> AbstractDialogFactory_Impl::CreateSvxSecurityOptionsDialog(weld::Window* pParent)
+{
+ return VclPtr<AbstractSecurityOptionsDialog_Impl>::Create(std::make_unique<svx::SecurityOptionsDialog>(pParent));
+}
+
+bool AbstractSecurityOptionsDialog_Impl::SetSecurityOptions()
+{
+ return m_xDlg->SetSecurityOptions();
+}
+
// TabDialog outside the drawing layer
VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet)
{
@@ -1078,12 +929,21 @@ VclPtr<AbstractThesaurusDialog> AbstractDialogFactory_Impl::CreateThesaurusDialo
return VclPtr<AbstractThesaurusDialog_Impl>::Create(std::make_shared<SvxThesaurusDialog>(pParent, xThesaurus, rWord, nLanguage));
}
-VclPtr<AbstractHyphenWordDialog> AbstractDialogFactory_Impl::CreateHyphenWordDialog(weld::Window* pParent,
+VclPtr<AbstractHyphenWordDialog> AbstractDialogFactory_Impl::CreateHyphenWordDialog(weld::Widget* pParent,
const OUString &rWord, LanguageType nLang,
css::uno::Reference< css::linguistic2::XHyphenator > &xHyphen,
SvxSpellWrapper* pWrapper)
{
+#if !ENABLE_WASM_STRIP_EXTRA
return VclPtr<AbstractHyphenWordDialog_Impl>::Create(std::make_unique<SvxHyphenWordDialog>(rWord, nLang, pParent, xHyphen, pWrapper));
+#else
+ (void) pParent;
+ (void) rWord;
+ (void) nLang;
+ (void) xHyphen;
+ (void) pWrapper;
+ return nullptr;
+#endif
}
VclPtr<AbstractFmShowColsDialog> AbstractDialogFactory_Impl::CreateFmShowColsDialog(weld::Window* pParent)
@@ -1176,7 +1036,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateTabItemDialog(wel
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxSearchAttributeDialog(weld::Window* pParent,
SearchAttrItemList& rLst,
- const sal_uInt16* pWhRanges )
+ const WhichRangesContainer& pWhRanges )
{
return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<SvxSearchAttributeDialog>(pParent, rLst, pWhRanges));
}
@@ -1245,9 +1105,9 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxEditDictionaryDia
}
VclPtr<AbstractSvxNameDialog> AbstractDialogFactory_Impl::CreateSvxNameDialog(weld::Window* pParent,
- const OUString& rName, const OUString& rDesc)
+ const OUString& rName, const OUString& rDesc, const OUString& rTitle)
{
- return VclPtr<AbstractSvxNameDialog_Impl>::Create(std::make_unique<SvxNameDialog>(pParent, rName, rDesc));
+ return VclPtr<AbstractSvxNameDialog_Impl>::Create(std::make_unique<SvxNameDialog>(pParent, rName, rDesc, rTitle));
}
VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName)
@@ -1255,9 +1115,9 @@ VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectN
return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(std::make_unique<SvxObjectNameDialog>(pParent, rName));
}
-VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription)
+VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription, bool const isDecorative)
{
- return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(std::make_unique<SvxObjectTitleDescDialog>(pParent, rTitle, rDescription));
+ return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(std::make_unique<SvxObjectTitleDescDialog>(pParent, rTitle, rDescription, isDecorative));
}
VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxMultiPathDialog(weld::Window* pParent)
@@ -1325,9 +1185,11 @@ VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFil
VclPtr<AbstractSvxAreaTabDialog> AbstractDialogFactory_Impl::CreateSvxAreaTabDialog(weld::Window* pParent,
const SfxItemSet* pAttr,
SdrModel* pModel,
- bool bShadow)
+ bool bShadow,
+ bool bSlideBackground)
{
- return VclPtr<AbstractSvxAreaTabDialog_Impl>::Create(std::make_shared<SvxAreaTabDialog>(pParent, pAttr, pModel, bShadow));
+ return VclPtr<AbstractSvxAreaTabDialog_Impl>::Create(
+ std::make_shared<SvxAreaTabDialog>(pParent, pAttr, pModel, bShadow, bSlideBackground));
}
VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog
@@ -1378,46 +1240,34 @@ VclPtr<AbstractSvxPostItDialog> AbstractDialogFactory_Impl::CreateSvxPostItDialo
namespace {
-class SvxMacroAssignDialog : public VclAbstractDialog
+class SvxMacroAssignDialog_Impl : public VclAbstractDialog
{
public:
- SvxMacroAssignDialog( weld::Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode,
+ SvxMacroAssignDialog_Impl( weld::Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode,
const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent )
- :m_aItems( SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM>{} )
+ :m_aItems( SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM> )
{
m_aItems.Put( SfxBoolItem( SID_ATTR_MACROITEM, _bUnoDialogMode ) );
- m_xDialog.reset(new SvxMacroAssignDlg(_pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent));
+ m_xDlg = std::make_shared<SvxMacroAssignDlg>(_pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent);
}
virtual short Execute() override;
+ virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
private:
SfxItemSet m_aItems;
- std::unique_ptr<SvxMacroAssignDlg> m_xDialog;
+ std::shared_ptr<SvxMacroAssignDlg> m_xDlg;
};
+IMPL_ABSTDLG_CLASS_ASYNC(SvxMacroAssignDialog, SvxMacroAssignDlg)
}
-short SvxMacroAssignDialog::Execute()
-{
- return m_xDialog->run();
-}
-
-short AbstractAdditionsDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractDiagramDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxMacroAssignDlg(
weld::Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode,
const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent )
{
- return VclPtr<SvxMacroAssignDialog>::Create( _pParent, _rxDocumentFrame, _bUnoDialogMode, _rxEvents, _nInitiallySelectedEvent );
+ return VclPtr<SvxMacroAssignDialog_Impl>::Create(_pParent, _rxDocumentFrame, _bUnoDialogMode, _rxEvents, _nInitiallySelectedEvent);
}
// Factories for TabPages
@@ -1488,6 +1338,8 @@ CreateTabPage AbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nId
return SvxGrfCropPage::Create;
case RID_SVXPAGE_MACROASSIGN :
return SfxMacroTabPage::Create;
+ case RID_SVXPAGE_TEXTCOLUMNS:
+ return SvxTextColumnsPage::Create;
default:
break;
}
@@ -1551,6 +1403,8 @@ GetTabPageRanges AbstractDialogFactory_Impl::GetTabPageRangesFunc( sal_uInt16 nI
return SvxPageDescPage::GetRanges;
case RID_SVXPAGE_ASIAN_LAYOUT:
return SvxAsianLayoutPage::GetRanges;
+ case RID_SVXPAGE_TEXTCOLUMNS:
+ return SvxTextColumnsPage::GetRanges;
default:
break;
}
@@ -1569,7 +1423,7 @@ VclPtr<SfxAbstractInsertObjectDialog> AbstractDialogFactory_Impl::CreateInsertOb
if ( pDlg )
{
- pDlg->SetHelpId( OUStringToOString( rCommand, RTL_TEXTENCODING_UTF8 ) );
+ pDlg->SetHelpId(rCommand);
return VclPtr<AbstractInsertObjectDialog_Impl>::Create( std::move(pDlg) );
}
return nullptr;
@@ -1581,7 +1435,7 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateEditObjectDialog(wel
if ( rCommand == ".uno:InsertObjectFloatingFrame" )
{
auto pDlg = std::make_unique<SfxInsertFloatingFrameDialog>(pParent, xObj);
- pDlg->SetHelpId( OUStringToOString( rCommand, RTL_TEXTENCODING_UTF8 ) );
+ pDlg->SetHelpId(rCommand);
return VclPtr<AbstractInsertObjectDialog_Impl>::Create( std::move(pDlg) );
}
return nullptr;
@@ -1600,9 +1454,9 @@ VclPtr<SfxAbstractLinksDialog> AbstractDialogFactory_Impl::CreateLinksDialog(wel
return VclPtr<AbstractLinksDialog_Impl>::Create(std::move(xLinkDlg));
}
-VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel)
+VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet& rAttr, const SdrModel& rModel, bool bStyle)
{
- return VclPtr<CuiAbstractTabController_Impl>::Create(std::make_shared<SvxFormatCellsDialog>(pParent, pAttr, rModel));
+ return VclPtr<CuiAbstractTabController_Impl>::Create(std::make_shared<SvxFormatCellsDialog>(pParent, rAttr, rModel, bStyle));
}
VclPtr<SvxAbstractSplitTableDialog> AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical)
@@ -1620,9 +1474,9 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateOptionsDialog(weld::
return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<OfaTreeOptionsDialog>(pParent, rExtensionId));
}
-VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId)
+VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OUString& rHelpId)
{
- return VclPtr<SvxInsRowColDlg>::Create(pParent, bCol, rHelpId);
+ return VclPtr<SvxAbstractInsRowColDlg_Impl>::Create(std::make_shared<SvxInsRowColDlg>(pParent, bCol, rHelpId));
}
VclPtr<AbstractPasswordToOpenModifyDialog> AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog(
@@ -1655,7 +1509,7 @@ VclPtr<AbstractQrCodeGenDialog> AbstractDialogFactory_Impl::CreateQrCodeGenDialo
weld::Window* pParent, const Reference<XModel> xModel, bool bEditExisting)
{
return VclPtr<AbstractQrCodeGenDialog_Impl>::Create(
- std::make_unique<QrCodeGenDialog>(pParent, xModel, bEditExisting));
+ std::make_shared<QrCodeGenDialog>(pParent, xModel, bEditExisting));
}
VclPtr<AbstractAdditionsDialog> AbstractDialogFactory_Impl::CreateAdditionsDialog(
@@ -1667,22 +1521,47 @@ VclPtr<AbstractAdditionsDialog> AbstractDialogFactory_Impl::CreateAdditionsDialo
#else
(void) pParent;
(void) sAdditionsTag;
- return VclPtr<AbstractAdditionsDialog>(nullptr);
+ return nullptr;
#endif
}
VclPtr<VclAbstractDialog>
AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent)
{
- return VclPtr<CuiAbstractController_Impl>::Create(
- std::make_unique<AboutDialog>(pParent));
+ return VclPtr<CuiAbstractControllerAsync_Impl>::Create(
+ std::make_shared<AboutDialog>(pParent));
+}
+
+VclPtr<VclAbstractDialog>
+AbstractDialogFactory_Impl::CreateWhatsNewDialog(weld::Window* pParent, const bool bWelcome)
+{
+#if !ENABLE_WASM_STRIP_PINGUSER
+ return VclPtr<CuiAbstractControllerAsync_Impl>::Create(
+ std::make_shared<WhatsNewDialog>(pParent, bWelcome));
+#else
+ (void) pParent;
+ (void) bWelcome;
+ return nullptr;
+#endif
}
VclPtr<VclAbstractDialog>
AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent)
{
- return VclPtr<CuiAbstractController_Impl>::Create(
- std::make_unique<TipOfTheDayDialog>(pParent));
+#if !ENABLE_WASM_STRIP_PINGUSER
+ return VclPtr<CuiAbstractControllerAsync_Impl>::Create(
+ std::make_shared<TipOfTheDayDialog>(pParent));
+#else
+ (void) pParent;
+ return nullptr;
+#endif
+}
+
+VclPtr<VclAbstractDialog>
+AbstractDialogFactory_Impl::CreateWidgetTestDialog(weld::Window* pParent)
+{
+ return VclPtr<CuiAbstractWidgetTestControllerAsync_Impl>::Create(
+ std::make_shared<WidgetTestDialog>(pParent));
}
VclPtr<VclAbstractDialog>
@@ -1693,10 +1572,22 @@ AbstractDialogFactory_Impl::CreateToolbarmodeDialog(weld::Window* pParent)
}
VclPtr<AbstractDiagramDialog>
-AbstractDialogFactory_Impl::CreateDiagramDialog(weld::Window* pParent, std::shared_ptr<DiagramDataInterface> pDiagramData)
+AbstractDialogFactory_Impl::CreateDiagramDialog(
+ weld::Window* pParent,
+ SdrObjGroup& rDiagram)
{
return VclPtr<AbstractDiagramDialog_Impl>::Create(
- std::make_unique<DiagramDialog>(pParent, pDiagramData));
+ std::make_unique<DiagramDialog>(pParent, rDiagram));
}
+#ifdef _WIN32
+VclPtr<VclAbstractDialog>
+AbstractDialogFactory_Impl::CreateFileExtCheckDialog(weld::Window* pParent, const OUString& sTitle,
+ const OUString& sMsg)
+{
+ return VclPtr<CuiAbstractController_Impl>::Create(
+ std::make_unique<FileExtCheckDialog>(pParent, sTitle, sMsg));
+}
+#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 7d97167193b8..6b4a548fe3fc 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -26,7 +26,8 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <cfgutil.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
+#include <dlgname.hxx>
#include <cuifmsearch.hxx>
#include <cuigaldlg.hxx>
#include <cuigrfflt.hxx>
@@ -35,7 +36,6 @@
#include <cuisrchdlg.hxx>
#include <cuitabarea.hxx>
#include <cuitbxform.hxx>
-#include <dlgname.hxx>
#include <DiagramDialog.hxx>
#include <hangulhanjadlg.hxx>
#include <hyphen.hxx>
@@ -49,6 +49,7 @@
#include <postdlg.hxx>
#include <QrCodeGenDialog.hxx>
#include <screenshotannotationdlg.hxx>
+#include <securityoptions.hxx>
#include <showcols.hxx>
#include <SignatureLineDialog.hxx>
#include <SignSignatureLineDialog.hxx>
@@ -59,116 +60,84 @@
#include <zoom.hxx>
#include <AdditionsDialog.hxx>
-class SfxSingleTabDialogController;
-class SfxItemPool;
-class FmShowColsDialog;
-class SvxZoomDialog;
-class FmInputRecordNoDialog;
-class SvxJSearchOptionsDialog;
-class SvxNewDictionaryDialog;
-class SvxNameDialog;
+#define DECL_ABSTDLG_CLASS_(Class,Base,Dialog,StdPtr) \
+class Class##_Impl final : public Base \
+{ \
+ StdPtr<Dialog> m_xDlg; \
+public: \
+ explicit Class##_Impl(StdPtr<Dialog> p) : m_xDlg(std::move(p)) {} \
+ virtual short Execute() override;
-// #i68101#
-class SvxObjectNameDialog;
-class SvxObjectTitleDescDialog;
+#define DECL_ABSTDLG_CLASS_UNIQUE(Class,Base,Dialog) \
+DECL_ABSTDLG_CLASS_(Class,Base,Dialog,std::unique_ptr)
-class SvxMultiPathDialog;
-class SvxHpLinkDlg;
-class FmSearchDialog;
-class Graphic;
-class GraphicFilterDialog;
-class SvxAreaTabDialog;
-class InsertObjectDialog_Impl;
-class SvPasteObjectDialog;
-class SvBaseLinksDlg;
-class SvxTransformTabDialog;
-class SvxCaptionTabDialog;
-class SvxThesaurusDialog;
-class SvxHyphenWordDialog;
-
-namespace svx{
-class HangulHanjaConversionDialog;
+#define DECL_ABSTDLG_CLASS_SHARED(Class,Base,Dialog) \
+DECL_ABSTDLG_CLASS_(Class,Base,Dialog,std::shared_ptr)
+
+#define IMPL_ABSTDLG_CLASS(Class) \
+short Class##_Impl::Execute() \
+{ \
+ return m_xDlg->run(); \
}
-using namespace svx;
-
-#define DECL_ABSTDLG_BASE(Class,DialogClass) \
- ScopedVclPtr<DialogClass> pDlg; \
-public: \
- explicit Class( DialogClass* p) \
- : pDlg(p) \
- {} \
- virtual short Execute() override; \
- virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-
-#define IMPL_ABSTDLG_BASE(Class) \
-short Class::Execute() \
-{ \
- return pDlg->Execute(); \
-} \
-bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \
-{ \
- return pDlg->StartExecuteAsync(rCtx); \
+
+#define DECL_ABSTDLG_CLASS(Class,Dialog) \
+DECL_ABSTDLG_CLASS_UNIQUE(Class,Class,Dialog)
+
+// Async AKA std::shared_ptr
+
+#define DECL_ABSTDLG_CLASS_SHARED_ASYNC(Class,Base,Dialog) \
+DECL_ABSTDLG_CLASS_SHARED(Class,Base,Dialog) \
+ virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+
+#define DECL_ABSTDLG_CLASS_ASYNC(Class,Dialog) \
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(Class,Class,Dialog)
+
+#define IMPL_ABSTDLG_CLASS_ASYNC(Class,Dialog) \
+short Class##_Impl::Execute() \
+{ \
+ return m_xDlg->run(); \
+} \
+bool Class##_Impl::StartExecuteAsync(AsyncContext &rCtx) \
+{ \
+ return Dialog::runAsync(m_xDlg, rCtx.maEndDialogFn); \
}
-class CuiAbstractController_Impl : public VclAbstractDialog
-{
- std::unique_ptr<weld::DialogController> m_xDlg;
-public:
- explicit CuiAbstractController_Impl(std::unique_ptr<weld::DialogController> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// CuiAbstractController_Impl
+DECL_ABSTDLG_CLASS_UNIQUE(CuiAbstractController, VclAbstractDialog, weld::DialogController)
};
-class CuiAbstractSingleTabController_Impl : public SfxAbstractDialog
-{
- std::unique_ptr<SfxSingleTabDialogController> m_xDlg;
-public:
- explicit CuiAbstractSingleTabController_Impl(std::unique_ptr<SfxSingleTabDialogController> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual const SfxItemSet* GetOutputItemSet() const override;
+// CuiAbstractControllerAsync_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(CuiAbstractControllerAsync, VclAbstractDialog, weld::DialogController)
+};
+// CuiAbstractWidgetTestControllerAsync_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(CuiAbstractWidgetTestControllerAsync, VclAbstractDialog, weld::GenericDialogController)
+};
+
+// CuiAbstractSingleTabController_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(CuiAbstractSingleTabController, SfxAbstractDialog, SfxSingleTabDialogController)
+ virtual const SfxItemSet* GetOutputItemSet() const override;
//From class Window.
virtual void SetText( const OUString& rStr ) override;
};
-class CuiAbstractTabController_Impl : public SfxAbstractTabDialog
-{
- std::shared_ptr<SfxTabDialogController> m_xDlg;
-public:
- explicit CuiAbstractTabController_Impl(std::shared_ptr<SfxTabDialogController> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
- virtual void SetCurPageId( const OString &rName ) override;
+// CuiAbstractTabController_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(CuiAbstractTabController, SfxAbstractTabDialog, SfxTabDialogController)
+ virtual void SetCurPageId( const OUString &rName ) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
- virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override;
+ virtual WhichRangesContainer GetInputRanges( const SfxItemPool& pItem ) override;
virtual void SetInputSet( const SfxItemSet* pInSet ) override;
virtual void SetText( const OUString& rStr ) override;
// screenshotting
- virtual std::vector<OString> getAllPageUIXMLDescriptions() const override;
- virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override;
+ virtual std::vector<OUString> getAllPageUIXMLDescriptions() const override;
+ virtual bool selectPageByUIXMLDescription(const OUString& rUIXMLDescription) override;
virtual BitmapEx createScreenshot() const override;
- virtual OString GetScreenshotId() const override;
+ virtual OUString GetScreenshotId() const override;
};
-class AbstractHangulHanjaConversionDialog_Impl: public AbstractHangulHanjaConversionDialog
-{
-private:
- std::unique_ptr<HangulHanjaConversionDialog> m_xDlg;
-public:
- explicit AbstractHangulHanjaConversionDialog_Impl(std::unique_ptr<HangulHanjaConversionDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractHangulHanjaConversionDialog_Impl
+DECL_ABSTDLG_CLASS_UNIQUE(AbstractHangulHanjaConversionDialog,AbstractHangulHanjaConversionDialog,svx::HangulHanjaConversionDialog)
virtual void EndDialog(sal_Int32 nResult) override;
virtual void EnableRubySupport( bool _bVal ) override;
virtual void SetByCharacter( bool _bByCharacter ) override ;
@@ -179,8 +148,8 @@ public:
virtual void SetIgnoreAllHdl( const Link<weld::Button&,void>& _rHdl ) override ;
virtual void SetChangeHdl( const Link<weld::Button&,void>& _rHdl ) override ;
virtual void SetChangeAllHdl( const Link<weld::Button&,void>& rHdl ) override ;
- virtual void SetClickByCharacterHdl( const Link<weld::ToggleButton&,void>& rHdl ) override ;
- virtual void SetConversionFormatChangedHdl( const Link<weld::Button&,void>& _rHdl ) override ;
+ virtual void SetClickByCharacterHdl( const Link<weld::Toggleable&,void>& rHdl ) override ;
+ virtual void SetConversionFormatChangedHdl( const Link<weld::Toggleable&,void>& _rHdl ) override ;
virtual void SetFindHdl( const Link<weld::Button&,void>& _rHdl ) override;
virtual bool GetUseBothDirections( ) const override;
virtual editeng::HangulHanjaConversion::ConversionDirection
@@ -197,129 +166,53 @@ public:
virtual OUString GetCurrentSuggestion( ) const override;
};
-class AbstractThesaurusDialog_Impl : public AbstractThesaurusDialog
-{
- std::shared_ptr<SvxThesaurusDialog> m_xDlg;
-public:
- explicit AbstractThesaurusDialog_Impl(std::shared_ptr<SvxThesaurusDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+// AbstractThesaurusDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractThesaurusDialog,SvxThesaurusDialog)
virtual OUString GetWord() override;
};
-class AbstractHyphenWordDialog_Impl: public AbstractHyphenWordDialog
-{
- std::unique_ptr<SvxHyphenWordDialog> m_xDlg;
-public:
- explicit AbstractHyphenWordDialog_Impl(std::unique_ptr<SvxHyphenWordDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractHyphenWordDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractHyphenWordDialog,SvxHyphenWordDialog)
};
-class FmShowColsDialog;
-class AbstractFmShowColsDialog_Impl : public AbstractFmShowColsDialog
-{
- std::unique_ptr<FmShowColsDialog> m_xDlg;
-public:
- explicit AbstractFmShowColsDialog_Impl(std::unique_ptr<FmShowColsDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractFmShowColsDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractFmShowColsDialog,FmShowColsDialog)
virtual void SetColumns(const css::uno::Reference< css::container::XIndexContainer>& xCols) override;
};
-class SvxZoomDialog;
-class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog
-{
- std::unique_ptr<SvxZoomDialog> m_xDlg;
-public:
- explicit AbstractSvxZoomDialog_Impl(std::unique_ptr<SvxZoomDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxZoomDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSvxZoomDialog,SvxZoomDialog)
virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) override;
virtual void HideButton( ZoomButtonId nBtnId ) override;
virtual const SfxItemSet* GetOutputItemSet() const override ;
};
-namespace svx{ class SpellDialog;}
-class AbstractSpellDialog_Impl : public AbstractSpellDialog
-{
- std::shared_ptr<svx::SpellDialog> m_xDlg;
-public:
- explicit AbstractSpellDialog_Impl(std::shared_ptr<svx::SpellDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+// AbstractSpellDialog_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractSpellDialog, AbstractSpellDialog, svx::SpellDialog)
virtual void InvalidateDialog() override;
virtual std::shared_ptr<SfxDialogController> GetController() override;
virtual SfxBindings& GetBindings() override;
};
-class TitleDialog;
-class AbstractTitleDialog_Impl : public AbstractTitleDialog
-{
-protected:
- std::unique_ptr<TitleDialog> m_xDlg;
-public:
- explicit AbstractTitleDialog_Impl(std::unique_ptr<TitleDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractTitleDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractTitleDialog,TitleDialog)
virtual OUString GetTitle() const override ;
};
-class SvxScriptSelectorDialog;
-class AbstractScriptSelectorDialog_Impl : public AbstractScriptSelectorDialog
-{
- std::shared_ptr<SvxScriptSelectorDialog> m_xDlg;
-public:
- explicit AbstractScriptSelectorDialog_Impl(std::shared_ptr<SvxScriptSelectorDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+// AbstractScriptSelectorDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractScriptSelectorDialog,SvxScriptSelectorDialog)
virtual OUString GetScriptURL() const override;
virtual void SetRunLabel() override;
};
-class GalleryIdDialog;
-class AbstractGalleryIdDialog_Impl : public AbstractGalleryIdDialog
-{
-protected:
- std::unique_ptr<GalleryIdDialog> m_xDlg;
-public:
- explicit AbstractGalleryIdDialog_Impl(std::unique_ptr<GalleryIdDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractGalleryIdDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractGalleryIdDialog,GalleryIdDialog)
virtual sal_uInt32 GetId() const override;
};
-class URLDlg;
-class AbstractURLDlg_Impl :public AbstractURLDlg
-{
-protected:
- std::unique_ptr<URLDlg> m_xDlg;
-public:
- explicit AbstractURLDlg_Impl(std::unique_ptr<URLDlg> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractURLDlg_Impl
+DECL_ABSTDLG_CLASS(AbstractURLDlg, URLDlg)
virtual OUString GetURL() const override;
virtual OUString GetAltText() const override;
virtual OUString GetDesc() const override;
@@ -327,116 +220,61 @@ public:
virtual OUString GetName() const override;
};
-class SvxSearchSimilarityDialog;
-class AbstractSvxSearchSimilarityDialog_Impl :public AbstractSvxSearchSimilarityDialog
-{
- std::unique_ptr<SvxSearchSimilarityDialog> m_xDlg;
-public:
- explicit AbstractSvxSearchSimilarityDialog_Impl(std::unique_ptr<SvxSearchSimilarityDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxSearchSimilarityDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSvxSearchSimilarityDialog,SvxSearchSimilarityDialog)
virtual sal_uInt16 GetOther() override;
virtual sal_uInt16 GetShorter() override;
virtual sal_uInt16 GetLonger() override;
virtual bool IsRelaxed() override;
};
-class SvxJSearchOptionsDialog;
-class AbstractSvxJSearchOptionsDialog_Impl : public AbstractSvxJSearchOptionsDialog
-{
- std::unique_ptr<SvxJSearchOptionsDialog> m_xDlg;
-public:
- explicit AbstractSvxJSearchOptionsDialog_Impl(std::unique_ptr<SvxJSearchOptionsDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxJSearchOptionsDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSvxJSearchOptionsDialog,SvxJSearchOptionsDialog)
virtual TransliterationFlags GetTransliterationFlags() const override;
};
-class AbstractSvxTransformTabDialog_Impl : public AbstractSvxTransformTabDialog
-{
- std::shared_ptr<SvxTransformTabDialog> m_xDlg;
-public:
- explicit AbstractSvxTransformTabDialog_Impl(std::shared_ptr<SvxTransformTabDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+// AbstractSvxTransformTabDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSvxTransformTabDialog,SvxTransformTabDialog)
virtual void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ) override;
- virtual void SetCurPageId( const OString& rName ) override;
+ virtual void SetCurPageId( const OUString& rName ) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
- virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override;
+ virtual WhichRangesContainer GetInputRanges( const SfxItemPool& pItem ) override;
virtual void SetInputSet( const SfxItemSet* pInSet ) override;
virtual void SetText( const OUString& rStr ) override;
};
-class AbstractSvxCaptionDialog_Impl : public AbstractSvxCaptionDialog
-{
- std::shared_ptr<SvxCaptionTabDialog> m_xDlg;
-public:
- explicit AbstractSvxCaptionDialog_Impl(std::shared_ptr<SvxCaptionTabDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+// AbstractSvxCaptionDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSvxCaptionDialog,SvxCaptionTabDialog)
virtual void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ) override;
- virtual void SetCurPageId( const OString& rName ) override;
+ virtual void SetCurPageId( const OUString& rName ) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
- virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override;
+ virtual WhichRangesContainer GetInputRanges( const SfxItemPool& pItem ) override;
virtual void SetInputSet( const SfxItemSet* pInSet ) override;
virtual void SetText( const OUString& rStr ) override;
};
-class FmInputRecordNoDialog;
-class AbstractFmInputRecordNoDialog_Impl :public AbstractFmInputRecordNoDialog
-{
- std::unique_ptr<FmInputRecordNoDialog> m_xDlg;
-public:
- explicit AbstractFmInputRecordNoDialog_Impl(std::unique_ptr<FmInputRecordNoDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractFmInputRecordNoDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractFmInputRecordNoDialog,FmInputRecordNoDialog)
virtual void SetValue(tools::Long nNew) override ;
virtual tools::Long GetValue() const override ;
};
-class SvxNewDictionaryDialog;
-class AbstractSvxNewDictionaryDialog_Impl :public AbstractSvxNewDictionaryDialog
-{
- std::unique_ptr<SvxNewDictionaryDialog> m_xDlg;
-public:
- explicit AbstractSvxNewDictionaryDialog_Impl(std::unique_ptr<SvxNewDictionaryDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxNewDictionaryDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSvxNewDictionaryDialog,SvxNewDictionaryDialog)
virtual css::uno::Reference< css::linguistic2::XDictionary > GetNewDictionary() override;
};
-class SvxNameDialog;
-class AbstractSvxNameDialog_Impl :public AbstractSvxNameDialog
-{
-public:
- explicit AbstractSvxNameDialog_Impl(std::unique_ptr<SvxNameDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual void GetName( OUString& rName ) override ;
- virtual void SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately = false ) override ;
+// AbstractSvxNameDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSvxNameDialog,SvxNameDialog)
+ virtual OUString GetName() override;
+ virtual void SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink ) override ;
virtual void SetCheckNameTooltipHdl( const Link<AbstractSvxNameDialog&, OUString>& rLink ) override ;
- virtual void SetEditHelpId(const OString&) override ;
+ virtual void SetEditHelpId(const OUString&) override ;
//from class Window
- virtual void SetHelpId( const OString& ) override ;
+ virtual void SetHelpId( const OUString& ) override ;
virtual void SetText( const OUString& rStr ) override ;
+
private:
- std::unique_ptr<SvxNameDialog> m_xDlg;
Link<AbstractSvxNameDialog&,bool> aCheckNameHdl;
Link<AbstractSvxNameDialog&,OUString> aCheckNameTooltipHdl;
DECL_LINK(CheckNameHdl, SvxNameDialog&, bool);
@@ -446,152 +284,74 @@ private:
class SvxObjectNameDialog;
class SvxObjectTitleDescDialog;
-class AbstractSvxObjectNameDialog_Impl : public AbstractSvxObjectNameDialog
-{
-public:
- explicit AbstractSvxObjectNameDialog_Impl(std::unique_ptr<SvxObjectNameDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual void GetName(OUString& rName) override ;
+// AbstractSvxObjectNameDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSvxObjectNameDialog,SvxObjectNameDialog)
+ virtual OUString GetName() override;
virtual void SetCheckNameHdl(const Link<AbstractSvxObjectNameDialog&,bool>& rLink) override;
private:
- std::unique_ptr<SvxObjectNameDialog> m_xDlg;
Link<AbstractSvxObjectNameDialog&,bool> aCheckNameHdl;
DECL_LINK(CheckNameHdl, SvxObjectNameDialog&, bool);
};
-class AbstractSvxObjectTitleDescDialog_Impl :public AbstractSvxObjectTitleDescDialog
-{
- std::unique_ptr<SvxObjectTitleDescDialog> m_xDlg;
-public:
- explicit AbstractSvxObjectTitleDescDialog_Impl(std::unique_ptr<SvxObjectTitleDescDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual void GetTitle(OUString& rName) override;
- virtual void GetDescription(OUString& rName) override;
+// AbstractSvxObjectTitleDescDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSvxObjectTitleDescDialog,SvxObjectTitleDescDialog)
+ virtual OUString GetTitle() override;
+ virtual OUString GetDescription() override;
+ virtual bool IsDecorative() override;
};
-class AbstractSvxMultiPathDialog_Impl : public AbstractSvxMultiPathDialog
-{
- std::unique_ptr<SvxMultiPathDialog> m_xDlg;
-public:
- explicit AbstractSvxMultiPathDialog_Impl(std::unique_ptr<SvxMultiPathDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxMultiPathDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSvxMultiPathDialog,SvxMultiPathDialog)
virtual OUString GetPath() const override;
virtual void SetPath( const OUString& rPath ) override;
virtual void SetTitle( const OUString& rNewTitle ) override;
};
-class SvxPathSelectDialog;
-class AbstractSvxPathSelectDialog_Impl : public AbstractSvxMultiPathDialog
-{
-protected:
- std::unique_ptr<SvxPathSelectDialog> m_xDlg;
-public:
- explicit AbstractSvxPathSelectDialog_Impl(std::unique_ptr<SvxPathSelectDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxPathSelectDialog_Impl
+DECL_ABSTDLG_CLASS_UNIQUE(AbstractSvxPathSelectDialog,AbstractSvxMultiPathDialog,SvxPathSelectDialog)
virtual OUString GetPath() const override;
virtual void SetPath( const OUString& rPath ) override;
virtual void SetTitle( const OUString& rNewTitle ) override;
};
-class SvxHpLinkDlg;
-class AbstractSvxHpLinkDlg_Impl : public AbstractSvxHpLinkDlg
-{
-protected:
- std::shared_ptr<SvxHpLinkDlg> m_xDlg;
-public:
- explicit AbstractSvxHpLinkDlg_Impl(std::shared_ptr<SvxHpLinkDlg> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxHpLinkDlg_Impl
+DECL_ABSTDLG_CLASS_SHARED(AbstractSvxHpLinkDlg,AbstractSvxHpLinkDlg,SvxHpLinkDlg)
virtual std::shared_ptr<SfxDialogController> GetController() override;
virtual bool QueryClose() override;
};
-class FmSearchDialog;
+// AbstractFmSearchDialog_Impl
struct FmFoundRecordInformation;
-class AbstractFmSearchDialog_Impl :public AbstractFmSearchDialog
-{
- std::unique_ptr<FmSearchDialog> m_xDlg;
-public:
- explicit AbstractFmSearchDialog_Impl(std::unique_ptr<FmSearchDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+DECL_ABSTDLG_CLASS(AbstractFmSearchDialog,FmSearchDialog)
virtual void SetFoundHandler(const Link<FmFoundRecordInformation&,void>& lnk) override ;
virtual void SetCanceledNotFoundHdl(const Link<FmFoundRecordInformation&,void>& lnk) override;
virtual void SetActiveField(const OUString& strField) override;
};
-class AbstractGraphicFilterDialog_Impl : public AbstractGraphicFilterDialog
-{
- std::unique_ptr<GraphicFilterDialog> m_xDlg;
-public:
- explicit AbstractGraphicFilterDialog_Impl(std::unique_ptr<GraphicFilterDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractGraphicFilterDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractGraphicFilterDialog,GraphicFilterDialog)
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
};
-class SvxAreaTabDialog;
-class AbstractSvxAreaTabDialog_Impl : public AbstractSvxAreaTabDialog
-{
- std::shared_ptr<SvxAreaTabDialog> m_xDlg;
-public:
- explicit AbstractSvxAreaTabDialog_Impl(std::shared_ptr<SvxAreaTabDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
- virtual void SetCurPageId(const OString& rName) override;
+// AbstractSvxAreaTabDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSvxAreaTabDialog,SvxAreaTabDialog)
+ virtual void SetCurPageId(const OUString& rName) override;
virtual const SfxItemSet* GetOutputItemSet() const override;
- virtual const sal_uInt16* GetInputRanges(const SfxItemPool& pItem) override;
+ virtual WhichRangesContainer GetInputRanges( const SfxItemPool& pItem ) override;
virtual void SetInputSet(const SfxItemSet* pInSet) override;
virtual void SetText(const OUString& rStr) override;
};
-class AbstractInsertObjectDialog_Impl : public SfxAbstractInsertObjectDialog
-{
- std::unique_ptr<InsertObjectDialog_Impl> m_xDlg;
-public:
- explicit AbstractInsertObjectDialog_Impl(std::unique_ptr<InsertObjectDialog_Impl> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractInsertObjectDialog_Impl
+DECL_ABSTDLG_CLASS_UNIQUE(AbstractInsertObjectDialog,SfxAbstractInsertObjectDialog,InsertObjectDialog_Impl)
virtual css::uno::Reference < css::embed::XEmbeddedObject > GetObject() override;
virtual css::uno::Reference< css::io::XInputStream > GetIconIfIconified( OUString* pGraphicMediaType ) override;
virtual bool IsCreateNew() override;
};
-class AbstractPasteDialog_Impl : public SfxAbstractPasteDialog
-{
- std::shared_ptr<SvPasteObjectDialog> m_xDlg;
-public:
- explicit AbstractPasteDialog_Impl(std::shared_ptr<SvPasteObjectDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
- virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
-public:
+// AbstractPasteDialog_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractPasteDialog,SfxAbstractPasteDialog,SvPasteObjectDialog)
virtual void Insert( SotClipboardFormatId nFormat, const OUString & rFormatName ) override;
virtual void InsertUno( const OUString & sCmd, const OUString& sLabel ) override;
virtual void SetObjName( const SvGlobalName & rClass, const OUString & rObjName ) override;
@@ -600,27 +360,12 @@ public:
virtual SotClipboardFormatId GetFormat( const TransferableDataHelper& aHelper ) override;
};
-class AbstractLinksDialog_Impl : public SfxAbstractLinksDialog
-{
-protected:
- std::unique_ptr<SvBaseLinksDlg> m_xDlg;
-public:
- explicit AbstractLinksDialog_Impl(std::unique_ptr<SvBaseLinksDlg> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractLinksDialog_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractLinksDialog,SfxAbstractLinksDialog,SvBaseLinksDlg)
};
-class SvxPostItDialog;
-class AbstractSvxPostItDialog_Impl :public AbstractSvxPostItDialog
-{
-public:
- AbstractSvxPostItDialog_Impl(std::unique_ptr<SvxPostItDialog> pDlg)
- : m_xDlg(std::move(pDlg))
- {
- }
- virtual short Execute() override;
+// AbstractSvxPostItDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSvxPostItDialog,SvxPostItDialog)
virtual void SetText( const OUString& rStr ) override; //From class Window
virtual const SfxItemSet* GetOutputItemSet() const override;
virtual void SetPrevHdl( const Link<AbstractSvxPostItDialog&,void>& rLink ) override;
@@ -633,122 +378,56 @@ public:
virtual void HideAuthor() override;
virtual std::shared_ptr<weld::Dialog> GetDialog() override;
private:
- std::unique_ptr<SvxPostItDialog> m_xDlg;
Link<AbstractSvxPostItDialog&,void> aNextHdl;
Link<AbstractSvxPostItDialog&,void> aPrevHdl;
DECL_LINK(NextHdl, SvxPostItDialog&, void);
DECL_LINK(PrevHdl, SvxPostItDialog&, void);
};
-class PasswordToOpenModifyDialog;
-class AbstractPasswordToOpenModifyDialog_Impl : public AbstractPasswordToOpenModifyDialog
-{
- std::unique_ptr<PasswordToOpenModifyDialog> m_xDlg;
-public:
- explicit AbstractPasswordToOpenModifyDialog_Impl(std::unique_ptr<PasswordToOpenModifyDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractPasswordToOpenModifyDialog_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractPasswordToOpenModifyDialog,AbstractPasswordToOpenModifyDialog, PasswordToOpenModifyDialog)
virtual OUString GetPasswordToOpen() const override;
virtual OUString GetPasswordToModify() const override;
virtual bool IsRecommendToOpenReadonly() const override;
+ virtual void Response(sal_Int32) override;
+ virtual void AllowEmpty() override;
};
-class SvxCharacterMap;
-class AbstractSvxCharacterMapDialog_Impl : public SfxAbstractDialog
-{
- std::unique_ptr<SvxCharacterMap> m_xDlg;
-public:
- explicit AbstractSvxCharacterMapDialog_Impl(std::unique_ptr<SvxCharacterMap> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSvxCharacterMapDialog_Impl
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractSvxCharacterMapDialog,SfxAbstractDialog,SvxCharacterMap)
virtual const SfxItemSet* GetOutputItemSet() const override;
virtual void SetText(const OUString& rStr) override;
};
-class ScreenshotAnnotationDlg;
-class AbstractScreenshotAnnotationDlg_Impl : public AbstractScreenshotAnnotationDlg
-{
- std::unique_ptr<ScreenshotAnnotationDlg> m_xDlg;
-
-public:
- explicit AbstractScreenshotAnnotationDlg_Impl(std::unique_ptr<ScreenshotAnnotationDlg> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractScreenshotAnnotationDlg_Impl
+DECL_ABSTDLG_CLASS(AbstractScreenshotAnnotationDlg,ScreenshotAnnotationDlg)
};
-class SignatureLineDialog;
-class AbstractSignatureLineDialog_Impl : public AbstractSignatureLineDialog
-{
- std::unique_ptr<SignatureLineDialog> m_xDlg;
-
-public:
- explicit AbstractSignatureLineDialog_Impl(std::unique_ptr<SignatureLineDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSecurityOptionsDialog_Impl
+DECL_ABSTDLG_CLASS(AbstractSecurityOptionsDialog, svx::SecurityOptionsDialog)
+ virtual bool SetSecurityOptions() override;
};
-class QrCodeGenDialog;
-class AbstractQrCodeGenDialog_Impl : public AbstractQrCodeGenDialog
-{
- std::unique_ptr<QrCodeGenDialog> m_xDlg;
-
-public:
- explicit AbstractQrCodeGenDialog_Impl(std::unique_ptr<QrCodeGenDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSignatureLineDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSignatureLineDialog,SignatureLineDialog)
+ virtual void Apply() override { m_xDlg->Apply(); }
};
-class SignSignatureLineDialog;
-class AbstractSignSignatureLineDialog_Impl : public AbstractSignSignatureLineDialog
-{
-protected:
- std::unique_ptr<SignSignatureLineDialog> m_xDlg;
-
-public:
- explicit AbstractSignSignatureLineDialog_Impl(std::unique_ptr<SignSignatureLineDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractQrCodeGenDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractQrCodeGenDialog,QrCodeGenDialog)
};
-class AbstractAdditionsDialog_Impl : public AbstractAdditionsDialog
-{
-protected:
- std::unique_ptr<AdditionsDialog> m_xDlg;
-
-public:
- explicit AbstractAdditionsDialog_Impl(std::unique_ptr<AdditionsDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractSignSignatureLineDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractSignSignatureLineDialog,SignSignatureLineDialog)
+ virtual void Apply() override { m_xDlg->Apply(); }
};
-class DiagramDialog;
-
-/** Edit Diagram dialog */
-class AbstractDiagramDialog_Impl : public AbstractDiagramDialog
-{
-protected:
- std::unique_ptr<DiagramDialog> m_xDlg;
+// AbstractAdditionsDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractAdditionsDialog,weld::GenericDialogController)
+};
-public:
- explicit AbstractDiagramDialog_Impl(std::unique_ptr<DiagramDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
+// AbstractDiagramDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractDiagramDialog,DiagramDialog)
};
//AbstractDialogFactory_Impl implementations
@@ -768,8 +447,7 @@ public:
const SfxItemSet& rAttr,
const css::uno::Reference< css::frame::XFrame >& rFrame) override;
virtual VclPtr<VclAbstractDialog> CreateFrameDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame,
- sal_uInt32 nResId,
- const OUString& rParameter ) override;
+ sal_uInt32 nResId, sal_uInt16 nPageId, const OUString& rParameter) override;
virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) override;
virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog(weld::Window* pParent,
const SfxItemSet* pAttrSet,
@@ -796,7 +474,7 @@ public:
css::uno::Reference<css::linguistic2::XThesaurus> xThesaurus,
const OUString &rWord, LanguageType nLanguage) override;
- virtual VclPtr<AbstractHyphenWordDialog> CreateHyphenWordDialog(weld::Window*,
+ virtual VclPtr<AbstractHyphenWordDialog> CreateHyphenWordDialog(weld::Widget*,
const OUString &rWord, LanguageType nLang,
css::uno::Reference< css::linguistic2::XHyphenator > &xHyphen,
SvxSpellWrapper* pWrapper) override;
@@ -837,7 +515,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateSvxSearchAttributeDialog(weld::Window* pParent,
SearchAttrItemList& rLst,
- const sal_uInt16* pWhRanges) override;
+ const WhichRangesContainer& pWhRanges) override;
virtual VclPtr<AbstractSvxSearchSimilarityDialog> CreateSvxSearchSimilarityDialog( weld::Window* pParent,
bool bRelax,
sal_uInt16 nOther,
@@ -850,10 +528,10 @@ public:
virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog(weld::Window* pParent) override;
virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName) override;
virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent,
- const OUString& rName, const OUString& rDesc) override;
+ const OUString& rName, const OUString& rDesc, const OUString& rTitle = "") override;
// #i68101#
virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) override;
- virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) override;
+ virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription, bool isDecorative) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) override;
virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent) override;
@@ -877,7 +555,8 @@ public:
virtual VclPtr<AbstractSvxAreaTabDialog> CreateSvxAreaTabDialog(weld::Window* pParent,
const SfxItemSet* pAttr,
SdrModel* pModel,
- bool bShadow) override;
+ bool bShadow,
+ bool bSlideBackground) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr,
SdrModel* pModel,
const SdrObject* pObj,
@@ -906,7 +585,7 @@ public:
const sal_uInt16 _nInitiallySelectedEvent
) override;
- virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel) override;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet& rAttr, const SdrModel& rModel, bool bStyle) override;
virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) override;
@@ -915,12 +594,14 @@ public:
virtual VclPtr<VclAbstractDialog> CreateOptionsDialog(
weld::Window* pParent, const OUString& rExtensionId ) override;
- virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) override;
+ virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OUString& rHelpId) override;
virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window* pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) override;
virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(weld::Dialog& rParentDialog) override;
+ virtual VclPtr<AbstractSecurityOptionsDialog> CreateSvxSecurityOptionsDialog(weld::Window* pParent) override;
+
virtual VclPtr<AbstractSignatureLineDialog>
CreateSignatureLineDialog(weld::Window* pParent,
const css::uno::Reference<css::frame::XModel> xModel, bool bEditExisting) override;
@@ -938,13 +619,23 @@ public:
virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* pParent) override;
+ virtual VclPtr<VclAbstractDialog> CreateWhatsNewDialog(weld::Window* pParent, const bool bWelcome) override;
+
virtual VclPtr<VclAbstractDialog> CreateTipOfTheDayDialog(weld::Window* pParent) override;
+ virtual VclPtr<VclAbstractDialog> CreateWidgetTestDialog(weld::Window* pParent) override;
+
virtual VclPtr<VclAbstractDialog> CreateToolbarmodeDialog(weld::Window* pParent) override;
virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog(
weld::Window* pParent,
- std::shared_ptr<DiagramDataInterface> pDiagramData) override;
+ SdrObjGroup& rDiagram) override;
+
+#ifdef _WIN32
+ virtual VclPtr<VclAbstractDialog> CreateFileExtCheckDialog(weld::Window* pParent,
+ const OUString& sTitle,
+ const OUString& sMsg) override;
+#endif
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index 87f3105a0875..6b363f9bf543 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
// hook to call special character dialog for edits
// caution: needs C-Linkage since dynamically loaded via symbol name
@@ -32,9 +32,8 @@ SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(weld::Widget* i_pParent, const
if (aDlg.run() == RET_OK)
{
sal_UCS4 cChar = aDlg.GetChar();
- // using the new UCS4 constructor
- OUString aOUStr( &cChar, 1 );
- o_rResult = aOUStr;
+ // using the UCS4 constructor
+ o_rResult = OUString(&cChar, 1);
bRet = true;
}
return bRet;
diff --git a/cui/source/inc/AdditionsDialog.hxx b/cui/source/inc/AdditionsDialog.hxx
index 0e7620b38268..559a4ca911ff 100644
--- a/cui/source/inc/AdditionsDialog.hxx
+++ b/cui/source/inc/AdditionsDialog.hxx
@@ -58,7 +58,7 @@ class AdditionsDialog : public weld::GenericDialogController
private:
Timer m_aSearchDataTimer;
- DECL_LINK(GearHdl, const OString&, void);
+ DECL_LINK(GearHdl, const OUString&, void);
DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
DECL_LINK(ImplUpdateDataHdl, Timer*, void);
DECL_LINK(FocusOut_Impl, weld::Widget&, void);
@@ -68,7 +68,6 @@ public:
css::uno::Reference<css::deployment::XExtensionManager> m_xExtensionManager;
std::unique_ptr<weld::Entry> m_xEntrySearch;
std::unique_ptr<weld::Button> m_xButtonClose;
- std::unique_ptr<weld::MenuButton> m_xMenuButtonSettings;
std::vector<std::shared_ptr<AdditionsItem>> m_aAdditionsItems; // UI components
std::vector<AdditionInfo> m_aAllExtensionsVector; // Stores the all extensions' info
@@ -117,19 +116,15 @@ public:
std::unique_ptr<weld::LinkButton> m_xLinkButtonWebsite;
std::unique_ptr<weld::Label> m_xLabelName;
std::unique_ptr<weld::Label> m_xLabelAuthor;
- std::unique_ptr<weld::Label> m_xLabelDesc;
std::unique_ptr<weld::Label> m_xLabelDescription;
std::unique_ptr<weld::Label> m_xLabelLicense;
std::unique_ptr<weld::Label> m_xLabelVersion;
- std::unique_ptr<weld::Label> m_xLabelComments;
std::unique_ptr<weld::LinkButton> m_xLinkButtonComments;
std::unique_ptr<weld::Image> m_xImageVoting1;
std::unique_ptr<weld::Image> m_xImageVoting2;
std::unique_ptr<weld::Image> m_xImageVoting3;
std::unique_ptr<weld::Image> m_xImageVoting4;
std::unique_ptr<weld::Image> m_xImageVoting5;
- std::unique_ptr<weld::Label> m_xLabelNoVoting;
- std::unique_ptr<weld::Image> m_xImageDownloadNumber;
std::unique_ptr<weld::Label> m_xLabelDownloadNumber;
std::unique_ptr<weld::Button> m_xButtonShowMore;
AdditionsDialog* m_pParentDialog;
@@ -143,6 +138,7 @@ private:
AdditionsDialog* m_pAdditionsDialog;
std::atomic<bool> m_bExecute;
bool m_bIsFirstLoading;
+ bool m_bUITest;
void Search();
void Append(AdditionInfo& additionInfo);
diff --git a/cui/source/inc/CustomNotebookbarGenerator.hxx b/cui/source/inc/CustomNotebookbarGenerator.hxx
index b06848dbb955..a7149879aef0 100644
--- a/cui/source/inc/CustomNotebookbarGenerator.hxx
+++ b/cui/source/inc/CustomNotebookbarGenerator.hxx
@@ -35,8 +35,8 @@ public:
static void getFileNameAndAppName(OUString& sAppName, OUString& sNotebookbarUIFileName);
static void modifyCustomizedUIFile(const Sequence<OUString>& sUIItemProperties);
static void createCustomizedUIFile();
- static void setCustomizedUIItem(Sequence<OUString> sUIItemProperties,
- OUString sNotebookbarConfigType);
+ static void setCustomizedUIItem(const Sequence<OUString>& rUIItemProperties,
+ const OUString& rNotebookbarConfigType);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/DiagramDialog.hxx b/cui/source/inc/DiagramDialog.hxx
index adc8328969a8..a612e092a8e7 100644
--- a/cui/source/inc/DiagramDialog.hxx
+++ b/cui/source/inc/DiagramDialog.hxx
@@ -12,24 +12,26 @@
#include <tools/link.hxx>
#include <vcl/weld.hxx>
-class DiagramDataInterface;
+class SdrObjGroup;
/** Edit Diagram dialog */
class DiagramDialog : public weld::GenericDialogController
{
public:
- DiagramDialog(weld::Window* pWindow, std::shared_ptr<DiagramDataInterface> pDiagramData);
+ DiagramDialog(weld::Window* pWindow, SdrObjGroup& rDiagram);
virtual ~DiagramDialog() override;
private:
- std::shared_ptr<DiagramDataInterface> mpDiagramData;
- std::unique_ptr<weld::Button> mpBtnOk;
+ SdrObjGroup& m_rDiagram;
+ sal_uInt32 m_nUndos;
+
std::unique_ptr<weld::Button> mpBtnCancel;
std::unique_ptr<weld::Button> mpBtnAdd;
std::unique_ptr<weld::Button> mpBtnRemove;
std::unique_ptr<weld::TreeView> mpTreeDiagram;
std::unique_ptr<weld::TextView> mpTextAdd;
+ DECL_LINK(OnAddCancel, weld::Button&, void);
DECL_LINK(OnAddClick, weld::Button&, void);
DECL_LINK(OnRemoveClick, weld::Button&, void);
diff --git a/cui/source/inc/FontFeatures.hxx b/cui/source/inc/FontFeatures.hxx
new file mode 100644
index 000000000000..f16c11628143
--- /dev/null
+++ b/cui/source/inc/FontFeatures.hxx
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+#pragma once
+
+#include <vector>
+#include <vcl/font/Feature.hxx>
+#include <vcl/virdev.hxx>
+
+std::vector<vcl::font::Feature> getFontFeatureList(OUString const& rFontName, VirtualDevice& rVDev);
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/cui/source/inc/FontFeaturesDialog.hxx b/cui/source/inc/FontFeaturesDialog.hxx
index 6fd8b9de037e..93ba0cb9f80d 100644
--- a/cui/source/inc/FontFeaturesDialog.hxx
+++ b/cui/source/inc/FontFeaturesDialog.hxx
@@ -22,46 +22,58 @@ struct FontFeatureItem
{
FontFeatureItem(weld::Widget* pParent)
: m_aFeatureCode(0)
- , m_nDefault(0)
+ , m_nDefault(-1)
, m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/fontfragment.ui"))
, m_xContainer(m_xBuilder->weld_widget("fontentry"))
, m_xText(m_xBuilder->weld_label("label"))
, m_xCombo(m_xBuilder->weld_combo_box("combo"))
, m_xCheck(m_xBuilder->weld_check_button("check"))
{
+ m_xCheck->connect_toggled(LINK(this, FontFeatureItem, CheckBoxToggledHdl));
}
sal_uInt32 m_aFeatureCode;
- sal_uInt32 m_nDefault;
+ sal_Int32 m_nDefault;
+ weld::TriStateEnabled m_aTriStateEnabled;
+ Link<weld::Toggleable&, void> m_aToggleHdl;
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Widget> m_xContainer;
std::unique_ptr<weld::Label> m_xText;
std::unique_ptr<weld::ComboBox> m_xCombo;
std::unique_ptr<weld::CheckButton> m_xCheck;
+
+private:
+ DECL_LINK(CheckBoxToggledHdl, weld::Toggleable&, void);
};
class FontFeaturesDialog : public weld::GenericDialogController
{
private:
- std::vector<FontFeatureItem> m_aFeatureItems;
+ std::vector<std::unique_ptr<FontFeatureItem>> m_aFeatureItems;
OUString m_sFontName;
OUString m_sResultFontName;
SvxFontPrevWindow m_aPreviewWindow;
std::unique_ptr<weld::ScrolledWindow> m_xContentWindow;
+ std::unique_ptr<weld::Container> m_xContentBox;
std::unique_ptr<weld::Container> m_xContentGrid;
+ std::unique_ptr<weld::Container> m_xStylisticSetsBox;
+ std::unique_ptr<weld::Container> m_xStylisticSetsGrid;
+ std::unique_ptr<weld::Container> m_xCharacterVariantsBox;
+ std::unique_ptr<weld::Container> m_xCharacterVariantsGrid;
std::unique_ptr<weld::CustomWeld> m_xPreviewWindow;
void initialize();
OUString createFontNameWithFeatures();
- void fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
+ // returns the max height of a row
+ int fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
DECL_LINK(ComboBoxSelectedHdl, weld::ComboBox&, void);
- DECL_LINK(CheckBoxToggledHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxToggledHdl, weld::Toggleable&, void);
public:
- FontFeaturesDialog(weld::Window* pParent, OUString const& rFontName);
+ FontFeaturesDialog(weld::Window* pParent, OUString aFontName);
~FontFeaturesDialog() override;
virtual short run() override;
diff --git a/cui/source/inc/GraphicsTestsDialog.hxx b/cui/source/inc/GraphicsTestsDialog.hxx
new file mode 100644
index 000000000000..2bf18de5dde7
--- /dev/null
+++ b/cui/source/inc/GraphicsTestsDialog.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <vcl/bitmap.hxx>
+#include <vcl/weld.hxx>
+#include <tools/link.hxx>
+
+#include <vector>
+
+class GraphicTestEntry final
+{
+private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Label> m_xTestLabel;
+ std::unique_ptr<weld::Button> m_xTestButton;
+
+ weld::Dialog* m_xParentDialog;
+
+ Bitmap m_xResultBitmap;
+
+public:
+ DECL_LINK(HandleResultViewRequest, weld::Button&, void);
+ GraphicTestEntry(weld::Container* pParent, weld::Dialog* pDialog, OUString aTestName,
+ OUString aTestStatus, Bitmap aTestBitmap);
+ weld::Widget* get_widget() const { return m_xContainer.get(); }
+};
+
+class GraphicsTestsDialog : public weld::GenericDialogController
+{
+ std::unique_ptr<weld::TextView> m_xResultLog;
+ std::unique_ptr<weld::Button> m_xDownloadResults;
+ std::unique_ptr<weld::Box> m_xContainerBox;
+
+ std::vector<std::unique_ptr<GraphicTestEntry>> m_xGraphicTestEntries;
+
+ OUString m_xZipFileUrl;
+ OUString m_xCreateFolderUrl;
+
+ DECL_LINK(HandleDownloadRequest, weld::Button&, void);
+ DECL_LINK(HandleResultViewRequest, weld::Button&, void);
+
+public:
+ GraphicsTestsDialog(weld::Container* pParent);
+ ~GraphicsTestsDialog();
+ virtual short run() override;
+};
diff --git a/cui/source/inc/ImageViewerDialog.hxx b/cui/source/inc/ImageViewerDialog.hxx
new file mode 100644
index 000000000000..884deb18d4a7
--- /dev/null
+++ b/cui/source/inc/ImageViewerDialog.hxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#pragma once
+
+#include <vcl/bitmapex.hxx>
+#include <vcl/weld.hxx>
+
+class ImageViewerDialog : public weld::GenericDialogController
+{
+ std::unique_ptr<weld::Image> m_xDisplayImage;
+
+public:
+ ImageViewerDialog(weld::Dialog* pParent, BitmapEx aBitmap, OUString atitle);
+};
diff --git a/cui/source/inc/QrCodeGenDialog.hxx b/cui/source/inc/QrCodeGenDialog.hxx
index 7c39fe07ced6..02037ad4cdf6 100644
--- a/cui/source/inc/QrCodeGenDialog.hxx
+++ b/cui/source/inc/QrCodeGenDialog.hxx
@@ -8,7 +8,7 @@
*/
#pragma once
-#include <config_qrcodegen.h>
+#include <config_zxing.h>
#include <vcl/weld.hxx>
@@ -24,24 +24,28 @@ public:
bool bEditExisting);
virtual short run() override;
+ static bool runAsync(const std::shared_ptr<QrCodeGenDialog>& rController,
+ const std::function<void(sal_Int32)>& rFunc);
-protected:
- css::uno::Reference<css::frame::XModel> m_xModel;
void Apply();
+#if ENABLE_ZXING
+ weld::Widget* GetParent() { return mpParent; }
+#endif
private:
- std::unique_ptr<weld::Entry> m_xEdittext;
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ std::unique_ptr<weld::TextView> m_xEdittext;
std::unique_ptr<weld::RadioButton> m_xECC[4];
std::unique_ptr<weld::SpinButton> m_xSpinBorder;
-#if ENABLE_QRCODEGEN
+ std::unique_ptr<weld::ComboBox> m_xComboType;
+
+#if ENABLE_ZXING
weld::Widget* mpParent;
#endif
css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;
void GetErrorCorrection(tools::Long);
- //Function contains QR Code Generating Library Calls
- static OUString GenerateQRCode(OUString aQrText, tools::Long aQrECC, int aQrBorder);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/SignSignatureLineDialog.hxx b/cui/source/inc/SignSignatureLineDialog.hxx
index 5abe1969e32c..7c894a16a0b3 100644
--- a/cui/source/inc/SignSignatureLineDialog.hxx
+++ b/cui/source/inc/SignSignatureLineDialog.hxx
@@ -20,6 +20,8 @@ class SignSignatureLineDialog : public SignatureLineDialogBase
public:
SignSignatureLineDialog(weld::Widget* pParent, css::uno::Reference<css::frame::XModel> xModel);
+ void Apply();
+
private:
std::unique_ptr<weld::Entry> m_xEditName;
std::unique_ptr<weld::TextView> m_xEditComment;
@@ -42,7 +44,6 @@ private:
void ValidateFields();
css::uno::Reference<css::graphic::XGraphic> getSignedGraphic(bool bValid);
- virtual void Apply() override;
DECL_LINK(clearImage, weld::Button&, void);
DECL_LINK(loadImage, weld::Button&, void);
diff --git a/cui/source/inc/SignatureLineDialog.hxx b/cui/source/inc/SignatureLineDialog.hxx
index 73b093f601a5..e686cb4a4123 100644
--- a/cui/source/inc/SignatureLineDialog.hxx
+++ b/cui/source/inc/SignatureLineDialog.hxx
@@ -19,6 +19,8 @@ public:
SignatureLineDialog(weld::Widget* pParent, css::uno::Reference<css::frame::XModel> xModel,
bool bEditExisting);
+ void Apply();
+
private:
std::unique_ptr<weld::Entry> m_xEditName;
std::unique_ptr<weld::Entry> m_xEditTitle;
@@ -29,8 +31,6 @@ private:
css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;
OUString m_aSignatureLineId;
-
- virtual void Apply() override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/SignatureLineDialogBase.hxx b/cui/source/inc/SignatureLineDialogBase.hxx
index 3cc645819be8..4e0a3f298e5b 100644
--- a/cui/source/inc/SignatureLineDialogBase.hxx
+++ b/cui/source/inc/SignatureLineDialogBase.hxx
@@ -21,13 +21,12 @@ class SignatureLineDialogBase : public weld::GenericDialogController
{
public:
SignatureLineDialogBase(weld::Widget* pParent, css::uno::Reference<css::frame::XModel> xModel,
- const OUString& rUIFile, const OString& rDialogId);
+ const OUString& rUIFile, const OUString& rDialogId);
virtual short run() override;
protected:
css::uno::Reference<css::frame::XModel> m_xModel;
- virtual void Apply() = 0;
static OUString getCDataString(std::u16string_view rString);
};
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index f184f8e78ad2..81d68e214314 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -46,6 +46,7 @@ struct SpellErrorDescription;
class SentenceEditWindow_Impl : public WeldEditView
{
private:
+ std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
std::set<sal_Int32> m_aIgnoreErrorsAt;
SpellDialog* m_pSpellDialog;
weld::Toolbar* m_pToolbar;
@@ -61,14 +62,21 @@ private:
bool GetErrorDescription(SpellErrorDescription& rSpellErrorDescription, sal_Int32 nPosition);
- DECL_LINK(ToolbarHdl, const OString&, void);
+ DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
+ DECL_LINK(EditStatusHdl, EditStatus&, void);
+ DECL_LINK(ToolbarHdl, const OUString&, void);
+
+ void DoScroll();
+ void SetScrollBarRange();
protected:
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void StyleUpdated() override;
public:
- SentenceEditWindow_Impl();
+ SentenceEditWindow_Impl(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual void EditViewScrollStateChange() override;
void SetSpellDialog(SpellDialog* pDialog) { m_pSpellDialog = pDialog; }
virtual ~SentenceEditWindow_Impl() override;
@@ -113,6 +121,8 @@ public:
void MoveErrorEnd(tools::Long nOffset);
void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); }
+
+ void SetDocumentColor(weld::DrawingArea* pDrawingArea);
};
// class SvxSpellDialog ---------------------------------------------
@@ -130,7 +140,7 @@ private:
OUString m_sTitleSpellingGrammar;
Link<SpellUndoAction_Impl&,void> aDialogUndoLink;
-
+ ImplSVEvent * m_pInitHdlEvent;
bool bFocusLocked;
svx::SpellDialogChildWindow& rParent;
@@ -143,7 +153,6 @@ private:
std::unique_ptr<weld::Label> m_xAltTitle;
std::unique_ptr<weld::Label> m_xResumeFT;
std::unique_ptr<weld::Label> m_xNoSuggestionsFT;
- std::unique_ptr<weld::Label> m_xIgnoreOnceFT;
std::unique_ptr<weld::Label> m_xLanguageFT;
std::unique_ptr<SvxLanguageBox> m_xLanguageLB;
std::unique_ptr<weld::Label> m_xExplainFT;
@@ -166,25 +175,26 @@ private:
std::unique_ptr<weld::Button> m_xClosePB;
std::unique_ptr<weld::Toolbar> m_xToolbar;
std::unique_ptr<weld::CustomWeld> m_xSentenceEDWeld;
+ std::shared_ptr<SfxSingleTabDialogController> m_xOptionsDlg;
DECL_LINK(ChangeHdl, weld::Button&, void);
DECL_LINK(DoubleClickChangeHdl, weld::TreeView&, bool);
DECL_LINK(ChangeAllHdl, weld::Button&, void);
DECL_LINK(IgnoreAllHdl, weld::Button&, void);
DECL_LINK(IgnoreHdl, weld::Button&, void);
- DECL_LINK(CheckGrammarHdl, weld::Button&, void);
+ DECL_LINK(CheckGrammarHdl, weld::Toggleable&, void);
DECL_LINK(ExtClickHdl, weld::Button&, void);
DECL_LINK(CancelHdl, weld::Button&, void);
DECL_LINK(ModifyHdl, LinkParamNone*, void);
DECL_LINK(UndoHdl, weld::Button&, void);
- DECL_LINK(AddToDictSelectHdl, const OString&, void);
+ DECL_LINK(AddToDictSelectHdl, const OUString&, void);
DECL_LINK(AddToDictClickHdl, weld::Button&, void);
DECL_LINK(LanguageSelectHdl, weld::ComboBox&, void);
DECL_LINK(DialogUndoHdl, SpellUndoAction_Impl&, void);
DECL_LINK(InitHdl, void*, void);
- void AddToDictionaryExecute(const OString& rItemId);
+ void AddToDictionaryExecute(const OUString& rItemId);
void StartSpellOptDlg_Impl();
int InitUserDicts();
void UpdateBoxes_Impl(bool bCallFromSelectHdl = false);
diff --git a/cui/source/inc/SvxMenuConfigPage.hxx b/cui/source/inc/SvxMenuConfigPage.hxx
index bc8fba3f5780..36fee041de76 100644
--- a/cui/source/inc/SvxMenuConfigPage.hxx
+++ b/cui/source/inc/SvxMenuConfigPage.hxx
@@ -33,15 +33,15 @@ private:
DECL_LINK(ContentContextMenuHdl, const CommandEvent&, bool);
DECL_LINK(FunctionContextMenuHdl, const CommandEvent&, bool);
- DECL_LINK(GearHdl, const OString&, void);
+ DECL_LINK(GearHdl, const OUString&, void);
DECL_LINK(SelectCategory, weld::ComboBox&, void);
DECL_LINK(AddCommandHdl, weld::Button&, void);
DECL_LINK(RemoveCommandHdl, weld::Button&, void);
- DECL_LINK(InsertHdl, const OString&, void);
- DECL_LINK(ModifyItemHdl, const OString&, void);
+ DECL_LINK(InsertHdl, const OUString&, void);
+ DECL_LINK(ModifyItemHdl, const OUString&, void);
DECL_LINK(ResetMenuHdl, weld::Button&, void);
DECL_LINK(MenuEntriesSizeAllocHdl, const Size&, void);
diff --git a/cui/source/inc/SvxNotebookbarConfigPage.hxx b/cui/source/inc/SvxNotebookbarConfigPage.hxx
index 7e417463ab30..672d2e8299e4 100644
--- a/cui/source/inc/SvxNotebookbarConfigPage.hxx
+++ b/cui/source/inc/SvxNotebookbarConfigPage.hxx
@@ -74,13 +74,19 @@ public:
class SvxNotebookbarEntriesListBox final : public SvxMenuEntriesListBox
{
+ typedef std::unordered_map<OUString, OUString> TooltipMap;
+ TooltipMap m_aTooltipMap;
+
void ChangedVisibility(int nRow);
DECL_LINK(CheckButtonHdl, const weld::TreeView::iter_col&, void);
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
public:
SvxNotebookbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPg);
virtual ~SvxNotebookbarEntriesListBox() override;
+
+ TooltipMap& GetTooltipMap() { return m_aTooltipMap; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/SvxToolbarConfigPage.hxx b/cui/source/inc/SvxToolbarConfigPage.hxx
index e035d6b7ef31..28fe658f2cca 100644
--- a/cui/source/inc/SvxToolbarConfigPage.hxx
+++ b/cui/source/inc/SvxToolbarConfigPage.hxx
@@ -32,7 +32,7 @@ private:
DECL_LINK(SelectToolbarEntry, weld::TreeView&, void);
DECL_LINK(MoveHdl, weld::Button&, void);
- DECL_LINK(GearHdl, const OString&, void);
+ DECL_LINK(GearHdl, const OUString&, void);
DECL_LINK(SelectCategory, weld::ComboBox&, void);
@@ -42,8 +42,8 @@ private:
DECL_LINK(AddCommandHdl, weld::Button&, void);
DECL_LINK(RemoveCommandHdl, weld::Button&, void);
- DECL_LINK(InsertHdl, const OString&, void);
- DECL_LINK(ModifyItemHdl, const OString&, void);
+ DECL_LINK(InsertHdl, const OUString&, void);
+ DECL_LINK(ModifyItemHdl, const OUString&, void);
DECL_LINK(ResetToolbarHdl, weld::Button&, void);
virtual void ListModified() override;
diff --git a/cui/source/inc/TextColumnsPage.hxx b/cui/source/inc/TextColumnsPage.hxx
new file mode 100644
index 000000000000..af45c23c93ca
--- /dev/null
+++ b/cui/source/inc/TextColumnsPage.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <sfx2/tabdlg.hxx>
+
+#include <memory>
+
+/// Tab page for EditEngine columns properties
+class SvxTextColumnsPage : public SfxTabPage
+{
+private:
+ static const WhichRangesContainer pRanges;
+
+ std::unique_ptr<weld::SpinButton> m_xColumnsNumber;
+ std::unique_ptr<weld::MetricSpinButton> m_xColumnsSpacing;
+
+public:
+ SvxTextColumnsPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
+ virtual ~SvxTextColumnsPage() override;
+
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
+ static WhichRangesContainer GetRanges() { return pRanges; }
+
+ virtual bool FillItemSet(SfxItemSet*) override;
+ virtual void Reset(const SfxItemSet*) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx
index 2cfc65a894f4..42eae5467eab 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -46,7 +46,7 @@ private:
static OUString GetMiscString();
static OUString GetCopyrightString();
- static bool IsStringValidGitHash(const OUString& hash);
+ static bool IsStringValidGitHash(std::u16string_view hash);
DECL_LINK(HandleClick, weld::Button&, void);
diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx
index aecc923adec2..e9207d5a1add 100644
--- a/cui/source/inc/acccfg.hxx
+++ b/cui/source/inc/acccfg.hxx
@@ -28,9 +28,12 @@
#include <vcl/idle.hxx>
#include <vcl/keycod.hxx>
#include <i18nutil/searchopt.hxx>
+#include <config_features.h>
#include "cfgutil.hxx"
+#if HAVE_FEATURE_SCRIPTING
class SfxMacroInfoItem;
+#endif
class CuiConfigFunctionListBox;
class SfxAcceleratorConfigPage;
class SfxStringItem;
@@ -76,7 +79,9 @@ enum class StartFileDialogType
class SfxAcceleratorConfigPage : public SfxTabPage
{
private:
+#if HAVE_FEATURE_SCRIPTING
const SfxMacroInfoItem* m_pMacroInfoItem;
+#endif
std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
OUString aLoadAccelConfigStr;
@@ -122,7 +127,7 @@ private:
DECL_LINK(Save, weld::Button&, void);
DECL_LINK(Load, weld::Button&, void);
DECL_LINK(Default, weld::Button&, void);
- DECL_LINK(RadioHdl, weld::Button&, void);
+ DECL_LINK(RadioHdl, weld::Toggleable&, void);
DECL_LINK(ImplUpdateDataHdl, Timer*, void);
DECL_LINK(FocusOut_Impl, weld::Widget&, void);
DECL_LINK(TimeOut_Impl, Timer*, void);
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index d88fc28dce29..caea33e42150 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -40,19 +40,21 @@
#include <svx/frmdirlbox.hxx>
#include <vcl/weld.hxx>
+class SfxEnumItemInterface;
+
namespace svx {
class AlignmentTabPage : public SfxTabPage
{
- static const sal_uInt16 s_pRanges[];
+ static const WhichRangesContainer s_pRanges;
public:
virtual ~AlignmentTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
explicit AlignmentTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet);
- static const sal_uInt16* GetRanges() { return s_pRanges; }
+ static WhichRangesContainer GetRanges() { return s_pRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
@@ -62,14 +64,14 @@ private:
void InitVsRefEgde();
void UpdateEnableControls();
- bool HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const;
+ bool HasAlignmentChanged( const SfxItemSet& rNew, TypedWhichId<SfxEnumItemInterface> nWhich ) const;
DECL_LINK(UpdateEnableHdl, weld::ComboBox&, void);
- DECL_LINK(StackedClickHdl, weld::ToggleButton&, void);
- DECL_LINK(AsianModeClickHdl, weld::ToggleButton&, void);
- DECL_LINK(WrapClickHdl, weld::ToggleButton&, void);
- DECL_LINK(HyphenClickHdl, weld::ToggleButton&, void);
- DECL_LINK(ShrinkClickHdl, weld::ToggleButton&, void);
+ DECL_LINK(StackedClickHdl, weld::Toggleable&, void);
+ DECL_LINK(AsianModeClickHdl, weld::Toggleable&, void);
+ DECL_LINK(WrapClickHdl, weld::Toggleable&, void);
+ DECL_LINK(HyphenClickHdl, weld::Toggleable&, void);
+ DECL_LINK(ShrinkClickHdl, weld::Toggleable&, void);
private:
weld::TriStateEnabled m_aStackedState;
@@ -92,7 +94,6 @@ private:
std::unique_ptr<weld::CheckButton> m_xCbStacked;
std::unique_ptr<weld::CheckButton> m_xCbAsianMode;
- std::unique_ptr<weld::Widget> m_xBoxDirection;
std::unique_ptr<weld::CheckButton> m_xBtnWrap;
std::unique_ptr<weld::CheckButton> m_xBtnHyphen;
std::unique_ptr<weld::CheckButton> m_xBtnShrink;
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 86218a58a581..2677b8535ebe 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -20,12 +20,13 @@
#include <sfx2/tabdlg.hxx>
#include <svx/langbox.hxx>
+#include <unotools/collatorwrapper.hxx>
#include <map>
#include <set>
+#include <utility>
class CharClass;
-class CollatorWrapper;
class SmartTagMgr;
namespace editeng { class SortedAutoCompleteStrings; }
@@ -56,6 +57,7 @@ private:
OUString m_sStartCap;
OUString m_sBoldUnderline;
OUString m_sURL;
+ OUString m_sDOI;
OUString m_sNoDblSpaces;
OUString m_sDash;
OUString m_sAccidentalCaps;
@@ -91,9 +93,11 @@ class OfaSwAutoFmtOptionsPage : public SfxTabPage
OUString sNoDblSpaces;
OUString sCorrectCapsLock;
OUString sDetectURL;
+ OUString sDetectDOI;
OUString sDash;
OUString sRightMargin;
OUString sNum;
+ OUString sBulletsAfterSpace;
OUString sBorder;
OUString sTable;
OUString sReplaceTemplates;
@@ -135,6 +139,12 @@ struct DoubleString
OUString sShort;
OUString sLong;
void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
+ DoubleString(OUString aShort, OUString aLong)
+ : sShort(std::move(aShort))
+ , sLong(std::move(aLong))
+ , pUserData(nullptr)
+ {
+ }
};
typedef std::vector<DoubleString> DoubleStringArray;
@@ -159,7 +169,7 @@ private:
std::set<OUString> aFormatText;
std::map<LanguageType, DoubleStringArray>
aDoubleStringTable;
- std::unique_ptr<CollatorWrapper> pCompareClass;
+ CollatorWrapper maCompareClass;
std::unique_ptr<CharClass> pCharClass;
LanguageType eLang;
@@ -220,7 +230,7 @@ class OfaAutocorrExceptPage : public SfxTabPage
{
private:
StringsTable aStringsTable;
- std::unique_ptr<CollatorWrapper> pCompareClass;
+ CollatorWrapper maCompareClass;
LanguageType eLang;
std::unique_ptr<weld::Entry> m_xAbbrevED;
@@ -334,7 +344,7 @@ private:
std::unique_ptr<weld::TreeView> m_xLBEntries;
std::unique_ptr<weld::Button> m_xPBEntries;
- DECL_LINK(CheckHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckHdl, weld::Toggleable&, void);
DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
public:
@@ -382,7 +392,7 @@ private:
Enables/disables all controls in the tab page (except from the
check box.
*/
- DECL_LINK(CheckHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckHdl, weld::Toggleable&, void);
/** Handler for the push button
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index 5673b2f6067b..3d50d69e95f4 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -37,23 +37,28 @@ class SvxBrushItem;
class SvxBkgTabPage : public SvxAreaTabPage
{
- static const sal_uInt16 pPageRanges[];
+ static const WhichRangesContainer pBkgRanges;
std::unique_ptr<weld::ComboBox> m_xTblLBox;
- bool bHighlighting : 1;
- bool bCharBackColor : 1;
- SfxItemSet maSet;
- std::unique_ptr<SfxItemSet> m_pResetSet;
+ bool m_bHighlighting = false;
+ bool m_bCharBackColor = false;
+
+ // m_aAttrSet is used to convert between SvxBrushItem and XFILL item attributes and also to
+ // allow for cell, row, and table backgrounds to be set in one Table dialog opening.
+ SfxItemSet m_aAttrSet;
sal_Int32 m_nActPos = -1;
DECL_LINK(TblDestinationHdl_Impl, weld::ComboBox&, void);
+
+ void SetActiveTableDestinationBrushItem();
+
public:
SvxBkgTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxBkgTabPage() override;
// returns the area of the which-values
- static const sal_uInt16* GetRanges() { return pPageRanges; }
+ static WhichRangesContainer GetRanges() { return pBkgRanges; }
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) override;
diff --git a/cui/source/inc/bbdlg.hxx b/cui/source/inc/bbdlg.hxx
index 1c7a289723a6..c18b5b3da4e6 100644
--- a/cui/source/inc/bbdlg.hxx
+++ b/cui/source/inc/bbdlg.hxx
@@ -32,7 +32,7 @@ public:
bool bEnableSelector,
bool bEnableDrawingLayerFillStyles);
protected:
- virtual void PageCreated(const OString& rPageId, SfxTabPage& rTabPage) override;
+ virtual void PageCreated(const OUString& rPageId, SfxTabPage& rTabPage) override;
private:
bool mbEnableBackgroundSelector : 1; ///< for Border/Background
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 8637f6e8943b..accb555930dc 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -27,6 +27,7 @@
#include <svx/colorbox.hxx>
#include <svx/frmsel.hxx>
#include <svx/flagsdef.hxx>
+#include <unotools/resmgr.hxx>
#include <set>
@@ -75,14 +76,14 @@ private:
class SvxBorderTabPage : public SfxTabPage
{
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
public:
SvxBorderTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs);
virtual ~SvxBorderTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet);
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* rCoreAttrs ) override;
virtual void Reset( const SfxItemSet* ) override;
@@ -127,6 +128,7 @@ private:
std::unique_ptr<SvtLineListBox> m_xLbLineStyle;
std::unique_ptr<ColorListBox> m_xLbLineColor;
+ std::unique_ptr<weld::ComboBox> m_xLineWidthLB;
std::unique_ptr<weld::MetricSpinButton> m_xLineWidthMF;
std::unique_ptr<weld::Container> m_xSpacingFrame;
@@ -164,16 +166,18 @@ private:
DECL_LINK(SelSdwHdl_Impl, ValueSet*, void);
DECL_LINK(LinesChanged_Impl, LinkParamNone*, void);
DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(ModifyWidthHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(SyncHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(ModifyWidthLBHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void);
+ DECL_LINK(SyncHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::Toggleable&, void);
sal_uInt16 GetPresetImageId(sal_uInt16 nValueSetIdx) const;
- const char* GetPresetStringId(sal_uInt16 nValueSetIdx) const;
+ TranslateId GetPresetStringId(sal_uInt16 nValueSetIdx) const;
void FillPresetVS();
void FillShadowVS();
void FillValueSets();
+ void SetLineWidth(sal_Int64 nWidth, sal_Int32 nRemovedType = 0);
// Filler
void FillLineListBox_Impl();
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index ecefed6578d6..1ae5b23a2999 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -19,9 +19,9 @@
#pragma once
-#include <vcl/transfer.hxx>
#include <vcl/timer.hxx>
#include <vcl/weld.hxx>
+#include <vcl/weldutils.hxx>
#include <svtools/valueset.hxx>
#include <com/sun/star/container/XIndexContainer.hpp>
@@ -40,23 +40,24 @@
#include "cfgutil.hxx"
#include "CommandCategoryListBox.hxx"
-#define notebookbarTabScope "notebookbarTabScope"
+inline constexpr OUString notebookbarTabScope = u"notebookbarTabScope"_ustr;
-const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
-inline constexpr OUStringLiteral ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer";
-const char ITEM_DESCRIPTOR_LABEL[] = "Label";
-const char ITEM_DESCRIPTOR_TYPE[] = "Type";
-const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
-const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL";
-inline constexpr OUStringLiteral ITEM_DESCRIPTOR_UINAME = u"UIName";
+inline constexpr OUString ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_LABEL = u"Label"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_TYPE = u"Type"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_STYLE = u"Style"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_ISVISIBLE = u"IsVisible"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_RESOURCEURL = u"ResourceURL"_ustr;
+inline constexpr OUString ITEM_DESCRIPTOR_UINAME = u"UIName"_ustr;
-inline constexpr OUStringLiteral ITEM_MENUBAR_URL = u"private:resource/menubar/menubar";
-constexpr char16_t ITEM_TOOLBAR_URL[] = u"private:resource/toolbar/";
+inline constexpr OUString ITEM_MENUBAR_URL = u"private:resource/menubar/menubar"_ustr;
+inline constexpr OUString ITEM_TOOLBAR_URL = u"private:resource/toolbar/"_ustr;
+inline constexpr OUString ITEM_EVENT_URL = u"private:resource/event/"_ustr;
-inline constexpr OUStringLiteral CUSTOM_TOOLBAR_STR = u"custom_toolbar_";
+inline constexpr OUString CUSTOM_TOOLBAR_STR = u"custom_toolbar_"_ustr;
-const char aMenuSeparatorStr[] = " | ";
+inline constexpr OUString aMenuSeparatorStr = u" | "_ustr;
class SvxConfigEntry;
class SvxConfigPage;
@@ -68,10 +69,12 @@ class SvxConfigDialog : public SfxTabDialogController
private:
css::uno::Reference< css::frame::XFrame > m_xFrame;
+ virtual void ActivatePage(const OUString& rPage) override;
+
public:
SvxConfigDialog(weld::Window*, const SfxItemSet*);
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame);
};
@@ -113,8 +116,8 @@ protected:
public:
SaveInData(
- const css::uno::Reference < css::ui::XUIConfigurationManager >& xCfgMgr,
- const css::uno::Reference < css::ui::XUIConfigurationManager >& xParentCfgMgr,
+ css::uno::Reference < css::ui::XUIConfigurationManager > xCfgMgr,
+ css::uno::Reference < css::ui::XUIConfigurationManager > xParentCfgMgr,
const OUString& aModuleId,
bool docConfig );
@@ -253,8 +256,8 @@ private:
public:
- SvxConfigEntry( const OUString& rDisplayName,
- const OUString& rCommandURL,
+ SvxConfigEntry( OUString aDisplayName,
+ OUString aCommandURL,
bool bPopup,
bool bParentData );
@@ -348,17 +351,16 @@ public:
}
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
void CreateDropDown();
};
-class SvxConfigPageFunctionDropTarget : public DropTargetHelper
+class SvxConfigPageFunctionDropTarget : public weld::ReorderingDropTarget
{
private:
SvxConfigPage& m_rPage;
- weld::TreeView& m_rTreeView;
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
public:
@@ -410,12 +412,14 @@ protected:
std::unique_ptr<weld::ComboBox> m_xSaveInListBox;
+ std::unique_ptr<weld::Widget> m_xCustomizeBox;
std::unique_ptr<weld::MenuButton> m_xInsertBtn;
std::unique_ptr<weld::MenuButton> m_xModifyBtn;
// Used to reset the selected toolbar/menu/context menu
std::unique_ptr<weld::Button> m_xResetBtn;
// Middle buttons
+ std::unique_ptr<weld::Widget> m_xCommandButtons;
std::unique_ptr<weld::Button> m_xAddCommandButton;
std::unique_ptr<weld::Button> m_xRemoveCommandButton;
@@ -466,6 +470,11 @@ protected:
void ReloadTopLevelListBox( SvxConfigEntry const * pSelection = nullptr );
+ static bool IsCommandInMenuList(const SvxConfigEntry *pEntryData,
+ const SvxEntries *pEntries);
+
+ SvxConfigEntry *CreateCommandFromSelection(const OUString &aURL);
+
public:
virtual ~SvxConfigPage() override;
@@ -493,7 +502,7 @@ public:
SvxConfigEntry* GetTopLevelSelection()
{
- return reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_active_id().toInt64());
+ return weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_active_id());
}
/** identifies the module in the given frame. If the frame is <NULL/>, a default
@@ -596,7 +605,6 @@ class SvxNewToolbarDialog : public weld::GenericDialogController
{
private:
std::unique_ptr<weld::Entry> m_xEdtName;
- std::unique_ptr<weld::Button> m_xBtnOK;
public:
std::unique_ptr<weld::ComboBox> m_xSaveInListBox;
@@ -644,8 +652,8 @@ public:
SvxIconSelectorDialog(
weld::Window *pWindow,
- const css::uno::Reference< css::ui::XImageManager >& rXImageManager,
- const css::uno::Reference< css::ui::XImageManager >& rXParentImageManager);
+ css::uno::Reference< css::ui::XImageManager > xImageManager,
+ css::uno::Reference< css::ui::XImageManager > xParentImageManager);
virtual ~SvxIconSelectorDialog() override;
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index bd4e8e8e2d76..b1f22e4065b9 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -31,10 +31,13 @@
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <vcl/weld.hxx>
+#include <config_features.h>
class Button;
class SaveInData;
+#if HAVE_FEATURE_SCRIPTING
class SfxMacroInfoItem;
+#endif
struct SfxStyleInfo_Impl
{
@@ -82,7 +85,8 @@ enum class SfxCfgKind
GROUP_SCRIPTCONTAINER = 3,
FUNCTION_SCRIPT = 4,
GROUP_STYLES = 5,
- GROUP_ALLFUNCTIONS = 6
+ GROUP_ALLFUNCTIONS = 6,
+ GROUP_SIDEBARDECKS = 7
};
struct SfxGroupInfo_Impl
@@ -200,9 +204,9 @@ class CuiConfigGroupListBox
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
std::u16string_view docName);
- void InitModule();
+ sal_Int32 InitModule();
void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
- const weld::TreeIter* pParentEntry, bool bCheapChildrenOnDemand);
+ const weld::TreeIter* pParentEntry);
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation >& xCommands);
OUString MapCommand2UIName(const OUString& sCommand);
@@ -224,8 +228,9 @@ public:
void SetFunctionListBox( CuiConfigFunctionListBox *pBox )
{ m_pFunctionListBox = pBox; }
void GroupSelected();
+#if HAVE_FEATURE_SCRIPTING
void SelectMacro(const SfxMacroInfoItem*);
- void SelectMacro(std::u16string_view, const OUString&);
+#endif
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
};
@@ -238,12 +243,11 @@ class SvxScriptSelectorDialog : public weld::GenericDialogController
std::unique_ptr<CuiConfigGroupListBox> m_xCategories;
std::unique_ptr<CuiConfigFunctionListBox> m_xCommands;
std::unique_ptr<weld::Label> m_xLibraryFT;
- std::unique_ptr<weld::Label> m_xCategoryFT;
std::unique_ptr<weld::Label> m_xMacronameFT;
- std::unique_ptr<weld::Label> m_xCommandsFT;
std::unique_ptr<weld::Button> m_xOKButton;
std::unique_ptr<weld::Button> m_xCancelButton;
std::unique_ptr<weld::TextView> m_xDescriptionText;
+ std::unique_ptr<weld::Frame> m_xDescriptionFrame;
DECL_LINK(ClickHdl, weld::Button&, void);
DECL_LINK(SelectHdl, weld::TreeView&, void);
@@ -259,6 +263,8 @@ public:
OUString GetScriptURL() const;
void SetRunLabel();
+ void SaveLastUsedMacro();
+ void LoadLastUsedMacro();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index bbf227f492fe..b484c7419b83 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -39,7 +39,7 @@ protected:
bool m_bPreviewBackgroundToCharacter;
- SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rAttrSet);
+ SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rAttrSet);
void SetPrevFontWidthScale( const SfxItemSet& rSet );
void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
@@ -61,11 +61,11 @@ struct SvxCharNamePage_Impl;
class SvxCharNamePage : public SvxCharBasePage
{
private:
- static const sal_uInt16 pNameRanges[];
+ static const WhichRangesContainer pNameRanges;
std::unique_ptr<SvxCharNamePage_Impl> m_pImpl;
- std::unique_ptr<weld::Widget> m_xWestFrame;
+ std::unique_ptr<weld::Notebook> m_xWestern;
std::unique_ptr<weld::Label> m_xWestFontNameFT;
std::unique_ptr<weld::ComboBox> m_xWestFontNameLB;
std::unique_ptr<weld::Label> m_xWestFontStyleFT;
@@ -74,10 +74,10 @@ private:
std::unique_ptr<FontSizeBox> m_xWestFontSizeLB;
std::unique_ptr<weld::Label> m_xWestFontLanguageFT;
std::unique_ptr<SvxLanguageBox> m_xWestFontLanguageLB;
- std::unique_ptr<weld::Label> m_xWestFontTypeFT;
std::unique_ptr<weld::Button> m_xWestFontFeaturesButton;
+ std::unique_ptr<weld::Label> m_xWestFontTypeFT;
- std::unique_ptr<weld::Widget> m_xEastFrame;
+ std::unique_ptr<weld::Notebook> m_xCJK_CTL;
std::unique_ptr<weld::Label> m_xEastFontNameFT;
std::unique_ptr<weld::ComboBox> m_xEastFontNameLB;
std::unique_ptr<weld::Label> m_xEastFontStyleFT;
@@ -86,10 +86,9 @@ private:
std::unique_ptr<FontSizeBox> m_xEastFontSizeLB;
std::unique_ptr<weld::Label> m_xEastFontLanguageFT;
std::unique_ptr<SvxLanguageBox> m_xEastFontLanguageLB;
- std::unique_ptr<weld::Label> m_xEastFontTypeFT;
std::unique_ptr<weld::Button> m_xEastFontFeaturesButton;
+ std::unique_ptr<weld::Label> m_xEastFontTypeFT;
- std::unique_ptr<weld::Widget> m_xCTLFrame;
std::unique_ptr<weld::Label> m_xCTLFontNameFT;
std::unique_ptr<weld::ComboBox> m_xCTLFontNameLB;
std::unique_ptr<weld::Label> m_xCTLFontStyleFT;
@@ -98,14 +97,18 @@ private:
std::unique_ptr<FontSizeBox> m_xCTLFontSizeLB;
std::unique_ptr<weld::Label> m_xCTLFontLanguageFT;
std::unique_ptr<SvxLanguageBox> m_xCTLFontLanguageLB;
- std::unique_ptr<weld::Label> m_xCTLFontTypeFT;
std::unique_ptr<weld::Button> m_xCTLFontFeaturesButton;
+ std::unique_ptr<weld::Label> m_xCTLFontTypeFT;
+
+ //for getting FontFeatures
+ ScopedVclPtrInstance<VirtualDevice> m_xVDev;
void Initialize();
const FontList* GetFontList() const;
void UpdatePreview_Impl();
void FillStyleBox_Impl(const weld::Widget& rBox);
void FillSizeBox_Impl(const weld::Widget& rBox);
+ void EnableFeatureButton(const weld::Widget& rNameBox);
enum LanguageGroup
{
@@ -140,7 +143,7 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxCharNamePage() override;
- static const sal_uInt16* GetRanges() { return pNameRanges; }
+ static WhichRangesContainer GetRanges() { return pNameRanges; }
virtual void Reset( const SfxItemSet* rSet ) override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
@@ -159,12 +162,11 @@ public:
class SvxCharEffectsPage : public SvxCharBasePage
{
private:
- static const sal_uInt16 pEffectsRanges[];
+ static const WhichRangesContainer pEffectsRanges;
bool m_bOrigFontColor;
bool m_bNewFontColor;
bool m_bEnableNoneFontColor;
Color m_aOrigFontColor;
- sal_uInt16 m_nHtmlMode;
weld::TriStateEnabled m_aOutlineState;
weld::TriStateEnabled m_aShadowState;
@@ -205,10 +207,10 @@ private:
void SelectHdl_Impl(const weld::ComboBox*);
DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBox&, void);
- DECL_LINK(OutlineBtnClickHdl, weld::ToggleButton&, void);
- DECL_LINK(ShadowBtnClickHdl, weld::ToggleButton&, void);
- DECL_LINK(HiddenBtnClickHdl, weld::ToggleButton&, void);
- DECL_LINK(CbClickHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(OutlineBtnClickHdl, weld::Toggleable&, void);
+ DECL_LINK(ShadowBtnClickHdl, weld::Toggleable&, void);
+ DECL_LINK(HiddenBtnClickHdl, weld::Toggleable&, void);
+ DECL_LINK(CbClickHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ColorBoxSelectHdl_Impl, ColorListBox&, void);
DECL_LINK(ModifyFontTransparencyHdl_Impl, weld::MetricSpinButton&, void);
@@ -220,7 +222,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
public:
- static const sal_uInt16* GetRanges() { return pEffectsRanges; }
+ static WhichRangesContainer GetRanges() { return pEffectsRanges; }
virtual void Reset( const SfxItemSet* rSet ) override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
@@ -233,7 +235,7 @@ public:
// class SvxCharPositionPage ---------------------------------------------
class SvxCharPositionPage : public SvxCharBasePage
{
- static const sal_uInt16 pPositionRanges[];
+ static const WhichRangesContainer pPositionRanges;
private:
short m_nSuperEsc;
@@ -267,15 +269,16 @@ private:
std::unique_ptr<weld::MetricSpinButton> m_xKerningMF;
std::unique_ptr<weld::CheckButton> m_xPairKerningBtn;
+ std::unique_ptr<weld::CheckButton> m_xNoHyphenationBtn;
void Initialize();
void UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
void SetEscapement_Impl( SvxEscapement nEsc );
- DECL_LINK(PositionHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(RotationHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(AutoPositionHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(FitToLineHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(PositionHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(RotationHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(AutoPositionHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(FitToLineHdl_Impl, weld::Toggleable&, void);
DECL_LINK(KerningModifyHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ValueChangedHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ScaleWidthModifyHdl_Impl, weld::MetricSpinButton&, void);
@@ -289,7 +292,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
public:
- static const sal_uInt16* GetRanges() { return pPositionRanges; }
+ static WhichRangesContainer GetRanges() { return pPositionRanges; }
virtual void Reset( const SfxItemSet* rSet ) override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
@@ -303,7 +306,7 @@ public:
class SvxCharTwoLinesPage : public SvxCharBasePage
{
private:
- static const sal_uInt16 pTwoLinesRanges[];
+ static const WhichRangesContainer pTwoLinesRanges;
sal_uInt16 m_nStartBracketPosition;
sal_uInt16 m_nEndBracketPosition;
@@ -317,7 +320,7 @@ private:
void SelectCharacter(weld::TreeView* pBox);
void SetBracket(sal_Unicode cBracket, bool bStart);
- DECL_LINK(TwoLinesHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(TwoLinesHdl_Impl, weld::Toggleable&, void);
DECL_LINK(CharacterMapHdl_Impl, weld::TreeView&, void);
public:
@@ -328,7 +331,7 @@ public:
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
- static const sal_uInt16* GetRanges() { return pTwoLinesRanges; }
+ static WhichRangesContainer GetRanges() { return pTwoLinesRanges; }
virtual void Reset( const SfxItemSet* rSet ) override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx
index ea97a266c882..73891d0ff8e6 100644
--- a/cui/source/inc/connect.hxx
+++ b/cui/source/inc/connect.hxx
@@ -30,7 +30,7 @@ class SdrView;
class SvxConnectionPage : public SfxTabPage
{
private:
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
const SdrView* pView;
@@ -55,13 +55,15 @@ private:
DECL_LINK(ChangeAttrEditHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ChangeAttrListBoxHdl_Impl, weld::ComboBox&, void);
+ template<class T>
+ void SetMetricValueAndSave(const SfxItemSet *rAttrs, weld::MetricSpinButton &rField, TypedWhichId<T> nWhich);
public:
SvxConnectionPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxConnectionPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
index 9b3a5f947016..29484ef8f69c 100644
--- a/cui/source/inc/cuifmsearch.hxx
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -133,7 +133,7 @@ public:
inline void SetActiveField(const OUString& strField);
private:
- void Init(const OUString& strVisibleFields, const OUString& strInitialText);
+ void Init(std::u16string_view strVisibleFields, const OUString& strInitialText);
// only to be used out of the constructors
void OnFound(const css::uno::Any& aCursorPos, sal_Int16 nFieldPos);
@@ -148,7 +148,8 @@ private:
void SaveParams() const;
// Handler for the Controls
- DECL_LINK(OnClickedFieldRadios, weld::Button&, void);
+ DECL_LINK(OnToggledSearchRadio, weld::Toggleable&, void);
+ DECL_LINK(OnToggledFieldRadios, weld::Toggleable&, void);
DECL_LINK(OnClickedSearchAgain, weld::Button&, void);
DECL_LINK(OnClickedSpecialSettings, weld::Button&, void);
@@ -158,7 +159,7 @@ private:
DECL_LINK(OnFieldSelected, weld::ComboBox&, void);
DECL_LINK(OnFocusGrabbed, weld::Widget&, void);
- DECL_LINK(OnCheckBoxToggled, weld::ToggleButton&, void);
+ DECL_LINK(OnCheckBoxToggled, weld::Toggleable&, void);
DECL_LINK(OnContextSelection, weld::ComboBox&, void);
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index 4a20724ffd81..cac63d8a6b1e 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -39,7 +39,7 @@ class SearchProgress;
class TakeProgress;
class TPGalleryThemeProperties;
-typedef std::vector< sal_uLong > TokenList_impl;
+typedef std::vector< sal_Int32 > TokenList_impl;
struct FilterEntry
{
@@ -65,7 +65,7 @@ public:
SearchThread(SearchProgress* pProgress,
TPGalleryThemeProperties* pBrowser,
- const INetURLObject& rStartURL);
+ INetURLObject aStartURL);
};
class SearchProgress : public weld::GenericDialogController
@@ -81,7 +81,7 @@ private:
DECL_LINK(ClickCancelBtn, weld::Button&, void);
public:
- SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL);
+ SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, INetURLObject aStartURL);
void LaunchThread();
virtual ~SearchProgress() override;
@@ -182,7 +182,7 @@ class GalleryThemeProperties : public SfxTabDialogController
{
ExchangeData* pData;
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
public:
GalleryThemeProperties(weld::Widget* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
@@ -251,7 +251,7 @@ class TPGalleryThemeProperties : public SfxTabPage
void DoPreview();
void EndSearchProgressHdl(sal_Int32 nResult);
- DECL_LINK(ClickPreviewHdl, weld::ToggleButton&, void);
+ DECL_LINK(ClickPreviewHdl, weld::Toggleable&, void);
DECL_LINK(ClickSearchHdl, weld::Button&, void);
DECL_LINK(ClickTakeHdl, weld::Button&, void);
DECL_LINK(ClickTakeAllHdl, weld::Button&, void);
@@ -268,7 +268,7 @@ public:
void SetXChgData( ExchangeData* pData );
const ExchangeData* GetXChgData() const { return pData; }
- void StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult );
+ void StartSearchFiles( std::u16string_view _rFolderURL, short _nDlgResult );
static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
};
diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx
index 05cc36292882..075c74c29f42 100644
--- a/cui/source/inc/cuigrfflt.hxx
+++ b/cui/source/inc/cuigrfflt.hxx
@@ -79,7 +79,7 @@ protected:
public:
- GraphicFilterDialog(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, const Graphic& rGraphic);
+ GraphicFilterDialog(weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID, const Graphic& rGraphic);
virtual Graphic GetFilteredGraphic(const Graphic& rGraphic, double fScaleX, double fScaleY) = 0;
};
@@ -101,7 +101,7 @@ private:
std::unique_ptr<weld::MetricSpinButton> mxMtrWidth;
std::unique_ptr<weld::MetricSpinButton> mxMtrHeight;
std::unique_ptr<weld::CheckButton> mxCbxEdges;
- DECL_LINK(CheckBoxModifyHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxModifyHdl, weld::Toggleable&, void);
DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
public:
@@ -117,7 +117,7 @@ class GraphicFilterSolarize : public GraphicFilterDialog
private:
std::unique_ptr<weld::MetricSpinButton> mxMtrThreshold;
std::unique_ptr<weld::CheckButton> mxCbxInvert;
- DECL_LINK(CheckBoxModifyHdl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxModifyHdl, weld::Toggleable&, void);
DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
public:
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index af0124239563..8423d8c49759 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -49,7 +49,7 @@ public:
SvxHlinkCtrl( sal_uInt16 nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg);
virtual void dispose() override;
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) override;
};
@@ -67,12 +67,14 @@ private:
std::vector< std::unique_ptr<IconChoicePageData> > maPageList;
- OString msCurrentPageId;
+ OUString msCurrentPageId;
+ // tdf#90496 - remember last used view in hyperlink dialog
+ static OUString msRememberedPageId;
const SfxItemSet* pSet;
std::unique_ptr<SfxItemSet> pOutSet;
- SfxItemSet* pExampleSet;
- std::unique_ptr<sal_uInt16[]> pRanges;
+ std::unique_ptr<SfxItemSet> pExampleSet;
+ WhichRangesContainer pRanges;
SvxHlinkCtrl maCtrl; ///< Controller
std::unique_ptr<SfxItemSet> mpItemSet;
@@ -87,17 +89,17 @@ private:
std::unique_ptr<weld::Button> m_xHelpBtn;
std::unique_ptr<weld::Button> m_xResetBtn;
- DECL_LINK( ChosePageHdl_Impl, const OString&, void );
+ DECL_LINK( ChosePageHdl_Impl, const OUString&, void );
- IconChoicePageData* GetPageData ( std::string_view rId );
+ IconChoicePageData* GetPageData ( std::u16string_view rId );
- void SwitchPage( const OString& rId );
+ void SwitchPage( const OUString& rId );
DECL_LINK( ResetHdl, weld::Button&, void) ;
DECL_LINK (ClickOkHdl_Impl, weld::Button&, void );
DECL_LINK (ClickApplyHdl_Impl, weld::Button&, void );
- IconChoicePage* GetTabPage( std::string_view rPageId )
+ IconChoicePage* GetTabPage( std::u16string_view rPageId )
{ return GetPageData(rPageId)->xPage.get(); }
void ActivatePageImpl ();
@@ -113,14 +115,14 @@ public:
virtual ~SvxHpLinkDlg () override;
// interface
- void AddTabPage(const OString &rId, CreatePage pCreateFunc /* != NULL */);
+ void AddTabPage(const OUString &rId, CreatePage pCreateFunc /* != NULL */);
- void SetCurPageId( const OString& rId ) { msCurrentPageId = rId; SwitchPage(rId ); }
- const OString & GetCurPageId() const { return msCurrentPageId; }
- void ShowPage( const OString& rId );
+ void SetCurPageId( const OUString& rId ) { msCurrentPageId = rId; SwitchPage(rId ); }
+ const OUString& GetCurPageId() const { return msCurrentPageId; }
+ void ShowPage( const OUString& rId );
/// gives via map converted local slots if applicable
- const sal_uInt16* GetInputRanges( const SfxItemPool& );
+ WhichRangesContainer GetInputRanges( const SfxItemPool& );
void SetInputSet( const SfxItemSet* pInSet );
void Start();
diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx
index 42cdbbec3aa9..0ee8cacb6c50 100644
--- a/cui/source/inc/cuioptgenrl.hxx
+++ b/cui/source/inc/cuioptgenrl.hxx
@@ -32,10 +32,16 @@ class SvxGeneralTabPage : public SfxTabPage
private:
// the "Use data for document properties" checkbox
std::unique_ptr<weld::CheckButton> m_xUseDataCB;
+ std::unique_ptr<weld::Widget> m_xUseDataImg;
std::unique_ptr<weld::Widget> m_xCryptoFrame;
std::unique_ptr<weld::ComboBox> m_xSigningKeyLB;
+ std::unique_ptr<weld::Label> m_xSigningKeyFT;
+ std::unique_ptr<weld::Widget> m_xSigningKeyImg;
std::unique_ptr<weld::ComboBox> m_xEncryptionKeyLB;
+ std::unique_ptr<weld::Label> m_xEncryptionKeyFT;
+ std::unique_ptr<weld::Widget> m_xEncryptionKeyImg;
std::unique_ptr<weld::CheckButton> m_xEncryptToSelfCB;
+ std::unique_ptr<weld::Widget> m_xEncryptToSelfImg;
// rows
struct Row;
std::vector<std::shared_ptr<Row> > vRows;
@@ -64,6 +70,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index aa660c6d791d..3e810c5b0dbe 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -39,8 +39,8 @@ class ButtonBox
{
private:
sal_Int32 mnCurrentButton;
- std::vector<weld::ToggleButton*> maButtonList;
- std::map<weld::ToggleButton*, sal_Int32 > maButtonToPos;
+ std::vector<weld::Toggleable*> maButtonList;
+ std::map<weld::Toggleable*, sal_Int32 > maButtonToPos;
void SelectButtonImpl( sal_Int32 nPos )
{
if(mnCurrentButton != NO_BUTTON_SELECTED)
@@ -55,21 +55,21 @@ class ButtonBox
{
mnCurrentButton = NO_BUTTON_SELECTED;
};
- void AddButton(weld::ToggleButton* pButton)
+ void AddButton(weld::Toggleable* pButton)
{
maButtonList.push_back(pButton);
maButtonToPos.insert( std::make_pair(pButton, maButtonList.size() - 1) );
}
sal_Int32 GetCurrentButtonPos() const { return mnCurrentButton; }
- sal_Int32 GetButtonPos(weld::ToggleButton* pButton)
+ sal_Int32 GetButtonPos(weld::Toggleable* pButton)
{
- std::map<weld::ToggleButton*, sal_Int32>::const_iterator aBtnPos = maButtonToPos.find(pButton);
+ std::map<weld::Toggleable*, sal_Int32>::const_iterator aBtnPos = maButtonToPos.find(pButton);
if(aBtnPos != maButtonToPos.end())
return aBtnPos->second;
else
return -1;
}
- void SelectButton(weld::ToggleButton* pButton)
+ void SelectButton(weld::Toggleable* pButton)
{
sal_Int32 nPos = GetButtonPos(pButton);
if(nPos != -1)
@@ -108,14 +108,15 @@ class SvxAreaTabDialog final : public SfxTabDialogController
ChangeType mnGradientListState;
ChangeType mnHatchingListState;
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
virtual short Ok() override;
DECL_LINK(CancelHdlImpl, weld::Button&, void);
void SavePalettes();
public:
- SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow);
+ SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow,
+ bool bSlideBackground);
void SetNewColorList( XColorListRef const & pColorList )
{ mpNewColorList = pColorList; }
@@ -126,7 +127,7 @@ public:
class SvxTransparenceTabPage : public SfxTabPage
{
- static const sal_uInt16 pTransparenceRanges[];
+ static const WhichRangesContainer pTransparenceRanges;
const SfxItemSet& rOutAttrs;
@@ -168,9 +169,12 @@ class SvxTransparenceTabPage : public SfxTabPage
std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
- DECL_LINK(ClickTransOffHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(ClickTransLinearHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(ClickTransGradientHdl_Impl, weld::ToggleButton&, void );
+ // MCGR: Preserve ColorStops until we have a UI to edit these
+ basegfx::BColorStops maColorStops;
+
+ DECL_LINK(ClickTransOffHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(ClickTransLinearHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(ClickTransGradientHdl_Impl, weld::Toggleable&, void );
DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ModifiedTrgrEditHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ModifiedTrgrListBoxHdl_Impl, weld::ComboBox&, void);
@@ -183,12 +187,15 @@ class SvxTransparenceTabPage : public SfxTabPage
bool InitPreview ( const SfxItemSet& rSet );
void InvalidatePreview (bool bEnable = true );
+ // MCGR: Preserve ColorStops until we have a UI to edit these
+ basegfx::BColorStops createColorStops();
+
public:
SvxTransparenceTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxTransparenceTabPage() override;
static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
- static const sal_uInt16* GetRanges() { return pTransparenceRanges; }
+ static WhichRangesContainer GetRanges() { return pTransparenceRanges; }
virtual bool FillItemSet(SfxItemSet*) override;
virtual void Reset(const SfxItemSet*) override;
@@ -205,7 +212,7 @@ public:
class SvxAreaTabPage : public SfxTabPage
{
- static const sal_uInt16 pAreaRanges[];
+ static const WhichRangesContainer pAreaRanges;
private:
std::unique_ptr<SfxTabPage> m_xFillTabPage;
ButtonBox maBox;
@@ -235,22 +242,22 @@ private:
protected:
std::unique_ptr<weld::Container> m_xFillTab;
- std::unique_ptr<weld::ToggleButton> m_xBtnNone;
- std::unique_ptr<weld::ToggleButton> m_xBtnColor;
- std::unique_ptr<weld::ToggleButton> m_xBtnGradient;
- std::unique_ptr<weld::ToggleButton> m_xBtnHatch;
- std::unique_ptr<weld::ToggleButton> m_xBtnBitmap;
- std::unique_ptr<weld::ToggleButton> m_xBtnPattern;
+ std::unique_ptr<weld::Toggleable> m_xBtnNone;
+ std::unique_ptr<weld::Toggleable> m_xBtnColor;
+ std::unique_ptr<weld::Toggleable> m_xBtnGradient;
+ std::unique_ptr<weld::Toggleable> m_xBtnHatch;
+ std::unique_ptr<weld::Toggleable> m_xBtnBitmap;
+ std::unique_ptr<weld::Toggleable> m_xBtnPattern;
+ std::unique_ptr<weld::Toggleable> m_xBtnUseBackground;
void SetOptimalSize(weld::DialogController* pController);
- void SelectFillType( weld::ToggleButton& rButton, const SfxItemSet* _pSet = nullptr );
- SfxTabPage* GetFillTabPage() { return m_xFillTabPage.get(); }
+ void SelectFillType( weld::Toggleable& rButton, const SfxItemSet* _pSet = nullptr );
bool IsBtnClicked() const { return m_bBtnClicked; }
private:
- DECL_LINK(SelectFillTypeHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(SelectFillTypeHdl_Impl, weld::Toggleable&, void);
template< typename TabPage >
bool FillItemSet_Impl( SfxItemSet* );
@@ -260,11 +267,17 @@ private:
DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet );
public:
- SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
+ SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs, bool bSlideBackground = false);
virtual ~SvxAreaTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pAreaRanges; }
+ static std::unique_ptr<SfxTabPage>
+ CreateWithSlideBackground(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet*);
+ static WhichRangesContainer GetRanges() { return pAreaRanges; }
+
+ virtual OUString GetAllStrings() override;
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
@@ -279,7 +292,7 @@ public:
void SetBitmapList( XBitmapListRef const & pBmpLst) { m_pBitmapList = pBmpLst; }
void SetPatternList( XPatternListRef const &pPtrnLst ) { m_pPatternList = pPtrnLst; }
virtual void PageCreated(const SfxAllItemSet& aSet) override;
- void CreatePage(sal_Int32 nId, SfxTabPage* pTab);
+ void CreatePage(sal_Int32 nId, SfxTabPage& rTab);
void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
void SetGrdChgd( ChangeType* pIn ) { m_pnGradientListState = pIn; }
void SetHtchChgd( ChangeType* pIn ) { m_pnHatchingListState = pIn; }
@@ -290,7 +303,7 @@ public:
class SvxShadowTabPage : public SvxTabPage
{
- static const sal_uInt16 pShadowRanges[];
+ static const WhichRangesContainer pShadowRanges;
private:
const SfxItemSet& m_rOutAttrs;
@@ -315,7 +328,7 @@ private:
std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
- DECL_LINK(ClickShadowHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(ClickShadowHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ModifyShadowHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(SelectShadowHdl_Impl, ColorListBox&, void);
@@ -324,7 +337,7 @@ public:
virtual ~SvxShadowTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pShadowRanges; }
+ static WhichRangesContainer GetRanges() { return pShadowRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
@@ -355,6 +368,9 @@ private:
XFillAttrSetItem m_aXFillAttr;
SfxItemSet& m_rXFSet;
+ // MCGR: Preserve ColorStops until we have a UI to edit these
+ basegfx::BColorStops m_aColorStops;
+
SvxXRectPreview m_aCtlPreview;
std::unique_ptr<weld::ComboBox> m_xLbGradientType;
std::unique_ptr<weld::Label> m_xFtCenter;
@@ -387,13 +403,16 @@ private:
DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void );
DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
- DECL_LINK( ChangeAutoStepHdl_Impl, weld::ToggleButton&, void );
+ DECL_LINK( ChangeAutoStepHdl_Impl, weld::Toggleable&, void );
DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
void ModifiedHdl_Impl(void const *);
void SetControlState_Impl( css::awt::GradientStyle eXGS );
sal_Int32 SearchGradientList(std::u16string_view rGradientName);
+ // MCGR: Preserve ColorStops until we have a UI to edit these
+ basegfx::BColorStops createColorStops();
+
public:
SvxGradientTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxGradientTabPage() override;
@@ -451,7 +470,7 @@ private:
DECL_LINK( ModifiedEditHdl_Impl, weld::MetricSpinButton&, void );
DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
- DECL_LINK( ToggleHatchBackgroundColor_Impl, weld::ToggleButton&, void );
+ DECL_LINK( ToggleHatchBackgroundColor_Impl, weld::Toggleable&, void );
DECL_LINK( ModifiedBackgroundHdl_Impl, ColorListBox&, void );
DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
void ModifiedHdl_Impl(void const *);
@@ -527,7 +546,7 @@ private:
std::unique_ptr<weld::CustomWeld> m_xBitmapLBWin;
DECL_LINK( ModifyBitmapHdl, ValueSet*, void );
- DECL_LINK( ClickScaleHdl, weld::Button&, void );
+ DECL_LINK( ClickScaleHdl, weld::Toggleable&, void );
DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBox&, void );
DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void );
DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBox&, void );
@@ -639,10 +658,8 @@ private:
ColorModel eCM;
- Color aPreviousColor;
- Color aCurrentColor;
-
- css::uno::Reference< css::uno::XComponentContext > m_context;
+ Color m_aPreviousColor;
+ NamedColor m_aCurrentColor;
PaletteManager maPaletteManager;
SvxXRectPreview m_aCtlPreviewOld;
@@ -675,6 +692,7 @@ private:
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnDelete;
std::unique_ptr<weld::Button> m_xBtnWorkOn;
+ std::unique_ptr<weld::Button> m_xMoreColors;
std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld;
std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew;
std::unique_ptr<weld::CustomWeld> m_xValSetColorListWin;
@@ -692,11 +710,12 @@ private:
DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
DECL_LINK(ClickWorkOnHdl_Impl, weld::Button&, void);
DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
+ DECL_STATIC_LINK(SvxColorTabPage, OnMoreColorsClick, weld::Button&, void);
DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
- DECL_LINK( SelectColorModeHdl_Impl, weld::ToggleButton&, void );
- void ChangeColor(const Color &rNewColor, bool bUpdatePreset = true);
+ DECL_LINK( SelectColorModeHdl_Impl, weld::Toggleable&, void );
+ void ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset = true);
void SetColorModel(ColorModel eModel);
void ChangeColorModel();
void UpdateColorValues( bool bUpdatePreset = true );
@@ -728,8 +747,6 @@ public:
void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
- void SetCtlPreviewOld( const SfxItemSet& rAttrs ) { m_aCtlPreviewOld.SetAttributes( rAttrs ); }
-
virtual void FillUserData() override;
};
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 2839927c1bc8..1122a2017f00 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -19,6 +19,7 @@
#pragma once
+#include <memory>
#include <vector>
#include <editeng/brushitem.hxx>
#include <sfx2/tabdlg.hxx>
@@ -53,7 +54,7 @@ class SvxLineTabDialog final : public SfxTabDialogController
sal_Int32 nPosDashLb;
sal_Int32 nPosLineEndLb;
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
virtual short Ok() override;
DECL_LINK(CancelHdlImpl, weld::Button&, void);
@@ -86,7 +87,7 @@ struct SvxBmpItemInfo
class SvxLineTabPage : public SfxTabPage
{
- static const sal_uInt16 pLineRanges[];
+ static const WhichRangesContainer pLineRanges;
private:
//#58425# symbols on a line (e. g. StarChart) ->
/** a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview.
@@ -95,9 +96,9 @@ private:
bool m_bNewSize;
/// a graphic to be displayed in the preview in case that an automatic symbol is chosen
Graphic m_aAutoSymbolGraphic;
- tools::Long m_nSymbolType;
+ sal_Int32 m_nSymbolType;
/// attributes for the shown symbols; only necessary if not equal to line properties
- SfxItemSet* m_pSymbolAttr;
+ std::unique_ptr<SfxItemSet> m_xSymbolAttr;
std::vector<OUString> m_aGrfNames;
std::vector< std::unique_ptr<SvxBmpItemInfo> >
@@ -169,19 +170,19 @@ private:
std::unique_ptr<weld::CheckButton> m_xSymbolRatioCB;
// handler for gallery popup menu button + size
- DECL_LINK(GraphicHdl_Impl, const OString&, void);
+ DECL_LINK(GraphicHdl_Impl, const OUString&, void);
DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(MenuCreateHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(RatioHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(MenuCreateHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ClickInvisibleHdl_Impl, weld::ComboBox&, void);
void ClickInvisibleHdl_Impl();
- DECL_LINK(ChangeStartClickHdl_Impl, weld::Button&, void);
+ DECL_LINK(ChangeStartClickHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ChangeStartListBoxHdl_Impl, weld::ComboBox&, void);
DECL_LINK(ChangeStartModifyHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ChangeEndListBoxHdl_Impl, weld::ComboBox&, void);
DECL_LINK(ChangeEndModifyHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(ChangeEndClickHdl_Impl, weld::Button&, void);
+ DECL_LINK(ChangeEndClickHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ChangePreviewListBoxHdl_Impl, ColorListBox&, void);
DECL_LINK(ChangePreviewModifyHdl_Impl, weld::MetricSpinButton&, void);
void ChangePreviewHdl_Impl(const weld::MetricSpinButton*);
@@ -205,7 +206,7 @@ public:
void Construct();
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pLineRanges; }
+ static WhichRangesContainer GetRanges() { return pLineRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet* ) override;
@@ -282,10 +283,10 @@ private:
DECL_LINK(ChangeNumber2Hdl_Impl, weld::SpinButton&, void);
DECL_LINK(ClickLoadHdl_Impl, weld::Button&, void);
DECL_LINK(ClickSaveHdl_Impl, weld::Button&, void);
- DECL_LINK(ChangeMetricHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(ChangeMetricHdl_Impl, weld::Toggleable&, void);
DECL_LINK(SelectTypeListBoxHdl_Impl, weld::ComboBox&, void);
void SelectTypeHdl_Impl(const weld::ComboBox*);
- void ChangeMetricHdl_Impl(const weld::ToggleButton*);
+ void ChangeMetricHdl_Impl(const weld::Toggleable*);
void CheckChanges_Impl();
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index 3e8b592228bb..3b26e5190cb0 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/dbregister.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <rtl/ustring.hxx>
+#include <tools/solar.h>
#include <sfx2/basedlgs.hxx>
#include <sfx2/tabdlg.hxx>
@@ -29,7 +30,7 @@ namespace svx
class DbRegistrationOptionsPage : public SfxTabPage
{
private:
- sal_uLong m_nOldCount;
+ size_t m_nOldCount;
bool m_bModified;
std::unique_ptr<weld::Button> m_xNew;
@@ -72,6 +73,8 @@ namespace svx
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
@@ -88,7 +91,7 @@ namespace svx
SfxItemSet m_aRegistrationItems;
protected:
- RegistrationItemSetHolder( const SfxItemSet& _rMasterSet );
+ RegistrationItemSetHolder( SfxItemSet _aMasterSet );
~RegistrationItemSetHolder();
protected:
diff --git a/cui/source/inc/dialmgr.hxx b/cui/source/inc/dialmgr.hxx
index c31fde3a27a3..a26c0b25d32b 100644
--- a/cui/source/inc/dialmgr.hxx
+++ b/cui/source/inc/dialmgr.hxx
@@ -20,7 +20,8 @@
#pragma once
#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
-OUString CuiResId(const char* pKey);
+OUString CuiResId(TranslateId aKey);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
deleted file mode 100644
index 06e70562fc8d..000000000000
--- a/cui/source/inc/dlgname.hxx
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#pragma once
-
-#include <vcl/weld.hxx>
-
-/// Dialog for editing a name
-class SvxNameDialog : public weld::GenericDialogController
-{
-private:
- std::unique_ptr<weld::Entry> m_xEdtName;
- std::unique_ptr<weld::Label> m_xFtDescription;
- std::unique_ptr<weld::Button> m_xBtnOK;
-
- Link<SvxNameDialog&, bool> m_aCheckNameHdl;
- Link<SvxNameDialog&, OUString> m_aCheckNameTooltipHdl;
-
- DECL_LINK(ModifyHdl, weld::Entry&, void);
-
-public:
- SvxNameDialog(weld::Window* pWindow, const OUString& rName, const OUString& rDesc);
-
- OUString GetName() const { return m_xEdtName->get_text(); }
-
- /** add a callback Link that is called whenever the content of the edit
- field is changed. The Link result determines whether the OK
- Button is enabled (> 0) or disabled (== 0).
-
- @param rLink a Callback declared with DECL_LINK and implemented with
- IMPL_LINK, that is executed on modification.
-
- @param bCheckImmediately If true, the Link is called directly after
- setting it. It is recommended to set this flag to true to avoid
- an inconsistent state if the initial String (given in the CTOR)
- does not satisfy the check condition.
-
- @todo Remove the parameter bCheckImmediately and incorporate the 'true'
- behaviour as default.
- */
- void SetCheckNameHdl(const Link<SvxNameDialog&, bool>& rLink, bool bCheckImmediately)
- {
- m_aCheckNameHdl = rLink;
- if (bCheckImmediately)
- m_xBtnOK->set_sensitive(rLink.Call(*this));
- }
-
- void SetCheckNameTooltipHdl(const Link<SvxNameDialog&, OUString>& rLink)
- {
- m_aCheckNameTooltipHdl = rLink;
- m_xBtnOK->set_tooltip_text(rLink.Call(*this));
- }
-
- void SetEditHelpId(const OString& aHelpId) { m_xEdtName->set_help_id(aHelpId); }
-};
-
-/** #i68101#
- Dialog for editing Object name
- plus uniqueness-callback-linkHandler */
-class SvxObjectNameDialog : public weld::GenericDialogController
-{
-private:
- // name
- std::unique_ptr<weld::Entry> m_xEdtName;
-
- // buttons
- std::unique_ptr<weld::Button> m_xBtnOK;
-
- // callback link for name uniqueness
- Link<SvxObjectNameDialog&, bool> aCheckNameHdl;
-
- DECL_LINK(ModifyHdl, weld::Entry&, void);
-
-public:
- // constructor
- SvxObjectNameDialog(weld::Window* pWindow, const OUString& rName);
-
- // data access
- OUString GetName() const { return m_xEdtName->get_text(); }
-
- // set handler
- void SetCheckNameHdl(const Link<SvxObjectNameDialog&, bool>& rLink) { aCheckNameHdl = rLink; }
-};
-
-/** #i68101#
- Dialog for editing Object Title and Description */
-class SvxObjectTitleDescDialog : public weld::GenericDialogController
-{
-private:
- // title
- std::unique_ptr<weld::Entry> m_xEdtTitle;
-
- // description
- std::unique_ptr<weld::TextView> m_xEdtDescription;
-
-public:
- // constructor
- SvxObjectTitleDescDialog(weld::Window* pWindow, const OUString& rTitle, const OUString& rDesc);
- // data access
- OUString GetTitle() const { return m_xEdtTitle->get_text(); }
- OUString GetDescription() const { return m_xEdtDescription->get_text(); }
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/fileextcheckdlg.hxx b/cui/source/inc/fileextcheckdlg.hxx
new file mode 100644
index 000000000000..968deae77177
--- /dev/null
+++ b/cui/source/inc/fileextcheckdlg.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <vcl/weld.hxx>
+
+class FileExtCheckDialog : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::Label> m_pText;
+ std::unique_ptr<weld::CheckButton> m_pPerformCheck;
+ std::unique_ptr<weld::Button> m_pOk;
+
+ DECL_LINK(OnOkClick, weld::Button&, void);
+
+public:
+ FileExtCheckDialog(weld::Window* pWindow, const OUString& sTitle, const OUString& sMsg);
+ virtual ~FileExtCheckDialog() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index 35653eaf6ade..673062b7593a 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -49,13 +49,14 @@ class SvxGrfCropPage : public SfxTabPage
{
friend class VclPtr<SvxGrfCropPage>;
- OUString aGraphicName;
- Size aOrigSize;
- Size aOrigPixelSize;
- Size aPageSize;
- tools::Long nOldWidth;
- tools::Long nOldHeight;
- bool bSetOrigSize;
+ OUString m_aGraphicName;
+ Size m_aOrigSize;
+ Size m_aOrigPixelSize;
+ Size m_aPageSize;
+ tools::Long m_nOldWidth;
+ tools::Long m_nOldHeight;
+ bool m_bSetOrigSize;
+ sal_Int32 m_aPreferredDPI;
SvxCropExample m_aExampleWN;
@@ -79,6 +80,8 @@ class SvxGrfCropPage : public SfxTabPage
std::unique_ptr<weld::Label> m_xOrigSizeFT;
std::unique_ptr<weld::Button> m_xOrigSizePB;
+ std::unique_ptr<weld::Button> m_xUncropPB;
+
// Example
std::unique_ptr<weld::CustomWeld> m_xExampleWN;
@@ -86,13 +89,14 @@ class SvxGrfCropPage : public SfxTabPage
DECL_LINK(SizeHdl, weld::MetricSpinButton&, void);
DECL_LINK(CropModifyHdl, weld::MetricSpinButton&, void);
DECL_LINK(OrigSizeHdl, weld::Button&, void);
+ DECL_LINK(UncropHdl, weld::Button&, void);
void CalcZoom();
void CalcMinMaxBorder();
void GraphicHasChanged(bool bFound);
virtual void ActivatePage(const SfxItemSet& rSet) override;
- static Size GetGrfOrigSize(const Graphic&);
+ Size GetGrfOrigSize(const Graphic& rGraphic);
public:
SvxGrfCropPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet );
diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx
index 716efa0827b8..57c3284d61b3 100644
--- a/cui/source/inc/hangulhanjadlg.hxx
+++ b/cui/source/inc/hangulhanjadlg.hxx
@@ -96,7 +96,7 @@ namespace svx
bool m_bDocumentMode;
Link<LinkParamNone*,void> m_aOptionsChangedLink;
- Link<weld::ToggleButton&,void> m_aClickByCharacterLink;
+ Link<weld::Toggleable&,void> m_aClickByCharacterLink;
std::unique_ptr<weld::Button> m_xFind;
std::unique_ptr<weld::Button> m_xIgnore;
@@ -128,8 +128,8 @@ namespace svx
void SetChangeHdl( const Link<weld::Button&,void>& _rHdl );
void SetChangeAllHdl( const Link<weld::Button&,void>& _rHdl );
- void SetClickByCharacterHdl( const Link<weld::ToggleButton&,void>& _rHdl );
- void SetConversionFormatChangedHdl( const Link<weld::Button&,void>& _rHdl );
+ void SetClickByCharacterHdl( const Link<weld::Toggleable&,void>& _rHdl );
+ void SetConversionFormatChangedHdl( const Link<weld::Toggleable&,void>& _rHdl );
void SetFindHdl( const Link<weld::Button&,void>& _rHdl );
OUString GetCurrentString( ) const;
@@ -164,8 +164,8 @@ namespace svx
DECL_LINK( OnOption, weld::Button&, void );
DECL_LINK( OnSuggestionModified, weld::Entry&, void );
DECL_LINK( OnSuggestionSelected, SuggestionDisplay&, void );
- DECL_LINK( OnConversionDirectionClicked, weld::ToggleButton&, void );
- DECL_LINK( ClickByCharacterHdl, weld::ToggleButton&, void );
+ DECL_LINK( OnConversionDirectionClicked, weld::Toggleable&, void );
+ DECL_LINK( ClickByCharacterHdl, weld::Toggleable&, void );
/// fill the suggestion list box with suggestions for the actual input
void FillSuggestions( const css::uno::Sequence< OUString >& _rSuggestions );
diff --git a/cui/source/inc/helpids.h b/cui/source/inc/helpids.h
index 437552504d95..8f9af7fd9570 100644
--- a/cui/source/inc/helpids.h
+++ b/cui/source/inc/helpids.h
@@ -18,26 +18,35 @@
*/
#pragma once
-#define HID_OPTIONS_COLORCONFIG_SAVE_SCHEME "CUI_HID_OPTIONS_COLORCONFIG_SAVE_SCHEME"
-#define HID_OFA_FONT_SUBST_CLB "CUI_HID_OFA_FONT_SUBST_CLB"
-#define HID_DBPATH_CTL_PATH "CUI_HID_DBPATH_CTL_PATH"
+#include <rtl/ustring.hxx>
+
+inline constexpr OUString HID_OPTIONS_COLORCONFIG_SAVE_SCHEME
+ = u"CUI_HID_OPTIONS_COLORCONFIG_SAVE_SCHEME"_ustr;
+inline constexpr OUString HID_OFA_FONT_SUBST_CLB = u"CUI_HID_OFA_FONT_SUBST_CLB"_ustr;
+inline constexpr OUString HID_DBPATH_CTL_PATH = u"CUI_HID_DBPATH_CTL_PATH"_ustr;
#define HID_DBPATH_HEADERBAR "CUI_HID_DBPATH_HEADERBAR"
-#define HID_OFADLG_TREELISTBOX "CUI_HID_OFADLG_TREELISTBOX"
-#define HID_SVX_CONFIG_TOOLBAR "CUI_HID_SVX_CONFIG_TOOLBAR"
-#define HID_SVX_CONFIG_TOOLBAR_CONTENTS "CUI_HID_SVX_CONFIG_TOOLBAR_CONTENTS"
-#define HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS "CUI_HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS"
-#define HID_HANGULDLG_SUGGESTIONS_GRID "CUI_HID_HANGULDLG_SUGGESTIONS_GRID"
-#define HID_HANGULDLG_SUGGESTIONS_LIST "CUI_HID_HANGULDLG_SUGGESTIONS_LIST"
-#define HID_SVX_CONFIG_NAME_SUBMENU "CUI_HID_SVX_CONFIG_NAME_SUBMENU"
-#define HID_SVX_CONFIG_RENAME_MENU "CUI_HID_SVX_CONFIG_RENAME_MENU"
-#define HID_SVX_CONFIG_RENAME_MENU_ITEM "CUI_HID_SVX_CONFIG_RENAME_MENU_ITEM"
-#define HID_SVX_CONFIG_RENAME_TOOLBAR "CUI_HID_SVX_CONFIG_RENAME_TOOLBAR"
-#define HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM "CUI_HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM"
-#define HID_SVX_UP_TOOLBAR_ITEM "CUI_HID_SVX_UP_TOOLBAR_ITEM"
-#define HID_SVX_DOWN_TOOLBAR_ITEM "CUI_HID_SVX_DOWN_TOOLBAR_ITEM"
-#define HID_SVX_SAVE_IN "CUI_HID_SVX_SAVE_IN"
-#define HID_SVX_TOPLEVELLISTBOX "CUI_HID_SVX_TOPLEVELLISTBOX"
-#define HID_SVX_DESCFIELD "CUI_HID_SVX_DESCFIELD"
-#define HID_MACRO_HEADERTABLISTBOX "CUI_HID_MACRO_HEADERTABLISTBOX"
+inline constexpr OUString HID_OFADLG_TREELISTBOX = u"CUI_HID_OFADLG_TREELISTBOX"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_TOOLBAR = u"CUI_HID_SVX_CONFIG_TOOLBAR"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_TOOLBAR_CONTENTS
+ = u"CUI_HID_SVX_CONFIG_TOOLBAR_CONTENTS"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS
+ = u"CUI_HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS"_ustr;
+inline constexpr OUString HID_HANGULDLG_SUGGESTIONS_GRID
+ = u"CUI_HID_HANGULDLG_SUGGESTIONS_GRID"_ustr;
+inline constexpr OUString HID_HANGULDLG_SUGGESTIONS_LIST
+ = u"CUI_HID_HANGULDLG_SUGGESTIONS_LIST"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_NAME_SUBMENU = u"CUI_HID_SVX_CONFIG_NAME_SUBMENU"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_RENAME_MENU = u"CUI_HID_SVX_CONFIG_RENAME_MENU"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_RENAME_MENU_ITEM
+ = u"CUI_HID_SVX_CONFIG_RENAME_MENU_ITEM"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_RENAME_TOOLBAR = u"CUI_HID_SVX_CONFIG_RENAME_TOOLBAR"_ustr;
+inline constexpr OUString HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM
+ = u"CUI_HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM"_ustr;
+inline constexpr OUString HID_SVX_UP_TOOLBAR_ITEM = u"CUI_HID_SVX_UP_TOOLBAR_ITEM"_ustr;
+inline constexpr OUString HID_SVX_DOWN_TOOLBAR_ITEM = u"CUI_HID_SVX_DOWN_TOOLBAR_ITEM"_ustr;
+inline constexpr OUString HID_SVX_SAVE_IN = u"CUI_HID_SVX_SAVE_IN"_ustr;
+inline constexpr OUString HID_SVX_TOPLEVELLISTBOX = u"CUI_HID_SVX_TOPLEVELLISTBOX"_ustr;
+inline constexpr OUString HID_SVX_DESCFIELD = u"CUI_HID_SVX_DESCFIELD"_ustr;
+inline constexpr OUString HID_MACRO_HEADERTABLISTBOX = u"CUI_HID_MACRO_HEADERTABLISTBOX"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx
index 95a11dd9f1fc..68bce1650a00 100644
--- a/cui/source/inc/hldocntp.hxx
+++ b/cui/source/inc/hldocntp.hxx
@@ -34,7 +34,7 @@ private:
std::unique_ptr<weld::Button> m_xBtCreate;
std::unique_ptr<weld::TreeView> m_xLbDocTypes;
- bool ImplGetURLObject( const OUString& rPath, const OUString& rBase, INetURLObject& aURLObject ) const;
+ bool ImplGetURLObject( const OUString& rPath, std::u16string_view rBase, INetURLObject& aURLObject ) const;
void FillDocumentList ();
DECL_LINK (ClickNewHdl_Impl, weld::Button&, void );
@@ -42,7 +42,7 @@ private:
protected:
void FillDlgFields(const OUString& rStrURL) override;
- void GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+ void GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode ) override;
@@ -52,7 +52,6 @@ public:
static std::unique_ptr<IconChoicePage> Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet);
- virtual bool AskApply () override;
virtual void DoApply () override;
virtual void SetInitFocus() override;
diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx
index 73f6218eabc5..61005a42d635 100644
--- a/cui/source/inc/hldoctp.hxx
+++ b/cui/source/inc/hldoctp.hxx
@@ -49,10 +49,10 @@ private:
DECL_LINK( TimeoutHdl_Impl, Timer *, void ); ///< Handler for timer -timeout
enum class EPathType { Invalid, ExistsFile };
- static EPathType GetPathType ( const OUString& rStrPath );
+ static EPathType GetPathType ( std::u16string_view rStrPath );
void FillDlgFields(const OUString& rStrURL) override;
- void GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+ void GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode ) override;
virtual bool ShouldOpenMarkWnd () override {return m_bMarkWndOpen;}
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index c317fc122fd4..366d8243a8b6 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -18,6 +18,10 @@
*/
#pragma once
+#include <sal/config.h>
+
+#include <string_view>
+
#include "cuihyperdlg.hxx"
#include "hltpbase.hxx"
@@ -30,47 +34,31 @@
class SvxHyperlinkInternetTp : public SvxHyperlinkTabPageBase
{
private:
- OUString maStrOldUser;
- OUString maStrOldPassword;
-
bool m_bMarkWndOpen;
- std::unique_ptr<weld::RadioButton> m_xRbtLinktypInternet;
- std::unique_ptr<weld::RadioButton> m_xRbtLinktypFTP;
std::unique_ptr<SvxHyperURLBox> m_xCbbTarget;
std::unique_ptr<weld::Label> m_xFtTarget;
- std::unique_ptr<weld::Label> m_xFtLogin;
- std::unique_ptr<weld::Entry> m_xEdLogin;
- std::unique_ptr<weld::Label> m_xFtPassword;
- std::unique_ptr<weld::Entry> m_xEdPassword;
- std::unique_ptr<weld::CheckButton> m_xCbAnonymous;
-
- DECL_LINK( Click_SmartProtocol_Impl, weld::Button&, void ); ///< Radiobutton clicked: Type HTTP or FTP
- DECL_LINK( ClickAnonymousHdl_Impl, weld::Button&, void ); ///< Checkbox : Anonymous User
- DECL_LINK( ModifiedLoginHdl_Impl, weld::Entry&, void ); ///< Contents of editfield "Login" modified
+
DECL_LINK( LostFocusTargetHdl_Impl, weld::Widget&, void ); ///< Combobox "Target" lost its focus
DECL_LINK( ModifiedTargetHdl_Impl, weld::ComboBox&, void ); ///< Contents of editfield "Target" modified
DECL_LINK( TimeoutHdl_Impl, Timer *, void); ///< Handler for timer -timeout
- void SetScheme(const OUString& rScheme);
+ void SetScheme(std::u16string_view rScheme);
void RemoveImproperProtocol(std::u16string_view rProperScheme);
- OUString GetSchemeFromButtons() const;
- INetProtocol GetSmartProtocolFromButtons() const;
+ static INetProtocol GetSmartProtocolFromButtons();
OUString CreateAbsoluteURL() const;
- void setAnonymousFTPUser();
- void setFTPUser(const OUString& rUser, const OUString& rPassword);
void RefreshMarkWindow();
protected:
virtual void FillDlgFields(const OUString& rStrURL) override;
- virtual void GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+ virtual void GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode ) override;
- virtual bool ShouldOpenMarkWnd () override {return ( m_bMarkWndOpen && m_xRbtLinktypInternet->get_active() );}
+ virtual bool ShouldOpenMarkWnd () override { return false; }
virtual void SetMarkWndShouldOpen (bool bOpen) override {m_bMarkWndOpen=bOpen;}
public:
diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx
index 8b8bc39d88cb..b7c76c52cb18 100644
--- a/cui/source/inc/hlmailtp.hxx
+++ b/cui/source/inc/hlmailtp.hxx
@@ -31,7 +31,6 @@ class SvxHyperlinkMailTp : public SvxHyperlinkTabPageBase
private:
std::unique_ptr<SvxHyperURLBox> m_xCbbReceiver;
std::unique_ptr<weld::Button> m_xBtAdrBook;
- std::unique_ptr<weld::Label> m_xFtSubject;
std::unique_ptr<weld::Entry> m_xEdSubject;
DECL_STATIC_LINK(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, weld::Button&, void);
@@ -45,7 +44,7 @@ private:
protected:
virtual void FillDlgFields(const OUString& rStrURL) override;
- virtual void GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+ virtual void GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode ) override;
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index 00cda67f9d02..acb84198ad25 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -23,7 +23,7 @@
#include <sfx2/dispatch.hxx>
#include <svtools/inettbc.hxx>
#include <vcl/timer.hxx>
-#include <vcl/waitobj.hxx>
+#include <vcl/locktoplevels.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <svx/hlnkitem.hxx>
@@ -75,7 +75,7 @@ protected:
void InitStdControls ();
void FillStandardDlgFields ( const SvxHyperlinkItem* pHyperlinkItem );
virtual void FillDlgFields(const OUString& rStrURL) = 0;
- virtual void GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
+ virtual void GetCurrentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode ) = 0;
@@ -94,7 +94,7 @@ public:
weld::Container* pParent,
SvxHpLinkDlg* pDlg,
const OUString& rUIXMLDescription,
- const OString& rID,
+ const OUString& rID,
const SfxItemSet* pItemSet
);
virtual ~SvxHyperlinkTabPageBase () override;
@@ -105,7 +105,6 @@ public:
mxDocumentFrame = rxDocumentFrame;
}
- virtual bool AskApply ();
virtual void DoApply ();
virtual void SetInitFocus();
virtual void SetMarkStr ( const OUString& aStrMark );
diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx
index 4625d2491e18..0b304e9439f9 100644
--- a/cui/source/inc/hyphen.hxx
+++ b/cui/source/inc/hyphen.hxx
@@ -71,8 +71,8 @@ class SvxHyphenWordDialog : public SfxDialogController
DECL_LINK(CursorChangeHdl_Impl, weld::Entry&, void);
public:
- SvxHyphenWordDialog(const OUString &rWord, LanguageType nLang,
- weld::Window* pParent,
+ SvxHyphenWordDialog(OUString aWord, LanguageType nLang,
+ weld::Widget* pParent,
css::uno::Reference<css::linguistic2::XHyphenator> const &xHyphen,
SvxSpellWrapper* pWrapper);
virtual ~SvxHyphenWordDialog() override;
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index 5cf1ab54f6d7..e31aaa74e0db 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -20,6 +20,7 @@
#include <rtl/ustring.hxx>
#include <sfx2/tabdlg.hxx>
+#include <utility>
// forward-declarations
struct IconChoicePageData;
@@ -31,21 +32,6 @@ class SfxItemSet;
// Create-Function
typedef std::unique_ptr<IconChoicePage> (*CreatePage)(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pAttrSet);
-/// Data-structure for pages in dialog
-struct IconChoicePageData
-{
- OString sId;
- std::unique_ptr<IconChoicePage> xPage; ///< the TabPage itself
- bool bRefresh; ///< Flag: page has to be newly initialized
-
- // constructor
- IconChoicePageData(const OString& rId, std::unique_ptr<IconChoicePage> xInPage)
- : sId(rId)
- , xPage(std::move(xInPage))
- , bRefresh(false)
- {}
-};
-
class IconChoicePage
{
protected:
@@ -58,12 +44,12 @@ private:
protected:
- IconChoicePage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet* pItemSet);
+ IconChoicePage(weld::Container* pParent, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet* pItemSet);
public:
virtual ~IconChoicePage();
- OString GetHelpId() const { return xContainer->get_help_id(); }
+ OUString GetHelpId() const { return xContainer->get_help_id(); }
const SfxItemSet& GetItemSet() const { return *pSet; }
@@ -78,4 +64,19 @@ public:
virtual bool QueryClose();
};
+/// Data-structure for pages in dialog
+struct IconChoicePageData
+{
+ OUString sId;
+ std::unique_ptr<IconChoicePage> xPage; ///< the TabPage itself
+ bool bRefresh; ///< Flag: page has to be newly initialized
+
+ // constructor
+ IconChoicePageData(OUString aId, std::unique_ptr<IconChoicePage> xInPage)
+ : sId(std::move(aId))
+ , xPage(std::move(xInPage))
+ , bRefresh(false)
+ {}
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx
index d6bd30ed395d..61c707507087 100644
--- a/cui/source/inc/insdlg.hxx
+++ b/cui/source/inc/insdlg.hxx
@@ -36,12 +36,12 @@ protected:
comphelper::EmbeddedObjectContainer aCnt;
InsertObjectDialog_Impl(weld::Window * pParent,
- const OUString& rUIXMLDescription, const OString& rID,
- const css::uno::Reference < css::embed::XStorage >& xStorage);
+ const OUString& rUIXMLDescription, const OUString& rID,
+ css::uno::Reference < css::embed::XStorage > xStorage);
public:
const css::uno::Reference<css::embed::XEmbeddedObject>& GetObject() const { return m_xObj; }
virtual css::uno::Reference<css::io::XInputStream> GetIconIfIconified(OUString* pGraphicMediaType);
- void SetHelpId(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
+ void SetHelpId(const OUString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
virtual bool IsCreateNew() const;
};
@@ -64,7 +64,7 @@ class SvInsertOleDlg : public InsertObjectDialog_Impl
DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
DECL_LINK(BrowseHdl, weld::Button&, void);
- DECL_LINK(RadioHdl, weld::Button&, void);
+ DECL_LINK(RadioHdl, weld::Toggleable&, void);
bool IsCreateNew() const override { return m_xRbNewObject->get_active(); }
public:
@@ -99,7 +99,7 @@ private:
std::unique_ptr<weld::CheckButton> m_xCBMarginHeightDefault;
DECL_LINK(OpenHdl, weld::Button&, void);
- DECL_LINK(CheckHdl, weld::Button&, void);
+ DECL_LINK(CheckHdl, weld::Toggleable&, void);
void Init();
diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx
index e003795383dc..9ab7f0fed466 100644
--- a/cui/source/inc/insrc.hxx
+++ b/cui/source/inc/insrc.hxx
@@ -22,7 +22,7 @@
#include <svx/svxdlg.hxx>
#include <vcl/weld.hxx>
-class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public weld::GenericDialogController
+class SvxInsRowColDlg : public weld::GenericDialogController
{
private:
std::unique_ptr<weld::SpinButton> m_xCountEdit;
@@ -30,10 +30,23 @@ private:
std::unique_ptr<weld::RadioButton> m_xAfterBtn;
public:
- SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId);
+ SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OUString& rHelpId);
- virtual short Execute() override;
+ bool isInsertBefore() const;
+ sal_uInt16 getInsertCount() const;
+};
+
+class SvxAbstractInsRowColDlg_Impl final : public SvxAbstractInsRowColDlg
+{
+ std::shared_ptr<SvxInsRowColDlg> m_xDlg;
+public:
+ explicit SvxAbstractInsRowColDlg_Impl(std::shared_ptr<SvxInsRowColDlg> p)
+ : m_xDlg(std::move(p))
+ {
+ }
+ virtual short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext& rCtx) override;
virtual bool isInsertBefore() const override;
virtual sal_uInt16 getInsertCount() const override;
};
diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx
index d55c8b8d44ec..5d7f778d5c38 100644
--- a/cui/source/inc/labdlg.hxx
+++ b/cui/source/inc/labdlg.hxx
@@ -34,7 +34,7 @@ const sal_uInt16 CAPTYPE_BITMAPS_COUNT = 3;
class SvxCaptionTabPage : public SfxTabPage
{
private:
- static const sal_uInt16 pCaptionRanges[];
+ static const WhichRangesContainer pCaptionRanges;
Image m_aBmpCapTypes[CAPTYPE_BITMAPS_COUNT];
@@ -73,7 +73,7 @@ private:
void SetupType_Impl( SdrCaptionType nType );
DECL_LINK(ExtensionSelectHdl_Impl, weld::ComboBox&, void);
DECL_LINK(PositionSelectHdl_Impl, weld::ComboBox&, void);
- DECL_LINK(LineOptHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(LineOptHdl_Impl, weld::Toggleable&, void);
DECL_LINK(SelectCaptTypeHdl_Impl, ValueSet*, void);
public:
@@ -81,7 +81,7 @@ public:
virtual ~SvxCaptionTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pCaptionRanges; }
+ static WhichRangesContainer GetRanges() { return pCaptionRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
@@ -102,7 +102,7 @@ private:
Link<SvxSwFrameValidation&,void> aValidateLink;
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
public:
SvxCaptionTabDialog(weld::Window* pParent, const SdrView* pView,
diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx
index 3549ef0eb291..1e54954ec555 100644
--- a/cui/source/inc/linkdlg.hxx
+++ b/cui/source/inc/linkdlg.hxx
@@ -58,8 +58,7 @@ class SvBaseLinksDlg : public weld::GenericDialogController
DECL_LINK(LinksSelectHdl, weld::TreeView&, void);
DECL_LINK(LinksDoubleClickHdl, weld::TreeView&, bool);
- DECL_LINK(AutomaticClickHdl, weld::Button&, void);
- DECL_LINK(ManualClickHdl, weld::Button&, void);
+ DECL_LINK(ToggleHdl, weld::Toggleable&, void);
DECL_LINK(UpdateNowClickHdl, weld::Button&, void);
DECL_LINK(ChangeSourceClickHdl, weld::Button&, void);
DECL_LINK(BreakLinkClickHdl, weld::Button&, void);
diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx
index ea365b225747..ba3c1de11717 100644
--- a/cui/source/inc/macroass.hxx
+++ b/cui/source/inc/macroass.hxx
@@ -29,6 +29,7 @@
class SfxMacroTabPage_;
class SfxMacroTabPage_Impl;
+class Timer;
class SfxMacroTabPage final : public SfxTabPage
{
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index 2c1bd1a1259a..2f2471bb09eb 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -25,17 +25,19 @@
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
#include <unordered_map>
#include <vector>
-typedef std::unordered_map< OUString, std::pair< OUString, OUString > > EventsHash;
+typedef std::pair<OUString, OUString> EventPair;
+typedef std::unordered_map<OUString, EventPair> EventsHash;
struct EventDisplayName
{
const char* pAsciiEventName;
- const char* pEventResourceID;
- EventDisplayName(const char* pAsciiName, const char* pResId)
+ TranslateId pEventResourceID;
+ EventDisplayName(const char* pAsciiName, TranslateId pResId)
: pAsciiEventName(pAsciiName)
, pEventResourceID(pResId)
{
@@ -53,8 +55,10 @@ class SvxMacroTabPage_ : public SfxTabPage
DECL_LINK( SelectEvent_Impl, weld::TreeView&, void );
DECL_LINK( AssignDeleteHdl_Impl, weld::Button&, void );
DECL_LINK( DoubleClickHdl_Impl, weld::TreeView&, bool );
+ DECL_LINK( DeleteAllHdl_Impl, weld::Button&, void );
- static void GenericHandler_Impl( SvxMacroTabPage_* pThis, const weld::Button* pBtn );
+ void GenericHandler_Impl(const weld::Button* pBtn);
+ const EventPair* LookupEvent(const OUString& rEventName);
css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
protected:
@@ -63,14 +67,15 @@ protected:
css::uno::Reference< css::util::XModifiable > m_xModifiable;
EventsHash m_appEventsHash;
EventsHash m_docEventsHash;
+ int m_nAssignedEvents;
bool bDocModified, bAppEvents, bInitialized;
std::vector< EventDisplayName > aDisplayNames;
- SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemSet);
+ SvxMacroTabPage_(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rItemSet);
void EnableButtons();
static css::uno::Any GetPropsByName( const OUString& eventName, EventsHash& eventsHash );
- static std::pair< OUString, OUString > GetPairFromAny( const css::uno::Any& aAny );
+ static EventPair GetPairFromAny(const css::uno::Any& aAny);
public:
@@ -101,7 +106,7 @@ public:
// class SvxMacroAssignDlg --------------------------------------------------
-typedef const sal_uInt16* (*GetTabPageRanges)(); // gives international Which-values
+typedef WhichRangesContainer (*GetTabPageRanges)(); // gives international Which-values
class SvxMacroAssignSingleTabDialog : public SfxSingleTabDialogController
{
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
index 8f8836d0b8ed..7e18c6485556 100644
--- a/cui/source/inc/measure.hxx
+++ b/cui/source/inc/measure.hxx
@@ -28,7 +28,7 @@ class SdrView;
class SvxMeasurePage : public SvxTabPage
{
private:
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
@@ -57,11 +57,11 @@ private:
void FillUnitLB();
- DECL_LINK(ClickAutoPosHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(ClickAutoPosHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ChangeAttrEditHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ChangeAttrSpinHdl_Impl, weld::SpinButton&, void);
DECL_LINK(ChangeAttrListBoxHdl_Impl, weld::ComboBox&, void);
- DECL_LINK(ChangeAttrClickHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(ChangeAttrClickHdl_Impl, weld::Toggleable&, void);
void ChangeAttrHdl_Impl(void const *);
public:
@@ -70,7 +70,7 @@ public:
virtual ~SvxMeasurePage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
index 3f747f21aadd..258e446e80f8 100644
--- a/cui/source/inc/multipat.hxx
+++ b/cui/source/inc/multipat.hxx
@@ -20,16 +20,6 @@
#include <vcl/weld.hxx>
-// define ----------------------------------------------------------------
-
-// different delimiter for Unix (:) and Windows (;)
-
-#ifdef UNX
-#define CLASSPATH_DELIMITER ':'
-#else
-#define CLASSPATH_DELIMITER ';'
-#endif
-
class SvxMultiPathDialog : public weld::GenericDialogController
{
private:
@@ -50,7 +40,7 @@ public:
virtual ~SvxMultiPathDialog() override;
OUString GetPath() const;
- void SetPath(const OUString& rPath);
+ void SetPath(std::u16string_view rPath);
void SetTitle(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
};
@@ -69,7 +59,7 @@ public:
SvxPathSelectDialog(weld::Window* pParent);
OUString GetPath() const;
- void SetPath( const OUString& rPath );
+ void SetPath( std::u16string_view rPath );
void SetTitle(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
};
diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx
index b62e1199e44d..4a34cb37712c 100644
--- a/cui/source/inc/newtabledlg.hxx
+++ b/cui/source/inc/newtabledlg.hxx
@@ -37,7 +37,7 @@ public:
class SvxNewTableDialogWrapper : public SvxAbstractNewTableDialog
{
private:
- std::shared_ptr<weld::DialogController> m_xDlg;
+ std::shared_ptr<SvxNewTableDialog> m_xDlg;
public:
SvxNewTableDialogWrapper(weld::Window* pParent)
@@ -52,18 +52,16 @@ public:
virtual sal_Int32 getRows() const override
{
- SvxNewTableDialog* pDlg = dynamic_cast<SvxNewTableDialog*>(m_xDlg.get());
- if (pDlg)
- return pDlg->getRows();
+ if (m_xDlg)
+ return m_xDlg->getRows();
return 0;
}
virtual sal_Int32 getColumns() const override
{
- SvxNewTableDialog* pDlg = dynamic_cast<SvxNewTableDialog*>(m_xDlg.get());
- if (pDlg)
- return pDlg->getColumns();
+ if (m_xDlg)
+ return m_xDlg->getColumns();
return 0;
}
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index 5d525282a9ca..13f1a88e9eab 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -56,7 +56,7 @@ public:
class SvxNumberFormatTabPage : public SfxTabPage
{
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
public:
SvxNumberFormatTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs);
@@ -64,7 +64,7 @@ public:
const SfxItemSet* rAttrSet );
virtual ~SvxNumberFormatTabPage() override;
// Returns area information.
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
@@ -129,18 +129,18 @@ private:
void MakePreviewText( const OUString& rFormat );
void ChangePreviewText( sal_uInt16 nPos );
void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect);
- bool Click_Impl(weld::Button& rIB);
+ bool Click_Impl(const weld::Button& rIB);
// Handler
DECL_LINK(LostFocusHdl_Impl, weld::Widget&, void);
DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, bool);
DECL_LINK(SelFormatListBoxHdl_Impl, weld::ComboBox&, void);
DECL_LINK(SelFormatTreeListBoxHdl_Impl, weld::TreeView&, void);
- DECL_LINK(SelFormatClickHdl_Impl, weld::Button&, void);
+ DECL_LINK(SelFormatClickHdl_Impl, weld::Toggleable&, void);
void SelFormatHdl_Impl(weld::Widget*);
DECL_LINK(ClickHdl_Impl, weld::Button&, void);
DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
DECL_LINK(OptEditHdl_Impl, weld::SpinButton&, void);
- DECL_LINK(OptClickHdl_Impl, weld::Button&, void);
+ DECL_LINK(OptClickHdl_Impl, weld::Toggleable&, void);
void EditHdl_Impl(const weld::Entry*);
void OptHdl_Impl(const weld::Widget*);
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 4a00f44e6f76..7c34d49fcc62 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -25,9 +25,10 @@
#include <editeng/numdef.hxx>
#include <editeng/svxenum.hxx>
#include <svtools/ctrlbox.hxx>
+#include <svx/numberingpreview.hxx>
#include <vcl/customweld.hxx>
#include <vcl/timer.hxx>
-#include <cui/numberingpreview.hxx>
+#include <svx/dlgutil.hxx>
#define MN_GALLERY_ENTRY 100
@@ -63,8 +64,7 @@ class SvxSingleNumPickTabPage final : public SfxTabPage
sal_uInt16 nActNumLvl;
bool bModified : 1;
bool bPreset : 1;
-
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
std::unique_ptr<SvxNumValueSet> m_xExamplesVS;
std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
@@ -92,7 +92,7 @@ class SvxBulletPickTabPage final : public SfxTabPage
sal_uInt16 nActNumLvl;
bool bModified : 1;
bool bPreset : 1;
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
OUString sBulletCharFormatName;
@@ -129,7 +129,7 @@ class SvxNumPickTabPage final : public SfxTabPage
std::unique_ptr<SvxNumRule> pActNum;
std::unique_ptr<SvxNumRule> pSaveNum;
sal_uInt16 nActNumLvl;
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
bool bModified : 1;
bool bPreset : 1;
@@ -164,7 +164,7 @@ class SvxBitmapPickTabPage final : public SfxTabPage
std::unique_ptr<SvxNumRule> pActNum;
std::unique_ptr<SvxNumRule> pSaveNum;
sal_uInt16 nActNumLvl;
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
MapUnit eCoreUnit;
bool bModified : 1;
bool bPreset : 1;
@@ -216,9 +216,11 @@ class SvxNumOptionsTabPage : public SfxTabPage
sal_uInt8 nBullet;
sal_uInt16 nActNumLvl;
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
MapUnit eCoreUnit;
+ SvxRatioConnector m_aRatioTop;
+ SvxRatioConnector m_aRatioBottom;
SvxNumberingPreview m_aPreviewWIN;
std::unique_ptr<weld::Widget> m_xGrid;
std::unique_ptr<weld::TreeView> m_xLevelLB;
@@ -236,6 +238,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
std::unique_ptr<weld::Label> m_xAllLevelFT;
std::unique_ptr<weld::SpinButton> m_xAllLevelNF;
+ std::unique_ptr<weld::CheckButton> m_xIsLegalCB;
std::unique_ptr<weld::Label> m_xStartFT;
std::unique_ptr<weld::SpinButton> m_xStartED;
std::unique_ptr<weld::Label> m_xBulletFT;
@@ -247,6 +250,9 @@ class SvxNumOptionsTabPage : public SfxTabPage
std::unique_ptr<weld::Label> m_xHeightFT;
std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
std::unique_ptr<weld::CheckButton> m_xRatioCB;
+ std::unique_ptr<weld::Image> m_xCbxScaleImg;
+ std::unique_ptr<weld::CustomWeld> m_xImgRatioTop;
+ std::unique_ptr<weld::CustomWeld> m_xImgRatioBottom;
std::unique_ptr<weld::Label> m_xOrientFT;
std::unique_ptr<weld::ComboBox> m_xOrientLB;
std::unique_ptr<weld::Widget> m_xAllLevelsFrame;
@@ -265,17 +271,18 @@ class SvxNumOptionsTabPage : public SfxTabPage
DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
DECL_LINK(LevelHdl, void *, void);
- DECL_LINK(PopupActivateHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(GraphicHdl_Impl, const OString&, void);
+ DECL_LINK(PopupActivateHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(GraphicHdl_Impl, const OUString&, void);
DECL_LINK(BulletHdl_Impl, weld::Button&, void);
DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(RatioHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void);
DECL_LINK(CharFmtHdl_Impl, weld::ComboBox&, void);
DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
DECL_LINK(SpinModifyHdl_Impl, weld::SpinButton&, void);
DECL_LINK(AllLevelHdl_Impl, weld::SpinButton&, void);
+ DECL_LINK(IsLegalHdl_Impl, weld::Toggleable&, void);
DECL_LINK(OrientHdl_Impl, weld::ComboBox&, void);
- DECL_LINK(SameLevelHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(SameLevelHdl_Impl, weld::Toggleable&, void);
DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
DECL_LINK(BulRelSizeHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void);
@@ -312,7 +319,7 @@ class SvxNumPositionTabPage : public SfxTabPage
ImplSVEvent* m_pLevelHdlEvent;
sal_uInt16 nActNumLvl;
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
MapUnit eCoreUnit;
bool bModified : 1;
@@ -354,7 +361,7 @@ class SvxNumPositionTabPage : public SfxTabPage
DECL_LINK(LevelHdl, void *, void);
DECL_LINK(EditModifyHdl_Impl, weld::ComboBox&, void);
DECL_LINK(DistanceHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(RelativeHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(RelativeHdl_Impl, weld::Toggleable&, void);
DECL_LINK(StandardHdl_Impl, weld::Button&, void);
void InitPosAndSpaceMode();
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
index 8ecf942b9a13..31a622f7a50d 100644
--- a/cui/source/inc/optasian.hxx
+++ b/cui/source/inc/optasian.hxx
@@ -42,7 +42,7 @@ class SvxAsianLayoutPage : public SfxTabPage
std::unique_ptr<weld::Label> m_xHintFT;
DECL_LINK(LanguageHdl, weld::ComboBox&, void);
- DECL_LINK(ChangeStandardHdl, weld::ToggleButton&, void);
+ DECL_LINK(ChangeStandardHdl, weld::Toggleable&, void);
DECL_LINK(ModifyHdl, weld::Entry&, void);
public:
@@ -52,7 +52,10 @@ public:
static std::unique_ptr<SfxTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
- static const sal_uInt16* GetRanges();
+ static WhichRangesContainer GetRanges();
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet(SfxItemSet* rSet) override;
virtual void Reset(const SfxItemSet* rSet) override;
};
diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx
index 1449e9457ad9..8e382cc32e8f 100644
--- a/cui/source/inc/optdict.hxx
+++ b/cui/source/inc/optdict.hxx
@@ -89,7 +89,6 @@ private:
DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
DECL_LINK(ModifyHdl, weld::Entry&, void);
DECL_LINK(EntrySizeAllocHdl, const Size&, void);
- DECL_STATIC_LINK(SvxEditDictionaryDialog, InsertTextHdl, OUString&, bool);
bool NewDelHdl(const weld::Widget*);
void ShowWords_Impl( sal_uInt16 nId );
@@ -99,7 +98,7 @@ private:
css::linguistic2::XDictionary > const &xDic );
void RemoveDictEntry(int nEntry);
- int GetLBInsertPos(const OUString &rDicWord);
+ int GetLBInsertPos(std::u16string_view rDicWord);
public:
SvxEditDictionaryDialog(weld::Window* pParent, std::u16string_view rName);
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 365acfbbb0fb..6c5657acf7bd 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -22,6 +22,7 @@
#include <svx/langbox.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/configuration/ReadWriteAccess.hpp>
namespace com::sun::star{
namespace beans{
@@ -60,6 +61,8 @@ class SvxEditModulesDlg : public weld::GenericDialogController
std::unique_ptr<weld::Button> m_xClosePB;
std::unique_ptr<SvxLanguageBox> m_xLanguageLB;
+ css::uno::Reference< css::configuration::XReadWriteAccess> m_xReadWriteAccess;
+
DECL_LINK( SelectHdl_Impl, weld::TreeView&, void );
DECL_LINK( UpDownHdl_Impl, weld::Button&, void );
DECL_LINK( ClickHdl_Impl, weld::Button&, void );
@@ -84,6 +87,8 @@ private:
OUString sWordsWithDigits;
OUString sSpellSpecial;
OUString sSpellAuto;
+ OUString sSpellClosedCompound;
+ OUString sSpellHyphenatedCompound;
OUString sGrammarAuto;
OUString sNumMinWordlen;
OUString sNumPreBreak;
@@ -118,6 +123,7 @@ private:
std::unique_ptr<weld::Button> m_xLinguDicsDelPB;
std::unique_ptr<weld::TreeView> m_xLinguOptionsCLB;
std::unique_ptr<weld::Button> m_xLinguOptionsEditPB;
+ std::unique_ptr<weld::Box> m_xMoreDictsBox;
std::unique_ptr<weld::LinkButton> m_xMoreDictsLink;
void AddDicBoxEntry( const css::uno::Reference< css::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx );
@@ -139,6 +145,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxLinguTabPage() override;
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index c3b9aafbbae5..ccfeb70e0072 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -56,13 +56,15 @@ private:
void GetPathList( SvtPathOptions::Paths _nPathHandle, OUString& _rInternalPath,
OUString& _rUserPath, OUString& _rWritablePath, bool& _rReadOnly );
void SetPathList( SvtPathOptions::Paths _nPathHandle,
- const OUString& _rUserPath, const OUString& _rWritablePath );
+ std::u16string_view _rUserPath, const OUString& _rWritablePath );
public:
SvxPathTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet );
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxPathTabPage() override;
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 1a2e8fb506c4..151569ac4634 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -38,7 +38,6 @@
<SvxSizeItem>: <SID_ATTR_MAXSIZE>
<SvxULSpaceItem>: <SID_ATTR_LRSPACE>
<SvxLRSpaceItem>: <SID_ATTR_ULSPACE>
- <SfxAllEnumItem>: <SID_ATTR_PAPERTRAY>
<SvxPaperBinItem>: <SID_ATTR_PAPERBIN>
<SvxBoolItem>: <SID_ATTR_EXT1>
<SvxBoolItem>: <SID_ATTR_EXT2>
@@ -64,7 +63,7 @@ typedef sal_uInt16 MarginPosition;
class SvxPageDescPage : public SfxTabPage
{
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
private:
OUString sStandardRegister;
tools::Long nFirstLeftMargin;
@@ -93,7 +92,6 @@ private:
std::unique_ptr<SvxPaperSizeListBox> m_xPaperSizeBox;
std::unique_ptr<weld::MetricSpinButton> m_xPaperWidthEdit;
std::unique_ptr<weld::MetricSpinButton> m_xPaperHeightEdit;
- std::unique_ptr<weld::Label> m_xOrientationFT;
std::unique_ptr<weld::RadioButton> m_xPortraitBtn;
std::unique_ptr<weld::RadioButton> m_xLandscapeBtn;
std::unique_ptr<weld::Label> m_xTextFlowLbl;
@@ -125,6 +123,8 @@ private:
std::unique_ptr<weld::ComboBox> m_xRegisterLB;
std::unique_ptr<weld::Label> m_xGutterPositionFT;
std::unique_ptr<weld::ComboBox> m_xGutterPositionLB;
+ std::unique_ptr<weld::CheckButton> m_xRtlGutterCB;
+ std::unique_ptr<weld::CheckButton> m_xBackgroundFullSizeCB;
std::unique_ptr<weld::Label> m_xInsideLbl;
std::unique_ptr<weld::Label> m_xOutsideLbl;
std::unique_ptr<weld::Label> m_xPrintRangeQueryText;
@@ -134,11 +134,11 @@ private:
DECL_LINK(LayoutHdl_Impl, weld::ComboBox&, void);
DECL_LINK(GutterPositionHdl_Impl, weld::ComboBox&, void);
DECL_LINK(PaperBinHdl_Impl, weld::Widget&, void);
- DECL_LINK(SwapOrientation_Impl, weld::Button&, void);
+ DECL_LINK(SwapOrientation_Impl, weld::Toggleable&, void);
void SwapFirstValues_Impl( bool bSet );
DECL_LINK(BorderModify_Impl, weld::MetricSpinButton&, void);
void InitHeadFoot_Impl( const SfxItemSet& rSet );
- DECL_LINK(CenterHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(CenterHdl_Impl, weld::Toggleable&, void);
void UpdateExample_Impl( bool bResetbackground = false );
DECL_LINK(PaperSizeSelect_Impl, weld::ComboBox&, void );
@@ -151,7 +151,7 @@ private:
void RangeHdl_Impl();
void CalcMargin_Impl();
- DECL_LINK(RegisterModify, weld::ToggleButton&, void);
+ DECL_LINK(RegisterModify, weld::Toggleable&, void);
// page direction
/** Disables vertical page direction entries in the text flow listbox. */
@@ -172,7 +172,7 @@ public:
virtual ~SvxPageDescPage() override;
// returns the range of the Which values
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* rOutSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index cea797707a7e..b35111f43b33 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -40,35 +40,35 @@ class SvxLineSpacingItem;
class SvxStdParagraphTabPage: public SfxTabPage
{
- static const sal_uInt16 pStdRanges[];
+ static const WhichRangesContainer pStdRanges;
private:
tools::Long nWidth;
tools::Long nMinFixDist;
bool bRelativeMode;
- OUString sAbsDist;
SvxParaPrevWindow m_aExampleWin;
- // indention
- std::unique_ptr<SvxRelativeField> m_xLeftIndent;
+ // indentation
+ bool m_bSplitLRSpace = false; ///< which items to use?
+ SvxRelativeField m_aLeftIndent;
- std::unique_ptr<weld::Label> m_xRightLabel;
- std::unique_ptr<SvxRelativeField> m_xRightIndent;
+ SvxRelativeField m_aRightIndent;
std::unique_ptr<weld::Label> m_xFLineLabel;
- std::unique_ptr<SvxRelativeField> m_xFLineIndent;
+ SvxRelativeField m_aFLineIndent;
std::unique_ptr<weld::CheckButton> m_xAutoCB;
// distance
- std::unique_ptr<SvxRelativeField> m_xTopDist;
- std::unique_ptr<SvxRelativeField> m_xBottomDist;
+ SvxRelativeField m_aTopDist;
+ SvxRelativeField m_aBottomDist;
std::unique_ptr<weld::CheckButton> m_xContextualCB;
// line spacing
std::unique_ptr<weld::ComboBox> m_xLineDist;
std::unique_ptr<weld::MetricSpinButton> m_xLineDistAtPercentBox;
std::unique_ptr<weld::MetricSpinButton> m_xLineDistAtMetricBox;
+ std::unique_ptr<weld::MetricSpinButton> m_xLineDistAtPlaceHolderBox;
std::unique_ptr<weld::Label> m_xLineDistAtLabel;
std::unique_ptr<weld::Label> m_xAbsDist;
@@ -86,7 +86,7 @@ private:
DECL_LINK(LineDistPopupHdl_Impl, weld::ComboBox&, void);
DECL_LINK(LineDistHdl_Impl, weld::ComboBox&, void);
DECL_LINK(ModifyHdl_Impl, weld::MetricSpinButton&, void);
- DECL_LINK(AutoHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(AutoHdl_Impl, weld::Toggleable&, void);
bool m_bLineDistToggled = false;
@@ -102,7 +102,7 @@ public:
DECL_LINK(ELRLoseFocusHdl, weld::MetricSpinButton&, void);
- static const sal_uInt16* GetRanges() { return pStdRanges; }
+ static WhichRangesContainer GetRanges() { return pStdRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
@@ -112,7 +112,6 @@ public:
void EnableRegisterMode();
void EnableContextualMode();
void EnableAutoFirstLine();
- void EnableAbsLineDist(tools::Long nMinTwip);
void EnableNegativeMode();
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
@@ -121,7 +120,9 @@ public:
class SvxParaAlignTabPage : public SfxTabPage
{
- static const sal_uInt16 pAlignRanges[];
+ static const WhichRangesContainer pAlignRanges, pSdrAlignRanges;
+
+ bool m_bSdrVertAlign;
SvxParaPrevWindow m_aExampleWin;
@@ -144,11 +145,12 @@ class SvxParaAlignTabPage : public SfxTabPage
//vertical alignment
std::unique_ptr<weld::Widget> m_xVertAlignFL;
std::unique_ptr<weld::ComboBox> m_xVertAlignLB;
+ std::unique_ptr<weld::Label> m_xVertAlign;
+ std::unique_ptr<weld::Label> m_xVertAlignSdr;
- std::unique_ptr<weld::Widget> m_xPropertiesFL;
std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB;
- DECL_LINK(AlignHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(AlignHdl_Impl, weld::Toggleable&, void);
DECL_LINK(LastLineHdl_Impl, weld::ComboBox&, void);
DECL_LINK(TextDirectionHdl_Impl, weld::ComboBox&, void);
@@ -163,13 +165,15 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxParaAlignTabPage() override;
- static const sal_uInt16* GetRanges() { return pAlignRanges; }
+ static WhichRangesContainer GetRanges() { return pAlignRanges; }
+ static WhichRangesContainer GetSdrRanges() { return pSdrAlignRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void ChangesApplied() override;
void EnableJustifyExt();
+ void EnableSdrVertAlign();
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
@@ -189,7 +193,7 @@ public:
class SvxExtParagraphTabPage: public SfxTabPage
{
- static const sal_uInt16 pExtRanges[];
+ static const WhichRangesContainer pExtRanges;
public:
SvxExtParagraphTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -197,7 +201,7 @@ public:
const SfxItemSet* rSet );
virtual ~SvxExtParagraphTabPage() override;
- static const sal_uInt16* GetRanges() { return pExtRanges; }
+ static WhichRangesContainer GetRanges() { return pExtRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
@@ -213,10 +217,13 @@ private:
weld::TriStateEnabled aPageBreakState;
weld::TriStateEnabled aApplyCollState;
weld::TriStateEnabled aPageNumState;
- weld::TriStateEnabled aKeepTogetherState;
+ weld::TriStateEnabled aAllowSplitState;
weld::TriStateEnabled aKeepParaState;
weld::TriStateEnabled aOrphanState;
weld::TriStateEnabled aWidowState;
+ weld::TriStateEnabled aAcrossColumnState;
+ weld::TriStateEnabled aAcrossPageState;
+ weld::TriStateEnabled aAcrossSpreadState;
bool bPageBreak;
bool bHtmlMode;
@@ -225,12 +232,19 @@ private:
// hyphenation
std::unique_ptr<weld::CheckButton> m_xHyphenBox;
std::unique_ptr<weld::CheckButton> m_xHyphenNoCapsBox;
+ std::unique_ptr<weld::CheckButton> m_xHyphenNoLastWordBox;
std::unique_ptr<weld::Label> m_xBeforeText;
std::unique_ptr<weld::SpinButton> m_xExtHyphenBeforeBox;
std::unique_ptr<weld::Label> m_xAfterText;
std::unique_ptr<weld::SpinButton> m_xExtHyphenAfterBox;
+ std::unique_ptr<weld::Label> m_xCompoundBeforeText;
+ std::unique_ptr<weld::SpinButton> m_xExtCompoundHyphenBeforeBox;
std::unique_ptr<weld::Label> m_xMaxHyphenLabel;
std::unique_ptr<weld::SpinButton> m_xMaxHyphenEdit;
+ std::unique_ptr<weld::Label> m_xMinWordLabel;
+ std::unique_ptr<weld::SpinButton> m_xMinWordLength;
+ std::unique_ptr<weld::Label> m_xHyphenZoneLabel;
+ SvxRelativeField m_aHyphenZone;
// pagebreak
std::unique_ptr<weld::CheckButton> m_xPageBreakBox;
@@ -244,7 +258,7 @@ private:
std::unique_ptr<weld::SpinButton> m_xPagenumEdit;
// paragraph division
- std::unique_ptr<weld::CheckButton> m_xKeepTogetherBox;
+ std::unique_ptr<weld::CheckButton> m_xAllowSplitBox;
std::unique_ptr<weld::CheckButton> m_xKeepParaBox;
// orphan/widow
@@ -256,24 +270,33 @@ private:
std::unique_ptr<weld::SpinButton> m_xWidowRowNo;
std::unique_ptr<weld::Label> m_xWidowRowLabel;
+ // avoid hyphenation across
+ std::unique_ptr<weld::Label> m_xAcrossText;
+ std::unique_ptr<weld::CheckButton> m_xAcrossColumnBox;
+ std::unique_ptr<weld::CheckButton> m_xAcrossPageBox;
+ std::unique_ptr<weld::CheckButton> m_xAcrossSpreadBox;
+
void HyphenClickHdl();
void PageNumBoxClickHdl();
void ApplyCollClickHdl();
void PageBreakHdl();
- void KeepTogetherHdl();
+ void AllowSplitHdl();
void OrphanHdl();
void WidowHdl();
- DECL_LINK(PageBreakHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(KeepTogetherHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(WidowHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(OrphanHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(HyphenClickHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(ApplyCollClickHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(PageBreakHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(AllowSplitHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(WidowHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(OrphanHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(HyphenClickHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(ApplyCollClickHdl_Impl, weld::Toggleable&, void);
DECL_LINK(PageBreakPosHdl_Impl, weld::ComboBox&, void);
DECL_LINK(PageBreakTypeHdl_Impl, weld::ComboBox&, void);
- DECL_LINK(PageNumBoxClickHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(KeepParaBoxClickHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(PageNumBoxClickHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(KeepParaBoxClickHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(AcrossColumnHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(AcrossPageHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(AcrossSpreadHdl_Impl, weld::Toggleable&, void);
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
@@ -289,7 +312,7 @@ public:
static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
virtual ~SvxAsianTabPage() override;
- static const sal_uInt16* GetRanges();
+ static WhichRangesContainer GetRanges();
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx
index 62f2ba036771..1077195f7a85 100644
--- a/cui/source/inc/passwdomdlg.hxx
+++ b/cui/source/inc/passwdomdlg.hxx
@@ -25,6 +25,7 @@ class PasswordToOpenModifyDialog : public SfxDialogController
{
std::unique_ptr<weld::Entry> m_xPasswdToOpenED;
std::unique_ptr<weld::Label> m_xPasswdToOpenInd;
+ std::unique_ptr<weld::LevelBar> m_xPasswdToOpenBar;
std::unique_ptr<weld::Entry> m_xReenterPasswdToOpenED;
std::unique_ptr<weld::Label> m_xReenterPasswdToOpenInd;
std::unique_ptr<weld::Expander> m_xOptionsExpander;
@@ -33,21 +34,25 @@ class PasswordToOpenModifyDialog : public SfxDialogController
std::unique_ptr<weld::Label> m_xPasswdToModifyFT;
std::unique_ptr<weld::Entry> m_xPasswdToModifyED;
std::unique_ptr<weld::Label> m_xPasswdToModifyInd;
+ std::unique_ptr<weld::LevelBar> m_xPasswdToModifyBar;
std::unique_ptr<weld::Label> m_xReenterPasswdToModifyFT;
std::unique_ptr<weld::Entry> m_xReenterPasswdToModifyED;
std::unique_ptr<weld::Label> m_xReenterPasswdToModifyInd;
+ std::shared_ptr<weld::MessageDialog> m_xErrorBox;
OUString m_aOneMismatch;
OUString m_aTwoMismatch;
OUString m_aInvalidStateForOkButton;
OUString m_aInvalidStateForOkButton_v2;
+ std::optional<OUString> m_oPasswordPolicy;
int m_nMaxPasswdLen;
bool m_bIsPasswordToModify;
+ bool m_bAllowEmpty;
DECL_LINK(OkBtnClickHdl, weld::Button&, void);
- DECL_LINK(ReadonlyOnOffHdl, weld::Button&, void);
+ DECL_LINK(ReadonlyOnOffHdl, weld::Toggleable&, void);
DECL_LINK(ChangeHdl, weld::Entry&, void);
PasswordToOpenModifyDialog( const PasswordToOpenModifyDialog & ) = delete;
@@ -57,11 +62,13 @@ public:
PasswordToOpenModifyDialog(weld::Window* pParent,
sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */,
bool bIsPasswordToModify );
+ ~PasswordToOpenModifyDialog();
// AbstractPasswordToOpenModifyDialog
OUString GetPasswordToOpen() const;
OUString GetPasswordToModify() const;
bool IsRecommendToOpenReadonly() const;
+ void AllowEmpty();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index b294fbcc77df..66fd07af6255 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -44,7 +44,7 @@ public:
bool bPrevNext);
virtual ~SvxPostItDialog() override;
- static const sal_uInt16* GetRanges();
+ static WhichRangesContainer GetRanges();
const SfxItemSet* GetOutputItemSet() const { return m_xOutSet.get(); }
void SetPrevHdl( const Link<SvxPostItDialog&,void>& rLink )
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 6a1cbd15ae5c..b1b014771dae 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -76,7 +76,7 @@ public:
class SvxScriptOrgDialog : public SfxDialogController
{
-protected:
+ weld::Window* m_pParent;
OUString m_sLanguage;
static Selection_hash m_lastSelection;
const OUString m_delErrStr;
@@ -106,9 +106,9 @@ protected:
static bool getBoolProperty( css::uno::Reference< css::beans::XPropertySet > const & xProps, OUString const & propName );
void CheckButtons( css::uno::Reference< css::script::browse::XBrowseNode > const & node );
- void createEntry(weld::TreeIter& rEntry);
+ void createEntry(const weld::TreeIter& rEntry);
void renameEntry(const weld::TreeIter& rEntry);
- void deleteEntry(weld::TreeIter& rEntry);
+ void deleteEntry(const weld::TreeIter& rEntry);
css::uno::Reference<css::script::browse::XBrowseNode> getBrowseNode(const weld::TreeIter& rEntry);
css::uno::Reference<css::frame::XModel> getModel(const weld::TreeIter& rEntry);
OUString getListOfChildren( const css::uno::Reference< css::script::browse::XBrowseNode >& node, int depth );
@@ -117,13 +117,13 @@ protected:
void Init(std::u16string_view language);
void delUserData(const weld::TreeIter& rIter);
- void deleteTree(weld::TreeIter& rIter);
+ void deleteTree(const weld::TreeIter& rIter);
void deleteAllTree();
void insertEntry(OUString const & rText, OUString const & rBitmap,
const weld::TreeIter* pParent,
bool bChildrenOnDemand,
std::unique_ptr< SFEntry > && aUserData,
- const OUString& factoryURL, bool bSelect);
+ std::u16string_view factoryURL, bool bSelect);
void insertEntry(OUString const & rText, OUString const & rBitmap,
const weld::TreeIter* pParent,
bool bChildrenOnDemand,
@@ -142,7 +142,7 @@ protected:
public:
// prob need another arg in the ctor
// to specify the language or provider
- SvxScriptOrgDialog(weld::Window* pParent, const OUString& language);
+ SvxScriptOrgDialog(weld::Window* pParent, OUString language);
virtual ~SvxScriptOrgDialog() override;
virtual short run() override;
diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx
index 5b7e9ca71a20..46f34c0dae28 100644
--- a/cui/source/inc/sdrcelldlg.hxx
+++ b/cui/source/inc/sdrcelldlg.hxx
@@ -38,9 +38,9 @@ private:
XPatternListRef mpPatternList;
public:
- SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel);
+ SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet& rAttr, const SdrModel& rModel, bool bStyle);
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
};
diff --git a/cui/source/options/securityoptions.hxx b/cui/source/inc/securityoptions.hxx
index d5ed7b01ac25..a86b4f0c605a 100644
--- a/cui/source/options/securityoptions.hxx
+++ b/cui/source/inc/securityoptions.hxx
@@ -20,11 +20,8 @@
#include <vcl/weld.hxx>
-class SvtSecurityOptions;
-
namespace svx
{
-
class SecurityOptionsDialog : public weld::GenericDialogController
{
private:
@@ -45,18 +42,44 @@ namespace svx
std::unique_ptr<weld::Widget> m_xCtrlHyperlinkImg;
std::unique_ptr<weld::CheckButton> m_xBlockUntrustedRefererLinksCB;
std::unique_ptr<weld::Widget> m_xBlockUntrustedRefererLinksImg;
+ std::unique_ptr<weld::CheckButton> m_xDisableActiveContentCB;
+ std::unique_ptr<weld::Widget> m_xDisableActiveContentImg;
+
+ std::unique_ptr<weld::CheckButton> m_xRedlineinfoCB;
+ std::unique_ptr<weld::Widget> m_xRedlineinfoImg;
+ std::unique_ptr<weld::CheckButton> m_xDocPropertiesCB;
+ std::unique_ptr<weld::Widget> m_xDocPropertiesImg;
+ std::unique_ptr<weld::CheckButton> m_xNoteAuthorCB;
+ std::unique_ptr<weld::Widget> m_xNoteAuthorImg;
+ std::unique_ptr<weld::CheckButton> m_xDocumentVersionCB;
+ std::unique_ptr<weld::Widget> m_xDocumentVersionImg;
+ std::unique_ptr<weld::CheckButton> m_xPrinterSettingsCB;
+ std::unique_ptr<weld::Widget> m_xPrinterSettingsImg;
public:
- SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions);
+ SecurityOptionsDialog(weld::Window* pParent);
+
+ void init();
bool IsSaveOrSendDocsChecked() const { return m_xSaveOrSendDocsCB->get_active(); }
bool IsSignDocsChecked() const { return m_xSignDocsCB->get_active(); }
bool IsPrintDocsChecked() const { return m_xPrintDocsCB->get_active(); }
bool IsCreatePdfChecked() const { return m_xCreatePdfCB->get_active(); }
bool IsRemovePersInfoChecked() const { return m_xRemovePersInfoCB->get_active(); }
+ bool IsRemoveRedlineInfoChecked() const { return m_xRedlineinfoCB->get_active(); }
+ bool IsRemoveDocUserInfoChecked() const { return m_xDocPropertiesCB->get_active(); }
+ bool IsRemoveNoteAuthorInfoChecked() const { return m_xNoteAuthorCB->get_active(); }
+ bool IsRemoveDocVersionInfoChecked() const { return m_xDocumentVersionCB->get_active(); }
+ bool IsKeepPrinterSettingsChecked() const { return m_xPrinterSettingsCB->get_active(); }
bool IsRecommPasswdChecked() const { return m_xRecommPasswdCB->get_active(); }
bool IsCtrlHyperlinkChecked() const { return m_xCtrlHyperlinkCB->get_active(); }
bool IsBlockUntrustedRefererLinksChecked() const { return m_xBlockUntrustedRefererLinksCB->get_active(); }
+ bool IsDisableActiveContentChecked() const { return m_xDisableActiveContentCB->get_active(); }
+
+ DECL_LINK(ShowPersonalInfosToggle, weld::Toggleable&, void);
+
+ bool SetSecurityOptions();
+ void changeKeepSecurityInfosEnabled();
};
}
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index 86655a2a5755..ce14e0714a3e 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -35,7 +35,7 @@ private:
public:
SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, tools::Long nMaxVertical, tools::Long nMaxHorizontal);
- DECL_LINK(ClickHdl, weld::Button&, void);
+ DECL_LINK(ToggleHdl, weld::Toggleable&, void);
bool IsHorizontal() const;
bool IsProportional() const;
diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx
index 4da71f3c9601..712abc8b55bc 100644
--- a/cui/source/inc/srchxtra.hxx
+++ b/cui/source/inc/srchxtra.hxx
@@ -30,7 +30,7 @@ public:
virtual ~SvxSearchFormatDialog() override;
protected:
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
private:
std::unique_ptr<FontList> m_pFontList;
@@ -42,7 +42,7 @@ class SvxSearchAttributeDialog : public weld::GenericDialogController
{
public:
SvxSearchAttributeDialog(weld::Window* pParent, SearchAttrItemList& rLst,
- const sal_uInt16* pWhRanges);
+ const WhichRangesContainer& pWhRanges);
virtual ~SvxSearchAttributeDialog() override;
private:
diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx
index d9c72495acde..2e5a15fbebbb 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -21,6 +21,7 @@
#include <sfx2/tabdlg.hxx>
#include <svx/swframeexample.hxx>
#include <vcl/weld.hxx>
+#include <svx/dlgutil.hxx>
// SvxSwPosSizeTabPage - position and size page for Writer drawing objects
struct FrmMap;
@@ -55,10 +56,15 @@ class SvxSwPosSizeTabPage : public SfxTabPage
TriState m_nProtectSizeState;
SwFrameExample m_aExampleWN;
+ SvxRatioConnector m_aRatioTop;
+ SvxRatioConnector m_aRatioBottom;
std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
std::unique_ptr<weld::CheckButton> m_xKeepRatioCB;
+ std::unique_ptr<weld::Image> m_xCbxScaleImg;
+ std::unique_ptr<weld::CustomWeld> m_xImgRatioTop;
+ std::unique_ptr<weld::CustomWeld> m_xImgRatioBottom;
std::unique_ptr<weld::RadioButton> m_xToPageRB;
std::unique_ptr<weld::RadioButton> m_xToParaRB;
std::unique_ptr<weld::RadioButton> m_xToCharRB;
@@ -84,13 +90,14 @@ class SvxSwPosSizeTabPage : public SfxTabPage
std::unique_ptr<weld::CustomWeld> m_xExampleWN;
DECL_LINK(RangeModifyHdl, weld::Widget&, void);
- DECL_LINK(RangeModifyClickHdl, weld::ToggleButton&, void);
- DECL_LINK(AnchorTypeHdl, weld::ToggleButton&, void);
+ DECL_LINK(RangeModifyClickHdl, weld::Toggleable&, void);
+ DECL_LINK(AnchorTypeHdl, weld::Toggleable&, void);
DECL_LINK(PosHdl, weld::ComboBox&, void);
DECL_LINK(RelHdl, weld::ComboBox&, void);
- DECL_LINK(MirrorHdl, weld::ToggleButton&, void);
+ DECL_LINK(MirrorHdl, weld::Toggleable&, void);
DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void);
- DECL_LINK(ProtectHdl, weld::ToggleButton&, void);
+ DECL_LINK(ProtectHdl, weld::Toggleable&, void);
+ DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void);
void InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
sal_uInt16 nV, sal_uInt16 nVRel,
@@ -112,7 +119,7 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
virtual ~SvxSwPosSizeTabPage() override;
- static const sal_uInt16* GetRanges();
+ static WhichRangesContainer GetRanges();
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index c6e7e70f748d..207b8b70503d 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -58,14 +58,14 @@ public:
class SvxTabulatorTabPage : public SfxTabPage
{
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
public:
SvxTabulatorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxTabulatorTabPage() override;
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
@@ -129,8 +129,8 @@ private:
DECL_LINK(DelHdl_Impl, weld::Button&, void);
DECL_LINK(DelAllHdl_Impl, weld::Button&, void);
- DECL_LINK(FillTypeCheckHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(TabTypeCheckHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(FillTypeCheckHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(TabTypeCheckHdl_Impl, weld::Toggleable&, void);
DECL_LINK(SelectHdl_Impl, weld::TreeView&, bool);
DECL_LINK(ModifyHdl_Impl, weld::ComboBox&, void);
diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx
index 04306a7b69db..010d3954716c 100644
--- a/cui/source/inc/textanim.hxx
+++ b/cui/source/inc/textanim.hxx
@@ -34,7 +34,7 @@ class SdrView;
class SvxTextAnimationPage : public SfxTabPage
{
private:
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
SdrTextAniKind eAniKind;
FieldUnit eFUnit;
@@ -67,9 +67,9 @@ private:
std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDelay;
DECL_LINK( SelectEffectHdl_Impl, weld::ComboBox&, void );
- DECL_LINK( ClickEndlessHdl_Impl, weld::Button&, void );
- DECL_LINK( ClickAutoHdl_Impl, weld::Button&, void );
- DECL_LINK( ClickPixelHdl_Impl, weld::Button&, void );
+ DECL_LINK( ClickEndlessHdl_Impl, weld::Toggleable&, void );
+ DECL_LINK( ClickAutoHdl_Impl, weld::Toggleable&, void );
+ DECL_LINK( ClickPixelHdl_Impl, weld::Toggleable&, void );
DECL_LINK( ClickDirectionHdl_Impl, weld::Button&, void );
void SelectDirection( SdrTextAniDirection nValue );
@@ -80,7 +80,7 @@ public:
virtual ~SvxTextAnimationPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
@@ -96,7 +96,7 @@ class SvxTextTabDialog : public SfxTabDialogController
private:
const SdrView* pView;
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
public:
SvxTextTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrView* pView);
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
index c2abee744b40..a6a7f2bd6f46 100644
--- a/cui/source/inc/textattr.hxx
+++ b/cui/source/inc/textattr.hxx
@@ -19,7 +19,7 @@
#pragma once
#include <svx/dlgctrl.hxx>
-#include <svx/svdobj.hxx>
+#include <svx/svdobjkind.hxx>
class SdrView;
@@ -32,7 +32,7 @@ class SdrView;
class SvxTextAttrPage : public SvxTabPage
{
private:
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
const SfxItemSet& rOutAttrs;
SdrObjKind m_eObjKind;
@@ -63,8 +63,8 @@ private:
std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
std::unique_ptr<weld::CheckButton> m_xTsbFullWidth;
- DECL_LINK(ClickFullWidthHdl_Impl, weld::Button&, void);
- DECL_LINK(ClickHdl_Impl, weld::Button&, void);
+ DECL_LINK(ClickFullWidthHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(ClickHdl_Impl, weld::Toggleable&, void);
/** Return whether the text direction is from left to right (</sal_True>) or
top to bottom (</sal_False>).
@@ -77,7 +77,7 @@ public:
virtual ~SvxTextAttrPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pRanges; }
+ static WhichRangesContainer GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx
index de085d678682..05865d68d92f 100644
--- a/cui/source/inc/thesdlg.hxx
+++ b/cui/source/inc/thesdlg.hxx
@@ -26,6 +26,8 @@
#include <memory>
#include <stack>
+struct ImplSVEvent;
+
class SvxThesaurusDialog : public SfxDialogController
{
Idle m_aModifyIdle;
@@ -43,6 +45,7 @@ class SvxThesaurusDialog : public SfxDialogController
std::unique_ptr<weld::Entry> m_xReplaceEdit;
std::unique_ptr<weld::ComboBox> m_xLangLB;
std::unique_ptr<weld::Button> m_xReplaceBtn;
+ ImplSVEvent* m_nSelectFirstEvent;
public:
virtual ~SvxThesaurusDialog() override;
diff --git a/cui/source/inc/tipofthedaydlg.hxx b/cui/source/inc/tipofthedaydlg.hxx
index 44ea0134fe01..1f86d1bf238c 100644
--- a/cui/source/inc/tipofthedaydlg.hxx
+++ b/cui/source/inc/tipofthedaydlg.hxx
@@ -21,10 +21,13 @@
#include <vcl/weld.hxx>
#include "cuigrfflt.hxx"
+class VclWindowEvent;
+
class TipOfTheDayDialog : public weld::GenericDialogController
{
private:
CuiGraphicPreviewWindow m_aPreview;
+ css::uno::Reference<css::awt::XWindow> m_xParent;
std::unique_ptr<weld::Label> m_pText;
std::unique_ptr<weld::CheckButton> m_pShowTip;
@@ -33,7 +36,6 @@ private:
std::unique_ptr<weld::CustomWeld> m_pPreview;
sal_Int32 m_nCurrentTip;
- sal_Int32 m_nDay;
void UpdateTip();
DECL_LINK(OnNextClick, weld::Button&, void);
DECL_LINK(OnLinkClick, weld::LinkButton&, bool);
@@ -41,6 +43,8 @@ private:
public:
TipOfTheDayDialog(weld::Window* pWindow);
virtual ~TipOfTheDayDialog() override;
+
+ DECL_LINK(Terminated, VclWindowEvent&, void);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/toolbarmodedlg.hxx b/cui/source/inc/toolbarmodedlg.hxx
index 8d0216734a75..5965aa7598d6 100644
--- a/cui/source/inc/toolbarmodedlg.hxx
+++ b/cui/source/inc/toolbarmodedlg.hxx
@@ -30,7 +30,7 @@ private:
void UpdateImage(std::u16string_view sFileName);
int GetActiveRadioButton();
- DECL_LINK(SelectToolbarmode, weld::ToggleButton&, void);
+ DECL_LINK(SelectToolbarmode, weld::Toggleable&, void);
DECL_LINK(OnApplyClick, weld::Button&, void);
};
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index 33d984ff8b26..78ffd84e2794 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <svx/dlgctrl.hxx>
+#include <svx/dlgutil.hxx>
#include <svx/dialcontrol.hxx>
#include <svx/anchorid.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -41,7 +42,7 @@ private:
SvxAnchorIds nAnchorCtrls;
Link<SvxSwFrameValidation&,void> aValidateLink;
- virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
public:
SvxTransformTabDialog(weld::Window* pParent, const SfxItemSet* pAttr,
@@ -60,7 +61,7 @@ public:
class SvxPositionSizeTabPage : public SvxTabPage
{
- static const sal_uInt16 pPosSizeRanges[];
+ static const WhichRangesContainer pPosSizeRanges;
private:
const SfxItemSet& mrOutAttrs;
@@ -91,6 +92,9 @@ private:
SvxRectCtl m_aCtlPos;
SvxRectCtl m_aCtlSize;
+ SvxRatioConnector m_aRatioTop;
+ SvxRatioConnector m_aRatioBottom;
+
// position
std::unique_ptr<weld::Widget> m_xFlPosition;
std::unique_ptr<weld::MetricSpinButton> m_xMtrPosX;
@@ -104,6 +108,9 @@ private:
std::unique_ptr<weld::Label> m_xFtHeight;
std::unique_ptr<weld::MetricSpinButton> m_xMtrHeight;
std::unique_ptr<weld::CheckButton> m_xCbxScale;
+ std::unique_ptr<weld::Image> m_xCbxScaleImg;
+ std::unique_ptr<weld::CustomWeld> m_xImgRatioTop;
+ std::unique_ptr<weld::CustomWeld> m_xImgRatioBottom;
std::unique_ptr<weld::CustomWeld> m_xCtlSize;
// protect
@@ -116,23 +123,23 @@ private:
std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowWidth;
std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowHeight;
- DECL_LINK(ChangePosProtectHdl, weld::ToggleButton&, void);
- DECL_LINK(ChangeSizeProtectHdl, weld::ToggleButton&, void);
+ DECL_LINK(ChangePosProtectHdl, weld::Toggleable&, void);
+ DECL_LINK(ChangeSizeProtectHdl, weld::Toggleable&, void);
void SetMinMaxPosition();
void GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange);
DECL_LINK( ChangeWidthHdl, weld::MetricSpinButton&, void );
DECL_LINK( ChangeHeightHdl, weld::MetricSpinButton&, void );
- DECL_LINK( ClickSizeProtectHdl, weld::ToggleButton&, void );
- DECL_LINK( ClickAutoHdl, weld::ToggleButton&, void );
+ DECL_LINK( ClickSizeProtectHdl, weld::Toggleable&, void );
+ DECL_LINK( ClickAutoHdl, weld::Toggleable&, void );
public:
SvxPositionSizeTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxPositionSizeTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pPosSizeRanges; }
+ static WhichRangesContainer GetRanges() { return pPosSizeRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
@@ -160,7 +167,7 @@ public:
\************************************************************************/
class SvxAngleTabPage : public SvxTabPage
{
- static const sal_uInt16 pAngleRanges[];
+ static const WhichRangesContainer pAngleRanges;
private:
const SdrView* pView;
@@ -188,7 +195,7 @@ public:
virtual ~SvxAngleTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pAngleRanges; }
+ static WhichRangesContainer GetRanges() { return pAngleRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
@@ -209,7 +216,7 @@ public:
\************************************************************************/
class SvxSlantTabPage : public SfxTabPage
{
- static const sal_uInt16 pSlantRanges[];
+ static const WhichRangesContainer pSlantRanges;
private:
const SdrView* pView;
@@ -232,7 +239,7 @@ public:
virtual ~SvxSlantTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
- static const sal_uInt16* GetRanges() { return pSlantRanges; }
+ static WhichRangesContainer GetRanges() { return pSlantRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 59f7ef2d3e03..6d07d0981d5a 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -25,6 +25,9 @@
#include <sfx2/basedlgs.hxx>
#include <svtools/restartdialog.hxx>
+#include <utility>
+#include <i18nutil/searchopt.hxx>
+#include <vcl/timer.hxx>
class SfxModule;
class SfxShell;
@@ -36,8 +39,8 @@ struct OrderedEntry
sal_Int32 m_nIndex;
OUString m_sId;
- OrderedEntry( sal_Int32 nIndex, const OUString& rId ) :
- m_nIndex( nIndex ), m_sId( rId ) {}
+ OrderedEntry( sal_Int32 nIndex, OUString aId ) :
+ m_nIndex( nIndex ), m_sId(std::move( aId )) {}
};
@@ -61,15 +64,15 @@ struct OptionsLeaf
OUString m_sGroupId;
sal_Int32 m_nGroupIndex;
- OptionsLeaf( const OUString& rLabel,
- const OUString& rPageURL,
- const OUString& rEventHdl,
- const OUString& rGroupId,
+ OptionsLeaf( OUString aLabel,
+ OUString aPageURL,
+ OUString aEventHdl,
+ OUString aGroupId,
sal_Int32 nGroupIndex ) :
- m_sLabel( rLabel ),
- m_sPageURL( rPageURL ),
- m_sEventHdl( rEventHdl ),
- m_sGroupId( rGroupId ),
+ m_sLabel(std::move( aLabel )),
+ m_sPageURL(std::move( aPageURL )),
+ m_sEventHdl(std::move( aEventHdl )),
+ m_sGroupId(std::move( aGroupId )),
m_nGroupIndex( nGroupIndex ) {}
};
@@ -84,11 +87,11 @@ struct OptionsNode
std::vector< std::vector< std::unique_ptr<OptionsLeaf> > >
m_aGroupedLeaves;
- OptionsNode( const OUString& rId,
- const OUString& rLabel,
+ OptionsNode( OUString aId,
+ OUString aLabel,
bool bAllModules ) :
- m_sId( rId ),
- m_sLabel( rLabel ),
+ m_sId(std::move( aId )),
+ m_sLabel(std::move( aLabel )),
m_bAllModules( bAllModules ) {}
};
@@ -113,6 +116,7 @@ struct Module;
class ExtensionsTabPage;
class SvxColorTabPage;
struct OptionsGroupInfo;
+struct OptionsPageIdInfo;
class OfaTreeOptionsDialog final: public SfxOkDialogController
{
@@ -123,11 +127,38 @@ private:
std::unique_ptr<weld::TreeView> xTreeLB;
std::unique_ptr<weld::Container> xTabBox;
+ std::unique_ptr<weld::Entry> m_xSearchEdit;
weld::Window* m_pParent;
std::unique_ptr<weld::TreeIter> xCurrentPageEntry;
+ // For search
+ Timer m_aUpdateDataTimer;
+ i18nutil::SearchOptions2 m_options;
+
+ bool bIsFirtsInitialize;
+ std::vector<OptionsPageIdInfo*> m_aTreePageIds;
+ typedef std::vector<std::pair<sal_uInt16, std::vector<sal_uInt16>>> VectorOfMatchedIds;
+
+ void generalOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_GENERAL_OPTIONS
+ void loadAndSaveOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_FILTER_DLG
+ void languageOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_LANGUAGE_OPTIONS
+ void writerOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SW_EDITOPTIONS
+ void writerWebOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SW_ONLINEOPTIONS
+ void calcOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SC_EDITOPTIONS
+ void impressOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SD_EDITOPTIONS
+ void drawOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SD_GRAPHIC_OPTIONS
+ void mathOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SM_EDITOPTIONS
+ void databaseOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SB_STARBASEOPTIONS
+ void chartOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_SCH_EDITOPTIONS
+ void internetOptions(const std::vector<sal_uInt16>& vPageId = {}); // SID_INET_DLG
+
+ void clearOptionsDialog();
+ void selectFirstEntry();
+ void storeOptionsTree();
+ void showDialog(VectorOfMatchedIds& pSearchIds);
+
OUString sTitle;
bool bForgetSelection;
@@ -141,14 +172,13 @@ private:
css::uno::Reference < css::awt::XContainerWindowProvider >
m_xContainerWinProvider;
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
static LastPageSaver* pLastPageSaver;
- std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId );
+ std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId );
static void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
- void InitTreeAndHandler();
void Initialize( const css::uno::Reference< css::frame::XFrame >& _xFrame );
- void InitWidgets();
void LoadExtensionOptions( std::u16string_view rExtensionId );
static OUString GetModuleIdentifier( const css::uno::Reference<
@@ -163,8 +193,13 @@ private:
DECL_LINK(BackHdl_Impl, weld::Button&, void);
DECL_LINK(ApplyHdl_Impl, weld::Button&, void);
DECL_LINK(HelpHdl_Impl, weld::Widget&, bool);
+ DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
+ DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(FocusOut_Impl, weld::Widget&, void);
void ResetCurrentPageFromConfig();
void SelectHdl_Impl();
+ void initializeCurrentDialog(OptionsPageInfo*& pPageInfo,
+ std::unique_ptr<weld::TreeIter>& xEntry);
void InitItemSets(OptionsGroupInfo& rGroupInfo);
@@ -173,6 +208,13 @@ private:
virtual weld::Button& GetOKButton() const override { return *xOkPB; }
virtual const SfxItemSet* GetExampleSet() const override { return nullptr; }
+ int applySearchFilter(const OUString& rSearchTerm);
+
+ void ImplDestroy();
+
+ // Common initialization
+ OfaTreeOptionsDialog(weld::Window* pParent, bool fromExtensionManager);
+
public:
OfaTreeOptionsDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& _xFrame,
@@ -189,8 +231,12 @@ public:
void ActivatePage( const OUString& rPageURL );
void ApplyItemSets();
- // helper functions to call the language settings TabPage from the SpellDialog
+ // default value initializes all dialogs
+ void initializeFirstNDialog(sal_Int16 nNumberOfNode = -1);
+
+ // helper functions to call the Languages and Locales TabPage from the SpellDialog
static void ApplyLanguageOptions(const SfxItemSet& rSet);
+ static OUString getCurrentFactory_Impl( const css::uno::Reference< css::frame::XFrame >& _xFrame );
void SetNeedsRestart( svtools::RestartReason eReason );
};
@@ -219,7 +265,7 @@ private:
public:
ExtensionsTabPage(
weld::Container* pParent,
- const OUString& rPageURL, const OUString& rEvtHdl,
+ OUString rPageURL, OUString aEvtHdl,
const css::uno::Reference<
css::awt::XContainerWindowProvider >& rProvider );
@@ -235,4 +281,13 @@ public:
void SavePage();
};
+// class TreeOptHelper ---------------------------------------------------
+
+class TreeOptHelper
+{
+public:
+ static void storeStringsOfDialog(sal_uInt16 nPageId, const OUString& sPageStrings);
+ static OUString getStringsFromDialog(sal_uInt16 nPageId);
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/whatsnew.hxx b/cui/source/inc/whatsnew.hxx
new file mode 100644
index 000000000000..979fff919df2
--- /dev/null
+++ b/cui/source/inc/whatsnew.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
+#include "cuigrfflt.hxx"
+
+class WhatsNewImg : public weld::CustomWidgetController
+{
+ OUString m_sImage;
+ OUString m_sText;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+
+public:
+ WhatsNewImg() {}
+ void Update(const OUString& sImage, const OUString& sText)
+ {
+ m_sImage = sImage;
+ m_sText = sText;
+ SetAccessibleName(m_sText);
+ Invalidate();
+ }
+};
+
+class WhatsNewProgress : public weld::CustomWidgetController
+{
+ sal_Int32 m_nTotal;
+ sal_Int32 m_nCurrent;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+
+public:
+ WhatsNewProgress()
+ : m_nTotal(0)
+ , m_nCurrent(0)
+ {
+ }
+ void Update(const sal_Int32 nCurrent, const sal_Int32 nTotal)
+ {
+ m_nTotal = nTotal;
+ m_nCurrent = nCurrent;
+ Invalidate();
+ }
+};
+
+class WhatsNewDialog : public weld::GenericDialogController
+{
+private:
+ const bool m_bWelcome;
+
+ WhatsNewImg m_aPreview;
+ WhatsNewProgress m_aProgress;
+
+ std::unique_ptr<weld::Button> m_pPrevBtn;
+ std::unique_ptr<weld::Button> m_pNextBtn;
+ std::unique_ptr<weld::CustomWeld> m_pProgress;
+ std::unique_ptr<weld::CustomWeld> m_pImage;
+
+ DECL_LINK(OnPrevClick, weld::Button&, void);
+ DECL_LINK(OnNextClick, weld::Button&, void);
+
+ void LoadImage(); // loads WHATSNEW_STRINGARRAY[m_nCurrentNews]
+
+ sal_Int32 m_nNumberOfNews;
+ sal_Int32 m_nCurrentNews;
+
+public:
+ WhatsNewDialog(weld::Window* pParent, const bool bWelcome);
+ virtual ~WhatsNewDialog() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx
index f338e313305d..f44998378d73 100644
--- a/cui/source/inc/zoom.hxx
+++ b/cui/source/inc/zoom.hxx
@@ -45,11 +45,11 @@ private:
std::unique_ptr<weld::CheckButton> m_xBookModeChk;
std::unique_ptr<weld::Button> m_xOKBtn;
- DECL_LINK(UserHdl, weld::ToggleButton&, void);
+ DECL_LINK(UserHdl, weld::Toggleable&, void);
DECL_LINK(SpinHdl, weld::MetricSpinButton&, void);
- DECL_LINK(ViewLayoutUserHdl, weld::ToggleButton&, void);
+ DECL_LINK(ViewLayoutUserHdl, weld::Toggleable&, void);
DECL_LINK(ViewLayoutSpinHdl, weld::SpinButton&, void);
- DECL_LINK(ViewLayoutCheckHdl, weld::ToggleButton&, void);
+ DECL_LINK(ViewLayoutCheckHdl, weld::Toggleable&, void);
DECL_LINK(OKHdl, weld::Button&, void);
public:
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index b82065868f09..5cccccf1995c 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -10,12 +10,13 @@
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
#include <osl/security.hxx>
-#include <tools/diagnose_ex.h>
+#include <sfx2/filedlghelper.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include "certpath.hxx"
#include <com/sun/star/xml/crypto/NSSInitializer.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <comphelper/processfactory.hxx>
using namespace ::com::sun::star;
@@ -59,7 +60,7 @@ void CertPathDialog::Init()
"thunderbird"
};
- for (const auto& rNSSProfile : std::as_const(aProductList))
+ for (const auto& rNSSProfile : aProductList)
{
if (rNSSProfile.Type == mozilla::MozillaProductType_Default)
{
@@ -208,7 +209,8 @@ IMPL_LINK_NOARG(CertPathDialog, ManualHdl_Impl, weld::Button&, void)
{
try
{
- uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(comphelper::getProcessComponentContext());
+ uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = sfx2::createFolderPicker(
+ comphelper::getProcessComponentContext(), m_xDialog.get());
OUString sURL;
if (!m_sManualPath.isEmpty())
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx
index 525761c3c86c..8d1bd5e4130e 100644
--- a/cui/source/options/cfgchart.cxx
+++ b/cui/source/options/cfgchart.cxx
@@ -23,6 +23,8 @@
#include "cfgchart.hxx"
#include <dialmgr.hxx>
#include <strings.hrc>
+#include <utility>
+#include <officecfg/Office/Chart.hxx>
#define ROW_COLOR_COUNT 12
@@ -115,14 +117,14 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex )
{
OUString aName;
- OUString sDefaultNamePrefix;
- OUString sDefaultNamePostfix;
- OUString aResName( CuiResId( RID_SVXSTR_DIAGRAM_ROW ) );
+ std::u16string_view sDefaultNamePrefix;
+ std::u16string_view sDefaultNamePostfix;
+ OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) );
sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
if( nPos != -1 )
{
- sDefaultNamePrefix = aResName.copy( 0, nPos );
- sDefaultNamePostfix = aResName.copy( nPos + sizeof( "$(ROW)" ) - 1 );
+ sDefaultNamePrefix = aResName.subView( 0, nPos );
+ sDefaultNamePostfix = aResName.subView( nPos + sizeof( "$(ROW)" ) - 1 );
}
else
{
@@ -158,109 +160,63 @@ bool SvxChartColorTable::operator==( const SvxChartColorTable & _rOther ) const
-SvxChartOptions::SvxChartOptions() :
- ::utl::ConfigItem( "Office.Chart" ),
- mbIsInitialized( false )
+SvxChartColorTable SvxChartOptions::GetDefaultColors()
{
- maPropertyNames.realloc( 1 );
- maPropertyNames[ 0 ] = "DefaultColor/Series";
-}
+ // 1. default colors for series
+ uno::Sequence< sal_Int64 > aColorSeq = officecfg::Office::Chart::DefaultColor::Series::get();
-SvxChartOptions::~SvxChartOptions()
-{
-}
-
-const SvxChartColorTable& SvxChartOptions::GetDefaultColors()
-{
- if ( !mbIsInitialized )
- mbIsInitialized = RetrieveOptions();
- return maDefColors;
-}
-
-void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& aCol )
-{
- maDefColors = aCol;
- SetModified();
-}
+ sal_Int32 nCount = aColorSeq.getLength();
+ Color aCol;
-bool SvxChartOptions::RetrieveOptions()
-{
- // get sequence containing all properties
-
- uno::Sequence< OUString > aNames = GetPropertyNames();
- uno::Sequence< uno::Any > aProperties( aNames.getLength());
- aProperties = GetProperties( aNames );
-
- if( aProperties.getLength() == aNames.getLength())
+ // create strings for entry names
+ OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) );
+ std::u16string_view aPrefix, aPostfix;
+ OUString aName;
+ sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
+ if( nPos != -1 )
{
- // 1. default colors for series
- maDefColors.clear();
- uno::Sequence< sal_Int64 > aColorSeq;
- aProperties[ 0 ] >>= aColorSeq;
-
- sal_Int32 nCount = aColorSeq.getLength();
- Color aCol;
-
- // create strings for entry names
- OUString aResName( CuiResId( RID_SVXSTR_DIAGRAM_ROW ) );
- OUString aPrefix, aPostfix, aName;
- sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
- if( nPos != -1 )
- {
- aPrefix = aResName.copy( 0, nPos );
- sal_Int32 idx = nPos + sizeof( "$(ROW)" ) - 1;
- aPostfix = aResName.copy( idx );
- }
- else
- aPrefix = aResName;
-
- // set color values
- for( sal_Int32 i=0; i < nCount; i++ )
- {
- aCol = Color(ColorTransparency, aColorSeq[ i ]);
-
- aName = aPrefix + OUString::number(i + 1) + aPostfix;
-
- maDefColors.append( XColorEntry( aCol, aName ));
- }
- return true;
+ aPrefix = aResName.subView( 0, nPos );
+ sal_Int32 idx = nPos + sizeof( "$(ROW)" ) - 1;
+ aPostfix = aResName.subView( idx );
}
- return false;
-}
-
-void SvxChartOptions::ImplCommit()
-{
- uno::Sequence< OUString > aNames = GetPropertyNames();
- uno::Sequence< uno::Any > aValues( aNames.getLength());
+ else
+ aPrefix = aResName;
- if( aValues.hasElements() )
+ // set color values
+ SvxChartColorTable aDefColors;
+ for( sal_Int32 i=0; i < nCount; i++ )
{
- // 1. default colors for series
- // convert list to sequence
- const size_t nCount = maDefColors.size();
- uno::Sequence< sal_Int64 > aColors( nCount );
- for( size_t i=0; i < nCount; i++ )
- {
- Color aData = maDefColors.getColor( i );
- aColors[ i ] = sal_uInt32(aData);
- }
+ aCol = Color(ColorTransparency, aColorSeq[ i ]);
+
+ aName = aPrefix + OUString::number(i + 1) + aPostfix;
- aValues[ 0 ] <<= aColors;
+ aDefColors.append( XColorEntry( aCol, aName ));
}
- PutProperties( aNames, aValues );
+ return aDefColors;
}
-void SvxChartOptions::Notify( const css::uno::Sequence< OUString >& )
+void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& rDefColors )
{
+ // 1. default colors for series
+ // convert list to sequence
+ const size_t nCount = rDefColors.size();
+ uno::Sequence< sal_Int64 > aColors( nCount );
+ auto aColorsRange = asNonConstRange(aColors);
+ for( size_t i=0; i < nCount; i++ )
+ {
+ Color aData = rDefColors.getColor( i );
+ aColorsRange[ i ] = sal_uInt32(aData);
+ }
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Chart::DefaultColor::Series::set(aColors, batch);
+ batch->commit();
}
-
-
-SvxChartColorTableItem::SvxChartColorTableItem( sal_uInt16 nWhich_, const SvxChartColorTable& aTable ) :
+SvxChartColorTableItem::SvxChartColorTableItem( sal_uInt16 nWhich_, SvxChartColorTable aTable ) :
SfxPoolItem( nWhich_ ),
- m_aColorTable( aTable )
+ m_aColorTable(std::move( aTable ))
{
}
diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx
index acbe41a9b41e..ce39b0a1734a 100644
--- a/cui/source/options/cfgchart.hxx
+++ b/cui/source/options/cfgchart.hxx
@@ -19,10 +19,8 @@
#pragma once
-#include <unotools/configitem.hxx>
#include <svl/poolitem.hxx>
#include <svx/xtable.hxx>
-
#include <vector>
class SvxChartColorTable
@@ -51,29 +49,10 @@ public:
// all options
-class SvxChartOptions : public ::utl::ConfigItem
+namespace SvxChartOptions
{
-private:
- SvxChartColorTable maDefColors;
- bool mbIsInitialized;
-
- css::uno::Sequence< OUString >
- maPropertyNames;
-
- const css::uno::Sequence< OUString >& GetPropertyNames() const
- { return maPropertyNames; }
- bool RetrieveOptions();
-
- virtual void ImplCommit() override;
-
-public:
- SvxChartOptions();
- virtual ~SvxChartOptions() override;
-
- const SvxChartColorTable& GetDefaultColors();
- void SetDefaultColors( const SvxChartColorTable& aCol );
-
- virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
+ SvxChartColorTable GetDefaultColors();
+ void SetDefaultColors( const SvxChartColorTable& aCol );
};
@@ -86,7 +65,7 @@ public:
class SvxChartColorTableItem : public SfxPoolItem
{
public:
- SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& );
+ SvxChartColorTableItem( sal_uInt16 nWhich, SvxChartColorTable );
virtual SvxChartColorTableItem* Clone( SfxItemPool *pPool = nullptr ) const override;
virtual bool operator==( const SfxPoolItem& ) const override;
diff --git a/cui/source/options/connpoolconfig.cxx b/cui/source/options/connpoolconfig.cxx
index 8bf95ee0db5d..0d0f45be10b9 100644
--- a/cui/source/options/connpoolconfig.cxx
+++ b/cui/source/options/connpoolconfig.cxx
@@ -36,50 +36,21 @@ namespace offapp
using namespace ::utl;
using namespace ::com::sun::star::uno;
-
- static OUString getConnectionPoolNodeName()
- {
- return "org.openoffice.Office.DataAccess/ConnectionPool";
- }
-
-
- static OUString getEnablePoolingNodeName()
- {
- return "EnablePooling";
- }
-
-
- static OUString getDriverSettingsNodeName()
- {
- return "DriverSettings";
- }
-
-
- static OUString getDriverNameNodeName()
- {
- return "DriverName";
- }
-
-
- static OUString getEnableNodeName()
- {
- return "Enable";
- }
-
-
- static OUString getTimeoutNodeName()
- {
- return "Timeout";
- }
+ constexpr OUString CONNECTIONPOOL_NODENAME = u"org.openoffice.Office.DataAccess/ConnectionPool"_ustr;
+ constexpr OUString ENABLE_POOLING = u"EnablePooling"_ustr;
+ constexpr OUString DRIVER_SETTINGS = u"DriverSettings"_ustr;
+ constexpr OUString DRIVER_NAME = u"DriverName"_ustr;
+ constexpr OUString ENABLE = u"Enable"_ustr;
+ constexpr OUString TIMEOUT = u"Timeout"_ustr;
void ConnectionPoolConfig::GetOptions(SfxItemSet& _rFillItems)
{
// the config node where all pooling relevant info are stored under
OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithComponentContext(
- ::comphelper::getProcessComponentContext(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
+ ::comphelper::getProcessComponentContext(), CONNECTIONPOOL_NODENAME, -1, OConfigurationTreeRoot::CM_READONLY);
// the global "enabled" flag
- Any aEnabled = aConnectionPoolRoot.getNodeValue(getEnablePoolingNodeName());
+ Any aEnabled = aConnectionPoolRoot.getNodeValue(ENABLE_POOLING);
bool bEnabled = true;
aEnabled >>= bEnabled;
_rFillItems.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, bEnabled));
@@ -94,7 +65,7 @@ namespace offapp
}
// then look for which of them settings are stored in the configuration
- OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName());
+ OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(DRIVER_SETTINGS);
Sequence< OUString > aDriverKeys = aDriverSettings.getNodeNames();
const OUString* pDriverKeys = aDriverKeys.getConstArray();
@@ -104,7 +75,7 @@ namespace offapp
// the name of the driver in this round
OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys);
OUString sThisDriverName;
- aThisDriverSettings.getNodeValue(getDriverNameNodeName()) >>= sThisDriverName;
+ aThisDriverSettings.getNodeValue(DRIVER_NAME) >>= sThisDriverName;
// look if we (resp. the driver manager) know this driver
// doing O(n) search here, which is expensive, but this doesn't matter in this small case ...
@@ -126,8 +97,8 @@ namespace offapp
}
// now fill this entry with the settings from the configuration
- aThisDriverSettings.getNodeValue(getEnableNodeName()) >>= aLookup->bEnabled;
- aThisDriverSettings.getNodeValue(getTimeoutNodeName()) >>= aLookup->nTimeoutSeconds;
+ aThisDriverSettings.getNodeValue(ENABLE) >>= aLookup->bEnabled;
+ aThisDriverSettings.getNodeValue(TIMEOUT) >>= aLookup->nTimeoutSeconds;
}
_rFillItems.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, aSettings));
@@ -138,7 +109,7 @@ namespace offapp
{
// the config node where all pooling relevant info are stored under
OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithComponentContext(
- ::comphelper::getProcessComponentContext(), getConnectionPoolNodeName());
+ ::comphelper::getProcessComponentContext(), CONNECTIONPOOL_NODENAME);
if (!aConnectionPoolRoot.isValid())
// already asserted by the OConfigurationTreeRoot
@@ -151,7 +122,7 @@ namespace offapp
if (pEnabled)
{
bool bEnabled = pEnabled->GetValue();
- aConnectionPoolRoot.setNodeValue(getEnablePoolingNodeName(), Any(bEnabled));
+ aConnectionPoolRoot.setNodeValue(ENABLE_POOLING, Any(bEnabled));
bNeedCommit = true;
}
@@ -159,7 +130,7 @@ namespace offapp
const DriverPoolingSettingsItem* pDriverSettings = _rSourceItems.GetItem<DriverPoolingSettingsItem>(SID_SB_DRIVER_TIMEOUTS);
if (pDriverSettings)
{
- OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName());
+ OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(DRIVER_SETTINGS);
if (!aDriverSettings.isValid())
return;
@@ -179,9 +150,9 @@ namespace offapp
aThisDriverSettings = aDriverSettings.createNode(newSetting.sName);
// set the values
- aThisDriverSettings.setNodeValue(getDriverNameNodeName(), Any(sThisDriverName));
- aThisDriverSettings.setNodeValue(getEnableNodeName(), Any(newSetting.bEnabled));
- aThisDriverSettings.setNodeValue(getTimeoutNodeName(), Any(newSetting.nTimeoutSeconds));
+ aThisDriverSettings.setNodeValue(DRIVER_NAME, Any(sThisDriverName));
+ aThisDriverSettings.setNodeValue(ENABLE, Any(newSetting.bEnabled));
+ aThisDriverSettings.setNodeValue(TIMEOUT, Any(newSetting.nTimeoutSeconds));
}
bNeedCommit = true;
}
diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx
index 7ceaf5803cfa..f6321f2252b1 100644
--- a/cui/source/options/connpooloptions.cxx
+++ b/cui/source/options/connpooloptions.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include "connpooloptions.hxx"
#include "connpoolsettings.hxx"
@@ -24,6 +25,8 @@
#include <svx/databaseregistrationui.hxx>
#include <strings.hrc>
#include <dialmgr.hxx>
+#include <officecfg/Office/DataAccess.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
namespace offapp
{
@@ -45,28 +48,36 @@ namespace offapp
ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet)
: SfxTabPage(pPage, pController, "cui/ui/connpooloptions.ui", "ConnPoolPage", &_rAttrSet)
- , m_sYes(CuiResId(RID_SVXSTR_YES))
- , m_sNo(CuiResId(RID_SVXSTR_NO))
+ , m_sYes(CuiResId(RID_CUISTR_YES))
+ , m_sNo(CuiResId(RID_CUISTR_NO))
, m_xEnablePooling(m_xBuilder->weld_check_button("connectionpooling"))
+ , m_xEnablePoolingImg(m_xBuilder->weld_widget("lockconnectionpooling"))
, m_xDriversLabel(m_xBuilder->weld_label("driverslabel"))
, m_xDriverList(m_xBuilder->weld_tree_view("driverlist"))
, m_xDriverLabel(m_xBuilder->weld_label("driverlabel"))
, m_xDriver(m_xBuilder->weld_label("driver"))
, m_xDriverPoolingEnabled(m_xBuilder->weld_check_button("enablepooling"))
+ , m_xDriverPoolingEnabledImg(m_xBuilder->weld_widget("lockenablepooling"))
, m_xTimeoutLabel(m_xBuilder->weld_label("timeoutlabel"))
, m_xTimeout(m_xBuilder->weld_spin_button("timeout"))
+ , m_xTimeoutImg(m_xBuilder->weld_widget("locktimeout"))
{
m_xDriverList->set_size_request(m_xDriverList->get_approximate_digit_width() * 60,
m_xDriverList->get_height_rows(15));
m_xDriverList->show();
- std::vector<int> aWidths;
- aWidths.push_back(m_xDriverList->get_approximate_digit_width() * 50);
- aWidths.push_back(m_xDriverList->get_approximate_digit_width() * 8);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xDriverList->get_approximate_digit_width() * 50),
+ o3tl::narrowing<int>(m_xDriverList->get_approximate_digit_width() * 8)
+ };
m_xDriverList->set_column_fixed_widths(aWidths);
- m_xEnablePooling->connect_clicked( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
- m_xDriverPoolingEnabled->connect_clicked( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+ css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
+
+ m_xEnablePooling->connect_toggled( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+ m_xDriverPoolingEnabled->connect_toggled( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
m_xDriverList->connect_changed(LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged));
m_xTimeout->connect_value_changed(LINK(this, ConnectionPoolOptionsPage, OnSpinValueChanged));
@@ -133,6 +144,8 @@ namespace offapp
const SfxBoolItem* pEnabled = _rSet.GetItem<SfxBoolItem>(SID_SB_POOLING_ENABLED);
OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!");
m_xEnablePooling->set_active(pEnabled == nullptr || pEnabled->GetValue());
+ m_xEnablePooling->set_sensitive(!officecfg::Office::DataAccess::ConnectionPool::EnablePooling::isReadOnly());
+ m_xEnablePoolingImg->set_visible(officecfg::Office::DataAccess::ConnectionPool::EnablePooling::isReadOnly());
m_xEnablePooling->save_state();
@@ -142,7 +155,7 @@ namespace offapp
UpdateDriverList(pDriverSettings->getSettings());
else
{
- OSL_FAIL("ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
+ SAL_WARN("cui.options", "ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
UpdateDriverList(DriverPoolingSettings());
}
saveDriverList();
@@ -156,6 +169,28 @@ namespace offapp
commitTimeoutField();
}
+ OUString ConnectionPoolOptionsPage::GetAllStrings()
+ {
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "driverslabel", "driverlabel", "timeoutlabel", "driver" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "connectionpooling", "enablepooling" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+ }
+
bool ConnectionPoolOptionsPage::FillItemSet(SfxItemSet* _rSet)
{
commitTimeoutField();
@@ -208,6 +243,20 @@ namespace offapp
m_xDriverPoolingEnabled->set_active(currentSetting.bEnabled);
m_xTimeout->set_value(currentSetting.nTimeoutSeconds);
+ OUString aConfigPath = officecfg::Office::DataAccess::ConnectionPool::DriverSettings::path() + "/" + currentSetting.sName;
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath + "/Enable");
+ bool bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+
+ m_xDriverPoolingEnabled->set_sensitive(!bReadOnly);
+ m_xDriverPoolingEnabledImg->set_visible(bReadOnly);
+
+ aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath + "/Timeout");
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+
+ m_xTimeout->set_sensitive(!bReadOnly);
+ m_xTimeoutLabel->set_sensitive(!bReadOnly);
+ m_xTimeoutImg->set_visible(bReadOnly);
+
OnEnabledDisabled(*m_xDriverPoolingEnabled);
}
}
@@ -221,7 +270,7 @@ namespace offapp
updateCurrentRow();
}
- IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, weld::Button&, rCheckBox, void )
+ IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, weld::Toggleable&, rCheckBox, void )
{
bool bGloballyEnabled = m_xEnablePooling->get_active();
bool bLocalDriverChanged = m_xDriverPoolingEnabled.get() == &rCheckBox;
@@ -234,13 +283,13 @@ namespace offapp
m_xDriverList->select(-1);
m_xDriverLabel->set_sensitive(bGloballyEnabled);
m_xDriver->set_sensitive(bGloballyEnabled);
- m_xDriverPoolingEnabled->set_sensitive(bGloballyEnabled);
+ m_xDriverPoolingEnabled->set_sensitive(bGloballyEnabled && !m_xDriverPoolingEnabledImg->get_visible());
}
else
OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?");
- m_xTimeoutLabel->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active());
- m_xTimeout->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active());
+ m_xTimeoutLabel->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active() && !m_xTimeoutImg->get_visible());
+ m_xTimeout->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active() && !m_xTimeoutImg->get_visible());
if (bLocalDriverChanged)
{
diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx
index 570ec66abda6..2413f0d16de3 100644
--- a/cui/source/options/connpooloptions.hxx
+++ b/cui/source/options/connpooloptions.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <sfx2/tabdlg.hxx>
+#include <com/sun/star/configuration/ReadWriteAccess.hpp>
#include "connpoolsettings.hxx"
@@ -32,19 +33,25 @@ namespace offapp
DriverPoolingSettings m_aSettings;
DriverPoolingSettings m_aSavedSettings;
+ css::uno::Reference< css::configuration::XReadWriteAccess> m_xReadWriteAccess;
+
std::unique_ptr<weld::CheckButton> m_xEnablePooling;
+ std::unique_ptr<weld::Widget> m_xEnablePoolingImg;
std::unique_ptr<weld::Label> m_xDriversLabel;
std::unique_ptr<weld::TreeView> m_xDriverList;
std::unique_ptr<weld::Label> m_xDriverLabel;
std::unique_ptr<weld::Label> m_xDriver;
std::unique_ptr<weld::CheckButton> m_xDriverPoolingEnabled;
+ std::unique_ptr<weld::Widget> m_xDriverPoolingEnabledImg;
std::unique_ptr<weld::Label> m_xTimeoutLabel;
std::unique_ptr<weld::SpinButton> m_xTimeout;
+ std::unique_ptr<weld::Widget> m_xTimeoutImg;
public:
ConnectionPoolOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet);
virtual ~ConnectionPoolOptionsPage() override;
static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet);
+ virtual OUString GetAllStrings() override;
private:
virtual bool FillItemSet(SfxItemSet* _rSet) override;
@@ -57,7 +64,7 @@ namespace offapp
bool isModifiedDriverList() const;
void saveDriverList() { m_aSavedSettings = m_aSettings; }
- DECL_LINK(OnEnabledDisabled, weld::Button&, void);
+ DECL_LINK(OnEnabledDisabled, weld::Toggleable&, void);
DECL_LINK(OnSpinValueChanged, weld::SpinButton&, void);
DECL_LINK(OnDriverRowChanged, weld::TreeView&, void);
diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx
index 46742d826aa5..e92b26da555f 100644
--- a/cui/source/options/connpoolsettings.cxx
+++ b/cui/source/options/connpoolsettings.cxx
@@ -17,14 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
+
#include "connpoolsettings.hxx"
namespace offapp
{
- DriverPooling::DriverPooling( const OUString& _rName )
- :sName(_rName)
+ DriverPooling::DriverPooling( OUString _aName )
+ :sName(std::move(_aName))
,bEnabled(false)
,nTimeoutSeconds(120)
{
@@ -43,9 +45,9 @@ namespace offapp
}
- DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings )
+ DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, DriverPoolingSettings _aSettings )
:SfxPoolItem(_nId)
- ,m_aSettings(_rSettings)
+ ,m_aSettings(std::move(_aSettings))
{
}
diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx
index 8f8c6bc3b361..1e2404b88583 100644
--- a/cui/source/options/connpoolsettings.hxx
+++ b/cui/source/options/connpoolsettings.hxx
@@ -36,7 +36,7 @@ namespace offapp
bool bEnabled;
sal_Int32 nTimeoutSeconds;
- explicit DriverPooling( const OUString& _rName );
+ explicit DriverPooling( OUString _aName );
bool operator == (const DriverPooling& _rR) const;
bool operator != (const DriverPooling& _rR) const { return !operator ==(_rR); }
@@ -72,7 +72,7 @@ namespace offapp
public:
- DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings );
+ DriverPoolingSettingsItem( sal_uInt16 _nId, DriverPoolingSettings _aSettings );
virtual bool operator==( const SfxPoolItem& ) const override;
virtual DriverPoolingSettingsItem* Clone( SfxItemPool *pPool = nullptr ) const override;
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 7bcf13435bbf..6aa9213efd92 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -17,13 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <dbregister.hxx>
#include "dbregistersettings.hxx"
+#include <o3tl/safeint.hxx>
#include <svl/filenotation.hxx>
#include <helpids.h>
#include <tools/debug.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <svl/itemset.hxx>
@@ -31,6 +37,7 @@
#include <dialmgr.hxx>
#include "dbregisterednamesconfig.hxx"
#include <svx/databaseregistrationui.hxx>
+#include <o3tl/string_view.hxx>
#define COL_TYPE 0
@@ -38,15 +45,13 @@ namespace svx
{
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
-using namespace ::com::sun::star::uno;
using namespace ::svt;
// class RegistrationItemSetHolder -------------------------------------------------
-RegistrationItemSetHolder::RegistrationItemSetHolder( const SfxItemSet& _rMasterSet )
- :m_aRegistrationItems( _rMasterSet )
+RegistrationItemSetHolder::RegistrationItemSetHolder( SfxItemSet _aMasterSet )
+ :m_aRegistrationItems(std::move( _aMasterSet ))
{
DbRegisteredNamesConfig::GetOptions( m_aRegistrationItems );
}
@@ -62,7 +67,7 @@ DatabaseRegistrationDialog::DatabaseRegistrationDialog(weld::Window* pParent, co
, SfxSingleTabDialogController(pParent, &getRegistrationItems())
{
SetTabPage(DbRegistrationOptionsPage::Create(get_content_area(), this, &getRegistrationItems()));
- m_xDialog->set_title(CuiResId(RID_SVXSTR_REGISTERED_DATABASES));
+ m_xDialog->set_title(CuiResId(RID_CUISTR_REGISTERED_DATABASES));
}
short DatabaseRegistrationDialog::run()
@@ -93,8 +98,10 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage(weld::Container* pPage, wel
m_xPathBox->get_height_rows(12));
m_xPathBox->set_size_request(aControlSize.Width(), aControlSize.Height());
- std::vector<int> aWidths;
- aWidths.push_back(m_xPathBox->get_approximate_digit_width() * 20);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xPathBox->get_approximate_digit_width() * 20)
+ };
m_xPathBox->set_column_fixed_widths(aWidths);
m_xNew->connect_clicked( LINK( this, DbRegistrationOptionsPage, NewHdl ) );
@@ -113,7 +120,7 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage(weld::Container* pPage, wel
DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
{
for (int i = 0, nCount = m_xPathBox->n_children(); i < nCount; ++i )
- delete reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(i).toInt64());
+ delete weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(i));
}
std::unique_ptr<SfxTabPage> DbRegistrationOptionsPage::Create( weld::Container* pPage, weld::DialogController* pController,
@@ -122,6 +129,16 @@ std::unique_ptr<SfxTabPage> DbRegistrationOptionsPage::Create( weld::Container*
return std::make_unique<DbRegistrationOptionsPage>(pPage, pController, *rAttrSet);
}
+OUString DbRegistrationOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+
+ if (const auto& pString = m_xBuilder->weld_label("label1"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool DbRegistrationOptionsPage::FillItemSet( SfxItemSet* rCoreSet )
{
// the settings for the single drivers
@@ -130,7 +147,7 @@ bool DbRegistrationOptionsPage::FillItemSet( SfxItemSet* rCoreSet )
int nCount = m_xPathBox->n_children();
for (int i = 0; i < nCount; ++i)
{
- DatabaseRegistration* pRegistration = reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(i).toInt64());
+ DatabaseRegistration* pRegistration = weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(i));
if ( pRegistration && !pRegistration->sLocation.isEmpty() )
{
OUString sName(m_xPathBox->get_text(i, 0));
@@ -140,7 +157,7 @@ bool DbRegistrationOptionsPage::FillItemSet( SfxItemSet* rCoreSet )
}
if ( m_nOldCount != aRegistrations.size() || m_bModified )
{
- rCoreSet->Put(DatabaseMapItem( SID_SB_DB_REGISTER, aRegistrations ));
+ rCoreSet->Put(DatabaseMapItem( SID_SB_DB_REGISTER, std::move(aRegistrations) ));
bModified = true;
}
@@ -165,25 +182,27 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet* rSet )
}
OUString aUserData = GetUserData();
- if ( !aUserData.isEmpty() )
+ if ( aUserData.isEmpty() )
+ return;
+
+ sal_Int32 nIdx {0};
+ // restore column width
+ std::vector<int> aWidths
{
- sal_Int32 nIdx {0};
- // restore column width
- std::vector<int> aWidths;
- aWidths.push_back(aUserData.getToken(0, ';', nIdx).toInt32());
- m_xPathBox->set_column_fixed_widths(aWidths);
- // restore sort direction
- bool bUp = aUserData.getToken(0, ';', nIdx).toInt32() != 0;
- m_xPathBox->set_sort_order(bUp);
- m_xPathBox->set_sort_indicator(bUp ? TRISTATE_TRUE : TRISTATE_FALSE, COL_TYPE);
- }
+ o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx))
+ };
+ m_xPathBox->set_column_fixed_widths(aWidths);
+ // restore sort direction
+ bool bUp = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx)) != 0;
+ m_xPathBox->set_sort_order(bUp);
+ m_xPathBox->set_sort_indicator(bUp ? TRISTATE_TRUE : TRISTATE_FALSE, COL_TYPE);
}
void DbRegistrationOptionsPage::FillUserData()
{
OUString aUserData = OUString::number( m_xPathBox->get_column_width(COL_TYPE) ) + ";";
bool bUp = m_xPathBox->get_sort_order();
- aUserData += (bUp ? OUStringLiteral(u"1") : OUStringLiteral(u"0"));
+ aUserData += (bUp ? std::u16string_view(u"1") : std::u16string_view(u"0"));
SetUserData( aUserData );
}
@@ -193,7 +212,7 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, DeleteHdl, weld::Button&, void)
if (nEntry != -1)
{
std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo, CuiResId(RID_SVXSTR_QUERY_DELETE_CONFIRM)));
+ VclMessageType::Question, VclButtonsType::YesNo, CuiResId(RID_CUISTR_QUERY_DELETE_CONFIRM)));
if (xQuery->run() == RET_YES)
m_xPathBox->remove(nEntry);
}
@@ -216,7 +235,7 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, EditHdl, weld::Button&, void)
if (nEntry == -1)
return;
- DatabaseRegistration* pOldRegistration = reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(nEntry).toInt64());
+ DatabaseRegistration* pOldRegistration = weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(nEntry));
if (!pOldRegistration || pOldRegistration->bReadOnly)
return;
@@ -241,7 +260,7 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, int, nCol, void )
IMPL_LINK_NOARG(DbRegistrationOptionsPage, PathSelect_Impl, weld::TreeView&, void)
{
- DatabaseRegistration* pRegistration = reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_selected_id().toInt64());
+ DatabaseRegistration* pRegistration = weld::fromId<DatabaseRegistration*>(m_xPathBox->get_selected_id());
bool bReadOnly = true;
if (pRegistration)
@@ -255,7 +274,7 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, PathSelect_Impl, weld::TreeView&, voi
void DbRegistrationOptionsPage::insertNewEntry(const OUString& _sName,const OUString& _sLocation, const bool _bReadOnly)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new DatabaseRegistration(_sLocation, _bReadOnly))));
+ OUString sId(weld::toId(new DatabaseRegistration(_sLocation, _bReadOnly)));
m_xPathBox->insert(nullptr, -1, &_sName, &sId, nullptr, nullptr, false, m_xIter.get());
if (_bReadOnly)
@@ -269,7 +288,10 @@ void DbRegistrationOptionsPage::openLinkDialog(const OUString& sOldName, const O
ODocumentLinkDialog aDlg(GetFrameWeld(), nEntry == -1);
aDlg.setLink(sOldName, sOldLocation);
- aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
+
+ // tdf#149195: control the name (ie check duplicate) only if new entry case
+ if (nEntry == -1)
+ aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
if (aDlg.run() != RET_OK)
return;
@@ -280,7 +302,7 @@ void DbRegistrationOptionsPage::openLinkDialog(const OUString& sOldName, const O
{
if (nEntry != -1)
{
- delete reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(nEntry).toInt64());
+ delete weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(nEntry));
m_xPathBox->remove(nEntry);
}
insertNewEntry( sNewName, sNewLocation, false );
diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
index 87681866e067..6539506e9614 100644
--- a/cui/source/options/dbregisterednamesconfig.cxx
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <comphelper/processfactory.hxx>
#include <svl/itemset.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace svx
@@ -32,7 +32,6 @@ namespace svx
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::container;
void DbRegisteredNamesConfig::GetOptions( SfxItemSet& _rFillItems )
{
@@ -59,7 +58,7 @@ namespace svx
DBG_UNHANDLED_EXCEPTION("cui.options");
}
- _rFillItems.Put( DatabaseMapItem( SID_SB_DB_REGISTER, aSettings ) );
+ _rFillItems.Put( DatabaseMapItem( SID_SB_DB_REGISTER, std::move(aSettings) ) );
}
diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx
index f7739a1092cc..c544e1111fe3 100644
--- a/cui/source/options/dbregistersettings.cxx
+++ b/cui/source/options/dbregistersettings.cxx
@@ -25,9 +25,9 @@
namespace svx
{
- DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations )
+ DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, DatabaseRegistrations&& _rRegistrations )
:SfxPoolItem( _nId )
- ,m_aRegistrations( _rRegistrations )
+ ,m_aRegistrations( std::move(_rRegistrations) )
{
}
diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx
index 9146afe7b1d3..b1db16542f02 100644
--- a/cui/source/options/dbregistersettings.hxx
+++ b/cui/source/options/dbregistersettings.hxx
@@ -24,6 +24,7 @@
#include <map>
#include <svl/poolitem.hxx>
+#include <utility>
namespace svx
@@ -41,8 +42,8 @@ namespace svx
{
}
- DatabaseRegistration( const OUString& _rLocation, const bool _bReadOnly )
- :sLocation( _rLocation )
+ DatabaseRegistration( OUString _aLocation, const bool _bReadOnly )
+ :sLocation(std::move( _aLocation ))
,bReadOnly( _bReadOnly )
{
}
@@ -64,7 +65,7 @@ namespace svx
public:
- DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations );
+ DatabaseMapItem( sal_uInt16 _nId, DatabaseRegistrations&& _rRegistrations );
virtual bool operator==( const SfxPoolItem& ) const override;
virtual DatabaseMapItem* Clone( SfxItemPool *pPool = nullptr ) const override;
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
index 4218a18a1a04..f938399140ab 100644
--- a/cui/source/options/doclinkdialog.cxx
+++ b/cui/source/options/doclinkdialog.cxx
@@ -20,7 +20,11 @@
#include "doclinkdialog.hxx"
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/processfactory.hxx>
+#include <officecfg/Office/DataAccess.hxx>
#include <strings.hrc>
#include <svl/filenotation.hxx>
#include <vcl/svapp.hxx>
@@ -51,7 +55,10 @@ namespace svx
m_xURL->SetSmartProtocol(INetProtocol::File);
m_xURL->DisableHistory();
- m_xURL->SetFilter("*.odb");
+ m_xURL->SetFilter(u"*.odb");
+
+ css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
m_xName->connect_changed( LINK(this, ODocumentLinkDialog, OnEntryModified) );
m_xURL->connect_changed( LINK(this, ODocumentLinkDialog, OnComboBoxModified) );
@@ -81,6 +88,44 @@ namespace svx
void ODocumentLinkDialog::validate( )
{
m_xOK->set_sensitive((!m_xName->get_text().isEmpty()) && (!m_xURL->get_active_text().isEmpty()));
+
+ if (m_xOK->get_sensitive())
+ {
+ Reference<container::XNameAccess> xItemList = officecfg::Office::DataAccess::RegisteredNames::get();
+ Sequence< OUString > lNodeNames = xItemList->getElementNames();
+
+ for (const OUString& sNodeName : lNodeNames)
+ {
+ Reference<css::beans::XPropertySet> xSet;
+ xItemList->getByName(sNodeName) >>= xSet;
+
+ OUString aDatabaseName;
+ if (xSet->getPropertySetInfo()->hasPropertyByName("Name"))
+ xSet->getPropertyValue("Name") >>= aDatabaseName;
+
+ if (!aDatabaseName.isEmpty() && m_xName->get_text() == aDatabaseName)
+ {
+ const OUString aConfigPath = officecfg::Office::DataAccess::RegisteredNames::path() + "/" + sNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath + "/Name"))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath + "/Name");
+ bool bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+
+ m_xURL->set_sensitive(!bReadOnly);
+ m_xBrowseFile->set_sensitive(!bReadOnly);
+ }
+
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath + "/Location"))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath + "/Location");
+ bool bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+
+ m_xName->set_sensitive(!bReadOnly);
+ }
+ break;
+ }
+ }
+ }
}
IMPL_LINK_NOARG(ODocumentLinkDialog, OnOk, weld::Button&, void)
diff --git a/cui/source/options/doclinkdialog.hxx b/cui/source/options/doclinkdialog.hxx
index 371dc6504fe9..3ea0d5027d0f 100644
--- a/cui/source/options/doclinkdialog.hxx
+++ b/cui/source/options/doclinkdialog.hxx
@@ -21,6 +21,7 @@
#include <vcl/weld.hxx>
#include <svtools/inettbc.hxx>
+#include <com/sun/star/configuration/ReadWriteAccess.hpp>
namespace svx
{
@@ -30,6 +31,8 @@ namespace svx
{
Link<const OUString&,bool> m_aNameValidator;
+ css::uno::Reference< css::configuration::XReadWriteAccess> m_xReadWriteAccess;
+
std::unique_ptr<weld::Button> m_xBrowseFile;
std::unique_ptr<weld::Entry> m_xName;
std::unique_ptr<weld::Button> m_xOK;
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index fa05481d0663..4d61a873e264 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -34,16 +34,21 @@
SvxFontSubstTabPage::SvxFontSubstTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optfontspage.ui", "OptFontsPage", &rSet)
- , m_xConfig(new SvtFontSubstConfig)
, m_xUseTableCB(m_xBuilder->weld_check_button("usetable"))
+ , m_xUseTableImg(m_xBuilder->weld_widget("lockusetable"))
, m_xFont1CB(m_xBuilder->weld_combo_box("font1"))
, m_xFont2CB(m_xBuilder->weld_combo_box("font2"))
, m_xApply(m_xBuilder->weld_button("apply"))
, m_xDelete(m_xBuilder->weld_button("delete"))
, m_xCheckLB(m_xBuilder->weld_tree_view("checklb"))
, m_xFontNameLB(m_xBuilder->weld_combo_box("fontname"))
+ , m_xFontNameLabel(m_xBuilder->weld_label("label8"))
+ , m_xFontNameImg(m_xBuilder->weld_widget("lockfontname"))
, m_xNonPropFontsOnlyCB(m_xBuilder->weld_check_button("nonpropfontonly"))
+ , m_xNonPropFontsOnlyImg(m_xBuilder->weld_widget("locknonpropfontonly"))
, m_xFontHeightLB(m_xBuilder->weld_combo_box("fontheight"))
+ , m_xFontHeightLabel(m_xBuilder->weld_label("label9"))
+ , m_xFontHeightImg(m_xBuilder->weld_widget("lockfontheight"))
{
m_xFont1CB->make_sorted();
m_xFont1CB->set_size_request(1, -1);
@@ -69,7 +74,7 @@ SvxFontSubstTabPage::SvxFontSubstTabPage(weld::Container* pPage, weld::DialogCon
m_xCheckLB->connect_changed(LINK(this, SvxFontSubstTabPage, TreeListBoxSelectHdl));
m_xCheckLB->connect_column_clicked(LINK(this, SvxFontSubstTabPage, HeaderBarClick));
- m_xUseTableCB->connect_clicked(aClickLink);
+ m_xUseTableCB->connect_toggled(LINK(this, SvxFontSubstTabPage, ToggleHdl));
m_xFont1CB->connect_changed(aLink2);
m_xFont2CB->connect_changed(aLink2);
m_xApply->connect_clicked(aClickLink);
@@ -122,10 +127,7 @@ void SvxFontSubstTabPage::setColSizes(const Size& rSize)
nMax = std::max(nMax, nMin);
const int nDoubleMax = 2*nMax;
const int nRest = rSize.Width() - nDoubleMax;
- std::vector<int> aWidths;
- aWidths.push_back(nMax);
- aWidths.push_back(nMax);
- aWidths.push_back(nRest/2);
+ std::vector<int> aWidths { nMax, nMax, nRest/2 };
m_xCheckLB->set_column_fixed_widths(aWidths);
}
@@ -144,25 +146,45 @@ std::unique_ptr<SfxTabPage> SvxFontSubstTabPage::Create( weld::Container* pPage,
return std::make_unique<SvxFontSubstTabPage>(pPage, pController, *rAttrSet);
}
-bool SvxFontSubstTabPage::FillItemSet( SfxItemSet* )
+OUString SvxFontSubstTabPage::GetAllStrings()
{
- m_xConfig->ClearSubstitutions();// remove all entries
+ OUString sAllStrings;
+ OUString labels[] = { "label4", "label2", "label3", "label1", "label8", "label9" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
- m_xConfig->Enable(m_xUseTableCB->get_active());
+ OUString checkButton[] = { "usetable", "nonpropfontonly" };
- m_xCheckLB->all_foreach([this](weld::TreeIter& rIter) {
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
+bool SvxFontSubstTabPage::FillItemSet( SfxItemSet* )
+{
+ std::vector<SubstitutionStruct> aNewFontSubs;
+
+ m_xCheckLB->all_foreach([this, &aNewFontSubs](weld::TreeIter& rIter) {
SubstitutionStruct aAdd;
aAdd.sFont = m_xCheckLB->get_text(rIter, 2);
aAdd.sReplaceBy = m_xCheckLB->get_text(rIter, 3);
aAdd.bReplaceAlways = m_xCheckLB->get_toggle(rIter, 0);
aAdd.bReplaceOnScreenOnly = m_xCheckLB->get_toggle(rIter, 1);
- m_xConfig->AddSubstitution(aAdd);
+ aNewFontSubs.push_back(aAdd);
return false;
});
- if(m_xConfig->IsModified())
- m_xConfig->Commit();
- m_xConfig->Apply();
+ svtools::SetFontSubstitutions(m_xUseTableCB->get_active(), aNewFontSubs);
+ svtools::ApplyFontSubstitutionsToVcl();
+
std::shared_ptr< comphelper::ConfigurationChanges > batch(
comphelper::ConfigurationChanges::create());
if (m_xFontHeightLB->get_value_changed_from_saved())
@@ -206,19 +228,20 @@ void SvxFontSubstTabPage::Reset( const SfxItemSet* )
m_xFont2CB->thaw();
m_xFont1CB->thaw();
- sal_Int32 nCount = m_xConfig->SubstitutionCount();
- if (nCount)
- m_xUseTableCB->set_active(m_xConfig->IsEnabled());
+ bool bEnable = !officecfg::Office::Common::Font::Substitution::Replacement::isReadOnly();
+ m_xUseTableCB->set_active(svtools::IsFontSubstitutionsEnabled());
+ m_xUseTableCB->set_sensitive(bEnable);
+ m_xUseTableImg->set_visible(!bEnable);
+ std::vector<SubstitutionStruct> aFontSubs = svtools::GetFontSubstitutions();
std::unique_ptr<weld::TreeIter> xIter(m_xCheckLB->make_iterator());
- for (sal_Int32 i = 0; i < nCount; ++i)
+ for (auto const & sub: aFontSubs)
{
m_xCheckLB->append(xIter.get());
- const SubstitutionStruct* pSubs = m_xConfig->GetSubstitution(i);
- m_xCheckLB->set_toggle(*xIter, pSubs->bReplaceAlways ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
- m_xCheckLB->set_toggle(*xIter, pSubs->bReplaceOnScreenOnly ? TRISTATE_TRUE : TRISTATE_FALSE, 1);
- m_xCheckLB->set_text(*xIter, pSubs->sFont, 2);
- m_xCheckLB->set_text(*xIter, pSubs->sReplaceBy, 3);
+ m_xCheckLB->set_toggle(*xIter, sub.bReplaceAlways ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ m_xCheckLB->set_toggle(*xIter, sub.bReplaceOnScreenOnly ? TRISTATE_TRUE : TRISTATE_FALSE, 1);
+ m_xCheckLB->set_text(*xIter, sub.sFont, 2);
+ m_xCheckLB->set_text(*xIter, sub.sReplaceBy, 3);
}
m_xCheckLB->thaw();
@@ -245,10 +268,28 @@ void SvxFontSubstTabPage::Reset( const SfxItemSet* )
OUString::number(
officecfg::Office::Common::Font::SourceViewFont::FontHeight::
get()));
+
+ bEnable = !officecfg::Office::Common::Font::SourceViewFont::FontName::isReadOnly();
+ m_xFontNameLB->set_sensitive(bEnable);
+ m_xFontNameLabel->set_sensitive(bEnable);
+ m_xFontNameImg->set_visible(!bEnable);
+
+ m_xNonPropFontsOnlyCB->set_sensitive(bEnable);
+ m_xNonPropFontsOnlyImg->set_visible(!bEnable);
+
+ m_xFontHeightLB->set_sensitive(bEnable);
+ m_xFontHeightLabel->set_sensitive(bEnable);
+ m_xFontHeightImg->set_visible(!bEnable);
+
m_xNonPropFontsOnlyCB->save_state();
m_xFontHeightLB->save_value();
}
+IMPL_LINK(SvxFontSubstTabPage, ToggleHdl, weld::Toggleable&, rButton, void)
+{
+ SelectHdl(&rButton);
+}
+
IMPL_LINK(SvxFontSubstTabPage, ClickHdl, weld::Button&, rButton, void)
{
SelectHdl(&rButton);
@@ -357,7 +398,7 @@ void SvxFontSubstTabPage::SelectHdl(const weld::Widget* pWin)
CheckEnable();
}
-IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, weld::Toggleable&, rBox, void)
{
OUString sFontName = m_xFontNameLB->get_active_text();
bool bNonPropOnly = rBox.get_active();
@@ -376,7 +417,7 @@ IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, weld::ToggleButton&, rBox, void)
void SvxFontSubstTabPage::CheckEnable()
{
- bool bEnableAll = m_xUseTableCB->get_active();
+ bool bEnableAll = m_xUseTableCB->get_active() && !officecfg::Office::Common::Font::SourceViewFont::FontName::isReadOnly();
m_xCheckLB->set_sensitive(bEnableAll);
m_xFont1CB->set_sensitive(bEnableAll);
m_xFont2CB->set_sensitive(bEnableAll);
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
index 7af81e211b7c..e91a9818e56c 100644
--- a/cui/source/options/fontsubs.hxx
+++ b/cui/source/options/fontsubs.hxx
@@ -26,22 +26,28 @@ class SvtFontSubstConfig;
class SvxFontSubstTabPage : public SfxTabPage
{
OUString m_sAutomatic;
- std::unique_ptr<SvtFontSubstConfig> m_xConfig;
std::unique_ptr<weld::CheckButton> m_xUseTableCB;
+ std::unique_ptr<weld::Widget> m_xUseTableImg;
std::unique_ptr<weld::ComboBox> m_xFont1CB;
std::unique_ptr<weld::ComboBox> m_xFont2CB;
std::unique_ptr<weld::Button> m_xApply;
std::unique_ptr<weld::Button> m_xDelete;
std::unique_ptr<weld::TreeView> m_xCheckLB;
std::unique_ptr<weld::ComboBox> m_xFontNameLB;
+ std::unique_ptr<weld::Label> m_xFontNameLabel;
+ std::unique_ptr<weld::Widget> m_xFontNameImg;
std::unique_ptr<weld::CheckButton> m_xNonPropFontsOnlyCB;
+ std::unique_ptr<weld::Widget> m_xNonPropFontsOnlyImg;
std::unique_ptr<weld::ComboBox> m_xFontHeightLB;
+ std::unique_ptr<weld::Label> m_xFontHeightLabel;
+ std::unique_ptr<weld::Widget> m_xFontHeightImg;
DECL_LINK(SelectComboBoxHdl, weld::ComboBox&, void);
+ DECL_LINK(ToggleHdl, weld::Toggleable&, void);
DECL_LINK(ClickHdl, weld::Button&, void);
DECL_LINK(TreeListBoxSelectHdl, weld::TreeView&, void);
- DECL_LINK(NonPropFontsHdl, weld::ToggleButton&, void);
+ DECL_LINK(NonPropFontsHdl, weld::Toggleable&, void);
DECL_LINK(HeaderBarClick, int, void);
DECL_LINK(ResizeHdl, const Size&, void);
@@ -54,6 +60,9 @@ public:
SvxFontSubstTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
virtual ~SvxFontSubstTabPage() override;
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 4c8d3d8118a4..de64f45b4260 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -8,159 +8,146 @@
*/
#include "optaboutconfig.hxx"
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/configuration/theDefaultProvider.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/configuration/ReadWriteAccess.hpp>
+#include <com/sun/star/configuration/XDocumentation.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
+#include <com/sun/star/container/XHierarchicalName.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/container/XHierarchicalName.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/util/InvalidStateException.hpp>
#include <com/sun/star/util/SearchAlgorithms2.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/diagnose_ex.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppu/unotype.hxx>
#include <rtl/ustrbuf.hxx>
+#include <sal/log.hxx>
#include <unotools/textsearch.hxx>
+#include <utility>
#include <vcl/event.hxx>
-#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <dialmgr.hxx>
+#include <strings.hrc>
+
+#include <algorithm>
#include <memory>
#include <vector>
-#include <iostream>
using namespace ::com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::container;
-#define SHORT_LEN_LIMIT 7
-#define LONG_LEN_LIMIT 11
-#define HYPER_LEN_LIMIT 20
-
struct Prop_Impl
{
- OUString Name;
- OUString Property;
- Any Value;
-
- Prop_Impl( const OUString& sName, const OUString& sProperty, const Any& aValue )
- : Name( sName )
- , Property( sProperty )
- , Value( aValue )
- {}
+ OUString Name;
+ OUString Property;
+ Any Value;
+
+ Prop_Impl(OUString sName, OUString sProperty, Any aValue)
+ : Name(std::move(sName))
+ , Property(std::move(sProperty))
+ , Value(std::move(aValue))
+ {
+ }
};
struct UserData
{
bool bIsPropertyPath;
+ bool bIsReadOnly;
+ bool bWasModified;
OUString sPropertyPath;
+ Any aPropertyValue;
+ OUString sTooltip;
int aLineage;
Reference<XNameAccess> aXNameAccess;
- explicit UserData( OUString const & rPropertyPath )
- : bIsPropertyPath( true )
- , sPropertyPath(rPropertyPath)
+ explicit UserData(OUString aPropertyPath, Any aPropValue, OUString aTooltip, bool isReadOnly,
+ bool wasModified)
+ : bIsPropertyPath(true)
+ , bIsReadOnly(isReadOnly)
+ , bWasModified(wasModified)
+ , sPropertyPath(std::move(aPropertyPath))
+ , aPropertyValue(aPropValue)
+ , sTooltip(std::move(aTooltip))
, aLineage(0)
- {}
+ {
+ }
- explicit UserData( Reference<XNameAccess> const & rXNameAccess, int rIndex )
- : bIsPropertyPath( false )
+ explicit UserData(Reference<XNameAccess> const& rXNameAccess, int rIndex)
+ : bIsPropertyPath(false)
+ , bIsReadOnly(false)
+ , bWasModified(false)
, aLineage(rIndex)
- , aXNameAccess( rXNameAccess )
- {}
-};
-
-IMPL_LINK(CuiAboutConfigValueDialog, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
-{
- bool bValid = false;
- bool bNonSpace = rKeyEvent.GetKeyCode().GetCode() != KEY_SPACE;
- if (m_bNumericOnly && bNonSpace )
+ , aXNameAccess(rXNameAccess)
{
- const vcl::KeyCode& rKeyCode = rKeyEvent.GetKeyCode();
- sal_uInt16 nGroup = rKeyCode.GetGroup();
- sal_uInt16 nKey = rKeyCode.GetCode();
-
- switch ( nGroup ) {
- case KEYGROUP_NUM :
- case KEYGROUP_CURSOR :
- {
- bValid = true;
- break;
- }
-
- case KEYGROUP_MISC :
- {
- switch ( nKey ) {
- case KEY_SUBTRACT :
- case KEY_COMMA :
- case KEY_POINT :
- {
- bValid = true;
- break;
- }
-
- default :
- {
- if( nKey < KEY_ADD || nKey > KEY_EQUAL )
- bValid = true;
- break;
- }
- }
- break;
- }
-
- default :
- {
- bValid = false;
- break;
- }
- }
-
- //Select all, Copy, Paste, Cut, Undo Keys
- if ( !bValid && ( rKeyCode.IsMod1() && (
- KEY_A == nKey || KEY_C == nKey || KEY_V == nKey || KEY_X == nKey || KEY_Z == nKey ) ) )
- bValid = true;
}
- else
- bValid = true;
-
- //if value return true to claim that it has been handled
- return !bValid;
-}
+};
CuiAboutConfigTabPage::CuiAboutConfigTabPage(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/aboutconfigdialog.ui", "AboutConfig")
, m_xResetBtn(m_xBuilder->weld_button("reset"))
, m_xEditBtn(m_xBuilder->weld_button("edit"))
, m_xSearchBtn(m_xBuilder->weld_button("searchButton"))
+ , m_xModifiedCheckBtn(m_xBuilder->weld_check_button("modifiedButton"))
, m_xSearchEdit(m_xBuilder->weld_entry("searchEntry"))
, m_xPrefBox(m_xBuilder->weld_tree_view("preferences"))
, m_xScratchIter(m_xPrefBox->make_iterator())
- , m_vectorOfModified()
, m_bSorted(false)
{
m_xPrefBox->set_size_request(m_xPrefBox->get_approximate_digit_width() * 100,
m_xPrefBox->get_height_rows(23));
m_xPrefBox->connect_column_clicked(LINK(this, CuiAboutConfigTabPage, HeaderBarClick));
- m_xEditBtn->connect_clicked(LINK( this, CuiAboutConfigTabPage, StandardHdl_Impl));
- m_xResetBtn->connect_clicked(LINK( this, CuiAboutConfigTabPage, ResetBtnHdl_Impl));
+ m_xEditBtn->connect_clicked(LINK(this, CuiAboutConfigTabPage, StandardHdl_Impl));
+ m_xResetBtn->connect_clicked(LINK(this, CuiAboutConfigTabPage, ResetBtnHdl_Impl));
m_xPrefBox->connect_row_activated(LINK(this, CuiAboutConfigTabPage, DoubleClickHdl_Impl));
m_xPrefBox->connect_expanding(LINK(this, CuiAboutConfigTabPage, ExpandingHdl_Impl));
m_xSearchBtn->connect_clicked(LINK(this, CuiAboutConfigTabPage, SearchHdl_Impl));
+ m_xModifiedCheckBtn->connect_toggled(LINK(this, CuiAboutConfigTabPage, ModifiedHdl_Impl));
m_options.AlgorithmType2 = util::SearchAlgorithms2::ABSOLUTE;
m_options.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
- m_options.searchFlag |= (util::SearchFlags::REG_NOT_BEGINOFLINE |
- util::SearchFlags::REG_NOT_ENDOFLINE);
+ m_options.searchFlag
+ |= (util::SearchFlags::REG_NOT_BEGINOFLINE | util::SearchFlags::REG_NOT_ENDOFLINE);
float fWidth = m_xPrefBox->get_approximate_digit_width();
- std::vector<int> aWidths;
- aWidths.push_back(fWidth * 65);
- aWidths.push_back(fWidth * 20);
- aWidths.push_back(fWidth * 8);
+ std::vector<int> aWidths{ o3tl::narrowing<int>(fWidth * 65), o3tl::narrowing<int>(fWidth * 20),
+ o3tl::narrowing<int>(fWidth * 8) };
m_xPrefBox->set_column_fixed_widths(aWidths);
+
+ m_xPrefBox->connect_query_tooltip(LINK(this, CuiAboutConfigTabPage, QueryTooltip));
+}
+
+IMPL_LINK(CuiAboutConfigTabPage, QueryTooltip, const weld::TreeIter&, rIter, OUString)
+{
+ UserData* pUserData = weld::fromId<UserData*>(m_xPrefBox->get_id(rIter));
+ OUStringBuffer ret;
+ if (pUserData && pUserData->bIsReadOnly)
+ {
+ ret.append(CuiResId(RID_CUISTR_OPT_READONLY));
+ }
+ if (pUserData && !pUserData->sTooltip.isEmpty())
+ {
+ if (pUserData->bIsReadOnly)
+ ret.append("\n\n");
+ ret.append(pUserData->sTooltip);
+ }
+
+ return ret.makeStringAndClear();
}
IMPL_LINK(CuiAboutConfigTabPage, HeaderBarClick, int, nColumn, void)
@@ -194,29 +181,106 @@ IMPL_LINK(CuiAboutConfigTabPage, HeaderBarClick, int, nColumn, void)
}
}
-CuiAboutConfigTabPage::~CuiAboutConfigTabPage()
+IMPL_STATIC_LINK_NOARG(CuiAboutConfigTabPage, ValidNameHdl, SvxNameDialog&, bool)
{
+ // Allow empty value
+ return true;
}
-void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUString& rProp, const OUString& rStatus,
- const OUString& rType, const OUString& rValue, const weld::TreeIter* pParentEntry,
- bool bInsertToPrefBox)
+CuiAboutConfigTabPage::~CuiAboutConfigTabPage() {}
+
+void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, Any aPropertyValue,
+ const OUString& rProp, const OUString& rStatus,
+ const OUString& rType, const OUString& rValue,
+ const OUString& rTooltip,
+ const weld::TreeIter* pParentEntry, bool bInsertToPrefBox,
+ bool bIsReadOnly, bool bWasModified)
{
- m_vectorUserData.push_back(std::make_unique<UserData>(rPropertyPath));
+ bool bOnlyModified = m_xModifiedCheckBtn->get_active();
+ if (bOnlyModified && !bWasModified)
+ return;
+
+ m_vectorUserData.push_back(std::make_unique<UserData>(rPropertyPath, aPropertyValue, rTooltip,
+ bIsReadOnly, bWasModified));
if (bInsertToPrefBox)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get())));
- m_xPrefBox->insert(pParentEntry, -1, &rProp, &sId, nullptr, nullptr, false, m_xScratchIter.get());
+ OUString sId(weld::toId(m_vectorUserData.back().get()));
+ m_xPrefBox->insert(pParentEntry, -1, &rProp, &sId, nullptr, nullptr, false,
+ m_xScratchIter.get());
m_xPrefBox->set_text(*m_xScratchIter, rStatus, 1);
m_xPrefBox->set_text(*m_xScratchIter, rType, 2);
m_xPrefBox->set_text(*m_xScratchIter, rValue, 3);
+ m_xPrefBox->set_text_emphasis(*m_xScratchIter, bWasModified, -1);
+ m_xPrefBox->set_sensitive(*m_xScratchIter, !bIsReadOnly, -1);
}
else
{
- m_prefBoxEntries.push_back({rProp, rStatus, rType, rValue, m_vectorUserData.back().get()});
+ m_prefBoxEntries.push_back(
+ { rProp, rStatus, rType, rValue, m_vectorUserData.back().get() });
}
}
+void CuiAboutConfigTabPage::InputChanged()
+{
+ weld::WaitObject aWait(m_xDialog.get());
+
+ m_xPrefBox->hide();
+ m_xPrefBox->clear();
+ m_xPrefBox->freeze();
+
+ if (m_bSorted)
+ m_xPrefBox->make_unsorted();
+
+ if (m_xSearchEdit->get_text().isEmpty())
+ {
+ m_xPrefBox->clear();
+ Reference<XNameAccess> xConfigAccess = getConfigAccess("/", false);
+ FillItems(xConfigAccess);
+ }
+ else
+ {
+ m_options.searchString = m_xSearchEdit->get_text();
+ utl::TextSearch textSearch(m_options);
+ for (auto const& it : m_prefBoxEntries)
+ {
+ sal_Int32 endPos, startPos = 0;
+
+ for (size_t i = 0; i < 5; ++i)
+ {
+ OUString scrTxt;
+
+ if (i == 0)
+ scrTxt = it.pUserData->sPropertyPath;
+ else if (i == 1)
+ scrTxt = it.sProp;
+ else if (i == 2)
+ scrTxt = it.sStatus;
+ else if (i == 3)
+ scrTxt = it.sType;
+ else if (i == 4)
+ scrTxt = it.sValue;
+
+ endPos = scrTxt.getLength();
+ if (textSearch.SearchForward(scrTxt, &startPos, &endPos))
+ {
+ InsertEntry(it);
+ break;
+ }
+ }
+ }
+ }
+
+ m_xPrefBox->thaw();
+ if (m_bSorted)
+ m_xPrefBox->make_sorted();
+
+ m_xPrefBox->all_foreach([this](weld::TreeIter& rEntry) {
+ m_xPrefBox->expand_row(rEntry);
+ return false;
+ });
+ m_xPrefBox->show();
+}
+
void CuiAboutConfigTabPage::Reset()
{
weld::WaitObject aWait(m_xDialog.get());
@@ -233,42 +297,106 @@ void CuiAboutConfigTabPage::Reset()
m_modifiedPrefBoxEntries.clear();
m_xPrefBox->freeze();
- Reference< XNameAccess > xConfigAccess = getConfigAccess( "/", false );
+ Reference<XNameAccess> xConfigAccess = getConfigAccess("/", false);
//Load all XNameAccess to m_prefBoxEntries
- FillItems( xConfigAccess, nullptr, 0, true );
+ FillItems(xConfigAccess, nullptr, 0, true);
//Load xConfigAccess' children to m_prefBox
- FillItems( xConfigAccess );
+ FillItems(xConfigAccess);
m_xPrefBox->thaw();
}
void CuiAboutConfigTabPage::FillItemSet()
{
- std::vector< std::shared_ptr< Prop_Impl > >::iterator pIter;
- for( pIter = m_vectorOfModified.begin() ; pIter != m_vectorOfModified.end(); ++pIter )
+ std::vector<std::shared_ptr<Prop_Impl>>::iterator pIter;
+ for (pIter = m_vectorOfModified.begin(); pIter != m_vectorOfModified.end(); ++pIter)
{
- Reference< XNameAccess > xUpdateAccess = getConfigAccess( (*pIter)->Name , true );
- Reference< XNameReplace > xNameReplace( xUpdateAccess, UNO_QUERY_THROW );
+ Reference<XNameAccess> xUpdateAccess = getConfigAccess((*pIter)->Name, true);
+ Reference<XNameReplace> xNameReplace(xUpdateAccess, UNO_QUERY_THROW);
- xNameReplace->replaceByName( (*pIter)->Property, (*pIter)->Value );
+ xNameReplace->replaceByName((*pIter)->Property, (*pIter)->Value);
- Reference< util::XChangesBatch > xChangesBatch( xUpdateAccess, UNO_QUERY_THROW );
+ Reference<util::XChangesBatch> xChangesBatch(xUpdateAccess, UNO_QUERY_THROW);
xChangesBatch->commitChanges();
}
}
-void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAccess, const weld::TreeIter* pParentEntry,
- int lineage, bool bLoadAll)
+namespace
+{
+OUString lcl_StringListToString(const uno::Sequence<OUString>& seq)
{
- OUString sPath = Reference< XHierarchicalName >(
- xNameAccess, uno::UNO_QUERY_THROW )->getHierarchicalName();
- const uno::Sequence< OUString > seqItems = xNameAccess->getElementNames();
- for( const OUString& item : seqItems )
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
{
- Any aNode = xNameAccess->getByName( item );
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(seq[i]);
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_IntListToString(const uno::Sequence<sal_Int16>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_IntListToString(const uno::Sequence<sal_Int32>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_IntListToString(const uno::Sequence<sal_Int64>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_DoubleListToString(const uno::Sequence<double>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+}
+
+void CuiAboutConfigTabPage::FillItems(const Reference<XNameAccess>& xNameAccess,
+ const weld::TreeIter* pParentEntry, int lineage,
+ bool bLoadAll)
+{
+ OUString sPath
+ = Reference<XHierarchicalName>(xNameAccess, uno::UNO_QUERY_THROW)->getHierarchicalName();
+ const uno::Sequence<OUString> seqItems = xNameAccess->getElementNames();
+ for (const OUString& item : seqItems)
+ {
+ Any aNode = xNameAccess->getByName(item);
bool bNotLeaf = false;
- Reference< XNameAccess > xNextNameAccess;
+ Reference<XNameAccess> xNextNameAccess;
try
{
xNextNameAccess.set(aNode, uno::UNO_QUERY);
@@ -276,24 +404,27 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
}
catch (const RuntimeException&)
{
- TOOLS_WARN_EXCEPTION( "cui.options", "CuiAboutConfigTabPage");
+ TOOLS_WARN_EXCEPTION("cui.options", "CuiAboutConfigTabPage");
}
if (bNotLeaf)
{
- if(bLoadAll)
+ if (bLoadAll)
FillItems(xNextNameAccess, nullptr, lineage + 1, true);
else
{
// not leaf node
- m_vectorUserData.push_back(std::make_unique<UserData>(xNextNameAccess, lineage + 1));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get())));
+ m_vectorUserData.push_back(
+ std::make_unique<UserData>(xNextNameAccess, lineage + 1));
+ OUString sId(weld::toId(m_vectorUserData.back().get()));
- m_xPrefBox->insert(pParentEntry, -1, &item, &sId, nullptr, nullptr, true, m_xScratchIter.get());
- //It is needed, without this the selection line will be truncated.
+ m_xPrefBox->insert(pParentEntry, -1, &item, &sId, nullptr, nullptr, true,
+ m_xScratchIter.get());
+ // Necessary, without this the selection line will be truncated.
m_xPrefBox->set_text(*m_xScratchIter, "", 1);
m_xPrefBox->set_text(*m_xScratchIter, "", 2);
m_xPrefBox->set_text(*m_xScratchIter, "", 3);
+ m_xPrefBox->set_sensitive(*m_xScratchIter, true);
}
}
else
@@ -301,215 +432,308 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
// leaf node
OUString sPropertyName = item;
auto it = std::find_if(m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
- [&sPath, &sPropertyName](const prefBoxEntry& rEntry) -> bool
- {
- return rEntry.pUserData->sPropertyPath == sPath
- && rEntry.sStatus == sPropertyName;
- }
- );
-
- OUString sType = aNode.getValueTypeName();
+ [&sPath, &sPropertyName](const prefBoxEntry& rEntry) -> bool {
+ return rEntry.pUserData->sPropertyPath == sPath
+ && rEntry.sStatus == sPropertyName;
+ });
+
+ css::uno::Reference<css::configuration::XReadWriteAccess> m_xReadWriteAccess;
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(
+ ::comphelper::getProcessComponentContext(), "*");
+ beans::Property aProperty;
+ bool bReadOnly = false;
+ OUString sFullPath(sPath + "/" + sPropertyName);
+ try
+ {
+ aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(sFullPath);
+ bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
+ }
+ catch (css::beans::UnknownPropertyException)
+ {
+ SAL_WARN("cui.options", "unknown property: " << sFullPath);
+ }
+
+ OUString sTooltip;
+ OUString sType;
+ bool bWasModified = false;
+ css::uno::Type aType = cppu::UnoType<void>::get();
+ OUString sDynamicType = aNode.getValueTypeName();
+ try
+ {
+ Reference<configuration::XDocumentation> xDocumentation(xNameAccess,
+ UNO_QUERY_THROW);
+ sTooltip
+ = xDocumentation->getDescriptionByHierarchicalName(sPath + "/" + sPropertyName);
+ aType = xDocumentation->getTypeByHierarchicalName(sFullPath);
+ bWasModified = xDocumentation->getModifiedByHierarchicalName(sFullPath);
+ }
+ catch (css::container::NoSuchElementException)
+ {
+ }
+ catch (css::util::InvalidStateException)
+ {
+ }
+
OUStringBuffer sValue;
+ // Fall back to dynamic type when this is empty
+ if (aType == cppu::UnoType<void>::get() && sDynamicType != "void")
+ {
+ if (sDynamicType == "boolean")
+ aType = cppu::UnoType<sal_Bool>::get();
+ else if (sDynamicType == "short")
+ aType = cppu::UnoType<sal_Int16>::get();
+ else if (sDynamicType == "long")
+ aType = cppu::UnoType<sal_Int32>::get();
+ else if (sDynamicType == "hyper")
+ aType = cppu::UnoType<sal_Int64>::get();
+ else if (sDynamicType == "double")
+ aType = cppu::UnoType<double>::get();
+ else if (sDynamicType == "string")
+ aType = cppu::UnoType<OUString>::get();
+ else if (sDynamicType == "[]byte")
+ aType = cppu::UnoType<css::uno::Sequence<sal_Int8>>::get();
+ else if (sDynamicType == "[]boolean")
+ aType = cppu::UnoType<css::uno::Sequence<sal_Bool>>::get();
+ else if (sDynamicType == "[]short")
+ aType = cppu::UnoType<css::uno::Sequence<sal_Int16>>::get();
+ else if (sDynamicType == "[]long")
+ aType = cppu::UnoType<css::uno::Sequence<sal_Int32>>::get();
+ else if (sDynamicType == "[]hyper")
+ aType = cppu::UnoType<css::uno::Sequence<sal_Int64>>::get();
+ else if (sDynamicType == "[]double")
+ aType = cppu::UnoType<css::uno::Sequence<double>>::get();
+ else if (sDynamicType == "[]string")
+ aType = cppu::UnoType<css::uno::Sequence<OUString>>::get();
+ else if (sDynamicType == "[][]byte")
+ aType = cppu::UnoType<css::uno::Sequence<css::uno::Sequence<sal_Int8>>>::get();
+ }
+
if (it != m_modifiedPrefBoxEntries.end())
sValue = it->sValue;
else
{
- switch( aNode.getValueType().getTypeClass() )
+ bool bHasValue = sDynamicType != "void";
+ if (aType == cppu::UnoType<sal_Bool>::get())
{
- case css::uno::TypeClass_VOID:
- break;
-
- case css::uno::TypeClass_BOOLEAN:
- sValue = OUString::boolean( aNode.get<bool>() );
- break;
-
- case css::uno::TypeClass_SHORT:
- case css::uno::TypeClass_LONG:
- case css::uno::TypeClass_HYPER:
- sValue = OUString::number( aNode.get<sal_Int64>() );
- break;
-
- case css::uno::TypeClass_DOUBLE:
- sValue = OUString::number( aNode.get<double>() );
- break;
-
- case css::uno::TypeClass_STRING:
- sValue = aNode.get<OUString>();
- break;
-
- case css::uno::TypeClass_SEQUENCE:
- if( sType == "[]boolean" )
- {
- uno::Sequence<sal_Bool> seq = aNode.get< uno::Sequence<sal_Bool> >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
- {
- if( j != 0 )
- {
- sValue.append(",");
- }
- sValue.append(OUString::boolean( seq[j] ));
- }
- }
- else if( sType == "[]byte" )
+ if (bHasValue)
+ sValue = OUString::boolean(aNode.get<bool>());
+ sType = "boolean";
+ }
+ else if (aType == cppu::UnoType<sal_Int16>::get())
+ {
+ if (bHasValue)
+ sValue = OUString::number(aNode.get<sal_Int16>());
+ sType = "short";
+ }
+ else if (aType == cppu::UnoType<sal_Int32>::get())
+ {
+ if (bHasValue)
+ sValue = OUString::number(aNode.get<sal_Int32>());
+ sType = "int";
+ }
+ else if (aType == cppu::UnoType<sal_Int64>::get())
+ {
+ if (bHasValue)
+ sValue = OUString::number(aNode.get<sal_Int64>());
+ sType = "long";
+ }
+ else if (aType == cppu::UnoType<double>::get())
+ {
+ if (bHasValue)
+ sValue = OUString::number(aNode.get<double>());
+ sType = "double";
+ }
+ else if (aType == cppu::UnoType<OUString>::get())
+ {
+ if (bHasValue)
+ sValue = aNode.get<OUString>();
+ sType = "string";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<sal_Int8>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence<sal_Int8> seq = aNode.get< uno::Sequence<sal_Int8> >();
- for( sal_Int8 j : seq )
+ const uno::Sequence<sal_Int8> seq = aNode.get<uno::Sequence<sal_Int8>>();
+ for (sal_Int8 j : seq)
{
- OUString s = OUString::number(
- static_cast<sal_uInt8>(j), 16 );
- if( s.getLength() == 1 )
+ OUString s = OUString::number(static_cast<sal_uInt8>(j), 16);
+ if (s.getLength() == 1)
{
sValue.append("0");
}
sValue.append(s.toAsciiUpperCase());
}
}
- else if( sType == "[][]byte" )
+ sType = "hexBinary";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<sal_Bool>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence< uno::Sequence<sal_Int8> > seq = aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
+ uno::Sequence<sal_Bool> seq = aNode.get<uno::Sequence<sal_Bool>>();
+ for (sal_Int32 j = 0; j != seq.getLength(); ++j)
{
- if( j != 0 )
+ if (j != 0)
{
sValue.append(",");
}
- for( sal_Int8 k : seq[j] )
- {
- OUString s = OUString::number(
- static_cast<sal_uInt8>(k), 16 );
- if( s.getLength() == 1 )
- {
- sValue.append("0");
- }
- sValue.append(s.toAsciiUpperCase());
- }
+ sValue.append(OUString::boolean(seq[j]));
}
}
- else if( sType == "[]short" )
+ sType = "boolean-list";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<sal_Int16>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence<sal_Int16> seq = aNode.get< uno::Sequence<sal_Int16> >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
+ uno::Sequence<sal_Int16> seq = aNode.get<uno::Sequence<sal_Int16>>();
+ for (sal_Int32 j = 0; j != seq.getLength(); ++j)
{
- if( j != 0 )
+ if (j != 0)
{
sValue.append(",");
}
- sValue.append(OUString::number( seq[j] ));
+ sValue.append(static_cast<sal_Int32>(seq[j]));
}
}
- else if( sType == "[]long" )
+ sType = "short-list";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<sal_Int32>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence<sal_Int32> seq = aNode.get< uno::Sequence<sal_Int32> >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
+ uno::Sequence<sal_Int32> seq = aNode.get<uno::Sequence<sal_Int32>>();
+ for (sal_Int32 j = 0; j != seq.getLength(); ++j)
{
- if( j != 0 )
+ if (j != 0)
{
sValue.append(",");
}
- sValue.append(OUString::number( seq[j] ));
+ sValue.append(seq[j]);
}
}
- else if( sType == "[]hyper" )
+ sType = "int-list";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<sal_Int64>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence<sal_Int64> seq = aNode.get< uno::Sequence<sal_Int64> >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
+ uno::Sequence<sal_Int64> seq = aNode.get<uno::Sequence<sal_Int64>>();
+ for (sal_Int32 j = 0; j != seq.getLength(); ++j)
{
- if( j != 0 )
+ if (j != 0)
{
sValue.append(",");
}
- sValue.append(OUString::number( seq[j] ));
+ sValue.append(seq[j]);
}
}
- else if( sType == "[]double" )
+ sType = "long-list";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<double>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence<double> seq = aNode.get< uno::Sequence<double> >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
+ uno::Sequence<double> seq = aNode.get<uno::Sequence<double>>();
+ for (sal_Int32 j = 0; j != seq.getLength(); ++j)
{
- if( j != 0 )
+ if (j != 0)
{
sValue.append(",");
}
- sValue.append(OUString::number( seq[j] ));
+ sValue.append(seq[j]);
}
}
- else if( sType == "[]string" )
+ sType = "double-list";
+ }
+ else if (aType == cppu::UnoType<css::uno::Sequence<OUString>>::get())
+ {
+ if (bHasValue)
+ sValue = lcl_StringListToString(aNode.get<uno::Sequence<OUString>>());
+ sType = "string-list";
+ }
+ else if (aType
+ == cppu::UnoType<css::uno::Sequence<css::uno::Sequence<sal_Int8>>>::get())
+ {
+ if (bHasValue)
{
- uno::Sequence<OUString> seq = aNode.get< uno::Sequence<OUString> >();
- for( sal_Int32 j = 0; j != seq.getLength(); ++j )
+ const uno::Sequence<uno::Sequence<sal_Int8>> seq
+ = aNode.get<uno::Sequence<uno::Sequence<sal_Int8>>>();
+ for (sal_Int32 j = 0; j != seq.getLength(); ++j)
{
- if( j != 0 )
+ if (j != 0)
{
sValue.append(",");
}
- sValue.append(seq[j]);
+ for (sal_Int8 k : seq[j])
+ {
+ OUString s = OUString::number(static_cast<sal_uInt8>(k), 16);
+ if (s.getLength() == 1)
+ {
+ sValue.append("0");
+ }
+ sValue.append(s.toAsciiUpperCase());
+ }
}
}
- else
- {
- SAL_WARN(
- "cui.options",
- "path \"" << sPath << "\" member " << item
- << " of unsupported type " << sType);
- }
- break;
-
- default:
- SAL_WARN(
- "cui.options",
- "path \"" << sPath << "\" member " << item
- << " of unsupported type " << sType);
- break;
+ sType = "hexBinary-list";
+ }
+ else
+ {
+ SAL_INFO("cui.options", "path \"" << sPath << "\" member " << item
+ << " of unsupported type " << sType);
+ continue;
}
}
//Short name
int index = 0;
- for(int j = 1; j < lineage; ++j)
+ for (int j = 1; j < lineage; ++j)
index = sPath.indexOf("/", index + 1);
- InsertEntry(sPath, sPath.copy(index+1), item, sType, sValue.makeStringAndClear(), pParentEntry, !bLoadAll);
+ InsertEntry(sPath, aNode, sPath.copy(index + 1), item, sType,
+ sValue.makeStringAndClear(), sTooltip, pParentEntry, !bLoadAll, bReadOnly,
+ bWasModified);
}
}
}
-Reference< XNameAccess > CuiAboutConfigTabPage::getConfigAccess( const OUString& sNodePath, bool bUpdate )
+Reference<XNameAccess> CuiAboutConfigTabPage::getConfigAccess(const OUString& sNodePath,
+ bool bUpdate)
{
- uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
- uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
- css::configuration::theDefaultProvider::get( xContext ) );
+ uno::Reference<lang::XMultiServiceFactory> xConfigProvider(
+ css::configuration::theDefaultProvider::get(xContext));
beans::NamedValue aProperty;
aProperty.Name = "nodepath";
aProperty.Value <<= sNodePath;
- uno::Sequence< uno::Any > aArgumentList( 1 );
- aArgumentList[0] <<= aProperty;
+ uno::Sequence<uno::Any> aArgumentList{ uno::Any(aProperty) };
OUString sAccessString;
- if( bUpdate )
+ if (bUpdate)
sAccessString = "com.sun.star.configuration.ConfigurationUpdateAccess";
else
sAccessString = "com.sun.star.configuration.ConfigurationAccess";
- uno::Reference< container::XNameAccess > xNameAccess(
- xConfigProvider->createInstanceWithArguments(
- sAccessString, aArgumentList ),
- uno::UNO_QUERY_THROW );
+ uno::Reference<container::XNameAccess> xNameAccess(
+ xConfigProvider->createInstanceWithArguments(sAccessString, aArgumentList),
+ uno::UNO_QUERY_THROW);
return xNameAccess;
}
-void CuiAboutConfigTabPage::AddToModifiedVector( const std::shared_ptr< Prop_Impl >& rProp )
+void CuiAboutConfigTabPage::AddToModifiedVector(const std::shared_ptr<Prop_Impl>& rProp)
{
bool isModifiedBefore = false;
//Check if value modified before
- for(std::shared_ptr<Prop_Impl> & nInd : m_vectorOfModified)
+ for (std::shared_ptr<Prop_Impl>& nInd : m_vectorOfModified)
{
- if( rProp->Name == nInd->Name && rProp->Property == nInd->Property )
+ if (rProp->Name == nInd->Name && rProp->Property == nInd->Property)
{
//property modified before. Assign reference to the modified value
//do your changes on this object. They will be saved later.
@@ -519,47 +743,28 @@ void CuiAboutConfigTabPage::AddToModifiedVector( const std::shared_ptr< Prop_Imp
}
}
- if( !isModifiedBefore )
- m_vectorOfModified.push_back( rProp );
+ if (!isModifiedBefore)
+ m_vectorOfModified.push_back(rProp);
//property is not modified before
}
-std::vector< OUString > CuiAboutConfigTabPage::commaStringToSequence( const OUString& rCommaSepString )
+std::vector<OUString>
+CuiAboutConfigTabPage::commaStringToSequence(std::u16string_view rCommaSepString)
{
std::vector<OUString> tempVector;
sal_Int32 index = 0;
do
{
- OUString word = rCommaSepString.getToken(0, u',', index);
+ OUString word(o3tl::getToken(rCommaSepString, 0, u',', index));
word = word.trim();
- if( !word.isEmpty())
+ if (!word.isEmpty())
tempVector.push_back(word);
- }while( index >= 0 );
+ } while (index >= 0);
return tempVector;
}
-CuiAboutConfigValueDialog::CuiAboutConfigValueDialog(weld::Window* pWindow,
- const OUString& rValue,
- int limit)
- : GenericDialogController(pWindow, "cui/ui/aboutconfigvaluedialog.ui", "AboutConfigValueDialog")
- , m_bNumericOnly(limit != 0)
- , m_xEDValue(m_xBuilder->weld_entry("valuebox"))
-{
- if (limit)
- m_xEDValue->set_max_length(limit);
- m_xEDValue->set_text(rValue);
- m_xEDValue->connect_key_press(LINK(this, CuiAboutConfigValueDialog, KeyInputHdl));
-}
-
-CuiAboutConfigValueDialog::~CuiAboutConfigValueDialog()
-{
-}
-
-IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl, weld::Button&, void )
-{
- Reset();
-}
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, ResetBtnHdl_Impl, weld::Button&, void) { Reset(); }
IMPL_LINK_NOARG(CuiAboutConfigTabPage, DoubleClickHdl_Impl, weld::TreeView&, bool)
{
@@ -567,13 +772,13 @@ IMPL_LINK_NOARG(CuiAboutConfigTabPage, DoubleClickHdl_Impl, weld::TreeView&, boo
return true;
}
-IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void)
{
if (!m_xPrefBox->get_selected(m_xScratchIter.get()))
return;
- UserData *pUserData = reinterpret_cast<UserData*>(m_xPrefBox->get_id(*m_xScratchIter).toInt64());
- if (!(pUserData && pUserData->bIsPropertyPath))
+ UserData* pUserData = weld::fromId<UserData*>(m_xPrefBox->get_id(*m_xScratchIter));
+ if (!pUserData || !pUserData->bIsPropertyPath || pUserData->bIsReadOnly)
return;
//if selection is a node
@@ -581,16 +786,17 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
OUString sPropertyType = m_xPrefBox->get_text(*m_xScratchIter, 2);
OUString sPropertyValue = m_xPrefBox->get_text(*m_xScratchIter, 3);
- auto pProperty = std::make_shared<Prop_Impl>( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) );
+ auto pProperty
+ = std::make_shared<Prop_Impl>(pUserData->sPropertyPath, sPropertyName, Any(sPropertyValue));
bool bSaveChanges = false;
bool bOpenDialog = true;
OUString sDialogValue;
- if( sPropertyType == "boolean" )
+ if (sPropertyType == "boolean")
{
bool bValue;
- if( sPropertyValue == "true" )
+ if (sPropertyValue == "true")
{
sDialogValue = "false";
bValue = false;
@@ -605,10 +811,6 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
bOpenDialog = false;
bSaveChanges = true;
}
- else if ( sPropertyType == "void" )
- {
- bOpenDialog = false;
- }
else
{
sDialogValue = sPropertyValue;
@@ -617,163 +819,180 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
try
{
- if( bOpenDialog )
+ if (bOpenDialog)
{
- //Cosmetic length limit for integer values.
- int limit=0;
- if( sPropertyType == "short" )
- limit = SHORT_LEN_LIMIT;
- else if( sPropertyType == "long" )
- limit = LONG_LEN_LIMIT;
- else if( sPropertyType == "hyper" )
- limit = HYPER_LEN_LIMIT;
-
- CuiAboutConfigValueDialog aValueDialog(m_xDialog.get(), sDialogValue, limit);
-
- if (aValueDialog.run() == RET_OK )
+ if (sPropertyType == "short" || sPropertyType == "int" || sPropertyType == "long")
{
- OUString sNewValue = aValueDialog.getValue();
- bSaveChanges = true;
- if ( sPropertyType == "short")
- {
- sal_Int16 nShort;
- sal_Int32 nNumb = sNewValue.toInt32();
-
- //if the value is 0 and length is not 1, there is something wrong
- if( ( nNumb==0 && sNewValue.getLength()!=1 ) || nNumb > SAL_MAX_INT16 || nNumb < SAL_MIN_INT16)
- throw uno::Exception("out of range short", nullptr);
- nShort = static_cast<sal_Int16>(nNumb);
- pProperty->Value <<= nShort;
- }
- else if( sPropertyType == "long" )
- {
- sal_Int32 nLong = sNewValue.toInt32();
- if( nLong==0 && sNewValue.getLength()!=1)
- throw uno::Exception("out of range long", nullptr);
- pProperty->Value <<= nLong;
- }
- else if( sPropertyType == "hyper")
- {
- sal_Int64 nHyper = sNewValue.toInt64();
- if( nHyper==0 && sNewValue.getLength()!=1)
- throw uno::Exception("out of range hyper", nullptr);
- pProperty->Value <<= nHyper;
- }
- else if( sPropertyType == "double")
+ sal_Int64 nMin = sPropertyType == "short"
+ ? SAL_MIN_INT16
+ : sPropertyType == "int" ? SAL_MIN_INT32 : SAL_MIN_INT64;
+ sal_Int64 nMax = sPropertyType == "short"
+ ? SAL_MAX_INT16
+ : sPropertyType == "int" ? SAL_MAX_INT32 : SAL_MAX_INT64;
+ SvxNumberDialog aNumberDialog(m_xDialog.get(), sPropertyName,
+ sDialogValue.toInt64(), nMin, nMax);
+ if (aNumberDialog.run() == RET_OK)
{
- double nDoub = sNewValue.toDouble();
- if( nDoub ==0 && sNewValue.getLength()!=1)
- throw uno::Exception("out of range double", nullptr);
- pProperty->Value <<= nDoub;
+ sal_Int64 nNewValue = aNumberDialog.GetNumber();
+ if (sPropertyType == "short")
+ {
+ pProperty->Value <<= static_cast<sal_Int16>(nNewValue);
+ }
+ else if (sPropertyType == "int")
+ {
+ pProperty->Value <<= static_cast<sal_Int32>(nNewValue);
+ }
+ else if (sPropertyType == "long")
+ {
+ pProperty->Value <<= nNewValue;
+ }
+ bSaveChanges = true;
+ sDialogValue = OUString::number(nNewValue);
}
- else if( sPropertyType == "float")
+ }
+ else if (sPropertyType == "double")
+ {
+ SvxDecimalNumberDialog aNumberDialog(m_xDialog.get(), sPropertyName,
+ sDialogValue.toDouble());
+ if (aNumberDialog.run() == RET_OK)
{
- float nFloat = sNewValue.toFloat();
- if( nFloat ==0 && sNewValue.getLength()!=1)
- throw uno::Exception("out of range float", nullptr);
- pProperty->Value <<= nFloat;
+ double fNewValue = aNumberDialog.GetNumber();
+ pProperty->Value <<= fNewValue;
+ bSaveChanges = true;
+ sDialogValue = OUString::number(fNewValue);
}
- else if( sPropertyType == "string" )
+ }
+ else if (sPropertyType == "string")
+ {
+ SvxNameDialog aNameDialog(m_xDialog.get(), sDialogValue, sPropertyName);
+ aNameDialog.SetCheckNameHdl(LINK(this, CuiAboutConfigTabPage, ValidNameHdl));
+ if (aNameDialog.run() == RET_OK)
{
- pProperty->Value <<= sNewValue;
+ sDialogValue = aNameDialog.GetName();
+ pProperty->Value <<= sDialogValue;
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]short" )
+ }
+ else if (sPropertyType == "short-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Int16);
+ if (aListDialog.run() == RET_OK)
{
- //create string sequence from comma separated string
- //uno::Sequence< OUString > seqStr;
- std::vector< OUString > seqStr = commaStringToSequence( sNewValue );
-
- //create appropriate sequence with same size as string sequence
- uno::Sequence< sal_Int16 > seqShort( seqStr.size() );
- //convert all strings to appropriate type
- for( size_t i = 0; i < seqStr.size(); ++i )
- {
- seqShort[i] = static_cast<sal_Int16>(seqStr[i].toInt32());
- }
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<sal_Int16> seqShort(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seqShort.getArray(),
+ [](const auto& str) { return static_cast<sal_Int16>(str.toInt32()); });
pProperty->Value <<= seqShort;
+ sDialogValue = lcl_IntListToString(seqShort);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]long" )
- {
- std::vector< OUString > seqStrLong = commaStringToSequence( sNewValue );
-
- uno::Sequence< sal_Int32 > seqLong( seqStrLong.size() );
- for( size_t i = 0; i < seqStrLong.size(); ++i )
- {
- seqLong[i] = seqStrLong[i].toInt32();
- }
- pProperty->Value <<= seqLong;
- }
- else if( sPropertyType == "[]hyper" )
+ }
+ else if (sPropertyType == "int-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Int32);
+ if (aListDialog.run() == RET_OK)
{
- std::vector< OUString > seqStrHyper = commaStringToSequence( sNewValue );
- uno::Sequence< sal_Int64 > seqHyper( seqStrHyper.size() );
- for( size_t i = 0; i < seqStrHyper.size(); ++i )
- {
- seqHyper[i] = seqStrHyper[i].toInt64();
- }
- pProperty->Value <<= seqHyper;
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<sal_Int32> seq(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seq.getArray(),
+ [](const auto& str) { return static_cast<sal_Int32>(str.toInt32()); });
+ pProperty->Value <<= seq;
+ sDialogValue = lcl_IntListToString(seq);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]double" )
+ }
+ else if (sPropertyType == "long-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Int64);
+ if (aListDialog.run() == RET_OK)
{
- std::vector< OUString > seqStrDoub = commaStringToSequence( sNewValue );
- uno::Sequence< double > seqDoub( seqStrDoub.size() );
- for( size_t i = 0; i < seqStrDoub.size(); ++i )
- {
- seqDoub[i] = seqStrDoub[i].toDouble();
- }
- pProperty->Value <<= seqDoub;
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<sal_Int64> seq(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seq.getArray(),
+ [](const auto& str) { return static_cast<sal_Int64>(str.toInt32()); });
+ pProperty->Value <<= seq;
+ sDialogValue = lcl_IntListToString(seq);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]float" )
+ }
+ else if (sPropertyType == "double-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Double);
+ if (aListDialog.run() == RET_OK)
{
- std::vector< OUString > seqStrFloat = commaStringToSequence( sNewValue );
- uno::Sequence< sal_Int16 > seqFloat( seqStrFloat.size() );
- for( size_t i = 0; i < seqStrFloat.size(); ++i )
- {
- seqFloat[i] = seqStrFloat[i].toFloat();
- }
- pProperty->Value <<= seqFloat;
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<double> seq(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seq.getArray(),
+ [](const auto& str) { return static_cast<double>(str.toDouble()); });
+ pProperty->Value <<= seq;
+ sDialogValue = lcl_DoubleListToString(seq);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]string" )
+ }
+ else if (sPropertyType == "string-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ uno::Sequence<OUString> aList
+ = pUserData->aPropertyValue.get<uno::Sequence<OUString>>();
+ aListDialog.SetEntries(
+ comphelper::sequenceToContainer<std::vector<OUString>>(aList));
+ aListDialog.SetMode(ListMode::String);
+ if (aListDialog.run() == RET_OK)
{
- pProperty->Value <<= comphelper::containerToSequence( commaStringToSequence( sNewValue ));
+ auto seq = comphelper::containerToSequence(aListDialog.GetEntries());
+ sDialogValue = lcl_StringListToString(seq);
+ pProperty->Value <<= seq;
+ bSaveChanges = true;
}
- else //unknown
- throw uno::Exception("unknown property type " + sPropertyType, nullptr);
-
- sDialogValue = sNewValue;
}
+ else //unknown
+ throw uno::Exception("unknown property type " + sPropertyType, nullptr);
}
- if(bSaveChanges)
+ if (bSaveChanges)
{
- AddToModifiedVector( pProperty );
+ AddToModifiedVector(pProperty);
+ pUserData->aPropertyValue = pProperty->Value;
//update listbox value.
+ m_xPrefBox->set_text(*m_xScratchIter, sPropertyType, 2);
m_xPrefBox->set_text(*m_xScratchIter, sDialogValue, 3);
+ m_xPrefBox->set_text_emphasis(*m_xScratchIter, true, -1);
//update m_prefBoxEntries
- auto it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(),
- [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool
- {
- return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
- && rEntry.sStatus == sPropertyName;
- }
- );
+ auto it = std::find_if(
+ m_prefBoxEntries.begin(), m_prefBoxEntries.end(),
+ [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool {
+ return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
+ && rEntry.sStatus == sPropertyName;
+ });
if (it != m_prefBoxEntries.end())
{
it->sValue = sDialogValue;
+ it->pUserData->bWasModified = true;
auto modifiedIt = std::find_if(
- m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
- [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool
- {
- return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
- && rEntry.sStatus == sPropertyName;
- }
- );
+ m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
+ [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool {
+ return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
+ && rEntry.sStatus == sPropertyName;
+ });
if (modifiedIt != m_modifiedPrefBoxEntries.end())
{
modifiedIt->sValue = sDialogValue;
+ modifiedIt->pUserData->bWasModified = true;
}
else
{
@@ -782,74 +1001,24 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
}
}
}
- catch( uno::Exception& )
+ catch (uno::Exception&)
{
}
}
-IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl, weld::Button&, void)
-{
- weld::WaitObject aWait(m_xDialog.get());
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, SearchHdl_Impl, weld::Button&, void) { InputChanged(); }
- m_xPrefBox->hide();
- m_xPrefBox->clear();
- m_xPrefBox->freeze();
-
- if (m_bSorted)
- m_xPrefBox->make_unsorted();
-
- if (m_xSearchEdit->get_text().isEmpty())
- {
- m_xPrefBox->clear();
- Reference< XNameAccess > xConfigAccess = getConfigAccess( "/", false );
- FillItems( xConfigAccess );
- }
- else
- {
- m_options.searchString = m_xSearchEdit->get_text();
- utl::TextSearch textSearch( m_options );
- for (auto const& it : m_prefBoxEntries)
- {
- sal_Int32 endPos, startPos = 0;
-
- for(size_t i = 0; i < 5; ++i)
- {
- OUString scrTxt;
-
- if (i == 0)
- scrTxt = it.pUserData->sPropertyPath;
- else if (i == 1)
- scrTxt = it.sProp;
- else if (i == 2)
- scrTxt = it.sStatus;
- else if (i == 3)
- scrTxt = it.sType;
- else if (i == 4)
- scrTxt = it.sValue;
-
- endPos = scrTxt.getLength();
- if (textSearch.SearchForward(scrTxt, &startPos, &endPos))
- {
- InsertEntry(it);
- break;
- }
- }
- }
- }
-
- m_xPrefBox->thaw();
- if (m_bSorted)
- m_xPrefBox->make_sorted();
-
- m_xPrefBox->all_foreach([this](weld::TreeIter& rEntry) {
- m_xPrefBox->expand_row(rEntry);
- return false;
- });
- m_xPrefBox->show();
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, ModifiedHdl_Impl, weld::Toggleable&, void)
+{
+ InputChanged();
}
void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry)
{
+ bool bOnlyModified = m_xModifiedCheckBtn->get_active();
+ if (bOnlyModified && !rEntry.pUserData->bWasModified)
+ return;
+
OUString sPathWithProperty = rEntry.pUserData->sPropertyPath;
sal_Int32 index = sPathWithProperty.lastIndexOf(rEntry.sProp);
OUString sPath = sPathWithProperty.copy(0, index);
@@ -860,18 +1029,21 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry)
do
{
int prevIndex = index;
- index = sPath.indexOf("/", index+1);
+ index = sPath.indexOf("/", index + 1);
// deal with no parent case (tdf#107811)
if (index < 0)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rEntry.pUserData)));
- m_xPrefBox->insert(nullptr, -1, &rEntry.sProp, &sId, nullptr, nullptr, false, m_xScratchIter.get());
+ OUString sId(weld::toId(rEntry.pUserData));
+ m_xPrefBox->insert(nullptr, -1, &rEntry.sProp, &sId, nullptr, nullptr, false,
+ m_xScratchIter.get());
m_xPrefBox->set_text(*m_xScratchIter, rEntry.sStatus, 1);
m_xPrefBox->set_text(*m_xScratchIter, rEntry.sType, 2);
m_xPrefBox->set_text(*m_xScratchIter, rEntry.sValue, 3);
+ m_xPrefBox->set_text_emphasis(*m_xScratchIter, rEntry.pUserData->bWasModified, -1);
+ m_xPrefBox->set_sensitive(*m_xScratchIter, !rEntry.pUserData->bIsReadOnly);
return;
}
- OUString sParentName = sPath.copy(prevIndex+1, index - prevIndex - 1);
+ OUString sParentName = sPath.copy(prevIndex + 1, index - prevIndex - 1);
bool hasEntry = false;
bool bStartOk;
@@ -898,28 +1070,33 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry)
if (!hasEntry)
{
- m_xPrefBox->insert(xGrandParentEntry.get(), -1, &sParentName, nullptr, nullptr, nullptr, false, xParentEntry.get());
+ m_xPrefBox->insert(xGrandParentEntry.get(), -1, &sParentName, nullptr, nullptr, nullptr,
+ false, xParentEntry.get());
//It is needed, without this the selection line will be truncated.
m_xPrefBox->set_text(*xParentEntry, "", 1);
m_xPrefBox->set_text(*xParentEntry, "", 2);
m_xPrefBox->set_text(*xParentEntry, "", 3);
+ m_xPrefBox->set_sensitive(*xParentEntry, true);
}
xGrandParentEntry = m_xPrefBox->make_iterator(xParentEntry.get());
- } while(index < sPath.getLength() - 1);
+ } while (index < sPath.getLength() - 1);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rEntry.pUserData)));
- m_xPrefBox->insert(xParentEntry.get(), -1, &rEntry.sProp, &sId, nullptr, nullptr, false, m_xScratchIter.get());
+ OUString sId(weld::toId(rEntry.pUserData));
+ m_xPrefBox->insert(xParentEntry.get(), -1, &rEntry.sProp, &sId, nullptr, nullptr, false,
+ m_xScratchIter.get());
m_xPrefBox->set_text(*m_xScratchIter, rEntry.sStatus, 1);
m_xPrefBox->set_text(*m_xScratchIter, rEntry.sType, 2);
m_xPrefBox->set_text(*m_xScratchIter, rEntry.sValue, 3);
+ m_xPrefBox->set_text_emphasis(*m_xScratchIter, rEntry.pUserData->bWasModified, -1);
+ m_xPrefBox->set_sensitive(*m_xScratchIter, !rEntry.pUserData->bIsReadOnly);
}
IMPL_LINK(CuiAboutConfigTabPage, ExpandingHdl_Impl, const weld::TreeIter&, rEntry, bool)
{
if (m_xPrefBox->iter_has_child(rEntry))
return true;
- UserData *pUserData = reinterpret_cast<UserData*>(m_xPrefBox->get_id(rEntry).toInt64());
+ UserData* pUserData = weld::fromId<UserData*>(m_xPrefBox->get_id(rEntry));
if (pUserData && !pUserData->bIsPropertyPath)
{
assert(pUserData->aXNameAccess.is());
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index 69a207da6712..2b9402369a26 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -11,6 +11,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
+#include <dlgname.hxx>
#include <i18nutil/searchopt.hxx>
#include <vcl/weld.hxx>
@@ -36,60 +37,52 @@ private:
std::unique_ptr<weld::Button> m_xResetBtn;
std::unique_ptr<weld::Button> m_xEditBtn;
std::unique_ptr<weld::Button> m_xSearchBtn;
+ std::unique_ptr<weld::CheckButton> m_xModifiedCheckBtn;
std::unique_ptr<weld::Entry> m_xSearchEdit;
std::unique_ptr<weld::TreeView> m_xPrefBox;
std::unique_ptr<weld::TreeIter> m_xScratchIter;
- std::vector < std::unique_ptr<UserData> > m_vectorUserData;
+ std::vector<std::unique_ptr<UserData>> m_vectorUserData;
std::vector<prefBoxEntry> m_modifiedPrefBoxEntries;
- std::vector< std::shared_ptr< Prop_Impl > > m_vectorOfModified;
+ std::vector<std::shared_ptr<Prop_Impl>> m_vectorOfModified;
- //for search
+ //for search
i18nutil::SearchOptions2 m_options;
std::vector<prefBoxEntry> m_prefBoxEntries;
bool m_bSorted;
- void AddToModifiedVector( const std::shared_ptr< Prop_Impl >& rProp );
- static std::vector< OUString > commaStringToSequence( const OUString& rCommaSepString );
+ void AddToModifiedVector(const std::shared_ptr<Prop_Impl>& rProp);
+ static std::vector<OUString> commaStringToSequence(std::u16string_view rCommaSepString);
void InsertEntry(const prefBoxEntry& rEntry);
+ DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
DECL_LINK(StandardHdl_Impl, weld::Button&, void);
DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, bool);
DECL_LINK(ResetBtnHdl_Impl, weld::Button&, void);
DECL_LINK(SearchHdl_Impl, weld::Button&, void);
+ DECL_LINK(ModifiedHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ExpandingHdl_Impl, const weld::TreeIter&, bool);
DECL_LINK(HeaderBarClick, int, void);
+ DECL_STATIC_LINK(CuiAboutConfigTabPage, ValidNameHdl, SvxNameDialog&, bool);
public:
- explicit CuiAboutConfigTabPage(weld::Window* pParent);
- virtual ~CuiAboutConfigTabPage() override;
- void InsertEntry(const OUString &rPropertyPath, const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue,
- const weld::TreeIter* pParentEntry, bool bInsertToPrefBox);
- void Reset();
- void FillItems(const css::uno::Reference<css::container::XNameAccess>& xNameAccess,
- const weld::TreeIter* pParentEntry = nullptr, int lineage = 0, bool bLoadAll = false);
- static css::uno::Reference< css::container::XNameAccess > getConfigAccess( const OUString& sNodePath, bool bUpdate );
- void FillItemSet();
-};
-
-class CuiAboutConfigValueDialog : public weld::GenericDialogController
-{
-private:
- bool m_bNumericOnly;
- std::unique_ptr<weld::Entry> m_xEDValue;
-
- DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
-
-public:
- CuiAboutConfigValueDialog(weld::Window* pWindow, const OUString& rValue , int limit);
- virtual ~CuiAboutConfigValueDialog() override;
-
- OUString getValue() const
- {
- return m_xEDValue->get_text();
- }
+ explicit CuiAboutConfigTabPage(weld::Window* pParent);
+ virtual ~CuiAboutConfigTabPage() override;
+ void InsertEntry(const OUString& rPropertyPath, css::uno::Any aPropertyValue,
+ const OUString& rProp, const OUString& rStatus, const OUString& rType,
+ const OUString& rValue, const OUString& rTooltip,
+ const weld::TreeIter* pParentEntry, bool bInsertToPrefBox, bool bIsReadOnly,
+ bool bWasMOdified);
+ void Reset();
+ void InputChanged();
+ void FillItems(const css::uno::Reference<css::container::XNameAccess>& xNameAccess,
+ const weld::TreeIter* pParentEntry = nullptr, int lineage = 0,
+ bool bLoadAll = false);
+ static css::uno::Reference<css::container::XNameAccess>
+ getConfigAccess(const OUString& sNodePath, bool bUpdate);
+ void FillItemSet();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
index a394ff955a4a..008a4a273502 100644
--- a/cui/source/options/optaccessibility.cxx
+++ b/cui/source/options/optaccessibility.cxx
@@ -27,11 +27,18 @@ SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(weld::Container*
: SfxTabPage(pPage, pController, "cui/ui/optaccessibilitypage.ui", "OptAccessibilityPage", &rSet)
, m_xAccessibilityTool(m_xBuilder->weld_check_button("acctool"))
, m_xTextSelectionInReadonly(m_xBuilder->weld_check_button("textselinreadonly"))
+ , m_xTextSelectionInReadonlyImg(m_xBuilder->weld_widget("locktextselinreadonly"))
, m_xAnimatedGraphics(m_xBuilder->weld_check_button("animatedgraphics"))
+ , m_xAnimatedGraphicsImg(m_xBuilder->weld_widget("lockanimatedgraphics"))
, m_xAnimatedTexts(m_xBuilder->weld_check_button("animatedtext"))
- , m_xAutoDetectHC(m_xBuilder->weld_check_button("autodetecthc"))
+ , m_xAnimatedTextsImg(m_xBuilder->weld_widget("lockanimatedtext"))
+ , m_xHighContrast(m_xBuilder->weld_combo_box("highcontrast"))
+ , m_xHighContrastImg(m_xBuilder->weld_widget("lockhighcontrast"))
+ , m_xHighContrastLabel(m_xBuilder->weld_label("label13"))
, m_xAutomaticFontColor(m_xBuilder->weld_check_button("autofontcolor"))
+ , m_xAutomaticFontColorImg(m_xBuilder->weld_widget("lockautofontcolor"))
, m_xPagePreviews(m_xBuilder->weld_check_button("systempagepreviewcolor"))
+ , m_xPagePreviewsImg(m_xBuilder->weld_widget("locksystempagepreviewcolor"))
{
#ifdef UNX
// UNIX: read the gconf2 setting instead to use the checkbox
@@ -48,6 +55,29 @@ std::unique_ptr<SfxTabPage> SvxAccessibilityOptionsTabPage::Create(weld::Contain
return std::make_unique<SvxAccessibilityOptionsTabPage>(pPage, pController, *rAttrSet);
}
+OUString SvxAccessibilityOptionsTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label13" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "acctool", "textselinreadonly", "animatedgraphics",
+ "animatedtext", "autofontcolor", "systempagepreviewcolor" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
{
std::shared_ptr<comphelper::ConfigurationChanges> batch( comphelper::ConfigurationChanges::create() );
@@ -61,8 +91,8 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
officecfg::Office::Common::Accessibility::IsAutomaticFontColor::set(m_xAutomaticFontColor->get_active(), batch);
if ( !officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
officecfg::Office::Common::Accessibility::IsSelectionInReadonly::set(m_xTextSelectionInReadonly->get_active(), batch);
- if ( !officecfg::Office::Common::Accessibility::AutoDetectSystemHC::isReadOnly() )
- officecfg::Office::Common::Accessibility::AutoDetectSystemHC::set(m_xAutoDetectHC->get_active(), batch);
+ if ( !officecfg::Office::Common::Accessibility::HighContrast::isReadOnly() )
+ officecfg::Office::Common::Accessibility::HighContrast::set(m_xHighContrast->get_active(), batch);
batch->commit();
AllSettings aAllSettings = Application::GetSettings();
@@ -80,28 +110,47 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* )
{
m_xPagePreviews->set_active( officecfg::Office::Common::Accessibility::IsForPagePreviews::get() );
- if( officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly() )
+ if (officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly())
+ {
m_xPagePreviews->set_sensitive(false);
+ m_xPagePreviewsImg->set_visible(true);
+ }
m_xAnimatedGraphics->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::get() );
- if( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly() )
+ if (officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly())
+ {
m_xAnimatedGraphics->set_sensitive(false);
+ m_xAnimatedGraphicsImg->set_visible(true);
+ }
m_xAnimatedTexts->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::get() );
- if( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly() )
+ if (officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly())
+ {
m_xAnimatedTexts->set_sensitive(false);
+ m_xAnimatedTextsImg->set_visible(true);
+ }
m_xAutomaticFontColor->set_active( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::get() );
- if( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly() )
+ if (officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly())
+ {
m_xAutomaticFontColor->set_sensitive(false);
+ m_xAutomaticFontColorImg->set_visible(true);
+ }
m_xTextSelectionInReadonly->set_active( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::get() );
- if( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
+ if (officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly())
+ {
m_xTextSelectionInReadonly->set_sensitive(false);
+ m_xTextSelectionInReadonlyImg->set_visible(true);
+ }
- m_xAutoDetectHC->set_active( officecfg::Office::Common::Accessibility::AutoDetectSystemHC::get() );
- if( officecfg::Office::Common::Accessibility::AutoDetectSystemHC::isReadOnly() )
- m_xAutoDetectHC->set_sensitive(false);
+ m_xHighContrast->set_active( officecfg::Office::Common::Accessibility::HighContrast::get() );
+ if (officecfg::Office::Common::Accessibility::HighContrast::isReadOnly())
+ {
+ m_xHighContrast->set_sensitive(false);
+ m_xHighContrastLabel->set_sensitive(false);
+ m_xHighContrastImg->set_visible(true);
+ }
AllSettings aAllSettings = Application::GetSettings();
const MiscSettings& aMiscSettings = aAllSettings.GetMiscSettings();
diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx
index 35d5fdefde03..73fe167c1679 100644
--- a/cui/source/options/optaccessibility.hxx
+++ b/cui/source/options/optaccessibility.hxx
@@ -24,17 +24,27 @@ class SvxAccessibilityOptionsTabPage : public SfxTabPage
{
std::unique_ptr<weld::CheckButton> m_xAccessibilityTool;
std::unique_ptr<weld::CheckButton> m_xTextSelectionInReadonly;
+ std::unique_ptr<weld::Widget> m_xTextSelectionInReadonlyImg;
std::unique_ptr<weld::CheckButton> m_xAnimatedGraphics;
+ std::unique_ptr<weld::Widget> m_xAnimatedGraphicsImg;
std::unique_ptr<weld::CheckButton> m_xAnimatedTexts;
- std::unique_ptr<weld::CheckButton> m_xAutoDetectHC;
+ std::unique_ptr<weld::Widget> m_xAnimatedTextsImg;
+ std::unique_ptr<weld::ComboBox> m_xHighContrast;
+ std::unique_ptr<weld::Widget> m_xHighContrastImg;
+ std::unique_ptr<weld::Label> m_xHighContrastLabel;
std::unique_ptr<weld::CheckButton> m_xAutomaticFontColor;
+ std::unique_ptr<weld::Widget> m_xAutomaticFontColorImg;
std::unique_ptr<weld::CheckButton> m_xPagePreviews;
+ std::unique_ptr<weld::Widget> m_xPagePreviewsImg;
public:
SvxAccessibilityOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~SvxAccessibilityOptionsTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 962cf1fc2e0a..390621a0cdd9 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -20,9 +20,8 @@
#include <memory>
#include <map>
#include <optasian.hxx>
-#include <osl/diagnose.h>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <o3tl/any.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <svl/asiancfg.hxx>
@@ -43,15 +42,15 @@ using namespace com::sun::star::i18n;
using namespace com::sun::star::frame;
using namespace com::sun::star::beans;
-constexpr OUStringLiteral cIsKernAsianPunctuation = u"IsKernAsianPunctuation";
-constexpr OUStringLiteral cCharacterCompressionType = u"CharacterCompressionType";
+constexpr OUString cIsKernAsianPunctuation = u"IsKernAsianPunctuation"_ustr;
+constexpr OUString cCharacterCompressionType = u"CharacterCompressionType"_ustr;
namespace {
struct SvxForbiddenChars_Impl
{
bool bRemoved;
- std::unique_ptr<ForbiddenCharacters> pCharacters;
+ std::optional<ForbiddenCharacters> oCharacters;
};
}
@@ -64,12 +63,12 @@ struct SvxAsianLayoutPage_Impl
Reference< XForbiddenCharacters > xForbidden;
Reference< XPropertySet > xPrSet;
Reference< XPropertySetInfo > xPrSetInfo;
- std::map< LanguageType, std::unique_ptr<SvxForbiddenChars_Impl> >
+ std::map< LanguageType, SvxForbiddenChars_Impl >
aChangedLanguagesMap;
bool hasForbiddenCharacters(LanguageType eLang);
SvxForbiddenChars_Impl* getForbiddenCharacters(LanguageType eLang);
- void addForbiddenCharacters(LanguageType eLang, std::unique_ptr<ForbiddenCharacters> pForbidden);
+ void addForbiddenCharacters(LanguageType eLang, std::optional<ForbiddenCharacters> oForbidden);
};
bool SvxAsianLayoutPage_Impl::hasForbiddenCharacters(LanguageType eLang)
@@ -82,25 +81,25 @@ SvxForbiddenChars_Impl* SvxAsianLayoutPage_Impl::getForbiddenCharacters(Language
auto it = aChangedLanguagesMap.find( eLang );
DBG_ASSERT( ( it != aChangedLanguagesMap.end() ), "language not available");
if( it != aChangedLanguagesMap.end() )
- return it->second.get();
+ return &it->second;
return nullptr;
}
void SvxAsianLayoutPage_Impl::addForbiddenCharacters(
- LanguageType eLang, std::unique_ptr<ForbiddenCharacters> pForbidden)
+ LanguageType eLang, std::optional<ForbiddenCharacters> oForbidden)
{
auto itOld = aChangedLanguagesMap.find( eLang );
if( itOld == aChangedLanguagesMap.end() )
{
- std::unique_ptr<SvxForbiddenChars_Impl> pChar(new SvxForbiddenChars_Impl);
- pChar->bRemoved = nullptr == pForbidden;
- pChar->pCharacters = std::move(pForbidden);
- aChangedLanguagesMap.emplace( eLang, std::move(pChar) );
+ SvxForbiddenChars_Impl aChar;
+ aChar.bRemoved = !oForbidden.has_value();
+ aChar.oCharacters = std::move(oForbidden);
+ aChangedLanguagesMap.emplace( eLang, std::move(aChar) );
}
else
{
- itOld->second->bRemoved = nullptr == pForbidden;
- itOld->second->pCharacters = std::move(pForbidden);
+ itOld->second.bRemoved = !oForbidden.has_value();
+ itOld->second.oCharacters = std::move(oForbidden);
}
}
@@ -142,6 +141,32 @@ std::unique_ptr<SfxTabPage> SvxAsianLayoutPage::Create(weld::Container* pPage, w
return std::make_unique<SvxAsianLayoutPage>(pPage, pController, *rAttrSet);
}
+OUString SvxAsianLayoutPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[]
+ = { "label1", "label2", "label3", "languageft", "startft", "endft", "hintft" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString radioButton[] = { "charkerning", "charpunctkerning", "nocompression",
+ "punctcompression", "punctkanacompression" };
+
+ for (const auto& radio : radioButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xStandardCB->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
{
if(m_xCharKerningRB->get_state_changed_from_saved())
@@ -176,10 +201,10 @@ bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
for (auto const& changedLanguage : pImpl->aChangedLanguagesMap)
{
Locale aLocale( LanguageTag::convertToLocale(changedLanguage.first));
- if(changedLanguage.second->bRemoved)
+ if(changedLanguage.second.bRemoved)
pImpl->xForbidden->removeForbiddenCharacters( aLocale );
- else if(changedLanguage.second->pCharacters)
- pImpl->xForbidden->setForbiddenCharacters( aLocale, *( changedLanguage.second->pCharacters ) );
+ else if(changedLanguage.second.oCharacters)
+ pImpl->xForbidden->setForbiddenCharacters( aLocale, *( changedLanguage.second.oCharacters ) );
}
}
catch (const Exception&)
@@ -206,8 +231,8 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
}
if( pImpl->xPrSet.is() )
pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
- bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly();
- CharCompressType nCompress = pImpl->aConfig.GetCharDistanceCompression();
+ bool bKernWesternText = SvxAsianConfig::IsKerningWesternTextOnly();
+ CharCompressType nCompress = SvxAsianConfig::GetCharDistanceCompression();
if(pImpl->xPrSetInfo.is())
{
OUString sForbidden("ForbiddenCharacters");
@@ -287,14 +312,14 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void)
if(bAvail)
{
SvxForbiddenChars_Impl* pElement = pImpl->getForbiddenCharacters(eSelectLanguage);
- if(pElement->bRemoved || !pElement->pCharacters)
+ if(pElement->bRemoved || !pElement->oCharacters)
{
bAvail = false;
}
else
{
- sStart = pElement->pCharacters->beginLine;
- sEnd = pElement->pCharacters->endLine;
+ sStart = pElement->oCharacters->beginLine;
+ sEnd = pElement->oCharacters->endLine;
}
}
else
@@ -317,11 +342,11 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void)
}
else
{
- bAvail = pImpl->aConfig.GetStartEndChars( aLocale, sStart, sEnd );
+ bAvail = SvxAsianConfig::GetStartEndChars( aLocale, sStart, sEnd );
}
if(!bAvail)
{
- LocaleDataWrapper aWrap( aLanguageTag );
+ LocaleDataWrapper aWrap( std::move(aLanguageTag) );
ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters();
sStart = aForbidden.beginLine;
sEnd = aForbidden.endLine;
@@ -335,7 +360,7 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void)
m_xEndED->set_text(sEnd);
}
-IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, weld::Toggleable&, rBox, void)
{
bool bCheck = rBox.get_active();
m_xStartED->set_sensitive(!bCheck);
@@ -359,13 +384,13 @@ IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, weld::Entry&, rEdit, void)
{
if(bEnable)
{
- std::unique_ptr<ForbiddenCharacters> pFCSet(new ForbiddenCharacters);
- pFCSet->beginLine = sStart;
- pFCSet->endLine = sEnd;
- pImpl->addForbiddenCharacters(eSelectLanguage, std::move(pFCSet));
+ ForbiddenCharacters aFCSet;
+ aFCSet.beginLine = sStart;
+ aFCSet.endLine = sEnd;
+ pImpl->addForbiddenCharacters(eSelectLanguage, std::move(aFCSet));
}
else
- pImpl->addForbiddenCharacters(eSelectLanguage, nullptr);
+ pImpl->addForbiddenCharacters(eSelectLanguage, std::nullopt);
}
catch (const Exception&)
{
@@ -375,11 +400,10 @@ IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, weld::Entry&, rEdit, void)
pImpl->aConfig.SetStartEndChars( aLocale, bEnable ? &sStart : nullptr, bEnable ? &sEnd : nullptr);
}
-const sal_uInt16* SvxAsianLayoutPage::GetRanges()
+WhichRangesContainer SvxAsianLayoutPage::GetRanges()
{
//no items are used
- static const sal_uInt16 pAsianLayoutRanges[] = { 0 };
- return pAsianLayoutRanges;
+ return WhichRangesContainer();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
index c550d9440edd..bbe20fd01eee 100644
--- a/cui/source/options/optbasic.cxx
+++ b/cui/source/options/optbasic.cxx
@@ -53,6 +53,29 @@ void SvxBasicIDEOptionsPage::LoadConfig()
m_xUseExtendedTypesChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::UseExtended::isReadOnly() );
}
+OUString SvxBasicIDEOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "codecomplete_enable", "autocorrect", "autoclose_quotes",
+ "autoclose_paren", "autoclose_proc", "extendedtypes_enable" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
{
bool bModified = false;
diff --git a/cui/source/options/optbasic.hxx b/cui/source/options/optbasic.hxx
index 990b54d4e3bb..bc4274eaca1e 100644
--- a/cui/source/options/optbasic.hxx
+++ b/cui/source/options/optbasic.hxx
@@ -38,6 +38,9 @@ public:
virtual ~SvxBasicIDEOptionsPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index b8499c5ee886..eef87d2cd324 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -26,6 +26,7 @@
#include <svx/svxids.hrc>
#include <osl/diagnose.h>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Chart.hxx>
void SvxDefaultColorOptPage::InsertColorEntry(const XColorEntry& rEntry, sal_Int32 nPos)
{
@@ -100,6 +101,14 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(weld::Container* pPage, weld::Dia
{
m_xLbChartColors->set_size_request(-1, m_xLbChartColors->get_height_rows(16));
+ if (officecfg::Office::Chart::DefaultColor::Series::isReadOnly())
+ {
+ m_xPBDefault->set_sensitive(false);
+ m_xPBAdd->set_sensitive(false);
+ m_xPBRemove->set_sensitive(false);
+ m_xValSetColorBoxWin->set_sensitive(false);
+ }
+
m_xPBDefault->connect_clicked( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) );
m_xPBAdd->connect_clicked( LINK( this, SvxDefaultColorOptPage, AddChartColor ) );
m_xPBRemove->connect_clicked( LINK( this, SvxDefaultColorOptPage, RemoveChartColor ) );
@@ -109,19 +118,16 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(weld::Container* pPage, weld::Dia
m_xValSetColorBox->SetStyle( m_xValSetColorBox->GetStyle()
| WB_ITEMBORDER | WB_NAMEFIELD | WB_VSCROLL );
- m_SvxChartOptionsUniquePtr.reset(new SvxChartOptions);
-
- const SfxPoolItem* pItem = nullptr;
- if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, false, &pItem ) == SfxItemState::SET )
+ if ( const SvxChartColorTableItem* pEditOptionsItem = rInAttrs.GetItemIfSet( SID_SCH_EDITOPTIONS, false ) )
{
m_SvxChartColorTableUniquePtr = std::make_unique<SvxChartColorTable>(
- static_cast<const SvxChartColorTableItem*>(pItem)->GetColorList());
+ pEditOptionsItem->GetColorList());
}
else
{
m_SvxChartColorTableUniquePtr = std::make_unique<SvxChartColorTable>();
m_SvxChartColorTableUniquePtr->useDefault();
- m_SvxChartOptionsUniquePtr->SetDefaultColors(*m_SvxChartColorTableUniquePtr);
+ SvxChartOptions::SetDefaultColors(*m_SvxChartColorTableUniquePtr);
}
Construct();
@@ -146,6 +152,28 @@ std::unique_ptr<SfxTabPage> SvxDefaultColorOptPage::Create( weld::Container* pPa
return std::make_unique<SvxDefaultColorOptPage>( pPage, pController, *rAttrs );
}
+OUString SvxDefaultColorOptPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label20", "label1" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString buttons[] = { "add", "delete", "default" };
+
+ for (const auto& btn : buttons)
+ {
+ if (const auto& pString = m_xBuilder->weld_button(btn))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet* rOutAttrs )
{
if( m_SvxChartColorTableUniquePtr )
@@ -176,11 +204,8 @@ void SvxDefaultColorOptPage::FillPaletteLB()
void SvxDefaultColorOptPage::SaveChartOptions()
{
- if (m_SvxChartOptionsUniquePtr && m_SvxChartColorTableUniquePtr)
- {
- m_SvxChartOptionsUniquePtr->SetDefaultColors(*m_SvxChartColorTableUniquePtr);
- m_SvxChartOptionsUniquePtr->Commit();
- }
+ if (m_SvxChartColorTableUniquePtr)
+ SvxChartOptions::SetDefaultColors(*m_SvxChartColorTableUniquePtr);
}
// event handlers
diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx
index 11221617a9d1..22a01495b276 100644
--- a/cui/source/options/optchart.hxx
+++ b/cui/source/options/optchart.hxx
@@ -32,7 +32,6 @@ typedef std::vector<Color> ImpColorList;
class SvxDefaultColorOptPage : public SfxTabPage
{
private:
- std::unique_ptr<SvxChartOptions> m_SvxChartOptionsUniquePtr;
// no reason to use a cloned SfxItem here (SvxChartColorTableItem)
// that just leads to non-const SfxItem and potential trouble
std::unique_ptr<SvxChartColorTable> m_SvxChartColorTableUniquePtr;
@@ -70,6 +69,9 @@ public:
void Construct();
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) override;
virtual void Reset( const SfxItemSet* rInAttrs ) override;
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index c17e9a1ce5c0..d2c94669fa9f 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -21,6 +21,8 @@
#include <bitset>
+#include <com/sun/star/configuration/ReadWriteAccess.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <tools/debug.hxx>
#include <editeng/editids.hrc>
#include <svtools/colorcfg.hxx>
@@ -34,7 +36,10 @@
#include <dialmgr.hxx>
#include "optcolor.hxx"
#include <strings.hrc>
-
+#include <svtools/miscopt.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/ExtendedColorScheme.hxx>
+#include <officecfg/Office/UI.hxx>
using namespace ::com::sun::star;
using namespace ::svtools;
@@ -61,7 +66,7 @@ struct
// group
Group eGroup;
// .ui group name
- const char *pGroup;
+ OUString pGroup;
}
const vGroupInfo[] =
{
@@ -81,11 +86,13 @@ struct
// group
Group eGroup;
//checkbox (or simple text)
- const char *pText;
+ OUString pText;
//color listbox
- const char *pColor;
+ OUString pColor;
// has checkbox?
bool bCheckBox;
+ //prop name
+ std::u16string_view sPropName;
}
const vEntryInfo[] =
{
@@ -97,66 +104,102 @@ const vEntryInfo[] =
// The list of these entries (enum ColorConfigEntry) are in colorcfg.hxx.
- { Group_General, IDS(doccolor) },
- { Group_General, IDS_CB(docboundaries) },
- { Group_General, IDS(appback) },
- { Group_General, IDS_CB(objboundaries) },
- { Group_General, IDS_CB(tblboundaries) },
- { Group_General, IDS(font) },
- { Group_General, IDS_CB(unvisitedlinks) },
- { Group_General, IDS_CB(visitedlinks) },
- { Group_General, IDS(autospellcheck) },
- { Group_General, IDS(smarttags) },
- { Group_General, IDS_CB(shadows) },
-
- { Group_Writer, IDS(writergrid) },
- { Group_Writer, IDS_CB(field) },
- { Group_Writer, IDS_CB(index) },
- { Group_Writer, IDS(direct) },
- { Group_Writer, IDS(script) },
- { Group_Writer, IDS_CB(section) },
- { Group_Writer, IDS(hdft) },
- { Group_Writer, IDS(pagebreak) },
-
- { Group_Html, IDS(sgml) },
- { Group_Html, IDS(htmlcomment) },
- { Group_Html, IDS(htmlkeyword) },
- { Group_Html, IDS(unknown) },
-
- { Group_Calc, IDS(calcgrid) },
- { Group_Calc, IDS(brk) },
- { Group_Calc, IDS(brkmanual) },
- { Group_Calc, IDS(brkauto) },
- { Group_Calc, IDS(det) },
- { Group_Calc, IDS(deterror) },
- { Group_Calc, IDS(ref) },
- { Group_Calc, IDS(notes) },
- { Group_Calc, IDS(values) },
- { Group_Calc, IDS(formulas) },
- { Group_Calc, IDS(text) },
- { Group_Calc, IDS(protectedcells) },
-
- { Group_Draw, IDS(drawgrid) },
-
- { Group_Basic, IDS(basicid) },
- { Group_Basic, IDS(basiccomment) },
- { Group_Basic, IDS(basicnumber) },
- { Group_Basic, IDS(basicstring) },
- { Group_Basic, IDS(basicop) },
- { Group_Basic, IDS(basickeyword) },
- { Group_Basic, IDS(error) },
-
- { Group_Sql, IDS(sqlid) },
- { Group_Sql, IDS(sqlnumber) },
- { Group_Sql, IDS(sqlstring) },
- { Group_Sql, IDS(sqlop) },
- { Group_Sql, IDS(sqlkeyword) },
- { Group_Sql, IDS(sqlparam) },
- { Group_Sql, IDS(sqlcomment) }
+ { Group_General, IDS(doccolor), std::u16string_view(u"/DocColor") },
+ { Group_General, IDS_CB(docboundaries), std::u16string_view(u"/DocBoundaries") },
+ { Group_General, IDS(appback), std::u16string_view(u"/AppBackground") },
+ { Group_General, IDS_CB(objboundaries), std::u16string_view(u"/ObjectBoundaries") },
+ { Group_General, IDS_CB(tblboundaries), std::u16string_view(u"/TableBoundaries") },
+ { Group_General, IDS(font), std::u16string_view(u"/FontColor") },
+ { Group_General, IDS_CB(unvisitedlinks), std::u16string_view(u"/Links") },
+ { Group_General, IDS_CB(visitedlinks), std::u16string_view(u"/LinksVisited") },
+ { Group_General, IDS(autospellcheck), std::u16string_view(u"/Spell") },
+ { Group_General, IDS(grammarcheck), std::u16string_view(u"/Grammar") },
+ { Group_General, IDS(smarttags), std::u16string_view(u"/SmartTags") },
+ { Group_General, IDS_CB(shadows), std::u16string_view(u"/Shadow") },
+
+ { Group_Writer, IDS(writergrid), std::u16string_view(u"/WriterTextGrid") },
+ { Group_Writer, IDS_CB(field), std::u16string_view(u"/WriterFieldShadings") },
+ { Group_Writer, IDS_CB(index), std::u16string_view(u"/WriterIdxShadings") },
+ { Group_Writer, IDS(direct), std::u16string_view(u"/WriterDirectCursor") },
+ { Group_Writer, IDS(script), std::u16string_view(u"/WriterScriptIndicator") },
+ { Group_Writer, IDS_CB(section), std::u16string_view(u"/WriterSectionBoundaries") },
+ { Group_Writer, IDS(hdft), std::u16string_view(u"/WriterHeaderFooterMark") },
+ { Group_Writer, IDS(pagebreak), std::u16string_view(u"/WriterPageBreaks") },
+
+ { Group_Html, IDS(sgml), std::u16string_view(u"/HTMLSGML") },
+ { Group_Html, IDS(htmlcomment), std::u16string_view(u"/HTMLComment") },
+ { Group_Html, IDS(htmlkeyword), std::u16string_view(u"/HTMLKeyword") },
+ { Group_Html, IDS(unknown), std::u16string_view(u"/HTMLUnknown") },
+
+ { Group_Calc, IDS(calcgrid), std::u16string_view(u"/CalcGrid") },
+ { Group_Calc, IDS(calccellfocus), std::u16string_view(u"/CalcCellFocus") },
+ { Group_Calc, IDS(brk), std::u16string_view(u"/CalcPageBreak") },
+ { Group_Calc, IDS(brkmanual), std::u16string_view(u"/CalcPageBreakManual") },
+ { Group_Calc, IDS(brkauto), std::u16string_view(u"/CalcPageBreakAutomatic") },
+ { Group_Calc, IDS_CB(hiddencolrow), std::u16string_view(u"/CalcHiddenColRow") },
+ { Group_Calc, IDS_CB(textoverflow), std::u16string_view(u"/CalcTextOverflow") },
+ { Group_Calc, IDS(comments), std::u16string_view(u"/CalcComments") },
+ { Group_Calc, IDS(det), std::u16string_view(u"/CalcDetective") },
+ { Group_Calc, IDS(deterror), std::u16string_view(u"/CalcDetectiveError") },
+ { Group_Calc, IDS(ref), std::u16string_view(u"/CalcReference") },
+ { Group_Calc, IDS(notes), std::u16string_view(u"/CalcNotesBackground") },
+ { Group_Calc, IDS(values), std::u16string_view(u"/CalcValue") },
+ { Group_Calc, IDS(formulas), std::u16string_view(u"/CalcFormula") },
+ { Group_Calc, IDS(text), std::u16string_view(u"/CalcText") },
+ { Group_Calc, IDS(protectedcells), std::u16string_view(u"/CalcProtectedBackground") },
+
+ { Group_Draw, IDS(drawgrid), std::u16string_view(u"/DrawGrid") },
+
+ { Group_Basic, IDS(basiceditor), std::u16string_view(u"/BASICEditor") },
+ { Group_Basic, IDS(basicid), std::u16string_view(u"/BASICIdentifier") },
+ { Group_Basic, IDS(basiccomment), std::u16string_view(u"/BASICComment") },
+ { Group_Basic, IDS(basicnumber), std::u16string_view(u"/BASICNumber") },
+ { Group_Basic, IDS(basicstring), std::u16string_view(u"/BASICString") },
+ { Group_Basic, IDS(basicop), std::u16string_view(u"/BASICOperator") },
+ { Group_Basic, IDS(basickeyword), std::u16string_view(u"/BASICKeyword") },
+ { Group_Basic, IDS(error), std::u16string_view(u"/BASICError") },
+
+ { Group_Sql, IDS(sqlid), std::u16string_view(u"/SQLIdentifier") },
+ { Group_Sql, IDS(sqlnumber), std::u16string_view(u"/SQLNumber") },
+ { Group_Sql, IDS(sqlstring), std::u16string_view(u"/SQLString") },
+ { Group_Sql, IDS(sqlop), std::u16string_view(u"/SQLOperator") },
+ { Group_Sql, IDS(sqlkeyword), std::u16string_view(u"/SQLKeyword") },
+ { Group_Sql, IDS(sqlparam), std::u16string_view(u"/SQLParameter") },
+ { Group_Sql, IDS(sqlcomment), std::u16string_view(u"/SQLComment") }
#undef IDS
};
+// Maps the names of default color schemes to the corresponding TranslateId
+const std::map<OUString, OUString> &getColorSchemes()
+{
+ static std::map<OUString, OUString> const vColorSchemes = {
+ {"COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC)},
+ };
+ return vColorSchemes;
+};
+
+// If the color scheme name has a translated string, then return the translation
+// Or else simply return the input string
+// For non-translatable color schemes, the ID and the name are the same
+OUString lcl_SchemeIdToTranslatedName(const OUString& sSchemeId)
+{
+ auto it = getColorSchemes().find(sSchemeId);
+ if (it != getColorSchemes().end())
+ return it->second;
+ return sSchemeId;
+}
+
+// Given a translated color scheme name, return the scheme ID used in the UI.xcu file
+// For non-translatable color schemes, the ID and the name are the same
+OUString lcl_TranslatedNameToSchemeId(const OUString& sName)
+{
+ for (auto it = getColorSchemes().begin(); it != getColorSchemes().end(); ++it)
+ if (it->second == sName)
+ return it->first;
+ return sName;
+}
+
// ColorConfigWindow_Impl
class ColorConfigWindow_Impl
@@ -165,12 +208,13 @@ public:
explicit ColorConfigWindow_Impl(weld::Window* pTopLevel, weld::Container* pParent);
public:
- void SetLinks(Link<weld::ToggleButton&,void> const&,
+ void SetLinks(Link<weld::Toggleable&,void> const&,
Link<ColorListBox&,void> const&,
Link<weld::Widget&,void> const&,
weld::ScrolledWindow& rScroll);
void Update(EditableColorConfig const*, EditableExtendedColorConfig const*);
- void ClickHdl(EditableColorConfig*, weld::ToggleButton&);
+ void UpdateEntries();
+ void ClickHdl(EditableColorConfig*, const weld::Toggleable&);
void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const ColorListBox*);
weld::Widget& GetWidget1()
@@ -185,10 +229,13 @@ public:
weld::Widget& GetBody()
{
- return *m_xGrid;
+ return *m_xBox;
}
- void AdjustExtraWidths(int nTextWidth);
+ int GetLabelIndent() const
+ {
+ return m_nCheckBoxLabelOffset;
+ }
private:
// Chapter -- horizontal group separator stripe with text
@@ -197,38 +244,37 @@ private:
// text
std::unique_ptr<weld::Label> m_xText;
public:
- Chapter(weld::Builder& rBuilder, const char* pLabelWidget, bool bShow);
+ Chapter(weld::Builder& rBuilder, const OUString& pLabelWidget, bool bShow);
void SetText(const OUString& rLabel) { m_xText->set_label(rLabel); }
};
// Entry -- a color config entry:
// text (checkbox) + color list box
- class Entry
+ struct Entry
{
- public:
- Entry(weld::Window* pTopLevel, weld::Builder& rBuilder, const char* pTextWidget, const char* pColorWidget,
- const Color& rColor, tools::Long nCheckBoxLabelOffset, bool bCheckBox, bool bShow);
- public:
+ Entry(weld::Window* pTopLevel, weld::Builder& rBuilder, const OUString& pTextWidget, const OUString& pColorWidget,
+ const Color& rColor, int nCheckBoxLabelOffset, const ColorListBox* pCache, bool bCheckBox, bool bShow);
void SetText(const OUString& rLabel) { dynamic_cast<weld::Label&>(*m_xText).set_label(rLabel); }
- void set_width_request(int nTextWidth) { m_xText->set_size_request(nTextWidth, -1); }
int get_height_request() const
{
return std::max(m_xText->get_preferred_size().Height(),
m_xColorList->get_widget().get_preferred_size().Height());
}
- void Hide ();
- public:
- void SetLinks(Link<weld::ToggleButton&,void> const&,
+ void Hide();
+
+ void SetLinks(Link<weld::Toggleable&,void> const&,
Link<ColorListBox&,void> const&,
Link<weld::Widget&,void> const&);
- void Update (ColorConfigValue const&);
- void Update (ExtendedColorConfigValue const&);
+ void Update (ColorConfigValue const&, const std::u16string_view&,
+ css::uno::Reference<css::configuration::XReadWriteAccess> const&);
+ void Update (ExtendedColorConfigValue const&, const std::u16string_view&,
+ css::uno::Reference<css::configuration::XReadWriteAccess> const&);
void ColorChanged (ColorConfigValue&);
void ColorChanged (ExtendedColorConfigValue&);
- public:
- bool Is(const weld::ToggleButton* pBox) const { return m_xText.get() == pBox; }
+
+ bool Is(const weld::Toggleable* pBox) const { return m_xText.get() == pBox; }
bool Is(const ColorListBox* pBox) const { return m_xColorList.get() == pBox; }
- private:
+
// checkbox (CheckBox) or simple text (FixedText)
std::unique_ptr<weld::Widget> m_xText;
// color list box
@@ -237,10 +283,13 @@ private:
Color m_aDefaultColor;
};
+ css::uno::Reference<css::configuration::XReadWriteAccess> m_xReadWriteAccess;
+
private:
weld::Window* m_pTopLevel;
+ int m_nCheckBoxLabelOffset;
std::unique_ptr<weld::Builder> m_xBuilder;
- std::unique_ptr<weld::Container> m_xGrid;
+ std::unique_ptr<weld::Box> m_xBox;
std::unique_ptr<weld::Widget> m_xWidget1;
std::unique_ptr<weld::Widget> m_xWidget2;
@@ -269,7 +318,7 @@ private:
// ctor for default groups
// rParent: parent window (ColorConfigWindow_Impl)
// eGroup: which group is this?
-ColorConfigWindow_Impl::Chapter::Chapter(weld::Builder& rBuilder, const char* pLabelWidget, bool bShow)
+ColorConfigWindow_Impl::Chapter::Chapter(weld::Builder& rBuilder, const OUString& pLabelWidget, bool bShow)
: m_xText(rBuilder.weld_label(pLabelWidget))
{
if (!bShow)
@@ -278,10 +327,11 @@ ColorConfigWindow_Impl::Chapter::Chapter(weld::Builder& rBuilder, const char* pL
// ColorConfigWindow_Impl::Entry
ColorConfigWindow_Impl::Entry::Entry(weld::Window* pTopLevel, weld::Builder& rBuilder,
- const char* pTextWidget, const char* pColorWidget,
- const Color& rColor,
- tools::Long nCheckBoxLabelOffset, bool bCheckBox, bool bShow)
- : m_xColorList(new ColorListBox(rBuilder.weld_menu_button(pColorWidget), pTopLevel))
+ const OUString& pTextWidget, const OUString& pColorWidget,
+ const Color& rColor, int nCheckBoxLabelOffset,
+ const ColorListBox* pCache, bool bCheckBox, bool bShow)
+ : m_xColorList(new ColorListBox(rBuilder.weld_menu_button(pColorWidget),
+ [pTopLevel]{ return pTopLevel; }, pCache))
, m_aDefaultColor(rColor)
{
if (bCheckBox)
@@ -310,13 +360,13 @@ void ColorConfigWindow_Impl::Entry::Hide()
}
// SetLinks()
-void ColorConfigWindow_Impl::Entry::SetLinks(Link<weld::ToggleButton&,void> const& rCheckLink,
+void ColorConfigWindow_Impl::Entry::SetLinks(Link<weld::Toggleable&,void> const& rCheckLink,
Link<ColorListBox&,void> const& rColorLink,
Link<weld::Widget&,void> const& rGetFocusLink)
{
m_xColorList->SetSelectHdl(rColorLink);
m_xColorList->connect_focus_in(rGetFocusLink);
- if (weld::ToggleButton* pCheckBox = dynamic_cast<weld::ToggleButton*>(m_xText.get()))
+ if (weld::Toggleable* pCheckBox = dynamic_cast<weld::Toggleable*>(m_xText.get()))
{
pCheckBox->connect_toggled(rCheckLink);
pCheckBox->connect_focus_in(rGetFocusLink);
@@ -324,22 +374,54 @@ void ColorConfigWindow_Impl::Entry::SetLinks(Link<weld::ToggleButton&,void> cons
}
// updates a default color config entry
-void ColorConfigWindow_Impl::Entry::Update(ColorConfigValue const& rValue)
+void ColorConfigWindow_Impl::Entry::Update(ColorConfigValue const& rValue, const std::u16string_view& rConfigPath,
+ css::uno::Reference<css::configuration::XReadWriteAccess> const& xReadWriteAccess)
{
Color aColor(rValue.nColor);
m_xColorList->SelectEntry(aColor);
- if (weld::ToggleButton* pCheckBox = dynamic_cast<weld::ToggleButton*>(m_xText.get()))
+
+ bool bReadOnly = false;
+ OUString aConfigPath = OUString::Concat(rConfigPath) + "/Color";
+ if (xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+ m_xColorList->set_sensitive(!bReadOnly);
+
+ if (weld::Toggleable* pCheckBox = dynamic_cast<weld::Toggleable*>(m_xText.get()))
+ {
+ bReadOnly = false;
pCheckBox->set_active(rValue.bIsVisible);
+
+ aConfigPath = OUString::Concat(rConfigPath) + "/IsVisible";
+ if (xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+ pCheckBox->set_sensitive(!bReadOnly);
+ }
}
// updates an extended color config entry
-void ColorConfigWindow_Impl::Entry::Update(ExtendedColorConfigValue const& rValue)
+void ColorConfigWindow_Impl::Entry::Update(ExtendedColorConfigValue const& rValue, const std::u16string_view& rConfigPath,
+ css::uno::Reference<css::configuration::XReadWriteAccess> const& xReadWriteAccess)
{
Color aColor(rValue.getColor());
if (rValue.getColor() == rValue.getDefaultColor())
m_xColorList->SelectEntry(COL_AUTO);
else
m_xColorList->SelectEntry(aColor);
+
+ bool bReadOnly = false;
+ OUString aConfigPath = OUString::Concat(rConfigPath) + rValue.getName() + "/Color";
+ if (xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+ m_xColorList->set_sensitive(!bReadOnly);
}
// color of a default entry has changed
@@ -364,10 +446,13 @@ void ColorConfigWindow_Impl::Entry::ColorChanged(ExtendedColorConfigValue& rValu
ColorConfigWindow_Impl::ColorConfigWindow_Impl(weld::Window* pTopLevel, weld::Container* pParent)
: m_pTopLevel(pTopLevel)
, m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/colorconfigwin.ui"))
- , m_xGrid(m_xBuilder->weld_container("ColorConfigWindow"))
- , m_xWidget1(m_xBuilder->weld_widget("doccolor"))
- , m_xWidget2(m_xBuilder->weld_widget("doccolor_lb"))
+ , m_xBox(m_xBuilder->weld_box("ColorConfigWindow"))
+ , m_xWidget1(m_xBuilder->weld_widget("docboundaries"))
+ , m_xWidget2(m_xBuilder->weld_widget("docboundaries_lb"))
{
+ css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
+
CreateEntries();
}
@@ -384,9 +469,8 @@ void ColorConfigWindow_Impl::CreateEntries()
// Here we want to get the amount to add to the position of a FixedText to
// get it to align its contents with that of a CheckBox
- tools::Long nCheckBoxLabelOffset = 0;
{
- OUString sSampleText("X");
+ OUString sSampleText("XXXXXX");
std::unique_ptr<weld::CheckButton> xCheckBox(m_xBuilder->weld_check_button("docboundaries"));
std::unique_ptr<weld::Label> xFixedText(m_xBuilder->weld_label("doccolor"));
OUString sOrigCheck(xCheckBox->get_label());
@@ -397,19 +481,23 @@ void ColorConfigWindow_Impl::CreateEntries()
Size aFixedSize(xFixedText->get_preferred_size());
xCheckBox->set_label(sOrigCheck);
xFixedText->set_label(sOrigFixed);
- nCheckBoxLabelOffset = aCheckSize.Width() - aFixedSize.Width();
+ m_nCheckBoxLabelOffset = aCheckSize.Width() - aFixedSize.Width();
}
+ const ColorListBox* pCache = nullptr;
+
// creating entries
vEntries.reserve(ColorConfigEntryCount);
- for (size_t i = 0; i < SAL_N_ELEMENTS(vEntryInfo); ++i)
+ for (size_t i = 0; i < std::size(vEntryInfo); ++i)
{
vEntries.push_back(std::make_shared<Entry>(m_pTopLevel, *m_xBuilder,
vEntryInfo[i].pText, vEntryInfo[i].pColor,
ColorConfig::GetDefaultColor(static_cast<ColorConfigEntry>(i)),
- nCheckBoxLabelOffset,
+ m_nCheckBoxLabelOffset, pCache,
vEntryInfo[i].bCheckBox,
aModulesInstalled[vEntryInfo[i].eGroup]));
+ if (!pCache)
+ pCache = vEntries.back()->m_xColorList.get();
}
// extended entries
@@ -418,50 +506,37 @@ void ColorConfigWindow_Impl::CreateEntries()
if (!nExtGroupCount)
return;
- size_t nLineNum = vChapters.size() + vEntries.size() + 1;
for (unsigned j = 0; j != nExtGroupCount; ++j)
{
- vExtBuilders.emplace_back(Application::CreateBuilder(m_xGrid.get(), "cui/ui/chapterfragment.ui"));
- vExtContainers.emplace_back(vExtBuilders.back()->weld_container("ChapterFragment"));
-
- vExtContainers.back()->set_grid_width(3);
- vExtContainers.back()->set_grid_left_attach(0);
- vExtContainers.back()->set_grid_top_attach(nLineNum);
+ vExtBuilders.emplace_back(Application::CreateBuilder(m_xBox.get(), "cui/ui/chapterfragment.ui"));
+ vExtContainers.emplace_back(vExtBuilders.back()->weld_frame("ChapterFragment"));
OUString const sComponentName = aExtConfig.GetComponentName(j);
vChapters.push_back(std::make_shared<Chapter>(
*vExtBuilders.back(), "chapter", true));
vChapters.back()->SetText(aExtConfig.GetComponentDisplayName(sComponentName));
- ++nLineNum;
+
+ vExtContainers.emplace_back(vExtBuilders.back()->weld_box("contents"));
+ weld::Container* pChapterBox = vExtContainers.back().get();
+
unsigned nColorCount = aExtConfig.GetComponentColorCount(sComponentName);
for (unsigned i = 0; i != nColorCount; ++i)
{
- vExtBuilders.emplace_back(Application::CreateBuilder(m_xGrid.get(), "cui/ui/colorfragment.ui"));
+ vExtBuilders.emplace_back(Application::CreateBuilder(pChapterBox, "cui/ui/colorfragment.ui"));
vExtContainers.emplace_back(vExtBuilders.back()->weld_container("ColorFragment"));
- vExtContainers.back()->set_grid_width(3);
- vExtContainers.back()->set_grid_left_attach(0);
- vExtContainers.back()->set_grid_top_attach(nLineNum);
-
ExtendedColorConfigValue const aColorEntry =
aExtConfig.GetComponentColorConfigValue(sComponentName, i);
vEntries.push_back(std::make_shared<Entry>(m_pTopLevel, *vExtBuilders.back(),
"label", "button", aColorEntry.getDefaultColor(),
- nCheckBoxLabelOffset, false, true));
+ m_nCheckBoxLabelOffset, pCache, false, true));
vEntries.back()->SetText(aColorEntry.getDisplayName());
- ++nLineNum;
}
}
}
-void ColorConfigWindow_Impl::AdjustExtraWidths(int nTextWidth)
-{
- for (size_t i = SAL_N_ELEMENTS(vEntryInfo); i < vEntries.size(); ++i)
- vEntries[i]->set_width_request(nTextWidth);
-}
-
// SetLinks()
-void ColorConfigWindow_Impl::SetLinks(Link<weld::ToggleButton&,void> const& aCheckLink,
+void ColorConfigWindow_Impl::SetLinks(Link<weld::Toggleable&,void> const& aCheckLink,
Link<ColorListBox&,void> const& aColorLink,
Link<weld::Widget&,void> const& rGetFocusLink,
weld::ScrolledWindow& rScroll)
@@ -480,11 +555,17 @@ void ColorConfigWindow_Impl::Update (
EditableExtendedColorConfig const* pExtConfig)
{
// updating default entries
+ std::optional<OUString> aUIColorSchemeName = officecfg::Office::UI::ColorScheme::CurrentColorScheme::get();
+ OUString aUIColorSchemePath = officecfg::Office::UI::ColorScheme::ColorSchemes::path() + u"/" + aUIColorSchemeName.value();
+
for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
{
+ OUString sPath = aUIColorSchemePath + vEntryInfo[i].sPropName;
ColorConfigEntry const aColorEntry = static_cast<ColorConfigEntry>(i);
vEntries[i]->Update(
- pConfig->GetColorValue(aColorEntry)
+ pConfig->GetColorValue(aColorEntry),
+ sPath,
+ m_xReadWriteAccess
);
}
@@ -494,16 +575,30 @@ void ColorConfigWindow_Impl::Update (
for (unsigned j = 0; j != nExtCount; ++j)
{
OUString sComponentName = pExtConfig->GetComponentName(j);
+ aUIColorSchemePath = officecfg::Office::ExtendedColorScheme::ExtendedColorScheme::ColorSchemes::path() + u"/" +
+ aUIColorSchemeName.value() + u"/" + sComponentName + u"/Entries/";
unsigned const nColorCount = pExtConfig->GetComponentColorCount(sComponentName);
for (unsigned k = 0; i != vEntries.size() && k != nColorCount; ++i, ++k)
vEntries[i]->Update(
- pExtConfig->GetComponentColorConfigValue(sComponentName, k)
+ pExtConfig->GetComponentColorConfigValue(sComponentName, k),
+ aUIColorSchemePath,
+ m_xReadWriteAccess
);
}
}
+void ColorConfigWindow_Impl::UpdateEntries()
+{
+ for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
+ {
+ ColorConfigEntry const aEntry = static_cast<ColorConfigEntry>(i);
+ Color aColor = ColorConfig::GetDefaultColor(aEntry);
+ vEntries[i]->m_xColorList->SetAutoDisplayColor(aColor);
+ }
+}
+
// ClickHdl()
-void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, weld::ToggleButton& rBox)
+void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, const weld::Toggleable& rBox)
{
for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
{
@@ -591,17 +686,17 @@ class ColorConfigCtrl_Impl
EditableColorConfig* pColorConfig;
EditableExtendedColorConfig* pExtColorConfig;
- DECL_LINK(ClickHdl, weld::ToggleButton&, void);
+ DECL_LINK(ClickHdl, weld::Toggleable&, void);
DECL_LINK(ColorHdl, ColorListBox&, void);
DECL_LINK(ControlFocusHdl, weld::Widget&, void);
public:
explicit ColorConfigCtrl_Impl(weld::Window* pTopLevel, weld::Builder& rbuilder);
- void AdjustExtraWidths(int nTextWidth) { m_xScrollWindow->AdjustExtraWidths(nTextWidth); }
void SetConfig (EditableColorConfig& rConfig) { pColorConfig = &rConfig; }
void SetExtendedConfig (EditableExtendedColorConfig& rConfig) { pExtColorConfig = &rConfig; }
void Update();
+ void UpdateEntries();
tools::Long GetScrollPosition() const
{
return m_xVScroll->vadjustment_get_value();
@@ -618,6 +713,10 @@ public:
{
return m_xScrollWindow->GetWidget2();
}
+ int GetLabelIndent() const
+ {
+ return m_xScrollWindow->GetLabelIndent();
+ }
};
ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(weld::Window* pTopLevel, weld::Builder& rBuilder)
@@ -629,7 +728,7 @@ ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(weld::Window* pTopLevel, weld::Builde
{
m_xBody->set_stack_background();
- Link<weld::ToggleButton&,void> aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl);
+ Link<weld::Toggleable&,void> aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl);
Link<ColorListBox&,void> aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl);
Link<weld::Widget&,void> const& aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl);
m_xScrollWindow->SetLinks(aCheckLink, aColorLink, aGetFocusLink, *m_xVScroll);
@@ -641,7 +740,12 @@ void ColorConfigCtrl_Impl::Update ()
m_xScrollWindow->Update(pColorConfig, pExtColorConfig);
}
-IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, weld::ToggleButton&, rBox, void)
+void ColorConfigCtrl_Impl::UpdateEntries()
+{
+ m_xScrollWindow->UpdateEntries();
+}
+
+IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, weld::Toggleable&, rBox, void)
{
DBG_ASSERT(pColorConfig, "Configuration not set");
m_xScrollWindow->ClickHdl(pColorConfig, rBox);
@@ -696,19 +800,23 @@ IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, weld::Widget&, rCtrl, void)
SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet)
: SfxTabPage(pPage, pController, "cui/ui/optappearancepage.ui", "OptAppearancePage", &rCoreSet)
, bFillItemSetCalled(false)
+ , m_nSizeAllocEventId(nullptr)
+ , m_xAutoColorLB(m_xBuilder->weld_combo_box("autocolorlb"))
+ , m_xAutoColorImg(m_xBuilder->weld_widget("lockautocolorlb"))
, m_xColorSchemeLB(m_xBuilder->weld_combo_box("colorschemelb"))
+ , m_xColorSchemeImg(m_xBuilder->weld_widget("lockcolorschemelb"))
, m_xSaveSchemePB(m_xBuilder->weld_button("save"))
, m_xDeleteSchemePB(m_xBuilder->weld_button("delete"))
, m_xColorConfigCT(new ColorConfigCtrl_Impl(pController->getDialog(), *m_xBuilder))
, m_xTable(m_xBuilder->weld_widget("table"))
, m_xOnFT(m_xBuilder->weld_label("on"))
- , m_xElementFT(m_xBuilder->weld_label("uielements"))
, m_xColorFT(m_xBuilder->weld_label("colorsetting"))
, m_rWidget1(m_xColorConfigCT->GetWidget1())
, m_rWidget2(m_xColorConfigCT->GetWidget2())
{
m_xColorSchemeLB->make_sorted();
m_xColorSchemeLB->connect_changed(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl));
+ m_xAutoColorLB->connect_changed(LINK(this, SvxColorOptionsTabPage, onAutoColorChanged));
Link<weld::Button&,void> aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl );
m_xSaveSchemePB->connect_clicked(aLk);
m_xDeleteSchemePB->connect_clicked(aLk);
@@ -741,6 +849,8 @@ SvxColorOptionsTabPage::~SvxColorOptionsTabPage()
pExtColorConfig.reset();
}
m_xColorConfigCT.reset();
+ if (m_nSizeAllocEventId)
+ Application::RemoveUserEvent(m_nSizeAllocEventId);
}
std::unique_ptr<SfxTabPage> SvxColorOptionsTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
@@ -748,6 +858,21 @@ std::unique_ptr<SfxTabPage> SvxColorOptionsTabPage::Create(weld::Container* pPag
return std::make_unique<SvxColorOptionsTabPage>(pPage, pController, *rAttrSet);
}
+OUString SvxColorOptionsTabPage::GetAllStrings()
+{
+ // buttons are excluded
+ OUString sAllStrings;
+ OUString labels[] = { "label2", "label3", "autocolor", "uielements", "colorsetting" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxColorOptionsTabPage::FillItemSet( SfxItemSet* )
{
bFillItemSetCalled = true;
@@ -781,16 +906,30 @@ void SvxColorOptionsTabPage::Reset( const SfxItemSet* )
pExtColorConfig.reset(new EditableExtendedColorConfig);
m_xColorConfigCT->SetExtendedConfig(*pExtColorConfig);
+ m_xAutoColorLB->set_active( MiscSettings::GetAppColorMode() );
+
+ bool bReadOnly = officecfg::Office::ExtendedColorScheme::ExtendedColorScheme::CurrentColorScheme::isReadOnly() ||
+ officecfg::Office::UI::ColorScheme::CurrentColorScheme::isReadOnly();
+ m_xAutoColorLB->set_sensitive(!bReadOnly);
+ m_xSaveSchemePB->set_sensitive(!bReadOnly);
+ m_xDeleteSchemePB->set_sensitive(!bReadOnly);
+ m_xAutoColorImg->set_visible(bReadOnly);
+
OUString sUser = GetUserData();
//has to be called always to speed up accessibility tools
m_xColorConfigCT->SetScrollPosition(sUser.toInt32());
m_xColorSchemeLB->clear();
const uno::Sequence< OUString > aSchemes = pColorConfig->GetSchemeNames();
for(const OUString& s : aSchemes)
- m_xColorSchemeLB->append_text(s);
- m_xColorSchemeLB->set_active_text(pColorConfig->GetCurrentSchemeName());
+ m_xColorSchemeLB->append_text(lcl_SchemeIdToTranslatedName(s));
+
+ m_xColorSchemeLB->set_active_text(lcl_SchemeIdToTranslatedName(pColorConfig->GetCurrentSchemeName()));
+ m_xColorSchemeLB->set_sensitive(!officecfg::Office::Common::Misc::ApplicationAppearance::isReadOnly());
+ m_xColorSchemeImg->set_visible(officecfg::Office::Common::Misc::ApplicationAppearance::isReadOnly());
m_xColorSchemeLB->save_value();
- m_xDeleteSchemePB->set_sensitive( aSchemes.getLength() > 1 );
+
+ m_xDeleteSchemePB->set_sensitive( aSchemes.getLength() > 1 &&
+ !officecfg::Office::ExtendedColorScheme::ExtendedColorScheme::CurrentColorScheme::isReadOnly() );
UpdateColorConfig();
}
@@ -807,10 +946,21 @@ void SvxColorOptionsTabPage::UpdateColorConfig()
m_xColorConfigCT->Update();
}
+IMPL_LINK_NOARG(SvxColorOptionsTabPage, onAutoColorChanged, weld::ComboBox&, void)
+{
+ MiscSettings::SetAppColorMode( m_xAutoColorLB->get_active() );
+
+ m_xColorConfigCT->UpdateEntries();
+
+ pColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(m_xColorSchemeLB->get_active_text()));
+ pExtColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(m_xColorSchemeLB->get_active_text()));
+ UpdateColorConfig();
+}
+
IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, weld::ComboBox&, rBox, void)
{
- pColorConfig->LoadScheme(rBox.get_active_text());
- pExtColorConfig->LoadScheme(rBox.get_active_text());
+ pColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(rBox.get_active_text()));
+ pExtColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(rBox.get_active_text()));
UpdateColorConfig();
}
@@ -822,14 +972,14 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, weld::Button&, rButton, vo
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(GetFrameWeld(),
- sName, CuiResId(RID_SVXSTR_COLOR_CONFIG_SAVE2) ));
+ sName, CuiResId(RID_CUISTR_COLOR_CONFIG_SAVE2) ));
aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
- aNameDlg->SetText(CuiResId(RID_SVXSTR_COLOR_CONFIG_SAVE1));
+ aNameDlg->SetText(CuiResId(RID_CUISTR_COLOR_CONFIG_SAVE1));
aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME);
aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
if(RET_OK == aNameDlg->Execute())
{
- aNameDlg->GetName(sName);
+ sName = aNameDlg->GetName();
pColorConfig->AddScheme(sName);
pExtColorConfig->AddScheme(sName);
m_xColorSchemeLB->append_text(sName);
@@ -842,8 +992,8 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, weld::Button&, rButton, vo
DBG_ASSERT(m_xColorSchemeLB->get_count() > 1, "don't delete the last scheme");
std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE)));
- xQuery->set_title(CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE));
+ CuiResId(RID_CUISTR_COLOR_CONFIG_DELETE)));
+ xQuery->set_title(CuiResId(RID_CUISTR_COLOR_CONFIG_DELETE_TITLE));
if (RET_YES == xQuery->run())
{
OUString sDeleteScheme(m_xColorSchemeLB->get_active_text());
@@ -860,8 +1010,7 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, weld::Button&, rButton, vo
IMPL_LINK(SvxColorOptionsTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog&, rDialog, bool )
{
- OUString sName;
- rDialog.GetName(sName);
+ OUString sName = rDialog.GetName();
return !sName.isEmpty() && m_xColorSchemeLB->find_text(sName) == -1;
}
@@ -872,17 +1021,29 @@ void SvxColorOptionsTabPage::FillUserData()
IMPL_LINK_NOARG(SvxColorOptionsTabPage, AdjustHeaderBar, const Size&, void)
{
+ if (m_nSizeAllocEventId)
+ return;
+ m_nSizeAllocEventId = Application::PostUserEvent(LINK(this, SvxColorOptionsTabPage, PostAdjustHeaderBar));
+}
+
+IMPL_LINK_NOARG(SvxColorOptionsTabPage, PostAdjustHeaderBar, void*, void)
+{
+ m_nSizeAllocEventId = nullptr;
+
// horizontal positions
- int nX0 = 0, nX1, nX2, y, width, height;
+ int nX1, nX2, nX3, y, width, height;
if (!m_rWidget1.get_extents_relative_to(*m_xTable, nX1, y, width, height))
return;
if (!m_rWidget2.get_extents_relative_to(*m_xTable, nX2, y, width, height))
return;
- auto nTextWidth1 = nX1 - nX0;
- auto nTextWidth2 = nX2 - nX1;
+ if (!m_xTable->get_extents_relative_to(*m_xTable, nX3, y, width, height))
+ return;
+
+ // 6 is the column-spacing of the parent grid of these labels
+ auto nTextWidth1 = nX1 + m_xColorConfigCT->GetLabelIndent() - 6;
m_xOnFT->set_size_request(nTextWidth1, -1);
- m_xElementFT->set_size_request(nTextWidth2, -1);
- m_xColorConfigCT->AdjustExtraWidths(nTextWidth2 - 12);
+ auto nTextWidth3 = width - nX2;
+ m_xColorFT->set_size_request(nTextWidth3, -1);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
index de84e06b1405..7b5cdbca7451 100644
--- a/cui/source/options/optcolor.hxx
+++ b/cui/source/options/optcolor.hxx
@@ -23,18 +23,25 @@
namespace svtools {class EditableColorConfig;class EditableExtendedColorConfig;}
class ColorConfigCtrl_Impl;
class AbstractSvxNameDialog;
+struct ImplSVEvent;
+
class SvxColorOptionsTabPage : public SfxTabPage
{
bool bFillItemSetCalled;
+ ImplSVEvent* m_nSizeAllocEventId;
+
+ std::unique_ptr<weld::ComboBox> m_xAutoColorLB;
+ std::unique_ptr<weld::Widget> m_xAutoColorImg;
std::unique_ptr<weld::ComboBox> m_xColorSchemeLB;
+ std::unique_ptr<weld::Widget> m_xColorSchemeImg;
std::unique_ptr<weld::Button> m_xSaveSchemePB;
std::unique_ptr<weld::Button> m_xDeleteSchemePB;
std::unique_ptr<ColorConfigCtrl_Impl> m_xColorConfigCT;
std::unique_ptr<weld::Widget> m_xTable;
std::unique_ptr<weld::Label> m_xOnFT;
- std::unique_ptr<weld::Label> m_xElementFT;
std::unique_ptr<weld::Label> m_xColorFT;
+
weld::Widget& m_rWidget1;
weld::Widget& m_rWidget2;
@@ -42,9 +49,11 @@ class SvxColorOptionsTabPage : public SfxTabPage
std::unique_ptr<svtools::EditableExtendedColorConfig> pExtColorConfig;
DECL_LINK(SchemeChangedHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(onAutoColorChanged, weld::ComboBox&, void);
DECL_LINK(SaveDeleteHdl_Impl, weld::Button&, void);
DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog&, bool);
DECL_LINK(AdjustHeaderBar, const Size&, void);
+ DECL_LINK(PostAdjustHeaderBar, void *, void);
void UpdateColorConfig();
public:
@@ -53,6 +62,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx
index 983f077e7ff8..10140c2eab50 100644
--- a/cui/source/options/optctl.cxx
+++ b/cui/source/options/optctl.cxx
@@ -24,7 +24,7 @@
// class SvxCTLOptionsPage -----------------------------------------------------
-IMPL_LINK_NOARG(SvxCTLOptionsPage, SequenceCheckingCB_Hdl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxCTLOptionsPage, SequenceCheckingCB_Hdl, weld::Toggleable&, void)
{
bool bIsSequenceChecking = m_xSequenceCheckingCB->get_active();
m_xRestrictedCB->set_sensitive( bIsSequenceChecking );
@@ -46,7 +46,7 @@ SvxCTLOptionsPage::SvxCTLOptionsPage(weld::Container* pPage, weld::DialogControl
, m_xMovementVisualRB(m_xBuilder->weld_radio_button("movementvisual"))
, m_xNumeralsLB(m_xBuilder->weld_combo_box("numerals"))
{
- m_xSequenceCheckingCB->connect_clicked(LINK(this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl));
+ m_xSequenceCheckingCB->connect_toggled(LINK(this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl));
}
SvxCTLOptionsPage::~SvxCTLOptionsPage()
@@ -58,6 +58,36 @@ std::unique_ptr<SfxTabPage> SvxCTLOptionsPage::Create( weld::Container* pPage, w
return std::make_unique<SvxCTLOptionsPage>( pPage, pController, *rAttrSet );
}
+OUString SvxCTLOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3", "label4", "label5" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "sequencechecking", "restricted", "typeandreplace" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString radioButton[] = { "movementlogical", "movementvisual" };
+
+ for (const auto& radio : radioButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxCTLOptionsPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
@@ -106,13 +136,11 @@ bool SvxCTLOptionsPage::FillItemSet( SfxItemSet* )
void SvxCTLOptionsPage::Reset( const SfxItemSet* )
{
- SvtCTLOptions aCTLOptions;
-
- m_xSequenceCheckingCB->set_active( aCTLOptions.IsCTLSequenceChecking() );
- m_xRestrictedCB->set_active( aCTLOptions.IsCTLSequenceCheckingRestricted() );
- m_xTypeReplaceCB->set_active( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() );
+ m_xSequenceCheckingCB->set_active( SvtCTLOptions::IsCTLSequenceChecking() );
+ m_xRestrictedCB->set_active( SvtCTLOptions::IsCTLSequenceCheckingRestricted() );
+ m_xTypeReplaceCB->set_active( SvtCTLOptions::IsCTLSequenceCheckingTypeAndReplace() );
- SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
+ SvtCTLOptions::CursorMovement eMovement = SvtCTLOptions::GetCTLCursorMovement();
switch ( eMovement )
{
case SvtCTLOptions::MOVEMENT_LOGICAL :
@@ -127,7 +155,7 @@ void SvxCTLOptionsPage::Reset( const SfxItemSet* )
SAL_WARN( "cui.options", "SvxCTLOptionsPage::Reset(): invalid movement enum" );
}
- sal_uInt16 nPos = static_cast<sal_uInt16>(aCTLOptions.GetCTLTextNumerals());
+ sal_uInt16 nPos = static_cast<sal_uInt16>(SvtCTLOptions::GetCTLTextNumerals());
DBG_ASSERT( nPos < m_xNumeralsLB->get_count(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
m_xNumeralsLB->set_active(nPos);
diff --git a/cui/source/options/optctl.hxx b/cui/source/options/optctl.hxx
index e81d24beaa19..35c07d3a81df 100644
--- a/cui/source/options/optctl.hxx
+++ b/cui/source/options/optctl.hxx
@@ -32,12 +32,15 @@ private:
std::unique_ptr<weld::RadioButton> m_xMovementVisualRB;
std::unique_ptr<weld::ComboBox> m_xNumeralsLB;
- DECL_LINK( SequenceCheckingCB_Hdl, weld::Button&, void );
+ DECL_LINK( SequenceCheckingCB_Hdl, weld::Toggleable&, void );
public:
SvxCTLOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~SvxCTLOptionsPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index 000000000000..ba068fe28af7
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include <officecfg/Office/Linguistic.hxx>
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet)
+ : SfxTabPage(pPage, pController, "cui/ui/optdeeplpage.ui", "OptDeeplPage", &rSet)
+ , m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+ , m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+ std::optional<OUString> oDeeplAPIUrl
+ = officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get();
+ if (oDeeplAPIUrl && !oDeeplAPIUrl->isEmpty())
+ m_xAPIUrl->set_text(*officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get());
+
+ std::optional<OUString> oDeeplAuthKey
+ = officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get();
+ if (oDeeplAuthKey && !oDeeplAuthKey->isEmpty())
+ m_xAuthKey->set_text(*officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get());
+}
+
+OUString OptDeeplTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_link_button("privacy"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Linguistic::Translation::Deepl::ApiURL::set(m_xAPIUrl->get_text(), batch);
+ officecfg::Office::Linguistic::Translation::Deepl::AuthKey::set(m_xAuthKey->get_text(), batch);
+ batch->commit();
+ return false;
+}
+
+std::unique_ptr<SfxTabPage> OptDeeplTabPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrSet)
+{
+ return std::make_unique<OptDeeplTabPage>(pPage, pController, *rAttrSet);
+}
diff --git a/cui/source/options/optdeepl.hxx b/cui/source/options/optdeepl.hxx
new file mode 100644
index 000000000000..51714c685084
--- /dev/null
+++ b/cui/source/options/optdeepl.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+#include <sfx2/tabdlg.hxx>
+
+class OptDeeplTabPage : public SfxTabPage
+{
+public:
+ OptDeeplTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet);
+ virtual ~OptDeeplTabPage() override;
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
+
+ virtual OUString GetAllStrings() override;
+
+ virtual bool FillItemSet(SfxItemSet* rSet) override;
+ virtual void Reset(const SfxItemSet* rSet) override;
+
+private:
+ std::unique_ptr<weld::Entry> m_xAPIUrl;
+ std::unique_ptr<weld::Entry> m_xAuthKey;
+};
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 55bfd4b72224..dbe7f80e3d6b 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -18,6 +18,7 @@
*/
#include <editeng/unolingu.hxx>
+#include <o3tl/safeint.hxx>
#include <svx/dialmgr.hxx>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/linguistic2/XDictionary.hpp>
@@ -43,7 +44,7 @@ using namespace linguistic;
// static function -------------------------------------------------------
-static OUString getNormDicEntry_Impl(const OUString &rText)
+static OUString getNormDicEntry_Impl(std::u16string_view rText)
{
OUString aTmp(comphelper::string::stripEnd(rText, '.'));
// non-standard hyphenation
@@ -66,6 +67,23 @@ static OUString getNormDicEntry_Impl(const OUString &rText)
return aTmp.replaceAll("=", "");
}
+// tdf#154499 separate words of a phrase only by a single space,
+// i.e. trim terminating spaces and replace space sequences with single spaces
+static OUString fixSpace(OUString sText)
+{
+ sText = sText.trim();
+
+ sal_Int32 nLen;
+ do
+ {
+ nLen = sText.getLength();
+ sText = sText.replaceAll(" ", " ");
+ }
+ while ( sText.getLength() < nLen );
+
+ return sText;
+}
+
namespace {
// Compare Dictionary Entry result
@@ -73,7 +91,7 @@ enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT };
}
-static CDE_RESULT cmpDicEntry_Impl( const OUString &rText1, const OUString &rText2 )
+static CDE_RESULT cmpDicEntry_Impl( std::u16string_view rText1, std::u16string_view rText2 )
{
CDE_RESULT eRes = CDE_DIFFERENT;
@@ -135,7 +153,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
// Detected an invalid character.
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Info, VclButtonsType::Ok,
- CuiResId(RID_SVXSTR_OPT_INVALID_DICT_NAME)));
+ CuiResId(RID_CUISTR_OPT_INVALID_DICT_NAME)));
xInfoBox->run();
m_xNameEdit->grab_focus();
return;
@@ -146,7 +164,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
// duplicate names?
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Info, VclButtonsType::Ok,
- CuiResId(RID_SVXSTR_OPT_DOUBLE_DICTS)));
+ CuiResId(RID_CUISTR_OPT_DOUBLE_DICTS)));
xInfoBox->run();
m_xNameEdit->grab_focus();
return;
@@ -174,7 +192,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
// error: couldn't create new dictionary
SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, OUString(),
m_xDialog.get(), RID_SVXERRCTX, SvxResLocale() );
- ErrorHandler::HandleError( *new StringErrorInfo(
+ ErrorHandler::HandleError( ErrCodeMsg(
ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) );
m_xDialog->response(RET_CANCEL);
}
@@ -235,8 +253,10 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16
m_xSingleColumnLB->connect_changed(LINK(this, SvxEditDictionaryDialog, SelectHdl));
m_xDoubleColumnLB->connect_changed(LINK(this, SvxEditDictionaryDialog, SelectHdl));
- std::vector<int> aWidths;
- aWidths.push_back(m_xDoubleColumnLB->get_approximate_digit_width() * 22);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xDoubleColumnLB->get_approximate_digit_width() * 22)
+ };
m_xDoubleColumnLB->set_column_fixed_widths(aWidths);
// install handler
@@ -278,10 +298,6 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16
m_xLangLB->SetLanguageList( SvxLanguageListFlags::ALL, true, true );
- Link<OUString&,bool> aLink = LINK(this, SvxEditDictionaryDialog, InsertTextHdl);
- m_xReplaceED->connect_insert_text(aLink);
- m_xWordED->connect_insert_text(aLink);
-
if ( nCount > 0 )
{
m_xAllDictsLB->set_active_text(aLookUpEntry);
@@ -355,7 +371,7 @@ void SvxEditDictionaryDialog::SetLanguage_Impl(LanguageType nLanguage)
m_xLangLB->set_active_id(nLanguage);
}
-int SvxEditDictionaryDialog::GetLBInsertPos(const OUString &rDicWord)
+int SvxEditDictionaryDialog::GetLBInsertPos(std::u16string_view rDicWord)
{
IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
const CollatorWrapper* pCollator = aIntlWrapper.getCollator();
@@ -422,7 +438,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, weld::ComboBox&, vo
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_CONFIRM_SET_LANGUAGE)));
+ CuiResId(RID_CUISTR_CONFIRM_SET_LANGUAGE)));
OUString sTxt(xBox->get_primary_text());
sTxt = sTxt.replaceFirst("%1", m_xAllDictsLB->get_active_text());
xBox->set_primary_text(sTxt);
@@ -465,7 +481,7 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
{
m_xReplaceFT->set_label(sReplaceFT_Text);
} else if (!bLangNone) {
- m_xReplaceFT->set_label(CuiResId(RID_SVXSTR_OPT_GRAMMAR_BY));
+ m_xReplaceFT->set_label(CuiResId(RID_CUISTR_OPT_GRAMMAR_BY));
}
if(bIsNegative || !bLangNone)
@@ -595,9 +611,9 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn)
if (pBtn == m_xNewReplacePB.get() || m_xNewReplacePB->get_sensitive())
{
int nEntry = m_pWordsLB->get_selected_index();
- OUString aNewWord(m_xWordED->get_text());
+ OUString aNewWord(fixSpace(m_xWordED->get_text()));
OUString sEntry(aNewWord);
- OUString aReplaceStr(m_xReplaceED->get_text());
+ OUString aReplaceStr(fixSpace(m_xReplaceED->get_text()));
DictionaryError nAddRes = DictionaryError::UNKNOWN;
int nPos = m_xAllDictsLB->get_active();
@@ -623,7 +639,7 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn)
nAddRes = linguistic::AddEntryToDic( xDic,
aNewWord, bIsNegEntry,
aRplcText, false );
- }
+ }
}
if (DictionaryError::NONE != nAddRes)
SvxDicError(m_xDialog.get(), nAddRes);
@@ -670,7 +686,7 @@ IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, weld::Entry&, rEdt, void)
OUString rEntry = rEdt.get_text();
sal_Int32 nWordLen = rEntry.getLength();
- const OUString& rRepString = m_xReplaceED->get_text();
+ const OUString& rRepString = fixSpace(m_xReplaceED->get_text());
bool bEnableNewReplace = false;
bool bEnableDelete = false;
@@ -751,9 +767,9 @@ IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, weld::Entry&, rEdt, void)
bEnableDelete = true;
}
bool bIsChange =
- CDE_EQUAL != cmpDicEntry_Impl(m_xWordED->get_text(), aWordText)
- || CDE_EQUAL != cmpDicEntry_Impl(m_xReplaceED->get_text(), aReplaceText);
- if (!m_xWordED->get_text().isEmpty() && bIsChange)
+ CDE_EQUAL != cmpDicEntry_Impl(fixSpace(m_xWordED->get_text()), aWordText)
+ || CDE_EQUAL != cmpDicEntry_Impl(fixSpace(m_xReplaceED->get_text()), aReplaceText);
+ if (!fixSpace(m_xWordED->get_text()).isEmpty() && bIsChange)
bEnableNewReplace = true;
}
@@ -762,10 +778,4 @@ IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, weld::Entry&, rEdt, void)
m_xDeletePB->set_sensitive(bEnableDelete && !IsDicReadonly_Impl());
}
-IMPL_STATIC_LINK(SvxEditDictionaryDialog, InsertTextHdl, OUString&, rText, bool)
-{
- rText = rText.replaceAll(" ", "");
- return true;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index aadb46f9520d..0ecd2215716d 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -18,8 +18,10 @@
*/
#include <unotools/moduleoptions.hxx>
-#include <unotools/fltrcfg.hxx>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Calc.hxx>
+#include <officecfg/Office/Writer.hxx>
+#include <officecfg/Office/Impress.hxx>
#include "optfltr.hxx"
#include <strings.hrc>
#include <dialmgr.hxx>
@@ -39,30 +41,40 @@ enum class MSFltrPg2_CheckBoxEntries {
OfaMSFilterTabPage::OfaMSFilterTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optfltrpage.ui", "OptFltrPage", &rSet)
, m_xWBasicCodeCB(m_xBuilder->weld_check_button("wo_basic"))
+ , m_xWBasicCodeImg(m_xBuilder->weld_widget("lockwo_basic"))
, m_xWBasicWbctblCB(m_xBuilder->weld_check_button("wo_exec"))
+ , m_xWBasicWbctblImg(m_xBuilder->weld_widget("lockwo_exec"))
, m_xWBasicStgCB(m_xBuilder->weld_check_button("wo_saveorig"))
+ , m_xWBasicStgImg(m_xBuilder->weld_widget("lockwo_saveorig"))
, m_xEBasicCodeCB(m_xBuilder->weld_check_button("ex_basic"))
+ , m_xEBasicCodeImg(m_xBuilder->weld_widget("lockex_basic"))
, m_xEBasicExectblCB(m_xBuilder->weld_check_button("ex_exec"))
+ , m_xEBasicExectblImg(m_xBuilder->weld_widget("lockex_exec"))
, m_xEBasicStgCB(m_xBuilder->weld_check_button("ex_saveorig"))
+ , m_xEBasicStgImg(m_xBuilder->weld_widget("lockex_saveorig"))
, m_xPBasicCodeCB(m_xBuilder->weld_check_button("pp_basic"))
+ , m_xPBasicCodeImg(m_xBuilder->weld_widget("lockpp_basic"))
, m_xPBasicStgCB(m_xBuilder->weld_check_button("pp_saveorig"))
+ , m_xPBasicStgImg(m_xBuilder->weld_widget("lockpp_saveorig"))
{
- m_xWBasicCodeCB->connect_clicked( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
- m_xEBasicCodeCB->connect_clicked( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
+ m_xWBasicCodeCB->connect_toggled( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
+ m_xEBasicCodeCB->connect_toggled( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
}
OfaMSFilterTabPage::~OfaMSFilterTabPage()
{
}
-IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, weld::Toggleable&, void)
{
- m_xWBasicWbctblCB->set_sensitive(m_xWBasicCodeCB->get_active());
+ m_xWBasicWbctblCB->set_sensitive(m_xWBasicCodeCB->get_active() && !officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
+ m_xWBasicWbctblImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
}
-IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, weld::Toggleable&, void)
{
- m_xEBasicExectblCB->set_sensitive(m_xEBasicCodeCB->get_active());
+ m_xEBasicExectblCB->set_sensitive(m_xEBasicCodeCB->get_active() && !officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
+ m_xEBasicExectblImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
}
std::unique_ptr<SfxTabPage> OfaMSFilterTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
@@ -71,75 +83,119 @@ std::unique_ptr<SfxTabPage> OfaMSFilterTabPage::Create( weld::Container* pPage,
return std::make_unique<OfaMSFilterTabPage>(pPage, pController, *rAttrSet);
}
+OUString OfaMSFilterTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "wo_basic", "wo_exec", "wo_saveorig", "ex_basic",
+ "ex_exec", "ex_saveorig", "pp_basic", "pp_saveorig" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaMSFilterTabPage::FillItemSet( SfxItemSet* )
{
- SvtFilterOptions& rOpt = SvtFilterOptions::Get();
+ auto batch = comphelper::ConfigurationChanges::create();
if( m_xWBasicCodeCB->get_state_changed_from_saved() )
- rOpt.SetLoadWordBasicCode( m_xWBasicCodeCB->get_active() );
+ officecfg::Office::Writer::Filter::Import::VBA::Load::set(m_xWBasicCodeCB->get_active(), batch);
if( m_xWBasicWbctblCB->get_state_changed_from_saved() )
- rOpt.SetLoadWordBasicExecutable( m_xWBasicWbctblCB->get_active() );
+ officecfg::Office::Writer::Filter::Import::VBA::Executable::set(m_xWBasicWbctblCB->get_active(), batch);
if( m_xWBasicStgCB->get_state_changed_from_saved() )
- rOpt.SetLoadWordBasicStorage( m_xWBasicStgCB->get_active() );
+ officecfg::Office::Writer::Filter::Import::VBA::Save::set(m_xWBasicStgCB->get_active(), batch);
if( m_xEBasicCodeCB->get_state_changed_from_saved())
- rOpt.SetLoadExcelBasicCode( m_xEBasicCodeCB->get_active() );
+ officecfg::Office::Calc::Filter::Import::VBA::Load::set(m_xEBasicCodeCB->get_active(), batch);
if( m_xEBasicExectblCB->get_state_changed_from_saved())
- rOpt.SetLoadExcelBasicExecutable( m_xEBasicExectblCB->get_active() );
+ officecfg::Office::Calc::Filter::Import::VBA::Executable::set(m_xEBasicExectblCB->get_active(), batch);
if( m_xEBasicStgCB->get_state_changed_from_saved())
- rOpt.SetLoadExcelBasicStorage( m_xEBasicStgCB->get_active() );
+ officecfg::Office::Calc::Filter::Import::VBA::Save::set(m_xEBasicStgCB->get_active(), batch);
if( m_xPBasicCodeCB->get_state_changed_from_saved())
- rOpt.SetLoadPPointBasicCode( m_xPBasicCodeCB->get_active() );
+ officecfg::Office::Impress::Filter::Import::VBA::Load::set(m_xPBasicCodeCB->get_active(), batch);
if( m_xPBasicStgCB->get_state_changed_from_saved())
- rOpt.SetLoadPPointBasicStorage( m_xPBasicStgCB->get_active() );
+ officecfg::Office::Impress::Filter::Import::VBA::Save::set(m_xPBasicStgCB->get_active(), batch);
+
+ batch->commit();
return false;
}
void OfaMSFilterTabPage::Reset( const SfxItemSet* )
{
- const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
-
- m_xWBasicCodeCB->set_active( rOpt.IsLoadWordBasicCode() );
+ m_xWBasicCodeCB->set_active(officecfg::Office::Writer::Filter::Import::VBA::Load::get());
+ m_xWBasicCodeCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Load::isReadOnly());
+ m_xWBasicCodeImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Load::isReadOnly());
m_xWBasicCodeCB->save_state();
- m_xWBasicWbctblCB->set_active( rOpt.IsLoadWordBasicExecutable() );
+ m_xWBasicWbctblCB->set_active(officecfg::Office::Writer::Filter::Import::VBA::Executable::get());
+ m_xWBasicWbctblCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
+ m_xWBasicWbctblImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
m_xWBasicWbctblCB->save_state();
- m_xWBasicStgCB->set_active( rOpt.IsLoadWordBasicStorage() );
+ m_xWBasicStgCB->set_active(officecfg::Office::Writer::Filter::Import::VBA::Save::get());
+ m_xWBasicStgCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Save::isReadOnly());
+ m_xWBasicStgImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Save::isReadOnly());
m_xWBasicStgCB->save_state();
LoadWordBasicCheckHdl_Impl( *m_xWBasicCodeCB );
- m_xEBasicCodeCB->set_active( rOpt.IsLoadExcelBasicCode() );
+ m_xEBasicCodeCB->set_active(officecfg::Office::Calc::Filter::Import::VBA::Load::get());
+ m_xEBasicCodeCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Load::isReadOnly());
+ m_xEBasicCodeImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Load::isReadOnly());
m_xEBasicCodeCB->save_state();
- m_xEBasicExectblCB->set_active( rOpt.IsLoadExcelBasicExecutable() );
+ m_xEBasicExectblCB->set_active(officecfg::Office::Calc::Filter::Import::VBA::Executable::get());
+ m_xEBasicExectblCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
+ m_xEBasicExectblImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
m_xEBasicExectblCB->save_state();
- m_xEBasicStgCB->set_active( rOpt.IsLoadExcelBasicStorage() );
+ m_xEBasicStgCB->set_active(officecfg::Office::Calc::Filter::Import::VBA::Save::get());
+ m_xEBasicStgCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Save::isReadOnly());
+ m_xEBasicStgImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Save::isReadOnly());
m_xEBasicStgCB->save_state();
LoadExcelBasicCheckHdl_Impl( *m_xEBasicCodeCB );
- m_xPBasicCodeCB->set_active( rOpt.IsLoadPPointBasicCode() );
+ m_xPBasicCodeCB->set_active(officecfg::Office::Impress::Filter::Import::VBA::Load::get());
+ m_xPBasicCodeCB->set_sensitive(!officecfg::Office::Impress::Filter::Import::VBA::Load::isReadOnly());
+ m_xPBasicCodeImg->set_visible(officecfg::Office::Impress::Filter::Import::VBA::Load::isReadOnly());
m_xPBasicCodeCB->save_state();
- m_xPBasicStgCB->set_active( rOpt.IsLoadPPointBasicStorage() );
+ m_xPBasicStgCB->set_active(officecfg::Office::Impress::Filter::Import::VBA::Save::get());
+ m_xPBasicStgCB->set_sensitive(!officecfg::Office::Impress::Filter::Import::VBA::Save::isReadOnly());
+ m_xPBasicStgImg->set_visible(officecfg::Office::Impress::Filter::Import::VBA::Save::isReadOnly());
m_xPBasicStgCB->save_state();
}
OfaMSFilterTabPage2::OfaMSFilterTabPage2(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optfltrembedpage.ui", "OptFilterPage", &rSet)
- , sChgToFromMath(CuiResId(RID_SVXSTR_CHG_MATH))
- , sChgToFromWriter(CuiResId(RID_SVXSTR_CHG_WRITER))
- , sChgToFromCalc(CuiResId(RID_SVXSTR_CHG_CALC))
- , sChgToFromImpress(CuiResId(RID_SVXSTR_CHG_IMPRESS))
- , sChgToFromSmartArt(CuiResId(RID_SVXSTR_CHG_SMARTART))
- , sChgToFromVisio(CuiResId(RID_SVXSTR_CHG_VISIO))
- , sChgToFromPDF(CuiResId(RID_SVXSTR_CHG_PDF))
+ , sChgToFromMath(CuiResId(RID_CUISTR_CHG_MATH))
+ , sChgToFromWriter(CuiResId(RID_CUISTR_CHG_WRITER))
+ , sChgToFromCalc(CuiResId(RID_CUISTR_CHG_CALC))
+ , sChgToFromImpress(CuiResId(RID_CUISTR_CHG_IMPRESS))
+ , sChgToFromSmartArt(CuiResId(RID_CUISTR_CHG_SMARTART))
+ , sChgToFromVisio(CuiResId(RID_CUISTR_CHG_VISIO))
+ , sChgToFromPDF(CuiResId(RID_CUISTR_CHG_PDF))
, m_xCheckLB(m_xBuilder->weld_tree_view("checklbcontainer"))
+ , m_xHighlightingFT(m_xBuilder->weld_label("label5"))
, m_xHighlightingRB(m_xBuilder->weld_radio_button("highlighting"))
, m_xShadingRB(m_xBuilder->weld_radio_button("shading"))
+ , m_xShadingImg(m_xBuilder->weld_widget("lockbuttonbox1"))
, m_xMSOLockFileCB(m_xBuilder->weld_check_button("mso_lockfile"))
+ , m_xMSOLockFileImg(m_xBuilder->weld_widget("lockmso_lockfile"))
{
- std::vector<int> aWidths;
- aWidths.push_back(m_xCheckLB->get_checkbox_column_width());
- aWidths.push_back(m_xCheckLB->get_checkbox_column_width());
+ std::vector<int> aWidths
+ {
+ m_xCheckLB->get_checkbox_column_width(),
+ m_xCheckLB->get_checkbox_column_width()
+ };
m_xCheckLB->set_column_fixed_widths(aWidths);
}
@@ -153,87 +209,122 @@ std::unique_ptr<SfxTabPage> OfaMSFilterTabPage2::Create( weld::Container* pPage,
return std::make_unique<OfaMSFilterTabPage2>( pPage, pController, *rAttrSet );
}
+OUString OfaMSFilterTabPage2::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3", "label4", "label5", "label6" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString radioButton[] = { "highlighting", "shading" };
+
+ for (const auto& radio : radioButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xMSOLockFileCB->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
+namespace
+{
+struct Functions
+{
+ bool (*FnIs)(css::uno::Reference<css::uno::XComponentContext> const &);
+ bool (*FnIsReadOnly)(css::uno::Reference<css::uno::XComponentContext> const &);
+ void (*FnSet)(const bool& bFlag, const std::shared_ptr<comphelper::ConfigurationChanges>&);
+ template <class reg> static constexpr Functions fromReg()
+ {
+ return { reg::get, reg::isReadOnly, reg::set };
+ }
+};
+struct ChkCBoxPair
+{
+ MSFltrPg2_CheckBoxEntries eType;
+ Functions load;
+ Functions save;
+};
+template <class regLoad, class regSave> constexpr ChkCBoxPair Pair(MSFltrPg2_CheckBoxEntries eType)
+{
+ return { eType, Functions::fromReg<regLoad>(), Functions::fromReg<regSave>() };
+}
+template <class regLoad> constexpr ChkCBoxPair Load(MSFltrPg2_CheckBoxEntries eType)
+{
+ return { eType, Functions::fromReg<regLoad>(), {} };
+}
+constexpr ChkCBoxPair aChkArr[] = {
+ Pair<officecfg::Office::Common::Filter::Microsoft::Import::MathTypeToMath,
+ officecfg::Office::Common::Filter::Microsoft::Export::MathToMathType>(
+ MSFltrPg2_CheckBoxEntries::Math),
+ Pair<officecfg::Office::Common::Filter::Microsoft::Import::WinWordToWriter,
+ officecfg::Office::Common::Filter::Microsoft::Export::WriterToWinWord>(
+ MSFltrPg2_CheckBoxEntries::Writer),
+ Pair<officecfg::Office::Common::Filter::Microsoft::Import::ExcelToCalc,
+ officecfg::Office::Common::Filter::Microsoft::Export::CalcToExcel>(
+ MSFltrPg2_CheckBoxEntries::Calc),
+ Pair<officecfg::Office::Common::Filter::Microsoft::Import::PowerPointToImpress,
+ officecfg::Office::Common::Filter::Microsoft::Export::ImpressToPowerPoint>(
+ MSFltrPg2_CheckBoxEntries::Impress),
+ Load<officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes>(
+ MSFltrPg2_CheckBoxEntries::SmartArt),
+ Load<officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw>(
+ MSFltrPg2_CheckBoxEntries::Visio),
+ Load<officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw>(
+ MSFltrPg2_CheckBoxEntries::PDF),
+};
+}
+
bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* )
{
- SvtFilterOptions& rOpt = SvtFilterOptions::Get();
-
- static struct ChkCBoxEntries{
- MSFltrPg2_CheckBoxEntries eType;
- bool (SvtFilterOptions::*FnIs)() const;
- void (SvtFilterOptions::*FnSet)( bool bFlag );
- } const aChkArr[] = {
- { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMathType2Math,
- &SvtFilterOptions::SetMathType2Math },
- { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMath2MathType,
- &SvtFilterOptions::SetMath2MathType },
- { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWinWord2Writer,
- &SvtFilterOptions::SetWinWord2Writer },
- { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWriter2WinWord,
- &SvtFilterOptions::SetWriter2WinWord },
- { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsExcel2Calc,
- &SvtFilterOptions::SetExcel2Calc },
- { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsCalc2Excel,
- &SvtFilterOptions::SetCalc2Excel },
- { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsPowerPoint2Impress,
- &SvtFilterOptions::SetPowerPoint2Impress },
- { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsImpress2PowerPoint,
- &SvtFilterOptions::SetImpress2PowerPoint },
- { MSFltrPg2_CheckBoxEntries::SmartArt, &SvtFilterOptions::IsSmartArt2Shape,
- &SvtFilterOptions::SetSmartArt2Shape },
- { MSFltrPg2_CheckBoxEntries::Visio, &SvtFilterOptions::IsVisio2Draw,
- &SvtFilterOptions::SetVisio2Draw },
- };
- bool bFirstCol = true;
- for( const ChkCBoxEntries & rEntry : aChkArr )
+ auto pBatch = comphelper::ConfigurationChanges::create();
+ for (const ChkCBoxPair& rEntry : aChkArr)
{
// we loop through the list, alternating reading the first/second column,
// each row appears twice in the list (except for smartart and later entries, which are
// import only)
- sal_uInt16 nCol = bFirstCol ? 0 : 1;
- bFirstCol = !bFirstCol;
int nEntry = GetEntry4Type(rEntry.eType);
if (nEntry != -1)
{
- bool bCheck = m_xCheckLB->get_toggle(nEntry, nCol);
- if( bCheck != (rOpt.*rEntry.FnIs)() )
- (rOpt.*rEntry.FnSet)( bCheck );
- }
- if (rEntry.eType == MSFltrPg2_CheckBoxEntries::SmartArt)
- {
- bFirstCol = !bFirstCol;
+ bool bCheck = m_xCheckLB->get_toggle(nEntry, 0);
+ if (bCheck != (rEntry.load.FnIs)(css::uno::Reference<css::uno::XComponentContext>()))
+ (rEntry.load.FnSet)(bCheck, pBatch);
+
+ if (rEntry.save.FnIs)
+ {
+ bCheck = m_xCheckLB->get_toggle(nEntry, 1);
+ if (bCheck != (rEntry.save.FnIs)(
+ css::uno::Reference<css::uno::XComponentContext>()))
+ (rEntry.save.FnSet)(bCheck, pBatch);
+ }
}
}
- int nPDFEntry = GetEntry4Type(MSFltrPg2_CheckBoxEntries::PDF);
- bool bPDFCheck = m_xCheckLB->get_toggle(nPDFEntry, 0);
- if (bPDFCheck != officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::get())
- {
- std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
- comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::set(bPDFCheck, pBatch);
- pBatch->commit();
- }
if( m_xHighlightingRB->get_state_changed_from_saved() )
{
- if (m_xHighlightingRB->get_active())
- rOpt.SetCharBackground2Highlighting();
- else
- rOpt.SetCharBackground2Shading();
+ officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(
+ m_xHighlightingRB->get_active(), pBatch);
}
if (m_xMSOLockFileCB->get_state_changed_from_saved())
{
- rOpt.EnableMSOLockFileCreation(m_xMSOLockFileCB->get_active());
+ officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::set(
+ m_xMSOLockFileCB->get_active(), pBatch);
}
+ pBatch->commit();
return true;
}
void OfaMSFilterTabPage2::Reset( const SfxItemSet* )
{
- SvtFilterOptions& rOpt = SvtFilterOptions::Get();
-
m_xCheckLB->freeze();
m_xCheckLB->clear();
@@ -255,63 +346,51 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* )
InsertEntry(sChgToFromPDF, MSFltrPg2_CheckBoxEntries::PDF, false);
}
- static struct ChkCBoxEntries{
- MSFltrPg2_CheckBoxEntries eType;
- bool (SvtFilterOptions::*FnIs)() const;
- } const aChkArr[] = {
- { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMathType2Math },
- { MSFltrPg2_CheckBoxEntries::Math, &SvtFilterOptions::IsMath2MathType },
- { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWinWord2Writer },
- { MSFltrPg2_CheckBoxEntries::Writer, &SvtFilterOptions::IsWriter2WinWord },
- { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsExcel2Calc },
- { MSFltrPg2_CheckBoxEntries::Calc, &SvtFilterOptions::IsCalc2Excel },
- { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsPowerPoint2Impress },
- { MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsImpress2PowerPoint },
- { MSFltrPg2_CheckBoxEntries::SmartArt, &SvtFilterOptions::IsSmartArt2Shape },
- { MSFltrPg2_CheckBoxEntries::Visio, &SvtFilterOptions::IsVisio2Draw },
- { MSFltrPg2_CheckBoxEntries::PDF, nullptr },
- };
-
- bool bFirstCol = true;
- for( const ChkCBoxEntries & rArr : aChkArr )
+ for (const ChkCBoxPair& rArr : aChkArr)
{
// we loop through the list, alternating reading the first/second column,
// each row appears twice in the list (except for smartart and later entries, which are
// import only)
- sal_uInt16 nCol = bFirstCol ? 0 : 1;
- bFirstCol = !bFirstCol;
int nEntry = GetEntry4Type( rArr.eType );
if (nEntry != -1)
{
- bool bCheck = false;
- if (rArr.eType != MSFltrPg2_CheckBoxEntries::PDF)
- {
- bCheck = (rOpt.*rArr.FnIs)();
- }
- else
+ bool bCheck = (rArr.load.FnIs)(css::uno::Reference<css::uno::XComponentContext>());
+ bool bReadOnly = (rArr.load.FnIsReadOnly)(
+ css::uno::Reference<css::uno::XComponentContext>());
+ m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ m_xCheckLB->set_sensitive(nEntry, !bReadOnly, 0);
+
+ if (rArr.save.FnIs)
{
- bCheck = officecfg::Office::Common::Filter::Adobe::Import::PDFToDraw::get();
- nCol = 0;
+ bCheck = (rArr.save.FnIs)(css::uno::Reference<css::uno::XComponentContext>());
+ bReadOnly = (rArr.save.FnIsReadOnly)(
+ css::uno::Reference<css::uno::XComponentContext>());
+ m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, 1);
+ m_xCheckLB->set_sensitive(nEntry, !bReadOnly, 1);
}
- m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, nCol);
- }
- if (rArr.eType == MSFltrPg2_CheckBoxEntries::SmartArt)
- {
- bFirstCol = !bFirstCol;
}
}
m_xCheckLB->thaw();
- if (rOpt.IsCharBackground2Highlighting())
+ if (officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::get())
m_xHighlightingRB->set_active(true);
else
m_xShadingRB->set_active(true);
+ if (officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::isReadOnly())
+ {
+ m_xHighlightingRB->set_sensitive(false);
+ m_xShadingRB->set_sensitive(false);
+ m_xHighlightingFT->set_sensitive(false);
+ m_xShadingImg->set_visible(true);
+ }
+
m_xHighlightingRB->save_state();
- m_xMSOLockFileCB->set_active(rOpt.IsMSOLockFileCreationIsEnabled());
+ m_xMSOLockFileCB->set_active(officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::get());
m_xMSOLockFileCB->save_state();
m_xMSOLockFileCB->set_sensitive(!officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::isReadOnly());
+ m_xMSOLockFileImg->set_visible(officecfg::Office::Common::Filter::Microsoft::Import::CreateMSOLockFiles::isReadOnly());
}
void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, MSFltrPg2_CheckBoxEntries _nType )
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
index 061636295848..51a51ec04456 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -23,16 +23,24 @@
class OfaMSFilterTabPage : public SfxTabPage
{
std::unique_ptr<weld::CheckButton> m_xWBasicCodeCB;
+ std::unique_ptr<weld::Widget> m_xWBasicCodeImg;
std::unique_ptr<weld::CheckButton> m_xWBasicWbctblCB;
+ std::unique_ptr<weld::Widget> m_xWBasicWbctblImg;
std::unique_ptr<weld::CheckButton> m_xWBasicStgCB;
+ std::unique_ptr<weld::Widget> m_xWBasicStgImg;
std::unique_ptr<weld::CheckButton> m_xEBasicCodeCB;
+ std::unique_ptr<weld::Widget> m_xEBasicCodeImg;
std::unique_ptr<weld::CheckButton> m_xEBasicExectblCB;
+ std::unique_ptr<weld::Widget> m_xEBasicExectblImg;
std::unique_ptr<weld::CheckButton> m_xEBasicStgCB;
+ std::unique_ptr<weld::Widget> m_xEBasicStgImg;
std::unique_ptr<weld::CheckButton> m_xPBasicCodeCB;
+ std::unique_ptr<weld::Widget> m_xPBasicCodeImg;
std::unique_ptr<weld::CheckButton> m_xPBasicStgCB;
+ std::unique_ptr<weld::Widget> m_xPBasicStgImg;
- DECL_LINK(LoadWordBasicCheckHdl_Impl, weld::Button&, void);
- DECL_LINK(LoadExcelBasicCheckHdl_Impl, weld::Button&, void);
+ DECL_LINK(LoadWordBasicCheckHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(LoadExcelBasicCheckHdl_Impl, weld::Toggleable&, void);
public:
OfaMSFilterTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet );
virtual ~OfaMSFilterTabPage() override;
@@ -40,6 +48,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
@@ -57,9 +67,12 @@ class OfaMSFilterTabPage2 : public SfxTabPage
sChgToFromPDF;
std::unique_ptr<weld::TreeView> m_xCheckLB;
+ std::unique_ptr<weld::Label> m_xHighlightingFT;
std::unique_ptr<weld::RadioButton> m_xHighlightingRB;
std::unique_ptr<weld::RadioButton> m_xShadingRB;
+ std::unique_ptr<weld::Widget> m_xShadingImg;
std::unique_ptr<weld::CheckButton> m_xMSOLockFileCB;
+ std::unique_ptr<weld::Widget> m_xMSOLockFileImg;
void InsertEntry( const OUString& _rTxt, MSFltrPg2_CheckBoxEntries _nType );
void InsertEntry( const OUString& _rTxt, MSFltrPg2_CheckBoxEntries _nType,
@@ -71,6 +84,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
virtual ~OfaMSFilterTabPage2() override;
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index f15171e38103..1b8e6f58fde7 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -18,7 +18,7 @@
*/
#include <config_features.h>
-#include <config_vclplug.h>
+#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
#include <svl/currencytable.hxx>
#include <svtools/langhelp.hxx>
@@ -31,12 +31,14 @@
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <unotools/compatibility.hxx>
-#include <svtools/menuoptions.hxx>
#include <svl/languageoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <svtools/miscopt.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <sfx2/objsh.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <svtools/langtab.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/langitem.hxx>
@@ -46,13 +48,14 @@
#include <editeng/editids.hrc>
#include <svx/svxids.hrc>
#include <svl/intitem.hxx>
-#include <svtools/helpopt.hxx>
+#include <svl/voiditem.hxx>
+#include <GraphicsTestsDialog.hxx>
#include <unotools/searchopt.hxx>
#include <sal/log.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Setup.hxx>
#include <comphelper/configuration.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#if HAVE_FEATURE_BREAKPAD
#include <desktop/crashreport.hxx>
#endif
@@ -79,17 +82,19 @@
#include <vcl/window.hxx>
#include <vcl/IconThemeInfo.hxx>
#include <vcl/skia/SkiaHelper.hxx>
+#include <bitmaps.hlst>
+
#include "optgdlg.hxx"
#include <svtools/apearcfg.hxx>
#include <svtools/optionsdrawinglayer.hxx>
#include <svtools/restartdialog.hxx>
#include <svtools/imgdef.hxx>
+#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
+#include <vcl/unohelp2.hxx>
#if defined(_WIN32)
-#include <o3tl/char16_t2wchar_t.hxx>
-#include <prewin.h>
-#include <shobjidl.h>
-#include <postwin.h>
+#include <systools/win32/winstoreutil.hxx>
+#include <vcl/fileregistration.hxx>
#endif
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -155,55 +160,46 @@ bool lcl_HasSystemFilePicker()
OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optgeneralpage.ui", "OptGeneralPage", &rSet)
, m_xExtHelpCB(m_xBuilder->weld_check_button("exthelp"))
+ , m_xExtHelpImg(m_xBuilder->weld_widget("lockexthelp"))
, m_xPopUpNoHelpCB(m_xBuilder->weld_check_button("popupnohelp"))
+ , m_xPopUpNoHelpImg(m_xBuilder->weld_widget("lockpopupnohelp"))
, m_xShowTipOfTheDay(m_xBuilder->weld_check_button("cbShowTipOfTheDay"))
+ , m_xShowTipOfTheDayImg(m_xBuilder->weld_widget("lockcbShowTipOfTheDay"))
, m_xFileDlgFrame(m_xBuilder->weld_widget("filedlgframe"))
- , m_xPrintDlgFrame(m_xBuilder->weld_widget("printdlgframe"))
, m_xFileDlgROImage(m_xBuilder->weld_widget("lockimage"))
, m_xFileDlgCB(m_xBuilder->weld_check_button("filedlg"))
- , m_xPrintDlgCB(m_xBuilder->weld_check_button("printdlg"))
, m_xDocStatusCB(m_xBuilder->weld_check_button("docstatus"))
+ , m_xDocStatusImg(m_xBuilder->weld_widget("lockdocstatus"))
, m_xYearFrame(m_xBuilder->weld_widget("yearframe"))
+ , m_xYearLabel(m_xBuilder->weld_label("yearslabel"))
, m_xYearValueField(m_xBuilder->weld_spin_button("year"))
, m_xToYearFT(m_xBuilder->weld_label("toyear"))
- , m_xCollectUsageInfo(m_xBuilder->weld_check_button("collectusageinfo"))
+ , m_xYearFrameImg(m_xBuilder->weld_widget("lockyears"))
+#if HAVE_FEATURE_BREAKPAD
+ , m_xPrivacyFrame(m_xBuilder->weld_widget("privacyframe"))
, m_xCrashReport(m_xBuilder->weld_check_button("crashreport"))
- , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
-#if defined(UNX)
- , m_xQuickLaunchCB(m_xBuilder->weld_check_button("systray"))
-#else
- , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
+ , m_xCrashReportImg(m_xBuilder->weld_widget("lockcrashreport"))
#endif
#if defined(_WIN32)
+ , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
+ , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
+ , m_xQuickLaunchImg(m_xBuilder->weld_widget("lockquicklaunch"))
, m_xFileAssocFrame(m_xBuilder->weld_widget("fileassoc"))
, m_xFileAssocBtn(m_xBuilder->weld_button("assocfiles"))
+ , m_xPerformFileExtCheck(m_xBuilder->weld_check_button("cbPerformFileExtCheck"))
+ , m_xPerformFileExtImg(m_xBuilder->weld_widget("lockcbPerformFileExtCheck"))
#endif
{
- if (!lcl_HasSystemFilePicker())
- m_xFileDlgFrame->hide();
- else if (officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly())
- {
- m_xFileDlgROImage->show();
- m_xFileDlgCB->set_sensitive(false);
- }
-
-#if !ENABLE_GTK3
- m_xPrintDlgFrame->hide();
-#else
- if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
- {
- m_xPrintDlgFrame->hide();
- }
-#endif
-
- m_xQuickLaunchCB->show();
-
- //Only available in Win or if building the gtk systray
-#if !defined(_WIN32)
- m_xQuickStarterFrame->hide();
+#if HAVE_FEATURE_BREAKPAD
+ m_xPrivacyFrame->show();
#endif
#if defined(_WIN32)
+ // Store-packaged apps (located under the protected Program Files\WindowsApps) can't use normal
+ // shell shortcuts to their exe. TODO: show a button to open "Startup Apps" system applet?
+ if (!sal::systools::IsStorePackagedApp())
+ m_xQuickStarterFrame->show();
+
m_xFileAssocFrame->show();
m_xFileAssocBtn->connect_clicked(LINK(this, OfaMiscTabPage, FileAssocClick));
#endif
@@ -223,17 +219,44 @@ std::unique_ptr<SfxTabPage> OfaMiscTabPage::Create( weld::Container* pPage, weld
return std::make_unique<OfaMiscTabPage>( pPage, pController, *rAttrSet );
}
+OUString OfaMiscTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label4", "label5", "yearslabel",
+ "toyear", "label7", "label8", "label9" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[]
+ = { "exthelp", "popupnohelp", "cbShowTipOfTheDay", "filedlg",
+ "docstatus", "crashreport", "quicklaunch", "cbPerformFileExtCheck" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_button("assocfiles"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
{
bool bModified = false;
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- SvtHelpOptions aHelpOptions;
if ( m_xPopUpNoHelpCB->get_state_changed_from_saved() )
- aHelpOptions.SetOfflineHelpPopUp( m_xPopUpNoHelpCB->get_active() );
+ officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(m_xPopUpNoHelpCB->get_active(), batch);
if ( m_xExtHelpCB->get_state_changed_from_saved() )
- aHelpOptions.SetExtendedHelp( m_xExtHelpCB->get_active() );
+ officecfg::Office::Common::Help::ExtendedTip::set(m_xExtHelpCB->get_active(), batch);
if ( m_xShowTipOfTheDay->get_state_changed_from_saved() )
{
@@ -243,19 +266,7 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
if ( m_xFileDlgCB->get_state_changed_from_saved() )
{
- std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
- comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::UseSystemFileDialog::set( !m_xFileDlgCB->get_active(), xChanges );
- xChanges->commit();
- bModified = true;
- }
-
- if ( m_xPrintDlgCB->get_state_changed_from_saved() )
- {
- std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
- comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::UseSystemPrintDialog::set( !m_xPrintDlgCB->get_active(), xChanges );
- xChanges->commit();
+ officecfg::Office::Common::Misc::UseSystemFileDialog::set( !m_xFileDlgCB->get_active(), batch );
bModified = true;
}
@@ -265,7 +276,7 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
bModified = true;
}
- const SfxUInt16Item* pUInt16Item = dynamic_cast< const SfxUInt16Item* >( GetOldItem( *rSet, SID_ATTR_YEAR2000 ) );
+ const SfxUInt16Item* pUInt16Item = GetOldItem( *rSet, SID_ATTR_YEAR2000 );
sal_uInt16 nNum = static_cast<sal_uInt16>(m_xYearValueField->get_text().toInt32());
if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
{
@@ -273,12 +284,6 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
rSet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) );
}
- if (m_xCollectUsageInfo->get_state_changed_from_saved())
- {
- officecfg::Office::Common::Misc::CollectUsageInformation::set(m_xCollectUsageInfo->get_active(), batch);
- bModified = true;
- }
-
#if HAVE_FEATURE_BREAKPAD
if (m_xCrashReport->get_state_changed_from_saved())
{
@@ -287,55 +292,87 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
}
#endif
- batch->commit();
+#if defined(_WIN32)
+ if (m_xPerformFileExtCheck->get_state_changed_from_saved())
+ {
+ officecfg::Office::Common::Misc::PerformFileExtCheck::set(
+ m_xPerformFileExtCheck->get_active(), batch);
+ bModified = true;
+ }
if( m_xQuickLaunchCB->get_state_changed_from_saved())
{
rSet->Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, m_xQuickLaunchCB->get_active()));
bModified = true;
}
+#endif
+
+ batch->commit();
return bModified;
}
void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
{
- SvtHelpOptions aHelpOptions;
- m_xExtHelpCB->set_active( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() );
+ bool bEnable = !officecfg::Office::Common::Help::ExtendedTip::isReadOnly();
+ m_xExtHelpCB->set_active( officecfg::Office::Common::Help::Tip::get() &&
+ officecfg::Office::Common::Help::ExtendedTip::get() );
+ m_xExtHelpCB->set_sensitive(bEnable);
+ m_xExtHelpImg->set_visible(!bEnable);
m_xExtHelpCB->save_state();
- m_xPopUpNoHelpCB->set_active( aHelpOptions.IsOfflineHelpPopUp() );
+
+ bEnable = !officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::isReadOnly();
+ m_xPopUpNoHelpCB->set_active( officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get() );
+ m_xPopUpNoHelpCB->set_sensitive(bEnable);
+ m_xPopUpNoHelpImg->set_visible(!bEnable);
m_xPopUpNoHelpCB->save_state();
+
+ bEnable = !officecfg::Office::Common::Misc::ShowTipOfTheDay::isReadOnly();
m_xShowTipOfTheDay->set_active( officecfg::Office::Common::Misc::ShowTipOfTheDay::get() );
+ m_xShowTipOfTheDay->set_sensitive(bEnable);
+ m_xShowTipOfTheDayImg->set_visible(!bEnable);
m_xShowTipOfTheDay->save_state();
- m_xFileDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemFileDialog::get() );
+
+ if (!lcl_HasSystemFilePicker())
+ m_xFileDlgFrame->hide();
+ else
+ {
+ bEnable = !officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly();
+ m_xFileDlgCB->set_sensitive(bEnable);
+ m_xFileDlgROImage->set_visible(!bEnable);
+ }
+ m_xFileDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemFileDialog::get());
m_xFileDlgCB->save_state();
- m_xPrintDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemPrintDialog::get() );
- m_xPrintDlgCB->save_state();
+ bEnable = !officecfg::Office::Common::Print::PrintingModifiesDocument::isReadOnly();
m_xDocStatusCB->set_active(officecfg::Office::Common::Print::PrintingModifiesDocument::get());
+ m_xDocStatusCB->set_sensitive(bEnable);
+ m_xDocStatusImg->set_visible(!bEnable);
m_xDocStatusCB->save_state();
- const SfxPoolItem* pItem = nullptr;
- if ( SfxItemState::SET == rSet->GetItemState( SID_ATTR_YEAR2000, false, &pItem ) )
+ bEnable = !officecfg::Office::Common::DateFormat::TwoDigitYear::isReadOnly();
+ m_xYearLabel->set_sensitive(bEnable);
+ m_xYearValueField->set_sensitive(bEnable);
+ m_xToYearFT->set_sensitive(bEnable);
+ m_xYearFrameImg->set_visible(!bEnable);
+
+ if ( const SfxUInt16Item* pYearItem = rSet->GetItemIfSet( SID_ATTR_YEAR2000, false ) )
{
- m_xYearValueField->set_value( static_cast<const SfxUInt16Item*>(pItem)->GetValue() );
+ m_xYearValueField->set_value( pYearItem->GetValue() );
TwoFigureHdl(*m_xYearValueField);
}
else
m_xYearFrame->set_sensitive(false);
- m_xCollectUsageInfo->set_active(officecfg::Office::Common::Misc::CollectUsageInformation::get());
- m_xCollectUsageInfo->set_sensitive(!officecfg::Office::Common::Misc::CollectUsageInformation::isReadOnly());
- m_xCollectUsageInfo->save_state();
-
#if HAVE_FEATURE_BREAKPAD
m_xCrashReport->set_active(officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::IsDumpEnable());
m_xCrashReport->set_sensitive(!officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable());
+ m_xCrashReportImg->set_visible(officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable());
m_xCrashReport->save_state();
-#else
- m_xCrashReport->hide();
#endif
+#if defined(_WIN32)
+ const SfxPoolItem* pItem = nullptr;
SfxItemState eState = rSet->GetItemState( SID_ATTR_QUICKLAUNCHER, false, &pItem );
if ( SfxItemState::SET == eState )
m_xQuickLaunchCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
@@ -346,6 +383,13 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
}
m_xQuickLaunchCB->save_state();
+
+ m_xPerformFileExtCheck->set_active(
+ officecfg::Office::Common::Misc::PerformFileExtCheck::get());
+ m_xPerformFileExtCheck->save_state();
+ m_xPerformFileExtCheck->set_sensitive(!officecfg::Office::Common::Misc::PerformFileExtCheck::isReadOnly());
+ m_xPerformFileExtImg->set_visible(officecfg::Office::Common::Misc::PerformFileExtCheck::isReadOnly());
+#endif
}
IMPL_LINK_NOARG( OfaMiscTabPage, TwoFigureHdl, weld::SpinButton&, void )
@@ -366,24 +410,7 @@ IMPL_LINK_NOARG( OfaMiscTabPage, TwoFigureHdl, weld::SpinButton&, void )
#if defined(_WIN32)
IMPL_STATIC_LINK_NOARG(OfaMiscTabPage, FileAssocClick, weld::Button&, void)
{
- const bool bUninit = SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED));
- IApplicationAssociationRegistrationUI* pIf = nullptr;
- HRESULT res = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI, nullptr,
- CLSCTX_INPROC_SERVER, IID_IApplicationAssociationRegistrationUI,
- reinterpret_cast<LPVOID*>(&pIf));
-
- if (SUCCEEDED(res) && pIf)
- {
- // LaunchAdvancedAssociationUI only works for applications registered under
- // Software\RegisteredApplications. See scp2/source/ooo/registryitem_ooo.scp
- const OUString expanded = Translate::ExpandVariables("%PRODUCTNAME %PRODUCTVERSION");
- // This will only show "To change your default apps, go to Settings > Apps > Default apps"
- // on Win10; this is expected. At least this will self-document it to users.
- pIf->LaunchAdvancedAssociationUI(o3tl::toW(expanded.getStr()));
- pIf->Release();
- }
- if (bUninit)
- CoUninitialize();
+ vcl::fileregistration::LaunchRegistrationUI();
}
#endif
@@ -407,7 +434,6 @@ private:
};
CanvasSettings::CanvasSettings() :
- mxForceFlagNameAccess(),
mbHWAccelAvailable(false),
mbHWAccelChecked(false)
{
@@ -559,39 +585,69 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, nSidebarSizeLB_InitialSelection(0)
, nNotebookbarSizeLB_InitialSelection(0)
, nStyleLB_InitialSelection(0)
- , pAppearanceCfg(new SvtTabAppearanceCfg)
, pCanvasSettings(new CanvasSettings)
- , mpDrawinglayerOpt(new SvtOptionsDrawinglayer)
+ , m_xIconSizeLabel(m_xBuilder->weld_label("label14"))
, m_xIconSizeLB(m_xBuilder->weld_combo_box("iconsize"))
+ , m_xIconSizeImg(m_xBuilder->weld_widget("lockiconsize"))
+ , m_xSidebarIconSizeLabel(m_xBuilder->weld_label("label9"))
, m_xSidebarIconSizeLB(m_xBuilder->weld_combo_box("sidebariconsize"))
+ , m_xSidebarIconSizeImg(m_xBuilder->weld_widget("locksidebariconsize"))
+ , m_xNotebookbarIconSizeLabel(m_xBuilder->weld_label("label8"))
, m_xNotebookbarIconSizeLB(m_xBuilder->weld_combo_box("notebookbariconsize"))
+ , m_xNotebookbarIconSizeImg(m_xBuilder->weld_widget("locknotebookbariconsize"))
+ , m_xDarkModeFrame(m_xBuilder->weld_widget("darkmode"))
+ , m_xAppearanceStyleLabel(m_xBuilder->weld_label("label7"))
+ , m_xAppearanceStyleLB(m_xBuilder->weld_combo_box("appearance"))
+ , m_xAppearanceStyleImg(m_xBuilder->weld_widget("lockappearance"))
+ , m_xIconStyleLabel(m_xBuilder->weld_label("label6"))
, m_xIconStyleLB(m_xBuilder->weld_combo_box("iconstyle"))
+ , m_xIconStyleImg(m_xBuilder->weld_widget("lockiconstyle"))
, m_xFontAntiAliasing(m_xBuilder->weld_check_button("aafont"))
+ , m_xFontAntiAliasingImg(m_xBuilder->weld_widget("lockaafont"))
, m_xAAPointLimitLabel(m_xBuilder->weld_label("aafrom"))
+ , m_xAAPointLimitLabelImg(m_xBuilder->weld_widget("lockaafrom"))
, m_xAAPointLimit(m_xBuilder->weld_metric_spin_button("aanf", FieldUnit::PIXEL))
- , m_xMenuIconBox(m_xBuilder->weld_widget("menuiconsbox"))
- , m_xMenuIconsLB(m_xBuilder->weld_combo_box("menuicons"))
- , m_xContextMenuShortcutsLB(m_xBuilder->weld_combo_box("contextmenushortcuts"))
, m_xFontShowCB(m_xBuilder->weld_check_button("showfontpreview"))
+ , m_xFontShowImg(m_xBuilder->weld_widget("lockshowfontpreview"))
, m_xUseHardwareAccell(m_xBuilder->weld_check_button("useaccel"))
+ , m_xUseHardwareAccellImg(m_xBuilder->weld_widget("lockuseaccel"))
, m_xUseAntiAliase(m_xBuilder->weld_check_button("useaa"))
+ , m_xUseAntiAliaseImg(m_xBuilder->weld_widget("lockuseaa"))
, m_xUseSkia(m_xBuilder->weld_check_button("useskia"))
+ , m_xUseSkiaImg(m_xBuilder->weld_widget("lockuseskia"))
, m_xForceSkiaRaster(m_xBuilder->weld_check_button("forceskiaraster"))
+ , m_xForceSkiaRasterImg(m_xBuilder->weld_widget("lockforceskiaraster"))
, m_xSkiaStatusEnabled(m_xBuilder->weld_label("skiaenabled"))
, m_xSkiaStatusDisabled(m_xBuilder->weld_label("skiadisabled"))
- , m_xMousePosLB(m_xBuilder->weld_combo_box("mousepos"))
+ , m_xSkiaLog(m_xBuilder->weld_button("btnSkialog"))
+ , m_xMouseMiddleLabel(m_xBuilder->weld_label("label12"))
, m_xMouseMiddleLB(m_xBuilder->weld_combo_box("mousemiddle"))
+ , m_xMouseMiddleImg(m_xBuilder->weld_widget("lockmousemiddle"))
, m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
+ , m_xRunGPTests(m_xBuilder->weld_button("btn_rungptest"))
+ , m_sAutoStr(m_xIconStyleLB->get_text(0))
{
- if (Application::GetToolkitName() == "gtk3")
- m_xMenuIconBox->hide();
+ OUString sToolKitName(Application::GetToolkitName());
+ const bool bHasDarkMode = sToolKitName.startsWith("gtk") || sToolKitName == "osx" || sToolKitName == "win";
+ if (!bHasDarkMode)
+ m_xDarkModeFrame->hide();
m_xFontAntiAliasing->connect_toggled( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
m_xUseSkia->connect_toggled(LINK(this, OfaViewTabPage, OnUseSkiaToggled));
+ m_xSkiaLog->connect_clicked(LINK(this, OfaViewTabPage, OnCopySkiaLog));
+
+ UpdateIconThemes();
+
+ m_xIconStyleLB->set_active(0);
+ m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
+ m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
+}
+
+void OfaViewTabPage::UpdateIconThemes()
+{
// Set known icon themes
- OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) );
m_xIconStyleLB->clear();
StyleSettings aStyleSettings = Application::GetSettings().GetStyleSettings();
mInstalledIconThemes = aStyleSettings.GetInstalledIconThemes();
@@ -601,9 +657,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
OUString autoThemeId = aStyleSettings.GetAutomaticallyChosenIconTheme();
const vcl::IconThemeInfo& autoIconTheme = vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, autoThemeId);
- OUString entryForAuto = sAutoStr + " (" +
- autoIconTheme.GetDisplayName() +
- ")";
+ OUString entryForAuto = m_sAutoStr + " (" + autoIconTheme.GetDisplayName() + ")";
m_xIconStyleLB->append("auto", entryForAuto); // index 0 means choose style automatically
// separate auto and other icon themes
@@ -611,44 +665,57 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
for (auto const& installIconTheme : mInstalledIconThemes)
m_xIconStyleLB->append(installIconTheme.GetThemeId(), installIconTheme.GetDisplayName());
-
- m_xIconStyleLB->set_active(0);
-
- m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
- m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
}
OfaViewTabPage::~OfaViewTabPage()
{
}
+IMPL_LINK_NOARG(OfaViewTabPage, OnRunGPTestClick, weld::Button&, void)
+{
+ GraphicsTestsDialog m_xGraphicsTestDialog(m_xContainer.get());
+ m_xGraphicsTestDialog.run();
+}
+
IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void)
{
- css::uno::Sequence<css::beans::PropertyValue> aArgs(1);
- aArgs[0].Name = "AdditionsTag";
- aArgs[0].Value <<= OUString("Icons");
+ css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue(
+ "AdditionsTag", OUString("Icons")) };
comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs);
}
-IMPL_LINK_NOARG( OfaViewTabPage, OnAntialiasingToggled, weld::ToggleButton&, void )
+IMPL_LINK_NOARG( OfaViewTabPage, OnAntialiasingToggled, weld::Toggleable&, void )
{
- bool bAAEnabled = m_xFontAntiAliasing->get_active();
+ bool bAAEnabled = m_xFontAntiAliasing->get_active() && !officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::isReadOnly();
m_xAAPointLimitLabel->set_sensitive(bAAEnabled);
m_xAAPointLimit->set_sensitive(bAAEnabled);
}
-IMPL_LINK_NOARG(OfaViewTabPage, OnUseSkiaToggled, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(OfaViewTabPage, OnUseSkiaToggled, weld::Toggleable&, void)
{
UpdateSkiaStatus();
}
+IMPL_LINK_NOARG(OfaViewTabPage, OnCopySkiaLog, weld::Button&, void)
+{
+#if HAVE_FEATURE_SKIA
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
+ css::datatransfer::clipboard::SystemClipboard::create(
+ comphelper::getProcessComponentContext());
+ OUString sInfo = SkiaHelper::readLog();
+ vcl::unohelper::TextDataObject::CopyStringTo(sInfo, xClipboard);
+ m_xSkiaLog->set_from_icon_name(RID_SVXBMP_COPY);
+#endif
+}
+
void OfaViewTabPage::HideSkiaWidgets()
{
m_xUseSkia->hide();
m_xForceSkiaRaster->hide();
m_xSkiaStatusEnabled->hide();
m_xSkiaStatusDisabled->hide();
+ m_xSkiaLog->hide();
}
void OfaViewTabPage::UpdateSkiaStatus()
@@ -662,6 +729,9 @@ void OfaViewTabPage::UpdateSkiaStatus()
// It can also be used on Linux, but only with the rarely used 'gen' backend.
if (Application::GetToolkitName() == "x11")
skiaHidden = false;
+ // OSX backend has Skia support too.
+ if (Application::GetToolkitName() == "osx")
+ skiaHidden = false;
if (skiaHidden)
{
@@ -674,9 +744,11 @@ void OfaViewTabPage::UpdateSkiaStatus()
m_xSkiaStatusEnabled->set_visible(bEnabled);
m_xSkiaStatusDisabled->set_visible(!bEnabled);
- // FIXME: should really add code to show a 'lock' icon here.
m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
+ m_xUseSkiaImg->set_visible(officecfg::Office::Common::VCL::UseSkia::isReadOnly());
m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+ m_xForceSkiaRasterImg->set_visible(officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+ m_xSkiaLog->set_sensitive(bEnabled);
// Technically the 'use hardware acceleration' option could be used to mean !forceSkiaRaster, but the implementation
// of the option is so tied to the implementation of the canvas module that it's simpler to ignore it.
@@ -691,13 +763,39 @@ std::unique_ptr<SfxTabPage> OfaViewTabPage::Create( weld::Container* pPage, weld
return std::make_unique<OfaViewTabPage>(pPage, pController, *rAttrSet);
}
-bool OfaViewTabPage::FillItemSet( SfxItemSet* )
+OUString OfaViewTabPage::GetAllStrings()
{
- SvtMenuOptions aMenuOpt;
+ OUString sAllStrings;
+ OUString labels[] = { "label16", "label7", "label1", "label6", "label15",
+ "label14", "label8", "label9", "label4", "label12",
+ "label2", "skiaenabled", "skiadisabled", "label5", "aafrom" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[]
+ = { "useaccel", "useaa", "useskia", "forceskiaraster", "showfontpreview", "aafont" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xSkiaLog->get_label() + " " + m_xRunGPTests->get_label() + " ";
+ return sAllStrings.replaceAll("_", "");
+}
+
+bool OfaViewTabPage::FillItemSet( SfxItemSet* )
+{
bool bModified = false;
- bool bMenuOptModified = false;
+ bool bDarkModeOptModified = false;
bool bRepaintWindows(false);
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges(comphelper::ConfigurationChanges::create());
SvtMiscOptions aMiscOptions;
const sal_Int32 nSizeLB_NewSelection = m_xIconSizeLB->get_active();
@@ -712,7 +810,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break;
case 3: eSet = SFX_SYMBOLS_SIZE_32; break;
default:
- OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xIconSizeLB should not be possible!" );
+ SAL_WARN("cui.options", "OfaViewTabPage::FillItemSet(): This state of m_xIconSizeLB should not be possible!");
}
aMiscOptions.SetSymbolsSize( eSet );
}
@@ -728,9 +826,9 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
case 1: eSet = ToolBoxButtonSize::Small; break;
case 2: eSet = ToolBoxButtonSize::Large; break;
default:
- OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xSidebarIconSizeLB should not be possible!" );
+ SAL_WARN("cui.options", "OfaViewTabPage::FillItemSet(): This state of m_xSidebarIconSizeLB should not be possible!");
}
- aMiscOptions.SetSidebarIconSize( eSet );
+ officecfg::Office::Common::Misc::SidebarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
}
const sal_Int32 nNotebookbarSizeLB_NewSelection = m_xNotebookbarIconSizeLB->get_active();
@@ -744,9 +842,9 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
case 1: eSet = ToolBoxButtonSize::Small; break;
case 2: eSet = ToolBoxButtonSize::Large; break;
default:
- OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xNotebookbarIconSizeLB should not be possible!" );
+ SAL_WARN("cui.options", "OfaViewTabPage::FillItemSet(): This state of m_xNotebookbarIconSizeLB should not be possible!");
}
- aMiscOptions.SetNotebookbarIconSize( eSet );
+ officecfg::Office::Common::Misc::NotebookbarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
}
const sal_Int32 nStyleLB_NewSelection = m_xIconStyleLB->get_active();
@@ -757,69 +855,44 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
}
bool bAppearanceChanged = false;
-
- // Mouse Snap Mode
- SnapType eOldSnap = pAppearanceCfg->GetSnapMode();
- SnapType eNewSnap = static_cast<SnapType>(m_xMousePosLB->get_active());
- if(eNewSnap > SnapType::NONE)
- eNewSnap = SnapType::NONE;
-
- if ( eNewSnap != eOldSnap )
- {
- pAppearanceCfg->SetSnapMode(eNewSnap );
- bAppearanceChanged = true;
- }
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
// Middle Mouse Button
- MouseMiddleButtonAction eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton();
+ MouseMiddleButtonAction eOldMiddleMouse = static_cast<MouseMiddleButtonAction>(officecfg::Office::Common::View::Dialog::MiddleMouseButton::get());
short eNewMiddleMouse = m_xMouseMiddleLB->get_active();
if(eNewMiddleMouse > 2)
eNewMiddleMouse = 2;
if ( eNewMiddleMouse != static_cast<short>(eOldMiddleMouse) )
{
- pAppearanceCfg->SetMiddleMouseButton( static_cast<MouseMiddleButtonAction>(eNewMiddleMouse) );
+ officecfg::Office::Common::View::Dialog::MiddleMouseButton::set(eNewMiddleMouse, batch);
bAppearanceChanged = true;
}
if (m_xFontAntiAliasing->get_state_changed_from_saved())
{
- pAppearanceCfg->SetFontAntiAliasing(m_xFontAntiAliasing->get_active());
+ bool b = m_xFontAntiAliasing->get_active();
+ officecfg::Office::Common::View::FontAntiAliasing::Enabled::set(b, batch);
bAppearanceChanged = true;
}
if (m_xAAPointLimit->get_value_changed_from_saved())
{
- pAppearanceCfg->SetFontAntialiasingMinPixelHeight(m_xAAPointLimit->get_value(FieldUnit::PIXEL));
+ sal_Int64 i = m_xAAPointLimit->get_value(FieldUnit::PIXEL);
+ officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::set(i, batch);
bAppearanceChanged = true;
}
if (m_xFontShowCB->get_state_changed_from_saved())
{
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::set(m_xFontShowCB->get_active(), batch);
- batch->commit();
- bModified = true;
- }
-
- if (m_xMenuIconsLB->get_value_changed_from_saved())
- {
- aMenuOpt.SetMenuIconsState(m_xMenuIconsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xMenuIconsLB->get_active() - 1));
+ officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::set(m_xFontShowCB->get_active(), xChanges);
bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
}
- if (m_xContextMenuShortcutsLB->get_value_changed_from_saved())
+ if (m_xAppearanceStyleLB->get_value_changed_from_saved())
{
- aMenuOpt.SetContextMenuShortcuts(m_xContextMenuShortcutsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xContextMenuShortcutsLB->get_active() - 1));
+ bDarkModeOptModified = true;
bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
}
// #i95644# if disabled, do not use value, see in ::Reset()
@@ -835,9 +908,9 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
// #i95644# if disabled, do not use value, see in ::Reset()
if (m_xUseAntiAliase->get_sensitive())
{
- if (m_xUseAntiAliase->get_active() != mpDrawinglayerOpt->IsAntiAliasing())
+ if (m_xUseAntiAliase->get_active() != SvtOptionsDrawinglayer::IsAntiAliasing())
{
- mpDrawinglayerOpt->SetAntiAliasing(m_xUseAntiAliase->get_active());
+ SvtOptionsDrawinglayer::SetAntiAliasing(m_xUseAntiAliase->get_active(), /*bTemporary*/false);
bModified = true;
bRepaintWindows = true;
}
@@ -846,27 +919,20 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
if (m_xUseSkia->get_state_changed_from_saved() ||
m_xForceSkiaRaster->get_state_changed_from_saved())
{
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::VCL::UseSkia::set(m_xUseSkia->get_active(), batch);
- officecfg::Office::Common::VCL::ForceSkiaRaster::set(m_xForceSkiaRaster->get_active(), batch);
- batch->commit();
+ officecfg::Office::Common::VCL::UseSkia::set(m_xUseSkia->get_active(), xChanges);
+ officecfg::Office::Common::VCL::ForceSkiaRaster::set(m_xForceSkiaRaster->get_active(), xChanges);
bModified = true;
}
- if( bMenuOptModified )
- {
- // Set changed settings to the application instance
- AllSettings aAllSettings = Application::GetSettings();
- StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
- aAllSettings.SetStyleSettings(aStyleSettings);
- Application::MergeSystemSettings( aAllSettings );
- Application::SetSettings(aAllSettings);
- }
+ xChanges->commit();
+
+ if (bDarkModeOptModified)
+ MiscSettings::SetDarkMode(m_xAppearanceStyleLB->get_active());
if ( bAppearanceChanged )
{
- pAppearanceCfg->Commit();
- pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
+ batch->commit();
+ SvtTabAppearanceCfg::SetApplicationDefaults ( GetpApp() );
}
if(bRepaintWindows)
@@ -896,85 +962,127 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
void OfaViewTabPage::Reset( const SfxItemSet* )
{
SvtMiscOptions aMiscOptions;
+ bool bEnable = true;
- if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
+ if (SvtMiscOptions::GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
{
nSizeLB_InitialSelection = 1;
- if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
+ if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
nSizeLB_InitialSelection = 2;
- else if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
+ else if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
nSizeLB_InitialSelection = 3;
}
+ bEnable = !officecfg::Office::Common::Misc::SymbolSet::isReadOnly();
m_xIconSizeLB->set_active( nSizeLB_InitialSelection );
+ m_xIconSizeLabel->set_sensitive(bEnable);
+ m_xIconSizeLB->set_sensitive(bEnable);
+ m_xMoreIcons->set_sensitive(bEnable);
+ m_xIconSizeImg->set_visible(!bEnable);
m_xIconSizeLB->save_value();
- if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::DontCare )
+ ToolBoxButtonSize eSidebarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
+ if( eSidebarIconSize == ToolBoxButtonSize::DontCare )
; // do nothing
- else if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::Small )
+ else if( eSidebarIconSize == ToolBoxButtonSize::Small )
nSidebarSizeLB_InitialSelection = 1;
- else if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::Large )
+ else if( eSidebarIconSize == ToolBoxButtonSize::Large )
nSidebarSizeLB_InitialSelection = 2;
+
+ bEnable = !officecfg::Office::Common::Misc::SidebarIconSize::isReadOnly();
m_xSidebarIconSizeLB->set_active( nSidebarSizeLB_InitialSelection );
+ m_xSidebarIconSizeLabel->set_sensitive(bEnable);
+ m_xSidebarIconSizeLB->set_sensitive(bEnable);
+ m_xSidebarIconSizeImg->set_visible(!bEnable);
m_xSidebarIconSizeLB->save_value();
- if( aMiscOptions.GetNotebookbarIconSize() == ToolBoxButtonSize::DontCare )
+
+ ToolBoxButtonSize eNotebookbarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::NotebookbarIconSize::get());
+ if( eNotebookbarIconSize == ToolBoxButtonSize::DontCare )
; // do nothing
- else if( aMiscOptions.GetNotebookbarIconSize() == ToolBoxButtonSize::Small )
+ else if( eNotebookbarIconSize == ToolBoxButtonSize::Small )
nNotebookbarSizeLB_InitialSelection = 1;
- else if( aMiscOptions.GetNotebookbarIconSize() == ToolBoxButtonSize::Large )
+ else if( eNotebookbarIconSize == ToolBoxButtonSize::Large )
nNotebookbarSizeLB_InitialSelection = 2;
+
+ bEnable = !officecfg::Office::Common::Misc::NotebookbarIconSize::isReadOnly();
m_xNotebookbarIconSizeLB->set_active(nNotebookbarSizeLB_InitialSelection);
+ m_xNotebookbarIconSizeLabel->set_sensitive(bEnable);
+ m_xNotebookbarIconSizeLB->set_sensitive(bEnable);
+ m_xNotebookbarIconSizeImg->set_visible(!bEnable);
m_xNotebookbarIconSizeLB->save_value();
+ // tdf#153497 set name of automatic icon theme, it may have changed due to "Apply" while this page is visible
+ UpdateIconThemes();
+
if (aMiscOptions.IconThemeWasSetAutomatically()) {
nStyleLB_InitialSelection = 0;
}
else {
- const OUString& selected = aMiscOptions.GetIconTheme();
+ const OUString& selected = SvtMiscOptions::GetIconTheme();
const vcl::IconThemeInfo& selectedInfo =
vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, selected);
nStyleLB_InitialSelection = m_xIconStyleLB->find_text(selectedInfo.GetDisplayName());
}
+ bEnable = !officecfg::Office::Common::Misc::SymbolStyle::isReadOnly();
m_xIconStyleLB->set_active(nStyleLB_InitialSelection);
+ m_xIconStyleLabel->set_sensitive(bEnable);
+ m_xIconStyleLB->set_sensitive(bEnable);
+ m_xIconStyleImg->set_visible(!bEnable);
m_xIconStyleLB->save_value();
- // Mouse Snap
- m_xMousePosLB->set_active(static_cast<sal_Int32>(pAppearanceCfg->GetSnapMode()));
- m_xMousePosLB->save_value();
+ bEnable = !officecfg::Office::Common::Misc::Appearance::isReadOnly();
+ m_xAppearanceStyleLB->set_active(officecfg::Office::Common::Misc::Appearance::get());
+ m_xAppearanceStyleLabel->set_sensitive(bEnable);
+ m_xAppearanceStyleLB->set_sensitive(bEnable);
+ m_xAppearanceStyleImg->set_visible(!bEnable);
+ m_xAppearanceStyleLB->save_value();
- // Mouse Snap
- m_xMouseMiddleLB->set_active(static_cast<short>(pAppearanceCfg->GetMiddleMouseButton()));
+ // Middle Mouse Button
+ bEnable = !officecfg::Office::Common::View::Dialog::MiddleMouseButton::isReadOnly();
+ sal_Int16 nMiddleMouseButton = officecfg::Office::Common::View::Dialog::MiddleMouseButton::get();
+ m_xMouseMiddleLB->set_active(static_cast<short>(nMiddleMouseButton));
+ m_xMouseMiddleLabel->set_sensitive(bEnable);
+ m_xMouseMiddleLB->set_sensitive(bEnable);
+ m_xMouseMiddleImg->set_visible(!bEnable);
m_xMouseMiddleLB->save_value();
- m_xFontAntiAliasing->set_active( pAppearanceCfg->IsFontAntiAliasing() );
- m_xAAPointLimit->set_value(pAppearanceCfg->GetFontAntialiasingMinPixelHeight(), FieldUnit::PIXEL);
+ bEnable = !officecfg::Office::Common::View::FontAntiAliasing::Enabled::isReadOnly();
+ bool bFontAntiAliasing = officecfg::Office::Common::View::FontAntiAliasing::Enabled::get();
+ m_xFontAntiAliasing->set_active( bFontAntiAliasing );
+ m_xFontAntiAliasing->set_sensitive(bEnable);
+ m_xFontAntiAliasingImg->set_visible(!bEnable);
+
+ bEnable = !officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::isReadOnly();
+ sal_Int16 nFontAntiAliasingMinPixelHeight = officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::get();
+ m_xAAPointLimit->set_value(nFontAntiAliasingMinPixelHeight, FieldUnit::PIXEL);
+ m_xAAPointLimit->set_sensitive(bEnable);
+ m_xAAPointLimitLabelImg->set_visible(!bEnable);
// WorkingSet
+ bEnable = !officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::isReadOnly();
m_xFontShowCB->set_active(officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get());
- SvtMenuOptions aMenuOpt;
- m_xMenuIconsLB->set_active(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1);
- m_xMenuIconsLB->save_value();
-
- TriState eContextMenuShortcuts = aMenuOpt.GetContextMenuShortcuts();
- bool bContextMenuShortcutsNonDefault = eContextMenuShortcuts == TRISTATE_FALSE || eContextMenuShortcuts == TRISTATE_TRUE;
- m_xContextMenuShortcutsLB->set_active(bContextMenuShortcutsNonDefault ? eContextMenuShortcuts + 1 : 0);
- m_xContextMenuShortcutsLB->save_value();
+ m_xFontShowCB->set_sensitive(bEnable);
+ m_xFontShowImg->set_visible(!bEnable);
UpdateHardwareAccelStatus();
m_xUseHardwareAccell->save_state();
{ // #i95644# AntiAliasing
- if(mpDrawinglayerOpt->IsAAPossibleOnThisSystem())
+ if(SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem())
{
- m_xUseAntiAliase->set_active(mpDrawinglayerOpt->IsAntiAliasing());
+ m_xUseAntiAliase->set_active(SvtOptionsDrawinglayer::IsAntiAliasing());
}
else
{
m_xUseAntiAliase->set_active(false);
m_xUseAntiAliase->set_sensitive(false);
+ m_xUseAntiAliaseImg->set_visible(true);
}
+ bEnable = !officecfg::Office::Common::Drawinglayer::AntiAliasing::isReadOnly();
+ m_xUseAntiAliase->set_sensitive(bEnable);
+ m_xUseAntiAliaseImg->set_visible(!bEnable);
m_xUseAntiAliase->save_state();
}
@@ -998,11 +1106,13 @@ void OfaViewTabPage::UpdateHardwareAccelStatus()
{
m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
+ m_xUseHardwareAccellImg->set_visible(pCanvasSettings->IsHardwareAccelerationRO());
}
else
{
m_xUseHardwareAccell->set_active(false);
m_xUseHardwareAccell->set_sensitive(false);
+ m_xUseHardwareAccellImg->set_visible(true);
}
#if HAVE_FEATURE_SKIA
m_xUseHardwareAccell->set_sensitive(!m_xUseSkia->get_active());
@@ -1011,7 +1121,7 @@ void OfaViewTabPage::UpdateHardwareAccelStatus()
struct LanguageConfig_Impl
{
- SvtLanguageOptions aLanguageOptions;
+ SvtCTLOptions aCTLLanguageOptions;
SvtSysLocaleOptions aSysLocaleOptions;
SvtLinguConfig aLinguConfig;
};
@@ -1019,11 +1129,11 @@ struct LanguageConfig_Impl
static bool bLanguageCurrentDoc_Impl = false;
// some things we'll need...
-constexpr OUStringLiteral sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess";
+constexpr OUString sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess"_ustr;
constexpr OUStringLiteral sAccessUpdSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess";
-constexpr OUStringLiteral sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales";
-constexpr OUStringLiteral sUserLocalePath = u"org.openoffice.Office.Linguistic/General";
-constexpr OUStringLiteral sUserLocaleKey = u"UILocale";
+constexpr OUString sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales"_ustr;
+constexpr OUString sUserLocalePath = u"org.openoffice.Office.Linguistic/General"_ustr;
+constexpr OUString sUserLocaleKey = u"UILocale"_ustr;
static Sequence< OUString > seqInstalledLanguages;
static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper )
@@ -1037,7 +1147,7 @@ static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocal
const OUString* pPatterns = aDateAcceptancePatterns.getConstArray();
aBuf.append( pPatterns[0]);
for (sal_Int32 i=1; i < nPatterns; ++i)
- aBuf.append(';').append( pPatterns[i]);
+ aBuf.append(";" + pPatterns[i]);
}
return aBuf.makeStringAndClear();
}
@@ -1059,19 +1169,28 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
, m_xUserInterfaceLB(m_xBuilder->weld_combo_box("userinterface"))
, m_xLocaleSettingFT(m_xBuilder->weld_label("localesettingFT"))
, m_xLocaleSettingLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("localesetting")))
+ , m_xLocaleSettingImg(m_xBuilder->weld_widget("locklocalesetting"))
+ , m_xDecimalSeparatorFT(m_xBuilder->weld_label("label6"))
, m_xDecimalSeparatorCB(m_xBuilder->weld_check_button("decimalseparator"))
+ , m_xDecimalSeparatorImg(m_xBuilder->weld_widget("lockdecimalseparator"))
, m_xCurrencyFT(m_xBuilder->weld_label("defaultcurrency"))
, m_xCurrencyLB(m_xBuilder->weld_combo_box("currencylb"))
+ , m_xCurrencyImg(m_xBuilder->weld_widget("lockcurrencylb"))
, m_xDatePatternsFT(m_xBuilder->weld_label("dataaccpatterns"))
, m_xDatePatternsED(m_xBuilder->weld_entry("datepatterns"))
+ , m_xDatePatternsImg(m_xBuilder->weld_widget("lockdatepatterns"))
, m_xWesternLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("westernlanguage")))
, m_xWesternLanguageFT(m_xBuilder->weld_label("western"))
+ , m_xWesternLanguageImg(m_xBuilder->weld_widget("lockwesternlanguage"))
, m_xAsianLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("asianlanguage")))
, m_xComplexLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("complexlanguage")))
, m_xCurrentDocCB(m_xBuilder->weld_check_button("currentdoc"))
, m_xAsianSupportCB(m_xBuilder->weld_check_button("asiansupport"))
+ , m_xAsianSupportImg(m_xBuilder->weld_widget("lockasiansupport"))
, m_xCTLSupportCB(m_xBuilder->weld_check_button("ctlsupport"))
+ , m_xCTLSupportImg(m_xBuilder->weld_widget("lockctlsupport"))
, m_xIgnoreLanguageChangeCB(m_xBuilder->weld_check_button("ignorelanguagechange"))
+ , m_xIgnoreLanguageChangeImg(m_xBuilder->weld_widget("lockignorelanguagechange"))
{
// tdf#125483 save original default label
m_sDecimalSeparatorLabel = m_xDecimalSeparatorCB->get_label();
@@ -1090,12 +1209,9 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
Reference< XMultiServiceFactory > theConfigProvider(
css::configuration::theDefaultProvider::get(
comphelper::getProcessComponentContext()));
- Sequence< Any > theArgs(1);
- Reference< XNameAccess > theNameAccess;
-
// find out which locales are currently installed and add them to the listbox
- theArgs[0] <<= NamedValue("nodepath", Any(OUString(sInstalledLocalesPath)));
- theNameAccess.set(
+ Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(sInstalledLocalesPath))) };
+ Reference< XNameAccess > theNameAccess(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
seqInstalledLanguages = theNameAccess->getElementNames();
LanguageType aLang = LANGUAGE_DONTKNOW;
@@ -1113,7 +1229,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
std::sort(aUILanguages.begin(), aUILanguages.end(), [](const auto& l1, const auto& l2) {
static const auto aSorter = comphelper::string::NaturalStringSorter(
comphelper::getProcessComponentContext(),
- Application::GetSettings().GetLanguageTag().getLocale());
+ Application::GetSettings().GetUILanguageTag().getLocale());
return aSorter.compare(l1.second, l2.second) < 0;
});
@@ -1126,8 +1242,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
m_xUserInterfaceLB->set_active(0);
// find out whether the user has a specific locale specified
- Sequence< Any > theArgs2(1);
- theArgs2[0] <<= NamedValue("nodepath", Any(OUString(sUserLocalePath)));
+ Sequence< Any > theArgs2{ Any(NamedValue("nodepath", Any(sUserLocalePath))) };
theNameAccess.set(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
if (theNameAccess->hasByName(sUserLocaleKey))
@@ -1197,7 +1312,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
aStr_ = ApplyLreOrRleEmbedding( aStr_ ) +
aTwoSpace +
ApplyLreOrRleEmbedding( SvtLanguageTable::GetLanguageString( v->GetLanguage() ) );
- m_xCurrencyLB->append(OUString::number(reinterpret_cast<sal_Int64>(v)), aStr_);
+ m_xCurrencyLB->append(weld::toId(v), aStr_);
}
m_xCurrencyLB->set_active(0);
@@ -1205,22 +1320,24 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
m_xLocaleSettingLB->connect_changed( LINK( this, OfaLanguagesTabPage, LocaleSettingHdl ) );
m_xDatePatternsED->connect_changed( LINK( this, OfaLanguagesTabPage, DatePatternsHdl ) );
- Link<weld::ToggleButton&,void> aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) );
+ Link<weld::Toggleable&,void> aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) );
m_xAsianSupportCB->connect_toggled( aLink );
m_xCTLSupportCB->connect_toggled( aLink );
- m_bOldAsian = pLangConfig->aLanguageOptions.IsAnyEnabled();
+ m_bOldAsian = SvtCJKOptions::IsAnyEnabled();
m_xAsianSupportCB->set_active(m_bOldAsian);
m_xAsianSupportCB->save_state();
- bool bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK);
+ bool bReadonly = SvtCJKOptions::IsAnyReadOnly();
m_xAsianSupportCB->set_sensitive(!bReadonly);
+ m_xAsianSupportImg->set_visible(bReadonly);
SupportHdl(*m_xAsianSupportCB);
- m_bOldCtl = pLangConfig->aLanguageOptions.IsCTLFontEnabled();
+ m_bOldCtl = SvtCTLOptions::IsCTLFontEnabled();
m_xCTLSupportCB->set_active(m_bOldCtl);
m_xCTLSupportCB->save_state();
- bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT);
+ bReadonly = pLangConfig->aCTLLanguageOptions.IsReadOnly(SvtCTLOptions::E_CTLFONT);
m_xCTLSupportCB->set_sensitive(!bReadonly);
+ m_xCTLSupportImg->set_visible(bReadonly);
SupportHdl(*m_xCTLSupportCB);
m_xIgnoreLanguageChangeCB->set_active( pLangConfig->aSysLocaleOptions.IsIgnoreLanguageChange() );
@@ -1253,11 +1370,36 @@ static void lcl_Update(std::unique_ptr<SfxVoidItem> pInvalidItems[], std::unique
}
}
+OUString OfaLanguagesTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[]
+ = { "label1", "label4", "label7", "localesettingFT", "defaultcurrency",
+ "label6", "dataaccpatterns", "label2", "western", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "decimalseparator", "asiansupport", "ctlsupport", "currentdoc",
+ "ignorelanguagechange" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
{
// lock configuration broadcasters so that we can coordinate the notifications
pLangConfig->aSysLocaleOptions.BlockBroadcasts( true );
- pLangConfig->aLanguageOptions.BlockBroadcasts( true );
+ pLangConfig->aCTLLanguageOptions.BlockBroadcasts( true );
pLangConfig->aLinguConfig.BlockBroadcasts( true );
/*
@@ -1276,9 +1418,9 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
//sequence checking has to be switched on depending on the selected CTL language
LanguageType eCTLLang = m_xComplexLanguageLB->get_active_id();
bool bOn = MsLangId::needsSequenceChecking( eCTLLang);
- pLangConfig->aLanguageOptions.SetCTLSequenceCheckingRestricted(bOn);
- pLangConfig->aLanguageOptions.SetCTLSequenceChecking(bOn);
- pLangConfig->aLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn);
+ pLangConfig->aCTLLanguageOptions.SetCTLSequenceCheckingRestricted(bOn);
+ pLangConfig->aCTLLanguageOptions.SetCTLSequenceChecking(bOn);
+ pLangConfig->aCTLLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn);
}
try
{
@@ -1296,8 +1438,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Reference< XMultiServiceFactory > theConfigProvider(
css::configuration::theDefaultProvider::get(
comphelper::getProcessComponentContext()));
- Sequence< Any > theArgs(1);
- theArgs[0] <<= NamedValue("nodepath", Any(OUString(sUserLocalePath)));
+ Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(sUserLocalePath))) };
Reference< XPropertySet >xProp(
theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
if ( m_sUserLocaleValue != aLangString)
@@ -1353,8 +1494,10 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
SvtScriptType nNewType = SvtLanguageOptions::GetScriptTypeOfLanguage( eNewLocale );
bool bNewCJK = bool( nNewType & SvtScriptType::ASIAN );
- SvtCompatibilityOptions aCompatOpts;
- aCompatOpts.SetDefault( SvtCompatibilityEntry::Index::ExpandWordSpace, !bNewCJK );
+ auto batch = comphelper::ConfigurationChanges::create();
+ SvtCompatibilityDefault aCompatOpts(batch);
+ aCompatOpts.set(u"ExpandWordSpace"_ustr, !bNewCJK);
+ batch->commit();
}
if(m_xDecimalSeparatorCB->get_state_changed_from_saved())
@@ -1366,7 +1509,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
// Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default.
OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
OUString sId = m_xCurrencyLB->get_active_id();
- const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : reinterpret_cast<const NfCurrencyEntry*>(sId.toInt64());
+ const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : weld::fromId<const NfCurrencyEntry*>(sId);
OUString sNewCurr;
if ( pCurr )
sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString(
@@ -1395,7 +1538,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Any aValue;
Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
aValue <<= aLocale;
- pLangConfig->aLinguConfig.SetProperty( "DefaultLocale", aValue );
+ pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale", aValue );
if (xLinguProp.is())
xLinguProp->setDefaultLocale( aLocale );
}
@@ -1414,7 +1557,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Any aValue;
Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
aValue <<= aLocale;
- pLangConfig->aLinguConfig.SetProperty( "DefaultLocale_CJK", aValue );
+ pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale_CJK", aValue );
if (xLinguProp.is())
xLinguProp->setDefaultLocale_CJK( aLocale );
}
@@ -1433,7 +1576,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Any aValue;
Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
aValue <<= aLocale;
- pLangConfig->aLinguConfig.SetProperty( "DefaultLocale_CTL", aValue );
+ pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale_CTL", aValue );
if (xLinguProp.is())
xLinguProp->setDefaultLocale_CTL( aLocale );
}
@@ -1447,7 +1590,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
if(m_xAsianSupportCB->get_state_changed_from_saved() )
{
bool bChecked = m_xAsianSupportCB->get_active();
- pLangConfig->aLanguageOptions.SetAll(bChecked);
+ SvtCJKOptions::SetAll(bChecked);
//iterate over all bindings to invalidate vertical text direction
const sal_uInt16 STATE_COUNT = 2;
@@ -1469,7 +1612,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
aOpt.SetIgnoreDiacritics_CTL(true);
aOpt.SetIgnoreKashida_CTL(true);
aOpt.Commit();
- pLangConfig->aLanguageOptions.SetCTLFontEnabled( m_xCTLSupportCB->get_active() );
+ pLangConfig->aCTLLanguageOptions.SetCTLFontEnabled( m_xCTLSupportCB->get_active() );
const sal_uInt16 STATE_COUNT = 1;
std::unique_ptr<SfxBoolItem> pBoolItems[STATE_COUNT];
@@ -1486,7 +1629,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
// it seems that our code relies on the fact that before other changes like e.g. currency
// are broadcasted locale changes have been done
pLangConfig->aSysLocaleOptions.BlockBroadcasts( false );
- pLangConfig->aLanguageOptions.BlockBroadcasts( false );
+ pLangConfig->aCTLLanguageOptions.BlockBroadcasts( false );
pLangConfig->aLinguConfig.BlockBroadcasts( false );
return false;
@@ -1502,12 +1645,20 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Locale);
m_xLocaleSettingLB->set_sensitive(!bReadonly);
m_xLocaleSettingFT->set_sensitive(!bReadonly);
+ m_xLocaleSettingImg->set_visible(bReadonly);
m_xDecimalSeparatorCB->set_active( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale());
+ bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::DecimalSeparator);
+ m_xDecimalSeparatorCB->set_sensitive(!bReadonly);
+ m_xDecimalSeparatorFT->set_sensitive(!bReadonly);
+ m_xDecimalSeparatorImg->set_visible(bReadonly);
m_xDecimalSeparatorCB->save_state();
m_xIgnoreLanguageChangeCB->set_active( pLangConfig->aSysLocaleOptions.IsIgnoreLanguageChange());
+ bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::IgnoreLanguageChange);
+ m_xIgnoreLanguageChangeCB->set_sensitive(!bReadonly);
+ m_xIgnoreLanguageChangeImg->set_visible(bReadonly);
m_xIgnoreLanguageChangeCB->save_state();
// let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
@@ -1526,11 +1677,12 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
}
// if pCurr==nullptr the SYSTEM entry is selected
- OUString sId = !pCurr ? OUString("default") : OUString::number(reinterpret_cast<sal_Int64>(pCurr));
+ OUString sId = !pCurr ? OUString("default") : weld::toId(pCurr);
m_xCurrencyLB->set_active_id(sId);
bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Currency);
m_xCurrencyLB->set_sensitive(!bReadonly);
m_xCurrencyFT->set_sensitive(!bReadonly);
+ m_xCurrencyImg->set_visible(bReadonly);
// date acceptance patterns
OUString aDatePatternsString = pLangConfig->aSysLocaleOptions.GetDatePatternsConfigString();
@@ -1538,13 +1690,21 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
{
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
aDatePatternsString = lcl_getDatePatternsConfigString( rLocaleWrapper);
+ // Let's assume patterns are valid at this point.
+ m_bDatePatternsValid = true;
+ }
+ else
+ {
+ bool bModified = false;
+ m_bDatePatternsValid = validateDatePatterns( bModified, aDatePatternsString);
}
- // Let's assume patterns are valid at this point.
- m_bDatePatternsValid = true;
m_xDatePatternsED->set_text(aDatePatternsString);
+ m_xDatePatternsED->set_message_type( m_bDatePatternsValid ?
+ weld::EntryMessageType::Normal : weld::EntryMessageType::Error);
bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::DatePatterns);
m_xDatePatternsED->set_sensitive(!bReadonly);
m_xDatePatternsFT->set_sensitive(!bReadonly);
+ m_xDatePatternsImg->set_visible(bReadonly);
m_xDatePatternsED->save_value();
//western/CJK/CLK language
@@ -1560,18 +1720,18 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
Any aCTLLang;
try
{
- aWestLang = pLangConfig->aLinguConfig.GetProperty("DefaultLocale");
+ aWestLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale");
Locale aLocale;
aWestLang >>= aLocale;
eCurLang = LanguageTag::convertToLanguageType( aLocale, false);
- aCJKLang = pLangConfig->aLinguConfig.GetProperty("DefaultLocale_CJK");
+ aCJKLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale_CJK");
aLocale = Locale();
aCJKLang >>= aLocale;
eCurLangCJK = LanguageTag::convertToLanguageType( aLocale, false);
- aCTLLang = pLangConfig->aLinguConfig.GetProperty("DefaultLocale_CTL");
+ aCTLLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale_CTL");
aLocale = Locale();
aCTLLang >>= aLocale;
eCurLangCTL = LanguageTag::convertToLanguageType( aLocale, false);
@@ -1584,24 +1744,23 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
{
m_xCurrentDocCB->set_sensitive(true);
m_xCurrentDocCB->set_active(bLanguageCurrentDoc_Impl);
- const SfxPoolItem* pLang;
- if( SfxItemState::SET == rSet->GetItemState(SID_ATTR_LANGUAGE, false, &pLang))
+ if( const SvxLanguageItem* pLangItem = rSet->GetItemIfSet(SID_ATTR_LANGUAGE, false))
{
- LanguageType eTempCurLang = static_cast<const SvxLanguageItem*>(pLang)->GetValue();
+ LanguageType eTempCurLang = pLangItem->GetValue();
if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, css::i18n::ScriptType::LATIN) != eTempCurLang)
eCurLang = eTempCurLang;
}
- if( SfxItemState::SET == rSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, false, &pLang))
+ if( const SvxLanguageItem* pLang = rSet->GetItemIfSet(SID_ATTR_CHAR_CJK_LANGUAGE, false))
{
- LanguageType eTempCurLang = static_cast<const SvxLanguageItem*>(pLang)->GetValue();
+ LanguageType eTempCurLang = pLang->GetValue();
if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, css::i18n::ScriptType::ASIAN) != eTempCurLang)
eCurLangCJK = eTempCurLang;
}
- if( SfxItemState::SET == rSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, false, &pLang))
+ if( const SvxLanguageItem* pLang = rSet->GetItemIfSet(SID_ATTR_CHAR_CTL_LANGUAGE, false))
{
- LanguageType eTempCurLang = static_cast<const SvxLanguageItem*>(pLang)->GetValue();
+ LanguageType eTempCurLang = pLang->GetValue();
if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, css::i18n::ScriptType::COMPLEX) != eTempCurLang)
eCurLangCTL = eTempCurLang;
}
@@ -1627,14 +1786,15 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
m_xIgnoreLanguageChangeCB->save_state();
m_xCurrentDocCB->save_state();
- bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( "DefaultLocale" );
+ bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( u"DefaultLocale" );
m_xWesternLanguageFT->set_sensitive( bEnable );
m_xWesternLanguageLB->set_sensitive( bEnable );
+ m_xWesternLanguageImg->set_visible( !bEnable );
// check the box "For the current document only"
// set the focus to the Western Language box
- const SfxPoolItem* pLang = nullptr;
- if ( SfxItemState::SET == rSet->GetItemState(SID_SET_DOCUMENT_LANGUAGE, false, &pLang ) && static_cast<const SfxBoolItem*>(pLang)->GetValue() )
+ const SfxBoolItem* pLang = rSet->GetItemIfSet(SID_SET_DOCUMENT_LANGUAGE, false );
+ if ( pLang && pLang->GetValue() )
{
m_xWesternLanguageLB->grab_focus();
m_xCurrentDocCB->set_sensitive(true);
@@ -1642,12 +1802,12 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
}
}
-IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::Toggleable&, rBox, void)
{
bool bCheck = rBox.get_active();
if ( m_xAsianSupportCB.get() == &rBox )
{
- bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly("DefaultLocale_CJK");
+ bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly(u"DefaultLocale_CJK");
bCheck = ( bCheck && !bReadonly );
m_xAsianLanguageLB->set_sensitive( bCheck );
if (rBox.get_sensitive())
@@ -1655,7 +1815,7 @@ IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::ToggleButton&, rBox, void)
}
else if ( m_xCTLSupportCB.get() == &rBox )
{
- bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly("DefaultLocale_CTL");
+ bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly(u"DefaultLocale_CTL");
bCheck = ( bCheck && !bReadonly );
m_xComplexLanguageLB->set_sensitive( bCheck );
if (rBox.get_sensitive())
@@ -1685,7 +1845,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
SvtScriptType nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang);
// first check if CTL must be enabled
// #103299# - if CTL font setting is not readonly
- if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT))
+ if(!pLangConfig->aCTLLanguageOptions.IsReadOnly(SvtCTLOptions::E_CTLFONT))
{
bool bIsCTLFixed = bool(nType & SvtScriptType::COMPLEX);
lcl_checkLanguageCheckBox(*m_xCTLSupportCB, bIsCTLFixed, m_bOldCtl);
@@ -1693,7 +1853,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
}
// second check if CJK must be enabled
// #103299# - if CJK support is not readonly
- if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK))
+ if(!SvtCJKOptions::IsAnyReadOnly())
{
bool bIsCJKFixed = bool(nType & SvtScriptType::ASIAN);
lcl_checkLanguageCheckBox(*m_xAsianSupportCB, bIsCJKFixed, m_bOldAsian);
@@ -1701,8 +1861,8 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
}
const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
- (eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getSystemLanguage() : eLang);
- const OUString aDefaultID = "default";
+ (eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getConfiguredSystemLanguage() : eLang);
+ constexpr OUString aDefaultID = u"default"_ustr;
// Update the "Default ..." currency.
m_xCurrencyLB->remove_id(aDefaultID);
OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
@@ -1711,8 +1871,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
m_xCurrencyLB->set_active_text(aDefaultCurr);
// obtain corresponding locale data
- LanguageTag aLanguageTag( eLang);
- LocaleDataWrapper aLocaleWrapper( aLanguageTag );
+ LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang) ));
// update the decimal separator key of the related CheckBox
OUString sTempLabel(m_sDecimalSeparatorLabel);
@@ -1723,20 +1882,39 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
OUString aDatePatternsString = lcl_getDatePatternsConfigString( aLocaleWrapper);
m_bDatePatternsValid = true;
m_xDatePatternsED->set_text( aDatePatternsString);
+ m_xDatePatternsED->set_message_type(weld::EntryMessageType::Normal);
}
IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
{
- const OUString aPatterns(rEd.get_text());
- OUStringBuffer aBuf( aPatterns);
- sal_Int32 nChar = 0;
- bool bValid = true;
+ OUString aPatterns(rEd.get_text());
bool bModified = false;
- if (!aPatterns.isEmpty())
+ const bool bValid = validateDatePatterns( bModified, aPatterns);
+ if (bModified)
+ {
+ // gtk3 keeps the cursor position on equal length set_text() but at
+ // least the 'gen' backend does not and resets to 0.
+ const int nCursorPos = rEd.get_position();
+ rEd.set_text(aPatterns);
+ rEd.set_position(nCursorPos);
+ }
+ if (bValid)
+ rEd.set_message_type(weld::EntryMessageType::Normal);
+ else
+ rEd.set_message_type(weld::EntryMessageType::Error);
+ m_bDatePatternsValid = bValid;
+}
+
+bool OfaLanguagesTabPage::validateDatePatterns( bool& rbModified, OUString& rPatterns )
+{
+ bool bValid = true;
+ if (!rPatterns.isEmpty())
{
+ OUStringBuffer aBuf( rPatterns);
+ sal_Int32 nChar = 0;
for (sal_Int32 nIndex=0; nIndex >= 0 && bValid; ++nChar)
{
- const OUString aPat( aPatterns.getToken( 0, ';', nIndex));
+ const OUString aPat( rPatterns.getToken( 0, ';', nIndex));
if (aPat.isEmpty() && nIndex < 0)
{
// Indicating failure when about to append a pattern is too
@@ -1751,6 +1929,18 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
bool bY, bM, bD;
bY = bM = bD = false;
bool bSep = true;
+ if (aPat.getLength() == 3)
+ {
+ // Disallow a pattern that would match a numeric input with
+ // decimal separator, like M.D
+ const LanguageType eLang = m_xLocaleSettingLB->get_active_id();
+ const LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang)));
+ if ( aPat[1] == aLocaleWrapper.getNumDecimalSep().toChar()
+ || aPat[1] == aLocaleWrapper.getNumDecimalSepAlt().toChar())
+ {
+ bValid = false;
+ }
+ }
for (sal_Int32 i = 0; i < aPat.getLength() && bValid; /*nop*/)
{
const sal_Int32 j = i;
@@ -1765,7 +1955,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'y')
{
aBuf[nChar] = 'Y';
- bModified = true;
+ rbModified = true;
}
bY = true;
bSep = false;
@@ -1777,7 +1967,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'm')
{
aBuf[nChar] = 'M';
- bModified = true;
+ rbModified = true;
}
bM = true;
bSep = false;
@@ -1789,7 +1979,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'd')
{
aBuf[nChar] = 'D';
- bModified = true;
+ rbModified = true;
}
bD = true;
bSep = false;
@@ -1807,14 +1997,10 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
bValid &= (bY || bM || bD);
}
}
+ if (rbModified)
+ rPatterns = aBuf.makeStringAndClear();
}
- if (bModified)
- rEd.replace_selection(aBuf.makeStringAndClear());
- if (bValid)
- rEd.set_message_type(weld::EntryMessageType::Normal);
- else
- rEd.set_message_type(weld::EntryMessageType::Error);
- m_bDatePatternsValid = bValid;
+ return bValid;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 07d3cca86fb7..2c62e569ea75 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -18,11 +18,11 @@
*/
#pragma once
#include <memory>
+#include <config_features.h>
#include <sfx2/tabdlg.hxx>
#include <svx/langbox.hxx>
class CanvasSettings;
-class SvtOptionsDrawinglayer;
namespace vcl {
class IconThemeInfo;
@@ -34,29 +34,39 @@ private:
OUString m_aStrDateInfo;
std::unique_ptr<weld::CheckButton> m_xExtHelpCB;
+ std::unique_ptr<weld::Widget> m_xExtHelpImg;
std::unique_ptr<weld::CheckButton> m_xPopUpNoHelpCB;
+ std::unique_ptr<weld::Widget> m_xPopUpNoHelpImg;
std::unique_ptr<weld::CheckButton> m_xShowTipOfTheDay;
+ std::unique_ptr<weld::Widget> m_xShowTipOfTheDayImg;
std::unique_ptr<weld::Widget> m_xFileDlgFrame;
- std::unique_ptr<weld::Widget> m_xPrintDlgFrame;
std::unique_ptr<weld::Widget> m_xFileDlgROImage;
std::unique_ptr<weld::CheckButton> m_xFileDlgCB;
- std::unique_ptr<weld::CheckButton> m_xPrintDlgCB;
std::unique_ptr<weld::CheckButton> m_xDocStatusCB;
+ std::unique_ptr<weld::Widget> m_xDocStatusImg;
std::unique_ptr<weld::Widget> m_xYearFrame;
+ std::unique_ptr<weld::Label> m_xYearLabel;
std::unique_ptr<weld::SpinButton> m_xYearValueField;
std::unique_ptr<weld::Label> m_xToYearFT;
- std::unique_ptr<weld::CheckButton> m_xCollectUsageInfo;
+ std::unique_ptr<weld::Widget> m_xYearFrameImg;
+#if HAVE_FEATURE_BREAKPAD
+ std::unique_ptr<weld::Widget> m_xPrivacyFrame;
std::unique_ptr<weld::CheckButton> m_xCrashReport;
+ std::unique_ptr<weld::Widget> m_xCrashReportImg;
+#endif
+#if defined(_WIN32)
std::unique_ptr<weld::Widget> m_xQuickStarterFrame;
std::unique_ptr<weld::CheckButton> m_xQuickLaunchCB;
-#if defined(_WIN32)
+ std::unique_ptr<weld::Widget> m_xQuickLaunchImg;
std::unique_ptr<weld::Widget> m_xFileAssocFrame;
std::unique_ptr<weld::Button> m_xFileAssocBtn;
+ std::unique_ptr<weld::CheckButton> m_xPerformFileExtCheck;
+ std::unique_ptr<weld::Widget> m_xPerformFileExtImg;
#endif
DECL_LINK(TwoFigureHdl, weld::SpinButton&, void);
#if defined(_WIN32)
- DECL_STATIC_LINK(OfaMiscTabPage, FileAssocClick, weld::Button&, void);
+ DECL_DLLPRIVATE_STATIC_LINK(OfaMiscTabPage, FileAssocClick, weld::Button&, void);
#endif
protected:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
@@ -67,12 +77,12 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
-class SvtTabAppearanceCfg;
-
class OfaViewTabPage : public SfxTabPage
{
private:
@@ -81,46 +91,66 @@ private:
sal_Int32 nNotebookbarSizeLB_InitialSelection;
sal_Int32 nStyleLB_InitialSelection;
- std::unique_ptr<SvtTabAppearanceCfg> pAppearanceCfg;
std::unique_ptr<CanvasSettings> pCanvasSettings;
- std::unique_ptr<SvtOptionsDrawinglayer> mpDrawinglayerOpt;
std::vector<vcl::IconThemeInfo> mInstalledIconThemes;
+ std::unique_ptr<weld::Label> m_xIconSizeLabel;
std::unique_ptr<weld::ComboBox> m_xIconSizeLB;
+ std::unique_ptr<weld::Widget> m_xIconSizeImg;
+ std::unique_ptr<weld::Label> m_xSidebarIconSizeLabel;
std::unique_ptr<weld::ComboBox> m_xSidebarIconSizeLB;
+ std::unique_ptr<weld::Widget> m_xSidebarIconSizeImg;
+ std::unique_ptr<weld::Label> m_xNotebookbarIconSizeLabel;
std::unique_ptr<weld::ComboBox> m_xNotebookbarIconSizeLB;
+ std::unique_ptr<weld::Widget> m_xNotebookbarIconSizeImg;
+ std::unique_ptr<weld::Widget> m_xDarkModeFrame;
+ std::unique_ptr<weld::Label> m_xAppearanceStyleLabel;
+ std::unique_ptr<weld::ComboBox> m_xAppearanceStyleLB;
+ std::unique_ptr<weld::Widget> m_xAppearanceStyleImg;
+ std::unique_ptr<weld::Label> m_xIconStyleLabel;
std::unique_ptr<weld::ComboBox> m_xIconStyleLB;
+ std::unique_ptr<weld::Widget> m_xIconStyleImg;
std::unique_ptr<weld::CheckButton> m_xFontAntiAliasing;
+ std::unique_ptr<weld::Widget> m_xFontAntiAliasingImg;
std::unique_ptr<weld::Label> m_xAAPointLimitLabel;
+ std::unique_ptr<weld::Widget> m_xAAPointLimitLabelImg;
std::unique_ptr<weld::MetricSpinButton> m_xAAPointLimit;
- std::unique_ptr<weld::Widget> m_xMenuIconBox;
- std::unique_ptr<weld::ComboBox> m_xMenuIconsLB;
-
- std::unique_ptr<weld::ComboBox> m_xContextMenuShortcutsLB;
-
std::unique_ptr<weld::CheckButton> m_xFontShowCB;
+ std::unique_ptr<weld::Widget> m_xFontShowImg;
std::unique_ptr<weld::CheckButton> m_xUseHardwareAccell;
+ std::unique_ptr<weld::Widget> m_xUseHardwareAccellImg;
std::unique_ptr<weld::CheckButton> m_xUseAntiAliase;
+ std::unique_ptr<weld::Widget> m_xUseAntiAliaseImg;
std::unique_ptr<weld::CheckButton> m_xUseSkia;
+ std::unique_ptr<weld::Widget> m_xUseSkiaImg;
std::unique_ptr<weld::CheckButton> m_xForceSkiaRaster;
+ std::unique_ptr<weld::Widget> m_xForceSkiaRasterImg;
std::unique_ptr<weld::Label> m_xSkiaStatusEnabled;
std::unique_ptr<weld::Label> m_xSkiaStatusDisabled;
+ std::unique_ptr<weld::Button> m_xSkiaLog;
- std::unique_ptr<weld::ComboBox> m_xMousePosLB;
+ std::unique_ptr<weld::Label> m_xMouseMiddleLabel;
std::unique_ptr<weld::ComboBox> m_xMouseMiddleLB;
+ std::unique_ptr<weld::Widget> m_xMouseMiddleImg;
std::unique_ptr<weld::Button> m_xMoreIcons;
+ std::unique_ptr<weld::Button> m_xRunGPTests;
+
+ OUString m_sAutoStr;
- DECL_LINK(OnAntialiasingToggled, weld::ToggleButton&, void);
- DECL_LINK(OnUseSkiaToggled, weld::ToggleButton&, void);
+ DECL_LINK(OnAntialiasingToggled, weld::Toggleable&, void);
+ DECL_LINK(OnUseSkiaToggled, weld::Toggleable&, void);
+ DECL_LINK(OnCopySkiaLog, weld::Button&, void);
DECL_STATIC_LINK(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void);
+ DECL_LINK(OnRunGPTestClick, weld::Button&, void);
void UpdateSkiaStatus();
void HideSkiaWidgets();
void UpdateHardwareAccelStatus();
+ void UpdateIconThemes();
public:
OfaViewTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -128,6 +158,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
@@ -149,31 +181,44 @@ class OfaLanguagesTabPage : public SfxTabPage
std::unique_ptr<weld::ComboBox> m_xUserInterfaceLB;
std::unique_ptr<weld::Label> m_xLocaleSettingFT;
std::unique_ptr<SvxLanguageBox> m_xLocaleSettingLB;
+ std::unique_ptr<weld::Widget> m_xLocaleSettingImg;
+ std::unique_ptr<weld::Label> m_xDecimalSeparatorFT;
std::unique_ptr<weld::CheckButton> m_xDecimalSeparatorCB;
+ std::unique_ptr<weld::Widget> m_xDecimalSeparatorImg;
std::unique_ptr<weld::Label> m_xCurrencyFT;
std::unique_ptr<weld::ComboBox> m_xCurrencyLB;
+ std::unique_ptr<weld::Widget> m_xCurrencyImg;
std::unique_ptr<weld::Label> m_xDatePatternsFT;
std::unique_ptr<weld::Entry> m_xDatePatternsED;
+ std::unique_ptr<weld::Widget> m_xDatePatternsImg;
std::unique_ptr<SvxLanguageBox> m_xWesternLanguageLB;
std::unique_ptr<weld::Label> m_xWesternLanguageFT;
+ std::unique_ptr<weld::Widget> m_xWesternLanguageImg;
std::unique_ptr<SvxLanguageBox> m_xAsianLanguageLB;
std::unique_ptr<SvxLanguageBox> m_xComplexLanguageLB;
std::unique_ptr<weld::CheckButton> m_xCurrentDocCB;
std::unique_ptr<weld::CheckButton> m_xAsianSupportCB;
+ std::unique_ptr<weld::Widget> m_xAsianSupportImg;
std::unique_ptr<weld::CheckButton> m_xCTLSupportCB;
+ std::unique_ptr<weld::Widget> m_xCTLSupportImg;
std::unique_ptr<weld::CheckButton> m_xIgnoreLanguageChangeCB;
+ std::unique_ptr<weld::Widget> m_xIgnoreLanguageChangeImg;
- DECL_LINK(SupportHdl, weld::ToggleButton&, void);
+ DECL_LINK(SupportHdl, weld::Toggleable&, void);
DECL_LINK(LocaleSettingHdl, weld::ComboBox&, void);
DECL_LINK(DatePatternsHdl, weld::Entry&, void);
+ bool validateDatePatterns( bool& rbModified, OUString& rPatterns );
+
public:
OfaLanguagesTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~OfaLanguagesTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 6fcef33199c3..d2cf40244d85 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -30,10 +30,10 @@
#include <i18nlangtag/mslangid.hxx>
#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
-#include <unotools/saveopt.hxx>
#include <svl/intitem.hxx>
#include <vcl/settings.hxx>
+#include <officecfg/Office/Common.hxx>
#include <unotools/useroptions.hxx>
#include <cuioptgenrl.hxx>
#include <svx/svxids.hrc>
@@ -79,26 +79,28 @@ namespace Lang
struct
{
+ // id of the lockimage
+ OUString pLockId;
// id of the text
- const char *pTextId;
+ OUString pTextId;
// language flags (see Lang above):
// which language is this row for?
unsigned nLangFlags;
}
const vRowInfo[] =
{
- { "companyft", Lang::All },
- { "nameft", Lang::All & ~Lang::Russian & ~Lang::Eastern },
- { "rusnameft", Lang::Russian },
- { "eastnameft", Lang::Eastern },
- { "streetft", Lang::All & ~Lang::Russian },
- { "russtreetft", Lang::Russian },
- { "icityft", Lang::All & ~Lang::US },
- { "cityft", Lang::US },
- { "countryft", Lang::All },
- { "titleft", Lang::All },
- { "phoneft", Lang::All },
- { "faxft", Lang::All },
+ { "lockcompanyft", "companyft", Lang::All },
+ { "locknameft", "nameft", Lang::All & ~Lang::Russian & ~Lang::Eastern },
+ { "lockrusnameft", "rusnameft", Lang::Russian },
+ { "lockeastnameft", "eastnameft", Lang::Eastern },
+ { "lockstreetft", "streetft", Lang::All & ~Lang::Russian },
+ { "lockrusstreetft","russtreetft", Lang::Russian },
+ { "lockicityft", "icityft", Lang::All & ~Lang::US },
+ { "lockcityft", "cityft", Lang::US },
+ { "lockcountryft", "countryft", Lang::All },
+ { "locktitleft", "titleft", Lang::All },
+ { "lockphoneft", "phoneft", Lang::All },
+ { "lockfaxft", "faxft", Lang::All },
};
@@ -110,7 +112,7 @@ struct
// in which row?
RowType eRow;
// id of the edit box
- const char *pEditId;
+ OUString pEditId;
// id for SvtUserOptions in unotools/useroptions.hxx
UserOptToken nUserOptionsId;
// id for settings the focus (defined in svx/optgenrl.hxx)
@@ -166,14 +168,17 @@ const vFieldInfo[] =
struct SvxGeneralTabPage::Row
{
+ // row lockdown icon
+ std::unique_ptr<weld::Widget> xLockImg;
// row label
std::unique_ptr<weld::Label> xLabel;
// first and last field in the row (last is exclusive)
unsigned nFirstField, nLastField;
public:
- explicit Row (std::unique_ptr<weld::Label> xLabel_)
- : xLabel(std::move(xLabel_))
+ explicit Row (std::unique_ptr<weld::Widget> xLockImg_, std::unique_ptr<weld::Label> xLabel_)
+ : xLockImg(std::move(xLockImg_))
+ , xLabel(std::move(xLabel_))
, nFirstField(0)
, nLastField(0)
{
@@ -210,10 +215,16 @@ public:
SvxGeneralTabPage::SvxGeneralTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet)
: SfxTabPage(pPage, pController, "cui/ui/optuserpage.ui", "OptUserPage", &rCoreSet)
, m_xUseDataCB(m_xBuilder->weld_check_button("usefordocprop"))
+ , m_xUseDataImg(m_xBuilder->weld_widget("lockusefordocprop"))
, m_xCryptoFrame(m_xBuilder->weld_widget( "cryptography"))
, m_xSigningKeyLB(m_xBuilder->weld_combo_box("signingkey"))
+ , m_xSigningKeyFT(m_xBuilder->weld_label("signingkeylabel"))
+ , m_xSigningKeyImg(m_xBuilder->weld_widget("locksigningkey"))
, m_xEncryptionKeyLB(m_xBuilder->weld_combo_box("encryptionkey"))
+ , m_xEncryptionKeyFT(m_xBuilder->weld_label("encryptionkeylabel"))
+ , m_xEncryptionKeyImg(m_xBuilder->weld_widget("lockencryptionkey"))
, m_xEncryptToSelfCB(m_xBuilder->weld_check_button("encrypttoself"))
+ , m_xEncryptToSelfImg(m_xBuilder->weld_widget("lockencrypttoself"))
{
InitControls();
#if HAVE_FEATURE_GPGME
@@ -258,11 +269,11 @@ void SvxGeneralTabPage::InitControls ()
if (!(vRowInfo[iRow].nLangFlags & LangBit))
continue;
// creating row
- vRows.push_back(std::make_shared<Row>(
+ vRows.push_back(std::make_shared<Row>(m_xBuilder->weld_widget(vRowInfo[iRow].pLockId),
m_xBuilder->weld_label(vRowInfo[iRow].pTextId)));
Row& rRow = *vRows.back();
// fields in the row
- static unsigned const nFieldCount = SAL_N_ELEMENTS(vFieldInfo);
+ static unsigned const nFieldCount = std::size(vFieldInfo);
// skipping other (invisible) rows
while (iField != nFieldCount && vFieldInfo[iField].eRow != eRow)
++iField;
@@ -301,7 +312,7 @@ void SvxGeneralTabPage::InitCryptography()
if (xCertificates.hasElements())
{
- for (auto& xCert : xCertificates)
+ for (auto& xCert : asNonConstRange(xCertificates))
{
m_xSigningKeyLB->append_text( xCert->getIssuerName());
m_xEncryptionKeyLB->append_text( xCert->getIssuerName());
@@ -315,7 +326,7 @@ void SvxGeneralTabPage::InitCryptography()
{
m_xSigningKeyLB->set_size_request(nMaxWidth, -1);
m_xEncryptionKeyLB->set_size_request(nMaxWidth, -1);
- m_xEncryptToSelfCB->set_label_line_wrap(true);
+ m_xEncryptToSelfCB->set_label_wrap(true);
m_xEncryptToSelfCB->set_size_request(nMaxWidth, -1);
}
}
@@ -341,6 +352,26 @@ std::unique_ptr<SfxTabPage> SvxGeneralTabPage::Create( weld::Container* pPage, w
return std::make_unique<SvxGeneralTabPage>( pPage, pController, *rAttrSet );
}
+OUString SvxGeneralTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[]
+ = { "label1", "companyft", "nameft", "rusnameft",
+ "eastnameft", "streetft", "russtreetft", "icityft",
+ "cityft", "countryft", "titleft", "phoneft",
+ "faxft", "cryptographylabel", "signingkeylabel", "encryptionkeylabel" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xUseDataCB->get_label() + " " + m_xEncryptToSelfCB->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxGeneralTabPage::FillItemSet( SfxItemSet* )
{
// remove leading and trailing whitespaces
@@ -349,10 +380,11 @@ bool SvxGeneralTabPage::FillItemSet( SfxItemSet* )
bool bModified = false;
bModified |= GetData_Impl();
- SvtSaveOptions aSaveOpt;
- if (m_xUseDataCB->get_active() != aSaveOpt.IsUseUserData())
+ if (m_xUseDataCB->get_active() != officecfg::Office::Common::Save::Document::UseUserData::get())
{
- aSaveOpt.SetUseUserData(m_xUseDataCB->get_active());
+ auto xChanges = comphelper::ConfigurationChanges::create();
+ officecfg::Office::Common::Save::Document::UseUserData::set(m_xUseDataCB->get_active(), xChanges);
+ xChanges->commit();
bModified = true;
}
return bModified;
@@ -362,11 +394,9 @@ void SvxGeneralTabPage::Reset( const SfxItemSet* rSet )
{
SetData_Impl();
- sal_uInt16 const nWhich = GetWhich(SID_FIELD_GRABFOCUS);
-
- if (rSet->GetItemState(nWhich) == SfxItemState::SET)
+ if (rSet->GetItemState(SID_FIELD_GRABFOCUS) == SfxItemState::SET)
{
- EditPosition nField = static_cast<EditPosition>(static_cast<const SfxUInt16Item&>(rSet->Get(nWhich)).GetValue());
+ EditPosition nField = static_cast<EditPosition>(rSet->Get(SID_FIELD_GRABFOCUS).GetValue());
if (nField != EditPosition::UNKNOWN)
{
for (auto const & i: vFields)
@@ -377,7 +407,7 @@ void SvxGeneralTabPage::Reset( const SfxItemSet* rSet )
vFields.front()->xEdit->grab_focus();
}
- m_xUseDataCB->set_active(SvtSaveOptions().IsUseUserData());
+ m_xUseDataCB->set_active(officecfg::Office::Common::Save::Document::UseUserData::get());
}
@@ -478,13 +508,33 @@ void SvxGeneralTabPage::SetData_Impl()
bEnableLabel = bEnableLabel || bEnableEdit;
}
rRow.xLabel->set_sensitive(bEnableLabel);
+ rRow.xLockImg->set_visible(!bEnableLabel);
}
// saving
for (auto const & i: vFields)
i->xEdit->save_value();
+ //enabling and disabling remaining fields
+ bool bEnable = !officecfg::Office::Common::Save::Document::UseUserData::isReadOnly();
+ m_xUseDataCB->set_sensitive(bEnable);
+ m_xUseDataImg->set_visible(!bEnable);
+
#if HAVE_FEATURE_GPGME
+ bEnable = !aUserOpt.IsTokenReadonly(UserOptToken::SigningKey);
+ m_xSigningKeyLB->set_sensitive(bEnable);
+ m_xSigningKeyFT->set_sensitive(bEnable);
+ m_xSigningKeyImg->set_visible(!bEnable);
+
+ bEnable = !aUserOpt.IsTokenReadonly(UserOptToken::EncryptionKey);
+ m_xEncryptionKeyLB->set_sensitive(bEnable);
+ m_xEncryptionKeyFT->set_sensitive(bEnable);
+ m_xEncryptionKeyImg->set_visible(!bEnable);
+
+ bEnable = !aUserOpt.IsTokenReadonly(UserOptToken::EncryptToSelf);
+ m_xEncryptToSelfCB->set_sensitive(bEnable);
+ m_xEncryptToSelfImg->set_visible(!bEnable);
+
OUString aSK = aUserOpt.GetToken(UserOptToken::SigningKey);
aSK.isEmpty() ? m_xSigningKeyLB->set_active( 0 ) //i.e. 'No Key'
: m_xSigningKeyLB->set_active_text( aSK );
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx
index fca286ddbb7a..6880ec4b2e33 100644
--- a/cui/source/options/opthtml.cxx
+++ b/cui/source/options/opthtml.cxx
@@ -18,27 +18,41 @@
*/
#include <svtools/langtab.hxx>
-#include <svtools/htmlcfg.hxx>
+#include <comphelper/configuration.hxx>
+#include <officecfg/Office/Common.hxx>
#include "opthtml.hxx"
OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/opthtmlpage.ui", "OptHtmlPage", &rSet)
, m_xSize1NF(m_xBuilder->weld_spin_button("size1"))
+ , m_xSize1Img(m_xBuilder->weld_widget("locksize1"))
, m_xSize2NF(m_xBuilder->weld_spin_button("size2"))
+ , m_xSize2Img(m_xBuilder->weld_widget("locksize2"))
, m_xSize3NF(m_xBuilder->weld_spin_button("size3"))
+ , m_xSize3Img(m_xBuilder->weld_widget("locksize3"))
, m_xSize4NF(m_xBuilder->weld_spin_button("size4"))
+ , m_xSize4Img(m_xBuilder->weld_widget("locksize4"))
, m_xSize5NF(m_xBuilder->weld_spin_button("size5"))
+ , m_xSize5Img(m_xBuilder->weld_widget("locksize5"))
, m_xSize6NF(m_xBuilder->weld_spin_button("size6"))
+ , m_xSize6Img(m_xBuilder->weld_widget("locksize6"))
, m_xSize7NF(m_xBuilder->weld_spin_button("size7"))
+ , m_xSize7Img(m_xBuilder->weld_widget("locksize7"))
, m_xNumbersEnglishUSCB(m_xBuilder->weld_check_button("numbersenglishus"))
+ , m_xNumbersEnglishUSImg(m_xBuilder->weld_widget("locknumbersenglishus"))
, m_xUnknownTagCB(m_xBuilder->weld_check_button("unknowntag"))
+ , m_xUnknownTagImg(m_xBuilder->weld_widget("lockunknowntag"))
, m_xIgnoreFontNamesCB(m_xBuilder->weld_check_button("ignorefontnames"))
+ , m_xIgnoreFontNamesImg(m_xBuilder->weld_widget("lockignorefontnames"))
, m_xStarBasicCB(m_xBuilder->weld_check_button("starbasic"))
+ , m_xStarBasicImg(m_xBuilder->weld_widget("lockstarbasic"))
, m_xStarBasicWarningCB(m_xBuilder->weld_check_button("starbasicwarning"))
+ , m_xStarBasicWarningImg(m_xBuilder->weld_widget("lockstarbasicwarning"))
, m_xPrintExtensionCB(m_xBuilder->weld_check_button("printextension"))
+ , m_xPrintExtensionImg(m_xBuilder->weld_widget("lockprintextension"))
, m_xSaveGrfLocalCB(m_xBuilder->weld_check_button("savegrflocal"))
- , m_xCharSetLB(new SvxTextEncodingBox(m_xBuilder->weld_combo_box("charset")))
+ , m_xSaveGrfLocalImg(m_xBuilder->weld_widget("locksavegrflocal"))
{
// replace placeholder with UI string from language list
OUString aText(m_xNumbersEnglishUSCB->get_label());
@@ -55,9 +69,6 @@ OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* p
}
m_xStarBasicCB->connect_toggled(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
-
- // initialize the characterset listbox
- m_xCharSetLB->FillWithMimeAndSelectBest();
}
OfaHtmlTabPage::~OfaHtmlTabPage()
@@ -70,70 +81,183 @@ std::unique_ptr<SfxTabPage> OfaHtmlTabPage::Create( weld::Container* pPage, weld
return std::make_unique<OfaHtmlTabPage>(pPage, pController, *rAttrSet);
}
+OUString OfaHtmlTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3", "size1FT", "size2FT",
+ "size3FT", "size4FT", "size5FT", "size6FT", "size7FT" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "numbersenglishus", "unknowntag", "ignorefontnames", "starbasic",
+ "starbasicwarning", "printextension", "savegrflocal" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaHtmlTabPage::FillItemSet( SfxItemSet* )
{
- SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges = comphelper::ConfigurationChanges::create();
if(m_xSize1NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(0, static_cast<sal_uInt16>(m_xSize1NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_1::set(
+ static_cast<sal_uInt16>(m_xSize1NF->get_value()), xChanges);
if(m_xSize2NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(1, static_cast<sal_uInt16>(m_xSize2NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_2::set(
+ static_cast<sal_uInt16>(m_xSize2NF->get_value()), xChanges);
if(m_xSize3NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(2, static_cast<sal_uInt16>(m_xSize3NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_3::set(
+ static_cast<sal_uInt16>(m_xSize3NF->get_value()), xChanges);
if(m_xSize4NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(3, static_cast<sal_uInt16>(m_xSize4NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_4::set(
+ static_cast<sal_uInt16>(m_xSize4NF->get_value()), xChanges);
if(m_xSize5NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(4, static_cast<sal_uInt16>(m_xSize5NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_5::set(
+ static_cast<sal_uInt16>(m_xSize5NF->get_value()), xChanges);
if(m_xSize6NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(5, static_cast<sal_uInt16>(m_xSize6NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_6::set(
+ static_cast<sal_uInt16>(m_xSize6NF->get_value()), xChanges);
if(m_xSize7NF->get_value_changed_from_saved())
- rHtmlOpt.SetFontSize(6, static_cast<sal_uInt16>(m_xSize7NF->get_value()));
+ officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_7::set(
+ static_cast<sal_uInt16>(m_xSize7NF->get_value()), xChanges);
if(m_xNumbersEnglishUSCB->get_state_changed_from_saved())
- rHtmlOpt.SetNumbersEnglishUS(m_xNumbersEnglishUSCB->get_active());
+ officecfg::Office::Common::Filter::HTML::Import::NumbersEnglishUS::set(
+ m_xNumbersEnglishUSCB->get_active(), xChanges);
if(m_xUnknownTagCB->get_state_changed_from_saved())
- rHtmlOpt.SetImportUnknown(m_xUnknownTagCB->get_active());
+ officecfg::Office::Common::Filter::HTML::Import::UnknownTag::set(
+ m_xUnknownTagCB->get_active(), xChanges);
if(m_xIgnoreFontNamesCB->get_state_changed_from_saved())
- rHtmlOpt.SetIgnoreFontFamily(m_xIgnoreFontNamesCB->get_active());
+ officecfg::Office::Common::Filter::HTML::Import::FontSetting::set(
+ m_xIgnoreFontNamesCB->get_active(), xChanges);
if(m_xStarBasicCB->get_state_changed_from_saved())
- rHtmlOpt.SetStarBasic(m_xStarBasicCB->get_active());
+ officecfg::Office::Common::Filter::HTML::Export::Basic::set(
+ m_xStarBasicCB->get_active(), xChanges);
if(m_xStarBasicWarningCB->get_state_changed_from_saved())
- rHtmlOpt.SetStarBasicWarning(m_xStarBasicWarningCB->get_active());
+ officecfg::Office::Common::Filter::HTML::Export::Warning::set(
+ m_xStarBasicWarningCB->get_active(), xChanges);
if(m_xSaveGrfLocalCB->get_state_changed_from_saved())
- rHtmlOpt.SetSaveGraphicsLocal(m_xSaveGrfLocalCB->get_active());
+ officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::set(
+ m_xSaveGrfLocalCB->get_active(), xChanges);
if(m_xPrintExtensionCB->get_state_changed_from_saved())
- rHtmlOpt.SetPrintLayoutExtension(m_xPrintExtensionCB->get_active());
-
- if( m_xCharSetLB->GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
- rHtmlOpt.SetTextEncoding( m_xCharSetLB->GetSelectTextEncoding() );
+ officecfg::Office::Common::Filter::HTML::Export::PrintLayout::set(
+ m_xPrintExtensionCB->get_active(), xChanges);
+ xChanges->commit();
return false;
}
void OfaHtmlTabPage::Reset( const SfxItemSet* )
{
- SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
- m_xSize1NF->set_value(rHtmlOpt.GetFontSize(0));
- m_xSize2NF->set_value(rHtmlOpt.GetFontSize(1));
- m_xSize3NF->set_value(rHtmlOpt.GetFontSize(2));
- m_xSize4NF->set_value(rHtmlOpt.GetFontSize(3));
- m_xSize5NF->set_value(rHtmlOpt.GetFontSize(4));
- m_xSize6NF->set_value(rHtmlOpt.GetFontSize(5));
- m_xSize7NF->set_value(rHtmlOpt.GetFontSize(6));
- m_xNumbersEnglishUSCB->set_active(rHtmlOpt.IsNumbersEnglishUS());
- m_xUnknownTagCB->set_active(rHtmlOpt.IsImportUnknown());
- m_xIgnoreFontNamesCB->set_active(rHtmlOpt.IsIgnoreFontFamily());
-
- m_xStarBasicCB->set_active(rHtmlOpt.IsStarBasic());
- m_xStarBasicWarningCB->set_active(rHtmlOpt.IsStarBasicWarning());
- m_xStarBasicWarningCB->set_sensitive(!m_xStarBasicCB->get_active());
- m_xSaveGrfLocalCB->set_active(rHtmlOpt.IsSaveGraphicsLocal());
- m_xPrintExtensionCB->set_active(rHtmlOpt.IsPrintLayoutExtension());
+ m_xSize1NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_1::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_1::isReadOnly())
+ {
+ m_xSize1NF->set_sensitive(false);
+ m_xSize1Img->set_visible(true);
+ }
+
+ m_xSize2NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_2::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_2::isReadOnly())
+ {
+ m_xSize2NF->set_sensitive(false);
+ m_xSize2Img->set_visible(true);
+ }
+
+ m_xSize3NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_3::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_3::isReadOnly())
+ {
+ m_xSize3NF->set_sensitive(false);
+ m_xSize3Img->set_visible(true);
+ }
+
+ m_xSize4NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_4::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_4::isReadOnly())
+ {
+ m_xSize4NF->set_sensitive(false);
+ m_xSize4Img->set_visible(true);
+ }
+
+ m_xSize5NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_5::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_5::isReadOnly())
+ {
+ m_xSize5NF->set_sensitive(false);
+ m_xSize5Img->set_visible(true);
+ }
+
+ m_xSize6NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_6::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_6::isReadOnly())
+ {
+ m_xSize6NF->set_sensitive(false);
+ m_xSize6Img->set_visible(true);
+ }
+
+ m_xSize7NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_7::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_7::isReadOnly())
+ {
+ m_xSize7NF->set_sensitive(false);
+ m_xSize7Img->set_visible(true);
+ }
+
+ m_xNumbersEnglishUSCB->set_active(officecfg::Office::Common::Filter::HTML::Import::NumbersEnglishUS::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::NumbersEnglishUS::isReadOnly())
+ {
+ m_xNumbersEnglishUSCB->set_sensitive(false);
+ m_xNumbersEnglishUSImg->set_visible(true);
+ }
+
+ m_xUnknownTagCB->set_active(officecfg::Office::Common::Filter::HTML::Import::UnknownTag::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::UnknownTag::isReadOnly())
+ {
+ m_xUnknownTagCB->set_sensitive(false);
+ m_xUnknownTagImg->set_visible(true);
+ }
+
+ m_xIgnoreFontNamesCB->set_active(officecfg::Office::Common::Filter::HTML::Import::FontSetting::get());
+ if (officecfg::Office::Common::Filter::HTML::Import::FontSetting::isReadOnly())
+ {
+ m_xIgnoreFontNamesCB->set_sensitive(false);
+ m_xIgnoreFontNamesImg->set_visible(true);
+ }
+
+ m_xStarBasicCB->set_active(officecfg::Office::Common::Filter::HTML::Export::Basic::get());
+ if (officecfg::Office::Common::Filter::HTML::Export::Basic::isReadOnly())
+ {
+ m_xStarBasicCB->set_sensitive(false);
+ m_xStarBasicImg->set_visible(true);
+ }
+
+ m_xStarBasicWarningCB->set_active(officecfg::Office::Common::Filter::HTML::Export::Warning::get());
+ m_xStarBasicWarningCB->set_sensitive(!m_xStarBasicCB->get_active() && !officecfg::Office::Common::Filter::HTML::Export::Warning::isReadOnly());
+ m_xStarBasicWarningImg->set_visible(officecfg::Office::Common::Filter::HTML::Export::Warning::isReadOnly());
+
+ m_xSaveGrfLocalCB->set_active(officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::get());
+ if (officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::isReadOnly())
+ {
+ m_xSaveGrfLocalCB->set_sensitive(false);
+ m_xSaveGrfLocalImg->set_visible(true);
+ }
+
+ m_xPrintExtensionCB->set_active(officecfg::Office::Common::Filter::HTML::Export::PrintLayout::get());
+ if (officecfg::Office::Common::Filter::HTML::Export::PrintLayout::isReadOnly())
+ {
+ m_xPrintExtensionCB->set_sensitive(false);
+ m_xPrintExtensionImg->set_visible(true);
+ }
m_xPrintExtensionCB->save_state();
m_xStarBasicCB->save_state();
@@ -149,13 +273,9 @@ void OfaHtmlTabPage::Reset( const SfxItemSet* )
m_xNumbersEnglishUSCB->save_state();
m_xUnknownTagCB->save_state();
m_xIgnoreFontNamesCB->save_state();
-
- if( !rHtmlOpt.IsDefaultTextEncoding() &&
- m_xCharSetLB->GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
- m_xCharSetLB->SelectTextEncoding( rHtmlOpt.GetTextEncoding() );
}
-IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::Toggleable&, rBox, void)
{
m_xStarBasicWarningCB->set_sensitive(!rBox.get_active());
}
diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx
index 9915c3f0c2a9..2f389a7af571 100644
--- a/cui/source/options/opthtml.hxx
+++ b/cui/source/options/opthtml.hxx
@@ -25,24 +25,37 @@ class OfaHtmlTabPage : public SfxTabPage
{
std::unique_ptr<weld::SpinButton> m_xSize1NF;
+ std::unique_ptr<weld::Widget> m_xSize1Img;
std::unique_ptr<weld::SpinButton> m_xSize2NF;
+ std::unique_ptr<weld::Widget> m_xSize2Img;
std::unique_ptr<weld::SpinButton> m_xSize3NF;
+ std::unique_ptr<weld::Widget> m_xSize3Img;
std::unique_ptr<weld::SpinButton> m_xSize4NF;
+ std::unique_ptr<weld::Widget> m_xSize4Img;
std::unique_ptr<weld::SpinButton> m_xSize5NF;
+ std::unique_ptr<weld::Widget> m_xSize5Img;
std::unique_ptr<weld::SpinButton> m_xSize6NF;
+ std::unique_ptr<weld::Widget> m_xSize6Img;
std::unique_ptr<weld::SpinButton> m_xSize7NF;
+ std::unique_ptr<weld::Widget> m_xSize7Img;
std::unique_ptr<weld::CheckButton> m_xNumbersEnglishUSCB;
+ std::unique_ptr<weld::Widget> m_xNumbersEnglishUSImg;
std::unique_ptr<weld::CheckButton> m_xUnknownTagCB;
+ std::unique_ptr<weld::Widget> m_xUnknownTagImg;
std::unique_ptr<weld::CheckButton> m_xIgnoreFontNamesCB;
+ std::unique_ptr<weld::Widget> m_xIgnoreFontNamesImg;
std::unique_ptr<weld::CheckButton> m_xStarBasicCB;
+ std::unique_ptr<weld::Widget> m_xStarBasicImg;
std::unique_ptr<weld::CheckButton> m_xStarBasicWarningCB;
+ std::unique_ptr<weld::Widget> m_xStarBasicWarningImg;
std::unique_ptr<weld::CheckButton> m_xPrintExtensionCB;
+ std::unique_ptr<weld::Widget> m_xPrintExtensionImg;
std::unique_ptr<weld::CheckButton> m_xSaveGrfLocalCB;
- std::unique_ptr<SvxTextEncodingBox> m_xCharSetLB;
+ std::unique_ptr<weld::Widget> m_xSaveGrfLocalImg;
- DECL_LINK(CheckBoxHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(CheckBoxHdl_Impl, weld::Toggleable&, void);
public:
OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -50,6 +63,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index f8648bac62a4..eaf0e8616bfd 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -27,9 +27,8 @@
#include <vcl/weld.hxx>
#include <sfx2/filedlghelper.hxx>
#include <vcl/svapp.hxx>
-#include <unotools/securityoptions.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <dialmgr.hxx>
#include "optinet2.hxx"
@@ -52,7 +51,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/task/PasswordContainer.hpp>
#include <com/sun/star/task/XPasswordContainer2.hpp>
-#include "securityoptions.hxx"
+#include <securityoptions.hxx>
#include "webconninfo.hxx"
#include "certpath.hxx"
#include "tsaurls.hxx"
@@ -88,19 +87,17 @@ IMPL_LINK(SvxProxyTabPage, PortChangedHdl, weld::Entry&, rEdit, void)
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
- CuiResId( RID_SVXSTR_OPT_PROXYPORTS)));
+ CuiResId(RID_CUISTR_OPT_PROXYPORTS)));
xErrorBox->run();
}
}
-constexpr OUStringLiteral g_aProxyModePN = u"ooInetProxyType";
-constexpr OUStringLiteral g_aHttpProxyPN = u"ooInetHTTPProxyName";
-constexpr OUStringLiteral g_aHttpPortPN = u"ooInetHTTPProxyPort";
-constexpr OUStringLiteral g_aHttpsProxyPN = u"ooInetHTTPSProxyName";
-constexpr OUStringLiteral g_aHttpsPortPN = u"ooInetHTTPSProxyPort";
-constexpr OUStringLiteral g_aFtpProxyPN = u"ooInetFTPProxyName";
-constexpr OUStringLiteral g_aFtpPortPN = u"ooInetFTPProxyPort";
-constexpr OUStringLiteral g_aNoProxyDescPN = u"ooInetNoProxy";
+constexpr OUString g_aProxyModePN = u"ooInetProxyType"_ustr;
+constexpr OUString g_aHttpProxyPN = u"ooInetHTTPProxyName"_ustr;
+constexpr OUString g_aHttpPortPN = u"ooInetHTTPProxyPort"_ustr;
+constexpr OUString g_aHttpsProxyPN = u"ooInetHTTPSProxyName"_ustr;
+constexpr OUString g_aHttpsPortPN = u"ooInetHTTPSProxyPort"_ustr;
+constexpr OUString g_aNoProxyDescPN = u"ooInetNoProxy"_ustr;
IMPL_STATIC_LINK(SvxProxyTabPage, NumberOnlyTextFilterHdl, OUString&, rTest, bool)
{
@@ -127,21 +124,24 @@ IMPL_STATIC_LINK(SvxProxyTabPage, NoSpaceTextFilterHdl, OUString&, rTest, bool)
/********************************************************************/
SvxProxyTabPage::SvxProxyTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optproxypage.ui", "OptProxyPage", &rSet)
+ , m_xProxyModeFT(m_xBuilder->weld_label("label2"))
, m_xProxyModeLB(m_xBuilder->weld_combo_box("proxymode"))
+ , m_xProxyModeImg(m_xBuilder->weld_widget("lockproxymode"))
, m_xHttpProxyFT(m_xBuilder->weld_label("httpft"))
, m_xHttpProxyED(m_xBuilder->weld_entry("http"))
+ , m_xHttpProxyImg(m_xBuilder->weld_widget("lockhttp"))
, m_xHttpPortFT(m_xBuilder->weld_label("httpportft"))
, m_xHttpPortED(m_xBuilder->weld_entry("httpport"))
+ , m_xHttpPortImg(m_xBuilder->weld_widget("lockhttpport"))
, m_xHttpsProxyFT(m_xBuilder->weld_label("httpsft"))
, m_xHttpsProxyED(m_xBuilder->weld_entry("https"))
+ , m_xHttpsProxyImg(m_xBuilder->weld_widget("lockhttps"))
, m_xHttpsPortFT(m_xBuilder->weld_label("httpsportft"))
, m_xHttpsPortED(m_xBuilder->weld_entry("httpsport"))
- , m_xFtpProxyFT(m_xBuilder->weld_label("ftpft"))
- , m_xFtpProxyED(m_xBuilder->weld_entry("ftp"))
- , m_xFtpPortFT(m_xBuilder->weld_label("ftpportft"))
- , m_xFtpPortED(m_xBuilder->weld_entry("ftpport"))
+ , m_xHttpsPortImg(m_xBuilder->weld_widget("lockhttpsport"))
, m_xNoProxyForFT(m_xBuilder->weld_label("noproxyft"))
, m_xNoProxyForED(m_xBuilder->weld_entry("noproxy"))
+ , m_xNoProxyForImg(m_xBuilder->weld_widget("locknoproxy"))
, m_xNoProxyDescFT(m_xBuilder->weld_label("noproxydesc"))
{
m_xHttpProxyED->connect_insert_text(LINK(this, SvxProxyTabPage, NoSpaceTextFilterHdl));
@@ -150,14 +150,10 @@ SvxProxyTabPage::SvxProxyTabPage(weld::Container* pPage, weld::DialogController*
m_xHttpsProxyED->connect_insert_text(LINK(this, SvxProxyTabPage, NoSpaceTextFilterHdl));
m_xHttpsPortED->connect_insert_text(LINK(this, SvxProxyTabPage, NumberOnlyTextFilterHdl));
m_xHttpsPortED->connect_changed(LINK(this, SvxProxyTabPage, PortChangedHdl));
- m_xFtpProxyED->connect_insert_text(LINK(this, SvxProxyTabPage, NoSpaceTextFilterHdl));
- m_xFtpPortED->connect_insert_text(LINK(this, SvxProxyTabPage, NumberOnlyTextFilterHdl));
- m_xFtpPortED->connect_changed(LINK(this, SvxProxyTabPage, PortChangedHdl));
Link<weld::Widget&,void> aLink = LINK( this, SvxProxyTabPage, LoseFocusHdl_Impl );
m_xHttpPortED->connect_focus_out( aLink );
m_xHttpsPortED->connect_focus_out( aLink );
- m_xFtpPortED->connect_focus_out( aLink );
m_xProxyModeLB->connect_changed(LINK( this, SvxProxyTabPage, ProxyHdl_Impl ));
@@ -170,8 +166,7 @@ SvxProxyTabPage::SvxProxyTabPage(weld::Container* pPage, weld::DialogController*
aProperty.Name = "nodepath";
aProperty.Value <<= OUString( "org.openoffice.Inet/Settings" );
- Sequence< Any > aArgumentList( 1 );
- aArgumentList[0] <<= aProperty;
+ Sequence< Any > aArgumentList{ Any(aProperty) };
m_xConfigurationUpdateAccess = xConfigurationProvider->createInstanceWithArguments(
"com.sun.star.configuration.ConfigurationUpdateAccess",
@@ -205,6 +200,8 @@ void SvxProxyTabPage::ReadConfigData_Impl()
nIntValue = *x;
m_xHttpPortED->set_text( OUString::number( nIntValue ));
}
+ else
+ m_xHttpPortED->set_text( "" );
m_xHttpsProxyED->set_text( officecfg::Inet::Settings::ooInetHTTPSProxyName::get() );
x = officecfg::Inet::Settings::ooInetHTTPSProxyPort::get();
@@ -213,14 +210,8 @@ void SvxProxyTabPage::ReadConfigData_Impl()
nIntValue = *x;
m_xHttpsPortED->set_text( OUString::number( nIntValue ));
}
-
- m_xFtpProxyED->set_text( officecfg::Inet::Settings::ooInetFTPProxyName::get() );
- x = officecfg::Inet::Settings::ooInetFTPProxyPort::get();
- if (x)
- {
- nIntValue = *x;
- m_xFtpPortED->set_text( OUString::number( nIntValue ));
- }
+ else
+ m_xHttpsPortED->set_text( "" );
m_xNoProxyForED->set_text( officecfg::Inet::Settings::ooInetNoProxy::get() );
}
@@ -254,16 +245,6 @@ void SvxProxyTabPage::ReadConfigDefaults_Impl()
m_xHttpsPortED->set_text( OUString::number( nIntValue ));
}
- if( xPropertyState->getPropertyDefault(g_aFtpProxyPN) >>= aStringValue )
- {
- m_xFtpProxyED->set_text( aStringValue );
- }
-
- if( xPropertyState->getPropertyDefault(g_aFtpPortPN) >>= nIntValue )
- {
- m_xFtpPortED->set_text( OUString::number( nIntValue ));
- }
-
if( xPropertyState->getPropertyDefault(g_aNoProxyDescPN) >>= aStringValue )
{
m_xNoProxyForED->set_text( aStringValue );
@@ -294,8 +275,6 @@ void SvxProxyTabPage::RestoreConfigDefaults_Impl()
xPropertyState->setPropertyToDefault(g_aHttpPortPN);
xPropertyState->setPropertyToDefault(g_aHttpsProxyPN);
xPropertyState->setPropertyToDefault(g_aHttpsPortPN);
- xPropertyState->setPropertyToDefault(g_aFtpProxyPN);
- xPropertyState->setPropertyToDefault(g_aFtpPortPN);
xPropertyState->setPropertyToDefault(g_aNoProxyDescPN);
Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
@@ -324,13 +303,26 @@ void SvxProxyTabPage::Reset(const SfxItemSet*)
m_xHttpPortED->save_value();
m_xHttpsProxyED->save_value();
m_xHttpsPortED->save_value();
- m_xFtpProxyED->save_value();
- m_xFtpPortED->save_value();
m_xNoProxyForED->save_value();
EnableControls_Impl();
}
+OUString SvxProxyTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "httpft", "httpsft",
+ "noproxyft", "httpportft", "httpsportft", "noproxydesc" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxProxyTabPage::FillItemSet(SfxItemSet* )
{
bool bModified = false;
@@ -375,18 +367,6 @@ bool SvxProxyTabPage::FillItemSet(SfxItemSet* )
bModified = true;
}
- if( m_xFtpProxyED->get_value_changed_from_saved())
- {
- xPropertySet->setPropertyValue( g_aFtpProxyPN, Any(m_xFtpProxyED->get_text()) );
- bModified = true;
- }
-
- if ( m_xFtpPortED->get_value_changed_from_saved() )
- {
- xPropertySet->setPropertyValue( g_aFtpPortPN, Any(m_xFtpPortED->get_text().toInt32()));
- bModified = true;
- }
-
if ( m_xNoProxyForED->get_value_changed_from_saved() )
{
xPropertySet->setPropertyValue( g_aNoProxyDescPN, Any( m_xNoProxyForED->get_text()));
@@ -417,34 +397,38 @@ bool SvxProxyTabPage::FillItemSet(SfxItemSet* )
void SvxProxyTabPage::EnableControls_Impl()
{
- m_xProxyModeLB->set_sensitive(!officecfg::Inet::Settings::ooInetNoProxy::isReadOnly());
+ bool bEnable = !officecfg::Inet::Settings::ooInetNoProxy::isReadOnly();
+ m_xProxyModeFT->set_sensitive(bEnable);
+ m_xProxyModeLB->set_sensitive(bEnable);
+ m_xProxyModeImg->set_visible(!bEnable);
const bool bManualConfig = m_xProxyModeLB->get_active() == 2;
- const bool bHTTPProxyNameEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPProxyName::isReadOnly();
- const bool bHTTPProxyPortEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPProxyPort::isReadOnly();
+ bEnable = !officecfg::Inet::Settings::ooInetHTTPProxyName::isReadOnly();
+ const bool bHTTPProxyNameEnabled = bManualConfig && bEnable;
+ const bool bHTTPProxyPortEnabled = bManualConfig && bEnable;
m_xHttpProxyFT->set_sensitive(bHTTPProxyNameEnabled);
m_xHttpProxyED->set_sensitive(bHTTPProxyNameEnabled);
+ m_xHttpProxyImg->set_visible(!bEnable);
m_xHttpPortFT->set_sensitive(bHTTPProxyPortEnabled);
m_xHttpPortED->set_sensitive(bHTTPProxyPortEnabled);
+ m_xHttpPortImg->set_visible(!bEnable);
- const bool bHTTPSProxyNameEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPSProxyName::isReadOnly();
- const bool bHTTPSProxyPortEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetHTTPSProxyPort::isReadOnly();
+ bEnable = !officecfg::Inet::Settings::ooInetHTTPSProxyName::isReadOnly();
+ const bool bHTTPSProxyNameEnabled = bManualConfig && bEnable;
+ const bool bHTTPSProxyPortEnabled = bManualConfig && bEnable;
m_xHttpsProxyFT->set_sensitive(bHTTPSProxyNameEnabled);
m_xHttpsProxyED->set_sensitive(bHTTPSProxyNameEnabled);
+ m_xHttpsProxyImg->set_visible(!bEnable);
m_xHttpsPortFT->set_sensitive(bHTTPSProxyPortEnabled);
m_xHttpsPortED->set_sensitive(bHTTPSProxyPortEnabled);
+ m_xHttpsPortImg->set_visible(!bEnable);
- const bool bFTPProxyNameEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetFTPProxyName::isReadOnly();
- const bool bFTPProxyPortEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetFTPProxyPort::isReadOnly();
- m_xFtpProxyFT->set_sensitive(bFTPProxyNameEnabled);
- m_xFtpProxyED->set_sensitive(bFTPProxyNameEnabled);
- m_xFtpPortFT->set_sensitive(bFTPProxyPortEnabled);
- m_xFtpPortED->set_sensitive(bFTPProxyPortEnabled);
-
- const bool bInetNoProxyEnabled = bManualConfig && !officecfg::Inet::Settings::ooInetNoProxy::isReadOnly();
+ bEnable = !officecfg::Inet::Settings::ooInetNoProxy::isReadOnly();
+ const bool bInetNoProxyEnabled = bManualConfig && bEnable;
m_xNoProxyForFT->set_sensitive(bInetNoProxyEnabled);
m_xNoProxyForED->set_sensitive(bInetNoProxyEnabled);
+ m_xNoProxyForImg->set_visible(!bEnable);
m_xNoProxyDescFT->set_sensitive(bInetNoProxyEnabled);
}
@@ -475,20 +459,29 @@ IMPL_STATIC_LINK(SvxProxyTabPage, LoseFocusHdl_Impl, weld::Widget&, rControl, vo
/********************************************************************/
SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optsecuritypage.ui", "OptSecurityPage", &rSet)
- , mpSecOptions(new SvtSecurityOptions)
, m_xSecurityOptionsPB(m_xBuilder->weld_button("options"))
, m_xSavePasswordsCB(m_xBuilder->weld_check_button("savepassword"))
+ , m_xSavePasswordsImg(m_xBuilder->weld_widget("locksavepassword"))
, m_xShowConnectionsPB(m_xBuilder->weld_button("connections"))
, m_xMasterPasswordCB(m_xBuilder->weld_check_button("usemasterpassword"))
+ , m_xMasterPasswordImg(m_xBuilder->weld_widget("lockusemasterpassword"))
, m_xMasterPasswordFT(m_xBuilder->weld_label("masterpasswordtext"))
, m_xMasterPasswordPB(m_xBuilder->weld_button("masterpassword"))
, m_xMacroSecFrame(m_xBuilder->weld_container("macrosecurity"))
, m_xMacroSecPB(m_xBuilder->weld_button("macro"))
, m_xCertFrame(m_xBuilder->weld_container("certificatepath"))
, m_xCertPathPB(m_xBuilder->weld_button("cert"))
+ , m_xCertPathImg(m_xBuilder->weld_widget("lockcertipath"))
+ , m_xCertPathLabel(m_xBuilder->weld_label("label7"))
, m_xTSAURLsFrame(m_xBuilder->weld_container("tsaurls"))
, m_xTSAURLsPB(m_xBuilder->weld_button("tsas"))
+ , m_xTSAURLsImg(m_xBuilder->weld_widget("locktsas"))
+ , m_xTSAURLsLabel(m_xBuilder->weld_label("label9"))
, m_xNoPasswordSaveFT(m_xBuilder->weld_label("nopasswordsave"))
+ , m_xCertMgrPathLB(m_xBuilder->weld_button("browse"))
+ , m_xParameterEdit(m_xBuilder->weld_entry("parameterfield"))
+ , m_xCertMgrPathImg(m_xBuilder->weld_widget("lockcertimanager"))
+ , m_xCertMgrPathLabel(m_xBuilder->weld_label("label11"))
{
//fdo#65595, we need height-for-width support here, but for now we can
//bodge it
@@ -496,7 +489,7 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* pPage, weld::DialogContr
int nMaxWidth = m_xSavePasswordsCB->get_approximate_digit_width() * 40;
if (aPrefSize.Width() > nMaxWidth)
{
- m_xSavePasswordsCB->set_label_line_wrap(true);
+ m_xSavePasswordsCB->set_label_wrap(true);
m_xSavePasswordsCB->set_size_request(nMaxWidth, -1);
}
@@ -505,17 +498,53 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* pPage, weld::DialogContr
InitControls();
m_xSecurityOptionsPB->connect_clicked( LINK( this, SvxSecurityTabPage, SecurityOptionsHdl ) );
- m_xSavePasswordsCB->connect_clicked( LINK( this, SvxSecurityTabPage, SavePasswordHdl ) );
+ m_xSavePasswordsCB->connect_toggled( LINK( this, SvxSecurityTabPage, SavePasswordHdl ) );
m_xMasterPasswordPB->connect_clicked( LINK( this, SvxSecurityTabPage, MasterPasswordHdl ) );
- m_xMasterPasswordCB->connect_clicked( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) );
+ m_xMasterPasswordCB->connect_toggled( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) );
m_xShowConnectionsPB->connect_clicked( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
m_xMacroSecPB->connect_clicked( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) );
m_xCertPathPB->connect_clicked( LINK( this, SvxSecurityTabPage, CertPathPBHdl ) );
m_xTSAURLsPB->connect_clicked( LINK( this, SvxSecurityTabPage, TSAURLsPBHdl ) );
+ m_xCertMgrPathLB->connect_clicked( LINK( this, SvxSecurityTabPage, CertMgrPBHdl ) );
ActivatePage( rSet );
}
+IMPL_LINK_NOARG(SvxSecurityTabPage, CertMgrPBHdl, weld::Button&, void)
+{
+ try
+ {
+ FileDialogHelper aHelper(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ FileDialogFlags::NONE, nullptr);
+ OUString sPath = m_xParameterEdit->get_text();
+ if (sPath.isEmpty())
+ sPath = "/usr/bin";
+
+ OUString sUrl;
+ osl::FileBase::getFileURLFromSystemPath(sPath, sUrl);
+ aHelper.SetDisplayDirectory(sUrl);
+
+ if (ERRCODE_NONE == aHelper.Execute())
+ {
+ sUrl = aHelper.GetPath();
+ if (osl::FileBase::getSystemPathFromFileURL(sUrl, sPath) != osl::FileBase::E_None)
+ {
+ sPath.clear();
+ }
+ m_xParameterEdit->set_text(sPath);
+ }
+ std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+ comphelper::ConfigurationChanges::create());
+ OUString sCurCertMgr = m_xParameterEdit->get_text();
+ officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sCurCertMgr, pBatch);
+ pBatch->commit();
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("cui.options", "CertMgrPBHdl");
+ }
+}
+
SvxSecurityTabPage::~SvxSecurityTabPage()
{
}
@@ -523,11 +552,11 @@ SvxSecurityTabPage::~SvxSecurityTabPage()
IMPL_LINK_NOARG(SvxSecurityTabPage, SecurityOptionsHdl, weld::Button&, void)
{
if (!m_xSecOptDlg)
- m_xSecOptDlg.reset(new svx::SecurityOptionsDialog(GetFrameWeld(), mpSecOptions.get()));
+ m_xSecOptDlg.reset(new svx::SecurityOptionsDialog(GetFrameWeld()));
m_xSecOptDlg->run();
}
-IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl, weld::Toggleable&, void)
{
try
{
@@ -606,7 +635,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordHdl, weld::Button&, void)
{}
}
-IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl, weld::Toggleable&, void)
{
try
{
@@ -741,11 +770,51 @@ void SvxSecurityTabPage::InitControls()
m_xMasterPasswordFT->set_sensitive(true);
}
}
+
+ if (officecfg::Office::Common::Passwords::UseStorage::isReadOnly())
+ {
+ m_xSavePasswordsCB->set_sensitive(false);
+ m_xShowConnectionsPB->set_sensitive(false);
+ m_xSavePasswordsImg->set_visible(true);
+ m_xMasterPasswordCB->set_sensitive(false);
+ m_xMasterPasswordPB->set_sensitive(false);
+ m_xMasterPasswordImg->set_visible(true);
+ }
}
catch (const Exception&)
{
m_xSavePasswordsCB->set_sensitive( false );
}
+
+ try
+ {
+ OUString sCurCertMgr = officecfg::Office::Common::Security::Scripting::CertMgrPath::get();
+
+ if (!sCurCertMgr.isEmpty())
+ m_xParameterEdit->set_text(sCurCertMgr);
+
+ bool bEnable = !officecfg::Office::Common::Security::Scripting::CertMgrPath::isReadOnly();
+ m_xCertMgrPathLB->set_sensitive(bEnable);
+ m_xParameterEdit->set_sensitive(bEnable);
+ m_xCertMgrPathLabel->set_sensitive(bEnable);
+ m_xCertMgrPathImg->set_visible(!bEnable);
+
+ bEnable = !officecfg::Office::Common::Security::Scripting::TSAURLs::isReadOnly();
+ m_xTSAURLsPB->set_sensitive(bEnable);
+ m_xTSAURLsLabel->set_sensitive(bEnable);
+ m_xTSAURLsImg->set_visible(!bEnable);
+
+#ifndef UNX
+ bEnable = !officecfg::Office::Common::Security::Scripting::CertDir::isReadOnly() ||
+ !officecfg::Office::Common::Security::Scripting::ManualCertDir::isReadOnly();
+ m_xCertPathPB->set_sensitive(bEnable);
+ m_xCertPathLabel->set_sensitive(bEnable);
+ m_xCertPathImg->set_visible(!bEnable);
+#endif
+ }
+ catch (const uno::Exception&)
+ {
+ }
}
std::unique_ptr<SfxTabPage> SvxSecurityTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
@@ -764,39 +833,56 @@ DeactivateRC SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-namespace
+OUString SvxSecurityTabPage::GetAllStrings()
{
- bool CheckAndSave( SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModified )
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label4", "label2", "masterpasswordtext",
+ "nopasswordsave", "label3", "label5", "label8",
+ "label7", "label10", "label9", "label12",
+ "label11" };
+
+ for (const auto& label : labels)
{
- bool bModified = false;
- if ( _rOpt.IsOptionEnabled( _eOpt ) )
- {
- bModified = _rOpt.IsOptionSet( _eOpt ) != _bIsChecked;
- if ( bModified )
- {
- _rOpt.SetOption( _eOpt, _bIsChecked );
- _rModified = true;
- }
- }
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "savepassword", "usemasterpassword" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
- return bModified;
+ // TODO: Should we exclude button strings from the search?
+ // button id: "browse" is excluded
+ OUString buttons[] = { "options", "connections", "masterpassword", "macro", "cert", "tsas" };
+
+ for (const auto& btn : buttons)
+ {
+ if (const auto& pString = m_xBuilder->weld_button(btn))
+ sAllStrings += pString->get_label() + " ";
}
+
+ return sAllStrings.replaceAll("_", "");
}
bool SvxSecurityTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
- if (m_xSecOptDlg)
+ if (m_xSecOptDlg) {
+ bModified = m_xSecOptDlg->SetSecurityOptions();
+ }
+
+ std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+ comphelper::ConfigurationChanges::create());
+ if (m_xParameterEdit->get_value_changed_from_saved())
{
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, m_xSecOptDlg->IsSaveOrSendDocsChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnSigning, m_xSecOptDlg->IsSignDocsChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnPrint, m_xSecOptDlg->IsPrintDocsChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, m_xSecOptDlg->IsCreatePdfChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, m_xSecOptDlg->IsRemovePersInfoChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, m_xSecOptDlg->IsRecommPasswdChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified );
- CheckAndSave( *mpSecOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified );
+ OUString sCurCertMgr = m_xParameterEdit->get_text();
+ officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sCurCertMgr, pBatch);
+ pBatch->commit();
}
return bModified;
@@ -857,6 +943,22 @@ std::unique_ptr<SfxTabPage> SvxEMailTabPage::Create( weld::Container* pPage, wel
/* -------------------------------------------------------------------------*/
+OUString SvxEMailTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "browsetitle", "suppress" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
+/* -------------------------------------------------------------------------*/
+
bool SvxEMailTabPage::FillItemSet( SfxItemSet* )
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index 25facb94f76f..e05a79be029b 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -30,25 +30,27 @@ class SvxProxyTabPage : public SfxTabPage
{
private:
+ std::unique_ptr<weld::Label> m_xProxyModeFT;
std::unique_ptr<weld::ComboBox> m_xProxyModeLB;
+ std::unique_ptr<weld::Widget> m_xProxyModeImg;
std::unique_ptr<weld::Label> m_xHttpProxyFT;
std::unique_ptr<weld::Entry> m_xHttpProxyED;
+ std::unique_ptr<weld::Widget> m_xHttpProxyImg;
std::unique_ptr<weld::Label> m_xHttpPortFT;
std::unique_ptr<weld::Entry> m_xHttpPortED;
+ std::unique_ptr<weld::Widget> m_xHttpPortImg;
std::unique_ptr<weld::Label> m_xHttpsProxyFT;
std::unique_ptr<weld::Entry> m_xHttpsProxyED;
+ std::unique_ptr<weld::Widget> m_xHttpsProxyImg;
std::unique_ptr<weld::Label> m_xHttpsPortFT;
std::unique_ptr<weld::Entry> m_xHttpsPortED;
-
- std::unique_ptr<weld::Label> m_xFtpProxyFT;
- std::unique_ptr<weld::Entry> m_xFtpProxyED;
- std::unique_ptr<weld::Label> m_xFtpPortFT;
- std::unique_ptr<weld::Entry> m_xFtpPortED;
+ std::unique_ptr<weld::Widget> m_xHttpsPortImg;
std::unique_ptr<weld::Label> m_xNoProxyForFT;
std::unique_ptr<weld::Entry> m_xNoProxyForED;
+ std::unique_ptr<weld::Widget> m_xNoProxyForImg;
std::unique_ptr<weld::Label> m_xNoProxyDescFT;
css::uno::Reference< css::uno::XInterface > m_xConfigurationUpdateAccess;
@@ -68,18 +70,19 @@ public:
SvxProxyTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~SvxProxyTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
// class SvxSecurityTabPage ---------------------------------------------
-class SvtSecurityOptions;
class CertPathDialog;
class SvxSecurityTabPage : public SfxTabPage
{
private:
- std::unique_ptr<SvtSecurityOptions> mpSecOptions;
std::unique_ptr<svx::SecurityOptionsDialog> m_xSecOptDlg;
std::unique_ptr<CertPathDialog> mpCertPathDlg;
@@ -89,9 +92,11 @@ private:
std::unique_ptr<weld::Button> m_xSecurityOptionsPB;
std::unique_ptr<weld::CheckButton> m_xSavePasswordsCB;
+ std::unique_ptr<weld::Widget> m_xSavePasswordsImg;
std::unique_ptr<weld::Button> m_xShowConnectionsPB;
std::unique_ptr<weld::CheckButton> m_xMasterPasswordCB;
+ std::unique_ptr<weld::Widget> m_xMasterPasswordImg;
std::unique_ptr<weld::Label> m_xMasterPasswordFT;
std::unique_ptr<weld::Button> m_xMasterPasswordPB;
@@ -100,20 +105,30 @@ private:
std::unique_ptr<weld::Container> m_xCertFrame;
std::unique_ptr<weld::Button> m_xCertPathPB;
+ std::unique_ptr<weld::Widget> m_xCertPathImg;
+ std::unique_ptr<weld::Label> m_xCertPathLabel;
std::unique_ptr<weld::Container> m_xTSAURLsFrame;
std::unique_ptr<weld::Button> m_xTSAURLsPB;
+ std::unique_ptr<weld::Widget> m_xTSAURLsImg;
+ std::unique_ptr<weld::Label> m_xTSAURLsLabel;
std::unique_ptr<weld::Label> m_xNoPasswordSaveFT;
+ std::unique_ptr<weld::Button> m_xCertMgrPathLB;
+ std::unique_ptr<weld::Entry> m_xParameterEdit;
+ std::unique_ptr<weld::Widget> m_xCertMgrPathImg;
+ std::unique_ptr<weld::Label> m_xCertMgrPathLabel;
+
DECL_LINK(SecurityOptionsHdl, weld::Button&, void);
- DECL_LINK(SavePasswordHdl, weld::Button&, void);
+ DECL_LINK(SavePasswordHdl, weld::Toggleable&, void);
DECL_LINK(MasterPasswordHdl, weld::Button&, void);
- DECL_LINK(MasterPasswordCBHdl, weld::Button&, void);
+ DECL_LINK(MasterPasswordCBHdl, weld::Toggleable&, void);
DECL_LINK(ShowPasswordsHdl, weld::Button&, void);
DECL_LINK(MacroSecPBHdl, weld::Button&, void );
DECL_LINK(CertPathPBHdl, weld::Button&, void );
DECL_LINK(TSAURLsPBHdl, weld::Button&, void );
+ DECL_LINK(CertMgrPBHdl, weld::Button&, void );
void InitControls();
@@ -125,6 +140,9 @@ public:
SvxSecurityTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
virtual ~SvxSecurityTabPage() override;
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
@@ -153,6 +171,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 81bb4e30450a..cc89865bdd28 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/safeint.hxx>
#include <sal/config.h>
#include <sal/log.hxx>
@@ -32,6 +33,7 @@
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
#include <strings.hrc>
#include <vcl/svapp.hxx>
@@ -43,14 +45,12 @@
#include <svtools/restartdialog.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/inputdlg.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
#if HAVE_FEATURE_JAVA
#include <jvmfwk/framework.hxx>
#endif
@@ -59,8 +59,6 @@
#define CLASSPATH_DELIMITER SAL_PATHSEPARATOR
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
@@ -77,7 +75,9 @@ SvxJavaOptionsPage::SvxJavaOptionsPage(weld::Container* pPage, weld::DialogContr
, m_xClassPathBtn(m_xBuilder->weld_button("classpath"))
, m_xExpertConfigBtn(m_xBuilder->weld_button("expertconfig"))
, m_xExperimentalCB(m_xBuilder->weld_check_button("experimental"))
+ , m_xExperimentalImg(m_xBuilder->weld_widget("lockexperimental"))
, m_xMacroCB(m_xBuilder->weld_check_button("macrorecording"))
+ , m_xMacroImg(m_xBuilder->weld_widget("lockmacrorecording"))
, m_xAddDialogText(m_xBuilder->weld_label("selectruntime"))
, m_xJavaFrame(m_xBuilder->weld_widget("javaframe"))
{
@@ -91,12 +91,14 @@ SvxJavaOptionsPage::SvxJavaOptionsPage(weld::Container* pPage, weld::DialogContr
m_xJavaList->connect_toggled( LINK( this, SvxJavaOptionsPage, CheckHdl_Impl ) );
m_xJavaList->connect_changed( LINK( this, SvxJavaOptionsPage, SelectHdl_Impl ) );
- std::vector<int> aWidths;
- aWidths.push_back(m_xJavaList->get_checkbox_column_width());
- aWidths.push_back(m_xJavaList->get_pixel_size("Sun Microsystems Inc.").Width());
+ std::vector<int> aWidths
+ {
+ m_xJavaList->get_checkbox_column_width(),
+ o3tl::narrowing<int>(m_xJavaList->get_pixel_size("Sun Microsystems Inc.").Width())
+ };
m_xJavaList->set_column_fixed_widths(aWidths);
- m_xJavaEnableCB->connect_clicked( LINK( this, SvxJavaOptionsPage, EnableHdl_Impl ) );
+ m_xJavaEnableCB->connect_toggled( LINK( this, SvxJavaOptionsPage, EnableHdl_Impl ) );
m_xAddBtn->connect_clicked( LINK( this, SvxJavaOptionsPage, AddHdl_Impl ) );
m_xParameterBtn->connect_clicked( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) );
m_xClassPathBtn->connect_clicked( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) );
@@ -107,10 +109,16 @@ SvxJavaOptionsPage::SvxJavaOptionsPage(weld::Container* pPage, weld::DialogContr
m_xExpertConfigBtn->set_sensitive(false);
if (officecfg::Office::Common::Misc::MacroRecorderMode::isReadOnly())
+ {
m_xMacroCB->set_sensitive(false);
+ m_xMacroImg->set_visible(true);
+ }
if (officecfg::Office::Common::Misc::ExperimentalMode::isReadOnly())
+ {
m_xExperimentalCB->set_sensitive(false);
+ m_xExperimentalImg->set_visible(true);
+ }
xDialogListener->SetDialogClosedLink( LINK( this, SvxJavaOptionsPage, DialogClosedHdl ) );
@@ -132,7 +140,7 @@ SvxJavaOptionsPage::~SvxJavaOptionsPage()
#endif
}
-IMPL_LINK_NOARG(SvxJavaOptionsPage, EnableHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxJavaOptionsPage, EnableHdl_Impl, weld::Toggleable&, void)
{
bool bEnable = m_xJavaFrame->get_sensitive() && m_xJavaEnableCB->get_active();
m_xJavaList->set_sensitive(bEnable);
@@ -153,7 +161,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, weld::Button&, void)
try
{
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- xFolderPicker = FolderPicker::create(xContext);
+ xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld());
OUString sWorkFolder = SvtPathOptions().GetWorkPath();
xFolderPicker->setDisplayDirectory( sWorkFolder );
@@ -431,14 +439,14 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
- CuiResId(RID_SVXSTR_JRE_NOT_RECOGNIZED)));
+ CuiResId(RID_CUISTR_JRE_NOT_RECOGNIZED)));
xBox->run();
}
else if ( JFW_E_FAILED_VERSION == eErr )
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
- CuiResId(RID_SVXSTR_JRE_FAILED_VERSION)));
+ CuiResId(RID_CUISTR_JRE_FAILED_VERSION)));
xBox->run();
}
@@ -465,6 +473,36 @@ std::unique_ptr<SfxTabPage> SvxJavaOptionsPage::Create(weld::Container* pPage, w
return std::make_unique<SvxJavaOptionsPage>(pPage, pController, *rAttrSet);
}
+OUString SvxJavaOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "javapath", "selectruntime", "label12" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "javaenabled", "experimental", "macrorecording" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString buttons[] = { "add", "parameters", "classpath", "expertconfig" };
+
+ for (const auto& btn : buttons)
+ {
+ if (const auto& pString = m_xBuilder->weld_button(btn))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
{
bool bModified = false;
@@ -611,6 +649,7 @@ SvxJavaParameterDlg::SvxJavaParameterDlg(weld::Window* pParent)
m_xAssignedList->set_size_request(m_xAssignedList->get_approximate_digit_width() * 54,
m_xAssignedList->get_height_rows(6));
m_xParameterEdit->connect_changed( LINK( this, SvxJavaParameterDlg, ModifyHdl_Impl ) );
+ m_xParameterEdit->connect_activate(LINK(this, SvxJavaParameterDlg, ActivateHdl_Impl));
m_xAssignBtn->connect_clicked( LINK( this, SvxJavaParameterDlg, AssignHdl_Impl ) );
m_xRemoveBtn->connect_clicked( LINK( this, SvxJavaParameterDlg, RemoveHdl_Impl ) );
m_xEditBtn->connect_clicked( LINK( this, SvxJavaParameterDlg, EditHdl_Impl ) );
@@ -652,6 +691,16 @@ IMPL_LINK_NOARG(SvxJavaParameterDlg, AssignHdl_Impl, weld::Button&, void)
EnableRemoveButton();
}
+IMPL_LINK_NOARG(SvxJavaParameterDlg, ActivateHdl_Impl, weld::Entry&, bool)
+{
+ if (m_xAssignBtn->get_sensitive())
+ {
+ AssignHdl_Impl(*m_xAssignBtn);
+ return true;
+ }
+ return false;
+}
+
IMPL_LINK_NOARG(SvxJavaParameterDlg, EditHdl_Impl, weld::Button&, void)
{
EditParameter();
@@ -698,7 +747,7 @@ void SvxJavaParameterDlg::EditParameter()
if (nPos == -1)
return;
- InputDialog aParamEditDlg(m_xDialog.get(), CuiResId(RID_SVXSTR_JAVA_START_PARAM));
+ InputDialog aParamEditDlg(m_xDialog.get(), CuiResId(RID_CUISTR_JAVA_START_PARAM));
OUString editableClassPath = m_xAssignedList->get_selected_text();
aParamEditDlg.SetEntryText(editableClassPath);
aParamEditDlg.HideHelpBtn();
@@ -778,17 +827,17 @@ SvxJavaClassPathDlg::~SvxJavaClassPathDlg()
IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void)
{
sfx2::FileDialogHelper aDlg(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
- aDlg.SetTitle( CuiResId( RID_SVXSTR_ARCHIVE_TITLE ) );
- aDlg.AddFilter( CuiResId( RID_SVXSTR_ARCHIVE_HEADLINE ), "*.jar;*.zip" );
+ aDlg.SetTitle( CuiResId( RID_CUISTR_ARCHIVE_TITLE ) );
+ aDlg.AddFilter( CuiResId( RID_CUISTR_ARCHIVE_HEADLINE ), "*.jar;*.zip" );
+ aDlg.SetContext(sfx2::FileDialogHelper::JavaClassPath);
OUString sFolder;
if (m_xPathList->count_selected_rows() > 0)
{
osl::FileBase::getFileURLFromSystemPath(m_xPathList->get_selected_text(), sFolder);
// best effort
}
- if (sFolder.isEmpty())
- sFolder = SvtPathOptions().GetWorkPath();
- aDlg.SetDisplayDirectory( sFolder );
+ if (!sFolder.isEmpty())
+ aDlg.SetDisplayDirectory( sFolder );
if ( aDlg.Execute() == ERRCODE_NONE )
{
OUString sURL = aDlg.GetPath();
@@ -803,7 +852,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void)
}
else
{
- OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ OUString sMsg( CuiResId( RID_CUISTR_MULTIFILE_DBL_ERR ) );
sMsg = sMsg.replaceFirst( "%1", sFile );
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
@@ -812,7 +861,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void)
}
else
{
- OUString sMsg( CuiResId( RID_SVXSTR_CANNOTCONVERTURL_ERR ) );
+ OUString sMsg( CuiResId( RID_CUISTR_CANNOTCONVERTURL_ERR ) );
sMsg = sMsg.replaceFirst( "%1", sURL );
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
@@ -825,7 +874,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void)
IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, weld::Button&, void)
{
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
+ Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get());
OUString sOldFolder;
if (m_xPathList->count_selected_rows() > 0)
@@ -851,7 +900,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, weld::Button&, void)
}
else
{
- OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ OUString sMsg( CuiResId( RID_CUISTR_MULTIFILE_DBL_ERR ) );
sMsg = sMsg.replaceFirst( "%1", sNewFolder );
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
@@ -860,7 +909,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, weld::Button&, void)
}
else
{
- OUString sMsg( CuiResId( RID_SVXSTR_CANNOTCONVERTURL_ERR ) );
+ OUString sMsg( CuiResId( RID_CUISTR_CANNOTCONVERTURL_ERR ) );
sMsg = sMsg.replaceFirst( "%1", sFolderURL );
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
@@ -922,6 +971,7 @@ OUString SvxJavaClassPathDlg::GetClassPath() const
return sPath.makeStringAndClear();
}
+#if HAVE_FEATURE_JAVA
void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
{
if ( m_sOldPath.isEmpty() )
@@ -929,20 +979,27 @@ void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
m_xPathList->clear();
if (!_rPath.isEmpty())
{
- sal_Int32 nIdx = 0;
- do
+ std::vector paths = jfw_convertUserPathList(_rPath);
+ for (auto const& path : paths)
{
- OUString sToken = _rPath.getToken( 0, CLASSPATH_DELIMITER, nIdx );
OUString sURL;
- osl::FileBase::getFileURLFromSystemPath(sToken, sURL); // best effort
+ if (path.startsWith("$"))
+ {
+ sURL = path;
+ rtl::Bootstrap::expandMacros(sURL);
+ }
+ else
+ {
+ osl::FileBase::getFileURLFromSystemPath(path, sURL);
+ }
INetURLObject aURL( sURL );
- m_xPathList->append("", sToken, SvFileInformationManager::GetImageId(aURL));
+ m_xPathList->append("", path, SvFileInformationManager::GetImageId(aURL));
}
- while (nIdx>=0);
// select first entry
m_xPathList->select(0);
}
SelectHdl_Impl(*m_xPathList);
}
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index a3af9aaf71b1..84422c903056 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -75,13 +75,15 @@ private:
std::unique_ptr<SvxJavaClassPathDlg> m_xPathDlg;
std::unique_ptr<weld::CheckButton> m_xExperimentalCB;
+ std::unique_ptr<weld::Widget> m_xExperimentalImg;
std::unique_ptr<weld::CheckButton> m_xMacroCB;
+ std::unique_ptr<weld::Widget> m_xMacroImg;
std::unique_ptr<weld::Label> m_xAddDialogText;
std::unique_ptr<weld::Widget> m_xJavaFrame;
- DECL_LINK(EnableHdl_Impl, weld::Button&, void);
+ DECL_LINK(EnableHdl_Impl, weld::Toggleable&, void);
DECL_LINK(CheckHdl_Impl, const weld::TreeView::iter_col&, void);
DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
DECL_LINK(AddHdl_Impl, weld::Button&, void);
@@ -108,6 +110,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
@@ -125,6 +129,7 @@ private:
std::unique_ptr<weld::Button> m_xEditBtn;
DECL_LINK(ModifyHdl_Impl, weld::Entry&, void);
+ DECL_LINK(ActivateHdl_Impl, weld::Entry&, bool);
DECL_LINK(AssignHdl_Impl, weld::Button&, void);
DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
DECL_LINK(DblClickHdl_Impl, weld::TreeView&, bool);
@@ -199,7 +204,9 @@ public:
void SetFocus() { m_xPathList->grab_focus(); }
OUString GetClassPath() const;
+#if HAVE_FEATURE_JAVA
void SetClassPath( const OUString& _rPath );
+#endif
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx
index 4a2c31c49f76..3c313338a021 100644
--- a/cui/source/options/optjsearch.cxx
+++ b/cui/source/options/optjsearch.cxx
@@ -22,8 +22,6 @@
#include <i18nutil/transliteration.hxx>
#include "optjsearch.hxx"
-using namespace com::sun::star::i18n;
-
SvxJSearchOptionsPage::SvxJSearchOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optjsearchpage.ui", "OptJSearchPage", &rSet)
@@ -201,6 +199,45 @@ void SvxJSearchOptionsPage::Reset( const SfxItemSet* )
m_xIgnoreMiddleDot ->save_state();
}
+OUString SvxJSearchOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "matchcase",
+ "matchfullhalfwidth",
+ "matchhiraganakatakana",
+ "matchcontractions",
+ "matchminusdashchoon",
+ "matchrepeatcharmarks",
+ "matchvariantformkanji",
+ "matcholdkanaforms",
+ "ignorepunctuation",
+ "ignorewhitespace",
+ "matchdiziduzu",
+ "matchbavahafa",
+ "matchtsithichidhizi",
+ "matchhyuiyubyuvyu",
+ "matchseshezeje",
+ "matchiaiya",
+ "matchkiku",
+ "matchprolongedsoundmark",
+ "ignoremiddledot" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
bool SvxJSearchOptionsPage::FillItemSet( SfxItemSet* )
{
diff --git a/cui/source/options/optjsearch.hxx b/cui/source/options/optjsearch.hxx
index f0da350ae651..96b7d73f1f11 100644
--- a/cui/source/options/optjsearch.hxx
+++ b/cui/source/options/optjsearch.hxx
@@ -59,6 +59,8 @@ public:
virtual ~SvxJSearchOptionsPage() override;
static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
+ virtual OUString GetAllStrings() override;
+
virtual void Reset( const SfxItemSet* rSet ) override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
diff --git a/cui/source/options/optlanguagetool.cxx b/cui/source/options/optlanguagetool.cxx
new file mode 100644
index 000000000000..3979b42c0521
--- /dev/null
+++ b/cui/source/options/optlanguagetool.cxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optlanguagetool.hxx"
+#include <officecfg/Office/Linguistic.hxx>
+#include <sal/log.hxx>
+#include <dialmgr.hxx>
+#include <strings.hrc>
+
+using LanguageToolCfg = officecfg::Office::Linguistic::GrammarChecking::LanguageTool;
+constexpr OUString LANGUAGETOOL_DEFAULT_URL = u"https://api.languagetool.org/v2"_ustr;
+constexpr OUString LANGUAGETOOLPLUS_DEFAULT_URL = u"https://api.languagetoolplus.com/v2"_ustr;
+
+OptLanguageToolTabPage::OptLanguageToolTabPage(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet& rSet)
+ : SfxTabPage(pPage, pController, "cui/ui/langtoolconfigpage.ui", "OptLangToolPage", &rSet)
+ , m_xBaseURLED(m_xBuilder->weld_entry("baseurl"))
+ , m_xBaseURLImg(m_xBuilder->weld_widget("lockbaseurl"))
+ , m_xUsernameED(m_xBuilder->weld_entry("username"))
+ , m_xUsernameImg(m_xBuilder->weld_widget("lockusername"))
+ , m_xApiKeyED(m_xBuilder->weld_entry("apikey"))
+ , m_xApiKeyImg(m_xBuilder->weld_widget("lockapikey"))
+ , m_xRestProtocol(m_xBuilder->weld_entry("restprotocol"))
+ , m_xRestProtocolImg(m_xBuilder->weld_widget("lockrestprotocol"))
+ , m_xActivateBox(m_xBuilder->weld_check_button("activate"))
+ , m_xActivateBoxImg(m_xBuilder->weld_widget("lockactivate"))
+ , m_xSSLDisableVerificationBox(m_xBuilder->weld_check_button("verifyssl"))
+ , m_xSSLDisableVerificationBoxImg(m_xBuilder->weld_widget("lockverifyssl"))
+ , m_xApiSettingsFrame(m_xBuilder->weld_frame("apisettings"))
+{
+ m_xActivateBox->connect_toggled(LINK(this, OptLanguageToolTabPage, CheckHdl));
+ EnableControls(LanguageToolCfg::IsEnabled::get());
+
+ // tdf#150494 Set default values as placeholder text
+ m_xBaseURLED->set_placeholder_text(CuiResId(RID_LANGUAGETOOL_LEAVE_EMPTY));
+ m_xUsernameED->set_placeholder_text(CuiResId(RID_LANGUAGETOOL_LEAVE_EMPTY));
+ m_xApiKeyED->set_placeholder_text(CuiResId(RID_LANGUAGETOOL_LEAVE_EMPTY));
+ m_xRestProtocol->set_placeholder_text(CuiResId(RID_LANGUAGETOOL_REST_LEAVE_EMPTY));
+}
+
+OptLanguageToolTabPage::~OptLanguageToolTabPage() {}
+
+void OptLanguageToolTabPage::EnableControls(bool bEnable)
+{
+ if (bEnable != LanguageToolCfg::IsEnabled::get())
+ {
+ auto batch(comphelper::ConfigurationChanges::create());
+ LanguageToolCfg::IsEnabled::set(bEnable, batch);
+ batch->commit();
+ }
+ m_xApiSettingsFrame->set_visible(bEnable);
+ m_xActivateBox->set_active(bEnable);
+ m_xActivateBox->set_sensitive(!LanguageToolCfg::IsEnabled::isReadOnly());
+ m_xActivateBoxImg->set_visible(LanguageToolCfg::IsEnabled::isReadOnly());
+ m_xSSLDisableVerificationBox->set_active(!LanguageToolCfg::SSLCertVerify::get());
+ m_xSSLDisableVerificationBox->set_sensitive(!LanguageToolCfg::SSLCertVerify::isReadOnly());
+ m_xSSLDisableVerificationBoxImg->set_visible(LanguageToolCfg::SSLCertVerify::isReadOnly());
+}
+
+IMPL_LINK_NOARG(OptLanguageToolTabPage, CheckHdl, weld::Toggleable&, void)
+{
+ EnableControls(m_xActivateBox->get_active());
+}
+
+void OptLanguageToolTabPage::Reset(const SfxItemSet*)
+{
+ // tdf#150494 If no URL has been set, use the default URL
+ OUString aUsername = LanguageToolCfg::Username::get().value_or("");
+ OUString aApiKey = LanguageToolCfg::ApiKey::get().value_or("");
+ OUString aBaseURL = LanguageToolCfg::BaseURL::get().value_or(
+ (aUsername.isEmpty() && aApiKey.isEmpty()) ? LANGUAGETOOL_DEFAULT_URL
+ : LANGUAGETOOLPLUS_DEFAULT_URL);
+
+ m_xBaseURLED->set_text(aBaseURL);
+ m_xBaseURLED->set_sensitive(!LanguageToolCfg::BaseURL::isReadOnly());
+ m_xBaseURLImg->set_visible(LanguageToolCfg::BaseURL::isReadOnly());
+
+ m_xUsernameED->set_text(aUsername);
+ m_xUsernameED->set_sensitive(!LanguageToolCfg::Username::isReadOnly());
+ m_xUsernameImg->set_visible(LanguageToolCfg::Username::isReadOnly());
+
+ m_xApiKeyED->set_text(aApiKey);
+ m_xApiKeyED->set_sensitive(!LanguageToolCfg::ApiKey::isReadOnly());
+ m_xApiKeyImg->set_visible(LanguageToolCfg::ApiKey::isReadOnly());
+
+ m_xRestProtocol->set_text(LanguageToolCfg::RestProtocol::get().value_or(""));
+ m_xRestProtocol->set_sensitive(!LanguageToolCfg::RestProtocol::isReadOnly());
+ m_xRestProtocolImg->set_visible(LanguageToolCfg::RestProtocol::isReadOnly());
+
+ m_xSSLDisableVerificationBox->set_active(!LanguageToolCfg::SSLCertVerify::get());
+ m_xSSLDisableVerificationBox->set_sensitive(!LanguageToolCfg::SSLCertVerify::isReadOnly());
+ m_xSSLDisableVerificationBoxImg->set_visible(LanguageToolCfg::SSLCertVerify::isReadOnly());
+}
+
+OUString OptLanguageToolTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "langtoolsettings", "disclaimer", "apisettingsheader", "base",
+ "urldesc", "usernamelbl", "usernamedesc", "apikeylbl",
+ "apikeydesc", "restlbl", "restdesc" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "activate", "verifyssl" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_link_button("policy"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
+bool OptLanguageToolTabPage::FillItemSet(SfxItemSet*)
+{
+ auto batch(comphelper::ConfigurationChanges::create());
+
+ // tdf#150494 If no URL has been set, then save the default URL
+ // tdf#159395 If Username and ApiKey are set, then save the default URL for paid service
+ OUString aBaseURL = m_xBaseURLED->get_text();
+ OUString aUsername = m_xUsernameED->get_text();
+ OUString aApiKey = m_xApiKeyED->get_text();
+
+ if (aBaseURL.isEmpty()
+ || (aUsername.isEmpty() && aApiKey.isEmpty() && aBaseURL == LANGUAGETOOLPLUS_DEFAULT_URL))
+ aBaseURL = LANGUAGETOOL_DEFAULT_URL;
+
+ if (!aUsername.isEmpty() && !aApiKey.isEmpty() && aBaseURL == LANGUAGETOOL_DEFAULT_URL)
+ aBaseURL = LANGUAGETOOLPLUS_DEFAULT_URL;
+
+ LanguageToolCfg::BaseURL::set(aBaseURL, batch);
+ LanguageToolCfg::Username::set(aUsername, batch);
+ LanguageToolCfg::ApiKey::set(aApiKey, batch);
+ LanguageToolCfg::RestProtocol::set(m_xRestProtocol->get_text(), batch);
+ LanguageToolCfg::SSLCertVerify::set(!m_xSSLDisableVerificationBox->get_active(), batch);
+ batch->commit();
+ return false;
+}
+
+std::unique_ptr<SfxTabPage> OptLanguageToolTabPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrSet)
+{
+ return std::make_unique<OptLanguageToolTabPage>(pPage, pController, *rAttrSet);
+}
diff --git a/cui/source/options/optlanguagetool.hxx b/cui/source/options/optlanguagetool.hxx
new file mode 100644
index 000000000000..3e3c3e8da0c7
--- /dev/null
+++ b/cui/source/options/optlanguagetool.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+#include <sfx2/tabdlg.hxx>
+#include <rtl/ustring.hxx>
+
+class OptLanguageToolTabPage : public SfxTabPage
+{
+public:
+ OptLanguageToolTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet);
+ virtual ~OptLanguageToolTabPage() override;
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
+
+ virtual OUString GetAllStrings() override;
+
+ virtual bool FillItemSet(SfxItemSet* rSet) override;
+ virtual void Reset(const SfxItemSet* rSet) override;
+
+private:
+ std::unique_ptr<weld::Entry> m_xBaseURLED;
+ std::unique_ptr<weld::Widget> m_xBaseURLImg;
+ std::unique_ptr<weld::Entry> m_xUsernameED;
+ std::unique_ptr<weld::Widget> m_xUsernameImg;
+ std::unique_ptr<weld::Entry> m_xApiKeyED;
+ std::unique_ptr<weld::Widget> m_xApiKeyImg;
+ std::unique_ptr<weld::Entry> m_xRestProtocol;
+ std::unique_ptr<weld::Widget> m_xRestProtocolImg;
+ std::unique_ptr<weld::CheckButton> m_xActivateBox;
+ std::unique_ptr<weld::Widget> m_xActivateBoxImg;
+ std::unique_ptr<weld::CheckButton> m_xSSLDisableVerificationBox;
+ std::unique_ptr<weld::Widget> m_xSSLDisableVerificationBoxImg;
+ std::unique_ptr<weld::Frame> m_xApiSettingsFrame;
+
+ void EnableControls(bool bEnable);
+
+ DECL_LINK(CheckHdl, weld::Toggleable&, void);
+};
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 865f56e16840..4ec9bd987462 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -17,11 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
#include <vcl/settings.hxx>
#include <vcl/weld.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <o3tl/safeint.hxx>
#include <officecfg/Office/Security.hxx>
+#include <officecfg/Office/Linguistic.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
#include <editeng/unolingu.hxx>
@@ -29,8 +32,9 @@
#include <sfx2/sfxsids.hrc>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
@@ -43,6 +47,8 @@
#include <com/sun/star/linguistic2/XLinguProperties.hpp>
#include <com/sun/star/lang/XServiceDisplayName.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <unotools/extendedsecurityoptions.hxx>
#include <svl/eitem.hxx>
#include <vcl/svapp.hxx>
@@ -57,6 +63,7 @@
#include <ucbhelper/content.hxx>
+#include <set>
#include <vector>
#include <map>
@@ -67,10 +74,10 @@ using namespace css::uno;
using namespace css::linguistic2;
using namespace css::beans;
-constexpr OUStringLiteral cSpell(SN_SPELLCHECKER);
-constexpr OUStringLiteral cGrammar(SN_GRAMMARCHECKER);
-constexpr OUStringLiteral cHyph(SN_HYPHENATOR);
-constexpr OUStringLiteral cThes(SN_THESAURUS);
+constexpr OUString cSpell(SN_SPELLCHECKER);
+constexpr OUString cGrammar(SN_GRAMMARCHECKER);
+constexpr OUString cHyph(SN_HYPHENATOR);
+constexpr OUString cThes(SN_THESAURUS);
// static ----------------------------------------------------------------
@@ -127,12 +134,12 @@ class ModuleUserData_Impl
OUString sImplName;
public:
- ModuleUserData_Impl( const OUString& sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
+ ModuleUserData_Impl( OUString sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
bParent(bIsParent),
bIsChecked(bChecked),
nType(nSetType),
nIndex(nSetIndex),
- sImplName(sImpName)
+ sImplName(std::move(sImpName))
{
}
bool IsParent() const {return bParent;}
@@ -191,31 +198,31 @@ enum EID_OPTIONS
EID_NUM_PRE_BREAK,
EID_NUM_POST_BREAK,
EID_HYPH_AUTO,
- EID_HYPH_SPECIAL
+ EID_HYPH_SPECIAL,
+ EID_SPELL_CLOSED_COMPOUND,
+ EID_SPELL_HYPHENATED_COMPOUND
};
}
-//! this array must have an entry for every value of EID_OPTIONS.
-// It is used to get the respective property name.
-static const char * aEidToPropName[] =
-{
- UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO
- UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO
- UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS
- UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS
- UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL
- UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN,
- UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK
- UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK
- UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO
- UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL
-};
-
static OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
{
- DBG_ASSERT( static_cast<unsigned int>(eEntryId) < SAL_N_ELEMENTS(aEidToPropName), "index out of range" );
- return OUString::createFromAscii( aEidToPropName[ static_cast<int>(eEntryId) ] );
+ switch (eEntryId)
+ {
+ case EID_SPELL_AUTO: return UPN_IS_SPELL_AUTO;
+ case EID_GRAMMAR_AUTO: return UPN_IS_GRAMMAR_AUTO;
+ case EID_CAPITAL_WORDS: return UPN_IS_SPELL_UPPER_CASE;
+ case EID_SPELL_CLOSED_COMPOUND: return UPN_IS_SPELL_CLOSED_COMPOUND;
+ case EID_SPELL_HYPHENATED_COMPOUND: return UPN_IS_SPELL_HYPHENATED_COMPOUND;
+ case EID_WORDS_WITH_DIGITS: return UPN_IS_SPELL_WITH_DIGITS;
+ case EID_SPELL_SPECIAL: return UPN_IS_SPELL_SPECIAL;
+ case EID_NUM_MIN_WORDLEN: return UPN_HYPH_MIN_WORD_LENGTH;
+ case EID_NUM_PRE_BREAK: return UPN_HYPH_MIN_LEADING;
+ case EID_NUM_POST_BREAK: return UPN_HYPH_MIN_TRAILING;
+ case EID_HYPH_AUTO: return UPN_IS_HYPH_AUTO;
+ case EID_HYPH_SPECIAL: return UPN_IS_HYPH_SPECIAL;
+ default: assert (false); abort();
+ }
}
namespace {
@@ -326,6 +333,22 @@ struct ServiceInfo_Impl
ServiceInfo_Impl() : bConfigured(false) {}
};
+struct Locale_less
+{
+ bool operator()(const css::lang::Locale& lhs, const css::lang::Locale& rhs) const
+ {
+ if (lhs.Language < rhs.Language)
+ return true;
+ if (lhs.Language > rhs.Language)
+ return false;
+ if (lhs.Country < rhs.Country)
+ return true;
+ if (lhs.Country > rhs.Country)
+ return false;
+ return lhs.Variant < rhs.Variant;
+ }
+};
+
}
typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
@@ -340,7 +363,7 @@ class SvxLinguData_Impl
ServiceInfoArr aDisplayServiceArr;
sal_uInt32 nDisplayServices;
- Sequence< Locale > aAllServiceLocales;
+ std::set<Locale, Locale_less> aAllServiceLocales;
LangImplNameTable aCfgSpellTable;
LangImplNameTable aCfgHyphTable;
LangImplNameTable aCfgThesTable;
@@ -359,7 +382,7 @@ public:
void SetChecked( const Sequence< OUString > &rConfiguredServices );
void Reconfigure( std::u16string_view rDisplayName, bool bEnable );
- const Sequence<Locale> & GetAllSupportedLocales() const { return aAllServiceLocales; }
+ const auto& GetAllSupportedLocales() const { return aAllServiceLocales; }
LangImplNameTable & GetSpellTable() { return aCfgSpellTable; }
LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
@@ -417,12 +440,12 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang,
if (pTable->count( nLang ))
aRes = (*pTable)[ nLang ]; // add configured services
sal_Int32 nIdx = aRes.getLength();
- DBG_ASSERT( static_cast<sal_Int32>(nDisplayServices) >= nIdx, "size mismatch" );
+ DBG_ASSERT( nDisplayServices >= o3tl::make_unsigned(nIdx), "size mismatch" );
aRes.realloc( nDisplayServices );
OUString *pRes = aRes.getArray();
// add not configured services
- for (sal_Int32 i = 0; i < static_cast<sal_Int32>(nDisplayServices); ++i)
+ for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
{
const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ];
OUString aImplName;
@@ -465,37 +488,6 @@ ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( std::u16string_view rSv
return nullptr;
}
-
-static void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd)
-{
- Sequence<Locale> aLocToAdd(rAdd.getLength());
- Locale* pLocToAdd = aLocToAdd.getArray();
- sal_Int32 nFound = 0;
- for(const Locale& i : rAdd)
- {
- bool bFound = false;
- for(const Locale& j : std::as_const(aAllLocales))
- {
- if (i.Language == j.Language &&
- i.Country == j.Country &&
- i.Variant == j.Variant)
- {
- bFound = true;
- break;
- }
- }
- if(!bFound)
- {
- pLocToAdd[nFound++] = i;
- }
- }
- sal_Int32 nLength = aAllLocales.getLength();
- aAllLocales.realloc( nLength + nFound);
- Locale* pAllLocales2 = aAllLocales.getArray();
- for(sal_Int32 i = 0; i < nFound; i++)
- pAllLocales2[nLength++] = pLocToAdd[i];
-}
-
static void lcl_MergeDisplayArray(
SvxLinguData_Impl &rData,
const ServiceInfo_Impl &rToAdd )
@@ -556,9 +548,12 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
xLinguSrvcMgr = LinguServiceManager::create(xContext);
- const Locale& rCurrentLocale = Application::GetSettings().GetLanguageTag().getLocale();
- Sequence<Any> aArgs(2);//second arguments has to be empty!
- aArgs.getArray()[0] <<= LinguMgr::GetLinguPropertySet();
+ const Locale& rCurrentLocale = Application::GetSettings().GetUILanguageTag().getLocale();
+ Sequence<Any> aArgs
+ {
+ Any(LinguMgr::GetLinguPropertySet()),
+ Any() // second argument has to be empty!
+ };
//read spell checker
const Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices(
@@ -579,7 +574,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
@@ -602,7 +597,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
@@ -624,7 +619,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
@@ -646,13 +641,13 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
Sequence< OUString > aCfgSvcs;
- for(auto const & locale : std::as_const(aAllServiceLocales))
+ for (auto const& locale : aAllServiceLocales)
{
LanguageType nLang = LanguageTag::convertToLanguageType( locale );
@@ -825,16 +820,18 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optlingupage.ui", "OptLinguPage", &rSet)
- , sCapitalWords (CuiResId(RID_SVXSTR_CAPITAL_WORDS))
- , sWordsWithDigits(CuiResId(RID_SVXSTR_WORDS_WITH_DIGITS))
- , sSpellSpecial (CuiResId(RID_SVXSTR_SPELL_SPECIAL))
- , sSpellAuto (CuiResId(RID_SVXSTR_SPELL_AUTO))
- , sGrammarAuto (CuiResId(RID_SVXSTR_GRAMMAR_AUTO))
- , sNumMinWordlen (CuiResId(RID_SVXSTR_NUM_MIN_WORDLEN))
- , sNumPreBreak (CuiResId(RID_SVXSTR_NUM_PRE_BREAK))
- , sNumPostBreak (CuiResId(RID_SVXSTR_NUM_POST_BREAK))
- , sHyphAuto (CuiResId(RID_SVXSTR_HYPH_AUTO))
- , sHyphSpecial (CuiResId(RID_SVXSTR_HYPH_SPECIAL))
+ , sCapitalWords (CuiResId(RID_CUISTR_CAPITAL_WORDS))
+ , sWordsWithDigits(CuiResId(RID_CUISTR_WORDS_WITH_DIGITS))
+ , sSpellSpecial (CuiResId(RID_CUISTR_SPELL_SPECIAL))
+ , sSpellAuto (CuiResId(RID_CUISTR_SPELL_AUTO))
+ , sSpellClosedCompound (CuiResId(RID_CUISTR_SPELL_CLOSED_COMPOUND))
+ , sSpellHyphenatedCompound (CuiResId(RID_CUISTR_SPELL_HYPHENATED_COMPOUND))
+ , sGrammarAuto (CuiResId(RID_CUISTR_GRAMMAR_AUTO))
+ , sNumMinWordlen (CuiResId(RID_CUISTR_NUM_MIN_WORDLEN))
+ , sNumPreBreak (CuiResId(RID_CUISTR_NUM_PRE_BREAK))
+ , sNumPostBreak (CuiResId(RID_CUISTR_NUM_POST_BREAK))
+ , sHyphAuto (CuiResId(RID_CUISTR_HYPH_AUTO))
+ , sHyphSpecial (CuiResId(RID_CUISTR_HYPH_SPECIAL))
, nUPN_HYPH_MIN_WORD_LENGTH(-1)
, nUPN_HYPH_MIN_LEADING(-1)
, nUPN_HYPH_MIN_TRAILING(-1)
@@ -849,6 +846,7 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
, m_xLinguDicsDelPB(m_xBuilder->weld_button("lingudictsdelete"))
, m_xLinguOptionsCLB(m_xBuilder->weld_tree_view("linguoptions"))
, m_xLinguOptionsEditPB(m_xBuilder->weld_button("linguoptionsedit"))
+ , m_xMoreDictsBox(m_xBuilder->weld_box("moredictsbox"))
, m_xMoreDictsLink(m_xBuilder->weld_link_button("moredictslink"))
{
m_xLinguModulesCLB->enable_toggle_buttons(weld::ColumnToggleType::Check);
@@ -874,7 +872,15 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
m_xMoreDictsLink->connect_activate_link(LINK(this, SvxLinguTabPage, OnLinkClick));
if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
- m_xMoreDictsLink->hide();
+ m_xMoreDictsBox->hide();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // hide User-defined Dictionaries part
+ m_xBuilder->weld_frame("dictsframe")->hide();
+ // hide Get more dictionaries URL + icon
+ m_xMoreDictsBox->hide();
+ }
xProp = LinguMgr::GetLinguPropertySet();
xDicList.set( LinguMgr::GetDictionaryList() );
@@ -918,6 +924,22 @@ std::unique_ptr<SfxTabPage> SvxLinguTabPage::Create( weld::Container* pPage, wel
return std::make_unique<SvxLinguTabPage>( pPage, pController, *rAttrSet );
}
+OUString SvxLinguTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "lingumodulesft", "lingudictsft", "label4" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xMoreDictsLink->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
{
bool bModified = true; // !!!!
@@ -1001,12 +1023,8 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
if (LinguMgr::GetIgnoreAllList() == xDic)
bChecked = true;
xDic->setActive( bChecked );
-
if (bChecked)
- {
- OUString aDicName( xDic->getName() );
- pActiveDic[ nActiveDics++ ] = aDicName;
- }
+ pActiveDic[nActiveDics++] = xDic->getName();
}
}
}
@@ -1045,7 +1063,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
OptionsUserData aPostBreakData(m_xLinguOptionsCLB->get_id(EID_NUM_POST_BREAK).toUInt32());
if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() )
{
- SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) );
+ SfxHyphenRegionItem aHyp( SID_ATTR_HYPHENREGION );
aHyp.GetMinLead() = static_cast<sal_uInt8>(aPreBreakData.GetNumericValue());
aHyp.GetMinTrail() = static_cast<sal_uInt8>(aPostBreakData.GetNumericValue());
rCoreSet->Put( aHyp );
@@ -1056,8 +1074,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
const SfxPoolItem* pOld = GetOldItem( *rCoreSet, SID_AUTOSPELL_CHECK );
if ( !pOld || static_cast<const SfxBoolItem*>(pOld)->GetValue() != bNewAutoCheck )
{
- rCoreSet->Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_CHECK ),
- bNewAutoCheck ) );
+ rCoreSet->Put( SfxBoolItem( SID_AUTOSPELL_CHECK, bNewAutoCheck ) );
bModified = true;
}
@@ -1138,7 +1155,7 @@ void SvxLinguTabPage::UpdateModulesBox_Impl()
{
const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i];
m_xLinguModulesCLB->append();
- m_xLinguModulesCLB->set_id(i, OUString::number(reinterpret_cast<sal_Int64>(&rInfo)));
+ m_xLinguModulesCLB->set_id(i, weld::toId(&rInfo));
m_xLinguModulesCLB->set_toggle(i, rInfo.bConfigured ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguModulesCLB->set_text(i, rInfo.sDisplayName, 0);
}
@@ -1182,6 +1199,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sSpellAuto, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_AUTO));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1191,6 +1209,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sGrammarAuto, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_GRAMMAR_AUTO));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1200,6 +1219,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sCapitalWords, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_UPPER_CASE));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1209,6 +1229,27 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sWordsWithDigits, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_WITH_DIGITS));
+
+ m_xLinguOptionsCLB->append();
+ ++nEntry;
+
+ aLngCfg.GetProperty( UPN_IS_SPELL_CLOSED_COMPOUND ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_CLOSED_COMPOUND, false, 0, true, bVal).GetUserData();
+ m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xLinguOptionsCLB->set_text(nEntry, sSpellClosedCompound, 0);
+ m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_CLOSED_COMPOUND));
+
+ m_xLinguOptionsCLB->append();
+ ++nEntry;
+
+ aLngCfg.GetProperty( UPN_IS_SPELL_HYPHENATED_COMPOUND ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_HYPHENATED_COMPOUND, false, 0, true, bVal).GetUserData();
+ m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xLinguOptionsCLB->set_text(nEntry, sSpellHyphenatedCompound, 0);
+ m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_HYPHENATED_COMPOUND));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1218,6 +1259,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sSpellSpecial, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_SPECIAL));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1226,12 +1268,12 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
m_xLinguOptionsCLB->set_text(nEntry, sNumMinWordlen + " " + OUString::number(nVal), 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_HYPH_MIN_WORD_LENGTH));
nUPN_HYPH_MIN_WORD_LENGTH = nEntry;
const SfxHyphenRegionItem *pHyp = nullptr;
- sal_uInt16 nWhich = GetWhich( SID_ATTR_HYPHENREGION );
- if ( rSet->GetItemState( nWhich, false ) == SfxItemState::SET )
- pHyp = &static_cast<const SfxHyphenRegionItem &>( rSet->Get( nWhich ) );
+ if ( rSet->GetItemState( SID_ATTR_HYPHENREGION, false ) == SfxItemState::SET )
+ pHyp = & rSet->Get( SID_ATTR_HYPHENREGION );
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1242,6 +1284,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
nUserData = OptionsUserData( EID_NUM_PRE_BREAK, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
m_xLinguOptionsCLB->set_text(nEntry, sNumPreBreak + " " + OUString::number(nVal), 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_HYPH_MIN_LEADING));
nUPN_HYPH_MIN_LEADING = nEntry;
m_xLinguOptionsCLB->append();
@@ -1253,6 +1296,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
nUserData = OptionsUserData( EID_NUM_POST_BREAK, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
m_xLinguOptionsCLB->set_text(nEntry, sNumPostBreak + " " + OUString::number(nVal), 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_HYPH_MIN_TRAILING));
nUPN_HYPH_MIN_TRAILING = nEntry;
m_xLinguOptionsCLB->append();
@@ -1263,6 +1307,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sHyphAuto, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_HYPH_AUTO));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1272,6 +1317,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sHyphSpecial, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_HYPH_SPECIAL));
m_xLinguOptionsCLB->thaw();
@@ -1284,6 +1330,15 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguDicsCLB->get_height_rows(5));
m_xLinguOptionsCLB->set_size_request(m_xLinguOptionsCLB->get_preferred_size().Width(),
m_xLinguOptionsCLB->get_height_rows(5));
+
+ if (officecfg::Office::Linguistic::General::DictionaryList::ActiveDictionaries::isReadOnly())
+ {
+ m_xLinguDicsFT->set_sensitive(false);
+ m_xLinguDicsCLB->set_sensitive(false);
+ m_xLinguDicsNewPB->set_sensitive(false);
+ m_xLinguDicsEditPB->set_sensitive(false);
+ m_xLinguDicsDelPB->set_sensitive(false);
+ }
}
IMPL_LINK(SvxLinguTabPage, BoxDoubleClickHdl_Impl, weld::TreeView&, rBox, bool)
@@ -1330,20 +1385,18 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
if (!pLinguData)
pLinguData.reset( new SvxLinguData_Impl );
- SvxLinguData_Impl aOldLinguData( *pLinguData );
+ SvxLinguData_Impl aOldLinguData(*pLinguData);
SvxEditModulesDlg aDlg(GetFrameWeld(), *pLinguData);
if (aDlg.run() != RET_OK)
- *pLinguData = aOldLinguData;
+ *pLinguData = std::move(aOldLinguData);
// evaluate new status of 'bConfigured' flag
sal_uInt32 nLen = pLinguData->GetDisplayServiceCount();
for (sal_uInt32 i = 0; i < nLen; ++i)
pLinguData->GetDisplayServiceArray()[i].bConfigured = false;
- const Locale* pAllLocales = pLinguData->GetAllSupportedLocales().getConstArray();
- sal_Int32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
- for (sal_Int32 k = 0; k < nLocales; ++k)
+ for (const auto& locale : pLinguData->GetAllSupportedLocales())
{
- LanguageType nLang = LanguageTag::convertToLanguageType( pAllLocales[k] );
+ LanguageType nLang = LanguageTag::convertToLanguageType(locale);
if (pLinguData->GetSpellTable().count( nLang ))
pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
if (pLinguData->GetGrammarTable().count( nLang ))
@@ -1486,7 +1539,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
}
else
{
- OSL_FAIL( "rBtn unexpected value" );
+ SAL_WARN("cui.options", "rBtn unexpected value");
}
}
@@ -1518,7 +1571,7 @@ IMPL_LINK(SvxLinguTabPage, SelectHdl_Impl, weld::TreeView&, rBox, void)
}
else
{
- OSL_FAIL( "rBox unexpected value" );
+ SAL_WARN("cui.options", "rBtn unexpected value");
}
}
@@ -1530,9 +1583,10 @@ void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
m_xLinguModulesCLB->hide();
m_xLinguModulesEditPB->hide();
- if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER)
+ if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER &&
+ !comphelper::LibreOfficeKit::isActive())
{
- m_xMoreDictsLink->show();
+ m_xMoreDictsBox->show();
}
}
}
@@ -1545,10 +1599,10 @@ IMPL_STATIC_LINK_NOARG(SvxLinguTabPage, OnLinkClick, weld::LinkButton&, bool)
SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& rData)
: GenericDialogController(pParent, "cui/ui/editmodulesdialog.ui", "EditModulesDialog")
- , sSpell(CuiResId(RID_SVXSTR_SPELL))
- , sHyph(CuiResId(RID_SVXSTR_HYPH))
- , sThes(CuiResId(RID_SVXSTR_THES))
- , sGrammar(CuiResId(RID_SVXSTR_GRAMMAR))
+ , sSpell(CuiResId(RID_CUISTR_SPELL))
+ , sHyph(CuiResId(RID_CUISTR_HYPH))
+ , sThes(CuiResId(RID_CUISTR_THES))
+ , sGrammar(CuiResId(RID_CUISTR_GRAMMAR))
, rLinguData(rData)
, m_xModulesCLB(m_xBuilder->weld_tree_view("lingudicts"))
, m_xPrioUpPB(m_xBuilder->weld_button("up"))
@@ -1584,17 +1638,20 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
m_xLanguageLB->SetLanguageList(SvxLanguageListFlags::EMPTY, false, false, true);
//fill language box
- const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales();
- for (Locale const & locale : rLoc)
- {
- LanguageType nLang = LanguageTag::convertToLanguageType( locale );
- m_xLanguageLB->InsertLanguage(nLang);
- }
- LanguageType eSysLang = MsLangId::getSystemLanguage();
+ const auto& rLoc = rLinguData.GetAllSupportedLocales();
+ std::vector<LanguageType> aLanguages;
+ aLanguages.reserve(rLoc.size());
+ std::transform(rLoc.begin(), rLoc.end(), std::back_inserter(aLanguages),
+ [](Locale const& locale) { return LanguageTag::convertToLanguageType(locale); });
+ m_xLanguageLB->InsertLanguages(aLanguages);
+ LanguageType eSysLang = MsLangId::getConfiguredSystemLanguage();
m_xLanguageLB->set_active_id( eSysLang );
if (m_xLanguageLB->get_active_id() != eSysLang)
m_xLanguageLB->set_active(0);
+ css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
+
m_xLanguageLB->connect_changed( LINK( this, SvxEditModulesDlg, LangSelectListBoxHdl_Impl ));
LangSelectHdl_Impl(m_xLanguageLB.get());
}
@@ -1602,7 +1659,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
SvxEditModulesDlg::~SvxEditModulesDlg()
{
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ delete weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
}
IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
@@ -1613,16 +1670,16 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
bool bDisableUp = true;
bool bDisableDown = true;
- ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos).toInt64());
+ ModuleUserData_Impl* pData = weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos));
if (!pData->IsParent() && pData->GetType() != TYPE_HYPH)
{
if (nCurPos < rBox.n_children() - 1)
{
- bDisableDown = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 1).toInt64())->IsParent();
+ bDisableDown = weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 1))->IsParent();
}
if (nCurPos > 1)
{
- bDisableUp = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 1).toInt64())->IsParent();
+ bDisableUp = weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 1))->IsParent();
}
}
m_xPrioUpPB->set_sensitive(!bDisableUp);
@@ -1631,7 +1688,7 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void )
{
- ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first).toInt64());
+ ModuleUserData_Impl* pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first));
if (pData->IsParent() || pData->GetType() != TYPE_HYPH)
return;
@@ -1640,7 +1697,7 @@ IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const weld::TreeView::iter
auto nPos = m_xModulesCLB->get_iter_index_in_parent(rRowCol.first);
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
{
- pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
if (!pData->IsParent() && pData->GetType() == TYPE_HYPH && i != nPos)
{
m_xModulesCLB->set_toggle(i, TRISTATE_FALSE);
@@ -1671,7 +1728,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
bool bChanged = false;
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
{
- ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ ModuleUserData_Impl* pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
if (pData->IsParent())
{
if (bChanged)
@@ -1714,7 +1771,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
}
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ delete weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
m_xModulesCLB->clear();
// display entries for new selected language
@@ -1723,19 +1780,28 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
{
sal_Int32 n;
ServiceInfo_Impl* pInfo;
+ bool bReadOnly = false;
int nRow = 0;
// spellchecker entries
ModuleUserData_Impl* pUserData = new ModuleUserData_Impl(
OUString(), true, false, TYPE_SPELL, 0 );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ OUString sId(weld::toId(pUserData));
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sSpell, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ OUString aLangNodeName = LanguageTag::convertToBcp47(aCurLocale);
+ OUString aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/SpellCheckerList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
const OUString *pName = aNames.getConstArray();
sal_Int32 nNames = aNames.getLength();
@@ -1765,13 +1831,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_SPELL, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1779,13 +1846,20 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// grammar checker entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_GRAMMAR, 0 );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sGrammar, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/GrammarCheckerList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
pName = aNames.getConstArray();
nNames = aNames.getLength();
@@ -1816,13 +1890,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_GRAMMAR, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1830,13 +1905,20 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// hyphenator entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_HYPH, 0 );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sHyph, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/HyphenatorList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
pName = aNames.getConstArray();
nNames = aNames.getLength();
@@ -1866,13 +1948,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_HYPH, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1880,13 +1963,20 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// thesaurus entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_THES, 0 );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sThes, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/ThesaurusList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
pName = aNames.getConstArray();
nNames = aNames.getLength();
@@ -1916,13 +2006,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_THES, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index e85ef1d7e23a..129cbc1b01b7 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -30,11 +30,13 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(weld::Container* pPage, weld::DialogControlle
: SfxTabPage(pPage, pController, "cui/ui/optopenclpage.ui", "OptOpenCLPage", &rSet)
, maConfig(OpenCLConfig::get())
, mxUseOpenCL(m_xBuilder->weld_check_button("useopencl"))
+ , mxUseOpenImg(m_xBuilder->weld_widget("lockuseopencl"))
, mxOclUsed(m_xBuilder->weld_label("openclused"))
, mxOclNotUsed(m_xBuilder->weld_label("openclnotused"))
{
mxUseOpenCL->set_active(maConfig.mbUseOpenCL);
mxUseOpenCL->set_sensitive(!officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
+ mxUseOpenImg->set_visible(officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
bool bCLUsed = openclwrapper::GPUEnv::isOpenCLEnabled();
mxOclUsed->set_visible(bCLUsed);
@@ -50,6 +52,22 @@ std::unique_ptr<SfxTabPage> SvxOpenCLTabPage::Create(weld::Container* pPage, wel
return std::make_unique<SvxOpenCLTabPage>(pPage, pController, *rAttrSet);
}
+OUString SvxOpenCLTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "openclnotused", "openclused" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += mxUseOpenCL->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
@@ -81,6 +99,7 @@ void SvxOpenCLTabPage::Reset( const SfxItemSet* )
maConfig = OpenCLConfig::get();
mxUseOpenCL->set_active(maConfig.mbUseOpenCL);
+ mxUseOpenImg->set_visible(officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
mxUseOpenCL->save_state();
}
diff --git a/cui/source/options/optopencl.hxx b/cui/source/options/optopencl.hxx
index f7097d3fdba6..e6414245da8f 100644
--- a/cui/source/options/optopencl.hxx
+++ b/cui/source/options/optopencl.hxx
@@ -27,6 +27,7 @@ private:
OpenCLConfig maConfig;
std::unique_ptr<weld::CheckButton> mxUseOpenCL;
+ std::unique_ptr<weld::Widget> mxUseOpenImg;
std::unique_ptr<weld::Label> mxOclUsed;
std::unique_ptr<weld::Label> mxOclNotUsed;
@@ -34,6 +35,7 @@ public:
SvxOpenCLTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxOpenCLTabPage() override;
+ virtual OUString GetAllStrings() override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index e1f638faa673..4a410af07c4b 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -36,38 +36,37 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
-#include <com/sun/star/ui/dialogs/FilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/util/thePathSettings.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
using namespace css;
using namespace css::beans;
-using namespace css::lang;
using namespace css::ui::dialogs;
using namespace css::uno;
using namespace svx;
// define ----------------------------------------------------------------
-#define POSTFIX_INTERNAL "_internal"
-#define POSTFIX_USER "_user"
-#define POSTFIX_WRITABLE "_writable"
-#define VAR_ONE "%1"
-#define IODLG_CONFIGNAME "FilePicker_Save"
+constexpr OUStringLiteral POSTFIX_INTERNAL = u"_internal";
+constexpr OUString POSTFIX_USER = u"_user"_ustr;
+constexpr OUString POSTFIX_WRITABLE = u"_writable"_ustr;
+constexpr OUStringLiteral VAR_ONE = u"%1";
+constexpr OUStringLiteral IODLG_CONFIGNAME = u"FilePicker_Save";
// struct OptPath_Impl ---------------------------------------------------
struct OptPath_Impl
{
- SvtDefaultOptions m_aDefOpt;
OUString m_sMultiPathDlg;
Reference< css::util::XPathSettings > m_xPathSettings;
OptPath_Impl()
- : m_sMultiPathDlg(CuiResId(RID_SVXSTR_EDIT_PATHS))
+ : m_sMultiPathDlg(CuiResId(RID_CUISTR_EDIT_PATHS))
{
}
};
@@ -77,14 +76,14 @@ namespace {
struct PathUserData_Impl
{
SvtPathOptions::Paths nRealId;
- SfxItemState eState;
+ bool bItemStateSet;
OUString sUserPath;
OUString sWritablePath;
bool bReadOnly;
explicit PathUserData_Impl(SvtPathOptions::Paths nId)
: nRealId(nId)
- , eState(SfxItemState::UNKNOWN)
+ , bItemStateSet(false)
, bReadOnly(false)
{
}
@@ -136,16 +135,16 @@ static OUString getCfgName_Impl( SvtPathOptions::Paths _nHandle )
#define MULTIPATH_DELIMITER ';'
-static OUString Convert_Impl( const OUString& rValue )
+static OUString Convert_Impl( std::u16string_view rValue )
{
- if (rValue.isEmpty())
+ if (rValue.empty())
return OUString();
sal_Int32 nPos = 0;
OUStringBuffer aReturn;
for (;;)
{
- OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos );
+ OUString aValue( o3tl::getToken(rValue, 0, MULTIPATH_DELIMITER, nPos ) );
INetURLObject aObj( aValue );
if ( aObj.GetProtocol() == INetProtocol::File )
aReturn.append(aObj.PathToFileName());
@@ -212,7 +211,7 @@ IMPL_LINK(SvxPathTabPage, HeaderBarClick, int, nColumn, void)
SvxPathTabPage::~SvxPathTabPage()
{
for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(i).toInt64());
+ delete weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
}
std::unique_ptr<SfxTabPage> SvxPathTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
@@ -221,13 +220,21 @@ std::unique_ptr<SfxTabPage> SvxPathTabPage::Create( weld::Container* pPage, weld
return std::make_unique<SvxPathTabPage>( pPage, pController, *rAttrSet );
}
+OUString SvxPathTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ if (const auto& pString = m_xBuilder->weld_label("label1"))
+ sAllStrings += pString->get_label() + " ";
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxPathTabPage::FillItemSet( SfxItemSet* )
{
for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; ++i)
{
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(i).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
SvtPathOptions::Paths nRealId = pPathImpl->nRealId;
- if (pPathImpl->eState == SfxItemState::SET)
+ if (pPathImpl->bItemStateSet )
SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath );
}
return true;
@@ -246,44 +253,44 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
&& !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
continue;
- const char* pId = nullptr;
+ TranslateId pId;
switch (static_cast<SvtPathOptions::Paths>(i))
{
case SvtPathOptions::Paths::AutoCorrect:
- pId = RID_SVXSTR_KEY_AUTOCORRECT_DIR;
+ pId = RID_CUISTR_KEY_AUTOCORRECT_DIR;
break;
case SvtPathOptions::Paths::AutoText:
- pId = RID_SVXSTR_KEY_GLOSSARY_PATH;
+ pId = RID_CUISTR_KEY_GLOSSARY_PATH;
break;
case SvtPathOptions::Paths::Backup:
- pId = RID_SVXSTR_KEY_BACKUP_PATH;
+ pId = RID_CUISTR_KEY_BACKUP_PATH;
break;
case SvtPathOptions::Paths::Gallery:
- pId = RID_SVXSTR_KEY_GALLERY_DIR;
+ pId = RID_CUISTR_KEY_GALLERY_DIR;
break;
case SvtPathOptions::Paths::Graphic:
- pId = RID_SVXSTR_KEY_GRAPHICS_PATH;
+ pId = RID_CUISTR_KEY_GRAPHICS_PATH;
break;
case SvtPathOptions::Paths::Temp:
- pId = RID_SVXSTR_KEY_TEMP_PATH;
+ pId = RID_CUISTR_KEY_TEMP_PATH;
break;
case SvtPathOptions::Paths::Template:
- pId = RID_SVXSTR_KEY_TEMPLATE_PATH;
+ pId = RID_CUISTR_KEY_TEMPLATE_PATH;
break;
case SvtPathOptions::Paths::Dictionary:
- pId = RID_SVXSTR_KEY_DICTIONARY_PATH;
+ pId = RID_CUISTR_KEY_DICTIONARY_PATH;
break;
case SvtPathOptions::Paths::Classification:
- pId = RID_SVXSTR_KEY_CLASSIFICATION_PATH;
+ pId = RID_CUISTR_KEY_CLASSIFICATION_PATH;
break;
#if OSL_DEBUG_LEVEL > 1
case SvtPathOptions::Paths::Linguistic:
- pId = RID_SVXSTR_KEY_LINGUISTIC_DIR;
+ pId = RID_CUISTR_KEY_LINGUISTIC_DIR;
break;
#endif
case SvtPathOptions::Paths::Work:
- pId = RID_SVXSTR_KEY_WORK_PATH;
+ pId = RID_CUISTR_KEY_WORK_PATH;
break;
default: break;
}
@@ -323,7 +330,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
pPathImpl->sWritablePath = sWritable;
pPathImpl->bReadOnly = bReadOnly;
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pPathImpl));
+ OUString sId = weld::toId(pPathImpl);
m_xPathBox->set_id(*xIter, sId);
}
}
@@ -339,7 +346,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathSelect_Impl, weld::TreeView&, void)
int nEntry = m_xPathBox->get_selected_index();
if (nEntry != -1)
{
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry));
bEnable = !pPathImpl->bReadOnly;
}
sal_uInt16 nSelCount = m_xPathBox->count_selected_rows();
@@ -350,8 +357,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathSelect_Impl, weld::TreeView&, void)
IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, weld::Button&, void)
{
m_xPathBox->selected_foreach([this](weld::TreeIter& rEntry){
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(rEntry).toInt64());
- OUString aOldPath = pImpl->m_aDefOpt.GetDefaultPath( pPathImpl->nRealId );
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(rEntry));
+ OUString aOldPath = SvtDefaultOptions::GetDefaultPath( pPathImpl->nRealId );
if ( !aOldPath.isEmpty() )
{
@@ -363,13 +370,13 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, weld::Button&, void)
do
{
bool bFound = false;
- const OUString sOnePath = aOldPath.getToken( 0, MULTIPATH_DELIMITER, nOldPos );
+ const std::u16string_view sOnePath = o3tl::getToken(aOldPath, 0, MULTIPATH_DELIMITER, nOldPos );
if ( !sInternal.isEmpty() )
{
sal_Int32 nInternalPos = 0;
do
{
- if ( sInternal.getToken( 0, MULTIPATH_DELIMITER, nInternalPos ) == sOnePath )
+ if ( o3tl::getToken(sInternal, 0, MULTIPATH_DELIMITER, nInternalPos ) == sOnePath )
bFound = true;
}
while ( !bFound && nInternalPos >= 0 );
@@ -403,7 +410,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, weld::Button&, void)
}
}
m_xPathBox->set_text(rEntry, Convert_Impl(sTemp), 1);
- pPathImpl->eState = SfxItemState::SET;
+ pPathImpl->bItemStateSet = true;
pPathImpl->sUserPath = sUserPath.makeStringAndClear();
pPathImpl->sWritablePath = sWritablePath;
}
@@ -421,7 +428,7 @@ void SvxPathTabPage::ChangeCurrentEntry( const OUString& _rFolder )
}
OUString sInternal, sUser, sWritable;
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry));
bool bReadOnly = false;
GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
sUser = pPathImpl->sUserPath;
@@ -448,7 +455,7 @@ void SvxPathTabPage::ChangeCurrentEntry( const OUString& _rFolder )
return;
m_xPathBox->set_text(nEntry, Convert_Impl(sNewPathStr), 1);
- pPathImpl->eState = SfxItemState::SET;
+ pPathImpl->bItemStateSet = true;
pPathImpl->sWritablePath = sNewPathStr;
if ( SvtPathOptions::Paths::Work == pPathImpl->nRealId )
{
@@ -471,7 +478,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, DoubleClickPathHdl_Impl, weld::TreeView&, bool)
IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void)
{
int nEntry = m_xPathBox->get_cursor_index();
- PathUserData_Impl* pPathImpl = nEntry != -1 ? reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64()) : nullptr;
+ PathUserData_Impl* pPathImpl = nEntry != -1 ? weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry)) : nullptr;
if (!pPathImpl || pPathImpl->bReadOnly)
return;
@@ -530,7 +537,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void)
m_xPathBox->set_text(nEntry, Convert_Impl(sFullPath), 1);
// save modified flag
- pPathImpl->eState = SfxItemState::SET;
+ pPathImpl->bItemStateSet = true;
pPathImpl->sUserPath = sUser;
pPathImpl->sWritablePath = sWritable;
}
@@ -540,7 +547,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void)
try
{
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- xFolderPicker = FolderPicker::create(xContext);
+ xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld());
INetURLObject aURL( sWritable, INetProtocol::File );
xFolderPicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
@@ -567,8 +574,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void)
{
try
{
- uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
- uno::Reference<ui::dialogs::XFilePicker3> xFilePicker = ui::dialogs::FilePicker::createWithMode(xComponentContext, ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE);
+ sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld());
+ uno::Reference<ui::dialogs::XFilePicker3> xFilePicker = aHelper.GetFilePicker();
xFilePicker->appendFilter(OUString(), "*.xml");
if (xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK)
{
@@ -659,7 +666,7 @@ void SvxPathTabPage::GetPathList(
void SvxPathTabPage::SetPathList(
- SvtPathOptions::Paths _nPathHandle, const OUString& _rUserPath, const OUString& _rWritablePath )
+ SvtPathOptions::Paths _nPathHandle, std::u16string_view _rUserPath, const OUString& _rWritablePath )
{
OUString sCfgName = getCfgName_Impl( _nPathHandle );
@@ -678,7 +685,7 @@ void SvxPathTabPage::SetPathList(
OUString* pArray = aPathSeq.getArray();
sal_Int32 nPos = 0;
for ( sal_Int32 i = 0; i < nCount; ++i )
- pArray[i] = _rUserPath.getToken( 0, MULTIPATH_DELIMITER, nPos );
+ pArray[i] = o3tl::getToken(_rUserPath, 0, MULTIPATH_DELIMITER, nPos );
Any aValue( aPathSeq );
pImpl->m_xPathSettings->setPropertyValue(
sCfgName + POSTFIX_USER, aValue);
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index f2d54205db5c..ecf23f377ec3 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -21,9 +21,14 @@
#include <string_view>
+#include <o3tl/string_view.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
+#include <dialmgr.hxx>
#include "optsave.hxx"
+#include <strings.hrc>
+#include <treeopt.hxx>
+#include <officecfg/Office/Common.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/moduleoptions.hxx>
#include <unotools/saveopt.hxx>
@@ -35,21 +40,19 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <sfx2/sfxsids.hrc>
#include <sfx2/docfilt.hxx>
-#include <unotools/optionsdlg.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <officecfg/Office/Recovery.hxx>
+#include <unotools/confignode.hxx>
#include <sfx2/fcontnr.hxx>
using namespace com::sun::star::uno;
-using namespace com::sun::star::util;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace comphelper;
-#define CFG_PAGE_AND_GROUP u"General", u"LoadSave"
-
struct SvxSaveTabPage_Impl
{
@@ -73,24 +76,42 @@ SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( false )
SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet)
: SfxTabPage( pPage, pController, "cui/ui/optsavepage.ui", "OptSavePage", &rCoreSet )
, pImpl(new SvxSaveTabPage_Impl)
+ , m_xLoadViewPosAnyUserCB(m_xBuilder->weld_check_button("load_anyuser"))
+ , m_xLoadViewPosAnyUserImg(m_xBuilder->weld_widget("lockload_anyuser"))
, m_xLoadUserSettingsCB(m_xBuilder->weld_check_button("load_settings"))
+ , m_xLoadUserSettingsImg(m_xBuilder->weld_widget("lockload_settings"))
, m_xLoadDocPrinterCB(m_xBuilder->weld_check_button("load_docprinter"))
+ , m_xLoadDocPrinterImg(m_xBuilder->weld_widget("lockload_docprinter"))
, m_xDocInfoCB(m_xBuilder->weld_check_button("docinfo"))
+ , m_xDocInfoImg(m_xBuilder->weld_widget("lockdocinfo"))
, m_xBackupCB(m_xBuilder->weld_check_button("backup"))
+ , m_xBackupImg(m_xBuilder->weld_widget("lockbackup"))
+ , m_xBackupIntoDocumentFolderCB(m_xBuilder->weld_check_button("backupintodocumentfolder"))
+ , m_xBackupIntoDocumentFolderImg(m_xBuilder->weld_widget("lockbackupintodoc"))
, m_xAutoSaveCB(m_xBuilder->weld_check_button("autosave"))
+ , m_xAutoSaveImg(m_xBuilder->weld_widget("lockautosave"))
, m_xAutoSaveEdit(m_xBuilder->weld_spin_button("autosave_spin"))
, m_xMinuteFT(m_xBuilder->weld_label("autosave_mins"))
, m_xUserAutoSaveCB(m_xBuilder->weld_check_button("userautosave"))
+ , m_xUserAutoSaveImg(m_xBuilder->weld_widget("lockuserautosave"))
, m_xRelativeFsysCB(m_xBuilder->weld_check_button("relative_fsys"))
+ , m_xRelativeFsysImg(m_xBuilder->weld_widget("lockrelative_fsys"))
, m_xRelativeInetCB(m_xBuilder->weld_check_button("relative_inet"))
+ , m_xRelativeInetImg(m_xBuilder->weld_widget("lockrelative_inet"))
, m_xODFVersionLB(m_xBuilder->weld_combo_box("odfversion"))
+ , m_xODFVersionFT(m_xBuilder->weld_label("label5"))
+ , m_xODFVersionImg(m_xBuilder->weld_widget("lockodfversion"))
, m_xWarnAlienFormatCB(m_xBuilder->weld_check_button("warnalienformat"))
+ , m_xWarnAlienFormatImg(m_xBuilder->weld_widget("lockwarnalienformat"))
, m_xDocTypeLB(m_xBuilder->weld_combo_box("doctype"))
, m_xSaveAsFT(m_xBuilder->weld_label("saveas_label"))
, m_xSaveAsLB(m_xBuilder->weld_combo_box("saveas"))
, m_xODFWarningFI(m_xBuilder->weld_widget("odfwarning_image"))
, m_xODFWarningFT(m_xBuilder->weld_label("odfwarning_label"))
{
+ m_xAutoSaveEdit->set_max_length(2);
+ m_xBackupIntoDocumentFolderCB->set_accessible_description(CuiResId(RID_CUISTR_A11Y_DESC_BACKUP));
+
m_xODFVersionLB->set_id(0, OUString::number(SvtSaveOptions::ODFVER_011)); // 1.0/1.1
m_xODFVersionLB->set_id(1, OUString::number(SvtSaveOptions::ODFVER_012)); // 1.2
m_xODFVersionLB->set_id(2, OUString::number(SvtSaveOptions::ODFVER_012_EXT_COMPAT)); // 1.2 Extended (compatibility mode)
@@ -98,15 +119,23 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p
m_xODFVersionLB->set_id(4, OUString::number(SvtSaveOptions::ODFVER_013)); // 1.3
m_xODFVersionLB->set_id(5, OUString::number(SvtSaveOptions::ODFVER_LATEST)); // 1.3 Extended (recommended)
- m_xDocTypeLB->set_id(0, OUString::number(APP_WRITER) );
- m_xDocTypeLB->set_id(1, OUString::number(APP_WRITER_WEB) );
- m_xDocTypeLB->set_id(2, OUString::number(APP_WRITER_GLOBAL));
- m_xDocTypeLB->set_id(3, OUString::number(APP_CALC) );
- m_xDocTypeLB->set_id(4, OUString::number(APP_IMPRESS) );
- m_xDocTypeLB->set_id(5, OUString::number(APP_DRAW) );
- m_xDocTypeLB->set_id(6, OUString::number(APP_MATH) );
+ auto aFilterClassesNode = utl::OConfigurationTreeRoot::createWithComponentContext(
+ comphelper::getProcessComponentContext(),
+ "org.openoffice.Office.UI/FilterClassification/GlobalFilters/Classes",
+ -1,
+ utl::OConfigurationTreeRoot::CM_READONLY
+ );
+
+ m_xDocTypeLB->append(OUString::number(APP_WRITER), aFilterClassesNode.getNodeValue("com.sun.star.text.TextDocument/DisplayName").get<OUString>());
+ m_xDocTypeLB->append(OUString::number(APP_WRITER_WEB), aFilterClassesNode.getNodeValue("com.sun.star.text.WebDocument/DisplayName").get<OUString>());
+ m_xDocTypeLB->append(OUString::number(APP_WRITER_GLOBAL), aFilterClassesNode.getNodeValue("com.sun.star.text.GlobalDocument/DisplayName").get<OUString>());
+ m_xDocTypeLB->append(OUString::number(APP_CALC), aFilterClassesNode.getNodeValue("com.sun.star.sheet.SpreadsheetDocument/DisplayName").get<OUString>());
+ m_xDocTypeLB->append(OUString::number(APP_IMPRESS), aFilterClassesNode.getNodeValue("com.sun.star.presentation.PresentationDocument/DisplayName").get<OUString>());
+ m_xDocTypeLB->append(OUString::number(APP_DRAW), aFilterClassesNode.getNodeValue("com.sun.star.drawing.DrawingDocument/DisplayName").get<OUString>());
+ m_xDocTypeLB->append(OUString::number(APP_MATH), aFilterClassesNode.getNodeValue("com.sun.star.formula.FormulaProperties/DisplayName").get<OUString>());
- m_xAutoSaveCB->connect_clicked( LINK( this, SvxSaveTabPage, AutoClickHdl_Impl ) );
+ m_xAutoSaveCB->connect_toggled( LINK( this, SvxSaveTabPage, AutoClickHdl_Impl ) );
+ m_xBackupCB->connect_toggled(LINK(this, SvxSaveTabPage, BackupClickHdl_Impl));
SvtModuleOptions aModuleOpt;
if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
@@ -177,8 +206,6 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p
aLink = LINK( this, SvxSaveTabPage, FilterHdl_Impl );
m_xDocTypeLB->connect_changed( aLink );
m_xSaveAsLB->connect_changed( aLink );
-
- DetectHiddenControls();
}
SvxSaveTabPage::~SvxSaveTabPage()
@@ -191,101 +218,110 @@ std::unique_ptr<SfxTabPage> SvxSaveTabPage::Create(weld::Container* pPage, weld:
return std::make_unique<SvxSaveTabPage>(pPage, pController, *rAttrSet);
}
-void SvxSaveTabPage::DetectHiddenControls()
+OUString SvxSaveTabPage::GetAllStrings()
{
- SvtOptionsDialogOptions aOptionsDlgOpt;
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "autosave_mins", "label3",
+ "label5", "label6", "saveas_label", "odfwarning_label" };
- if ( aOptionsDlgOpt.IsOptionHidden( u"Backup", CFG_PAGE_AND_GROUP ) )
+ for (const auto& label : labels)
{
- // hide controls of "Backup"
- m_xBackupCB->hide();
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
}
- if ( aOptionsDlgOpt.IsOptionHidden( u"AutoSave", CFG_PAGE_AND_GROUP ) )
- {
- // hide controls of "AutoSave"
- m_xAutoSaveCB->hide();
- m_xAutoSaveEdit->hide();
- m_xMinuteFT->hide();
- }
+ OUString checkButton[]
+ = { "load_settings", "load_docprinter", "load_anyuser", "autosave",
+ "userautosave", "docinfo", "backup", "backupintodocumentfolder",
+ "relative_fsys", "relative_inet", "warnalienformat" };
- if ( aOptionsDlgOpt.IsOptionHidden( u"UserAutoSave", CFG_PAGE_AND_GROUP ) )
+ for (const auto& check : checkButton)
{
- // hide controls of "UserAutoSave"
- m_xUserAutoSaveCB->hide();
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
}
+ return sAllStrings.replaceAll("_", "");
}
bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
{
+ auto xChanges = comphelper::ConfigurationChanges::create();
bool bModified = false;
- SvtSaveOptions aSaveOpt;
- if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
+ if (m_xLoadViewPosAnyUserCB->get_state_changed_from_saved())
{
- aSaveOpt.SetLoadUserSettings(m_xLoadUserSettingsCB->get_active());
+ officecfg::Office::Common::Load::ViewPositionForAnyUser::set(m_xLoadViewPosAnyUserCB->get_active(), xChanges);
}
+ if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
+ officecfg::Office::Common::Load::UserDefinedSettings::set(m_xLoadUserSettingsCB->get_active(), xChanges);
if ( m_xLoadDocPrinterCB->get_state_changed_from_saved() )
- aSaveOpt.SetLoadDocumentPrinter( m_xLoadDocPrinterCB->get_active() );
+ officecfg::Office::Common::Save::Document::LoadPrinter::set(m_xLoadDocPrinterCB->get_active(), xChanges);
if ( m_xODFVersionLB->get_value_changed_from_saved() )
{
sal_Int32 nVersion = m_xODFVersionLB->get_active_id().toInt32();
- aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ) );
+ SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ), xChanges );
}
if ( m_xDocInfoCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ),
+ rSet->Put( SfxBoolItem( SID_ATTR_DOCINFO,
m_xDocInfoCB->get_active() ) );
bModified = true;
}
if ( m_xBackupCB->get_sensitive() && m_xBackupCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ),
- m_xBackupCB->get_active() ) );
+ rSet->Put( SfxBoolItem( SID_ATTR_BACKUP, m_xBackupCB->get_active() ) );
+ bModified = true;
+ }
+
+ if (m_xBackupIntoDocumentFolderCB->get_sensitive()
+ && m_xBackupIntoDocumentFolderCB->get_state_changed_from_saved())
+ {
+ rSet->Put(
+ SfxBoolItem(SID_ATTR_BACKUP_BESIDE_ORIGINAL, m_xBackupIntoDocumentFolderCB->get_active()));
bModified = true;
}
if ( m_xAutoSaveCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ),
+ rSet->Put( SfxBoolItem( SID_ATTR_AUTOSAVE,
m_xAutoSaveCB->get_active() ) );
bModified = true;
}
if ( m_xWarnAlienFormatCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ),
+ rSet->Put( SfxBoolItem( SID_ATTR_WARNALIENFORMAT,
m_xWarnAlienFormatCB->get_active() ) );
bModified = true;
}
if ( m_xAutoSaveEdit->get_value_changed_from_saved() )
{
- rSet->Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
+ rSet->Put( SfxUInt16Item( SID_ATTR_AUTOSAVEMINUTE,
static_cast<sal_uInt16>(m_xAutoSaveEdit->get_value()) ) );
bModified = true;
}
if ( m_xUserAutoSaveCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_USERAUTOSAVE ),
+ rSet->Put( SfxBoolItem( SID_ATTR_USERAUTOSAVE,
m_xUserAutoSaveCB->get_active() ) );
bModified = true;
}
// save relatively
if ( m_xRelativeFsysCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ),
+ rSet->Put( SfxBoolItem( SID_SAVEREL_FSYS,
m_xRelativeFsysCB->get_active() ) );
bModified = true;
}
if ( m_xRelativeInetCB->get_state_changed_from_saved() )
{
- rSet->Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ),
+ rSet->Put( SfxBoolItem( SID_SAVEREL_INET,
m_xRelativeInetCB->get_active() ) );
bModified = true;
}
@@ -319,10 +355,11 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL))
aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
+ xChanges->commit();
return bModified;
}
-static bool isODFFormat( const OUString& sFilter )
+static bool isODFFormat( std::u16string_view sFilter )
{
static const char* aODFFormats[] =
{
@@ -346,7 +383,7 @@ static bool isODFFormat( const OUString& sFilter )
int i = 0;
while ( aODFFormats[i] != nullptr )
{
- if ( sFilter.equalsAscii( aODFFormats[i++] ) )
+ if ( o3tl::equalsAscii( sFilter, aODFFormats[i++] ) )
{
bRet = true;
break;
@@ -358,13 +395,20 @@ static bool isODFFormat( const OUString& sFilter )
void SvxSaveTabPage::Reset( const SfxItemSet* )
{
- SvtSaveOptions aSaveOpt;
- m_xLoadUserSettingsCB->set_active(aSaveOpt.IsLoadUserSettings());
+ m_xLoadViewPosAnyUserCB->set_active(officecfg::Office::Common::Load::ViewPositionForAnyUser::get());
+ m_xLoadViewPosAnyUserCB->save_state();
+ m_xLoadViewPosAnyUserCB->set_sensitive(!officecfg::Office::Common::Load::ViewPositionForAnyUser::isReadOnly());
+ m_xLoadViewPosAnyUserImg->set_visible(officecfg::Office::Common::Load::ViewPositionForAnyUser::isReadOnly());
+
+ m_xLoadUserSettingsCB->set_active(officecfg::Office::Common::Load::UserDefinedSettings::get());
m_xLoadUserSettingsCB->save_state();
- m_xLoadUserSettingsCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UseUserData));
- m_xLoadDocPrinterCB->set_active( aSaveOpt.IsLoadDocumentPrinter() );
+ m_xLoadUserSettingsCB->set_sensitive(!officecfg::Office::Common::Load::UserDefinedSettings::isReadOnly());
+ m_xLoadUserSettingsImg->set_visible(officecfg::Office::Common::Load::UserDefinedSettings::isReadOnly());
+
+ m_xLoadDocPrinterCB->set_active( officecfg::Office::Common::Save::Document::LoadPrinter::get() );
m_xLoadDocPrinterCB->save_state();
- m_xLoadDocPrinterCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::LoadDocPrinter));
+ m_xLoadDocPrinterCB->set_sensitive(!officecfg::Office::Common::Save::Document::LoadPrinter::isReadOnly());
+ m_xLoadDocPrinterImg->set_visible(officecfg::Office::Common::Save::Document::LoadPrinter::isReadOnly());
if ( !pImpl->bInitialized )
{
@@ -394,7 +438,7 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
case APP_IMPRESS : sReplace = "com.sun.star.presentation.PresentationDocument";break;
case APP_DRAW : sReplace = "com.sun.star.drawing.DrawingDocument";break;
case APP_MATH : sReplace = "com.sun.star.formula.FormulaProperties";break;
- default: OSL_FAIL("illegal user data");
+ default: SAL_WARN("cui.options", "illegal user data");
}
sCommand = sCommand.replaceFirst("%1", sReplace);
Reference< XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
@@ -414,7 +458,23 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
pImpl->aODFArr[nData] = lODFList;
}
}
- m_xDocTypeLB->set_active(0);
+ OUString sModule = OfaTreeOptionsDialog::getCurrentFactory_Impl(GetFrame());
+ sal_Int32 docId = 0;
+ if (sModule == "com.sun.star.text.TextDocument")
+ docId = APP_WRITER;
+ else if (sModule == "com.sun.star.text.WebDocument")
+ docId = APP_WRITER_WEB;
+ else if (sModule == "com.sun.star.text.GlobalDocument")
+ docId = APP_WRITER_GLOBAL;
+ else if (sModule == "com.sun.star.sheet.SpreadsheetDocument")
+ docId = APP_CALC;
+ else if (sModule == "com.sun.star.presentation.PresentationDocument")
+ docId = APP_IMPRESS;
+ else if (sModule == "com.sun.star.drawing.DrawingDocument")
+ docId = APP_DRAW;
+ else if (sModule == "com.sun.star.formula.FormulaProperties")
+ docId = APP_MATH;
+ m_xDocTypeLB->set_active_id(OUString::number(docId));
FilterHdl_Impl(*m_xDocTypeLB);
}
catch(Exception const &)
@@ -425,40 +485,58 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
pImpl->bInitialized = true;
}
- m_xDocInfoCB->set_active(aSaveOpt.IsDocInfoSave());
- m_xDocInfoCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::DocInfSave));
+ m_xDocInfoCB->set_active(officecfg::Office::Common::Save::Document::EditProperty::get());
+ m_xDocInfoCB->set_sensitive(!officecfg::Office::Common::Save::Document::EditProperty::isReadOnly());
+ m_xDocInfoImg->set_visible(officecfg::Office::Common::Save::Document::EditProperty::isReadOnly());
- m_xBackupCB->set_active(aSaveOpt.IsBackup());
- m_xBackupCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::Backup));
+ m_xBackupCB->set_active(officecfg::Office::Common::Save::Document::CreateBackup::get());
+ m_xBackupCB->set_sensitive(!officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly());
+ m_xBackupImg->set_visible(officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly());
- m_xAutoSaveCB->set_active(aSaveOpt.IsAutoSave());
- m_xAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSave));
+ m_xBackupIntoDocumentFolderCB->set_active(
+ officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder::get());
+ m_xBackupIntoDocumentFolderCB->set_sensitive(
+ !officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder::isReadOnly()
+ && m_xBackupCB->get_active());
+ m_xBackupIntoDocumentFolderImg->set_visible(
+ officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder::isReadOnly());
- m_xUserAutoSaveCB->set_active(aSaveOpt.IsUserAutoSave());
- m_xUserAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave));
+ m_xAutoSaveCB->set_active(officecfg::Office::Recovery::AutoSave::Enabled::get());
+ m_xAutoSaveCB->set_sensitive(!officecfg::Office::Recovery::AutoSave::Enabled::isReadOnly());
+ m_xAutoSaveImg->set_visible(officecfg::Office::Recovery::AutoSave::Enabled::isReadOnly());
- m_xWarnAlienFormatCB->set_active(aSaveOpt.IsWarnAlienFormat());
- m_xWarnAlienFormatCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
+ m_xUserAutoSaveCB->set_active(officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get());
+ m_xUserAutoSaveCB->set_sensitive(!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly());
+ m_xUserAutoSaveImg->set_visible(officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly());
- m_xAutoSaveEdit->set_value(aSaveOpt.GetAutoSaveTime());
- m_xAutoSaveEdit->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime));
+ m_xWarnAlienFormatCB->set_active(officecfg::Office::Common::Save::Document::WarnAlienFormat::get());
+ m_xWarnAlienFormatCB->set_sensitive(!officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly());
+ m_xWarnAlienFormatImg->set_visible(officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly());
+
+ m_xAutoSaveEdit->set_value(officecfg::Office::Recovery::AutoSave::TimeIntervall::get());
+ m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Recovery::AutoSave::TimeIntervall::isReadOnly());
// save relatively
- m_xRelativeFsysCB->set_active(aSaveOpt.IsSaveRelFSys());
- m_xRelativeFsysCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelFsys));
+ m_xRelativeFsysCB->set_active(officecfg::Office::Common::Save::URL::FileSystem::get());
+ m_xRelativeFsysCB->set_sensitive(!officecfg::Office::Common::Save::URL::FileSystem::isReadOnly());
+ m_xRelativeFsysImg->set_visible(officecfg::Office::Common::Save::URL::FileSystem::isReadOnly());
- m_xRelativeInetCB->set_active(aSaveOpt.IsSaveRelINet());
- m_xRelativeInetCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::SaveRelInet));
+ m_xRelativeInetCB->set_active(officecfg::Office::Common::Save::URL::Internet::get());
+ m_xRelativeInetCB->set_sensitive(!officecfg::Office::Common::Save::URL::Internet::isReadOnly());
+ m_xRelativeInetImg->set_visible(officecfg::Office::Common::Save::URL::Internet::isReadOnly());
- sal_Int32 nDefaultVersion = aSaveOpt.GetODFDefaultVersion();
+ sal_Int32 nDefaultVersion = GetODFDefaultVersion();
m_xODFVersionLB->set_active_id(OUString::number(nDefaultVersion));
- m_xODFVersionLB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::OdfDefaultVersion));
+ m_xODFVersionLB->set_sensitive(!officecfg::Office::Common::Save::ODF::DefaultVersion::isReadOnly());
+ m_xODFVersionFT->set_sensitive(!officecfg::Office::Common::Save::ODF::DefaultVersion::isReadOnly());
+ m_xODFVersionImg->set_visible(officecfg::Office::Common::Save::ODF::DefaultVersion::isReadOnly());
AutoClickHdl_Impl(*m_xAutoSaveCB);
ODFVersionHdl_Impl(*m_xODFVersionLB);
m_xDocInfoCB->save_state();
m_xBackupCB->save_state();
+ m_xBackupIntoDocumentFolderCB->save_state();
m_xWarnAlienFormatCB->save_state();
m_xAutoSaveCB->save_state();
m_xAutoSaveEdit->save_value();
@@ -470,16 +548,16 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
m_xODFVersionLB->save_value();
}
-IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Button&, rBox, void)
+IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Toggleable&, rBox, void)
{
if (&rBox != m_xAutoSaveCB.get())
return;
if (m_xAutoSaveCB->get_active())
{
- m_xAutoSaveEdit->set_sensitive(true);
- m_xMinuteFT->set_sensitive(true);
- m_xUserAutoSaveCB->set_sensitive(true);
+ m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Recovery::AutoSave::Enabled::isReadOnly());
+ m_xMinuteFT->set_sensitive(!officecfg::Office::Recovery::AutoSave::Enabled::isReadOnly());
+ m_xUserAutoSaveCB->set_sensitive(!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly());
}
else
{
@@ -489,6 +567,12 @@ IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Button&, rBox, void)
}
}
+IMPL_LINK_NOARG(SvxSaveTabPage, BackupClickHdl_Impl, weld::Toggleable&, void)
+{
+ m_xBackupIntoDocumentFolderCB->set_sensitive(m_xBackupCB->get_active() &&
+ !officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder::isReadOnly());
+}
+
static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, std::u16string_view rExtension)
{
OUString sName;
@@ -563,7 +647,7 @@ IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, weld::ComboBox&, rBox, void )
{
OUString sId;
if (pImpl->aODFArr[nData][i])
- sId = OUString::number(reinterpret_cast<sal_Int64>(pImpl.get()));
+ sId = weld::toId(pImpl.get());
m_xSaveAsLB->append(sId, rUIFilters[i]);
if (rFilters[i] == pImpl->aDefaultArr[nData])
sSelect = rUIFilters[i];
diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx
index f916963e4eb8..255719184d63 100644
--- a/cui/source/options/optsave.hxx
+++ b/cui/source/options/optsave.hxx
@@ -41,36 +41,52 @@ class SvxSaveTabPage : public SfxTabPage
private:
std::unique_ptr<SvxSaveTabPage_Impl> pImpl;
+ std::unique_ptr<weld::CheckButton> m_xLoadViewPosAnyUserCB;
+ std::unique_ptr<weld::Widget> m_xLoadViewPosAnyUserImg;
std::unique_ptr<weld::CheckButton> m_xLoadUserSettingsCB;
+ std::unique_ptr<weld::Widget> m_xLoadUserSettingsImg;
std::unique_ptr<weld::CheckButton> m_xLoadDocPrinterCB;
+ std::unique_ptr<weld::Widget> m_xLoadDocPrinterImg;
std::unique_ptr<weld::CheckButton> m_xDocInfoCB;
+ std::unique_ptr<weld::Widget> m_xDocInfoImg;
std::unique_ptr<weld::CheckButton> m_xBackupCB;
+ std::unique_ptr<weld::Widget> m_xBackupImg;
+ std::unique_ptr<weld::CheckButton> m_xBackupIntoDocumentFolderCB;
+ std::unique_ptr<weld::Widget> m_xBackupIntoDocumentFolderImg;
std::unique_ptr<weld::CheckButton> m_xAutoSaveCB;
+ std::unique_ptr<weld::Widget> m_xAutoSaveImg;
std::unique_ptr<weld::SpinButton> m_xAutoSaveEdit;
std::unique_ptr<weld::Label> m_xMinuteFT;
std::unique_ptr<weld::CheckButton> m_xUserAutoSaveCB;
+ std::unique_ptr<weld::Widget> m_xUserAutoSaveImg;
std::unique_ptr<weld::CheckButton> m_xRelativeFsysCB;
+ std::unique_ptr<weld::Widget> m_xRelativeFsysImg;
std::unique_ptr<weld::CheckButton> m_xRelativeInetCB;
+ std::unique_ptr<weld::Widget> m_xRelativeInetImg;
std::unique_ptr<weld::ComboBox> m_xODFVersionLB;
+ std::unique_ptr<weld::Label> m_xODFVersionFT;
+ std::unique_ptr<weld::Widget> m_xODFVersionImg;
std::unique_ptr<weld::CheckButton> m_xWarnAlienFormatCB;
+ std::unique_ptr<weld::Widget> m_xWarnAlienFormatImg;
std::unique_ptr<weld::ComboBox> m_xDocTypeLB;
std::unique_ptr<weld::Label> m_xSaveAsFT;
std::unique_ptr<weld::ComboBox> m_xSaveAsLB;
std::unique_ptr<weld::Widget> m_xODFWarningFI;
std::unique_ptr<weld::Label> m_xODFWarningFT;
- DECL_LINK( AutoClickHdl_Impl, weld::Button&, void );
+ DECL_LINK( AutoClickHdl_Impl, weld::Toggleable&, void );
+ DECL_LINK(BackupClickHdl_Impl, weld::Toggleable&, void);
DECL_LINK( FilterHdl_Impl, weld::ComboBox&, void );
DECL_LINK(ODFVersionHdl_Impl, weld::ComboBox&, void );
- void DetectHiddenControls();
-
public:
SvxSaveTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~SvxSaveTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index 897f92505603..2686f8dfb277 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -17,14 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
+#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
#include "optupdt.hxx"
#include <comphelper/processfactory.hxx>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/deployment/UpdateInformationProvider.hpp>
#include <com/sun/star/ucb/XWebDAVCommandEnvironment.hpp>
@@ -33,56 +35,99 @@
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/setup/UpdateCheck.hpp>
#include <com/sun/star/setup/UpdateCheckConfig.hpp>
#include <com/sun/star/configuration/ReadWriteAccess.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <sfx2/filedlghelper.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Update.hxx>
#include <osl/file.hxx>
#include <osl/security.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <unotools/configmgr.hxx>
using namespace ::css;
SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optonlineupdatepage.ui", "OptOnlineUpdatePage", &rSet)
+ , m_showTraditionalOnlineUpdate(isTraditionalOnlineUpdateAvailable())
+ , m_showMarOnlineUpdate(isMarOnlineUpdateAvailable())
, m_xNeverChecked(m_xBuilder->weld_label("neverchecked"))
, m_xAutoCheckCheckBox(m_xBuilder->weld_check_button("autocheck"))
+ , m_xAutoCheckImg(m_xBuilder->weld_widget("lockautocheck"))
, m_xEveryDayButton(m_xBuilder->weld_radio_button("everyday"))
, m_xEveryWeekButton(m_xBuilder->weld_radio_button("everyweek"))
, m_xEveryMonthButton(m_xBuilder->weld_radio_button("everymonth"))
+ , m_xCheckIntervalImg(m_xBuilder->weld_widget("lockcheckinterval"))
, m_xCheckNowButton(m_xBuilder->weld_button("checknow"))
, m_xAutoDownloadCheckBox(m_xBuilder->weld_check_button("autodownload"))
+ , m_xAutoDownloadImg(m_xBuilder->weld_widget("lockautodownload"))
, m_xDestPathLabel(m_xBuilder->weld_label("destpathlabel"))
, m_xDestPath(m_xBuilder->weld_label("destpath"))
, m_xChangePathButton(m_xBuilder->weld_button("changepath"))
, m_xLastChecked(m_xBuilder->weld_label("lastchecked"))
, m_xExtrasCheckBox(m_xBuilder->weld_check_button("extrabits"))
+ , m_xExtrasImg(m_xBuilder->weld_widget("lockextrabits"))
, m_xUserAgentLabel(m_xBuilder->weld_label("useragent"))
+ , m_xPrivacyPolicyButton(m_xBuilder->weld_link_button("btnPrivacyPolicy"))
+ , m_xBox2(m_xBuilder->weld_box("box2"))
+ , m_xFrameDest(m_xBuilder->weld_frame("frameDest"))
+ , m_xFrameAgent(m_xBuilder->weld_frame("frameAgent"))
+ , m_xMar(m_xBuilder->weld_frame("frameMar"))
+ , m_xEnableMar(m_xBuilder->weld_check_button("enableMar"))
{
- m_aNeverChecked = m_xNeverChecked->get_label();
+ if (m_showTraditionalOnlineUpdate) {
+ m_aNeverChecked = m_xNeverChecked->get_label();
- m_xAutoCheckCheckBox->connect_toggled( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) );
- m_xExtrasCheckBox->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl ) );
- m_xCheckNowButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
- m_xChangePathButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
+ m_xAutoCheckCheckBox->connect_toggled( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) );
+ m_xExtrasCheckBox->connect_toggled( LINK( this, SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl ) );
+ m_xCheckNowButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
+ m_xChangePathButton->connect_clicked( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
+ m_xPrivacyPolicyButton->set_uri(
+ officecfg::Office::Common::Menus::PrivacyPolicyURL::get()
+ + "?type=updatecheck&LOvers=" + utl::ConfigManager::getProductVersion()
+ + "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47());
- uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
- m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
+ uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- bool bDownloadSupported = false;
- m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported;
+ m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
- m_xAutoDownloadCheckBox->set_visible(bDownloadSupported);
- m_xDestPathLabel->set_visible(bDownloadSupported);
- m_xDestPath->set_visible(bDownloadSupported);
- m_xChangePathButton->set_visible(bDownloadSupported);
+ bool bDownloadSupported = false;
+ m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported;
- m_aLastCheckedTemplate = m_xLastChecked->get_label();
+ m_xAutoDownloadCheckBox->set_visible(bDownloadSupported);
+ m_xDestPathLabel->set_visible(bDownloadSupported);
+ m_xDestPath->set_visible(bDownloadSupported);
+ m_xChangePathButton->set_visible(bDownloadSupported);
- UpdateLastCheckedText();
- UpdateUserAgent();
+ m_aLastCheckedTemplate = m_xLastChecked->get_label();
+
+ UpdateLastCheckedText();
+ UpdateUserAgent();
+ } else {
+ m_xAutoCheckCheckBox->hide();
+ m_xEveryDayButton->hide();
+ m_xEveryWeekButton->hide();
+ m_xEveryMonthButton->hide();
+ m_xCheckNowButton->hide();
+ m_xBox2->hide();
+ m_xAutoCheckImg->hide();
+ m_xCheckIntervalImg->hide();
+ m_xFrameDest->hide();
+ m_xFrameAgent->hide();
+ m_xPrivacyPolicyButton->hide();
+ }
+
+ if (m_showMarOnlineUpdate) {
+ m_xMar->show();
+ m_xEnableMar->set_sensitive(!officecfg::Office::Update::Update::Enabled::isReadOnly());
+ } else {
+ m_xMar->hide();
+ }
}
SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
@@ -118,7 +163,7 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
}
LanguageType eUILang = Application::GetSettings().GetUILanguageTag().getLanguageType();
- std::unique_ptr<SvNumberFormatter> pNumberFormatter(new SvNumberFormatter( ::comphelper::getProcessComponentContext(), eUILang ));
+ std::optional<SvNumberFormatter> pNumberFormatter( std::in_place, ::comphelper::getProcessComponentContext(), eUILang );
const Color* pColor = nullptr;
const Date& rNullDate = pNumberFormatter->GetNullDate();
sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::DATE, eUILang );
@@ -180,137 +225,191 @@ std::unique_ptr<SfxTabPage> SvxOnlineUpdateTabPage::Create( weld::Container* pPa
return std::make_unique<SvxOnlineUpdateTabPage>( pPage, pController, *rAttrSet );
}
-bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* )
+OUString SvxOnlineUpdateTabPage::GetAllStrings()
{
- bool bModified = false;
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "lastchecked", "neverchecked", "labeldest",
+ "destpathlabel", "labelagent", "useragent_label", "useragent_changed" };
- bool bValue;
- sal_Int64 nValue;
-
- if( m_xAutoCheckCheckBox->get_state_changed_from_saved() )
+ for (const auto& label : labels)
{
- bValue = m_xAutoCheckCheckBox->get_active();
- m_xUpdateAccess->replaceByName( "AutoCheckEnabled", uno::Any( bValue ) );
- bModified = true;
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
}
- nValue = 0;
- if( m_xEveryDayButton->get_active() )
- {
- if( !m_xEveryDayButton->get_saved_state() )
- nValue = 86400;
- }
- else if( m_xEveryWeekButton->get_active() )
- {
- if( !m_xEveryWeekButton->get_saved_state() )
- nValue = 604800;
- }
- else if( m_xEveryMonthButton->get_active() )
- {
- if( !m_xEveryMonthButton->get_saved_state() )
- nValue = 2592000;
- }
+ OUString checkButton[] = { "autocheck", "autodownload", "extrabits" };
- if( nValue > 0 )
+ for (const auto& check : checkButton)
{
- m_xUpdateAccess->replaceByName( "CheckInterval", uno::Any( nValue ) );
- bModified = true;
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
}
- if( m_xAutoDownloadCheckBox->get_state_changed_from_saved() )
+ OUString radioButton[] = { "everyday", "everyweek", "everymonth" };
+
+ for (const auto& radio : radioButton)
{
- bValue = m_xAutoDownloadCheckBox->get_active();
- m_xUpdateAccess->replaceByName( "AutoDownloadEnabled", uno::Any( bValue ) );
- bModified = true;
+ if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+ sAllStrings += pString->get_label() + " ";
}
- OUString sValue, aURL;
- m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
+ // some buttons are not included
+ sAllStrings += m_xPrivacyPolicyButton->get_label() + " ";
- if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) &&
- ( aURL != sValue ) )
- {
- m_xUpdateAccess->replaceByName( "DownloadDestination", uno::Any( aURL ) );
- bModified = true;
+ return sAllStrings.replaceAll("_", "");
+}
+
+bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* )
+{
+ bool bModified = false;
+
+ if (m_showTraditionalOnlineUpdate) {
+ bool bValue;
+ sal_Int64 nValue;
+
+ if( m_xAutoCheckCheckBox->get_state_changed_from_saved() )
+ {
+ bValue = m_xAutoCheckCheckBox->get_active();
+ m_xUpdateAccess->replaceByName( "AutoCheckEnabled", uno::Any( bValue ) );
+ bModified = true;
+ }
+
+ nValue = 0;
+ if( m_xEveryDayButton->get_active() )
+ {
+ if( !m_xEveryDayButton->get_saved_state() )
+ nValue = 86400;
+ }
+ else if( m_xEveryWeekButton->get_active() )
+ {
+ if( !m_xEveryWeekButton->get_saved_state() )
+ nValue = 604800;
+ }
+ else if( m_xEveryMonthButton->get_active() )
+ {
+ if( !m_xEveryMonthButton->get_saved_state() )
+ nValue = 2592000;
+ }
+
+ if( nValue > 0 )
+ {
+ m_xUpdateAccess->replaceByName( "CheckInterval", uno::Any( nValue ) );
+ bModified = true;
+ }
+
+ if( m_xAutoDownloadCheckBox->get_state_changed_from_saved() )
+ {
+ bValue = m_xAutoDownloadCheckBox->get_active();
+ m_xUpdateAccess->replaceByName( "AutoDownloadEnabled", uno::Any( bValue ) );
+ bModified = true;
+ }
+
+ OUString sValue, aURL;
+ m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
+
+ if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) &&
+ ( aURL != sValue ) )
+ {
+ m_xUpdateAccess->replaceByName( "DownloadDestination", uno::Any( aURL ) );
+ bModified = true;
+ }
+
+ if( m_xExtrasCheckBox->get_state_changed_from_saved() )
+ {
+ bValue = m_xExtrasCheckBox->get_active();
+ m_xUpdateAccess->replaceByName( "ExtendedUserAgent", uno::Any( bValue ) );
+ bModified = true;
+ }
+
+ uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, uno::UNO_QUERY);
+ if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
+ xChangesBatch->commitChanges();
}
- if( m_xExtrasCheckBox->get_state_changed_from_saved() )
- {
- bValue = m_xExtrasCheckBox->get_active();
- m_xUpdateAccess->replaceByName( "ExtendedUserAgent", uno::Any( bValue ) );
+ if (m_showMarOnlineUpdate && m_xEnableMar->get_state_changed_from_saved()) {
+ auto batch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Update::Update::Enabled::set(m_xEnableMar->get_active(), batch);
+ batch->commit();
bModified = true;
}
- uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, uno::UNO_QUERY);
- if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
- xChangesBatch->commitChanges();
-
return bModified;
}
void SvxOnlineUpdateTabPage::Reset( const SfxItemSet* )
{
- bool bValue = false;
- m_xUpdateAccess->getByName( "AutoCheckEnabled" ) >>= bValue;
- beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoCheckEnabled");
- bool bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
-
- m_xAutoCheckCheckBox->set_active(bValue);
- m_xAutoCheckCheckBox->set_sensitive(!bReadOnly);
-
- sal_Int64 nValue = 0;
- m_xUpdateAccess->getByName( "CheckInterval" ) >>= nValue;
- aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval");
- bool bReadOnly2 = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
- m_xEveryDayButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
- m_xEveryWeekButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
- m_xEveryMonthButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
-
- if( nValue == 86400 )
- m_xEveryDayButton->set_active(true);
- else if( nValue == 604800 )
- m_xEveryWeekButton->set_active(true);
- else
- m_xEveryMonthButton->set_active(true);
-
- m_xAutoCheckCheckBox->save_state();
- m_xEveryDayButton->save_state();
- m_xEveryWeekButton->save_state();
- m_xEveryMonthButton->save_state();
-
- m_xUpdateAccess->getByName( "AutoDownloadEnabled" ) >>= bValue;
- aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoDownloadEnabled");
- bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
- m_xAutoDownloadCheckBox->set_active(bValue);
- m_xAutoDownloadCheckBox->set_sensitive(!bReadOnly);
- m_xDestPathLabel->set_sensitive(true);
- m_xDestPath->set_sensitive(true);
-
- OUString sValue, aPath;
- m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
- aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/DownloadDestination");
- bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
- m_xChangePathButton->set_sensitive(!bReadOnly);
-
- if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
- m_xDestPath->set_label(aPath);
-
- m_xUpdateAccess->getByName( "ExtendedUserAgent" ) >>= bValue;
- aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/ExtendedUserAgent");
- bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
- m_xExtrasCheckBox->set_active(bValue);
- m_xExtrasCheckBox->set_sensitive(!bReadOnly);
- m_xExtrasCheckBox->save_state();
- UpdateUserAgent();
+ if (m_showTraditionalOnlineUpdate) {
+ bool bValue = false;
+ m_xUpdateAccess->getByName( "AutoCheckEnabled" ) >>= bValue;
+ beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoCheckEnabled");
+ bool bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
+
+ m_xAutoCheckCheckBox->set_active(bValue);
+ m_xAutoCheckCheckBox->set_sensitive(!bReadOnly);
+ m_xAutoCheckImg->set_visible(bReadOnly);
+
+ sal_Int64 nValue = 0;
+ m_xUpdateAccess->getByName( "CheckInterval" ) >>= nValue;
+ aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval");
+ bool bReadOnly2 = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
+ m_xEveryDayButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
+ m_xEveryWeekButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
+ m_xEveryMonthButton->set_sensitive(bValue && !(bReadOnly || bReadOnly2));
+ m_xCheckIntervalImg->set_visible(bReadOnly2);
+
+ if( nValue == 86400 )
+ m_xEveryDayButton->set_active(true);
+ else if( nValue == 604800 )
+ m_xEveryWeekButton->set_active(true);
+ else
+ m_xEveryMonthButton->set_active(true);
+
+ m_xAutoCheckCheckBox->save_state();
+ m_xEveryDayButton->save_state();
+ m_xEveryWeekButton->save_state();
+ m_xEveryMonthButton->save_state();
+
+ m_xUpdateAccess->getByName( "AutoDownloadEnabled" ) >>= bValue;
+ aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/AutoDownloadEnabled");
+ bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
+ m_xAutoDownloadCheckBox->set_active(bValue);
+ m_xAutoDownloadCheckBox->set_sensitive(!bReadOnly);
+ m_xAutoDownloadImg->set_visible(bReadOnly);
+ m_xDestPathLabel->set_sensitive(true);
+ m_xDestPath->set_sensitive(true);
+
+ OUString sValue, aPath;
+ m_xUpdateAccess->getByName( "DownloadDestination" ) >>= sValue;
+ aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/DownloadDestination");
+ bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
+ m_xChangePathButton->set_sensitive(!bReadOnly);
+
+ if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
+ m_xDestPath->set_label(aPath);
+
+ m_xUpdateAccess->getByName( "ExtendedUserAgent" ) >>= bValue;
+ aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/ExtendedUserAgent");
+ bReadOnly = (aProperty.Attributes & beans::PropertyAttribute::READONLY) != 0;
+ m_xExtrasCheckBox->set_active(bValue);
+ m_xExtrasCheckBox->set_sensitive(!bReadOnly);
+ m_xExtrasImg->set_visible(bReadOnly);
+ m_xExtrasCheckBox->save_state();
+ UpdateUserAgent();
+
+ m_xAutoDownloadCheckBox->save_state();
+ }
- m_xAutoDownloadCheckBox->save_state();
+ if (m_showMarOnlineUpdate) {
+ m_xEnableMar->set_active(officecfg::Office::Update::Update::Enabled::get());
+ m_xEnableMar->save_state();
+ }
}
void SvxOnlineUpdateTabPage::FillUserData()
{
}
-IMPL_LINK(SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bEnabled = rBox.get_active();
beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName("/org.openoffice.Office.Jobs/Jobs/org.openoffice.Office.Jobs:Job['UpdateCheck']/Arguments/CheckInterval");
@@ -318,9 +417,10 @@ IMPL_LINK(SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, weld::ToggleButton&, rBox,
m_xEveryDayButton->set_sensitive(bEnabled && !bReadOnly);
m_xEveryWeekButton->set_sensitive(bEnabled && !bReadOnly);
m_xEveryMonthButton->set_sensitive(bEnabled && !bReadOnly);
+ m_xCheckIntervalImg->set_visible(bReadOnly);
}
-IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, weld::Toggleable&, void)
{
UpdateUserAgent();
}
@@ -328,7 +428,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, weld::Button&, void
IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, weld::Button&, void)
{
uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext);
+ uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld());
OUString aURL;
if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) )
@@ -358,8 +458,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, weld::Button&, void)
aProperty.Name = "nodepath";
aProperty.Value <<= OUString("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob");
- uno::Sequence< uno::Any > aArgumentList( 1 );
- aArgumentList[0] <<= aProperty;
+ uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) };
uno::Reference< container::XNameAccess > xNameAccess(
xConfigProvider->createInstanceWithArguments(
@@ -393,4 +492,25 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl, weld::Button&, void)
}
}
+bool SvxOnlineUpdateTabPage::isTraditionalOnlineUpdateAvailable() {
+ try
+ {
+ css::uno::Reference < css::uno::XInterface > xService( setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
+ if( xService.is() )
+ return true;
+ }
+ catch ( css::uno::DeploymentException& )
+ {
+ }
+ return false;
+}
+
+bool SvxOnlineUpdateTabPage::isMarOnlineUpdateAvailable() {
+#if HAVE_FEATURE_UPDATE_MAR
+ return true;
+#else
+ return false;
+#endif
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx
index 3f189a336e18..48113c8079d6 100644
--- a/cui/source/options/optupdt.hxx
+++ b/cui/source/options/optupdt.hxx
@@ -28,6 +28,9 @@
class SvxOnlineUpdateTabPage : public SfxTabPage
{
private:
+ bool m_showTraditionalOnlineUpdate;
+ bool m_showMarOnlineUpdate;
+
OUString m_aNeverChecked;
OUString m_aLastCheckedTemplate;
@@ -36,22 +39,32 @@ private:
std::unique_ptr<weld::Label> m_xNeverChecked;
std::unique_ptr<weld::CheckButton> m_xAutoCheckCheckBox;
+ std::unique_ptr<weld::Widget> m_xAutoCheckImg;
std::unique_ptr<weld::RadioButton> m_xEveryDayButton;
std::unique_ptr<weld::RadioButton> m_xEveryWeekButton;
std::unique_ptr<weld::RadioButton> m_xEveryMonthButton;
+ std::unique_ptr<weld::Widget> m_xCheckIntervalImg;
std::unique_ptr<weld::Button> m_xCheckNowButton;
std::unique_ptr<weld::CheckButton> m_xAutoDownloadCheckBox;
+ std::unique_ptr<weld::Widget> m_xAutoDownloadImg;
std::unique_ptr<weld::Label> m_xDestPathLabel;
std::unique_ptr<weld::Label> m_xDestPath;
std::unique_ptr<weld::Button> m_xChangePathButton;
std::unique_ptr<weld::Label> m_xLastChecked;
std::unique_ptr<weld::CheckButton> m_xExtrasCheckBox;
+ std::unique_ptr<weld::Widget> m_xExtrasImg;
std::unique_ptr<weld::Label> m_xUserAgentLabel;
+ std::unique_ptr<weld::LinkButton> m_xPrivacyPolicyButton;
+ std::unique_ptr<weld::Box> m_xBox2;
+ std::unique_ptr<weld::Frame> m_xFrameDest;
+ std::unique_ptr<weld::Frame> m_xFrameAgent;
+ std::unique_ptr<weld::Frame> m_xMar;
+ std::unique_ptr<weld::CheckButton> m_xEnableMar;
DECL_LINK(FileDialogHdl_Impl, weld::Button&, void);
DECL_LINK(CheckNowHdl_Impl, weld::Button&, void);
- DECL_LINK(AutoCheckHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(ExtrasCheckHdl_Impl, weld::Button&, void);
+ DECL_LINK(AutoCheckHdl_Impl, weld::Toggleable&, void);
+ DECL_LINK(ExtrasCheckHdl_Impl, weld::Toggleable&, void);
void UpdateLastCheckedText();
void UpdateUserAgent();
@@ -61,9 +74,14 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxOnlineUpdateTabPage() override;
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
+
+ static bool isTraditionalOnlineUpdateAvailable();
+ static bool isMarOnlineUpdateAvailable();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index ac2def078f5c..3328760a9855 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -11,6 +11,8 @@
#include "personalization.hxx"
+#include <dialmgr.hxx>
+
#include <comphelper/processfactory.hxx>
#include <officecfg/Office/Common.hxx>
#include <rtl/bootstrap.hxx>
@@ -21,9 +23,9 @@
#include <vcl/settings.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/virdev.hxx>
+#include <personas.hrc>
using namespace com::sun::star;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
// persona
@@ -33,11 +35,13 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage(weld::Container* pPage,
: SfxTabPage(pPage, pController, "cui/ui/personalization_tab.ui", "PersonalizationTabPage",
&rSet)
, m_xNoPersona(m_xBuilder->weld_radio_button("no_persona"))
+ , m_xPersonaImg(m_xBuilder->weld_widget("lockpersona"))
, m_xDefaultPersona(m_xBuilder->weld_radio_button("default_persona"))
+ , m_xContentGrid(m_xBuilder->weld_container("gridpersonasetting"))
{
for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i)
{
- OString sDefaultId("default" + OString::number(i));
+ OUString sDefaultId("default" + OUString::number(i));
m_vDefaultPersonaImages[i] = m_xBuilder->weld_toggle_button(sDefaultId);
m_vDefaultPersonaImages[i]->connect_clicked(
LINK(this, SvxPersonalizationTabPage, DefaultPersona));
@@ -55,6 +59,23 @@ std::unique_ptr<SfxTabPage> SvxPersonalizationTabPage::Create(weld::Container* p
return std::make_unique<SvxPersonalizationTabPage>(pPage, pController, *rSet);
}
+OUString SvxPersonalizationTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString radioButton[] = { "no_persona", "default_persona" };
+
+ for (const auto& radio : radioButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_label("personas_label"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
{
// persona
@@ -63,11 +84,8 @@ bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
aPersona = "no";
bool bModified = false;
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
- if (xContext.is()
- && (aPersona != officecfg::Office::Common::Misc::Persona::get(xContext)
- || m_aPersonaSettings
- != officecfg::Office::Common::Misc::PersonaSettings::get(xContext)))
+ if (aPersona != officecfg::Office::Common::Misc::Persona::get()
+ || m_aPersonaSettings != officecfg::Office::Common::Misc::PersonaSettings::get())
{
bModified = true;
}
@@ -94,20 +112,24 @@ bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
void SvxPersonalizationTabPage::Reset(const SfxItemSet*)
{
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
-
// persona
- OUString aPersona("default");
- if (xContext.is())
- {
- aPersona = officecfg::Office::Common::Misc::Persona::get(xContext);
- m_aPersonaSettings = officecfg::Office::Common::Misc::PersonaSettings::get(xContext);
- }
+ OUString aPersona = officecfg::Office::Common::Misc::Persona::get();
+ m_aPersonaSettings = officecfg::Office::Common::Misc::PersonaSettings::get();
if (aPersona == "no")
m_xNoPersona->set_active(true);
else
m_xDefaultPersona->set_active(true);
+
+ if (officecfg::Office::Common::Misc::Persona::isReadOnly())
+ {
+ m_xNoPersona->set_sensitive(false);
+ m_xDefaultPersona->set_sensitive(false);
+ m_xPersonaImg->set_visible(true);
+ }
+
+ if (officecfg::Office::Common::Misc::PersonaSettings::isReadOnly())
+ m_xContentGrid->set_sensitive(false);
}
void SvxPersonalizationTabPage::LoadDefaultImages()
@@ -123,23 +145,24 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
sal_Int32 nIndex = 0;
bool foundOne = false;
+ OStringBuffer aLine;
+ int nLineNumberFilePersona = 0;
while (aStream.IsOpen() && !aStream.eof() && nIndex < MAX_DEFAULT_PERSONAS)
{
- OString aLine;
OUString aPersonaSetting, aPreviewFile, aName;
sal_Int32 nParseIndex = 0;
aStream.ReadLine(aLine);
aPersonaSetting = OStringToOUString(aLine, RTL_TEXTENCODING_UTF8);
- aName = aPersonaSetting.getToken(1, ';', nParseIndex);
- aPreviewFile = aPersonaSetting.getToken(0, ';', nParseIndex);
+ aName = CuiResId(RID_PERSONAS_COLOR[nLineNumberFilePersona].first);
+ aPreviewFile = aPersonaSetting.getToken(2, ';', nParseIndex);
if (aPreviewFile.isEmpty())
break;
m_vDefaultPersonaSettings.push_back(aPersonaSetting);
- INetURLObject aURLObj(gallery + aPreviewFile);
+ INetURLObject aURLObj(rtl::Concat2View(gallery + aPreviewFile));
aFilter.ImportGraphic(aGraphic, aURLObj);
Size aSize(aGraphic.GetSizePixel());
@@ -148,13 +171,14 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
ScopedVclPtr<VirtualDevice> xVirDev
= m_vDefaultPersonaImages[nIndex]->create_virtual_device();
xVirDev->SetOutputSizePixel(aSize);
- aGraphic.Draw(xVirDev.get(), Point(0, 0));
+ aGraphic.Draw(*xVirDev, Point(0, 0));
m_vDefaultPersonaImages[nIndex]->set_image(xVirDev.get());
xVirDev.disposeAndClear();
m_vDefaultPersonaImages[nIndex]->set_tooltip_text(aName);
m_vDefaultPersonaImages[nIndex++]->show();
foundOne = true;
+ ++nLineNumberFilePersona;
}
m_xDefaultPersona->set_sensitive(foundOne);
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index 671f194c244b..786b22c7d7b3 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -18,7 +18,9 @@ class SvxPersonalizationTabPage : public SfxTabPage
{
private:
std::unique_ptr<weld::RadioButton> m_xNoPersona; ///< Just the default look, without any bitmap
+ std::unique_ptr<weld::Widget> m_xPersonaImg;
std::unique_ptr<weld::RadioButton> m_xDefaultPersona; ///< Use the built-in bitmap
+ std::unique_ptr<weld::Container> m_xContentGrid;
std::unique_ptr<weld::ToggleButton> m_vDefaultPersonaImages
[MAX_DEFAULT_PERSONAS]; ///< Buttons to show the default persona images
OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.
@@ -33,6 +35,8 @@ public:
static std::unique_ptr<SfxTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
+ virtual OUString GetAllStrings() override;
+
/// Apply the settings ([OK] button).
virtual bool FillItemSet(SfxItemSet* rSet) override;
diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx
index f6a0cf3ad1ee..0ddd7f8f9f08 100644
--- a/cui/source/options/sdbcdriverenum.cxx
+++ b/cui/source/options/sdbcdriverenum.cxx
@@ -20,7 +20,7 @@
#include "sdbcdriverenum.hxx"
#include <comphelper/processfactory.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/DriverManager.hpp>
@@ -71,24 +71,24 @@ namespace offapp
}
}
- ODriverEnumeration::ODriverEnumeration() throw()
+ ODriverEnumeration::ODriverEnumeration() noexcept
:m_pImpl(new ODriverEnumerationImpl)
{
}
- ODriverEnumeration::~ODriverEnumeration() throw()
+ ODriverEnumeration::~ODriverEnumeration() noexcept
{
}
- ODriverEnumeration::const_iterator ODriverEnumeration::begin() const throw()
+ ODriverEnumeration::const_iterator ODriverEnumeration::begin() const noexcept
{
return m_pImpl->getDriverImplNames().begin();
}
- ODriverEnumeration::const_iterator ODriverEnumeration::end() const throw()
+ ODriverEnumeration::const_iterator ODriverEnumeration::end() const noexcept
{
return m_pImpl->getDriverImplNames().end();
}
diff --git a/cui/source/options/sdbcdriverenum.hxx b/cui/source/options/sdbcdriverenum.hxx
index ef25bca00430..852648893f16 100644
--- a/cui/source/options/sdbcdriverenum.hxx
+++ b/cui/source/options/sdbcdriverenum.hxx
@@ -40,12 +40,12 @@ namespace offapp
std::unique_ptr<ODriverEnumerationImpl> m_pImpl;
public:
- ODriverEnumeration() throw();
- ~ODriverEnumeration() throw();
+ ODriverEnumeration() noexcept;
+ ~ODriverEnumeration() noexcept;
typedef std::vector< OUString >::const_iterator const_iterator;
- const_iterator begin() const throw();
- const_iterator end() const throw();
+ const_iterator begin() const noexcept;
+ const_iterator end() const noexcept;
};
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
index 202128b99860..d99ad64e545e 100644
--- a/cui/source/options/securityoptions.cxx
+++ b/cui/source/options/securityoptions.cxx
@@ -17,28 +17,35 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/debug.hxx>
+#include <securityoptions.hxx>
#include <unotools/securityoptions.hxx>
-#include "securityoptions.hxx"
namespace
{
- bool enableAndSet(const SvtSecurityOptions& rOptions,
- SvtSecurityOptions::EOption eOption,
+ bool enableAndSet(SvtSecurityOptions::EOption eOption,
weld::CheckButton& rCheckBox, weld::Widget& rFixedImage)
{
- bool bEnable = rOptions.IsOptionEnabled(eOption);
+ bool bEnable = !SvtSecurityOptions::IsReadOnly(eOption);
rCheckBox.set_sensitive(bEnable);
rFixedImage.set_visible(!bEnable);
- rCheckBox.set_active(rOptions.IsOptionSet(eOption));
+ rCheckBox.set_active(SvtSecurityOptions::IsOptionSet(eOption));
return bEnable;
}
+
+ void CheckAndSave(SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModified)
+ {
+ if (!SvtSecurityOptions::IsReadOnly(_eOpt) && SvtSecurityOptions::IsOptionSet(_eOpt) != _bIsChecked)
+ {
+ SvtSecurityOptions::SetOption(_eOpt, _bIsChecked);
+ _rModified = true;
+ }
+ }
}
namespace svx
{
-SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions)
+SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/securityoptionsdialog.ui", "SecurityOptionsDialog")
, m_xSaveOrSendDocsCB(m_xBuilder->weld_check_button("savesenddocs"))
, m_xSaveOrSendDocsImg(m_xBuilder->weld_widget("locksavesenddocs"))
@@ -56,24 +63,92 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent, SvtSecurityO
, m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick"))
, m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted"))
, m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted"))
+ , m_xDisableActiveContentCB(m_xBuilder->weld_check_button("disableactivecontent"))
+ , m_xDisableActiveContentImg(m_xBuilder->weld_widget("lockdisableactivecontent"))
+ , m_xRedlineinfoCB(m_xBuilder->weld_check_button("redlineinfo"))
+ , m_xRedlineinfoImg(m_xBuilder->weld_widget("lockredlineinfo"))
+ , m_xDocPropertiesCB(m_xBuilder->weld_check_button("docproperties"))
+ , m_xDocPropertiesImg(m_xBuilder->weld_widget("lockdocproperties"))
+ , m_xNoteAuthorCB(m_xBuilder->weld_check_button("noteauthor"))
+ , m_xNoteAuthorImg(m_xBuilder->weld_widget("locknoteauthor"))
+ , m_xDocumentVersionCB(m_xBuilder->weld_check_button("documentversion"))
+ , m_xDocumentVersionImg(m_xBuilder->weld_widget("lockdocumentversion"))
+ , m_xPrinterSettingsCB(m_xBuilder->weld_check_button("printersettings"))
+ , m_xPrinterSettingsImg(m_xBuilder->weld_widget("lockprintersettings"))
+{
+ m_xRemovePersInfoCB->connect_toggled(LINK(this, SecurityOptionsDialog, ShowPersonalInfosToggle));
+ init();
+}
+
+IMPL_LINK_NOARG(SecurityOptionsDialog, ShowPersonalInfosToggle, weld::Toggleable&, void)
+{
+ changeKeepSecurityInfosEnabled();
+}
+
+void SecurityOptionsDialog::init()
{
- DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB,
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB,
*m_xSaveOrSendDocsImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnSigning, *m_xSignDocsCB,
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnSigning, *m_xSignDocsCB,
*m_xSignDocsImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnPrint, *m_xPrintDocsCB,
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnPrint, *m_xPrintDocsCB,
*m_xPrintDocsImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnCreatePdf, *m_xCreatePdfCB,
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnCreatePdf, *m_xCreatePdfCB,
*m_xCreatePdfImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB,
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB,
*m_xRemovePersInfoImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_xRecommPasswdCB,
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, *m_xRedlineinfoCB,
+ *m_xRedlineinfoImg);
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, *m_xDocPropertiesCB,
+ *m_xDocPropertiesImg);
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, *m_xNoteAuthorCB,
+ *m_xNoteAuthorImg);
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, *m_xDocumentVersionCB,
+ *m_xDocumentVersionImg);
+ enableAndSet(SvtSecurityOptions::EOption::DocKeepPrinterSettings, *m_xPrinterSettingsCB,
+ *m_xPrinterSettingsImg);
+ enableAndSet(SvtSecurityOptions::EOption::DocWarnRecommendPassword, *m_xRecommPasswdCB,
*m_xRecommPasswdImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB,
+ enableAndSet(SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB,
*m_xCtrlHyperlinkImg);
- enableAndSet(*pOptions, SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB,
+ enableAndSet(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB,
*m_xBlockUntrustedRefererLinksImg);
+ enableAndSet(SvtSecurityOptions::EOption::DisableActiveContent,
+ *m_xDisableActiveContentCB, *m_xDisableActiveContentImg);
+
+ if (!SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo))
+ changeKeepSecurityInfosEnabled();
+}
+
+bool SecurityOptionsDialog::SetSecurityOptions()
+{
+ bool bModified = false;
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnSaveOrSend, IsSaveOrSendDocsChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnSigning, IsSignDocsChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnPrint, IsPrintDocsChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnCreatePdf, IsCreatePdfChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, IsRemovePersInfoChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, IsRemoveRedlineInfoChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, IsRemoveDocUserInfoChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, IsRemoveNoteAuthorInfoChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, IsRemoveDocVersionInfoChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocKeepPrinterSettings, IsKeepPrinterSettingsChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DocWarnRecommendPassword, IsRecommPasswdChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::CtrlClickHyperlink, IsCtrlHyperlinkChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, IsBlockUntrustedRefererLinksChecked(), bModified);
+ CheckAndSave(SvtSecurityOptions::EOption::DisableActiveContent, IsDisableActiveContentChecked(), bModified);
+
+ return bModified;
+}
+
+void SecurityOptionsDialog::changeKeepSecurityInfosEnabled()
+{
+ bool bEnable = m_xRemovePersInfoCB->get_active();
+ m_xRedlineinfoCB->set_sensitive(bEnable);
+ m_xDocPropertiesCB->set_sensitive(bEnable);
+ m_xNoteAuthorCB->set_sensitive(bEnable);
+ m_xDocumentVersionCB->set_sensitive(bEnable);
+ m_xPrinterSettingsCB->set_sensitive(bEnable);
}
}
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index e254153ad4cc..6ab767bb8044 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -26,6 +26,7 @@
#include <config_gpgme.h>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Writer.hxx>
#include <svx/dialogs.hrc>
#include <svx/svxids.hrc>
@@ -62,6 +63,13 @@
#include "personalization.hxx"
#include <treeopt.hxx>
#include "optbasic.hxx"
+#include "optlanguagetool.hxx"
+#include "optdeepl.hxx"
+
+// include search util
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/util/SearchAlgorithms2.hpp>
+#include <unotools/textsearch.hxx>
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
#include <com/sun/star/awt/ContainerWindowProvider.hpp>
@@ -72,13 +80,13 @@
#include <com/sun/star/frame/UnknownModuleException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/linguistic2/LinguProperties.hpp>
-#include <com/sun/star/setup/UpdateCheck.hpp>
#include <comphelper/getexpandeduri.hxx>
#include <comphelper/processfactory.hxx>
#include <editeng/langitem.hxx>
#include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx>
#include <linguistic/misc.hxx>
+#include <o3tl/deleter.hxx>
#include <officecfg/Office/OptionsDialog.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
@@ -89,16 +97,17 @@
#include <sfx2/viewfrm.hxx>
#include <svl/flagitem.hxx>
#include <svl/intitem.hxx>
-#include <svl/languageoptions.hxx>
-#include <svtools/helpopt.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <svx/databaseregistrationui.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/moduleoptions.hxx>
#include <unotools/optionsdlg.hxx>
#include <unotools/viewoptions.hxx>
+#include <utility>
#include <vcl/help.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weldutils.hxx>
@@ -106,7 +115,6 @@
#include <sal/log.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
@@ -117,7 +125,7 @@ using namespace ::com::sun::star::util;
LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = nullptr;
// some stuff for easier changes for SvtViewOptions
-constexpr OUStringLiteral VIEWOPT_DATANAME = u"page data";
+constexpr OUString VIEWOPT_DATANAME = u"page data"_ustr;
static void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
{
@@ -226,42 +234,12 @@ static sal_uInt16 getGroupNodeId( std::u16string_view rModule )
namespace {
-class MailMergeCfg_Impl : public utl::ConfigItem
+bool MailMergeCfgIsEmailSupported()
{
-private:
- // variables
- bool bIsEmailSupported;
-
- virtual void ImplCommit() override;
-
-public:
- MailMergeCfg_Impl();
-
- virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
-
- bool IsEmailSupported() const {return bIsEmailSupported;}
-
-};
-
-}
-
-MailMergeCfg_Impl::MailMergeCfg_Impl() :
- utl::ConfigItem("Office.Writer/MailMergeWizard"),
- bIsEmailSupported(false)
-{
- Sequence<OUString> aNames { "EMailSupported" };
- const Sequence< Any > aValues = GetProperties(aNames);
- const Any* pValues = aValues.getConstArray();
- if(aValues.hasElements() && pValues[0].hasValue())
- pValues[0] >>= bIsEmailSupported;
+ std::optional<bool> b = officecfg::Office::Writer::MailMergeWizard::EMailSupported::get();
+ return b.has_value() && *b;
}
-void MailMergeCfg_Impl::ImplCommit()
-{
-}
-
-void MailMergeCfg_Impl::Notify( const css::uno::Sequence< OUString >& )
-{
}
//typedef SfxTabPage* (*FNCreateTabPage)(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet);
@@ -295,6 +273,8 @@ static std::unique_ptr<SfxTabPage> CreateGeneralTabPage(sal_uInt16 nId, weld::Co
case SID_SB_DBREGISTEROPTIONS: fnCreate = &svx::DbRegistrationOptionsPage::Create; break;
case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break;
case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
+ case RID_SVXPAGE_LANGTOOL_OPTIONS: fnCreate = &OptLanguageToolTabPage::Create ; break;
+ case RID_SVXPAGE_DEEPL_OPTIONS: fnCreate = &OptDeeplTabPage::Create ; break;
case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break;
#if HAVE_FEATURE_OPENCL
case RID_SVXPAGE_OPENCL: fnCreate = &SvxOpenCLTabPage::Create ; break;
@@ -451,7 +431,7 @@ struct OptionsPageInfo
struct OptionsGroupInfo
{
- std::unique_ptr<SfxItemSet> m_pInItemSet;
+ std::optional<SfxItemSet> m_pInItemSet;
std::unique_ptr<SfxItemSet> m_pOutItemSet;
SfxShell* m_pShell; // used to create the page
SfxModule* m_pModule; // used to create the ItemSet
@@ -462,22 +442,42 @@ struct OptionsGroupInfo
m_pModule( pMod ), m_nDialogId( nId ) {}
};
-#define INI_LIST() \
- , m_pParent ( pParent )\
- , sTitle ( m_xDialog->get_title() )\
- , bForgetSelection ( false )\
- , bIsFromExtensionManager( false ) \
- , bIsForSetDocumentLanguage( false ) \
- , bNeedsRestart ( false ) \
- , eRestartReason( svtools::RESTART_REASON_NONE )
-
-void OfaTreeOptionsDialog::InitWidgets()
-{
- xOkPB = m_xBuilder->weld_button("ok");
- xApplyPB = m_xBuilder->weld_button("apply");
- xBackPB = m_xBuilder->weld_button("revert");
- xTreeLB = m_xBuilder->weld_tree_view("pages");
- xTabBox = m_xBuilder->weld_container("box");
+struct OptionsPageIdInfo
+{
+ OUString m_sParentName;
+ OUString m_sPageName;
+ sal_uInt16 m_nParentId;
+ sal_uInt16 m_nPageId;
+
+ OptionsPageIdInfo(OUString sParentName, OUString sPageName, sal_uInt16 nParentId,
+ sal_uInt16 nPageId)
+ : m_sParentName(std::move(sParentName))
+ , m_sPageName(std::move(sPageName))
+ , m_nParentId(nParentId)
+ , m_nPageId(nPageId)
+ {
+ }
+};
+
+// Basic ctor with common initialization
+OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, bool fromExtensionManager)
+ : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
+ , xOkPB(m_xBuilder->weld_button("ok"))
+ , xApplyPB(m_xBuilder->weld_button("apply"))
+ , xBackPB(m_xBuilder->weld_button("revert"))
+ , xTreeLB(m_xBuilder->weld_tree_view("pages"))
+ , xTabBox(m_xBuilder->weld_container("box"))
+ , m_xSearchEdit(m_xBuilder->weld_entry("searchEntry"))
+ , m_pParent(pParent)
+ , m_aUpdateDataTimer("OfaTreeOptionsDialog UpdateDataTimer")
+ , bIsFirtsInitialize(true)
+ , sTitle(m_xDialog->get_title())
+ , bForgetSelection(false)
+ , bIsFromExtensionManager(fromExtensionManager)
+ , bIsForSetDocumentLanguage(false)
+ , bNeedsRestart(false)
+ , eRestartReason(svtools::RESTART_REASON_NONE)
+{
Size aSize(xTreeLB->get_approximate_digit_width() * 82, xTreeLB->get_height_rows(30));
#if HAVE_FEATURE_GPGME
// tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
@@ -485,38 +485,48 @@ void OfaTreeOptionsDialog::InitWidgets()
#endif
xTabBox->set_size_request(aSize.Width(), aSize.Height());
xTreeLB->set_size_request(xTreeLB->get_approximate_digit_width() * 35, aSize.Height());
+
+ // Init tree and handler
+ xTreeLB->set_help_id(HID_OFADLG_TREELISTBOX);
+ xTreeLB->connect_changed(LINK(this, OfaTreeOptionsDialog, ShowPageHdl_Impl));
+ xBackPB->connect_clicked(LINK(this, OfaTreeOptionsDialog, BackHdl_Impl));
+ xApplyPB->connect_clicked(LINK(this, OfaTreeOptionsDialog, ApplyHdl_Impl));
+ xOkPB->connect_clicked(LINK(this, OfaTreeOptionsDialog, ApplyHdl_Impl));
+ m_xSearchEdit->connect_changed(LINK(this, OfaTreeOptionsDialog, SearchUpdateHdl));
+ m_xSearchEdit->connect_focus_out(LINK(this, OfaTreeOptionsDialog, FocusOut_Impl));
+ m_xDialog->connect_help(LINK(this, OfaTreeOptionsDialog, HelpHdl_Impl));
+
+ m_aUpdateDataTimer.SetInvokeHandler(LINK(this, OfaTreeOptionsDialog, ImplUpdateDataHdl));
+ m_aUpdateDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
+
+ // Initialize search util
+ m_options.AlgorithmType2 = util::SearchAlgorithms2::ABSOLUTE;
+ m_options.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
+ m_options.searchFlag
+ |= (util::SearchFlags::REG_NOT_BEGINOFLINE | util::SearchFlags::REG_NOT_ENDOFLINE);
+
+ xTreeLB->set_accessible_name(sTitle);
}
// Ctor() with Frame -----------------------------------------------------
OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, const Reference< XFrame >& _xFrame, bool bActivateLastSelection)
- : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
- INI_LIST()
+ : OfaTreeOptionsDialog(pParent, false)
{
- InitWidgets();
-
- InitTreeAndHandler();
Initialize( _xFrame );
LoadExtensionOptions( u"" );
if (bActivateLastSelection)
ActivateLastSelection();
-
- xTreeLB->set_accessible_name(m_xDialog->get_title());
}
// Ctor() with ExtensionId -----------------------------------------------
OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, std::u16string_view rExtensionId)
- : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
- INI_LIST()
+ : OfaTreeOptionsDialog(pParent, !rExtensionId.empty())
{
- InitWidgets();
-
- bIsFromExtensionManager = ( !rExtensionId.empty() );
- InitTreeAndHandler();
LoadExtensionOptions( rExtensionId );
ActivateLastSelection();
}
-OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+void OfaTreeOptionsDialog::ImplDestroy()
{
xCurrentPageEntry.reset();
@@ -528,7 +538,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
// if Child (has parent), then OptionsPageInfo
if (xTreeLB->get_iter_depth(*xEntry))
{
- OptionsPageInfo *pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
if(pPageInfo->m_xPage)
{
pPageInfo->m_xPage->FillUserData();
@@ -564,7 +574,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
{
if (!xTreeLB->get_iter_depth(*xEntry))
{
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
delete pGroupInfo;
}
bEntry = xTreeLB->iter_next(*xEntry);
@@ -572,6 +582,11 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
deleteGroupNames();
}
+OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+{
+ suppress_fun_call_w_exception(ImplDestroy());
+}
+
OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup )
{
@@ -581,7 +596,7 @@ OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
xTreeLB->iter_nth_sibling(*xParent, nGroup);
OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pPageInfo)));
+ OUString sId(weld::toId(pPageInfo));
xTreeLB->insert(xParent.get(), -1, &rPageName, &sId, nullptr, nullptr, false, nullptr);
return pPageInfo;
}
@@ -594,7 +609,7 @@ sal_uInt16 OfaTreeOptionsDialog::AddGroup(const OUString& rGroupName,
{
OptionsGroupInfo* pInfo =
new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pInfo)));
+ OUString sId(weld::toId(pInfo));
xTreeLB->append(sId, rGroupName);
sal_uInt16 nRet = 0;
@@ -619,14 +634,14 @@ void OfaTreeOptionsDialog::ResetCurrentPageFromConfig()
if (!(xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry)))
return;
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if (pPageInfo->m_xPage)
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
xTreeLB->iter_parent(*xParent);
OptionsGroupInfo* pGroupInfo =
- reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
- pPageInfo->m_xPage->Reset( pGroupInfo->m_pInItemSet.get() );
+ weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
+ pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
}
else if ( pPageInfo->m_xExtPage )
pPageInfo->m_xExtPage->ResetPage();
@@ -645,13 +660,13 @@ void OfaTreeOptionsDialog::ApplyOptions()
{
if (xTreeLB->get_iter_depth(*xEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
if ( pPageInfo->m_xPage && !pPageInfo->m_xPage->HasExchangeSupport() )
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xEntry.get());
xTreeLB->iter_parent(*xParent);
OptionsGroupInfo* pGroupInfo =
- reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
pPageInfo->m_xPage->FillItemSet(pGroupInfo->m_pOutItemSet.get());
}
@@ -675,11 +690,11 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, HelpHdl_Impl, weld::Widget&, bool)
Help* pHelp = Application::GetHelp();
if (pHelp && xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if (pPageInfo->m_xPage)
{
- OString sHelpId(pPageInfo->m_xPage->GetHelpId());
- pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), m_xDialog.get());
+ OUString sHelpId(pPageInfo->m_xPage->GetHelpId());
+ pHelp->Start(sHelpId, m_xDialog.get());
return false;
}
}
@@ -694,13 +709,13 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
if (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if ( pPageInfo->m_xPage )
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
xTreeLB->iter_parent(*xParent);
- pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
&& pPageInfo->m_xPage->HasExchangeSupport() )
{
@@ -746,21 +761,321 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
SelectHdl_Impl();
}
- if (bNeedsRestart)
+ if (!bNeedsRestart)
+ return;
+
+ SolarMutexGuard aGuard;
+ weld::Window* pParent;
+ if (!bOkPressed)
+ pParent = m_xDialog.get();
+ else
+ {
+ m_xDialog->hide();
+ pParent = m_pParent;
+ }
+ bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
+ pParent, eRestartReason);
+ if (bRestart && !bOkPressed)
+ m_xDialog->response(RET_OK);
+}
+
+IMPL_LINK_NOARG(OfaTreeOptionsDialog, FocusOut_Impl, weld::Widget&, void)
+{
+ if (m_aUpdateDataTimer.IsActive())
+ {
+ m_aUpdateDataTimer.Stop();
+ m_aUpdateDataTimer.Invoke();
+ }
+}
+
+IMPL_LINK_NOARG(OfaTreeOptionsDialog, SearchUpdateHdl, weld::Entry&, void)
+{
+ m_aUpdateDataTimer.Start();
+}
+
+IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, Timer*, void)
+{
+ // initializeFirstNDialog() can take a long time, show wait cursor and disable input
+ std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new weld::WaitObject(m_pParent) : nullptr);
+
+ // Pause redraw
+ xTreeLB->freeze();
+
+ if (bIsFirtsInitialize)
+ {
+ m_xSearchEdit->freeze();
+ xTreeLB->hide();
+
+ initializeFirstNDialog();
+
+ m_xSearchEdit->thaw();
+ xTreeLB->show();
+ bIsFirtsInitialize = false;
+ }
+
+ // Apply the search filter
+ OUString aSearchTerm(m_xSearchEdit->get_text());
+ int nMatchFound = applySearchFilter(aSearchTerm);
+
+ // Resume redraw
+ xTreeLB->thaw();
+
+ // select first child of first node after the search done
+ if (nMatchFound != -1)
+ selectFirstEntry();
+}
+
+void OfaTreeOptionsDialog::selectFirstEntry()
+{
+ std::unique_ptr<weld::TreeIter> xTemp = xTreeLB->make_iterator();
+ bool bTemp = xTreeLB->get_iter_first(*xTemp);
+
+ while (bTemp)
+ {
+ // select only the first child
+ if (xTreeLB->get_iter_depth(*xTemp) && xTreeLB->get_id(*xTemp).toInt64())
+ {
+ std::unique_ptr<weld::TreeIter> xEntry(xTreeLB->make_iterator(xTemp.get()));
+
+ std::unique_ptr<weld::TreeIter> xParent(xTreeLB->make_iterator(xEntry.get()));
+ xTreeLB->iter_parent(*xParent);
+ xTreeLB->expand_row(*xParent);
+ xTreeLB->scroll_to_row(*xParent);
+ xTreeLB->scroll_to_row(*xEntry);
+ xTreeLB->set_cursor(*xEntry);
+ xTreeLB->select(*xEntry);
+ SelectHdl_Impl();
+
+ break;
+ }
+ bTemp = xTreeLB->iter_next(*xTemp);
+ }
+}
+
+void OfaTreeOptionsDialog::initializeFirstNDialog(sal_Int16 nNumberOfNode)
+{
+ std::unique_ptr<weld::TreeIter> xEntry;
+ sal_Int16 nCount = 0;
+
+ std::unique_ptr<weld::TreeIter> xTemp = xTreeLB->make_iterator();
+ bool bTemp = xTreeLB->get_iter_first(*xTemp);
+
+ while (bTemp)
+ {
+ if (xTreeLB->get_iter_depth(*xTemp) && xTreeLB->get_id(*xTemp).toInt64())
+ {
+ if (!(xEntry = xTreeLB->make_iterator(xTemp.get())))
+ {
+ xEntry = xTreeLB->make_iterator();
+ if (!xTreeLB->get_iter_first(*xEntry) || !xTreeLB->iter_next(*xEntry))
+ xEntry.reset();
+ }
+
+ if (!xEntry)
+ return;
+
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
+ if (TreeOptHelper::getStringsFromDialog(pPageInfo->m_nPageId).isEmpty())
+ {
+ SolarMutexGuard aGuard;
+ initializeCurrentDialog(pPageInfo, xEntry);
+ }
+ }
+
+ /* if nNumberOfNode is -1 (which is the default value if no parameter provided),
+ this function will initialize all dialogs since nCount always greater than -1 */
+ if (nCount == nNumberOfNode)
+ break;
+
+ ++nCount;
+ bTemp = xTreeLB->iter_next(*xTemp);
+ }
+}
+
+void OfaTreeOptionsDialog::clearOptionsDialog()
+{
+ // clear and reset
+ std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
+ bool bEntry = xTreeLB->get_iter_first(*xEntry);
+
+ while (bEntry)
{
- SolarMutexGuard aGuard;
- weld::Window* pParent;
- if (!bOkPressed)
- pParent = m_xDialog.get();
+ if (xTreeLB->get_iter_depth(*xEntry))
+ {
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
+ if (pPageInfo->m_xPage)
+ pPageInfo->m_xPage.reset();
+ }
+ bEntry = xTreeLB->iter_next(*xEntry);
+ }
+ xCurrentPageEntry.reset();
+}
+
+// store Options tree with their page names
+void OfaTreeOptionsDialog::storeOptionsTree()
+{
+ m_aTreePageIds.clear();
+
+ sal_uInt16 aParentId = 0;
+ OUString sParentName;
+
+ std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
+ bool bEntry = xTreeLB->get_iter_first(*xEntry);
+
+ while (bEntry)
+ {
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
+ bool bIsParentNode = !xTreeLB->get_iter_depth(*xEntry);
+
+ if (bIsParentNode)
+ {
+ // Parent node
+ sParentName = xTreeLB->get_text(*xEntry);
+ aParentId = pGroupInfo->m_nDialogId;
+ m_aTreePageIds.push_back(new OptionsPageIdInfo(sParentName, sParentName, aParentId, 0));
+ }
else
{
- m_xDialog->hide();
- pParent = m_pParent;
+ // Child node
+ OUString sChildName = xTreeLB->get_text(*xEntry);
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
+ m_aTreePageIds.push_back(
+ new OptionsPageIdInfo(sParentName, sChildName, aParentId, pPageInfo->m_nPageId));
+ }
+ bEntry = xTreeLB->iter_next(*xEntry);
+ }
+}
+
+int OfaTreeOptionsDialog::applySearchFilter(const OUString& rSearchTerm)
+{
+ if (rSearchTerm.isEmpty())
+ {
+ clearOptionsDialog();
+ xTreeLB->clear();
+ Initialize(m_xFrame);
+
+ return 0;
+ }
+
+ m_options.searchString = rSearchTerm;
+ utl::TextSearch textSearch(m_options);
+
+ clearOptionsDialog();
+
+ if (xTreeLB->n_children() > 0)
+ xTreeLB->clear();
+
+ std::vector<std::pair<sal_uInt16, std::vector<sal_uInt16>>> aFoundIdsVector;
+
+ for (std::size_t i = 0; i < m_aTreePageIds.size(); ++i)
+ {
+ const OUString sParentName = m_aTreePageIds[i]->m_sParentName;
+ const OUString sPageName = m_aTreePageIds[i]->m_sPageName;
+ const sal_uInt16 nParentId = m_aTreePageIds[i]->m_nParentId;
+ const sal_uInt16 nPageId = m_aTreePageIds[i]->m_nPageId;
+
+ const OUString sPageStrings = TreeOptHelper::getStringsFromDialog(nPageId);
+ const OUString sPageNameAndStrings = sParentName + " " + sPageName + " " + sPageStrings;
+
+ sal_Int32 aStartPos = 0;
+ sal_Int32 aEndPos = sPageNameAndStrings.getLength();
+
+ // check if rSearchTerm matches with sPageNameAndStrings
+ if (textSearch.SearchForward(sPageNameAndStrings, &aStartPos, &aEndPos))
+ {
+ bool isFound = false;
+ for (auto& aEntryId : aFoundIdsVector)
+ {
+ if (aEntryId.first == nParentId)
+ {
+ isFound = true;
+ aEntryId.second.push_back(nPageId);
+ }
+ }
+
+ if (!isFound)
+ aFoundIdsVector.push_back({ nParentId, { nPageId } });
+ }
+ }
+
+ showDialog(aFoundIdsVector);
+
+ // if treeview is empty, return -1
+ return xTreeLB->n_children() ? 0 : -1;
+}
+
+void OfaTreeOptionsDialog::showDialog(VectorOfMatchedIds& pSearchIds)
+{
+ //
+ // void generalOptions(); // SID_GENERAL_OPTIONS
+ // void loadAndSaveOptions(); // SID_FILTER_DLG
+ // void languageOptions(); // SID_LANGUAGE_OPTIONS
+ // void writerOptions(); // SID_SW_EDITOPTIONS
+ // void writerWebOptions(); // SID_SW_ONLINEOPTIONS
+ // void calcOptions(); // SID_SC_EDITOPTIONS
+ // void impressOptions(); // SID_SD_EDITOPTIONS
+ // void drawOptions(); // SID_SD_GRAPHIC_OPTIONS
+ // void mathOptions(); // SID_SM_EDITOPTIONS
+ // void databaseOptions(); // SID_SB_STARBASEOPTIONS
+ // void chartOptions(); // SID_SCH_EDITOPTIONS
+ // void internetOptions(); // SID_INET_DLG
+ //
+
+ for (auto& aEntryId : pSearchIds)
+ {
+ switch (aEntryId.first)
+ {
+ case SID_GENERAL_OPTIONS:
+ generalOptions(aEntryId.second);
+ break;
+
+ case SID_FILTER_DLG:
+ loadAndSaveOptions(aEntryId.second);
+ break;
+
+ case SID_LANGUAGE_OPTIONS:
+ languageOptions(aEntryId.second);
+ break;
+
+ case SID_SW_EDITOPTIONS:
+ writerOptions(aEntryId.second);
+ break;
+
+ case SID_SW_ONLINEOPTIONS:
+ writerWebOptions(aEntryId.second);
+ break;
+
+ case SID_SC_EDITOPTIONS:
+ calcOptions(aEntryId.second);
+ break;
+
+ case SID_SD_EDITOPTIONS:
+ impressOptions(aEntryId.second);
+ break;
+
+ case SID_SD_GRAPHIC_OPTIONS:
+ drawOptions(aEntryId.second);
+ break;
+
+ case SID_SM_EDITOPTIONS:
+ mathOptions(aEntryId.second);
+ break;
+
+ case SID_SB_STARBASEOPTIONS:
+ databaseOptions(aEntryId.second);
+ break;
+
+ case SID_SCH_EDITOPTIONS:
+ chartOptions(aEntryId.second);
+ break;
+
+ case SID_INET_DLG:
+ internetOptions(aEntryId.second);
+ break;
+
+ default:
+ break;
}
- bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
- pParent, eRestartReason);
- if (bRestart && !bOkPressed)
- m_xDialog->response(RET_OK);
}
}
@@ -772,7 +1087,7 @@ void OfaTreeOptionsDialog::ApplyItemSets()
{
if (!xTreeLB->get_iter_depth(*xEntry))
{
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
if(pGroupInfo->m_pOutItemSet)
{
if(pGroupInfo->m_pShell)
@@ -785,16 +1100,6 @@ void OfaTreeOptionsDialog::ApplyItemSets()
}
}
-void OfaTreeOptionsDialog::InitTreeAndHandler()
-{
- xTreeLB->set_help_id(HID_OFADLG_TREELISTBOX);
- xTreeLB->connect_changed( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) );
- xBackPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) );
- xApplyPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, ApplyHdl_Impl ) );
- xOkPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, ApplyHdl_Impl ) );
- m_xDialog->connect_help( LINK( this, OfaTreeOptionsDialog, HelpHdl_Impl ) );
-}
-
void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
{
bIsForSetDocumentLanguage = false;
@@ -848,7 +1153,7 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
// restore only selection of a leaf
if (xTreeLB->get_iter_depth(*xTemp) && xTreeLB->get_id(*xTemp).toInt64())
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xTemp).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xTemp));
OUString sPageURL = pPageInfo->m_sPageURL;
if ( bMustExpand )
{
@@ -885,22 +1190,95 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
xTreeLB->scroll_to_row(*xEntry);
xTreeLB->set_cursor(*xEntry);
xTreeLB->select(*xEntry);
- xTreeLB->grab_focus();
+ m_xSearchEdit->grab_focus();
+ SelectHdl_Impl();
+
+ // initializeFirstNDialog() can take a long time, show wait cursor
+ std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new weld::WaitObject(m_pParent) : nullptr);
+
+ /* initialize first 25 dialogs which are almost half of the dialogs
+ in a row while Options dialog opens. then clear&reselect to avoid UI test failures. */
+ initializeFirstNDialog(25);
+ clearOptionsDialog();
SelectHdl_Impl();
}
void OfaTreeOptionsDialog::InitItemSets(OptionsGroupInfo& rGroupInfo)
{
if (!rGroupInfo.m_pInItemSet)
- rGroupInfo.m_pInItemSet = rGroupInfo.m_pShell
- ? rGroupInfo.m_pShell->CreateItemSet( rGroupInfo.m_nDialogId )
- : CreateItemSet( rGroupInfo.m_nDialogId );
+ rGroupInfo.m_pInItemSet.emplace( rGroupInfo.m_pShell
+ ? *rGroupInfo.m_pShell->CreateItemSet( rGroupInfo.m_nDialogId )
+ : *CreateItemSet( rGroupInfo.m_nDialogId ) );
if (!rGroupInfo.m_pOutItemSet)
rGroupInfo.m_pOutItemSet = std::make_unique<SfxItemSet>(
*rGroupInfo.m_pInItemSet->GetPool(),
rGroupInfo.m_pInItemSet->GetRanges());
}
+void OfaTreeOptionsDialog::initializeCurrentDialog(OptionsPageInfo*& pPageInfo,
+ std::unique_ptr<weld::TreeIter>& xEntry)
+{
+ std::unique_ptr<weld::TreeIter> xParent(xTreeLB->make_iterator(xEntry.get()));
+ bool bParent = xTreeLB->iter_parent(*xParent);
+
+ if (!bParent)
+ return;
+
+ if (pPageInfo->m_xPage)
+ {
+ TreeOptHelper::storeStringsOfDialog(pPageInfo->m_nPageId,
+ pPageInfo->m_xPage->GetAllStrings());
+ return;
+ }
+
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
+
+ if (!pPageInfo->m_xPage && pPageInfo->m_nPageId > 0)
+ {
+ InitItemSets(*pGroupInfo);
+
+ pPageInfo->m_xPage = ::CreateGeneralTabPage(pPageInfo->m_nPageId, xTabBox.get(), this,
+ *pGroupInfo->m_pInItemSet);
+
+ if (!pPageInfo->m_xPage && pGroupInfo->m_pModule)
+ pPageInfo->m_xPage = pGroupInfo->m_pModule->CreateTabPage(
+ pPageInfo->m_nPageId, xTabBox.get(), this, *pGroupInfo->m_pInItemSet);
+
+ DBG_ASSERT(pPageInfo->m_xPage, "tabpage could not created");
+ if (pPageInfo->m_xPage)
+ {
+ SvtViewOptions aTabPageOpt(EViewType::TabPage, OUString::number(pPageInfo->m_nPageId));
+ pPageInfo->m_xPage->SetUserData(GetViewOptUserItem(aTabPageOpt));
+ pPageInfo->m_xPage->SetFrame(m_xFrame);
+ pPageInfo->m_xPage->Reset(&*pGroupInfo->m_pInItemSet);
+ }
+
+ TreeOptHelper::storeStringsOfDialog(pPageInfo->m_nPageId,
+ pPageInfo->m_xPage->GetAllStrings());
+
+ pPageInfo->m_xPage->set_visible(false);
+ }
+ else if (0 == pPageInfo->m_nPageId && !pPageInfo->m_xExtPage)
+ {
+ if (!m_xContainerWinProvider.is())
+ m_xContainerWinProvider
+ = awt::ContainerWindowProvider::create(::comphelper::getProcessComponentContext());
+
+ pPageInfo->m_xExtPage = std::make_unique<ExtensionsTabPage>(
+ xTabBox.get(), pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider);
+
+ pPageInfo->m_xExtPage->Hide();
+ }
+
+ BuilderPage* pNewPage = pPageInfo->m_xPage.get();
+
+ // fdo#58170 use current page's layout child HelpId, unless there isn't a current page
+ OUString sHelpId(pNewPage ? pNewPage->GetHelpId() : OUString());
+ if (sHelpId.isEmpty())
+ sHelpId = HID_OFADLG_TREELISTBOX;
+ xTreeLB->set_help_id(sHelpId);
+}
+
void OfaTreeOptionsDialog::SelectHdl_Impl()
{
std::unique_ptr<weld::TreeIter> xEntry(xTreeLB->make_iterator());
@@ -921,14 +1299,14 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
BuilderPage* pNewPage = nullptr;
OptionsPageInfo* pOptPageInfo = (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
- ? reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64()) : nullptr;
+ ? weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry)) : nullptr;
if (pOptPageInfo && pOptPageInfo->m_xPage && pOptPageInfo->m_xPage->IsVisible())
{
std::unique_ptr<weld::TreeIter> xCurParent(xTreeLB->make_iterator(xCurrentPageEntry.get()));
xTreeLB->iter_parent(*xCurParent);
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent));
DeactivateRC nLeave = DeactivateRC::LeavePage;
if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_xPage->HasExchangeSupport() )
nLeave = pOptPageInfo->m_xPage->DeactivatePage( pGroupInfo->m_pOutItemSet.get() );
@@ -949,8 +1327,8 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
pOptPageInfo->m_xExtPage->DeactivatePage();
}
- OptionsPageInfo *pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
if(!pPageInfo->m_xPage && pPageInfo->m_nPageId > 0)
{
InitItemSets(*pGroupInfo);
@@ -965,7 +1343,8 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
{
SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) );
pPageInfo->m_xPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
- pPageInfo->m_xPage->Reset( pGroupInfo->m_pInItemSet.get() );
+ pPageInfo->m_xPage->SetFrame( m_xFrame );
+ pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
}
}
else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_xExtPage )
@@ -1020,42 +1399,43 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
pNewPage = pPageInfo->m_xPage.get();
// fdo#58170 use current page's layout child HelpId, unless there isn't a current page
- OString sHelpId(pNewPage ? pNewPage->GetHelpId() : OString());
+ OUString sHelpId(pNewPage ? pNewPage->GetHelpId() : OUString());
if (sHelpId.isEmpty())
sHelpId = HID_OFADLG_TREELISTBOX;
xTreeLB->set_help_id(sHelpId);
}
-std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
+std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
{
Reference< XLinguProperties > xProp( LinguMgr::GetLinguPropertySet() );
- std::unique_ptr<SfxItemSet> pRet;
+ std::optional<SfxItemSet> pRet;
switch(nId)
{
case SID_GENERAL_OPTIONS:
{
- pRet = std::make_unique<SfxItemSet>(
+ pRet.emplace(
SfxGetpApp()->GetPool(),
svl::Items<
SID_HTML_MODE, SID_HTML_MODE,
SID_ATTR_METRIC, SID_ATTR_METRIC,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
- SID_ATTR_YEAR2000, SID_ATTR_YEAR2000>{} );
+ SID_ATTR_YEAR2000, SID_ATTR_YEAR2000> );
- SfxItemSet aOptSet( SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER>{} );
- SfxGetpApp()->GetOptions(aOptSet);
+ SfxItemSetFixed<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER> aOptSet( SfxGetpApp()->GetPool() );
+ SfxApplication::GetOptions(aOptSet);
pRet->Put(aOptSet);
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
if ( pViewFrame )
{
- const SfxPoolItem* pItem = nullptr;
- SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ SfxPoolItemHolder aResult;
+ const SfxItemState aState(pViewFrame->GetDispatcher()->QueryState(SID_ATTR_YEAR2000, aResult));
+ const SfxUInt16Item* pItem(static_cast<const SfxUInt16Item*>(aResult.getItem()));
// miscellaneous - Year2000
- if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
- pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<const SfxUInt16Item*>(pItem)->GetValue() ) );
+ if(SfxItemState::DEFAULT <= aState && nullptr != pItem)
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, pItem->GetValue() ) );
else
pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
}
@@ -1074,7 +1454,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
break;
case SID_LANGUAGE_OPTIONS :
{
- pRet = std::make_unique<SfxItemSet>(
+ pRet.emplace(
SfxGetpApp()->GetPool(),
svl::Items<
SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
@@ -1082,7 +1462,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
- SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED>{});
+ SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED>);
// for linguistic
SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION );
@@ -1100,31 +1480,28 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
if ( pViewFrame )
{
- const SfxPoolItem* pItem = nullptr;
- SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
- if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem))
- pRet->Put(
- SvxLanguageItem(
- (static_cast<const SvxLanguageItem*>(pItem)
- ->GetLanguage()),
- SID_ATTR_LANGUAGE));
- if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem))
- pRet->Put(
- SvxLanguageItem(
- (static_cast<const SvxLanguageItem*>(pItem)
- ->GetLanguage()),
- SID_ATTR_CHAR_CJK_LANGUAGE));
- if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem))
- pRet->Put(
- SvxLanguageItem(
- (static_cast<const SvxLanguageItem*>(pItem)
- ->GetLanguage()),
- SID_ATTR_CHAR_CTL_LANGUAGE));
+ SfxPoolItemHolder aResult;
+ SfxDispatcher* pDispatch(pViewFrame->GetDispatcher());
+
+ SfxItemState aState(pDispatch->QueryState(SID_ATTR_LANGUAGE, aResult));
+ if(SfxItemState::DEFAULT <= aState)
+ pRet->Put(*aResult.getItem());
+
+ aState = pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, aResult);
+ if(SfxItemState::DEFAULT <= aState)
+ pRet->Put(*aResult.getItem());
+
+ aState = pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, aResult);
+ if(SfxItemState::DEFAULT <= aState)
+ pRet->Put(*aResult.getItem());
pRet->Put(aHyphen);
- if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem))
+
+ aState = pDispatch->QueryState(SID_AUTOSPELL_CHECK, aResult);
+ if(SfxItemState::DEFAULT <= aState)
{
- pRet->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone()));
+ pRet->Put(*aResult.getItem()); // allow share/refcounting
+ // pRet->Put(std::unique_ptr<SfxPoolItem>(aResult.getItem()->Clone()));
}
else
{
@@ -1141,37 +1518,36 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
}
break;
case SID_INET_DLG :
- pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
+ pRet.emplace( SfxGetpApp()->GetPool(),
svl::Items<
//SID_OPTIONS_START - ..END
SID_SAVEREL_INET, SID_SAVEREL_FSYS,
- SID_INET_NOPROXY, SID_INET_FTP_PROXY_PORT,
- SID_SECURE_URL, SID_SECURE_URL>{} );
- SfxGetpApp()->GetOptions(*pRet);
+ SID_INET_NOPROXY, SID_INET_HTTP_PROXY_PORT,
+ SID_SECURE_URL, SID_SECURE_URL> );
+ SfxApplication::GetOptions(*pRet);
break;
case SID_FILTER_DLG:
- pRet = std::make_unique<SfxItemSet>(
+ pRet.emplace(
SfxGetpApp()->GetPool(),
svl::Items<
SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE,
SID_SAVEREL_INET, SID_SAVEREL_FSYS,
- SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING>{} );
- SfxGetpApp()->GetOptions(*pRet);
+ SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING> );
+ SfxApplication::GetOptions(*pRet);
break;
case SID_SB_STARBASEOPTIONS:
- pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
- svl::Items<SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER>{} );
+ pRet.emplace( SfxGetpApp()->GetPool(),
+ svl::Items<SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER> );
::offapp::ConnectionPoolConfig::GetOptions(*pRet);
svx::DbRegisteredNamesConfig::GetOptions(*pRet);
break;
case SID_SCH_EDITOPTIONS:
{
- SvxChartOptions aChartOpt;
- pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS>{} );
- pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
+ pRet.emplace( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS> );
+ pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, SvxChartOptions::GetDefaultColors() ) );
break;
}
}
@@ -1186,36 +1562,35 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- const SfxPoolItem* pItem = nullptr;
- SfxItemSet aOptSet(SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER>{} );
+ SfxItemSetFixed<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER> aOptSet(SfxGetpApp()->GetPool());
aOptSet.Put(rSet);
if(aOptSet.Count())
- SfxGetpApp()->SetOptions( aOptSet );
+ SfxApplication::SetOptions( aOptSet );
// get dispatcher anew, because SetOptions() might have destroyed the dispatcher
SfxViewFrame *pViewFrame = SfxViewFrame::Current();
// evaluate Year2000
sal_uInt16 nY2K = USHRT_MAX;
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_YEAR2000, false, &pItem ) )
- nY2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ const SfxUInt16Item* pYearItem = rSet.GetItemIfSet( SID_ATTR_YEAR2000, false );
+ if( pYearItem )
+ nY2K = pYearItem->GetValue();
if( USHRT_MAX != nY2K )
{
if ( pViewFrame )
{
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
pDispatch->ExecuteList(SID_ATTR_YEAR2000,
- SfxCallMode::ASYNCHRON, { pItem });
+ SfxCallMode::ASYNCHRON, { pYearItem });
}
officecfg::Office::Common::DateFormat::TwoDigitYear::set(nY2K, batch);
}
// evaluate print
- if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, false, &pItem))
- officecfg::Office::Common::Print::Warning::NotFound::set(static_cast<const SfxBoolItem*>(pItem)->GetValue(), batch);
+ if(const SfxBoolItem* pWarnItem = rSet.GetItemIfSet(SID_PRINTER_NOTFOUND_WARN, false))
+ officecfg::Office::Common::Print::Warning::NotFound::set(pWarnItem->GetValue(), batch);
- if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, false, &pItem))
+ if(const SfxFlagItem* pFlag = rSet.GetItemIfSet(SID_PRINTER_CHANGESTODOC, false))
{
- const SfxFlagItem* pFlag = static_cast<const SfxFlagItem*>(pItem);
bool bPaperSizeWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_SIZE);
officecfg::Office::Common::Print::Warning::PaperSize::set(bPaperSizeWarning, batch);
bool bPaperOrientationWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION);
@@ -1223,10 +1598,12 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
}
// evaluate help options
- if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() )
- SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
- if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() )
- SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
+ bool bHelpTips = officecfg::Office::Common::Help::Tip::get();
+ if ( bHelpTips != Help::IsQuickHelpEnabled() )
+ bHelpTips ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
+ bool bExtendedHelp = officecfg::Office::Common::Help::ExtendedTip::get();
+ if ( bExtendedHelp != Help::IsBalloonHelpEnabled() )
+ bExtendedHelp ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
batch->commit();
}
@@ -1238,7 +1615,7 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
break;
case SID_INET_DLG :
case SID_FILTER_DLG:
- SfxGetpApp()->SetOptions( rSet );
+ SfxApplication::SetOptions( rSet );
break;
case SID_SB_STARBASEOPTIONS:
@@ -1252,7 +1629,7 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
default:
{
- OSL_FAIL( "Unhandled option in ApplyItemSet" );
+ SAL_WARN("cui.options", "Unhandled option in ApplyItemSet");
}
break;
}
@@ -1265,10 +1642,8 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
Reference< XLinguProperties > xProp = LinguProperties::create( xContext );
- if ( SfxItemState::SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, false, &pItem ) )
+ if ( const SfxHyphenRegionItem* pHyphenItem = rSet.GetItemIfSet(SID_ATTR_HYPHENREGION, false ) )
{
- const SfxHyphenRegionItem* pHyphenItem = static_cast<const SfxHyphenRegionItem*>(pItem);
-
xProp->setHyphMinLeading( static_cast<sal_Int16>(pHyphenItem->GetMinLead()) );
xProp->setHyphMinTrailing( static_cast<sal_Int16>(pHyphenItem->GetMinTrail()) );
bSaveSpellCheck = true;
@@ -1281,17 +1656,17 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
pItem = nullptr;
if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_LANGUAGE, false, &pItem ))
{
- pDispatch->ExecuteList(pItem->Which(), SfxCallMode::ASYNCHRON, { pItem });
+ pDispatch->ExecuteList(pItem->Which(), SfxCallMode::SYNCHRON, { pItem });
bSaveSpellCheck = true;
}
if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, false, &pItem ))
{
- pDispatch->ExecuteList(pItem->Which(), SfxCallMode::ASYNCHRON, { pItem });
+ pDispatch->ExecuteList(pItem->Which(), SfxCallMode::SYNCHRON, { pItem });
bSaveSpellCheck = true;
}
if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, false, &pItem ))
{
- pDispatch->ExecuteList(pItem->Which(), SfxCallMode::ASYNCHRON, { pItem });
+ pDispatch->ExecuteList(pItem->Which(), SfxCallMode::SYNCHRON, { pItem });
bSaveSpellCheck = true;
}
@@ -1324,7 +1699,7 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
}
}
-static OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
+OUString OfaTreeOptionsDialog::getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
{
OUString sIdentifier;
Reference < XFrame > xCurrentFrame( _xFrame );
@@ -1354,19 +1729,17 @@ static OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
return sIdentifier;
}
-void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
+void OfaTreeOptionsDialog::generalOptions(const std::vector<sal_uInt16>& vPageId)
{
sal_uInt16 nGroup = 0;
-
SvtOptionsDialogOptions aOptionsDlgOpt;
- sal_uInt16 nPageId;
+ sal_uInt16 nPageId = 0;
- // %PRODUCTNAME options
if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) )
{
setGroupName(u"ProductName", CuiResId(SID_GENERAL_OPTIONS_RES[0].first));
nGroup = AddGroup(CuiResId(SID_GENERAL_OPTIONS_RES[0].first), nullptr, nullptr, SID_GENERAL_OPTIONS );
- const sal_uInt16 nEnd = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_GENERAL_OPTIONS_RES));
+ const sal_uInt16 nEnd = static_cast<sal_uInt16>(std::size(SID_GENERAL_OPTIONS_RES));
for (sal_uInt16 i = 1; i < nEnd; ++i)
{
@@ -1375,67 +1748,101 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- // Disable Online Update page if service not installed
- if( RID_SVXPAGE_ONLINEUPDATE == nPageId )
+ // Disable Online Update page if neither mode is available
+ if( RID_SVXPAGE_ONLINEUPDATE == nPageId
+ && !(SvxOnlineUpdateTabPage::isTraditionalOnlineUpdateAvailable()
+ || SvxOnlineUpdateTabPage::isMarOnlineUpdateAvailable()) )
{
- try
- {
- Reference < XInterface > xService( setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
- if( ! xService.is() )
- continue;
- }
- catch ( css::uno::DeploymentException& )
- {
- continue;
- }
+ continue;
}
- // Disable Basic IDE options, if experimental features are not enabled
- if( RID_SVXPAGE_BASICIDE_OPTIONS == nPageId )
+ if (!vPageId.empty())
{
- if( ! officecfg::Office::Common::Misc::ExperimentalMode::get() )
- continue;
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, sNewTitle, nGroup);
}
-
- AddTabPage( nPageId, sNewTitle, nGroup );
+ else
+ AddTabPage(nPageId, sNewTitle, nGroup);
}
}
+}
+
+void OfaTreeOptionsDialog::loadAndSaveOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Load and Save options
if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) )
{
setGroupName( u"LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_FILTER_DLG_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_FILTER_DLG_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_FILTER_DLG_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup);
+ }
}
}
+}
- // Language options
- SvtLanguageOptions aLanguageOptions;
+void OfaTreeOptionsDialog::languageOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ SvtCTLOptions aCTLLanguageOptions;
if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) )
{
setGroupName(u"LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first));
nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS );
- for (size_t i = 1; i < SAL_N_ELEMENTS(SID_LANGUAGE_OPTIONS_RES); ++i)
+ for (size_t i = 1; i < std::size(SID_LANGUAGE_OPTIONS_RES); ++i)
{
nPageId = static_cast<sal_uInt16>(SID_LANGUAGE_OPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) &&
- ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aLanguageOptions.IsAsianTypographyEnabled() ) &&
- ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) )
- AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
+
+ // Disable DeepL translation settings, if experimental mode is not enabled
+ if( RID_SVXPAGE_DEEPL_OPTIONS == nPageId )
+ {
+ if( ! officecfg::Office::Common::Misc::ExperimentalMode::get() )
+ continue;
+ }
+
+ if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || SvtCJKOptions::IsJapaneseFindEnabled() ) &&
+ ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || SvtCJKOptions::IsAsianTypographyEnabled() ) &&
+ ( RID_SVXPAGE_OPTIONS_CTL != nPageId || SvtCTLOptions::IsCTLFontEnabled() ) )
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::writerOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- OUString aFactory = getCurrentFactory_Impl( _xFrame );
- DBG_ASSERT( GetModuleIdentifier( _xFrame ) == aFactory, "S H I T!!!" );
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
- // Writer and Writer/Web options
SvtModuleOptions aModuleOpt;
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
{
@@ -1452,38 +1859,105 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
else
setGroupName( u"Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SW_EDITOPTIONS_RES); ++i )
+ SvtCTLOptions aCTLLanguageOptions;
+ for ( size_t i = 1; i < std::size(SID_SW_EDITOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SW_EDITOPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) &&
- ( RID_SW_TP_STD_FONT_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) &&
- ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) )
- AddTabPage( nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first), nGroup );
+ if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || SvtCJKOptions::IsCJKFontEnabled() ) &&
+ ( RID_SW_TP_STD_FONT_CTL != nPageId || SvtCTLOptions::IsCTLFontEnabled() ) &&
+ ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfgIsEmailSupported() ) )
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first),
+ nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first), nGroup);
+ }
}
#ifdef DBG_UTIL
- AddTabPage( RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), RID_SW_TP_OPTTEST_PAGE)
+ != vPageId.end())
+ AddTabPage(RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup);
+ }
+ else
+ AddTabPage(RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup);
#endif
}
+ }
+ }
+}
+
+void OfaTreeOptionsDialog::writerWebOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+
+ SvtModuleOptions aModuleOpt;
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
+ {
+ // text document
+ if ( aFactory == "com.sun.star.text.TextDocument"
+ || aFactory == "com.sun.star.text.WebDocument"
+ || aFactory == "com.sun.star.text.GlobalDocument" )
+ {
+ SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer);
// HTML documents
if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) )
{
nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS );
- for( size_t i = 1; i < SAL_N_ELEMENTS(SID_SW_ONLINEOPTIONS_RES); ++i )
+ for( size_t i = 1; i < std::size(SID_SW_ONLINEOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SW_ONLINEOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage(nPageId, CuiResId(SID_SW_ONLINEOPTIONS_RES[i].first), nGroup);
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SW_ONLINEOPTIONS_RES[i].first),
+ nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SW_ONLINEOPTIONS_RES[i].first),
+ nGroup);
+ }
}
#ifdef DBG_UTIL
- AddTabPage( RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), RID_SW_TP_OPTTEST_PAGE)
+ != vPageId.end())
+ AddTabPage(RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup);
+ }
+ else
+ AddTabPage(RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup);
#endif
}
}
}
+}
+void OfaTreeOptionsDialog::calcOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+
+ SvtModuleOptions aModuleOpt;
// Calc options
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) )
{
@@ -1494,18 +1968,35 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
SfxModule* pScMod = SfxApplication::GetModule( SfxToolsModule::Calc );
setGroupName( u"Calc", CuiResId(SID_SC_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SC_EDITOPTIONS_RES[0].first), pScMod, pScMod, SID_SC_EDITOPTIONS );
- const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SC_EDITOPTIONS_RES));
+ const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SC_EDITOPTIONS_RES));
for ( sal_uInt16 i = 1; i < nCount; ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SC_EDITOPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- AddTabPage( nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup);
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::impressOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+ SvtModuleOptions aModuleOpt;
// Impress options
SfxModule* pSdMod = SfxApplication::GetModule( SfxToolsModule::Draw );
@@ -1517,20 +2008,38 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
setGroupName( u"Impress", CuiResId(SID_SD_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SD_EDITOPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_EDITOPTIONS );
- const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SD_EDITOPTIONS_RES));
+ const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SD_EDITOPTIONS_RES));
for ( sal_uInt16 i = 1; i < nCount; ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SD_EDITOPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- AddTabPage( nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup);
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::drawOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+ SvtModuleOptions aModuleOpt;
// Draw options
+ SfxModule* pSdMod = SfxApplication::GetModule(SfxToolsModule::Draw);
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) )
{
if ( aFactory == "com.sun.star.drawing.DrawingDocument" )
@@ -1539,18 +2048,36 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
setGroupName( u"Draw", CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS );
- const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SD_GRAPHIC_OPTIONS_RES));
+ const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SD_GRAPHIC_OPTIONS_RES));
for ( sal_uInt16 i = 1; i < nCount; ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SD_GRAPHIC_OPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- AddTabPage( nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first),
+ nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first), nGroup);
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::mathOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+ SvtModuleOptions aModuleOpt;
// Math options
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
@@ -1562,15 +2089,33 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math);
setGroupName( u"Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SM_EDITOPTIONS_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_SM_EDITOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SM_EDITOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first),
+ nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup);
+ }
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::databaseOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ SvtModuleOptions aModuleOpt;
// Database - needed only if there is an application which integrates with databases
if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) &&
@@ -1581,35 +2126,63 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
setGroupName( u"Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SB_STARBASEOPTIONS_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_SB_STARBASEOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SB_STARBASEOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::chartOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Chart options (always installed and active)
if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) )
{
setGroupName( u"Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SCH_EDITOPTIONS_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_SCH_EDITOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SCH_EDITOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::internetOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Internet options
if ( lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) )
return;
setGroupName(u"Internet", CuiResId(SID_INET_DLG_RES[0].first));
nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_INET_DLG_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_INET_DLG_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_INET_DLG_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
@@ -1619,33 +2192,82 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
if ( nPageId == RID_SVXPAGE_INET_MAIL )
continue;
#endif
- AddTabPage( nPageId, CuiResId(SID_INET_DLG_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_INET_DLG_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_INET_DLG_RES[i].first), nGroup);
}
}
+void OfaTreeOptionsDialog::Initialize(const Reference<XFrame>& _xFrame)
+{
+ m_xFrame = _xFrame;
+
+ // %PRODUCTNAME options
+ generalOptions();
+
+ // Load and Save options
+ loadAndSaveOptions();
+
+ // Language options
+ languageOptions();
+
+ // Writer and Writer/Web options
+ writerOptions();
+ writerWebOptions();
+
+ // Calc options
+ calcOptions();
+
+ // Impress options
+ impressOptions();
+
+ // Draw options
+ drawOptions();
+
+ // Math options
+ mathOptions();
+
+ // Database - needed only if there is an application which integrates with databases
+ databaseOptions();
+
+ // Chart options (always installed and active)
+ chartOptions();
+
+ // Internet options
+ internetOptions();
+
+ // store Options Dialogs with their page names and strings
+ // in order to use them when searching
+ storeOptionsTree();
+}
+
static bool isNodeActive( OptionsNode const * pNode, Module* pModule )
{
- if ( pNode )
- {
- // Node for all modules active?
- if ( pNode->m_bAllModules )
- return true;
+ if ( !pNode )
+ return false;
- // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted
- if ( !getGroupName( pNode->m_sId, false ).isEmpty() )
- return true;
+ // Node for all modules active?
+ if ( pNode->m_bAllModules )
+ return true;
- // no module -> not active
- if ( !pModule )
- return false;
+ // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted
+ if ( !getGroupName( pNode->m_sId, false ).isEmpty() )
+ return true;
- // search node in active module
- if ( pModule->m_bActive )
- {
- for (auto const& j : pModule->m_aNodeList)
- if ( j->m_sId == pNode->m_sId )
- return true;
- }
+ // no module -> not active
+ if ( !pModule )
+ return false;
+
+ // search node in active module
+ if ( pModule->m_bActive )
+ {
+ for (auto const& j : pModule->m_aNodeList)
+ if ( j->m_sId == pNode->m_sId )
+ return true;
}
return false;
}
@@ -1957,8 +2579,7 @@ short OfaTreeOptionsDialog::run()
if ( !bIsFromExtensionManager )
{
// collect all DictionaryList Events while the dialog is executed
- Reference<css::linguistic2::XSearchableDictionaryList> xDictionaryList(LinguMgr::GetDictionaryList());
- pClamp.reset( new SvxDicListChgClamp( xDictionaryList ) );
+ pClamp.reset(new SvxDicListChgClamp(LinguMgr::GetDictionaryList()));
}
return SfxOkDialogController::run();
@@ -1966,11 +2587,11 @@ short OfaTreeOptionsDialog::run()
// class ExtensionsTabPage -----------------------------------------------
ExtensionsTabPage::ExtensionsTabPage(
- weld::Container* pParent, const OUString& rPageURL,
- const OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider )
+ weld::Container* pParent, OUString aPageURL,
+ OUString aEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider )
: m_pContainer(pParent)
- , m_sPageURL(rPageURL)
- , m_sEventHdl(rEvtHdl)
+ , m_sPageURL(std::move(aPageURL))
+ , m_sEventHdl(std::move(aEvtHdl))
, m_xWinProvider(rProvider)
{
}
diff --git a/cui/source/options/treeopthelper.cxx b/cui/source/options/treeopthelper.cxx
new file mode 100644
index 000000000000..e486dbb5ea30
--- /dev/null
+++ b/cui/source/options/treeopthelper.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <fstream>
+#include <treeopt.hxx>
+
+#include <treeopt.hrc>
+#include <helpids.h>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+
+namespace
+{
+struct PageIdToFileNameMap_Impl
+{
+ sal_uInt16 m_nPageId;
+ OUString m_sContent;
+};
+}
+
+static PageIdToFileNameMap_Impl FileMap_Impl[] = {
+
+ // { PAGE-ID, CONTENT },
+
+ // ProductName, SID_GENERAL_OPTIONS
+ { RID_SFXPAGE_GENERAL, "" }, // UserData
+
+ { OFA_TP_MISC, "" }, // General
+
+ { OFA_TP_VIEW, "" }, // View
+
+ { RID_SFXPAGE_PRINTOPTIONS, "" }, // Print
+
+ { RID_SFXPAGE_PATH, "" }, // Paths
+
+ { RID_SVX_FONT_SUBSTITUTION, "" }, // Fonts
+
+ { RID_SVXPAGE_INET_SECURITY, "" }, // Security
+
+ { RID_SVXPAGE_PERSONALIZATION, "" }, // Personalization
+ { RID_SVXPAGE_COLORCONFIG, "" }, // ApplicationColors
+ { RID_SVXPAGE_ACCESSIBILITYCONFIG, "" }, // Accessibility
+ { RID_SVXPAGE_OPTIONS_JAVA, "" }, // Java
+ { RID_SVXPAGE_BASICIDE_OPTIONS, "" }, // BasicIDEOptions
+ { RID_SVXPAGE_ONLINEUPDATE, "" }, // OnlineUpdate
+ { RID_SVXPAGE_OPENCL, "" }, // OpenCL
+
+ // LanguageSettings, SID_LANGUAGE_OPTIONS
+ { OFA_TP_LANGUAGES, "" }, // Languages
+ { RID_SFXPAGE_LINGU, "" }, // WritingAids
+ { RID_SVXPAGE_JSEARCH_OPTIONS, "" }, // SearchingInJapanese
+ { RID_SVXPAGE_ASIAN_LAYOUT, "" }, // AsianLayout
+ { RID_SVXPAGE_OPTIONS_CTL, "" }, // ComplexTextLayout
+ { RID_SVXPAGE_LANGTOOL_OPTIONS, "" }, // LanguageTool Server
+ { RID_SVXPAGE_DEEPL_OPTIONS, "" }, // DeepL Server
+
+ // Internet, SID_INET_DLG
+ { RID_SVXPAGE_INET_PROXY, "" }, // Proxy
+ { RID_SVXPAGE_INET_MAIL, "" }, // Email
+
+ // Load/Save, SID_FILTER_DLG
+ { RID_SFXPAGE_SAVE, "" }, // General
+ { SID_OPTFILTER_MSOFFICE, "" }, // VBA Properties
+ { RID_OFAPAGE_MSFILTEROPT2, "" }, // Microsoft Office
+ { RID_OFAPAGE_HTMLOPT, "" }, // HTML Compatibility
+
+ // Writer, SID_SW_EDITOPTIONS
+ { RID_SW_TP_OPTLOAD_PAGE, "" }, // General
+ { RID_SW_TP_CONTENT_OPT, "" }, // View
+ { RID_SW_TP_OPTSHDWCRSR, "" }, // FormattingAids
+ { RID_SVXPAGE_GRID, "" }, // Grid
+ { RID_SW_TP_STD_FONT, "" }, // BasicFontsWestern
+ { RID_SW_TP_STD_FONT_CJK, "" }, // BasicFontsAsian
+ { RID_SW_TP_STD_FONT_CTL, "" }, // BasicFontsCTL
+ { RID_SW_TP_OPTPRINT_PAGE, "" }, // Print
+ { RID_SW_TP_OPTTABLE_PAGE, "" }, // Table
+ { RID_SW_TP_REDLINE_OPT, "" }, // Changes
+ { RID_SW_TP_COMPARISON_OPT, "" }, // Comparison
+ { RID_SW_TP_OPTCOMPATIBILITY_PAGE, "" }, // Compatibility
+ { RID_SW_TP_OPTCAPTION_PAGE, "" }, // AutoCaption
+ { RID_SW_TP_MAILCONFIG, "" }, // MailMerge
+ { RID_SW_TP_OPTTEST_PAGE, "" }, // Internal Test (only in dev build)
+
+ // WriterWeb, SID_SW_ONLINEOPTIONS
+ { RID_SW_TP_HTML_CONTENT_OPT, "" }, // View
+ { RID_SW_TP_HTML_OPTSHDWCRSR, "" }, // FormattingAids
+ { RID_SW_TP_HTML_OPTGRID_PAGE, "" }, // Grid
+ { RID_SW_TP_HTML_OPTPRINT_PAGE, "" }, // Print
+ { RID_SW_TP_HTML_OPTTABLE_PAGE, "" }, // Table
+ { RID_SW_TP_BACKGROUND, "" }, // Background
+ { RID_SW_TP_OPTTEST_PAGE, "" }, // Internal Test (only in dev build)
+
+ // Math, SID_SM_EDITOPTIONS
+ { SID_SM_TP_PRINTOPTIONS, "" }, // Settings
+
+ // Calc, SID_SC_EDITOPTIONS
+ { SID_SC_TP_LAYOUT, "" }, // General
+ { RID_SC_TP_DEFAULTS, "" }, // Defaults
+ { SID_SC_TP_CONTENT, "" }, // View
+ { SID_SC_TP_CALC, "" }, // Calculate
+ { SID_SC_TP_FORMULA, "" }, // Formula
+ { SID_SC_TP_USERLISTS, "" }, // SortLists
+ { SID_SC_TP_CHANGES, "" }, // Changes
+ { SID_SC_TP_COMPATIBILITY, "" }, // Compatibility
+ { SID_SC_TP_GRID, "" }, // Grid
+ { RID_SC_TP_PRINT, "" }, // Print
+
+ // Impress, SID_SD_EDITOPTIONS
+ { SID_SI_TP_MISC, "" }, // General
+ { SID_SI_TP_CONTENTS, "" }, // View
+ { SID_SI_TP_SNAP, "" }, // Grid
+ { SID_SI_TP_PRINT, "" }, // Print
+
+ // Draw, SID_SD_GRAPHIC_OPTIONS
+ { SID_SD_TP_MISC, "" }, // General
+ { SID_SD_TP_CONTENTS, "" }, // View
+ { SID_SD_TP_SNAP, "" }, // Grid
+ { SID_SD_TP_PRINT, "" }, // Print
+
+ // Charts, SID_SCH_EDITOPTIONS
+ { RID_OPTPAGE_CHART_DEFCOLORS, "" }, // DefaultColor
+
+ // Base, SID_SB_STARBASEOPTIONS
+ { SID_SB_CONNECTIONPOOLING, "" }, // Connections
+ { SID_SB_DBREGISTEROPTIONS, "" } // Databases
+};
+
+void TreeOptHelper::storeStringsOfDialog(sal_uInt16 nPageId, const OUString& sPageStrings)
+{
+ for (PageIdToFileNameMap_Impl& rEntry : FileMap_Impl)
+ {
+ if (rEntry.m_nPageId == nPageId)
+ {
+ rEntry.m_sContent = sPageStrings.replaceAll("~", "");
+ break;
+ }
+ }
+}
+
+/*
+return the strings of:
+- labels,
+- check buttons,
+- radio buttons,
+- toggle buttons,
+- link buttons,
+- buttons
+
+TODO:
+- accessible-names
+- accessible-descriptions
+- tooltip-texts
+*/
+OUString TreeOptHelper::getStringsFromDialog(sal_uInt16 nPageId)
+{
+ if (nPageId == 0)
+ return OUString();
+
+ for (PageIdToFileNameMap_Impl& rEntry : FileMap_Impl)
+ {
+ if (rEntry.m_nPageId == nPageId)
+ return rEntry.m_sContent;
+ }
+
+ return OUString();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 5c01e1c5b425..d0d9ef1c1c6c 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -10,7 +10,7 @@
#include <officecfg/Office/Common.hxx>
#include <svx/svxdlg.hxx>
#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "tsaurls.hxx"
@@ -88,17 +88,15 @@ void TSAURLsDialog::AddTSAURL(const OUString& rURL)
IMPL_LINK_NOARG(TSAURLsDialog, AddHdl_Impl, weld::Button&, void)
{
- OUString aURL;
OUString aDesc(m_xEnterAUrl->get_label());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSvxNameDialog> pDlg(
- pFact->CreateSvxNameDialog(m_xDialog.get(), aURL, aDesc));
+ pFact->CreateSvxNameDialog(m_xDialog.get(), OUString(), aDesc));
if (pDlg->Execute() == RET_OK)
{
- pDlg->GetName(aURL);
- AddTSAURL(aURL);
+ AddTSAURL(pDlg->GetName());
m_xOKBtn->set_sensitive(true);
}
m_xURLListBox->unselect_all();
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index b8ae35dba1e3..4ab84e4320ed 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/safeint.hxx>
#include "webconninfo.hxx"
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/PasswordContainer.hpp>
@@ -41,8 +42,10 @@ WebConnectionInfoDialog::WebConnectionInfoDialog(weld::Window* pParent)
, m_xChangeBtn(m_xBuilder->weld_button("change"))
, m_xPasswordsLB(m_xBuilder->weld_tree_view("logins"))
{
- std::vector<int> aWidths;
- aWidths.push_back(m_xPasswordsLB->get_approximate_digit_width() * 50);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xPasswordsLB->get_approximate_digit_width() * 50)
+ };
m_xPasswordsLB->set_column_fixed_widths(aWidths);
m_xPasswordsLB->set_size_request(m_xPasswordsLB->get_approximate_digit_width() * 70,
m_xPasswordsLB->get_height_rows(8));
@@ -187,8 +190,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl, weld::Button&, void)
if ( pPasswordRequest->isPassword() )
{
- OUString aNewPass = pPasswordRequest->getPassword();
- uno::Sequence<OUString> aPasswd { aNewPass };
+ uno::Sequence<OUString> aPasswd { pPasswordRequest->getPassword() };
uno::Reference< task::XPasswordContainer2 > xPasswdContainer(
task::PasswordContainer::create(comphelper::getProcessComponentContext()));
diff --git a/cui/source/tabpages/TextColumnsPage.cxx b/cui/source/tabpages/TextColumnsPage.cxx
new file mode 100644
index 000000000000..2e39995083f3
--- /dev/null
+++ b/cui/source/tabpages/TextColumnsPage.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <svtools/unitconv.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+#include <TextColumnsPage.hxx>
+
+const WhichRangesContainer
+ SvxTextColumnsPage::pRanges(svl::Items<SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST>);
+
+SvxTextColumnsPage::SvxTextColumnsPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs)
+ : SfxTabPage(pPage, pController, "cui/ui/textcolumnstabpage.ui", "TextColumnsPage", &rInAttrs)
+ , m_xColumnsNumber(m_xBuilder->weld_spin_button("FLD_COL_NUMBER"))
+ , m_xColumnsSpacing(
+ m_xBuilder->weld_metric_spin_button("MTR_FLD_COL_SPACING", GetModuleFieldUnit(rInAttrs)))
+{
+}
+
+SvxTextColumnsPage::~SvxTextColumnsPage() = default;
+
+// read the passed item set
+void SvxTextColumnsPage::Reset(const SfxItemSet* rAttrs)
+{
+ SfxItemPool* pPool = rAttrs->GetPool();
+ assert(pPool);
+
+ {
+ auto pItem = GetItem(*rAttrs, SDRATTR_TEXTCOLUMNS_NUMBER);
+ if (!pItem)
+ pItem = &pPool->GetUserOrPoolDefaultItem(SDRATTR_TEXTCOLUMNS_NUMBER);
+ m_xColumnsNumber->set_value(pItem->GetValue());
+ m_xColumnsNumber->save_value();
+ }
+
+ {
+ MapUnit eUnit = pPool->GetMetric(SDRATTR_TEXTCOLUMNS_SPACING);
+ auto pItem = GetItem(*rAttrs, SDRATTR_TEXTCOLUMNS_SPACING);
+ if (!pItem)
+ pItem = &pPool->GetUserOrPoolDefaultItem(SDRATTR_TEXTCOLUMNS_SPACING);
+ SetMetricValue(*m_xColumnsSpacing, pItem->GetValue(), eUnit);
+ m_xColumnsSpacing->save_value();
+ }
+}
+
+// fill the passed item set with dialog box attributes
+bool SvxTextColumnsPage::FillItemSet(SfxItemSet* rAttrs)
+{
+ if (m_xColumnsNumber->get_value_changed_from_saved())
+ rAttrs->Put(SfxInt16Item(SDRATTR_TEXTCOLUMNS_NUMBER, m_xColumnsNumber->get_value()));
+
+ if (m_xColumnsSpacing->get_value_changed_from_saved())
+ {
+ SfxItemPool* pPool = rAttrs->GetPool();
+ assert(pPool);
+ MapUnit eUnit = pPool->GetMetric(SDRATTR_TEXTCOLUMNS_SPACING);
+ sal_Int32 nValue = GetCoreValue(*m_xColumnsSpacing, eUnit);
+ rAttrs->Put(SdrMetricItem(SDRATTR_TEXTCOLUMNS_SPACING, nValue));
+ }
+
+ return true;
+}
+
+std::unique_ptr<SfxTabPage> SvxTextColumnsPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrs)
+{
+ return std::make_unique<SvxTextColumnsPage>(pPage, pController, *rAttrs);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 30965cf9cb7f..d5816158d70b 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -39,55 +39,57 @@
namespace svx {
-const sal_uInt16 AlignmentTabPage::s_pRanges[] =
-{
- SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
- SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
- SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
- SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
- SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
- SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
- SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
- SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
- SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
- 0
-};
+const WhichRangesContainer AlignmentTabPage::s_pRanges(
+ svl::Items<
+ SID_ATTR_ALIGN_STACKED, SID_ATTR_ALIGN_LINEBREAK, // 10229 - 10230
+ SID_ATTR_ALIGN_INDENT, SID_ATTR_ALIGN_INDENT, // 10460 - 10460
+ SID_ATTR_ALIGN_DEGREES, SID_ATTR_ALIGN_DEGREES, // 10577 - 10577
+ SID_ATTR_ALIGN_LOCKPOS, SID_ATTR_ALIGN_LOCKPOS, // 10578 - 10578
+ SID_ATTR_ALIGN_HYPHENATION, SID_ATTR_ALIGN_HYPHENATION, // 10931 - 10931
+ SID_ATTR_FRAMEDIRECTION, SID_ATTR_FRAMEDIRECTION, // 10944 - 10944
+ SID_ATTR_ALIGN_ASIANVERTICAL, SID_ATTR_ALIGN_ASIANVERTICAL, // 10949 - 10949
+ SID_ATTR_ALIGN_SHRINKTOFIT, SID_ATTR_ALIGN_SHRINKTOFIT, // 11015 - 11015
+ SID_ATTR_ALIGN_HOR_JUSTIFY, SID_ATTR_ALIGN_VER_JUSTIFY>); // 11571 - 11572
namespace {
template<typename JustContainerType, typename JustEnumType>
void lcl_MaybeResetAlignToDistro(
- weld::ComboBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, JustEnumType eBlock)
+ weld::ComboBox& rLB, sal_uInt16 nListId, const SfxItemSet& rCoreAttrs, TypedWhichId<SfxEnumItemInterface> nWhichAlign, TypedWhichId<SfxEnumItemInterface> nWhichJM, JustEnumType eBlock)
{
- const SfxPoolItem* pItem;
- if (rCoreAttrs.GetItemState(nWhichAlign, true, &pItem) != SfxItemState::SET)
+ const SfxEnumItemInterface* p = rCoreAttrs.GetItemIfSet(nWhichAlign);
+ if (!p)
// alignment not set.
return;
- const SfxEnumItemInterface* p = static_cast<const SfxEnumItemInterface*>(pItem);
JustContainerType eVal = static_cast<JustContainerType>(p->GetEnumValue());
if (eVal != eBlock)
// alignment is not 'justify'. No need to go further.
return;
- if (rCoreAttrs.GetItemState(nWhichJM, true, &pItem) != SfxItemState::SET)
+ p = rCoreAttrs.GetItemIfSet(nWhichJM);
+ if (!p)
// justification method is not set.
return;
- p = static_cast<const SfxEnumItemInterface*>(pItem);
SvxCellJustifyMethod eMethod = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
if (eMethod == SvxCellJustifyMethod::Distribute)
{
// Select the 'distribute' entry in the specified list box.
- rLB.set_active(nListPos);
+ rLB.set_active_id(OUString::number(nListId));
}
}
-void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, const SfxItemSet& rOldSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListPos)
+void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, const SfxItemSet& rOldSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListId)
{
+ // tdf#138698 unsupported, e.g. dbaccess
+ if (rLB.find_id(OUString::number(nListId)) == -1)
+ return;
+
+ // feature supported , e.g. calc
SvxCellJustifyMethod eJM = SvxCellJustifyMethod::Auto;
- if (rLB.get_active() == nListPos)
+ if (rLB.get_active_id().toInt32() == nListId)
eJM = SvxCellJustifyMethod::Distribute;
// tdf#129300 If it would create no change, don't force it
@@ -121,7 +123,6 @@ AlignmentTabPage::AlignmentTabPage(weld::Container* pPage, weld::DialogControlle
, m_xCbStacked(m_xBuilder->weld_check_button("checkVertStack"))
, m_xCbAsianMode(m_xBuilder->weld_check_button("checkAsianMode"))
// Properties
- , m_xBoxDirection(m_xBuilder->weld_widget("boxDirection"))
, m_xBtnWrap(m_xBuilder->weld_check_button("checkWrapTextAuto"))
, m_xBtnHyphen(m_xBuilder->weld_check_button("checkHyphActive"))
, m_xBtnShrink(m_xBuilder->weld_check_button("checkShrinkFitCellSize"))
@@ -152,7 +153,7 @@ AlignmentTabPage::AlignmentTabPage(weld::Container* pPage, weld::DialogControlle
m_xBtnShrink->connect_toggled(LINK(this, AlignmentTabPage, ShrinkClickHdl));
// Asian vertical mode
- m_xCbAsianMode->set_visible(SvtCJKOptions().IsVerticalTextEnabled());
+ m_xCbAsianMode->set_visible(SvtCJKOptions::IsVerticalTextEnabled());
m_xLbFrameDir->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR));
m_xLbFrameDir->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL));
@@ -221,7 +222,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
assert(pIndentItem);
std::unique_ptr<SfxUInt16Item> pNewIndentItem(pIndentItem->Clone());
pNewIndentItem->SetValue(m_xEdIndent->get_value(FieldUnit::TWIP));
- rSet->Put(*pNewIndentItem);
+ rSet->Put(std::move(pNewIndentItem));
bChanged = true;
}
else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -264,25 +265,25 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
assert(pAngleItem);
std::unique_ptr<SdrAngleItem> pNewAngleItem(pAngleItem->Clone());
pNewAngleItem->SetValue(m_xCtrlDial->GetRotation());
- rSet->Put(*pNewAngleItem);
+ rSet->Put(std::move(pNewAngleItem));
bChanged = true;
}
else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
rSet->InvalidateItem(nWhich);
- nWhich = GetWhich(SID_ATTR_ALIGN_LOCKPOS);
+ TypedWhichId<SvxRotateModeItem> nWhichLockPos(GetWhich(SID_ATTR_ALIGN_LOCKPOS));
if (m_aVsRefEdge.IsValueChangedFromSaved())
{
switch (m_aVsRefEdge.GetSelectedItemId())
{
case IID_CELLLOCK:
- rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_STANDARD, nWhich));
+ rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_STANDARD, nWhichLockPos));
break;
case IID_TOPLOCK:
- rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_TOP, nWhich));
+ rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_TOP, nWhichLockPos));
break;
case IID_BOTTOMLOCK:
- rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_BOTTOM, nWhich));
+ rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_BOTTOM, nWhichLockPos));
break;
default:
m_aVsRefEdge.SetNoSelection();
@@ -290,8 +291,8 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
}
bChanged = true;
}
- else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
- rSet->InvalidateItem(nWhich);
+ else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhichLockPos, false))
+ rSet->InvalidateItem(nWhichLockPos);
nWhich = GetWhich(SID_ATTR_ALIGN_STACKED);
if (m_xCbStacked->get_state_changed_from_saved())
@@ -301,7 +302,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
assert(pStackItem);
std::unique_ptr<SfxBoolItem> pNewStackItem(pStackItem->Clone());
pNewStackItem->SetValue(m_xCbStacked->get_active());
- rSet->Put(*pNewStackItem);
+ rSet->Put(std::move(pNewStackItem));
bChanged = true;
}
else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -324,7 +325,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
assert(pWrapItem);
std::unique_ptr<SfxBoolItem> pNewWrapItem(pWrapItem->Clone());
pNewWrapItem->SetValue(m_xBtnWrap->get_active());
- rSet->Put(*pNewWrapItem);
+ rSet->Put(std::move(pNewWrapItem));
bChanged = true;
}
else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -338,7 +339,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
assert(pHyphItem);
std::unique_ptr<SfxBoolItem> pNewHyphItem(pHyphItem->Clone());
pNewHyphItem->SetValue(m_xBtnHyphen->get_active());
- rSet->Put(*pNewHyphItem);
+ rSet->Put(std::move(pNewHyphItem));
bChanged = true;
}
else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -352,7 +353,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
assert(pShrinkItem);
std::unique_ptr<SfxBoolItem> pNewShrinkItem(pShrinkItem->Clone());
pNewShrinkItem->SetValue(m_xBtnShrink->get_active());
- rSet->Put(*pNewShrinkItem);
+ rSet->Put(std::move(pNewShrinkItem));
bChanged = true;
}
else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -373,12 +374,12 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
// Special treatment for distributed alignment; we need to set the justify
// method to 'distribute' to distinguish from the normal justification.
- sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD);
+ TypedWhichId<SfxEnumItemInterface> nWhichHorJM(GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD));
lcl_SetJustifyMethodToItemSet(*rSet, rOldSet, nWhichHorJM, *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED);
if (!bChanged)
bChanged = HasAlignmentChanged(*rSet, nWhichHorJM);
- sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD);
+ TypedWhichId<SfxEnumItemInterface> nWhichVerJM(GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD));
lcl_SetJustifyMethodToItemSet(*rSet, rOldSet, nWhichVerJM, *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED);
if (!bChanged)
bChanged = HasAlignmentChanged(*rSet, nWhichVerJM);
@@ -398,11 +399,10 @@ namespace
rTriState.bTriStateEnabled = false;
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
rBtn.set_sensitive(false);
rTriState.bTriStateEnabled = false;
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
rBtn.set_state(TRISTATE_INDET);
rTriState.bTriStateEnabled = true;
break;
@@ -437,10 +437,9 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
m_xLbHorAlign->hide();
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xLbHorAlign->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xLbHorAlign->set_active(-1);
break;
case SfxItemState::DEFAULT:
@@ -481,10 +480,9 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
m_xFtIndent->hide();
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xEdIndent->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xEdIndent->set_text("");
break;
case SfxItemState::DEFAULT:
@@ -505,10 +503,9 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
m_xFtVerAlign->hide();
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xLbVerAlign->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xLbVerAlign->set_active(-1);
break;
case SfxItemState::DEFAULT:
@@ -546,11 +543,10 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
m_xCtrlDialWin->hide();
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xNfRotate->set_sensitive(false);
m_xCtrlDialWin->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xCtrlDial->SetNoRotation();
break;
case SfxItemState::DEFAULT:
@@ -570,10 +566,9 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
m_xVsRefEdge->hide();
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xVsRefEdge->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_aVsRefEdge.SetNoSelection();
break;
case SfxItemState::DEFAULT:
@@ -609,10 +604,9 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
m_xLbFrameDir->hide();
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xLbFrameDir->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xLbFrameDir->set_active(-1);
break;
case SfxItemState::DEFAULT:
@@ -624,19 +618,43 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs)
}
}
-
// Special treatment for distributed alignment; we need to set the justify
// method to 'distribute' to distinguish from the normal justification.
+ TypedWhichId<SfxEnumItemInterface> nHorJustifyMethodWhich(GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD));
+ SfxItemState eHorJustifyMethodState = pCoreAttrs->GetItemState(nHorJustifyMethodWhich);
+ if (eHorJustifyMethodState == SfxItemState::UNKNOWN)
+ {
+ // feature unknown, e.g. dbaccess, remove the option
+ int nDistribId = m_xLbHorAlign->find_id(OUString::number(ALIGNDLG_HORALIGN_DISTRIBUTED));
+ if (nDistribId != -1)
+ m_xLbHorAlign->remove(nDistribId);
+ }
+ else
+ {
+ // feature known, e.g. calc
+ lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>(
+ *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, *pCoreAttrs,
+ TypedWhichId<SfxEnumItemInterface>(GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY)), nHorJustifyMethodWhich,
+ SvxCellHorJustify::Block);
+ }
- lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>(
- *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, *pCoreAttrs,
- GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD),
- SvxCellHorJustify::Block);
-
- lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>(
- *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, *pCoreAttrs,
- GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD),
- SvxCellVerJustify::Block);
+ TypedWhichId<SfxEnumItemInterface> nVerJustifyMethodWhich( GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD) );
+ SfxItemState eVerJustifyMethodState = pCoreAttrs->GetItemState(nVerJustifyMethodWhich);
+ if (eVerJustifyMethodState == SfxItemState::UNKNOWN)
+ {
+ // feature unknown, e.g. dbaccess, remove the option
+ int nDistribId = m_xLbVerAlign->find_id(OUString::number(ALIGNDLG_VERALIGN_DISTRIBUTED));
+ if (nDistribId != -1)
+ m_xLbVerAlign->remove(nDistribId);
+ }
+ else
+ {
+ // feature known, e.g. calc
+ lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>(
+ *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, *pCoreAttrs,
+ TypedWhichId<SfxEnumItemInterface>(GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY)), nVerJustifyMethodWhich,
+ SvxCellVerJustify::Block);
+ }
m_xLbHorAlign->save_value();
m_xLbFrameDir->save_value();
@@ -677,7 +695,7 @@ void AlignmentTabPage::InitVsRefEgde()
void AlignmentTabPage::UpdateEnableControls()
{
- const sal_Int32 nHorAlign = m_xLbHorAlign->get_active();
+ const sal_Int32 nHorAlign = m_xLbHorAlign->get_active_id().toInt32();
bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT);
bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK);
bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL);
@@ -716,50 +734,47 @@ void AlignmentTabPage::UpdateEnableControls()
m_xNfRotate->set_sensitive(!bHorFill && !bStackedText);
}
-bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const
+bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, TypedWhichId<SfxEnumItemInterface> nWhich ) const
{
const SfxItemSet& rOld = GetItemSet();
- const SfxPoolItem* pItem;
SvxCellJustifyMethod eMethodOld = SvxCellJustifyMethod::Auto;
SvxCellJustifyMethod eMethodNew = SvxCellJustifyMethod::Auto;
- if (rOld.GetItemState(nWhich, true, &pItem) == SfxItemState::SET)
+ if (const SfxEnumItemInterface* p = rOld.GetItemIfSet(nWhich))
{
- const SfxEnumItemInterface* p = static_cast<const SfxEnumItemInterface*>(pItem);
eMethodOld = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
}
- if (rNew.GetItemState(nWhich, true, &pItem) == SfxItemState::SET)
+ if (const SfxEnumItemInterface* p = rNew.GetItemIfSet(nWhich))
{
- const SfxEnumItemInterface* p = static_cast<const SfxEnumItemInterface*>(pItem);
eMethodNew = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
}
return eMethodOld != eMethodNew;
}
-IMPL_LINK(AlignmentTabPage, StackedClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(AlignmentTabPage, StackedClickHdl, weld::Toggleable&, rToggle, void)
{
m_aStackedState.ButtonToggled(rToggle);
UpdateEnableControls();
}
-IMPL_LINK(AlignmentTabPage, AsianModeClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(AlignmentTabPage, AsianModeClickHdl, weld::Toggleable&, rToggle, void)
{
m_aAsianModeState.ButtonToggled(rToggle);
}
-IMPL_LINK(AlignmentTabPage, WrapClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(AlignmentTabPage, WrapClickHdl, weld::Toggleable&, rToggle, void)
{
m_aWrapState.ButtonToggled(rToggle);
UpdateEnableControls();
}
-IMPL_LINK(AlignmentTabPage, HyphenClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(AlignmentTabPage, HyphenClickHdl, weld::Toggleable&, rToggle, void)
{
m_aHyphenState.ButtonToggled(rToggle);
}
-IMPL_LINK(AlignmentTabPage, ShrinkClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(AlignmentTabPage, ShrinkClickHdl, weld::Toggleable&, rToggle, void)
{
m_aShrinkState.ButtonToggled(rToggle);
}
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 00ac479bac09..b7abdbcce907 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -17,7 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
#include <i18nutil/unicode.hxx>
+#include <o3tl/safeint.hxx>
+#include <utility>
#include <vcl/event.hxx>
#include <vcl/keycodes.hxx>
#include <vcl/settings.hxx>
@@ -28,11 +32,11 @@
#include <unotools/charclass.hxx>
#include <unotools/collatorwrapper.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/module.hxx>
#include <svl/eitem.hxx>
-#include <svl/languageoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <svx/SmartTagMgr.hxx>
#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
#include <rtl/strbuf.hxx>
@@ -43,14 +47,13 @@
#include <autocdlg.hxx>
#include <editeng/acorrcfg.hxx>
#include <editeng/svxacorr.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
#include <strings.hrc>
#include <dialmgr.hxx>
#include <svx/svxids.hrc>
static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star;
OfaAutoCorrDlg::OfaAutoCorrDlg(weld::Window* pParent, const SfxItemSet* _pSet )
@@ -103,9 +106,9 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(weld::Window* pParent, const SfxItemSet* _pSet )
//! will be set to LANGUAGE_UNDETERMINED
SvxLanguageListFlags nLangList = SvxLanguageListFlags::WESTERN;
- if( SvtLanguageOptions().IsCTLFontEnabled() )
+ if( SvtCTLOptions::IsCTLFontEnabled() )
nLangList |= SvxLanguageListFlags::CTL;
- if( SvtLanguageOptions().IsCJKFontEnabled() )
+ if( SvtCJKOptions::IsCJKFontEnabled() )
nLangList |= SvxLanguageListFlags::CJK;
m_xLanguageLB->SetLanguageList( nLangList, true, true );
m_xLanguageLB->set_active_id( LANGUAGE_NONE );
@@ -163,7 +166,7 @@ IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox&, void)
if(eNewLang == eLastDialogLanguage)
return;
- OString sPageId = GetCurPageId();
+ OUString sPageId = GetCurPageId();
if (sPageId == "replace")
{
OfaAutocorrReplacePage* pPage = static_cast<OfaAutocorrReplacePage*>(GetTabPage(sPageId));
@@ -180,14 +183,15 @@ IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox&, void)
OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/acoroptionspage.ui", "AutocorrectOptionsPage", &rSet)
- , m_sInput(CuiResId(RID_SVXSTR_USE_REPLACE))
- , m_sDoubleCaps(CuiResId(RID_SVXSTR_CPTL_STT_WORD))
- , m_sStartCap(CuiResId(RID_SVXSTR_CPTL_STT_SENT))
- , m_sBoldUnderline(CuiResId(RID_SVXSTR_BOLD_UNDER))
- , m_sURL(CuiResId(RID_SVXSTR_DETECT_URL))
- , m_sNoDblSpaces(CuiResId(RID_SVXSTR_NO_DBL_SPACES))
- , m_sDash(CuiResId(RID_SVXSTR_DASH))
- , m_sAccidentalCaps(CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
+ , m_sInput(CuiResId(RID_CUISTR_USE_REPLACE))
+ , m_sDoubleCaps(CuiResId(RID_CUISTR_CPTL_STT_WORD))
+ , m_sStartCap(CuiResId(RID_CUISTR_CPTL_STT_SENT))
+ , m_sBoldUnderline(CuiResId(RID_CUISTR_BOLD_UNDER))
+ , m_sURL(CuiResId(RID_CUISTR_DETECT_URL))
+ , m_sDOI(CuiResId(RID_CUISTR_DETECT_DOI))
+ , m_sNoDblSpaces(CuiResId(RID_CUISTR_NO_DBL_SPACES))
+ , m_sDash(CuiResId(RID_CUISTR_DASH))
+ , m_sAccidentalCaps(CuiResId(RID_CUISTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
, m_xCheckLB(m_xBuilder->weld_tree_view("checklist"))
{
m_xCheckLB->enable_toggle_buttons(weld::ColumnToggleType::Check);
@@ -219,6 +223,7 @@ bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* )
pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::SetDOIAttr, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE);
@@ -259,6 +264,7 @@ void OfaAutocorrOptionsPage::Reset( const SfxItemSet* )
InsertEntry(m_sStartCap);
InsertEntry(m_sBoldUnderline);
InsertEntry(m_sURL);
+ InsertEntry(m_sDOI);
InsertEntry(m_sDash);
InsertEntry(m_sNoDblSpaces);
InsertEntry(m_sAccidentalCaps);
@@ -269,6 +275,7 @@ void OfaAutocorrOptionsPage::Reset( const SfxItemSet* )
m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) ? TRISTATE_TRUE : TRISTATE_FALSE );
m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) ? TRISTATE_TRUE : TRISTATE_FALSE );
m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetINetAttr) ? TRISTATE_TRUE : TRISTATE_FALSE );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetDOIAttr) ? TRISTATE_TRUE : TRISTATE_FALSE );
m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) ? TRISTATE_TRUE : TRISTATE_FALSE );
m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) ? TRISTATE_TRUE : TRISTATE_FALSE );
m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -329,12 +336,14 @@ enum OfaAutoFmtOptions
BEGIN_UPPER,
BOLD_UNDERLINE,
DETECT_URL,
+ DETECT_DOI,
REPLACE_DASHES,
DEL_SPACES_AT_STT_END,
DEL_SPACES_BETWEEN_LINES,
IGNORE_DBLSPACE,
CORRECT_CAPS_LOCK,
APPLY_NUMBERING,
+ APPLY_NUMBERING_AFTER_SPACE,
INSERT_BORDER,
CREATE_TABLE,
REPLACE_STYLES,
@@ -349,35 +358,38 @@ enum OfaAutoFmtOptions
OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rSet )
: SfxTabPage(pPage, pController, "cui/ui/applyautofmtpage.ui", "ApplyAutoFmtPage", &rSet)
- , sDeleteEmptyPara(CuiResId(RID_SVXSTR_DEL_EMPTY_PARA))
- , sUseReplaceTbl(CuiResId(RID_SVXSTR_USE_REPLACE))
- , sCapitalStartWord(CuiResId(RID_SVXSTR_CPTL_STT_WORD))
- , sCapitalStartSentence(CuiResId(RID_SVXSTR_CPTL_STT_SENT))
- , sUserStyle(CuiResId(RID_SVXSTR_USER_STYLE))
- , sBullet(CuiResId(RID_SVXSTR_BULLET))
- , sBoldUnder(CuiResId(RID_SVXSTR_BOLD_UNDER))
- , sNoDblSpaces(CuiResId(RID_SVXSTR_NO_DBL_SPACES))
- , sCorrectCapsLock(CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
- , sDetectURL(CuiResId(RID_SVXSTR_DETECT_URL))
- , sDash(CuiResId(RID_SVXSTR_DASH))
- , sRightMargin(CuiResId(RID_SVXSTR_RIGHT_MARGIN))
- , sNum(CuiResId(RID_SVXSTR_NUM))
- , sBorder(CuiResId(RID_SVXSTR_BORDER))
- , sTable(CuiResId(RID_SVXSTR_CREATE_TABLE))
- , sReplaceTemplates(CuiResId(RID_SVXSTR_REPLACE_TEMPLATES))
- , sDelSpaceAtSttEnd(CuiResId(RID_SVXSTR_DEL_SPACES_AT_STT_END))
- , sDelSpaceBetweenLines(CuiResId(RID_SVXSTR_DEL_SPACES_BETWEEN_LINES))
+ , sDeleteEmptyPara(CuiResId(RID_CUISTR_DEL_EMPTY_PARA))
+ , sUseReplaceTbl(CuiResId(RID_CUISTR_USE_REPLACE))
+ , sCapitalStartWord(CuiResId(RID_CUISTR_CPTL_STT_WORD))
+ , sCapitalStartSentence(CuiResId(RID_CUISTR_CPTL_STT_SENT))
+ , sUserStyle(CuiResId(RID_CUISTR_USER_STYLE))
+ , sBullet(CuiResId(RID_CUISTR_BULLET))
+ , sBoldUnder(CuiResId(RID_CUISTR_BOLD_UNDER))
+ , sNoDblSpaces(CuiResId(RID_CUISTR_NO_DBL_SPACES))
+ , sCorrectCapsLock(CuiResId(RID_CUISTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
+ , sDetectURL(CuiResId(RID_CUISTR_DETECT_URL))
+ , sDetectDOI(CuiResId(RID_CUISTR_DETECT_DOI))
+ , sDash(CuiResId(RID_CUISTR_DASH))
+ , sRightMargin(CuiResId(RID_CUISTR_RIGHT_MARGIN))
+ , sNum(CuiResId(RID_CUISTR_NUM))
+ , sBulletsAfterSpace(CuiResId(RID_SVXSTR_NUM_FORMAT_AFTER_SPACE))
+ , sBorder(CuiResId(RID_CUISTR_BORDER))
+ , sTable(CuiResId(RID_CUISTR_CREATE_TABLE))
+ , sReplaceTemplates(CuiResId(RID_CUISTR_REPLACE_TEMPLATES))
+ , sDelSpaceAtSttEnd(CuiResId(RID_CUISTR_DEL_SPACES_AT_STT_END))
+ , sDelSpaceBetweenLines(CuiResId(RID_CUISTR_DEL_SPACES_BETWEEN_LINES))
, nPercent(50)
, m_xCheckLB(m_xBuilder->weld_tree_view("list"))
, m_xEditPB(m_xBuilder->weld_button("edit"))
{
m_xCheckLB->connect_changed(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl));
m_xCheckLB->connect_row_activated(LINK(this, OfaSwAutoFmtOptionsPage, DoubleClickEditHdl));
- m_xCheckLB->enable_toggle_buttons(weld::ColumnToggleType::Check);
- std::vector<int> aWidths;
- aWidths.push_back(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(0)).Width() * 2);
- aWidths.push_back(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(1)).Width() * 2);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(0)).Width() * 2),
+ o3tl::narrowing<int>(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(1)).Width() * 2)
+ };
m_xCheckLB->set_column_fixed_widths(aWidths);
m_xEditPB->connect_clicked(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl));
@@ -396,9 +408,9 @@ void OfaSwAutoFmtOptionsPage::CreateEntry(const OUString& rTxt, sal_uInt16 nCol)
OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage()
{
- delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(REPLACE_BULLETS).toInt64());
- delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(APPLY_NUMBERING).toInt64());
- delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA).toInt64());
+ delete weld::fromId<ImpUserData*>(m_xCheckLB->get_id(REPLACE_BULLETS));
+ delete weld::fromId<ImpUserData*>(m_xCheckLB->get_id(APPLY_NUMBERING));
+ delete weld::fromId<ImpUserData*>(m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA));
}
std::unique_ptr<SfxTabPage> OfaSwAutoFmtOptionsPage::Create(weld::Container* pPage, weld::DialogController* pController,
@@ -450,6 +462,12 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* )
pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr,
m_xCheckLB->get_toggle(DETECT_URL, CBCOL_SECOND) == TRISTATE_TRUE);
+ bCheck = m_xCheckLB->get_toggle(DETECT_DOI, CBCOL_FIRST) == TRISTATE_TRUE;
+ bModified |= pOpt->bSetDOIAttr != bCheck;
+ pOpt->bSetDOIAttr = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::SetDOIAttr,
+ m_xCheckLB->get_toggle(DETECT_DOI, CBCOL_SECOND) == TRISTATE_TRUE);
+
bCheck = m_xCheckLB->get_toggle(DEL_EMPTY_NODE, CBCOL_FIRST) == TRISTATE_TRUE;
bModified |= pOpt->bDelEmptyNode != bCheck;
pOpt->bDelEmptyNode = bCheck;
@@ -481,6 +499,10 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* )
bModified |= pOpt->bSetNumRule != bCheck;
pOpt->bSetNumRule = bCheck;
+ bCheck = m_xCheckLB->get_toggle(APPLY_NUMBERING_AFTER_SPACE, CBCOL_SECOND) == TRISTATE_TRUE;
+ bModified |= pOpt->bSetNumRuleAfterSpace != bCheck;
+ pOpt->bSetNumRuleAfterSpace = bCheck;
+
bCheck = m_xCheckLB->get_toggle(INSERT_BORDER, CBCOL_SECOND) == TRISTATE_TRUE;
bModified |= pOpt->bSetBorder != bCheck;
pOpt->bSetBorder = bCheck;
@@ -553,6 +575,7 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
CreateEntry(sCapitalStartSentence, CBCOL_BOTH );
CreateEntry(sBoldUnder, CBCOL_BOTH );
CreateEntry(sDetectURL, CBCOL_BOTH );
+ CreateEntry(sDetectDOI, CBCOL_BOTH );
CreateEntry(sDash, CBCOL_BOTH );
CreateEntry(sDelSpaceAtSttEnd, CBCOL_BOTH );
CreateEntry(sDelSpaceBetweenLines, CBCOL_BOTH );
@@ -560,6 +583,7 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
CreateEntry(sNoDblSpaces, CBCOL_SECOND);
CreateEntry(sCorrectCapsLock, CBCOL_SECOND);
CreateEntry(sNum.replaceFirst("%1", sBulletChar), CBCOL_SECOND);
+ CreateEntry(sBulletsAfterSpace, CBCOL_SECOND);
CreateEntry(sBorder, CBCOL_SECOND);
CreateEntry(sTable, CBCOL_SECOND);
CreateEntry(sReplaceTemplates, CBCOL_SECOND);
@@ -578,6 +602,8 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
m_xCheckLB->set_toggle(BOLD_UNDERLINE, bool(nFlags & ACFlags::ChgWeightUnderl) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(DETECT_URL, pOpt->bSetINetAttr ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
m_xCheckLB->set_toggle(DETECT_URL, bool(nFlags & ACFlags::SetINetAttr) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
+ m_xCheckLB->set_toggle(DETECT_DOI, pOpt->bSetDOIAttr ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
+ m_xCheckLB->set_toggle(DETECT_DOI, bool(nFlags & ACFlags::SetDOIAttr) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(REPLACE_DASHES, pOpt->bChgToEnEmDash ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
m_xCheckLB->set_toggle(REPLACE_DASHES, bool(nFlags & ACFlags::ChgToEnEmDash) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(DEL_SPACES_AT_STT_END, pOpt->bAFormatDelSpacesAtSttEnd ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
@@ -587,6 +613,7 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
m_xCheckLB->set_toggle(IGNORE_DBLSPACE, bool(nFlags & ACFlags::IgnoreDoubleSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(CORRECT_CAPS_LOCK, bool(nFlags & ACFlags::CorrectCapsLock) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(APPLY_NUMBERING, pOpt->bSetNumRule ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
+ m_xCheckLB->set_toggle(APPLY_NUMBERING_AFTER_SPACE, pOpt->bSetNumRuleAfterSpace ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(INSERT_BORDER, pOpt->bSetBorder ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(CREATE_TABLE, pOpt->bCreateTable ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xCheckLB->set_toggle(REPLACE_STYLES, pOpt->bReplaceStyles ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
@@ -596,15 +623,15 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
m_xCheckLB->set_toggle(MERGE_SINGLE_LINE_PARA, pOpt->bRightMargin ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ OUString sId(weld::toId(pUserData));
m_xCheckLB->set_id(REPLACE_BULLETS, sId);
pUserData = new ImpUserData(&sMargin, nullptr);
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xCheckLB->set_id(MERGE_SINGLE_LINE_PARA, sId);
ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont);
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData2));
+ sId = weld::toId(pUserData2);
m_xCheckLB->set_id(APPLY_NUMBERING, sId);
m_xCheckLB->thaw();
@@ -627,7 +654,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, weld::Button&, void)
if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
{
SvxCharacterMap aMapDlg(GetFrameWeld(), nullptr, nullptr);
- ImpUserData* pUserData = reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos).toInt64());
+ ImpUserData* pUserData = weld::fromId<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos));
aMapDlg.SetCharFont(*pUserData->pFont);
aMapDlg.SetChar( (*pUserData->pString)[0] );
if (RET_OK == aMapDlg.run())
@@ -662,6 +689,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, weld::Button&, void)
OfaAutocorrReplacePage::OfaAutocorrReplacePage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/acorreplacepage.ui", "AcorReplacePage", &rSet)
+ , maCompareClass(comphelper::getProcessComponentContext())
, eLang(eLastDialogLanguage)
, bHasSelectionText(false)
, bFirstSelect(true)
@@ -693,9 +721,8 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage(weld::Container* pPage, weld::Dia
bSWriter = pMod == SfxModule::GetActiveModule();
LanguageTag aLanguageTag( eLastDialogLanguage );
- pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
- pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
- pCharClass.reset( new CharClass( aLanguageTag ) );
+ maCompareClass.loadDefaultCollator( aLanguageTag.getLocale(), 0 );
+ pCharClass.reset( new CharClass( std::move(aLanguageTag) ) );
auto nColWidth = m_xReplaceTLB->get_approximate_digit_width() * 32;
m_aReplaceFixedWidths.push_back(nColWidth);
@@ -717,7 +744,6 @@ OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
aDoubleStringTable.clear();
aChangesTable.clear();
- pCompareClass.reset();
pCharClass.reset();
}
@@ -765,7 +791,8 @@ bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet* )
bool bKeepSourceFormatting = newEntry.pUserData == &bHasSelectionText;
if (bKeepSourceFormatting)
{
- pAutoCorrect->PutText(newEntry.sShort, *SfxObjectShell::Current(), eCurrentLang);
+ if (SfxObjectShell* pSh = SfxObjectShell::Current())
+ pAutoCorrect->PutText(newEntry.sShort, *pSh, eCurrentLang);
continue;
}
@@ -802,11 +829,10 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
}
m_xReplaceTLB->all_foreach([this, &pArray](weld::TreeIter& rIter) {
- pArray->push_back(DoubleString());
+ pArray->push_back(DoubleString(m_xReplaceTLB->get_text(rIter, 0),
+ m_xReplaceTLB->get_text(rIter, 1)));
DoubleString& rDouble = pArray->back();
- rDouble.sShort = m_xReplaceTLB->get_text(rIter, 0);
- rDouble.sLong = m_xReplaceTLB->get_text(rIter, 1);
- rDouble.pUserData = reinterpret_cast<void*>(m_xReplaceTLB->get_id(rIter).toInt64());
+ rDouble.pUserData = weld::fromId<void*>(m_xReplaceTLB->get_id(rIter));
return false;
});
}
@@ -827,7 +853,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
if (!bTextOnly)
{
// that means: with format info or even with selection text
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(rDouble.pUserData));
+ OUString sId = weld::toId(rDouble.pUserData);
m_xReplaceTLB->set_id(rIter, sId);
}
m_xReplaceTLB->set_text(rIter, rDouble.sShort, 0);
@@ -837,7 +863,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
{
aFormatText.insert(rDouble.sShort);
}
- }, &m_aReplaceFixedWidths);
+ }, nullptr, &m_aReplaceFixedWidths);
}
else
{
@@ -853,7 +879,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
if (!bTextOnly)
{
// that means: with format info or even with selection text
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(m_xTextOnlyCB.get()));
+ OUString sId = weld::toId(m_xTextOnlyCB.get());
m_xReplaceTLB->set_id(rIter, sId);
}
m_xReplaceTLB->set_text(rIter, elem.GetShort(), 0);
@@ -863,7 +889,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
{
aFormatText.insert(elem.GetShort());
}
- }, &m_aReplaceFixedWidths);
+ }, nullptr, &m_aReplaceFixedWidths);
m_xNewReplacePB->set_sensitive(false);
m_xDeleteReplacePB->set_sensitive(false);
}
@@ -899,9 +925,9 @@ void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet)
eLastDialogLanguage = eSet;
LanguageTag aLanguageTag( eLastDialogLanguage );
- pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
- pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
- pCharClass.reset( new CharClass( aLanguageTag ) );
+ maCompareClass = CollatorWrapper( comphelper::getProcessComponentContext() );
+ maCompareClass.loadDefaultCollator( aLanguageTag.getLocale(), 0 );
+ pCharClass.reset( new CharClass( std::move(aLanguageTag) ) );
ModifyHdl(*m_xShortED);
}
}
@@ -914,7 +940,7 @@ IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, weld::TreeView&, rBox, void)
OUString sTmpShort(rBox.get_text(nEntry, 0));
// if the text is set via ModifyHdl, the cursor is always at the beginning
// of a word, although you're editing here
- bool bSameContent = 0 == pCompareClass->compareString(sTmpShort, m_xShortED->get_text());
+ bool bSameContent = 0 == maCompareClass.compareString(sTmpShort, m_xShortED->get_text());
int nStartPos, nEndPos;
m_xShortED->get_selection_bounds(nStartPos, nEndPos);
if (m_xShortED->get_text() != sTmpShort)
@@ -961,9 +987,7 @@ void OfaAutocorrReplacePage::NewEntry(const OUString& sShort, const OUString& sL
}
}
- DoubleString aNewString;
- aNewString.sShort = sShort;
- aNewString.sLong = sLong;
+ DoubleString aNewString(sShort, sLong);
rNewArray.push_back(aNewString);
if (bKeepSourceFormatting)
rNewArray.back().pUserData = &bHasSelectionText;
@@ -991,9 +1015,7 @@ void OfaAutocorrReplacePage::DeleteEntry(const OUString& sShort, const OUString&
}
}
- DoubleString aDeletedString;
- aDeletedString.sShort = sShort;
- aDeletedString.sLong = sLong;
+ DoubleString aDeletedString(sShort, sLong);
rDeletedArray.push_back(aDeletedString);
}
@@ -1056,7 +1078,7 @@ bool OfaAutocorrReplacePage::NewDelHdl(const weld::Widget* pBtn)
int nCount = m_xReplaceTLB->n_children();
for (j = 0; j < nCount; ++j)
{
- if (0 >= pCompareClass->compareString(sEntry, m_xReplaceTLB->get_text(j, 0)))
+ if (0 >= maCompareClass.compareString(sEntry, m_xReplaceTLB->get_text(j, 0)))
break;
}
nPos = j;
@@ -1065,7 +1087,7 @@ bool OfaAutocorrReplacePage::NewDelHdl(const weld::Widget* pBtn)
OUString sId;
if (bKeepSourceFormatting)
{
- sId = OUString::number(reinterpret_cast<sal_Int64>(&bHasSelectionText)); // new formatted text
+ sId = weld::toId(&bHasSelectionText); // new formatted text
}
m_xReplaceTLB->insert(nPos, sEntry, &sId, nullptr, nullptr);
@@ -1109,7 +1131,7 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, weld::Entry&, rEdt, void)
&bTmpSelEntry, &bFirstSelIterSet,
&xFirstSel, &aWordStr](weld::TreeIter& rIter){
OUString aTestStr = m_xReplaceTLB->get_text(rIter, 0);
- if( pCompareClass->compareString(rEntry, aTestStr ) == 0 )
+ if( maCompareClass.compareString(rEntry, aTestStr ) == 0 )
{
if (!rRepString.isEmpty())
bFirstSelect = true;
@@ -1190,6 +1212,7 @@ static bool lcl_FindInArray(std::vector<OUString>& rStrings, std::u16string_view
OfaAutocorrExceptPage::OfaAutocorrExceptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/acorexceptpage.ui", "AcorExceptPage", &rSet)
+ , maCompareClass(comphelper::getProcessComponentContext())
, eLang(eLastDialogLanguage)
, m_xAbbrevED(m_xBuilder->weld_entry("abbrev"))
, m_xAbbrevLB(m_xBuilder->weld_tree_view("abbrevlist"))
@@ -1209,8 +1232,7 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage(weld::Container* pPage, weld::Dialo
m_xDoubleCapsLB->set_size_request(-1, m_xDoubleCapsLB->get_height_rows(6));
css::lang::Locale aLcl( LanguageTag::convertToLocale(eLastDialogLanguage ));
- pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
- pCompareClass->loadDefaultCollator( aLcl, 0 );
+ maCompareClass.loadDefaultCollator( aLcl, 0 );
m_xNewAbbrevPB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
m_xDelAbbrevPB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl));
@@ -1229,7 +1251,6 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage(weld::Container* pPage, weld::Dialo
OfaAutocorrExceptPage::~OfaAutocorrExceptPage()
{
aStringsTable.clear();
- pCompareClass.reset();
}
std::unique_ptr<SfxTabPage> OfaAutocorrExceptPage::Create(weld::Container* pPage, weld::DialogController* pController,
@@ -1259,7 +1280,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
StringsArrays& rArrays = it1->second;
if(eCurLang != eLang) // current language is treated later
{
- SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang);
+ SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWordStartExceptList(eCurLang);
if(pWrdList)
{
@@ -1279,7 +1300,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
{
pWrdList->insert(elem);
}
- pAutoCorrect->SaveWrdSttExceptList(eCurLang);
+ pAutoCorrect->SaveWordStartExceptList(eCurLang);
}
SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang);
@@ -1308,7 +1329,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
}
aStringsTable.clear();
- SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang);
+ SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWordStartExceptList(eLang);
if(pWrdList)
{
@@ -1327,7 +1348,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
{
pWrdList->insert(m_xDoubleCapsLB->get_text(i));
}
- pAutoCorrect->SaveWrdSttExceptList(eLang);
+ pAutoCorrect->SaveWordStartExceptList(eLang);
}
SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang);
@@ -1353,7 +1374,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
if (m_xAutoAbbrevCB->get_state_changed_from_saved())
pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordCplSttLst, m_xAutoAbbrevCB->get_active());
if (m_xAutoCapsCB->get_state_changed_from_saved())
- pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordWrdSttLst, m_xAutoCapsCB->get_active());
+ pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordWordStartLst, m_xAutoCapsCB->get_active());
return false;
}
@@ -1364,8 +1385,8 @@ void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet)
// save old settings and fill anew
RefillReplaceBoxes(false, eLang, eSet);
eLastDialogLanguage = eSet;
- pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) );
- pCompareClass->loadDefaultCollator( LanguageTag::convertToLocale( eLastDialogLanguage ), 0 );
+ maCompareClass = CollatorWrapper( comphelper::getProcessComponentContext() );
+ maCompareClass.loadDefaultCollator( LanguageTag::convertToLocale( eLastDialogLanguage ), 0 );
ModifyHdl(*m_xAbbrevED);
ModifyHdl(*m_xDoubleCapsED);
}
@@ -1421,7 +1442,7 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(bool bFromReset,
{
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang);
- const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang);
+ const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWordStartExceptList(eLang);
size_t i;
for( i = 0; i < pCplList->size(); i++ )
{
@@ -1439,7 +1460,7 @@ void OfaAutocorrExceptPage::Reset( const SfxItemSet* )
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
RefillReplaceBoxes(true, eLang, eLang);
m_xAutoAbbrevCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordCplSttLst));
- m_xAutoCapsCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordWrdSttLst));
+ m_xAutoCapsCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordWordStartLst));
m_xAutoAbbrevCB->save_state();
m_xAutoCapsCB->save_state();
}
@@ -1510,7 +1531,7 @@ IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, weld::Entry&, rEdt, void)
bool bEntryLen = !sEntry.isEmpty();
if (&rEdt == m_xAbbrevED.get())
{
- bool bSame = lcl_FindEntry(*m_xAbbrevLB, sEntry, *pCompareClass);
+ bool bSame = lcl_FindEntry(*m_xAbbrevLB, sEntry, maCompareClass);
if(bSame && sEntry != m_xAbbrevLB->get_selected_text())
rEdt.set_text(m_xAbbrevLB->get_selected_text());
m_xNewAbbrevPB->set_sensitive(!bSame && bEntryLen);
@@ -1518,7 +1539,7 @@ IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, weld::Entry&, rEdt, void)
}
else
{
- bool bSame = lcl_FindEntry(*m_xDoubleCapsLB, sEntry, *pCompareClass);
+ bool bSame = lcl_FindEntry(*m_xDoubleCapsLB, sEntry, maCompareClass);
if(bSame && sEntry != m_xDoubleCapsLB->get_selected_text())
rEdt.set_text(m_xDoubleCapsLB->get_selected_text());
m_xNewDoublePB->set_sensitive(!bSame && bEntryLen);
@@ -1551,10 +1572,10 @@ void OfaQuoteTabPage::CreateEntry(weld::TreeView& rCheckLB, const OUString& rTxt
OfaQuoteTabPage::OfaQuoteTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/applylocalizedpage.ui", "ApplyLocalizedPage", &rSet)
- , sNonBrkSpace(CuiResId(RID_SVXSTR_NON_BREAK_SPACE))
- , sOrdinal(CuiResId(RID_SVXSTR_ORDINAL))
- , sTransliterateRTL(CuiResId(RID_SVXSTR_OLD_HUNGARIAN))
- , sAngleQuotes(CuiResId(RID_SVXSTR_ANGLE_QUOTES))
+ , sNonBrkSpace(CuiResId(RID_CUISTR_NON_BREAK_SPACE))
+ , sOrdinal(CuiResId(RID_CUISTR_ORDINAL))
+ , sTransliterateRTL(CuiResId(RID_CUISTR_OLD_HUNGARIAN))
+ , sAngleQuotes(CuiResId(RID_CUISTR_ANGLE_QUOTES))
, cSglStartQuote(0)
, cSglEndQuote(0)
, cStartQuote(0)
@@ -1586,10 +1607,11 @@ OfaQuoteTabPage::OfaQuoteTabPage(weld::Container* pPage, weld::DialogController*
if ( bShowSWOptions )
{
- m_xSwCheckLB->enable_toggle_buttons(weld::ColumnToggleType::Check);
- std::vector<int> aWidths;
- aWidths.push_back(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(0)).Width() * 2);
- aWidths.push_back(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(1)).Width() * 2);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(0)).Width() * 2),
+ o3tl::narrowing<int>(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(1)).Width() * 2)
+ };
m_xSwCheckLB->set_column_fixed_widths(aWidths);
m_xCheckLB->hide();
}
@@ -1793,7 +1815,7 @@ IMPL_LINK(OfaQuoteTabPage, QuoteHdl, weld::Button&, rBtn, void)
SvxCharacterMap aMap(GetFrameWeld(), nullptr, nullptr);
aMap.SetCharFont( OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT,
LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne ));
- aMap.set_title(nMode < SGL_END ? CuiResId(RID_SVXSTR_STARTQUOTE) : CuiResId(RID_SVXSTR_ENDQUOTE));
+ aMap.set_title(nMode < SGL_END ? CuiResId(RID_CUISTR_STARTQUOTE) : CuiResId(RID_CUISTR_ENDQUOTE));
sal_UCS4 cDlg;
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
@@ -1919,12 +1941,13 @@ OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(weld::Container* pPage, weld::Dia
int nMaxWidth = m_xCBRemoveList->get_approximate_digit_width() * 40;
if (aPrefSize.Width() > nMaxWidth)
{
- m_xCBRemoveList->set_label_line_wrap(true);
+ m_xCBRemoveList->set_label_wrap(true);
m_xCBRemoveList->set_size_request(nMaxWidth, -1);
}
m_xLBEntries->set_size_request(m_xLBEntries->get_approximate_digit_width() * 30,
m_xLBEntries->get_height_rows(10));
+ m_xLBEntries->set_selection_mode(SelectionMode::Multiple);
// the defined KEYs
static const sal_uInt16 aKeyCodes[] = {
@@ -1965,7 +1988,6 @@ bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
bool bModified = false, bCheck;
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
- sal_uInt16 nVal;
bCheck = m_xCBActiv->get_active();
bModified |= pOpt->bAutoCompleteWords != bCheck;
@@ -1983,13 +2005,13 @@ bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
bModified |= pOpt->bAutoCmpltShowAsTip != bCheck;
pOpt->bAutoCmpltShowAsTip = bCheck;
- nVal = static_cast<sal_uInt16>(m_xNFMinWordlen->get_value());
+ sal_uInt16 nVal = static_cast<sal_uInt16>(m_xNFMinWordlen->get_value());
bModified |= nVal != pOpt->nAutoCmpltWordLen;
pOpt->nAutoCmpltWordLen = nVal;
- nVal = static_cast<sal_uInt16>(m_xNFMaxEntries->get_value());
- bModified |= nVal != pOpt->nAutoCmpltListLen;
- pOpt->nAutoCmpltListLen = nVal;
+ sal_uInt32 nList = static_cast<sal_uInt32>(m_xNFMaxEntries->get_value());
+ bModified |= nList != pOpt->nAutoCmpltListLen;
+ pOpt->nAutoCmpltListLen = nList;
const int nPos = m_xDCBExpandKey->get_active();
if (nPos != -1)
@@ -2050,7 +2072,7 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet* )
{
const OUString* pStr =
&(*m_pAutoCompleteList)[n]->GetAutoCompleteString();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pStr)));
+ OUString sId(weld::toId(pStr));
m_xLBEntries->append(sId, *pStr);
}
}
@@ -2076,7 +2098,7 @@ IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl, weld::Button&, void)
while (!rows.empty())
{
sal_Int32 nPos = rows.back();
- OUString* pStr = reinterpret_cast<OUString*>(m_xLBEntries->get_id(nPos).toInt64());
+ OUString* pStr = weld::fromId<OUString*>(m_xLBEntries->get_id(nPos));
m_xLBEntries->remove(nPos);
editeng::IAutoCompleteString hack(*pStr); // UGLY
m_pAutoCompleteList->erase(&hack);
@@ -2084,7 +2106,7 @@ IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl, weld::Button&, void)
}
}
-IMPL_LINK(OfaAutoCompleteTabPage, CheckHdl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(OfaAutoCompleteTabPage, CheckHdl, weld::Toggleable&, rBox, void)
{
bool bEnable = rBox.get_active();
if (&rBox == m_xCBActiv.get())
@@ -2112,15 +2134,10 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const
for (auto a : rows)
{
- sData.append(OUStringToOString(m_xLBEntries->get_text(a), nEncode));
-#if defined(_WIN32)
- sData.append("\015\012");
-#else
- sData.append("\012");
-#endif
+ sData.append(OUStringToOString(m_xLBEntries->get_text(a), nEncode) + SAL_NEWLINE_STRING);
}
pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() );
- pCntnr->CopyToClipboard(GetSystemClipboard());
+ pCntnr->CopyToClipboard(m_xLBEntries->get_clipboard());
}
IMPL_LINK(OfaAutoCompleteTabPage, KeyReleaseHdl, const KeyEvent&, rEvent, bool)
@@ -2183,11 +2200,11 @@ struct ImplSmartTagLBUserData
uno::Reference< smarttags::XSmartTagRecognizer > mxRec;
sal_Int32 mnSmartTagIdx;
- ImplSmartTagLBUserData( const OUString& rSmartTagType,
- uno::Reference< smarttags::XSmartTagRecognizer > const & xRec,
+ ImplSmartTagLBUserData( OUString aSmartTagType,
+ uno::Reference< smarttags::XSmartTagRecognizer > xRec,
sal_Int32 nSmartTagIdx ) :
- maSmartTagType( rSmartTagType ),
- mxRec( xRec ),
+ maSmartTagType(std::move( aSmartTagType )),
+ mxRec(std::move( xRec )),
mnSmartTagIdx( nSmartTagIdx ) {}
};
@@ -2200,7 +2217,7 @@ void OfaSmartTagOptionsTabPage::ClearListBox()
const int nCount = m_xSmartTagTypesLB->n_children();
for (int i = 0; i < nCount; ++i)
{
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i));
delete pUserData;
}
@@ -2240,7 +2257,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType );
m_xSmartTagTypesLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xSmartTagTypesLB->set_text(nRow, aLBEntry, 0);
- m_xSmartTagTypesLB->set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(new ImplSmartTagLBUserData(aSmartTagType, xRec, j))));
+ m_xSmartTagTypesLB->set_id(nRow, weld::toId(new ImplSmartTagLBUserData(aSmartTagType, xRec, j)));
}
}
}
@@ -2250,7 +2267,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, ClickHdl, weld::Button&, void)
{
const int nPos = m_xSmartTagTypesLB->get_selected_index();
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos));
uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
@@ -2261,7 +2278,7 @@ IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, ClickHdl, weld::Button&, void)
/** Handler for the check box
*/
-IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, CheckHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, CheckHdl, weld::Toggleable&, void)
{
const bool bEnable = m_xMainCB->get_active();
m_xSmartTagTypesLB->set_sensitive(bEnable);
@@ -2282,7 +2299,7 @@ IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, SelectHdl, weld::TreeView&, void)
const int nPos = m_xSmartTagTypesLB->get_selected_index();
if (nPos == -1)
return;
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos));
uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
@@ -2312,7 +2329,7 @@ bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet* )
for (int i = 0; i < nCount; ++i)
{
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i));
const bool bChecked = m_xSmartTagTypesLB->get_toggle(i) == TRISTATE_TRUE;
const bool bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType );
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 38190271d778..b10c6f79c304 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -36,12 +36,10 @@ using namespace css;
#define TBL_DEST_ROW 1
#define TBL_DEST_TBL 2
-const sal_uInt16 SvxBkgTabPage::pPageRanges[] =
-{
+const WhichRangesContainer SvxBkgTabPage::pBkgRanges(svl::Items<
SID_ATTR_BRUSH, SID_ATTR_BRUSH,
- SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR,
- 0
-};
+ SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR
+>);
static sal_uInt16 lcl_GetTableDestSlot(sal_Int32 nTblDest)
{
@@ -65,32 +63,13 @@ static sal_uInt16 lcl_GetTableDestSlot(sal_Int32 nTblDest)
SvxBkgTabPage::SvxBkgTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
: SvxAreaTabPage(pPage, pController, rInAttrs),
- bHighlighting(false),
- bCharBackColor(false),
- maSet(rInAttrs)
+ m_aAttrSet(*rInAttrs.GetPool(),
+ rInAttrs.GetRanges().MergeRange(XATTR_FILL_FIRST, XATTR_FILL_LAST))
{
m_xBtnGradient->hide();
m_xBtnHatch->hide();
m_xBtnBitmap->hide();
m_xBtnPattern->hide();
-
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
-
- XColorListRef pColorTable;
- if ( pDocSh )
- if (auto pItem = pDocSh->GetItem( SID_COLOR_TABLE ))
- pColorTable = pItem->GetColorList();
-
- if ( !pColorTable.is() )
- pColorTable = XColorList::CreateStdColorList();
-
- XBitmapListRef pBitmapList;
- if ( pDocSh )
- if (auto pItem = pDocSh->GetItem( SID_BITMAP_LIST ) )
- pBitmapList = pItem->GetBitmapList();
-
- SetColorList(pColorTable);
- SetBitmapList(pBitmapList);
}
SvxBkgTabPage::~SvxBkgTabPage()
@@ -100,12 +79,12 @@ SvxBkgTabPage::~SvxBkgTabPage()
void SvxBkgTabPage::ActivatePage( const SfxItemSet& )
{
- SvxAreaTabPage::ActivatePage( maSet );
+ SvxAreaTabPage::ActivatePage(m_aAttrSet);
}
DeactivateRC SvxBkgTabPage::DeactivatePage( SfxItemSet* _pSet )
{
- if ( DeactivateRC::KeepPage == SvxAreaTabPage::DeactivatePage( &maSet ) )
+ if (DeactivateRC::KeepPage == SvxAreaTabPage::DeactivatePage(&m_aAttrSet))
return DeactivateRC::KeepPage;
if ( _pSet )
@@ -114,37 +93,49 @@ DeactivateRC SvxBkgTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-void SvxBkgTabPage::Reset( const SfxItemSet* )
+void SvxBkgTabPage::Reset(const SfxItemSet* pItemSet)
{
- maSet.Set( *m_pResetSet );
- if ( m_xTblLBox && m_xTblLBox->get_visible() )
+ if (m_xTblLBox && m_xTblLBox->get_visible())
{
- m_nActPos = -1;
- const SfxPoolItem* pItem;
- if ( SfxItemState::SET == m_pResetSet->GetItemState( SID_BACKGRND_DESTINATION, false, &pItem ) )
+ if (m_nActPos == -1) // initial reset
{
- sal_uInt16 nDestValue = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- m_xTblLBox->set_active( nDestValue );
- TblDestinationHdl_Impl( *m_xTblLBox );
+ m_nActPos = 0;
+ if (const SfxUInt16Item* pDestItem = pItemSet->GetItemIfSet(SID_BACKGRND_DESTINATION, false))
+ m_nActPos = pDestItem->GetValue();
+ m_xTblLBox->set_active(m_nActPos);
}
- m_xTblLBox->save_value();
+ SetActiveTableDestinationBrushItem();
+ return;
+ }
+ else if (m_bCharBackColor)
+ {
+ sal_uInt16 nWhich(pItemSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_CHAR_BACK_COLOR));
+ Color aBackColor(static_cast<const SvxColorItem&>(pItemSet->Get(nWhich)).GetValue());
+ SvxBrushItem aBrushItem(SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR));
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, m_aAttrSet);
}
- SvxAreaTabPage::Reset( &maSet );
+ else
+ {
+ sal_uInt16 nWhich(pItemSet->GetPool()->GetWhichIDFromSlotID(m_bHighlighting ? SID_ATTR_BRUSH_CHAR : SID_ATTR_BRUSH));
+ SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(pItemSet->Get(nWhich)));
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, m_aAttrSet);
+ }
+ SvxAreaTabPage::Reset(&m_aAttrSet);
}
-bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet )
+bool SvxBkgTabPage::FillItemSet(SfxItemSet* pCoreSet)
{
sal_uInt16 nSlot = SID_ATTR_BRUSH;
if (m_xTblLBox && m_xTblLBox->get_visible())
nSlot = lcl_GetTableDestSlot(m_xTblLBox->get_active());
- else if ( bHighlighting )
+ else if (m_bHighlighting)
nSlot = SID_ATTR_BRUSH_CHAR;
- else if( bCharBackColor )
+ else if (m_bCharBackColor)
nSlot = SID_ATTR_CHAR_BACK_COLOR;
sal_uInt16 nWhich = GetWhich(nSlot);
- drawing::FillStyle eFillType = maSet.Get( XATTR_FILLSTYLE ).GetValue();
+ drawing::FillStyle eFillType = m_aAttrSet.Get(XATTR_FILLSTYLE).GetValue();
switch( eFillType )
{
case drawing::FillStyle_NONE:
@@ -153,76 +144,77 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet )
{
if ( SID_ATTR_CHAR_BACK_COLOR == nSlot )
{
- maSet.Put( SvxBackgroundColorItem( COL_TRANSPARENT, nWhich ) );
- rCoreSet->Put( SvxBackgroundColorItem( COL_TRANSPARENT, nWhich ) );
+ pCoreSet->Put(SvxColorItem(COL_TRANSPARENT, nWhich));
}
else
{
- maSet.Put( SvxBrushItem( COL_TRANSPARENT, nWhich ) );
- rCoreSet->Put( SvxBrushItem( COL_TRANSPARENT, nWhich ) );
+ pCoreSet->Put(SvxBrushItem(COL_TRANSPARENT, nWhich));
}
}
break;
}
case drawing::FillStyle_SOLID:
{
- XFillColorItem aColorItem( maSet.Get( XATTR_FILLCOLOR ) );
+ XFillColorItem aColorItem(m_aAttrSet.Get(XATTR_FILLCOLOR));
+
+ // tdf#157801 - don't change direct formatting when color is unchanged
+ if (const SfxPoolItem* pOldItem = GetOldItem(*pCoreSet, nSlot))
+ {
+ const SvxBrushItem* pOldBrushItem = static_cast<const SvxBrushItem*>(pOldItem);
+ if (pOldBrushItem->GetColor() == aColorItem.GetColorValue())
+ break;
+ }
+
if ( SID_ATTR_CHAR_BACK_COLOR == nSlot )
{
- maSet.Put( SvxBackgroundColorItem( aColorItem.GetColorValue(), nWhich ) );
- rCoreSet->Put( SvxBackgroundColorItem( aColorItem.GetColorValue(), nWhich ) );
+ pCoreSet->Put(SvxColorItem(aColorItem.GetColorValue(), aColorItem.getComplexColor(), nWhich));
}
else
{
- maSet.Put( SvxBrushItem( aColorItem.GetColorValue(), nWhich ) );
- rCoreSet->Put( SvxBrushItem( aColorItem.GetColorValue(), nWhich ) );
+ pCoreSet->Put(SvxBrushItem(aColorItem.GetColorValue(), aColorItem.getComplexColor(), nWhich));
}
break;
}
case drawing::FillStyle_BITMAP:
{
- std::unique_ptr<SvxBrushItem> aBrushItem( getSvxBrushItemFromSourceSet( maSet, nWhich ) );
+ std::unique_ptr<SvxBrushItem> aBrushItem(getSvxBrushItemFromSourceSet(m_aAttrSet, nWhich));
if ( GraphicType::NONE != aBrushItem->GetGraphicObject()->GetType() )
- rCoreSet->Put( *aBrushItem );
+ pCoreSet->Put(std::move(aBrushItem));
break;
}
default:
break;
}
- if (m_xTblLBox && m_xTblLBox->get_visible())
+ if (!m_xTblLBox || !m_xTblLBox->get_visible())
+ return true;
+
+ pCoreSet->Put(SfxUInt16Item(SID_BACKGRND_DESTINATION, m_xTblLBox->get_active()));
+
+ // *Put* in the core set all table brushes that are *SET* in the m_aAttrSet
+ if (nSlot != SID_ATTR_BRUSH)
{
- if (nSlot != SID_ATTR_BRUSH)
- {
- nWhich = maSet.GetPool()->GetWhich(SID_ATTR_BRUSH);
- if (SfxItemState::SET == maSet.GetItemState(nWhich))
- {
- SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(maSet.Get(nWhich)));
- rCoreSet->Put(aBrushItem);
- }
- }
- if (nSlot != SID_ATTR_BRUSH_ROW)
+ nWhich = m_aAttrSet.GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH);
+ if (SfxItemState::SET == m_aAttrSet.GetItemState(nWhich))
{
- nWhich = maSet.GetPool()->GetWhich(SID_ATTR_BRUSH_ROW);
- if (SfxItemState::SET == maSet.GetItemState(nWhich))
- {
- SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(maSet.Get(nWhich)));
- rCoreSet->Put(aBrushItem);
- }
+ SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(m_aAttrSet.Get(nWhich)));
+ pCoreSet->Put(aBrushItem);
}
- if (nSlot != SID_ATTR_BRUSH_TABLE)
+ }
+ if (nSlot != SID_ATTR_BRUSH_ROW)
+ {
+ if (SfxItemState::SET == m_aAttrSet.GetItemState(SID_ATTR_BRUSH_ROW))
{
- nWhich = maSet.GetPool()->GetWhich(SID_ATTR_BRUSH_TABLE);
- if (SfxItemState::SET == maSet.GetItemState(nWhich))
- {
- SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(maSet.Get(nWhich)));
- rCoreSet->Put(aBrushItem);
- }
+ SvxBrushItem aBrushItem(m_aAttrSet.Get(SID_ATTR_BRUSH_ROW));
+ pCoreSet->Put(aBrushItem);
}
-
- if (m_xTblLBox->get_value_changed_from_saved())
+ }
+ if (nSlot != SID_ATTR_BRUSH_TABLE)
+ {
+ if (SfxItemState::SET == m_aAttrSet.GetItemState(SID_ATTR_BRUSH_TABLE))
{
- rCoreSet->Put(SfxUInt16Item(SID_BACKGRND_DESTINATION, m_xTblLBox->get_active()));
+ SvxBrushItem aBrushItem(m_aAttrSet.Get(SID_ATTR_BRUSH_TABLE));
+ pCoreSet->Put(aBrushItem);
}
}
@@ -252,89 +244,90 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet)
if ((nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING) ||
(nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR))
{
- bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING);
- bCharBackColor = bool(nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR);
+ m_bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING);
+ m_bCharBackColor = bool(nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR);
}
if (nFlags & SvxBackgroundTabFlags::SHOW_SELECTOR)
m_xBtnBitmap->show();
SetOptimalSize(GetDialogController());
}
- if ( bCharBackColor )
+ SfxObjectShell* pObjSh = SfxObjectShell::Current();
+
+ // we always have the color page
+ XColorListRef xColorTable;
+ if (pObjSh)
{
- sal_uInt16 nWhich(maSet.GetPool()->GetWhich(SID_ATTR_CHAR_BACK_COLOR));
- Color aBackColor(static_cast<const SvxBackgroundColorItem&>(maSet.Get(nWhich)).GetValue());
- SvxBrushItem aBrushItem(SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR));
- setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, maSet);
+ const SvxColorListItem* pItem = pObjSh->GetItem(SID_COLOR_TABLE);
+ if (pItem)
+ xColorTable = pItem->GetColorList();
}
- else
+ if (!xColorTable.is())
+ xColorTable = XColorList::CreateStdColorList();
+ SetColorList(xColorTable);
+
+ // sometimes we have the bitmap page
+ if (m_xBtnBitmap->get_visible())
{
- sal_uInt16 nWhich(maSet.GetPool()->GetWhich(bHighlighting ? SID_ATTR_BRUSH_CHAR : SID_ATTR_BRUSH));
- SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(maSet.Get(nWhich)));
- setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, maSet);
+ XBitmapListRef xBitmapList;
+ if (pObjSh)
+ if (const SvxBitmapListItem* pItem = pObjSh->GetItem(SID_BITMAP_LIST))
+ xBitmapList = pItem->GetBitmapList();
+ SetBitmapList(xBitmapList);
}
-
- m_pResetSet = maSet.Clone();
-
- SvxAreaTabPage::PageCreated(aSet);
}
IMPL_LINK(SvxBkgTabPage, TblDestinationHdl_Impl, weld::ComboBox&, rBox, void)
{
- if (m_nActPos > -1)
- {
- // fill local item set with XATTR_FILL settings gathered from tab page
- // and convert to SvxBrushItem and store in table destination slot Which
- SvxAreaTabPage::FillItemSet(&maSet);
- maSet.Put(*getSvxBrushItemFromSourceSet(maSet, maSet.GetPool()->GetWhich(lcl_GetTableDestSlot(m_nActPos))));
- }
-
sal_Int32 nSelPos = rBox.get_active();
+
if (m_nActPos == nSelPos)
return;
+ // Fill the local item set with XATTR_FILL settings gathered from the tab page, convert to
+ // SvxBrushItem and store in table destination slot Which. Do this so cell, row, and table
+ // brush items can be set together.
+ SvxAreaTabPage::FillItemSet(&m_aAttrSet);
+ m_aAttrSet.Put(getSvxBrushItemFromSourceSet(m_aAttrSet, GetWhich(lcl_GetTableDestSlot(m_nActPos))));
+
m_nActPos = nSelPos;
- // fill local item set with XATTR_FILL created from SvxBushItem for table destination slot Which
- sal_uInt16 nWhich = maSet.GetPool()->GetWhich(lcl_GetTableDestSlot(nSelPos));
- if (SfxItemState::SET == maSet.GetItemState(nWhich))
+ SetActiveTableDestinationBrushItem();
+}
+
+void SvxBkgTabPage::SetActiveTableDestinationBrushItem()
+{
+ // set the table destination (cell, row, table) brush item as a fill item in the local item set
+ sal_uInt16 nWhich = GetWhich(lcl_GetTableDestSlot(m_nActPos));
+ if (SfxItemState::SET == GetItemSet().GetItemState(nWhich))
{
- SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(maSet.Get(nWhich)));
- setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, maSet);
+ SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(GetItemSet().Get(nWhich)));
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, m_aAttrSet);
}
else
{
- SelectFillType(*m_xBtnNone, &maSet);
+ SelectFillType(*m_xBtnNone, &m_aAttrSet);
return;
}
- // show tab page
- drawing::FillStyle eXFS = drawing::FillStyle_NONE;
- if (maSet.GetItemState(XATTR_FILLSTYLE) != SfxItemState::DONTCARE)
- {
- XFillStyleItem aFillStyleItem(static_cast<const XFillStyleItem&>(maSet.Get(GetWhich( XATTR_FILLSTYLE))));
- eXFS = aFillStyleItem.GetValue();
- }
+ XFillStyleItem aFillStyleItem(m_aAttrSet.Get(m_aAttrSet.GetPool()->GetWhichIDFromSlotID(XATTR_FILLSTYLE)));
+ drawing::FillStyle eXFS = aFillStyleItem.GetValue();
switch(eXFS)
{
default:
case drawing::FillStyle_NONE:
{
- SelectFillType(*m_xBtnNone, &maSet);
+ SelectFillType(*m_xBtnNone, &m_aAttrSet);
break;
}
case drawing::FillStyle_SOLID:
{
- SelectFillType(*m_xBtnColor, &maSet);
- // color tab page Active and New preview controls are same after SelectFillType
- // hack to restore color tab page Active preview
- setSvxBrushItemAsFillAttributesToTargetSet(static_cast<const SvxBrushItem&>(m_pResetSet->Get(nWhich)), *m_pResetSet);
- static_cast<SvxColorTabPage*>(GetFillTabPage())->SetCtlPreviewOld(*m_pResetSet);
+ SelectFillType(*m_xBtnColor, &m_aAttrSet);
break;
}
case drawing::FillStyle_BITMAP:
{
- SelectFillType(*m_xBtnBitmap, &maSet);
+ SelectFillType(*m_xBtnBitmap, &m_aAttrSet);
break;
}
}
diff --git a/cui/source/tabpages/bbdlg.cxx b/cui/source/tabpages/bbdlg.cxx
index d21d046da82c..9fc59604476e 100644
--- a/cui/source/tabpages/bbdlg.cxx
+++ b/cui/source/tabpages/bbdlg.cxx
@@ -33,8 +33,8 @@ SvxBorderBackgroundDlg::SvxBorderBackgroundDlg(weld::Window *pParent,
? OUString("cui/ui/borderareatransparencydialog.ui")
: OUString("cui/ui/borderbackgrounddialog.ui"),
bEnableDrawingLayerFillStyles
- ? OString("BorderAreaTransparencyDialog")
- : OString("BorderBackgroundDialog"),
+ ? OUString("BorderAreaTransparencyDialog")
+ : OUString("BorderBackgroundDialog"),
&rCoreSet)
, mbEnableBackgroundSelector(bEnableSelector)
{
@@ -51,7 +51,7 @@ SvxBorderBackgroundDlg::SvxBorderBackgroundDlg(weld::Window *pParent,
}
}
-void SvxBorderBackgroundDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
+void SvxBorderBackgroundDlg::PageCreated(const OUString& rPageId, SfxTabPage& rTabPage)
{
if (rPageId == "background")
{
@@ -69,10 +69,9 @@ void SvxBorderBackgroundDlg::PageCreated(const OString& rPageId, SfxTabPage& rTa
// demand, but could also be directly added from the DrawModel.
else if (rPageId == "area")
{
- SfxItemSet aNew(
- *GetInputSetImpl()->GetPool(),
- svl::Items<SID_COLOR_TABLE, SID_PATTERN_LIST,
- SID_OFFER_IMPORT, SID_OFFER_IMPORT>{});
+ SfxItemSetFixed<SID_COLOR_TABLE, SID_PATTERN_LIST,
+ SID_OFFER_IMPORT, SID_OFFER_IMPORT>
+ aNew(*GetInputSetImpl()->GetPool());
aNew.Put(*GetInputSetImpl());
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index cb7429928d44..ccb94fe46854 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -19,8 +19,6 @@
#include <sal/config.h>
-#include <string_view>
-
#include <sfx2/objsh.hxx>
#include <svx/strings.hrc>
#include <svx/svxids.hrc>
@@ -37,6 +35,7 @@
#include <vcl/fieldvalues.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
+#include <svx/dialmgr.hxx>
#include <svx/flagsdef.hxx>
#include <svl/grabbagitem.hxx>
#include <svl/intitem.hxx>
@@ -69,15 +68,28 @@ using ::com::sun::star::uno::UNO_QUERY;
// static ----------------------------------------------------------------
-const sal_uInt16 SvxBorderTabPage::pRanges[] =
+const WhichRangesContainer SvxBorderTabPage::pRanges(
+ svl::Items<
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_ALIGN_MARGIN, SID_ATTR_ALIGN_MARGIN,
+ SID_ATTR_BORDER_CONNECT, SID_ATTR_BORDER_CONNECT,
+ SID_SW_COLLAPSING_BORDERS, SID_SW_COLLAPSING_BORDERS,
+ SID_ATTR_BORDER_DIAG_TLBR, SID_ATTR_BORDER_DIAG_BLTR>);
+
+namespace
+{
+constexpr int twipsToPt100(sal_Int64 nTwips)
{
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
- SID_ATTR_ALIGN_MARGIN, SID_ATTR_ALIGN_MARGIN,
- SID_ATTR_BORDER_CONNECT, SID_ATTR_BORDER_CONNECT,
- SID_SW_COLLAPSING_BORDERS, SID_SW_COLLAPSING_BORDERS,
- SID_ATTR_BORDER_DIAG_TLBR, SID_ATTR_BORDER_DIAG_BLTR,
- 0
-};
+ return o3tl::convert(nTwips * 100, o3tl::Length::twip, o3tl::Length::pt);
+}
+constexpr int s_LineWidths[] = { twipsToPt100(SvxBorderLineWidth::Hairline),
+ twipsToPt100(SvxBorderLineWidth::VeryThin),
+ twipsToPt100(SvxBorderLineWidth::Thin),
+ twipsToPt100(SvxBorderLineWidth::Medium),
+ twipsToPt100(SvxBorderLineWidth::Thick),
+ twipsToPt100(SvxBorderLineWidth::ExtraThick),
+ -1 };
+}
static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton& rField)
{
@@ -103,8 +115,8 @@ static sal_Int64 lcl_GetMinLineWidth(SvxBorderLineStyle aStyle)
return 15;
// Double lines
- case SvxBorderLineStyle::DOUBLE: return 22;
- case SvxBorderLineStyle::DOUBLE_THIN: return 22;
+ case SvxBorderLineStyle::DOUBLE: return 15;
+ case SvxBorderLineStyle::DOUBLE_THIN: return 15;
case SvxBorderLineStyle::THINTHICK_SMALLGAP: return 20;
case SvxBorderLineStyle::THINTHICK_MEDIUMGAP: return 15;
case SvxBorderLineStyle::THINTHICK_LARGEGAP: return 15;
@@ -124,10 +136,10 @@ static sal_Int64 lcl_GetMinLineWidth(SvxBorderLineStyle aStyle)
}
// number of preset images to show
-const sal_uInt16 SVX_BORDER_PRESET_COUNT = 5;
+const sal_uInt16 BORDER_PRESET_COUNT = 5;
// number of shadow images to show
-const sal_uInt16 SVX_BORDER_SHADOW_COUNT = 5;
+const sal_uInt16 BORDER_SHADOW_COUNT = 5;
ShadowControlsWrapper::ShadowControlsWrapper(ValueSet& rVsPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor)
: mrVsPos(rVsPos)
@@ -292,7 +304,9 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
, m_xUserDefFT(m_xBuilder->weld_label("userdefft"))
, m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder, "framesel", m_aFrameSel))
, m_xLbLineStyle(new SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb")))
- , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"), pController->getDialog()))
+ , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
+ , m_xLineWidthLB(m_xBuilder->weld_combo_box("linewidthlb"))
, m_xLineWidthMF(m_xBuilder->weld_metric_spin_button("linewidthmf", FieldUnit::POINT))
, m_xSpacingFrame(m_xBuilder->weld_container("spacing"))
, m_xLeftFT(m_xBuilder->weld_label("leftft"))
@@ -310,90 +324,91 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
, m_xFtShadowSize(m_xBuilder->weld_label("distanceft"))
, m_xEdShadowSize(m_xBuilder->weld_metric_spin_button("distancemf", FieldUnit::MM))
, m_xFtShadowColor(m_xBuilder->weld_label("shadowcolorft"))
- , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("shadowcolorlb"), pController->getDialog()))
+ , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("shadowcolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xPropertiesFrame(m_xBuilder->weld_container("properties"))
, m_xMergeWithNextCB(m_xBuilder->weld_check_button("mergewithnext"))
, m_xMergeAdjacentBordersCB(m_xBuilder->weld_check_button("mergeadjacent"))
, m_xRemoveAdjacentCellBordersCB(m_xBuilder->weld_check_button("rmadjcellborders"))
, m_xRemoveAdjacentCellBordersFT(m_xBuilder->weld_label("rmadjcellbordersft"))
{
- static std::vector<std::u16string_view> aBorderImageIds;
+ static std::vector<OUString> aBorderImageIds;
if (aBorderImageIds.empty())
{
if (comphelper::LibreOfficeKit::isActive())
{
aBorderImageIds.insert(aBorderImageIds.end(), {
- u"" RID_SVXBMP_CELL_NONE_32,
- u"" RID_SVXBMP_CELL_ALL_32,
- u"" RID_SVXBMP_CELL_LR_32,
- u"" RID_SVXBMP_CELL_TB_32,
- u"" RID_SVXBMP_CELL_L_32,
- u"" RID_SVXBMP_CELL_DIAG_32
+ RID_SVXBMP_CELL_NONE_32,
+ RID_SVXBMP_CELL_ALL_32,
+ RID_SVXBMP_CELL_LR_32,
+ RID_SVXBMP_CELL_TB_32,
+ RID_SVXBMP_CELL_L_32,
+ RID_SVXBMP_CELL_DIAG_32
});
}
else
{
aBorderImageIds.insert(aBorderImageIds.end(), {
- u"" RID_SVXBMP_CELL_NONE,
- u"" RID_SVXBMP_CELL_ALL,
- u"" RID_SVXBMP_CELL_LR,
- u"" RID_SVXBMP_CELL_TB,
- u"" RID_SVXBMP_CELL_L,
- u"" RID_SVXBMP_CELL_DIAG
+ RID_SVXBMP_CELL_NONE,
+ RID_SVXBMP_CELL_ALL,
+ RID_SVXBMP_CELL_LR,
+ RID_SVXBMP_CELL_TB,
+ RID_SVXBMP_CELL_L,
+ RID_SVXBMP_CELL_DIAG
});
}
aBorderImageIds.insert(aBorderImageIds.end(), {
- u"" RID_SVXBMP_HOR_NONE,
- u"" RID_SVXBMP_HOR_OUTER,
- u"" RID_SVXBMP_HOR_HOR,
- u"" RID_SVXBMP_HOR_ALL,
- u"" RID_SVXBMP_HOR_OUTER2,
- u"" RID_SVXBMP_VER_NONE,
- u"" RID_SVXBMP_VER_OUTER,
- u"" RID_SVXBMP_VER_VER,
- u"" RID_SVXBMP_VER_ALL,
- u"" RID_SVXBMP_VER_OUTER2,
- u"" RID_SVXBMP_TABLE_NONE,
- u"" RID_SVXBMP_TABLE_OUTER,
- u"" RID_SVXBMP_TABLE_OUTERH,
- u"" RID_SVXBMP_TABLE_ALL,
- u"" RID_SVXBMP_TABLE_OUTER2
+ RID_SVXBMP_HOR_NONE,
+ RID_SVXBMP_HOR_OUTER,
+ RID_SVXBMP_HOR_HOR,
+ RID_SVXBMP_HOR_ALL,
+ RID_SVXBMP_HOR_OUTER2,
+ RID_SVXBMP_VER_NONE,
+ RID_SVXBMP_VER_OUTER,
+ RID_SVXBMP_VER_VER,
+ RID_SVXBMP_VER_ALL,
+ RID_SVXBMP_VER_OUTER2,
+ RID_SVXBMP_TABLE_NONE,
+ RID_SVXBMP_TABLE_OUTER,
+ RID_SVXBMP_TABLE_OUTERH,
+ RID_SVXBMP_TABLE_ALL,
+ RID_SVXBMP_TABLE_OUTER2
});
}
for (auto const & rImageId : aBorderImageIds)
- m_aBorderImgVec.emplace_back(StockImage::Yes, OUString(rImageId));
+ m_aBorderImgVec.emplace_back(StockImage::Yes, rImageId);
- static std::vector<std::u16string_view> aShadowImageIds;
+ static std::vector<OUString> aShadowImageIds;
if (aShadowImageIds.empty())
{
if (comphelper::LibreOfficeKit::isActive())
{
aShadowImageIds.insert(aShadowImageIds.end(), {
- u"" RID_SVXBMP_SHADOWNONE_32,
- u"" RID_SVXBMP_SHADOW_BOT_RIGHT_32,
- u"" RID_SVXBMP_SHADOW_TOP_RIGHT_32,
- u"" RID_SVXBMP_SHADOW_BOT_LEFT_32,
- u"" RID_SVXBMP_SHADOW_TOP_LEFT_32
+ RID_SVXBMP_SHADOWNONE_32,
+ RID_SVXBMP_SHADOW_BOT_RIGHT_32,
+ RID_SVXBMP_SHADOW_TOP_RIGHT_32,
+ RID_SVXBMP_SHADOW_BOT_LEFT_32,
+ RID_SVXBMP_SHADOW_TOP_LEFT_32
});
}
else
{
aShadowImageIds.insert(aShadowImageIds.end(), {
- u"" RID_SVXBMP_SHADOWNONE,
- u"" RID_SVXBMP_SHADOW_BOT_RIGHT,
- u"" RID_SVXBMP_SHADOW_TOP_RIGHT,
- u"" RID_SVXBMP_SHADOW_BOT_LEFT,
- u"" RID_SVXBMP_SHADOW_TOP_LEFT
+ RID_SVXBMP_SHADOWNONE,
+ RID_SVXBMP_SHADOW_BOT_RIGHT,
+ RID_SVXBMP_SHADOW_TOP_RIGHT,
+ RID_SVXBMP_SHADOW_BOT_LEFT,
+ RID_SVXBMP_SHADOW_TOP_LEFT
});
}
}
for (auto const & rImageId : aShadowImageIds)
- m_aShadowImgVec.emplace_back(StockImage::Yes, OUString(rImageId));
+ m_aShadowImgVec.emplace_back(StockImage::Yes, rImageId);
- assert(m_aShadowImgVec.size() == SVX_BORDER_SHADOW_COUNT);
+ assert(m_aShadowImgVec.size() == BORDER_SHADOW_COUNT);
// this page needs ExchangeSupport
SetExchangeSupport();
@@ -403,20 +418,17 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
is needed across various functions... */
mbUseMarginItem = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN)) != SfxItemState::UNKNOWN;
- const SfxPoolItem* pItem = nullptr;
- if (rCoreAttrs.HasItem(SID_ATTR_BORDER_STYLES, &pItem))
+ if (const SfxIntegerListItem* p = rCoreAttrs.GetItemIfSet(SID_ATTR_BORDER_STYLES))
{
- const SfxIntegerListItem* p = static_cast<const SfxIntegerListItem*>(pItem);
std::vector<sal_Int32> aUsedStyles = p->GetList();
for (int aUsedStyle : aUsedStyles)
maUsedBorderStyles.insert(static_cast<SvxBorderLineStyle>(aUsedStyle));
}
- if (rCoreAttrs.HasItem(SID_ATTR_BORDER_DEFAULT_WIDTH, &pItem))
+ if (const SfxInt64Item* p = rCoreAttrs.GetItemIfSet(SID_ATTR_BORDER_DEFAULT_WIDTH))
{
// The caller specifies default line width. Honor it.
- const SfxInt64Item* p = static_cast<const SfxInt64Item*>(pItem);
- m_xLineWidthMF->set_value(p->GetValue(), FieldUnit::POINT);
+ SetLineWidth(p->GetValue());
}
// set metric
@@ -516,14 +528,19 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
m_aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl));
m_xLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) );
m_xLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
- m_xLineWidthMF->connect_value_changed( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) );
+ m_xLineWidthLB->connect_changed(LINK(this, SvxBorderTabPage, ModifyWidthLBHdl_Impl));
+ m_xLineWidthMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyWidthMFHdl_Impl));
m_xWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
m_xWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
FillValueSets();
FillLineListBox_Impl();
+ // Reapply line width: probably one of predefined values should be selected
+ SetLineWidth(m_xLineWidthMF->get_value(FieldUnit::NONE));
+
// connections
+ const SfxPoolItem* pItem = nullptr;
if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_PARA_GRABBAG), &pItem))
{
const SfxGrabBagItem* pGrabBag = static_cast<const SfxGrabBagItem*>(pItem);
@@ -554,8 +571,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
// checkbox "Merge adjacent line styles" only visible for Writer dialog format.table
m_xMergeAdjacentBordersCB->hide();
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- if (pDocSh)
+ if (SfxObjectShell* pDocSh = SfxObjectShell::Current())
{
Reference< XServiceInfo > xSI( pDocSh->GetModel(), UNO_QUERY );
if ( xSI.is() )
@@ -618,7 +634,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR))
{
- sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR);
+ sal_uInt16 nBorderDiagId = pPool->GetWhichIDFromSlotID(SID_ATTR_BORDER_DIAG_TLBR);
if (const SvxLineItem* pLineItem = static_cast<const SvxLineItem*>(rSet->GetItem(nBorderDiagId)))
m_aFrameSel.ShowBorder(svx::FrameBorderType::TLBR, pLineItem->GetLine());
else
@@ -627,7 +643,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR))
{
- sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR);
+ sal_uInt16 nBorderDiagId = pPool->GetWhichIDFromSlotID(SID_ATTR_BORDER_DIAG_BLTR);
if (const SvxLineItem* pLineItem = static_cast<const SvxLineItem*>(rSet->GetItem(nBorderDiagId)))
m_aFrameSel.ShowBorder(svx::FrameBorderType::BLTR, pLineItem->GetLine());
else
@@ -636,7 +652,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
if (m_xShadowControls)
{
- sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
+ sal_uInt16 nShadowId = pPool->GetWhichIDFromSlotID(mnShadowSlot);
const SfxPoolItem* pItem = rSet->GetItem(nShadowId);
if (pItem)
m_xShadowControls->SetControlValue(*static_cast<const SvxShadowItem*>(pItem));
@@ -646,7 +662,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
if (m_xMarginControls)
{
- sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
+ sal_uInt16 nAlignMarginId = pPool->GetWhichIDFromSlotID(SID_ATTR_ALIGN_MARGIN);
const SfxPoolItem* pItem = rSet->GetItem(nAlignMarginId);
if (pItem)
m_xMarginControls->SetControlValue(*static_cast<const SvxMarginItem*>(pItem));
@@ -654,7 +670,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
m_xMarginControls->SetControlDontKnow();
}
- sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
+ sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhichIDFromSlotID(SID_SW_COLLAPSING_BORDERS);
const SfxBoolItem *pMergeAdjacentBorders = static_cast<const SfxBoolItem*>(rSet->GetItem(nMergeAdjacentBordersId));
if (!pMergeAdjacentBorders)
m_xMergeAdjacentBordersCB->set_state(TRISTATE_INDET);
@@ -662,7 +678,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
m_xMergeAdjacentBordersCB->set_active(pMergeAdjacentBorders->GetValue());
m_xMergeAdjacentBordersCB->save_state();
- sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
+ sal_uInt16 nMergeWithNextId = pPool->GetWhichIDFromSlotID(SID_ATTR_BORDER_CONNECT);
const SfxBoolItem *pMergeWithNext = static_cast<const SfxBoolItem*>(rSet->GetItem(nMergeWithNextId));
if (!pMergeWithNext)
m_xMergeWithNextCB->set_state(TRISTATE_INDET);
@@ -779,7 +795,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
sal_Int64 nWidthPt = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
sal_Int64( nWidth ), m_xLineWidthMF->get_digits(),
MapUnit::MapTwip, FieldUnit::POINT ));
- m_xLineWidthMF->set_value(nWidthPt, FieldUnit::POINT);
+ SetLineWidth(nWidthPt);
m_xLbLineStyle->SetWidth(nWidth);
// then set the style
@@ -823,13 +839,15 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
SelStyleHdl_Impl(*m_xLbLineStyle);
}
- const SfxPoolItem* pItem;
- SfxObjectShell* pShell;
- if(SfxItemState::SET == rSet->GetItemState(SID_HTML_MODE, false, &pItem) ||
- ( nullptr != (pShell = SfxObjectShell::Current()) &&
- nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ const SfxUInt16Item* pHtmlModeItem = rSet->GetItemIfSet(SID_HTML_MODE, false);
+ if(!pHtmlModeItem)
{
- sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem(SID_HTML_MODE);
+ }
+ if(pHtmlModeItem)
+ {
+ sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
if(nHtmlMode & HTMLMODE_ON)
{
// there are no shadows in Html-mode and only complete borders
@@ -935,7 +953,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
auto nState = m_xMergeAdjacentBordersCB->get_state();
if (nState == TRISTATE_INDET)
{
- sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
+ sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhichIDFromSlotID(SID_SW_COLLAPSING_BORDERS);
rCoreAttrs->ClearItem(nMergeAdjacentBordersId);
}
else
@@ -955,7 +973,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
auto nState = m_xMergeWithNextCB->get_state();
if (nState == TRISTATE_INDET)
{
- sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
+ sal_uInt16 nMergeWithNextId = pPool->GetWhichIDFromSlotID(SID_ATTR_BORDER_CONNECT);
rCoreAttrs->ClearItem(nMergeWithNextId);
}
else
@@ -972,7 +990,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
bool bPut = true;
sal_uInt16 nBoxWhich = GetWhich( mnBoxSlot );
- sal_uInt16 nBoxInfoWhich = pPool->GetWhich( SID_ATTR_BORDER_INNER, false );
+ sal_uInt16 nBoxInfoWhich = pPool->GetWhichIDFromSlotID( SID_ATTR_BORDER_INNER, false );
const SfxItemSet& rOldSet = GetItemSet();
SvxBoxItem aBoxItem ( nBoxWhich );
SvxBoxInfoItem aBoxInfoItem ( nBoxInfoWhich );
@@ -1213,13 +1231,34 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void)
IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void)
{
- Color aColor = rColorBox.GetSelectEntryColor();
- m_aFrameSel.SetColorToSelection(aColor);
+ NamedColor aNamedColor = rColorBox.GetSelectedEntry();
+ m_aFrameSel.SetColorToSelection(aNamedColor.m_aColor, aNamedColor.getComplexColor());
}
-IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, weld::MetricSpinButton&, void)
+IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthLBHdl_Impl, weld::ComboBox&, void)
+{
+ sal_Int32 nPos = m_xLineWidthLB->get_active();
+ sal_Int32 nRemovedType = 0;
+ if (m_xLineWidthLB->get_values_changed_from_saved()) {
+ nRemovedType = std::size(s_LineWidths) - m_xLineWidthLB->get_count();
+ }
+
+ SetLineWidth(s_LineWidths[nPos + nRemovedType], nRemovedType);
+
+ // Call the spinner handler to trigger all related modifications
+ ModifyWidthMFHdl_Impl(*m_xLineWidthMF);
+}
+
+IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void)
{
sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
+
+ // for DOUBLE_THIN line style we cannot allow thinner line width then 1.10pt
+ if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN)
+ m_xLineWidthMF->set_min(110, FieldUnit::NONE);
+ else
+ m_xLineWidthMF->set_min(5, FieldUnit::NONE);
+
nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
nVal,
m_xLineWidthMF->get_digits(),
@@ -1233,6 +1272,13 @@ IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, weld::MetricSpinButton&,
IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
{
sal_Int64 nOldWidth = m_xLineWidthMF->get_value(FieldUnit::NONE);
+
+ // for DOUBLE_THIN line style we cannot allow thinner line width then 1.10pt
+ if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN)
+ m_xLineWidthMF->set_min(110, FieldUnit::NONE);
+ else
+ m_xLineWidthMF->set_min(5, FieldUnit::NONE);
+
nOldWidth = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
nOldWidth,
m_xLineWidthMF->get_digits(),
@@ -1244,7 +1290,14 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
// auto change line-width if it doesn't correspond to minimal value
// let's change only in case when user has not changed the line-width into some custom value
- const sal_Int64 nNewWidth = (nOldMinWidth == nOldWidth)? nNewMinWidth : nOldWidth;
+ sal_Int64 nNewWidth = (nOldMinWidth == nOldWidth) ? nNewMinWidth : nOldWidth;
+
+ // if we had selected a predefined border width under SvxBorderLineWidth::Medium set the Medium as default
+ // otherwise if we had a custom border width under 1.10pt then set the spinner to the maximum allowed value for double border styles
+ bool bNewDoubleHairline = m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN && !m_xLineWidthMF->get_visible() &&
+ (nOldWidth == SvxBorderLineWidth::Hairline || nOldWidth == SvxBorderLineWidth::VeryThin || nOldWidth == SvxBorderLineWidth::Thin);
+ if (bNewDoubleHairline && nNewWidth < SvxBorderLineWidth::Medium)
+ nNewWidth = SvxBorderLineWidth::Medium;
// set value inside edit box
if (nOldWidth != nNewWidth)
@@ -1254,7 +1307,27 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
m_xLineWidthMF->get_digits(),
MapUnit::MapTwip,
FieldUnit::POINT));
- m_xLineWidthMF->set_value(nNewWidthPt, FieldUnit::POINT);
+ SetLineWidth(nNewWidthPt);
+ }
+
+ if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN)
+ {
+ for (size_t i = 0; i < 3; i++)
+ {
+ m_xLineWidthLB->save_values_by_id(OUString::number(i));
+ m_xLineWidthLB->remove_id(OUString::number(i));
+ }
+ if (m_xLineWidthLB->get_active_id().isEmpty())
+ m_xLineWidthLB->set_active_id("3");
+ }
+ else
+ {
+ if (m_xLineWidthLB->get_values_changed_from_saved())
+ {
+ for (size_t i = 0; i < 3; i++)
+ m_xLineWidthLB->append(i, OUString::number(i), m_xLineWidthLB->get_saved_values(i));
+ m_xLineWidthLB->removeSavedValues();
+ }
}
// set value inside style box
@@ -1267,7 +1340,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const
{
// table with all sets of predefined border styles
- static const sal_uInt16 ppnImgIds[][ SVX_BORDER_PRESET_COUNT ] =
+ static const sal_uInt16 ppnImgIds[][ BORDER_PRESET_COUNT ] =
{
// simple cell without diagonal frame borders
{ IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_L },
@@ -1292,15 +1365,15 @@ sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const
else
nLine = 4;
- DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= SVX_BORDER_PRESET_COUNT),
+ DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= BORDER_PRESET_COUNT),
"SvxBorderTabPage::GetPresetImageId - wrong index" );
return ppnImgIds[ nLine ][ nValueSetIdx - 1 ];
}
-const char* SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
+TranslateId SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
{
// string resource IDs for each image (in order of the IID_PRE_* image IDs)
- static const char* pnStrIds[] =
+ static const TranslateId pnStrIds[] =
{
RID_SVXSTR_TABLE_PRESET_NONE,
RID_SVXSTR_PARA_PRESET_ALL,
@@ -1334,14 +1407,14 @@ void SvxBorderTabPage::FillPresetVS()
{
// basic initialization of the ValueSet
m_xWndPresets->SetStyle( m_xWndPresets->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
- m_xWndPresets->SetColCount( SVX_BORDER_PRESET_COUNT );
+ m_xWndPresets->SetColCount( BORDER_PRESET_COUNT );
// insert images and help texts
- for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
+ for( sal_uInt16 nVSIdx = 1; nVSIdx <= BORDER_PRESET_COUNT; ++nVSIdx )
{
m_xWndPresets->InsertItem( nVSIdx );
m_xWndPresets->SetItemImage(nVSIdx, m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]);
- m_xWndPresets->SetItemText( nVSIdx, CuiResId( GetPresetStringId( nVSIdx ) ) );
+ m_xWndPresets->SetItemText( nVSIdx, SvxResId( GetPresetStringId( nVSIdx ) ) );
}
// show the control
@@ -1354,14 +1427,14 @@ void SvxBorderTabPage::FillShadowVS()
{
// basic initialization of the ValueSet
m_xWndShadows->SetStyle( m_xWndShadows->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
- m_xWndShadows->SetColCount( SVX_BORDER_SHADOW_COUNT );
+ m_xWndShadows->SetColCount( BORDER_SHADOW_COUNT );
// string resource IDs for each image
- static const char* pnStrIds[ SVX_BORDER_SHADOW_COUNT ] =
- { RID_SVXSTR_SHADOW_STYLE_NONE, RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT, RID_SVXSTR_SHADOW_STYLE_TOPRIGHT, RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT, RID_SVXSTR_SHADOW_STYLE_TOPLEFT };
+ static const TranslateId pnStrIds[ BORDER_SHADOW_COUNT ] =
+ { RID_CUISTR_SHADOW_STYLE_NONE, RID_CUISTR_SHADOW_STYLE_BOTTOMRIGHT, RID_CUISTR_SHADOW_STYLE_TOPRIGHT, RID_CUISTR_SHADOW_STYLE_BOTTOMLEFT, RID_CUISTR_SHADOW_STYLE_TOPLEFT };
// insert images and help texts
- for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx )
+ for( sal_uInt16 nVSIdx = 1; nVSIdx <= BORDER_SHADOW_COUNT; ++nVSIdx )
{
m_xWndShadows->InsertItem( nVSIdx );
m_xWndShadows->SetItemImage(nVSIdx, m_aShadowImgVec[nVSIdx-1]);
@@ -1381,6 +1454,26 @@ void SvxBorderTabPage::FillValueSets()
FillShadowVS();
}
+void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth, sal_Int32 nRemovedType )
+{
+ if ( nWidth >= 0 )
+ m_xLineWidthMF->set_value( nWidth, FieldUnit::POINT );
+
+ auto it = std::find( std::begin(s_LineWidths), std::end(s_LineWidths), nWidth );
+
+ if ( it != std::end(s_LineWidths) && *it >= 0 )
+ {
+ // Select predefined value in combobox
+ m_xLineWidthMF->hide();
+ m_xLineWidthLB->set_active(std::distance(std::begin(s_LineWidths), it) - nRemovedType);
+ }
+ else
+ {
+ // This is not one of predefined values. Show spinner
+ m_xLineWidthLB->set_active(std::size(s_LineWidths) - nRemovedType -1);
+ m_xLineWidthMF->show();
+ }
+}
static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
{
@@ -1424,7 +1517,7 @@ void SvxBorderTabPage::FillLineListBox_Impl()
m_xLbLineStyle->SetSourceUnit( FieldUnit::TWIP );
- for (size_t i = 0; i < SAL_N_ELEMENTS(aLines); ++i)
+ for (size_t i = 0; i < std::size(aLines); ++i)
{
if (!IsBorderLineStyleAllowed(aLines[i].mnStyle))
continue;
@@ -1515,12 +1608,12 @@ IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, weld::MetricSpinButton&, rF
}
}
-IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, weld::Toggleable&, rBox, void)
{
mbSync = rBox.get_active();
}
-IMPL_LINK( SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK( SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl, weld::Toggleable&, rBox, void)
{
mbRemoveAdjacentCellBorders = rBox.get_active();
}
@@ -1549,7 +1642,7 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset )
// Check if current selection involves deletion of at least one border
bool bBorderDeletionReq = false;
- for ( size_t i=0; i < SAL_N_ELEMENTS( eTypes1 ); ++i )
+ for ( size_t i=0; i < std::size( eTypes1 ); ++i )
{
if( pOldBoxItem->GetLine( eTypes2[i] ) || !( pOldBoxInfoItem->IsValid( eTypes1[i].second ) ) )
{
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 6a35b45ba46f..cd6965375003 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -23,7 +23,8 @@
#include <sfx2/objsh.hxx>
#include <svx/svxids.hrc>
#include <svtools/unitconv.hxx>
-#include <svl/languageoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <chardlg.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/postitem.hxx>
@@ -40,10 +41,11 @@
#include <editeng/kernitem.hxx>
#include <editeng/flstitem.hxx>
#include <editeng/autokernitem.hxx>
+#include <editeng/nhypitem.hxx>
#include <editeng/colritem.hxx>
#include <dialmgr.hxx>
#include <sfx2/htmlmode.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
#include "chardlg.h"
#include <editeng/emphasismarkitem.hxx>
#include <editeng/charreliefitem.hxx>
@@ -56,74 +58,48 @@
#include <twolines.hrc>
#include <svl/intitem.hxx>
#include <svx/flagsdef.hxx>
+#include <FontFeatures.hxx>
#include <FontFeaturesDialog.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <o3tl/unit_conversion.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star;
// static ----------------------------------------------------------------
-const sal_uInt16 SvxCharNamePage::pNameRanges[] =
-{
- SID_ATTR_CHAR_FONT,
- SID_ATTR_CHAR_WEIGHT,
- SID_ATTR_CHAR_FONTHEIGHT,
- SID_ATTR_CHAR_FONTHEIGHT,
- SID_ATTR_CHAR_COLOR,
- SID_ATTR_CHAR_COLOR,
- SID_ATTR_CHAR_LANGUAGE,
- SID_ATTR_CHAR_LANGUAGE,
- SID_ATTR_CHAR_CJK_FONT,
- SID_ATTR_CHAR_CJK_WEIGHT,
- SID_ATTR_CHAR_CTL_FONT,
- SID_ATTR_CHAR_CTL_WEIGHT,
- 0
-};
-
-const sal_uInt16 SvxCharEffectsPage::pEffectsRanges[] =
-{
- SID_ATTR_CHAR_SHADOWED,
- SID_ATTR_CHAR_UNDERLINE,
- SID_ATTR_CHAR_COLOR,
- SID_ATTR_CHAR_COLOR,
- SID_ATTR_CHAR_CASEMAP,
- SID_ATTR_CHAR_CASEMAP,
- SID_ATTR_FLASH,
- SID_ATTR_FLASH,
- SID_ATTR_CHAR_EMPHASISMARK,
- SID_ATTR_CHAR_EMPHASISMARK,
- SID_ATTR_CHAR_RELIEF,
- SID_ATTR_CHAR_RELIEF,
- SID_ATTR_CHAR_HIDDEN,
- SID_ATTR_CHAR_HIDDEN,
- SID_ATTR_CHAR_OVERLINE,
- SID_ATTR_CHAR_OVERLINE,
- 0
-};
-
-const sal_uInt16 SvxCharPositionPage::pPositionRanges[] =
-{
- SID_ATTR_CHAR_KERNING,
- SID_ATTR_CHAR_KERNING,
- SID_ATTR_CHAR_ESCAPEMENT,
- SID_ATTR_CHAR_ESCAPEMENT,
- SID_ATTR_CHAR_AUTOKERN,
- SID_ATTR_CHAR_AUTOKERN,
- SID_ATTR_CHAR_ROTATED,
- SID_ATTR_CHAR_SCALEWIDTH,
- SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
- SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
- 0
-};
-
-const sal_uInt16 SvxCharTwoLinesPage::pTwoLinesRanges[] =
-{
- SID_ATTR_CHAR_TWO_LINES,
- SID_ATTR_CHAR_TWO_LINES,
- 0
-};
+const WhichRangesContainer SvxCharNamePage::pNameRanges(svl::Items<
+ SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_LANGUAGE, SID_ATTR_CHAR_LANGUAGE,
+ SID_ATTR_CHAR_CJK_FONT, SID_ATTR_CHAR_CJK_WEIGHT,
+ SID_ATTR_CHAR_CTL_FONT, SID_ATTR_CHAR_CTL_WEIGHT
+>);
+
+const WhichRangesContainer SvxCharEffectsPage::pEffectsRanges(svl::Items<
+ SID_ATTR_CHAR_SHADOWED, SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_CASEMAP, SID_ATTR_CHAR_CASEMAP,
+ SID_ATTR_FLASH, SID_ATTR_FLASH,
+ SID_ATTR_CHAR_EMPHASISMARK, SID_ATTR_CHAR_EMPHASISMARK,
+ SID_ATTR_CHAR_RELIEF, SID_ATTR_CHAR_RELIEF,
+ SID_ATTR_CHAR_HIDDEN, SID_ATTR_CHAR_HIDDEN,
+ SID_ATTR_CHAR_OVERLINE, SID_ATTR_CHAR_OVERLINE
+>);
+
+const WhichRangesContainer SvxCharPositionPage::pPositionRanges(svl::Items<
+ SID_ATTR_CHAR_KERNING, SID_ATTR_CHAR_KERNING,
+ SID_ATTR_CHAR_ESCAPEMENT, SID_ATTR_CHAR_ESCAPEMENT,
+ SID_ATTR_CHAR_AUTOKERN, SID_ATTR_CHAR_AUTOKERN,
+ SID_ATTR_CHAR_ROTATED, SID_ATTR_CHAR_SCALEWIDTH,
+ SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
+>);
+
+const WhichRangesContainer SvxCharTwoLinesPage::pTwoLinesRanges(svl::Items<
+ SID_ATTR_CHAR_TWO_LINES, SID_ATTR_CHAR_TWO_LINES
+>);
// C-Function ------------------------------------------------------------
@@ -157,7 +133,7 @@ inline SvxFont& SvxCharBasePage::GetPreviewCTLFont()
return m_aPreviewWin.GetCTLFont();
}
-SvxCharBasePage::SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemset)
+SvxCharBasePage::SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rItemset)
: SfxTabPage(pPage, pController, rUIXMLDescription, rID, &rItemset)
, m_bPreviewBackgroundToCharacter( false )
{
@@ -195,7 +171,7 @@ void SvxCharBasePage::SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp
struct SvxCharNamePage_Impl
{
- Idle m_aUpdateIdle;
+ Idle m_aUpdateIdle { "cui SvxCharNamePage_Impl m_aUpdateIdle" };
OUString m_aNoStyleText;
std::unique_ptr<FontList> m_pFontList;
int m_nExtraEntryPos;
@@ -215,83 +191,72 @@ struct SvxCharNamePage_Impl
SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInSet)
: SvxCharBasePage(pPage, pController, "cui/ui/charnamepage.ui", "CharNamePage", rInSet)
, m_pImpl(new SvxCharNamePage_Impl)
- , m_xEastFrame(m_xBuilder->weld_widget("asian"))
- , m_xEastFontNameFT(m_xBuilder->weld_label("eastfontnameft"))
- , m_xEastFontNameLB(m_xBuilder->weld_combo_box("eastfontnamelb"))
- , m_xEastFontStyleFT(m_xBuilder->weld_label("eaststyleft"))
- , m_xEastFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("eaststylelb")))
- , m_xEastFontSizeFT(m_xBuilder->weld_label("eastsizeft"))
- , m_xEastFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("eastsizelb")))
- , m_xEastFontLanguageFT(m_xBuilder->weld_label("eastlangft"))
- , m_xEastFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("eastlanglb")))
- , m_xEastFontTypeFT(m_xBuilder->weld_label("eastfontinfo"))
- , m_xEastFontFeaturesButton(m_xBuilder->weld_button("east_features_button"))
- , m_xCTLFrame(m_xBuilder->weld_widget("ctl"))
- , m_xCTLFontNameFT(m_xBuilder->weld_label("ctlfontnameft"))
- , m_xCTLFontNameLB(m_xBuilder->weld_combo_box("ctlfontnamelb"))
- , m_xCTLFontStyleFT(m_xBuilder->weld_label("ctlstyleft"))
- , m_xCTLFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("ctlstylelb")))
- , m_xCTLFontSizeFT(m_xBuilder->weld_label("ctlsizeft"))
- , m_xCTLFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("ctlsizelb")))
- , m_xCTLFontLanguageFT(m_xBuilder->weld_label("ctllangft"))
- , m_xCTLFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("ctllanglb")))
- , m_xCTLFontTypeFT(m_xBuilder->weld_label("ctlfontinfo"))
- , m_xCTLFontFeaturesButton(m_xBuilder->weld_button("ctl_features_button"))
+ // Western
+ , m_xWestern(m_xBuilder->weld_notebook("nbWestern"))
+ , m_xWestFontNameFT(m_xBuilder->weld_label("lbWestFontname"))
+ , m_xWestFontStyleFT(m_xBuilder->weld_label("lbWestStyle"))
+ , m_xWestFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("cbWestStyle")))
+ , m_xWestFontSizeFT(m_xBuilder->weld_label("lbWestSize"))
+ , m_xWestFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("cbWestSize")))
+ , m_xWestFontLanguageFT(m_xBuilder->weld_label("lbWestLanguage"))
+ , m_xWestFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("cbWestLanguage")))
+ , m_xWestFontFeaturesButton(m_xBuilder->weld_button("btnWestFeatures"))
+ , m_xWestFontTypeFT(m_xBuilder->weld_label("lbWestFontinfo"))
+ , m_xCJK_CTL(m_xBuilder->weld_notebook("nbCJKCTL"))
+ // CJK
+ , m_xEastFontNameFT(m_xBuilder->weld_label("lbCJKFontname"))
+ , m_xEastFontStyleFT(m_xBuilder->weld_label("lbCJKStyle"))
+ , m_xEastFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("cbCJKStyle")))
+ , m_xEastFontSizeFT(m_xBuilder->weld_label("lbCJKSize"))
+ , m_xEastFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("cbCJKSize")))
+ , m_xEastFontLanguageFT(m_xBuilder->weld_label("lbCJKLanguage"))
+ , m_xEastFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("cbCJKLanguage")))
+ , m_xEastFontFeaturesButton(m_xBuilder->weld_button("btnCJKFeatures"))
+ , m_xEastFontTypeFT(m_xBuilder->weld_label("lbCJKFontinfo"))
+ // CTL
+ , m_xCTLFontNameFT(m_xBuilder->weld_label("lbCTLFontname"))
+ // tree
+ , m_xCTLFontStyleFT(m_xBuilder->weld_label("lbCTLStyle"))
+ , m_xCTLFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("cbCTLStyle")))
+ , m_xCTLFontSizeFT(m_xBuilder->weld_label("lbCTLSize"))
+ , m_xCTLFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("cbCTLSize")))
+ , m_xCTLFontLanguageFT(m_xBuilder->weld_label("lbCTLLanguage"))
+ , m_xCTLFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("cbCTLLanguage")))
+ , m_xCTLFontFeaturesButton(m_xBuilder->weld_button("btnCTLFeatures"))
+ , m_xCTLFontTypeFT(m_xBuilder->weld_label("lbCTLFontinfo"))
+
+ , m_xVDev(*Application::GetDefaultDevice(), DeviceFormat::WITH_ALPHA)
{
m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
#ifdef IOS
m_xPreviewWin->hide();
#endif
- m_pImpl->m_aNoStyleText = CuiResId( RID_SVXSTR_CHARNAME_NOSTYLE );
-
- SvtLanguageOptions aLanguageOptions;
- bool bShowCJK = aLanguageOptions.IsCJKFontEnabled();
- bool bShowCTL = aLanguageOptions.IsCTLFontEnabled();
- bool bShowNonWestern = bShowCJK || bShowCTL;
+ m_pImpl->m_aNoStyleText = CuiResId( RID_CUISTR_CHARNAME_NOSTYLE );
- if (bShowNonWestern)
- {
- m_xWestFrame = m_xBuilder->weld_widget("western");
- m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-cjk");
- m_xWestFontNameLB = m_xBuilder->weld_combo_box("westfontnamelb-cjk");
- m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-cjk");
- m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-cjk");
+ std::unique_ptr<weld::EntryTreeView> xWestFontName = m_xBuilder->weld_entry_tree_view("gdWestern", "edWestFontName", "trWestFontName");
+ std::unique_ptr<weld::EntryTreeView> xCJKFontName = m_xBuilder->weld_entry_tree_view("gdCJK", "edCJKFontName", "trCJKFontName");
+ std::unique_ptr<weld::EntryTreeView> xCTLFontName = m_xBuilder->weld_entry_tree_view("gdCTL", "edCTLFontName", "trCTLFontName");
- m_xWestFontStyleLB.reset(new FontStyleBox(m_xBuilder->weld_combo_box("weststylelb-cjk")));
- m_xWestFontSizeLB.reset(new FontSizeBox(m_xBuilder->weld_combo_box("westsizelb-cjk")));
+ // 7 lines in the treeview
+ xWestFontName->set_height_request_by_rows(7);
+ xCJKFontName->set_height_request_by_rows(7);
+ xCTLFontName->set_height_request_by_rows(7);
- m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-cjk");
- m_xWestFontLanguageLB.reset(new SvxLanguageBox(m_xBuilder->weld_combo_box("westlanglb-cjk")));
- m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-cjk");
+ m_xWestFontNameLB = std::move(xWestFontName);
+ m_xEastFontNameLB = std::move(xCJKFontName);
+ m_xCTLFontNameLB = std::move(xCTLFontName);
- m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-cjk");
- }
- else
+ bool bShowCJK = SvtCJKOptions::IsCJKFontEnabled();
+ bool bShowCTL = SvtCTLOptions::IsCTLFontEnabled();
+ bool bShowNonWestern = bShowCJK || bShowCTL;
+ if (!bShowNonWestern)
{
- m_xWestFrame = m_xBuilder->weld_widget("simple");
- m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-nocjk");
- m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-nocjk");
- m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-nocjk");
-
- m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-nocjk");
- m_xWestFontLanguageLB.reset(new SvxLanguageBox(m_xBuilder->weld_combo_box("westlanglb-nocjk")));
- m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-nocjk");
-
- m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-nocjk");
-
- std::unique_ptr<weld::EntryTreeView> xWestFontNameLB = m_xBuilder->weld_entry_tree_view("namegrid", "westfontname-nocjk", "westfontnamelb-nocjk");
- std::unique_ptr<weld::EntryTreeView> xWestFontStyleLB = m_xBuilder->weld_entry_tree_view("stylegrid", "weststyle-nocjk", "weststylelb-nocjk");
- std::unique_ptr<weld::EntryTreeView> xWestFontSizeLB = m_xBuilder->weld_entry_tree_view("sizegrid", "westsize-nocjk", "westsizelb-nocjk");
-
- // 7 lines in the treeview
- xWestFontNameLB->set_height_request_by_rows(7);
- xWestFontStyleLB->set_height_request_by_rows(7);
- xWestFontSizeLB->set_height_request_by_rows(7);
-
- m_xWestFontNameLB = std::move(xWestFontNameLB);
- m_xWestFontStyleLB.reset(new FontStyleBox(std::move(xWestFontStyleLB)));
- m_xWestFontSizeLB.reset(new FontSizeBox(std::move(xWestFontSizeLB)));
+ m_xCJK_CTL->hide();
+ m_xWestern->set_show_tabs(false); //hide single tab in case of Western only
}
+ else if (!bShowCJK) m_xCJK_CTL->remove_page("nbCJK");
+ else if (!bShowCTL) m_xCJK_CTL->remove_page("nbCTL");
+
//In MacOSX the standard dialogs name font-name, font-style as
//Family, Typeface
@@ -300,33 +265,34 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController*
//In Windows the standard dialogs name font-name, font-style as
//Font, Style
#ifdef _WIN32
- OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FONT));
+ OUString sFontFamilyString(CuiResId(RID_CUISTR_CHARNAME_FONT));
#else
- OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FAMILY));
+ OUString sFontFamilyString(CuiResId(RID_CUISTR_CHARNAME_FAMILY));
#endif
m_xWestFontNameFT->set_label(sFontFamilyString);
- m_xEastFontNameFT->set_label(sFontFamilyString);
m_xCTLFontNameFT->set_label(sFontFamilyString);
+ m_xEastFontNameFT->set_label(sFontFamilyString);
#ifdef MACOSX
- OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_TYPEFACE));
+ OUString sFontStyleString(CuiResId(RID_CUISTR_CHARNAME_TYPEFACE));
#else
- OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_STYLE));
+ OUString sFontStyleString(CuiResId(RID_CUISTR_CHARNAME_STYLE));
#endif
m_xWestFontStyleFT->set_label(sFontStyleString);
m_xEastFontStyleFT->set_label(sFontStyleString);
m_xCTLFontStyleFT->set_label(sFontStyleString);
- m_xWestFrame->show();
- m_xEastFrame->set_visible(bShowCJK);
- m_xCTLFrame->set_visible(bShowCTL);
-
m_xWestFontLanguageLB->SetLanguageList(SvxLanguageListFlags::WESTERN, true, false, true, true,
- LANGUAGE_SYSTEM, css::i18n::ScriptType::LATIN);
+ LANGUAGE_SYSTEM, css::i18n::ScriptType::LATIN);
m_xEastFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CJK, true, false, true, true,
- LANGUAGE_SYSTEM, css::i18n::ScriptType::ASIAN);
+ LANGUAGE_SYSTEM, css::i18n::ScriptType::ASIAN);
m_xCTLFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CTL, true, false, true, true,
- LANGUAGE_SYSTEM, css::i18n::ScriptType::COMPLEX);
+ LANGUAGE_SYSTEM, css::i18n::ScriptType::COMPLEX);
+ int nVisibleChars = 15;
+ // read-only combobox / HasEntry asserts on set_width_char()
+ m_xWestFontLanguageLB->set_width_chars(nVisibleChars);
+ m_xEastFontLanguageLB->set_width_chars(nVisibleChars);
+ m_xCTLFontLanguageLB->set_width_chars(nVisibleChars);
Initialize();
}
@@ -378,10 +344,8 @@ const FontList* SvxCharNamePage::GetFontList() const
{
if ( !m_pImpl->m_pFontList )
{
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
-
/* #110771# SvxFontListItem::GetFontList can return NULL */
- if ( pDocSh )
+ if (SfxObjectShell* pDocSh = SfxObjectShell::Current())
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
if ( pItem != nullptr )
@@ -506,6 +470,35 @@ void SvxCharNamePage::UpdatePreview_Impl()
m_aPreviewWin.Invalidate();
}
+void SvxCharNamePage::EnableFeatureButton(const weld::Widget& rNameBox)
+{
+ OUString sFontName;
+ weld::Button* pButton= nullptr;
+ if (m_xWestFontNameLB.get() == &rNameBox)
+ {
+ sFontName = m_xWestFontNameLB->get_active_text();
+ pButton= m_xWestFontFeaturesButton.get();
+ }
+ else if (m_xEastFontNameLB.get() == &rNameBox)
+ {
+ sFontName = m_xEastFontNameLB->get_active_text();
+ pButton=m_xEastFontFeaturesButton.get();
+ }
+ else if (m_xCTLFontNameLB.get() == &rNameBox)
+ {
+ sFontName = m_xCTLFontNameLB->get_active_text();
+ pButton= m_xCTLFontFeaturesButton.get();
+ }
+ else
+ {
+ SAL_WARN( "cui.tabpages", "invalid font name box" );
+ return;
+ }
+
+ bool bEnable = !getFontFeatureList(sFontName, *m_xVDev).empty();
+
+ pButton->set_sensitive(bEnable);
+}
void SvxCharNamePage::FillStyleBox_Impl(const weld::Widget& rNameBox)
{
@@ -558,27 +551,19 @@ void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox)
const FontList* pFontList = GetFontList();
DBG_ASSERT( pFontList, "no fontlist" );
- FontStyleBox* pStyleBox = nullptr;
FontSizeBox* pSizeBox = nullptr;
- OUString sFontName;
if (m_xWestFontNameLB.get() == &rNameBox)
{
- pStyleBox = m_xWestFontStyleLB.get();
pSizeBox = m_xWestFontSizeLB.get();
- sFontName = m_xWestFontNameLB->get_active_text();
}
else if (m_xEastFontNameLB.get() == &rNameBox)
{
- pStyleBox = m_xEastFontStyleLB.get();
pSizeBox = m_xEastFontSizeLB.get();
- sFontName = m_xEastFontNameLB->get_active_text();
}
else if (m_xCTLFontNameLB.get() == &rNameBox)
{
- pStyleBox = m_xCTLFontStyleLB.get();
pSizeBox = m_xCTLFontSizeLB.get();
- sFontName = m_xCTLFontNameLB->get_active_text();
}
else
{
@@ -586,8 +571,7 @@ void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox)
return;
}
- FontMetric _aFontMetric(pFontList->Get(sFontName, pStyleBox->get_active_text()));
- pSizeBox->Fill( &_aFontMetric, pFontList );
+ pSizeBox->Fill( pFontList );
}
namespace
@@ -695,7 +679,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
eItalic = rItem.GetValue();
bStyle = true;
}
- bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::DONTCARE);
+ bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::INVALID);
switch ( eLangGrp )
{
@@ -712,7 +696,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
}
else
bStyle = false;
- bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::DONTCARE);
+ bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::INVALID);
// currently chosen font
if ( bStyle && pFontItem )
@@ -770,7 +754,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
else
{
pSizeBox->set_active_or_entry_text(OUString());
- if ( eState <= SfxItemState::READONLY )
+ if ( eState <= SfxItemState::DISABLED )
{
pSizeBox->set_sensitive(false);
pSizeLabel->set_sensitive(false);
@@ -794,7 +778,6 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
pLangFT->set_sensitive(false);
pLangBox->set_sensitive(false);
break;
@@ -809,7 +792,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
pLangBox->set_active_id(eLangType);
break;
}
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
break;
}
@@ -829,6 +812,8 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
break;
}
+ EnableFeatureButton(*pNameBox);
+
// save these settings
pNameBox->save_value();
pStyleBox->save_value();
@@ -1075,31 +1060,40 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break;
case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break;
}
- nWhich = GetWhich( nSlot );
- pOld = GetOldItem( rSet, nSlot );
// For language list boxes acting as ComboBox, check for, add and select an
// edited entry.
- if (pLangBox == m_xWestFontLanguageLB.get())
+ switch (pLangBox->GetEditedAndValid())
{
- switch (pLangBox->GetEditedAndValid())
- {
- case SvxLanguageBox::EditedAndValid::No:
- ; // nothing to do
- break;
- case SvxLanguageBox::EditedAndValid::Valid:
+ case SvxLanguageBox::EditedAndValid::No:
+ ; // nothing to do
+ break;
+ case SvxLanguageBox::EditedAndValid::Valid:
+ {
+ SvxLanguageBox* ppBoxes[3]
+ = {m_xWestFontLanguageLB.get(), m_xEastFontLanguageLB.get(), m_xCTLFontLanguageLB.get()};
+ SvxLanguageBox* pBox = pLangBox->SaveEditedAsEntry(ppBoxes);
+ if (pBox != pLangBox)
{
- const int nPos = pLangBox->SaveEditedAsEntry();
- if (nPos != -1)
- pLangBox->set_active(nPos);
+ // Get item from corresponding slot.
+ if (pBox == m_xWestFontLanguageLB.get())
+ nSlot = SID_ATTR_CHAR_LANGUAGE;
+ else if (pBox == m_xEastFontLanguageLB.get())
+ nSlot = SID_ATTR_CHAR_CJK_LANGUAGE;
+ else if (pBox == m_xCTLFontLanguageLB.get())
+ nSlot = SID_ATTR_CHAR_CTL_LANGUAGE;
+ pLangBox = pBox;
}
- break;
- case SvxLanguageBox::EditedAndValid::Invalid:
- pLangBox->set_active_id(pLangBox->get_saved_active_id());
- break;
- }
+ }
+ break;
+ case SvxLanguageBox::EditedAndValid::Invalid:
+ pLangBox->set_active_id(pLangBox->get_saved_active_id());
+ break;
}
+ nWhich = GetWhich( nSlot );
+ pOld = GetOldItem( rSet, nSlot );
+
int nLangPos = pLangBox->get_active();
LanguageType eLangType = pLangBox->get_active_id();
@@ -1174,6 +1168,7 @@ void SvxCharNamePage::FontModifyHdl_Impl(const weld::Widget& rNameBox)
{
FillStyleBox_Impl(rNameBox);
FillSizeBox_Impl(rNameBox);
+ EnableFeatureButton(rNameBox);
}
}
@@ -1308,7 +1303,8 @@ SvxCharEffectsPage::SvxCharEffectsPage(weld::Container* pPage, weld::DialogContr
, m_bNewFontColor(false)
, m_bEnableNoneFontColor(false)
, m_xFontColorFT(m_xBuilder->weld_label("fontcolorft"))
- , m_xFontColorLB(new ColorListBox(m_xBuilder->weld_menu_button("fontcolorlb"), pController->getDialog()))
+ , m_xFontColorLB(new ColorListBox(m_xBuilder->weld_menu_button("fontcolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xFontTransparencyFT(m_xBuilder->weld_label("fonttransparencyft"))
, m_xFontTransparencyMtr(
m_xBuilder->weld_metric_spin_button("fonttransparencymtr", FieldUnit::PERCENT))
@@ -1321,11 +1317,13 @@ SvxCharEffectsPage::SvxCharEffectsPage(weld::Container* pPage, weld::DialogContr
, m_xHiddenBtn(m_xBuilder->weld_check_button("hiddencb"))
, m_xOverlineLB(m_xBuilder->weld_combo_box("overlinelb"))
, m_xOverlineColorFT(m_xBuilder->weld_label("overlinecolorft"))
- , m_xOverlineColorLB(new ColorListBox(m_xBuilder->weld_menu_button("overlinecolorlb"), pController->getDialog()))
+ , m_xOverlineColorLB(new ColorListBox(m_xBuilder->weld_menu_button("overlinecolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xStrikeoutLB(m_xBuilder->weld_combo_box("strikeoutlb"))
, m_xUnderlineLB(m_xBuilder->weld_combo_box("underlinelb"))
, m_xUnderlineColorFT(m_xBuilder->weld_label("underlinecolorft"))
- , m_xUnderlineColorLB(new ColorListBox(m_xBuilder->weld_menu_button("underlinecolorlb"), pController->getDialog()))
+ , m_xUnderlineColorLB(new ColorListBox(m_xBuilder->weld_menu_button("underlinecolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xIndividualWordsBtn(m_xBuilder->weld_check_button("individualwordscb"))
, m_xEmphasisFT(m_xBuilder->weld_label("emphasisft"))
, m_xEmphasisLB(m_xBuilder->weld_combo_box("emphasislb"))
@@ -1363,14 +1361,16 @@ void SvxCharEffectsPage::Initialize()
SetExchangeSupport();
// HTML-Mode
- const SfxPoolItem* pItem;
- SfxObjectShell* pShell;
- if ( SfxItemState::SET == GetItemSet().GetItemState( SID_HTML_MODE, false, &pItem ) ||
- ( nullptr != ( pShell = SfxObjectShell::Current() ) &&
- nullptr != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
+ const SfxUInt16Item* pHtmlModeItem = GetItemSet().GetItemIfSet( SID_HTML_MODE, false );
+ if ( !pHtmlModeItem)
+ {
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem( SID_HTML_MODE );
+ }
+ if (pHtmlModeItem)
{
- m_nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON )
+ sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
+ if ( ( nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON )
{
//!!! hide some controls please
}
@@ -1407,7 +1407,7 @@ void SvxCharEffectsPage::Initialize()
m_xOutlineBtn->connect_toggled(LINK(this, SvxCharEffectsPage, OutlineBtnClickHdl));
m_xShadowBtn->connect_toggled(LINK(this, SvxCharEffectsPage, ShadowBtnClickHdl));
- if ( !SvtLanguageOptions().IsAsianTypographyEnabled() )
+ if ( !SvtCJKOptions::IsAsianTypographyEnabled() )
{
m_xEmphasisFT->hide();
m_xEmphasisLB->hide();
@@ -1518,12 +1518,11 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xFontColorFT->set_sensitive(false);
m_xFontColorLB->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
//Related: tdf#106080 if there is no font color, then allow "none"
//as a color so the listbox can display that state.
EnableNoneFontColor();
@@ -1573,28 +1572,31 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
const SfxItemSet& rOldSet = GetItemSet();
- Color aSelectedColor;
+ NamedColor aSelectedColor;
bool bChanged = m_bNewFontColor;
if (bChanged)
{
- aSelectedColor = m_xFontColorLB->GetSelectEntryColor();
+ aSelectedColor = m_xFontColorLB->GetSelectedEntryThemedColor();
if (m_xFontTransparencyMtr->get_value_changed_from_saved())
{
double fTransparency
= m_xFontTransparencyMtr->get_value(FieldUnit::PERCENT) * 255.0 / 100;
- aSelectedColor.SetAlpha(255 - static_cast<sal_uInt8>(basegfx::fround(fTransparency)));
+ aSelectedColor.m_aColor.SetAlpha(255 - static_cast<sal_uInt8>(basegfx::fround(fTransparency)));
}
if (m_bOrigFontColor)
- bChanged = aSelectedColor != m_aOrigFontColor;
- if (m_bEnableNoneFontColor && bChanged && aSelectedColor == COL_NONE_COLOR)
+ bChanged = aSelectedColor.m_aColor != m_aOrigFontColor;
+ if (m_bEnableNoneFontColor && bChanged && aSelectedColor.m_aColor == COL_NONE_COLOR)
bChanged = false;
}
if (bChanged)
- rSet.Put( SvxColorItem( aSelectedColor, nWhich ) );
+ {
+ SvxColorItem aItem(aSelectedColor.m_aColor, aSelectedColor.getComplexColor(), nWhich);
+ rSet.Put(aItem);
+ }
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
rSet.InvalidateItem(nWhich);
@@ -1639,7 +1641,7 @@ void SvxCharEffectsPage::SelectHdl_Impl(const weld::ComboBox* pBox)
UpdatePreview_Impl();
}
-IMPL_LINK(SvxCharEffectsPage, CbClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxCharEffectsPage, CbClickHdl_Impl, weld::Toggleable&, rToggle, void)
{
m_aIndividualWordsState.ButtonToggled(rToggle);
UpdatePreview_Impl();
@@ -1687,9 +1689,9 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
m_xUnderlineLB->set_active( 0 );
SfxItemState eState = rSet->GetItemState( nWhich );
- if ( eState >= SfxItemState::DONTCARE )
+ if ( eState >= SfxItemState::INVALID )
{
- if ( eState == SfxItemState::DONTCARE )
+ if ( eState == SfxItemState::INVALID )
m_xUnderlineLB->set_active(-1);
else
{
@@ -1727,9 +1729,9 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
m_xOverlineLB->set_active( 0 );
eState = rSet->GetItemState( nWhich );
- if ( eState >= SfxItemState::DONTCARE )
+ if ( eState >= SfxItemState::INVALID )
{
- if ( eState == SfxItemState::DONTCARE )
+ if ( eState == SfxItemState::INVALID )
m_xOverlineLB->set_active(-1);
else
{
@@ -1767,9 +1769,9 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
m_xStrikeoutLB->set_active( 0 );
eState = rSet->GetItemState( nWhich );
- if ( eState >= SfxItemState::DONTCARE )
+ if ( eState >= SfxItemState::INVALID )
{
- if ( eState == SfxItemState::DONTCARE )
+ if ( eState == SfxItemState::INVALID )
m_xStrikeoutLB->set_active(-1);
else
{
@@ -1803,12 +1805,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_aIndividualWordsState.bTriStateEnabled = false;
m_xIndividualWordsBtn->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_aIndividualWordsState.bTriStateEnabled = true;
m_xIndividualWordsBtn->set_state( TRISTATE_INDET );
break;
@@ -1850,14 +1851,14 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
if (nPos != -1)
m_xPositionLB->set_active(nPos);
}
- else if ( eState == SfxItemState::DONTCARE )
+ else if ( eState == SfxItemState::INVALID )
m_xEmphasisLB->set_active(-1);
else if ( eState == SfxItemState::UNKNOWN )
{
m_xEmphasisFT->hide();
m_xEmphasisLB->hide();
}
- else // SfxItemState::DISABLED or SfxItemState::READONLY
+ else // SfxItemState::DISABLED
{
m_xEmphasisFT->set_sensitive(false);
m_xEmphasisLB->set_sensitive(false);
@@ -1881,12 +1882,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xEffectsFT->set_sensitive(false);
m_xEffectsLB->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xEffectsLB->set_active(-1);
break;
@@ -1911,12 +1911,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_xReliefFT->set_sensitive(false);
m_xReliefLB->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_xReliefLB->set_active(-1);
break;
@@ -1941,12 +1940,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_aOutlineState.bTriStateEnabled = false;
m_xOutlineBtn->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_aOutlineState.bTriStateEnabled = true;
m_xOutlineBtn->set_state(TRISTATE_INDET);
break;
@@ -1973,12 +1971,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_aShadowState.bTriStateEnabled = false;
m_xShadowBtn->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_aShadowState.bTriStateEnabled = true;
m_xShadowBtn->set_state( TRISTATE_INDET );
break;
@@ -2005,12 +2002,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
break;
case SfxItemState::DISABLED:
- case SfxItemState::READONLY:
m_aHiddenState.bTriStateEnabled = false;
m_xHiddenBtn->set_sensitive(false);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
m_aHiddenState.bTriStateEnabled = true;
m_xHiddenBtn->set_state(TRISTATE_INDET);
break;
@@ -2035,18 +2031,18 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
ChangesApplied();
}
-IMPL_LINK(SvxCharEffectsPage, HiddenBtnClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxCharEffectsPage, HiddenBtnClickHdl, weld::Toggleable&, rToggle, void)
{
m_aHiddenState.ButtonToggled(rToggle);
}
-IMPL_LINK(SvxCharEffectsPage, OutlineBtnClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxCharEffectsPage, OutlineBtnClickHdl, weld::Toggleable&, rToggle, void)
{
m_aOutlineState.ButtonToggled(rToggle);
UpdatePreview_Impl();
}
-IMPL_LINK(SvxCharEffectsPage, ShadowBtnClickHdl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxCharEffectsPage, ShadowBtnClickHdl, weld::Toggleable&, rToggle, void)
{
m_aShadowState.ButtonToggled(rToggle);
UpdatePreview_Impl();
@@ -2087,21 +2083,26 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
//! item-state in the 'rOldSet' will be invalid. In this case
//! changing the underline style will be allowed if a style is
//! selected in the listbox.
- bool bAllowChg = nPos != -1 &&
+ bool bAllowChange = nPos != -1 &&
SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
const SvxUnderlineItem& rItem = *static_cast<const SvxUnderlineItem*>(pOld);
- if ( rItem.GetValue() == eUnder &&
- ( LINESTYLE_NONE == eUnder || rItem.GetColor() == m_xUnderlineColorLB->GetSelectEntryColor() ) &&
- ! bAllowChg )
+ if (rItem.GetValue() == eUnder &&
+ (LINESTYLE_NONE == eUnder || (rItem.GetColor() == m_xUnderlineColorLB->GetSelectEntryColor() &&
+ rItem.getComplexColor() == m_xUnderlineColorLB->GetSelectedEntry().getComplexColor())) &&
+ !bAllowChange)
+ {
bChanged = false;
+ }
}
if ( bChanged )
{
SvxUnderlineItem aNewItem( eUnder, nWhich );
- aNewItem.SetColor( m_xUnderlineColorLB->GetSelectEntryColor() );
- rSet->Put( aNewItem );
+ auto aNamedColor = m_xUnderlineColorLB->GetSelectedEntry();
+ aNewItem.SetColor(aNamedColor.m_aColor);
+ aNewItem.setComplexColor(aNamedColor.getComplexColor());
+ rSet->Put(aNewItem);
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -2121,21 +2122,26 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
//! item-state in the 'rOldSet' will be invalid. In this case
//! changing the underline style will be allowed if a style is
//! selected in the listbox.
- bool bAllowChg = nPos != -1 &&
+ bool bAllowChange = nPos != -1 &&
SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
const SvxOverlineItem& rItem = *static_cast<const SvxOverlineItem*>(pOld);
- if ( rItem.GetValue() == eOver &&
- ( LINESTYLE_NONE == eOver || rItem.GetColor() == m_xOverlineColorLB->GetSelectEntryColor() ) &&
- ! bAllowChg )
+ if (rItem.GetValue() == eOver &&
+ (LINESTYLE_NONE == eOver || (rItem.GetColor() == m_xOverlineColorLB->GetSelectEntryColor() &&
+ rItem.getComplexColor() == m_xOverlineColorLB->GetSelectedEntry().getComplexColor())) &&
+ !bAllowChange)
+ {
bChanged = false;
+ }
}
if ( bChanged )
{
SvxOverlineItem aNewItem( eOver, nWhich );
- aNewItem.SetColor( m_xOverlineColorLB->GetSelectEntryColor() );
- rSet->Put( aNewItem );
+ auto aNamedColor = m_xOverlineColorLB->GetSelectedEntry();
+ aNewItem.SetColor(aNamedColor.m_aColor);
+ aNewItem.setComplexColor(aNamedColor.getComplexColor());
+ rSet->Put(aNewItem);
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -2217,7 +2223,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
if ( pOld )
{
- if( rOldSet.GetItemState( nWhich ) != SfxItemState::DONTCARE )
+ if( rOldSet.GetItemState( nWhich ) != SfxItemState::INVALID )
{
const SvxEmphasisMarkItem& rItem = *static_cast<const SvxEmphasisMarkItem*>(pOld);
if ( rItem.GetEmphasisMark() == eMark )
@@ -2225,7 +2231,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
}
}
- if (rOldSet.GetItemState( nWhich ) == SfxItemState::DONTCARE &&
+ if (rOldSet.GetItemState( nWhich ) == SfxItemState::INVALID &&
m_xEmphasisLB->get_saved_value() == sMarkPos && m_xPositionLB->get_saved_value() == sPosPos)
{
bChanged = false;
@@ -2233,7 +2239,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
if (bChanged)
{
- rSet->Put( SvxEmphasisMarkItem( eMark, nWhich ) );
+ rSet->Put( SvxEmphasisMarkItem( eMark, TypedWhichId<SvxEmphasisMarkItem>(nWhich) ) );
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -2384,10 +2390,7 @@ void SvxCharEffectsPage::PageCreated(const SfxAllItemSet& aSet)
if (pDisableCtlItem)
DisableControls(pDisableCtlItem->GetValue());
- if (!pFlagItem)
- return;
-
- sal_uInt32 nFlags=pFlagItem->GetValue();
+ sal_uInt32 nFlags = pFlagItem ? pFlagItem->GetValue() : 0;
if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
// the writer uses SID_ATTR_BRUSH as font background
m_bPreviewBackgroundToCharacter = true;
@@ -2427,6 +2430,7 @@ SvxCharPositionPage::SvxCharPositionPage(weld::Container* pPage, weld::DialogCon
, m_xScaleWidthMF(m_xBuilder->weld_metric_spin_button("scalewidthsb", FieldUnit::PERCENT))
, m_xKerningMF(m_xBuilder->weld_metric_spin_button("kerningsb", FieldUnit::POINT))
, m_xPairKerningBtn(m_xBuilder->weld_check_button("pairkerning"))
+ , m_xNoHyphenationBtn(m_xBuilder->weld_check_button("nohyphenation"))
{
m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
#ifdef IOS
@@ -2452,7 +2456,7 @@ void SvxCharPositionPage::Initialize()
m_xNormalPosBtn->set_active(true);
PositionHdl_Impl(*m_xNormalPosBtn);
- Link<weld::ToggleButton&,void> aLink2 = LINK(this, SvxCharPositionPage, PositionHdl_Impl);
+ Link<weld::Toggleable&,void> aLink2 = LINK(this, SvxCharPositionPage, PositionHdl_Impl);
m_xHighPosBtn->connect_toggled(aLink2);
m_xNormalPosBtn->connect_toggled(aLink2);
m_xLowPosBtn->connect_toggled(aLink2);
@@ -2525,7 +2529,7 @@ void SvxCharPositionPage::SetEscapement_Impl( SvxEscapement nEsc )
}
-IMPL_LINK_NOARG(SvxCharPositionPage, PositionHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxCharPositionPage, PositionHdl_Impl, weld::Toggleable&, void)
{
SvxEscapement nEsc = SvxEscapement::Off; // also when pBtn == NULL
@@ -2537,7 +2541,7 @@ IMPL_LINK_NOARG(SvxCharPositionPage, PositionHdl_Impl, weld::ToggleButton&, void
SetEscapement_Impl( nEsc );
}
-IMPL_LINK_NOARG(SvxCharPositionPage, RotationHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxCharPositionPage, RotationHdl_Impl, weld::Toggleable&, void)
{
bool bEnable = false;
if (m_x90degRB->get_active() || m_x270degRB->get_active())
@@ -2555,7 +2559,7 @@ void SvxCharPositionPage::FontModifyHdl_Impl()
UpdatePreview_Impl( 100, nEscProp, nEsc );
}
-IMPL_LINK(SvxCharPositionPage, AutoPositionHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxCharPositionPage, AutoPositionHdl_Impl, weld::Toggleable&, rBox, void)
{
if (rBox.get_active())
{
@@ -2568,7 +2572,7 @@ IMPL_LINK(SvxCharPositionPage, AutoPositionHdl_Impl, weld::ToggleButton&, rBox,
: *m_xNormalPosBtn);
}
-IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::Toggleable&, void)
{
sal_uInt16 nVal = m_nScaleWidthInitialVal;
if (m_xFitToLineCB->get_active())
@@ -2580,7 +2584,8 @@ IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::ToggleButton&, voi
IMPL_LINK_NOARG(SvxCharPositionPage, KerningModifyHdl_Impl, weld::MetricSpinButton&, void)
{
tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
- nVal = OutputDevice::LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip );
+ nVal = o3tl::convert(nVal, o3tl::Length::pt, o3tl::Length::twip);
+
tools::Long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
SvxFont& rFont = GetPreviewFont();
@@ -2641,10 +2646,10 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
if ( !sUser.isEmpty() )
{
sal_Int32 nIdx {0};
- m_nSuperEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32());
- m_nSubEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32());
- m_nSuperProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32());
- m_nSubProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32());
+ m_nSuperEsc = static_cast<short>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx )));
+ m_nSubEsc = static_cast<short>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx )));
+ m_nSuperProp = static_cast<sal_uInt8>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx )));
+ m_nSubProp = static_cast<sal_uInt8>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx )));
m_xHighLowMF->set_max(MAX_ESC_POS, FieldUnit::PERCENT);
@@ -2704,7 +2709,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
m_xHighPosBtn->set_active(true);
if ( nEsc == DFLT_ESC_AUTO_SUPER )
{
- nEsc = DFLT_ESC_SUPER;
+ nEsc = .8 * (100 - nEscProp); //approximation of actual percentage used
bAutomatic = true;
}
}
@@ -2714,7 +2719,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
m_xLowPosBtn->set_active(true);
if ( nEsc == DFLT_ESC_AUTO_SUB )
{
- nEsc = DFLT_ESC_SUB;
+ nEsc = .2 * -(100 - nEscProp); //approximation of actual percentage used
bAutomatic = true;
}
}
@@ -2745,6 +2750,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
m_xHighPosBtn->set_active(false);
m_xNormalPosBtn->set_active(false);
m_xLowPosBtn->set_active(false);
+
+ m_xHighLowRB->set_active(true);
}
// set BspFont
@@ -2766,10 +2773,13 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
rCJKFont.SetFixKerning( static_cast<short>(nKern) );
rCTLFont.SetFixKerning( static_cast<short>(nKern) );
- //the attribute value must be displayed also if it's above the maximum allowed value
+ //the attribute value must be displayed also if it's above/below the maximum allowed value
tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_max(FieldUnit::POINT));
if(nVal < nKerning)
m_xKerningMF->set_max(nKerning, FieldUnit::POINT);
+ nVal = static_cast<tools::Long>(m_xKerningMF->get_min(FieldUnit::POINT));
+ if (nVal > nKerning)
+ m_xKerningMF->set_min(nKerning, FieldUnit::POINT);
m_xKerningMF->set_value(nKerning, FieldUnit::POINT);
}
else
@@ -2786,6 +2796,16 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
else
m_xPairKerningBtn->set_active(false);
+ // No hyphenation
+ nWhich = GetWhich( sal_uInt16(19) ); // number borrowed from RES_CHRATR_NOHYPHEN
+ if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
+ {
+ const SvxNoHyphenItem& rItem = static_cast<const SvxNoHyphenItem&>(rSet->Get( nWhich ));
+ m_xNoHyphenationBtn->set_active(rItem.GetValue());
+ }
+ else
+ m_xNoHyphenationBtn->set_active(false);
+
// Scale Width
nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
@@ -2797,9 +2817,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
else
m_xScaleWidthMF->set_value(100, FieldUnit::PERCENT);
- nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE );
- if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
- m_nScaleWidthItemSetVal = static_cast<const SfxUInt16Item&>( rSet->Get( nWhich )).GetValue();
+ if ( rSet->GetItemState( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) >= SfxItemState::DEFAULT )
+ m_nScaleWidthItemSetVal = rSet->Get( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ).GetValue();
// Rotation
nWhich = GetWhich( SID_ATTR_CHAR_ROTATED );
@@ -2833,7 +2852,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
}
else
{
- if( eState == SfxItemState::DONTCARE )
+ if( eState == SfxItemState::INVALID )
{
m_x0degRB->set_active(false);
m_x90degRB->set_active(false);
@@ -2847,8 +2866,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
m_xFitToLineCB->set_sensitive(!m_x0degRB->get_active());
// is this value set?
- if( SfxItemState::UNKNOWN == rSet->GetItemState( GetWhich(
- SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) ))
+ if( SfxItemState::UNKNOWN == rSet->GetItemState(
+ SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ))
m_xFitToLineCB->hide();
}
ChangesApplied();
@@ -2867,6 +2886,7 @@ void SvxCharPositionPage::ChangesApplied()
m_xScaleWidthMF->save_value();
m_xKerningMF->save_value();
m_xPairKerningBtn->save_state();
+ m_xNoHyphenationBtn->save_state();
}
bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
@@ -2956,11 +2976,23 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
rSet->InvalidateItem(nWhich);
+ // No hyphenation
+
+ nWhich = GetWhich( sal_uInt16(19) ); // number borrowed from RES_CHRATR_NOHYPHEN
+
+ if (m_xNoHyphenationBtn->get_state_changed_from_saved())
+ {
+ rSet->Put( SvxNoHyphenItem( m_xNoHyphenationBtn->get_active(), nWhich ) );
+ bModified = true;
+ }
+ else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
+ rSet->InvalidateItem(nWhich);
+
// Scale Width
nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
if (m_xScaleWidthMF->get_value_changed_from_saved())
{
- rSet->Put(SvxCharScaleWidthItem(static_cast<sal_uInt16>(m_xScaleWidthMF->get_value(FieldUnit::PERCENT)), nWhich));
+ rSet->Put(SvxCharScaleWidthItem(static_cast<sal_uInt16>(m_xScaleWidthMF->get_value(FieldUnit::PERCENT)), TypedWhichId<SvxCharScaleWidthItem>(nWhich)));
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -2973,7 +3005,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
m_x270degRB->get_state_changed_from_saved() ||
m_xFitToLineCB->get_state_changed_from_saved() )
{
- SvxCharRotateItem aItem( 0_deg10, m_xFitToLineCB->get_active(), nWhich );
+ SvxCharRotateItem aItem( 0_deg10, m_xFitToLineCB->get_active(), TypedWhichId<SvxCharRotateItem>(nWhich) );
if (m_x90degRB->get_active())
aItem.SetBottomToTop();
else if (m_x270degRB->get_active())
@@ -2990,7 +3022,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
void SvxCharPositionPage::FillUserData()
{
- const OUString cTok( ";" );
+ static constexpr OUString cTok( u";"_ustr );
OUString sUser = OUString::number( m_nSuperEsc ) + cTok +
OUString::number( m_nSubEsc ) + cTok +
@@ -3022,9 +3054,9 @@ SvxCharTwoLinesPage::SvxCharTwoLinesPage(weld::Container* pPage, weld::DialogCon
, m_xStartBracketLB(m_xBuilder->weld_tree_view("startbracket"))
, m_xEndBracketLB(m_xBuilder->weld_tree_view("endbracket"))
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(TWOLINE_OPEN); ++i)
+ for (size_t i = 0; i < std::size(TWOLINE_OPEN); ++i)
m_xStartBracketLB->append(OUString::number(TWOLINE_OPEN[i].second), CuiResId(TWOLINE_OPEN[i].first));
- for (size_t i = 0; i < SAL_N_ELEMENTS(TWOLINE_CLOSE); ++i)
+ for (size_t i = 0; i < std::size(TWOLINE_CLOSE); ++i)
m_xEndBracketLB->append(OUString::number(TWOLINE_CLOSE[i].second), CuiResId(TWOLINE_CLOSE[i].first));
m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
@@ -3112,7 +3144,7 @@ void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, bool bStart )
m_nEndBracketPosition = nEntryPos;
}
-IMPL_LINK_NOARG(SvxCharTwoLinesPage, TwoLinesHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxCharTwoLinesPage, TwoLinesHdl_Impl, weld::Toggleable&, void)
{
bool bChecked = m_xTwoLinesBtn->get_active();
m_xEnclosingFrame->set_sensitive(bChecked);
@@ -3158,7 +3190,7 @@ void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet )
sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
SfxItemState eState = rSet->GetItemState( nWhich );
- if ( eState >= SfxItemState::DONTCARE )
+ if ( eState >= SfxItemState::INVALID )
{
const SvxTwoLinesItem& rItem = static_cast<const SvxTwoLinesItem&>(rSet->Get( nWhich ));
m_xTwoLinesBtn->set_active(rItem.GetValue());
diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
index 70b38bbc95af..b3d036d991f9 100644
--- a/cui/source/tabpages/connect.cxx
+++ b/cui/source/tabpages/connect.cxx
@@ -33,12 +33,8 @@
#include <connect.hxx>
-const sal_uInt16 SvxConnectionPage::pRanges[] =
-{
- SDRATTR_EDGE_FIRST,
- SDRATTR_EDGE_LAST,
- 0
-};
+const WhichRangesContainer SvxConnectionPage::pRanges(
+ svl::Items<SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST>);
/*************************************************************************
|*
@@ -54,7 +50,7 @@ SvxConnectionDialog::SvxConnectionDialog(weld::Window* pParent, const SfxItemSet
xPage->Construct();
SetTabPage(std::move(xPage));
- m_xDialog->set_title(CuiResId(RID_SVXSTR_CONNECTOR));
+ m_xDialog->set_title(CuiResId(RID_CUISTR_CONNECTOR));
}
/*************************************************************************
@@ -122,6 +118,17 @@ SvxConnectionPage::~SvxConnectionPage()
m_xCtlPreview.reset();
}
+template<class T>
+void SvxConnectionPage::SetMetricValueAndSave(const SfxItemSet* rAttrs, weld::MetricSpinButton& rField, TypedWhichId<T> nWhich)
+{
+ const SfxPoolItem* pItem = GetItem( *rAttrs, nWhich);
+ const SfxItemPool* pPool = rAttrs->GetPool();
+ if( !pItem )
+ pItem = &pPool->GetUserOrPoolDefaultItem( nWhich );
+ SetMetricValue(rField, pItem->StaticWhichCast(nWhich).GetValue(), eUnit);
+ rField.save_value();
+}
+
/*************************************************************************
|*
|* reads passed Item-Set
@@ -130,66 +137,35 @@ SvxConnectionPage::~SvxConnectionPage()
void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
{
- const SfxPoolItem* pItem = GetItem( *rAttrs, SDRATTR_EDGENODE1HORZDIST );
+ const SfxPoolItem* pItem;
const SfxItemPool* pPool = rAttrs->GetPool();
// SdrEdgeNode1HorzDistItem
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1HORZDIST );
- SetMetricValue(*m_xMtrFldHorz1, static_cast<const SdrEdgeNode1HorzDistItem*>(pItem)->GetValue(),
- eUnit);
- m_xMtrFldHorz1->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldHorz1, SDRATTR_EDGENODE1HORZDIST);
// SdrEdgeNode2HorzDistItem
- pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2HORZDIST );
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2HORZDIST );
- SetMetricValue(*m_xMtrFldHorz2, static_cast<const SdrEdgeNode2HorzDistItem*>(pItem)->GetValue(),
- eUnit);
- m_xMtrFldHorz2->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldHorz2, SDRATTR_EDGENODE2HORZDIST);
// SdrEdgeNode1VertDistItem
- pItem = GetItem( *rAttrs, SDRATTR_EDGENODE1VERTDIST );
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1VERTDIST );
- SetMetricValue(*m_xMtrFldVert1, static_cast<const SdrEdgeNode1VertDistItem*>(pItem)->GetValue(),
- eUnit);
- m_xMtrFldVert1->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldVert1, SDRATTR_EDGENODE1VERTDIST);
// SdrEdgeNode2VertDistItem
- pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2VERTDIST );
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2VERTDIST );
- SetMetricValue(*m_xMtrFldVert2, static_cast<const SdrEdgeNode2VertDistItem*>(pItem)->GetValue(),
- eUnit);
- m_xMtrFldVert2->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldVert2, SDRATTR_EDGENODE2VERTDIST);
// SdrEdgeLine1DeltaItem
- pItem = GetItem( *rAttrs, SDRATTR_EDGELINE1DELTA );
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE1DELTA );
- SetMetricValue(*m_xMtrFldLine1, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
- m_xMtrFldLine1->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldLine1, SDRATTR_EDGELINE1DELTA);
// SdrEdgeLine2DeltaItem
- pItem = GetItem( *rAttrs, SDRATTR_EDGELINE2DELTA );
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE2DELTA );
- SetMetricValue(*m_xMtrFldLine2, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
- m_xMtrFldLine2->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldLine2, SDRATTR_EDGELINE2DELTA);
// SdrEdgeLine3DeltaItem
- pItem = GetItem( *rAttrs, SDRATTR_EDGELINE3DELTA );
- if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE3DELTA );
- SetMetricValue(*m_xMtrFldLine3, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
- m_xMtrFldLine3->save_value();
+ SetMetricValueAndSave(rAttrs, *m_xMtrFldLine3, SDRATTR_EDGELINE3DELTA);
// SdrEdgeLineDeltaAnzItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINEDELTACOUNT );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINEDELTACOUNT );
- switch (static_cast<const SdrEdgeLineDeltaCountItem*>(pItem)->GetValue())
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_EDGELINEDELTACOUNT );
+ switch (pItem->StaticWhichCast(SDRATTR_EDGELINEDELTACOUNT).GetValue())
{
case 0:
m_xFtLine1->set_sensitive(false);
@@ -211,9 +187,9 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
// SdrEdgeKindItem
pItem = GetItem( *rAttrs, SDRATTR_EDGEKIND );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_EDGEKIND );
m_xLbType->set_active(
- sal::static_int_cast<sal_uInt16>(static_cast<const SdrEdgeKindItem*>(pItem)->GetValue()));
+ sal::static_int_cast<sal_uInt16>(pItem->StaticWhichCast(SDRATTR_EDGEKIND).GetValue()));
m_xLbType->save_value();
}
@@ -398,8 +374,8 @@ void SvxConnectionPage::FillTypeLB()
const SfxItemPool* pPool = rOutAttrs.GetPool();
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND );
- const SdrEdgeKindItem* pEdgeKindItem = static_cast<const SdrEdgeKindItem*>(pItem);
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_EDGEKIND );
+ const SdrEdgeKindItem* pEdgeKindItem = &pItem->StaticWhichCast(SDRATTR_EDGEKIND);
const sal_uInt16 nCount = pEdgeKindItem->GetValueCount();
for (sal_uInt16 i = 0; i < nCount; i++)
{
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 569329e3a160..9e96fdbb603c 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -32,6 +32,7 @@
#include <svx/svxids.hrc>
#include <strings.hrc>
#include <vcl/fieldvalues.hxx>
+#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <svtools/unitconv.hxx>
@@ -39,6 +40,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <o3tl/unit_conversion.hxx>
+#include <officecfg/Office/Common.hxx>
constexpr auto CM_1_TO_TWIP = o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip); // 567
@@ -54,9 +56,10 @@ static int lcl_GetValue(const weld::MetricSpinButton& rMetric, FieldUnit eUnit)
SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet)
: SfxTabPage(pPage, pController, "cui/ui/croppage.ui", "CropPage", &rSet)
- , nOldWidth(0)
- , nOldHeight(0)
- , bSetOrigSize(false)
+ , m_nOldWidth(0)
+ , m_nOldHeight(0)
+ , m_bSetOrigSize(false)
+ , m_aPreferredDPI(0)
, m_xCropFrame(m_xBuilder->weld_widget("cropframe"))
, m_xZoomConstRB(m_xBuilder->weld_radio_button("keepscale"))
, m_xSizeConstRB(m_xBuilder->weld_radio_button("keepsize"))
@@ -73,6 +76,7 @@ SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, weld::DialogController* p
, m_xOrigSizeGrid(m_xBuilder->weld_widget("origsizegrid"))
, m_xOrigSizeFT(m_xBuilder->weld_label("origsizeft"))
, m_xOrigSizePB(m_xBuilder->weld_button("origsize"))
+ , m_xUncropPB(m_xBuilder->weld_button("uncrop"))
, m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "preview", m_aExampleWN))
{
SetExchangeSupport();
@@ -102,6 +106,7 @@ SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, weld::DialogController* p
m_xBottomMF->connect_value_changed( aLk );
m_xOrigSizePB->connect_clicked(LINK(this, SvxGrfCropPage, OrigSizeHdl));
+ m_xUncropPB->connect_clicked(LINK(this, SvxGrfCropPage, UncropHdl));
}
SvxGrfCropPage::~SvxGrfCropPage()
@@ -119,7 +124,7 @@ void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
const SfxPoolItem* pItem;
const SfxItemPool& rPool = *rSet->GetPool();
- if(SfxItemState::SET == rSet->GetItemState( rPool.GetWhich(
+ if(SfxItemState::SET == rSet->GetItemState( rPool.GetWhichIDFromSlotID(
SID_ATTR_GRAF_KEEP_ZOOM ), true, &pItem ))
{
if( static_cast<const SfxBoolItem*>(pItem)->GetValue() )
@@ -129,7 +134,7 @@ void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
m_xZoomConstRB->save_state();
}
- sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_CROP );
+ sal_uInt16 nW = rPool.GetWhichIDFromSlotID( SID_ATTR_GRAF_CROP );
if( SfxItemState::SET == rSet->GetItemState( nW, true, &pItem))
{
FieldUnit eUnit = MapToFieldUnit( rSet->GetPool()->GetMetric( nW ));
@@ -159,55 +164,54 @@ void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
m_xTopMF->save_value();
m_xBottomMF->save_value();
- nW = rPool.GetWhich( SID_ATTR_PAGE_SIZE );
+ nW = rPool.GetWhichIDFromSlotID( SID_ATTR_PAGE_SIZE );
if ( SfxItemState::SET == rSet->GetItemState( nW, false, &pItem ) )
{
// orientation and size from the PageItem
FieldUnit eUnit = MapToFieldUnit( rSet->GetPool()->GetMetric( nW ));
- aPageSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
+ m_aPageSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
auto nMin = m_xWidthMF->normalize( 23 );
- auto nMax = m_xHeightMF->normalize(aPageSize.Height());
+ auto nMax = m_xHeightMF->normalize(m_aPageSize.Height());
m_xHeightMF->set_range(nMin, nMax, eUnit);
- nMax = m_xWidthMF->normalize(aPageSize.Width());
+ nMax = m_xWidthMF->normalize(m_aPageSize.Width());
m_xWidthMF->set_range(nMin, nMax, eUnit);
}
else
{
- aPageSize = OutputDevice::LogicToLogic(
+ m_aPageSize = OutputDevice::LogicToLogic(
Size( CM_1_TO_TWIP, CM_1_TO_TWIP ),
MapMode( MapUnit::MapTwip ),
MapMode( rSet->GetPool()->GetMetric( nW ) ) );
}
bool bFound = false;
- if( SfxItemState::SET == rSet->GetItemState( SID_ATTR_GRAF_GRAPHIC, false, &pItem ) )
+ if( const SvxBrushItem* pGraphicItem = rSet->GetItemIfSet( SID_ATTR_GRAF_GRAPHIC, false ) )
{
OUString referer;
- SfxStringItem const * it = static_cast<SfxStringItem const *>(
- rSet->GetItem(SID_REFERER));
+ SfxStringItem const * it = rSet->GetItem(SID_REFERER);
if (it != nullptr) {
referer = it->GetValue();
}
- const Graphic* pGrf = static_cast<const SvxBrushItem*>(pItem)->GetGraphic(referer);
+ const Graphic* pGrf = pGraphicItem->GetGraphic(referer);
if( pGrf )
{
- aOrigSize = GetGrfOrigSize( *pGrf );
- if (pGrf->GetType() == GraphicType::Bitmap && aOrigSize.Width() && aOrigSize.Height())
+ m_aOrigSize = GetGrfOrigSize( *pGrf );
+ if (pGrf->GetType() == GraphicType::Bitmap && m_aOrigSize.Width() && m_aOrigSize.Height())
{
- aOrigPixelSize = pGrf->GetSizePixel();
+ m_aOrigPixelSize = pGrf->GetSizePixel();
}
- if( aOrigSize.Width() && aOrigSize.Height() )
+ if( m_aOrigSize.Width() && m_aOrigSize.Height() )
{
CalcMinMaxBorder();
m_aExampleWN.SetGraphic( *pGrf );
- m_aExampleWN.SetFrameSize( aOrigSize );
+ m_aExampleWN.SetFrameSize( m_aOrigSize );
bFound = true;
- if( !static_cast<const SvxBrushItem*>(pItem)->GetGraphicLink().isEmpty() )
- aGraphicName = static_cast<const SvxBrushItem*>(pItem)->GetGraphicLink();
+ if( !pGraphicItem->GetGraphicLink().isEmpty() )
+ m_aGraphicName = pGraphicItem->GetGraphicLink();
}
}
}
@@ -223,21 +227,21 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet)
if( m_xWidthMF->get_value_changed_from_saved() ||
m_xHeightMF->get_value_changed_from_saved() )
{
- sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_FRMSIZE );
+ constexpr TypedWhichId<SvxSizeItem> nW = SID_ATTR_GRAF_FRMSIZE;
FieldUnit eUnit = MapToFieldUnit( rSet->GetPool()->GetMetric( nW ));
std::shared_ptr<SvxSizeItem> aSz(std::make_shared<SvxSizeItem>(nW));
// size could already have been set from another page
const SfxItemSet* pExSet = GetDialogExampleSet();
- const SfxPoolItem* pItem = nullptr;
- if( pExSet && SfxItemState::SET ==pExSet->GetItemState( nW, false, &pItem ) )
+ const SvxSizeItem* pSizeItem = nullptr;
+ if( pExSet && (pSizeItem = pExSet->GetItemIfSet( nW, false )) )
{
- aSz.reset(static_cast< SvxSizeItem*>(pItem->Clone()));
+ aSz.reset(pSizeItem->Clone());
}
else
{
- aSz.reset(static_cast< SvxSizeItem*>(GetItemSet().Get(nW).Clone()));
+ aSz.reset(GetItemSet().Get(nW).Clone());
}
Size aTmpSz( aSz->GetSize() );
@@ -251,16 +255,16 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet)
bModified |= nullptr != rSet->Put( *aSz );
- if( bSetOrigSize )
+ if (m_bSetOrigSize)
{
- bModified |= nullptr != rSet->Put( SvxSizeItem( rPool.GetWhich(
+ bModified |= nullptr != rSet->Put( SvxSizeItem( rPool.GetWhichIDFromSlotID(
SID_ATTR_GRAF_FRMSIZE_PERCENT ), Size( 0, 0 )) );
}
}
if( m_xLeftMF->get_value_changed_from_saved() || m_xRightMF->get_value_changed_from_saved() ||
m_xTopMF->get_value_changed_from_saved() || m_xBottomMF->get_value_changed_from_saved() )
{
- sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_CROP );
+ sal_uInt16 nW = rPool.GetWhichIDFromSlotID( SID_ATTR_GRAF_CROP );
FieldUnit eUnit = MapToFieldUnit( rSet->GetPool()->GetMetric( nW ));
std::unique_ptr<SvxGrfCrop> pNew(static_cast<SvxGrfCrop*>(rSet->Get( nW ).Clone()));
@@ -268,12 +272,12 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet)
pNew->SetRight( lcl_GetValue( *m_xRightMF, eUnit ) );
pNew->SetTop( lcl_GetValue( *m_xTopMF, eUnit ) );
pNew->SetBottom( lcl_GetValue( *m_xBottomMF, eUnit ) );
- bModified |= nullptr != rSet->Put( *pNew );
+ bModified |= nullptr != rSet->Put( std::move(pNew) );
}
if( m_xZoomConstRB->get_state_changed_from_saved() )
{
- bModified |= nullptr != rSet->Put( SfxBoolItem( rPool.GetWhich(
+ bModified |= nullptr != rSet->Put( SfxBoolItem( rPool.GetWhichIDFromSlotID(
SID_ATTR_GRAF_KEEP_ZOOM), m_xZoomConstRB->get_active() ) );
}
@@ -287,19 +291,23 @@ void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet)
DBG_ASSERT( pPool, "Where is the pool?" );
#endif
- bSetOrigSize = false;
+ auto& aProperties = getAdditionalProperties();
+ auto aIterator = aProperties.find("PreferredDPI");
+ if (aIterator != aProperties.end())
+ m_aPreferredDPI = aIterator->second.get<sal_Int32>();
+
+ m_bSetOrigSize = false;
// Size
Size aSize;
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRAF_FRMSIZE, false, &pItem ) )
- aSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
+ if( const SvxSizeItem* pFrmSizeItem = rSet.GetItemIfSet( SID_ATTR_GRAF_FRMSIZE, false ) )
+ aSize = pFrmSizeItem->GetSize();
- nOldWidth = aSize.Width();
- nOldHeight = aSize.Height();
+ m_nOldWidth = aSize.Width();
+ m_nOldHeight = aSize.Height();
- auto nWidth = m_xWidthMF->normalize(nOldWidth);
- auto nHeight = m_xHeightMF->normalize(nOldHeight);
+ auto nWidth = m_xWidthMF->normalize(m_nOldWidth);
+ auto nHeight = m_xHeightMF->normalize(m_nOldHeight);
if (nWidth != m_xWidthMF->get_value(FieldUnit::TWIP))
m_xWidthMF->set_value(nWidth, FieldUnit::TWIP);
@@ -309,29 +317,27 @@ void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet)
m_xHeightMF->set_value(nHeight, FieldUnit::TWIP);
m_xHeightMF->save_value();
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, false, &pItem ) )
+ if( const SvxBrushItem* pBrushItem = rSet.GetItemIfSet( SID_ATTR_GRAF_GRAPHIC, false ) )
{
- const SvxBrushItem& rBrush = *static_cast<const SvxBrushItem*>(pItem);
- if( !rBrush.GetGraphicLink().isEmpty() &&
- aGraphicName != rBrush.GetGraphicLink() )
- aGraphicName = rBrush.GetGraphicLink();
+ if( !pBrushItem->GetGraphicLink().isEmpty() &&
+ m_aGraphicName != pBrushItem->GetGraphicLink() )
+ m_aGraphicName = pBrushItem->GetGraphicLink();
OUString referer;
- SfxStringItem const * it = static_cast<SfxStringItem const *>(
- rSet.GetItem(SID_REFERER));
+ SfxStringItem const * it = rSet.GetItem(SID_REFERER);
if (it != nullptr) {
referer = it->GetValue();
}
- const Graphic* pGrf = rBrush.GetGraphic(referer);
+ const Graphic* pGrf = pBrushItem->GetGraphic(referer);
if( pGrf )
{
m_aExampleWN.SetGraphic( *pGrf );
- aOrigSize = GetGrfOrigSize( *pGrf );
- if (pGrf->GetType() == GraphicType::Bitmap && aOrigSize.Width() > 1 && aOrigSize.Height() > 1) {
- aOrigPixelSize = pGrf->GetSizePixel();
+ m_aOrigSize = GetGrfOrigSize( *pGrf );
+ if (pGrf->GetType() == GraphicType::Bitmap && m_aOrigSize.Width() > 1 && m_aOrigSize.Height() > 1) {
+ m_aOrigPixelSize = pGrf->GetSizePixel();
}
- m_aExampleWN.SetFrameSize(aOrigSize);
- GraphicHasChanged( aOrigSize.Width() && aOrigSize.Height() );
+ m_aExampleWN.SetFrameSize(m_aOrigSize);
+ GraphicHasChanged( m_aOrigSize.Width() && m_aOrigSize.Height() );
CalcMinMaxBorder();
}
else
@@ -356,7 +362,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) );
if (&rField == m_xWidthZoomMF.get())
@@ -364,7 +370,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
tools::Long nLRBorders = lcl_GetValue(*m_xLeftMF, eUnit)
+lcl_GetValue(*m_xRightMF, eUnit);
m_xWidthMF->set_value( m_xWidthMF->normalize(
- ((aOrigSize.Width() - nLRBorders) * rField.get_value(FieldUnit::NONE))/100),
+ ((m_aOrigSize.Width() - nLRBorders) * rField.get_value(FieldUnit::NONE))/100),
eUnit);
}
else
@@ -372,7 +378,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
tools::Long nULBorders = lcl_GetValue(*m_xTopMF, eUnit)
+lcl_GetValue(*m_xBottomMF, eUnit);
m_xHeightMF->set_value( m_xHeightMF->normalize(
- ((aOrigSize.Height() - nULBorders ) * rField.get_value(FieldUnit::NONE))/100) ,
+ ((m_aOrigSize.Height() - nULBorders ) * rField.get_value(FieldUnit::NONE))/100) ,
eUnit );
}
}
@@ -385,7 +391,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) );
Size aSize( lcl_GetValue(*m_xWidthMF, eUnit),
@@ -393,7 +399,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
if(&rField == m_xWidthMF.get())
{
- tools::Long nWidth = aOrigSize.Width() -
+ tools::Long nWidth = m_aOrigSize.Width() -
( lcl_GetValue(*m_xLeftMF, eUnit) +
lcl_GetValue(*m_xRightMF, eUnit) );
if(!nWidth)
@@ -403,7 +409,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
}
else
{
- tools::Long nHeight = aOrigSize.Height() -
+ tools::Long nHeight = m_aOrigSize.Height() -
( lcl_GetValue(*m_xTopMF, eUnit) +
lcl_GetValue(*m_xBottomMF, eUnit));
if(!nHeight)
@@ -421,7 +427,7 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) );
bool bZoom = m_xZoomConstRB->get_active();
@@ -430,19 +436,19 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
tools::Long nLeft = lcl_GetValue( *m_xLeftMF, eUnit );
tools::Long nRight = lcl_GetValue( *m_xRightMF, eUnit );
tools::Long nWidthZoom = static_cast<tools::Long>(m_xWidthZoomMF->get_value(FieldUnit::NONE));
- if (bZoom && nWidthZoom != 0 && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom )
- / 100 >= aPageSize.Width() ) )
+ if (bZoom && nWidthZoom != 0 && ( ( ( m_aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom )
+ / 100 >= m_aPageSize.Width() ) )
{
if (&rField == m_xLeftMF.get())
{
- nLeft = aOrigSize.Width() -
- ( aPageSize.Width() * 100 / nWidthZoom + nRight );
+ nLeft = m_aOrigSize.Width() -
+ ( m_aPageSize.Width() * 100 / nWidthZoom + nRight );
m_xLeftMF->set_value( m_xLeftMF->normalize( nLeft ), eUnit );
}
else
{
- nRight = aOrigSize.Width() -
- ( aPageSize.Width() * 100 / nWidthZoom + nLeft );
+ nRight = m_aOrigSize.Width() -
+ ( m_aPageSize.Width() * 100 / nWidthZoom + nLeft );
m_xRightMF->set_value( m_xRightMF->normalize( nRight ), eUnit );
}
}
@@ -467,20 +473,20 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
tools::Long nTop = lcl_GetValue( *m_xTopMF, eUnit );
tools::Long nBottom = lcl_GetValue( *m_xBottomMF, eUnit );
tools::Long nHeightZoom = static_cast<tools::Long>(m_xHeightZoomMF->get_value(FieldUnit::NONE));
- if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom)
- / 100 >= aPageSize.Height()))
+ if(bZoom && ( ( ( m_aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom)
+ / 100 >= m_aPageSize.Height()))
{
assert(nHeightZoom && "div-by-zero");
if(&rField == m_xTopMF.get())
{
- nTop = aOrigSize.Height() -
- ( aPageSize.Height() * 100 / nHeightZoom + nBottom);
+ nTop = m_aOrigSize.Height() -
+ ( m_aPageSize.Height() * 100 / nHeightZoom + nBottom);
m_xTopMF->set_value( m_xWidthMF->normalize( nTop ), eUnit );
}
else
{
- nBottom = aOrigSize.Height() -
- ( aPageSize.Height() * 100 / nHeightZoom + nTop);
+ nBottom = m_aOrigSize.Height() -
+ ( m_aPageSize.Height() * 100 / nHeightZoom + nTop);
m_xBottomMF->set_value( m_xWidthMF->normalize( nBottom ), eUnit );
}
}
@@ -506,21 +512,47 @@ IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, weld::Button&, void)
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) );
- tools::Long nWidth = aOrigSize.Width() -
+ tools::Long nWidth = m_aOrigSize.Width() -
lcl_GetValue( *m_xLeftMF, eUnit ) -
lcl_GetValue( *m_xRightMF, eUnit );
m_xWidthMF->set_value( m_xWidthMF->normalize( nWidth ), eUnit );
- tools::Long nHeight = aOrigSize.Height() -
+ tools::Long nHeight = m_aOrigSize.Height() -
lcl_GetValue( *m_xTopMF, eUnit ) -
lcl_GetValue( *m_xBottomMF, eUnit );
m_xHeightMF->set_value( m_xHeightMF->normalize( nHeight ), eUnit );
m_xWidthZoomMF->set_value(100, FieldUnit::NONE);
m_xHeightZoomMF->set_value(100, FieldUnit::NONE);
- bSetOrigSize = true;
+ m_bSetOrigSize = true;
}
+
+/*--------------------------------------------------------------------
+ description: reset crop
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_NOARG(SvxGrfCropPage, UncropHdl, weld::Button&, void)
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Where is the pool?" );
+
+ m_xLeftMF->set_value(0, FieldUnit::NONE);
+ m_xRightMF->set_value(0, FieldUnit::NONE);
+ m_xTopMF->set_value(0, FieldUnit::NONE);
+ m_xBottomMF->set_value(0, FieldUnit::NONE);
+
+ m_aExampleWN.SetLeft(0);
+ m_aExampleWN.SetRight(0);
+ m_aExampleWN.SetTop(0);
+ m_aExampleWN.SetBottom(0);
+
+ m_aExampleWN.Invalidate();
+ CalcMinMaxBorder();
+
+}
+
+
/*--------------------------------------------------------------------
description: compute scale
--------------------------------------------------------------------*/
@@ -529,7 +561,7 @@ void SvxGrfCropPage::CalcZoom()
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) );
tools::Long nWidth = lcl_GetValue( *m_xWidthMF, eUnit );
@@ -540,10 +572,10 @@ void SvxGrfCropPage::CalcZoom()
lcl_GetValue( *m_xBottomMF, eUnit );
sal_uInt16 nZoom = 0;
tools::Long nDen;
- if( (nDen = aOrigSize.Width() - nLRBorders) > 0)
+ if( (nDen = m_aOrigSize.Width() - nLRBorders) > 0)
nZoom = static_cast<sal_uInt16>((( nWidth * 1000 / nDen )+5)/10);
m_xWidthZoomMF->set_value(nZoom, FieldUnit::NONE);
- if( (nDen = aOrigSize.Height() - nULBorders) > 0)
+ if( (nDen = m_aOrigSize.Height() - nULBorders) > 0)
nZoom = static_cast<sal_uInt16>((( nHeight * 1000 / nDen )+5)/10);
else
nZoom = 0;
@@ -558,10 +590,10 @@ void SvxGrfCropPage::CalcMinMaxBorder()
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ) );
tools::Long nR = lcl_GetValue(*m_xRightMF, eUnit );
- tools::Long nMinWidth = (aOrigSize.Width() * 10) /11;
+ tools::Long nMinWidth = (m_aOrigSize.Width() * 10) /11;
tools::Long nMin = nMinWidth - (nR >= 0 ? nR : 0);
m_xLeftMF->set_max( m_xLeftMF->normalize(nMin), eUnit );
@@ -570,7 +602,7 @@ void SvxGrfCropPage::CalcMinMaxBorder()
m_xRightMF->set_max( m_xRightMF->normalize(nMin), eUnit );
tools::Long nUp = lcl_GetValue( *m_xTopMF, eUnit );
- tools::Long nMinHeight = (aOrigSize.Height() * 10) /11;
+ tools::Long nMinHeight = (m_aOrigSize.Height() * 10) /11;
nMin = nMinHeight - (nUp >= 0 ? nUp : 0);
m_xBottomMF->set_max( m_xBottomMF->normalize(nMin), eUnit );
@@ -589,19 +621,19 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
{
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
- FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
+ FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhichIDFromSlotID(
SID_ATTR_GRAF_CROP ) ));
- sal_Int64 nSpin = m_xLeftMF->normalize(aOrigSize.Width()) / 20;
- nSpin = vcl::ConvertValue( nSpin, aOrigSize.Width(), 0,
+ sal_Int64 nSpin = m_xLeftMF->normalize(m_aOrigSize.Width()) / 20;
+ nSpin = vcl::ConvertValue( nSpin, m_aOrigSize.Width(), 0,
eUnit, m_xLeftMF->get_unit());
// if the margin is too big, it is set to 1/3 on both pages
tools::Long nR = lcl_GetValue( *m_xRightMF, eUnit );
tools::Long nL = lcl_GetValue( *m_xLeftMF, eUnit );
- if((nL + nR) < - aOrigSize.Width())
+ if((nL + nR) < - m_aOrigSize.Width())
{
- tools::Long nVal = aOrigSize.Width() / -3;
+ tools::Long nVal = m_aOrigSize.Width() / -3;
m_xRightMF->set_value( m_xRightMF->normalize( nVal ), eUnit );
m_xLeftMF->set_value( m_xLeftMF->normalize( nVal ), eUnit );
m_aExampleWN.SetLeft(nVal);
@@ -609,9 +641,9 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
}
tools::Long nUp = lcl_GetValue(*m_xTopMF, eUnit );
tools::Long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
- if((nUp + nLow) < - aOrigSize.Height())
+ if((nUp + nLow) < - m_aOrigSize.Height())
{
- tools::Long nVal = aOrigSize.Height() / -3;
+ tools::Long nVal = m_aOrigSize.Height() / -3;
m_xTopMF->set_value( m_xTopMF->normalize( nVal ), eUnit );
m_xBottomMF->set_value( m_xBottomMF->normalize( nVal ), eUnit );
m_aExampleWN.SetTop(nVal);
@@ -620,8 +652,8 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
m_xLeftMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE);
m_xRightMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE);
- nSpin = m_xTopMF->normalize(aOrigSize.Height()) / 20;
- nSpin = vcl::ConvertValue( nSpin, aOrigSize.Width(), 0,
+ nSpin = m_xTopMF->normalize(m_aOrigSize.Height()) / 20;
+ nSpin = vcl::ConvertValue( nSpin, m_aOrigSize.Width(), 0,
eUnit, m_xLeftMF->get_unit() );
m_xTopMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE);
m_xBottomMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE);
@@ -638,26 +670,27 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
xFld->set_digits(m_xWidthMF->get_digits());
xFld->set_max(INT_MAX - 1, FieldUnit::NONE);
- xFld->set_value(xFld->normalize(aOrigSize.Width()), eUnit);
+ xFld->set_value(xFld->normalize(m_aOrigSize.Width()), eUnit);
sTemp = xFld->get_text();
- xFld->set_value(xFld->normalize(aOrigSize.Height()), eUnit);
+ xFld->set_value(xFld->normalize(m_aOrigSize.Height()), eUnit);
// multiplication sign (U+00D7)
sTemp += u"\u00D7" + xFld->get_text();
}
- if ( aOrigPixelSize.Width() && aOrigPixelSize.Height() ) {
- sal_Int32 ax = 0.5 + aOrigPixelSize.Width() /
- o3tl::convert<double>(aOrigSize.Width(), o3tl::Length::twip,
+ if ( m_aOrigPixelSize.Width() && m_aOrigPixelSize.Height() ) {
+ sal_Int32 ax = 0.5 + m_aOrigPixelSize.Width() /
+ o3tl::convert<double>(m_aOrigSize.Width(), o3tl::Length::twip,
o3tl::Length::in);
- sal_Int32 ay = 0.5 + aOrigPixelSize.Height() /
- o3tl::convert<double>(aOrigSize.Height(), o3tl::Length::twip,
+ sal_Int32 ay = 0.5 + m_aOrigPixelSize.Height() /
+ o3tl::convert<double>(m_aOrigSize.Height(), o3tl::Length::twip,
o3tl::Length::in);
OUString sPPI = OUString::number(ax);
if (abs(ax - ay) > 1) {
sPPI += u"\u00D7" + OUString::number(ay);
}
- sTemp += " " + CuiResId(RID_SVXSTR_PPI).replaceAll("%1", sPPI);
+ sTemp += " " + CuiResId(RID_CUISTR_PPI).replaceAll("%1", sPPI);
}
+ sTemp += "\n" + OUString::number(m_aOrigPixelSize.Width()) + u"\u00D7" + OUString::number(m_aOrigPixelSize.Height()) + " px";
m_xOrigSizeFT->set_label(sTemp);
}
@@ -670,13 +703,27 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
Size SvxGrfCropPage::GetGrfOrigSize(const Graphic& rGrf)
{
- const MapMode aMapTwip( MapUnit::MapTwip );
- Size aSize( rGrf.GetPrefSize() );
- if( MapUnit::MapPixel == rGrf.GetPrefMapMode().GetMapUnit() )
- aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapTwip);
+ Size aSize;
+
+ if (m_aPreferredDPI > 0)
+ {
+ Size aPixelSize = rGrf.GetSizePixel();
+ double fWidth = aPixelSize.Width() / double(m_aPreferredDPI);
+ double fHeight = aPixelSize.Height() / double(m_aPreferredDPI);
+ fWidth = o3tl::convert(fWidth, o3tl::Length::in, o3tl::Length::twip);
+ fHeight = o3tl::convert(fHeight, o3tl::Length::in, o3tl::Length::twip);
+ aSize = Size(fWidth, fHeight);
+ }
else
- aSize = OutputDevice::LogicToLogic( aSize,
- rGrf.GetPrefMapMode(), aMapTwip );
+ {
+ const MapMode aMapTwip( MapUnit::MapTwip );
+ aSize = rGrf.GetPrefSize();
+ if( MapUnit::MapPixel == rGrf.GetPrefMapMode().GetMapUnit() )
+ aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapTwip);
+ else
+ aSize = OutputDevice::LogicToLogic( aSize,
+ rGrf.GetPrefMapMode(), aMapTwip );
+ }
return aSize;
}
@@ -703,7 +750,7 @@ void SvxCropExample::SetDrawingArea(weld::DrawingArea* pDrawingArea)
void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
{
- rRenderContext.Push(PushFlags::MAPMODE);
+ rRenderContext.Push(vcl::PushFlags::MAPMODE);
rRenderContext.SetMapMode(m_aMapMode);
// Win BG
@@ -719,17 +766,16 @@ void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re
::tools::Rectangle aRect(
Point((aWinSize.Width() - m_aFrameSize.Width())/2, (aWinSize.Height() - m_aFrameSize.Height())/2),
m_aFrameSize);
- m_aGrf.Draw(&rRenderContext, aRect.TopLeft(), aRect.GetSize());
+ m_aGrf.Draw(rRenderContext, aRect.TopLeft(), aRect.GetSize());
// Remove one more case that uses XOR paint (RasterOp::Invert).
// Get colors and logic DashLength from settings, use equal to
// PolygonMarkerPrimitive2D, may be changed to that primitive later.
// Use this to guarantee good visibility - that was the purpose of
// the former used XOR paint.
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const Color aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
- const Color aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
- const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
+ const Color aColA(SvtOptionsDrawinglayer::GetStripeColorA().getBColor());
+ const Color aColB(SvtOptionsDrawinglayer::GetStripeColorB().getBColor());
+ const double fStripeLength(officecfg::Office::Common::Drawinglayer::StripeLength::get());
const basegfx::B2DVector aDashVector(rRenderContext.GetInverseViewTransformation() * basegfx::B2DVector(fStripeLength, 0.0));
const double fLogicDashLength(aDashVector.getX());
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
index c12ebc53601e..c5661586472c 100644
--- a/cui/source/tabpages/labdlg.cxx
+++ b/cui/source/tabpages/labdlg.cxx
@@ -49,20 +49,13 @@
// static ----------------------------------------------------------------
-const sal_uInt16 SvxCaptionTabPage::pCaptionRanges[] =
-{
- SDRATTR_CAPTIONTYPE,
- SDRATTR_CAPTIONFIXEDANGLE,
- SDRATTR_CAPTIONANGLE,
- SDRATTR_CAPTIONGAP,
- SDRATTR_CAPTIONESCDIR,
- SDRATTR_CAPTIONESCISREL,
- SDRATTR_CAPTIONESCREL,
- SDRATTR_CAPTIONESCABS,
- SDRATTR_CAPTIONLINELEN,
- SDRATTR_CAPTIONFITLINELEN,
- 0
-};
+const WhichRangesContainer SvxCaptionTabPage::pCaptionRanges(
+ svl::Items<
+ SDRATTR_CAPTIONTYPE, SDRATTR_CAPTIONFIXEDANGLE,
+ SDRATTR_CAPTIONANGLE, SDRATTR_CAPTIONGAP,
+ SDRATTR_CAPTIONESCDIR, SDRATTR_CAPTIONESCISREL,
+ SDRATTR_CAPTIONESCREL, SDRATTR_CAPTIONESCABS,
+ SDRATTR_CAPTIONLINELEN, SDRATTR_CAPTIONFITLINELEN>);
SvxCaptionTabPage::SvxCaptionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
: SfxTabPage(pPage, pController, "cui/ui/calloutpage.ui", "CalloutPage", &rInAttrs)
@@ -262,9 +255,9 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
SetMetricValue( *m_xMF_SPACING, nGap, eUnit );
nGap = m_xMF_SPACING->get_value(FieldUnit::NONE);
- nCaptionType = static_cast<const SdrCaptionTypeItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
+ nCaptionType = rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ).GetValue();
bFitLineLen = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
- nEscDir = static_cast<const SdrCaptionEscDirItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
+ nEscDir = rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ).GetValue();
bEscRel = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
// special treatment!!! XXX
@@ -408,7 +401,7 @@ IMPL_LINK(SvxCaptionTabPage, PositionSelectHdl_Impl, weld::ComboBox&, rListBox,
}
}
-IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, weld::ToggleButton&, rButton, void )
+IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, weld::Toggleable&, rButton, void )
{
if (&rButton != m_xCB_OPTIMAL.get())
return;
@@ -481,7 +474,7 @@ SvxCaptionTabDialog::SvxCaptionTabDialog(weld::Window* pParent, const SdrView* p
SvxCaptionTabPage::GetRanges );
}
-void SvxCaptionTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SvxCaptionTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "RID_SVXPAGE_POSITION_SIZE")
{
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index df3e47bf489b..baff7c87b0ae 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -18,7 +18,8 @@
*/
#include <macroass.hxx>
-
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>
@@ -47,7 +48,7 @@ public:
std::unique_ptr<weld::Frame> m_xMacroFrame;
std::unique_ptr<CuiConfigFunctionListBox> m_xMacroLB;
- Idle m_aFillGroupIdle;
+ Idle m_aFillGroupIdle { "cui SfxMacroTabPage m_aFillGroupIdle" };
bool m_bGotEvents;
};
@@ -70,7 +71,7 @@ static OUString ConvertToUIName_Impl( SvxMacro const *pMacro )
OUString aEntry = aName.getToken( nCount-1, '.' );
if ( nCount > 2 )
{
- aEntry += "(" + aName.getToken( 0, '.' ) + "." + aName.getToken( nCount-2, '.' ) + ")";
+ aEntry += OUString::Concat("(") + o3tl::getToken(aName, 0, '.' ) + "." + o3tl::getToken(aName, nCount-2, '.' ) + ")";
}
return aEntry;
}
@@ -105,7 +106,6 @@ SfxMacroTabPage::SfxMacroTabPage(weld::Container* pPage, weld::DialogController*
mpImpl->m_aFillGroupIdle.SetInvokeHandler( LINK( this, SfxMacroTabPage, TimeOut_Impl ) );
mpImpl->m_aFillGroupIdle.SetPriority( TaskPriority::HIGHEST );
- mpImpl->m_aFillGroupIdle.SetDebugName( "SfxMacroTabPage m_aFillGroupIdle" );
mpImpl->m_xEventLB.reset(new MacroEventListBox(m_xBuilder->weld_tree_view("assignments")));
mpImpl->m_xAssignPB = m_xBuilder->weld_button("assign");
@@ -156,9 +156,14 @@ bool SfxMacroTabPage::FillItemSet( SfxItemSet* rSet )
SvxMacroItem aItem( GetWhich( aPageRg[0] ) );
const_cast<SvxMacroTableDtor&>(aItem.GetMacroTable()) = aTbl;
- const SfxPoolItem* pItem;
- if( SfxItemState::SET != GetItemSet().GetItemState( aItem.Which(), true, &pItem )
- || aItem != *static_cast<const SvxMacroItem*>(pItem) )
+ const SfxPoolItem* pItem = nullptr;
+ SfxItemState eState = GetItemSet().GetItemState(aItem.Which(), true, &pItem);
+ if (eState == SfxItemState::DEFAULT && aTbl.empty())
+ {
+ // Don't touch the item set if there was no input and our table is empty.
+ return false;
+ }
+ if (SfxItemState::SET != eState || aItem != *static_cast<const SvxMacroItem*>(pItem))
{
rSet->Put( aItem );
return true;
@@ -179,11 +184,12 @@ void SfxMacroTabPage::ActivatePage( const SfxItemSet& )
void SfxMacroTabPage::PageCreated(const SfxAllItemSet& aSet)
{
- const SfxPoolItem* pEventsItem;
- if( !mpImpl->m_bGotEvents && SfxItemState::SET == aSet.GetItemState( SID_EVENTCONFIG, true, &pEventsItem ) )
+ if( mpImpl->m_bGotEvents )
+ return;
+ if( const SfxEventNamesItem* pEventsItem = aSet.GetItemIfSet( SID_EVENTCONFIG ) )
{
mpImpl->m_bGotEvents = true;
- const SfxEventNamesList& rList = static_cast<const SfxEventNamesItem*>(pEventsItem)->GetEvents();
+ const SfxEventNamesList& rList = pEventsItem->GetEvents();
for ( size_t nNo = 0, nCnt = rList.size(); nNo < nCnt; ++nNo )
{
const SfxEventName &rOwn = rList.at(nNo);
@@ -198,11 +204,11 @@ void SfxMacroTabPage::Reset( const SfxItemSet* rSet )
if( SfxItemState::SET == rSet->GetItemState( GetWhich( aPageRg[0] ), true, &pItem ))
aTbl = static_cast<const SvxMacroItem*>(pItem)->GetMacroTable();
- const SfxPoolItem* pEventsItem;
- if( !mpImpl->m_bGotEvents && SfxItemState::SET == rSet->GetItemState( SID_EVENTCONFIG, true, &pEventsItem ) )
+ const SfxEventNamesItem* pEventsItem;
+ if( !mpImpl->m_bGotEvents && (pEventsItem = rSet->GetItemIfSet( SID_EVENTCONFIG ) ) )
{
mpImpl->m_bGotEvents = true;
- const SfxEventNamesList& rList = static_cast<const SfxEventNamesItem*>(pEventsItem)->GetEvents();
+ const SfxEventNamesList& rList = pEventsItem->GetEvents();
for ( size_t nNo = 0, nCnt = rList.size(); nNo < nCnt; ++nNo )
{
const SfxEventName &rOwn = rList.at(nNo);
@@ -215,7 +221,10 @@ void SfxMacroTabPage::Reset( const SfxItemSet* rSet )
weld::TreeView& rListBox = mpImpl->m_xEventLB->GetListBox();
std::unique_ptr<weld::TreeIter> xIter(rListBox.make_iterator());
if (rListBox.get_iter_first(*xIter))
+ {
rListBox.set_cursor(*xIter);
+ EnableButtons();
+ }
}
bool SfxMacroTabPage::IsReadOnly() const
@@ -327,8 +336,10 @@ void SfxMacroTabPage::InitAndSetHandler()
mpImpl->m_xGroupLB->connect_changed(LINK(this, SfxMacroTabPage, SelectGroup_Impl));
mpImpl->m_xMacroLB->connect_changed(LINK(this, SfxMacroTabPage, SelectMacro_Impl));
- std::vector<int> aWidths;
- aWidths.push_back(rListBox.get_approximate_digit_width() * 35);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(rListBox.get_approximate_digit_width() * 35)
+ };
rListBox.set_column_fixed_widths(aWidths);
mpImpl->m_xEventLB->show();
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index 14c9fef1e09b..8c7b4dcd8351 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -36,12 +36,8 @@
#include <measure.hxx>
-const sal_uInt16 SvxMeasurePage::pRanges[] =
-{
- SDRATTR_MEASURE_FIRST,
- SDRATTR_MEASURE_LAST,
- 0
-};
+const WhichRangesContainer SvxMeasurePage::pRanges(
+ svl::Items<SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST>);
/*************************************************************************
|*
@@ -58,7 +54,7 @@ SvxMeasureDialog::SvxMeasureDialog(weld::Window* pParent, const SfxItemSet& rInA
xPage->Construct();
SetTabPage(std::move(xPage));
- m_xDialog->set_title(CuiResId(RID_SVXSTR_DIMENSION_LINE));
+ m_xDialog->set_title(CuiResId(RID_CUISTR_DIMENSION_LINE));
}
/*************************************************************************
@@ -114,11 +110,16 @@ SvxMeasurePage::SvxMeasurePage(weld::Container* pPage, weld::DialogController* p
m_xTsbAutoPosH->connect_toggled(LINK(this, SvxMeasurePage, ClickAutoPosHdl_Impl));
Link<weld::MetricSpinButton&,void> aLink(LINK(this, SvxMeasurePage, ChangeAttrEditHdl_Impl));
+ m_xMtrFldLineDist->set_range(-10000, 10000, FieldUnit::MM);
m_xMtrFldLineDist->connect_value_changed(aLink);
m_xMtrFldHelplineOverhang->connect_value_changed(aLink);
+ m_xMtrFldHelplineOverhang->set_range(-10000, 10000, FieldUnit::MM);
m_xMtrFldHelplineDist->connect_value_changed(aLink);
+ m_xMtrFldHelplineDist->set_range(-10000, 10000, FieldUnit::MM);
m_xMtrFldHelpline1Len->connect_value_changed(aLink);
+ m_xMtrFldHelpline1Len->set_range(-10000, 10000, FieldUnit::MM);
m_xMtrFldHelpline2Len->connect_value_changed(aLink);
+ m_xMtrFldHelpline2Len->set_range(-10000, 10000, FieldUnit::MM);
m_xMtrFldDecimalPlaces->connect_value_changed(LINK(this, SvxMeasurePage, ChangeAttrSpinHdl_Impl));
m_xTsbBelowRefEdge->connect_toggled(LINK(this, SvxMeasurePage, ChangeAttrClickHdl_Impl));
m_xTsbParallel->connect_toggled( LINK( this, SvxMeasurePage, ChangeAttrClickHdl_Impl));
@@ -148,14 +149,14 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
// SdrMeasureLineDistItem
if( pItem == nullptr )
- pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_MEASURELINEDIST );
SetMetricValue(*m_xMtrFldLineDist, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldLineDist->save_value();
// SdrMeasureHelplineOverhangItem
pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINEOVERHANG );
if( pItem == nullptr )
- pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG );
SetMetricValue(*m_xMtrFldHelplineOverhang, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
eUnit);
m_xMtrFldHelplineOverhang->save_value();
@@ -163,7 +164,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
// SdrMeasureHelplineDistItem
pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINEDIST );
if( pItem == nullptr )
- pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_MEASUREHELPLINEDIST );
SetMetricValue(*m_xMtrFldHelplineDist, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
eUnit);
m_xMtrFldHelplineDist->save_value();
@@ -171,7 +172,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
// SdrMeasureHelpline1LenItem
pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINE1LEN );
if( pItem == nullptr )
- pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_MEASUREHELPLINE1LEN );
SetMetricValue(*m_xMtrFldHelpline1Len, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
eUnit);
m_xMtrFldHelpline1Len->save_value();
@@ -179,13 +180,13 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
// SdrMeasureHelpline2LenItem
pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINE2LEN );
if( pItem == nullptr )
- pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_MEASUREHELPLINE2LEN );
SetMetricValue(*m_xMtrFldHelpline2Len, static_cast<const SdrMetricItem*>(pItem)->GetValue(),
eUnit);
m_xMtrFldHelpline2Len->save_value();
// SdrMeasureBelowRefEdgeItem
- if( rAttrs->GetItemState( SDRATTR_MEASUREBELOWREFEDGE ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_MEASUREBELOWREFEDGE ) != SfxItemState::INVALID )
{
m_xTsbBelowRefEdge->set_state( rAttrs->Get( SDRATTR_MEASUREBELOWREFEDGE ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -199,14 +200,14 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
// SdrMeasureDecimalPlacesItem
pItem = GetItem( *rAttrs, SDRATTR_MEASUREDECIMALPLACES );
if( pItem == nullptr )
- pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREDECIMALPLACES );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_MEASUREDECIMALPLACES );
m_xMtrFldDecimalPlaces->set_value(
static_cast<const SdrMeasureDecimalPlacesItem*>(pItem)->GetValue());
m_xMtrFldDecimalPlaces->save_value();
// SdrMeasureTextRota90Item
// Attention: negate !
- if( rAttrs->GetItemState( SDRATTR_MEASURETEXTROTA90 ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_MEASURETEXTROTA90 ) != SfxItemState::INVALID )
{
m_xTsbParallel->set_state( rAttrs->Get( SDRATTR_MEASURETEXTROTA90 ).
GetValue() ? TRISTATE_FALSE : TRISTATE_TRUE );
@@ -218,7 +219,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
m_xTsbParallel->save_state();
// SdrMeasureShowUnitItem
- if( rAttrs->GetItemState( SDRATTR_MEASURESHOWUNIT ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_MEASURESHOWUNIT ) != SfxItemState::INVALID )
{
m_xTsbShowUnit->set_state( rAttrs->Get( SDRATTR_MEASURESHOWUNIT ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -230,7 +231,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
m_xTsbShowUnit->save_state();
// SdrMeasureUnitItem
- if( rAttrs->GetItemState( SDRATTR_MEASUREUNIT ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_MEASUREUNIT ) != SfxItemState::INVALID )
{
tools::Long nFieldUnit = static_cast<tools::Long>(rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue());
@@ -250,12 +251,12 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
m_xLbUnit->save_value();
// Position
- if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTVPOS ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTVPOS ) != SfxItemState::INVALID )
{
css::drawing::MeasureTextVertPos eVPos =
rAttrs->Get( SDRATTR_MEASURETEXTVPOS ).GetValue();
{
- if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::INVALID )
{
css::drawing::MeasureTextHorzPos eHPos =
rAttrs->Get( SDRATTR_MEASURETEXTHPOS ).GetValue();
@@ -464,7 +465,7 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs)
if (m_xTsbAutoPosV->get_state() == TRISTATE_TRUE)
eVPos = css::drawing::MeasureTextVertPos_AUTO;
- if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTVPOS ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTVPOS ) != SfxItemState::INVALID )
{
css::drawing::MeasureTextVertPos eOldVPos = rOutAttrs.Get(SDRATTR_MEASURETEXTVPOS).GetValue();
if( eOldVPos != eVPos )
@@ -479,7 +480,7 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs)
bModified = true;
}
- if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::INVALID )
{
css::drawing::MeasureTextHorzPos eOldHPos = rOutAttrs.Get( SDRATTR_MEASURETEXTHPOS ).GetValue();
if( eOldHPos != eHPos )
@@ -530,7 +531,7 @@ void SvxMeasurePage::PointChanged(weld::DrawingArea* pDrawingArea, RectPoint /*e
ChangeAttrHdl_Impl(pDrawingArea);
}
-IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, weld::ToggleButton&, rBox, void )
+IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, weld::Toggleable&, rBox, void )
{
if (m_xTsbAutoPosH->get_state() == TRISTATE_TRUE)
{
@@ -577,7 +578,7 @@ IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, weld::ToggleButton&, rBox, void
ChangeAttrHdl_Impl(&rBox);
}
-IMPL_LINK(SvxMeasurePage, ChangeAttrClickHdl_Impl, weld::ToggleButton&, r, void)
+IMPL_LINK(SvxMeasurePage, ChangeAttrClickHdl_Impl, weld::Toggleable&, r, void)
{
ChangeAttrHdl_Impl(&r);
}
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index f51adcae2813..afaa43f0dc1c 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -24,8 +24,6 @@
#include <svl/intitem.hxx>
#include <sfx2/objsh.hxx>
#include <vcl/outdev.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
#include <i18nlangtag/lang.h>
#include <svx/svxids.hrc>
#include <svtools/colorcfg.hxx>
@@ -54,18 +52,12 @@ using ::com::sun::star::uno::UNO_QUERY;
// static ----------------------------------------------------------------
-const sal_uInt16 SvxNumberFormatTabPage::pRanges[] =
-{
- SID_ATTR_NUMBERFORMAT_VALUE,
- SID_ATTR_NUMBERFORMAT_INFO,
- SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
- SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
- SID_ATTR_NUMBERFORMAT_ONE_AREA,
- SID_ATTR_NUMBERFORMAT_ONE_AREA,
- SID_ATTR_NUMBERFORMAT_SOURCE,
- SID_ATTR_NUMBERFORMAT_SOURCE,
- 0
-};
+const WhichRangesContainer SvxNumberFormatTabPage::pRanges(
+ svl::Items<
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, // 10085 - 10086
+ SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA, // 10580 - 10580
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE, // 10700 - 10700
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE>); // 10932 - 10932
/*************************************************************************
#* Method: SvxNumberPreview
@@ -109,19 +101,29 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr,
{
mnChar = aPrevStr[ mnPos + 1 ];
// delete placeholder and char to repeat
- aPrevStr = aPrevStr.replaceAt( mnPos, 2, "" );
+ aPrevStr = aPrevStr.replaceAt( mnPos, 2, u"" );
}
else
{
// delete placeholder
- aPrevStr = aPrevStr.replaceAt( mnPos, 1, "" );
+ aPrevStr = aPrevStr.replaceAt( mnPos, 1, u"" );
// do not attempt to draw a 0 fill character
mnPos = -1;
}
}
- svtools::ColorConfig aColorConfig;
- Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
- aPrevCol = pColor ? *pColor : aWindowTextColor;
+ if (pColor)
+ aPrevCol = *pColor;
+ else
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aFgColor = aColorConfig.GetColorValue(svtools::FONTCOLOR, false).nColor;
+ if (aFgColor == COL_AUTO)
+ {
+ Color aBgColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK;
+ }
+ aPrevCol = aFgColor;
+ }
Invalidate();
}
@@ -138,11 +140,16 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr,
void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
{
- rRenderContext.Push(PushFlags::ALL);
+ rRenderContext.Push(vcl::PushFlags::ALL);
svtools::ColorConfig aColorConfig;
- rRenderContext.SetTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
- rRenderContext.SetBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ Color aBgColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ Color aFgColor = aColorConfig.GetColorValue(svtools::FONTCOLOR, false).nColor;
+ if (aFgColor == COL_AUTO)
+ aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK;
+ rRenderContext.SetBackground(aBgColor);
+ rRenderContext.SetTextColor(aFgColor);
+ rRenderContext.Erase();
vcl::Font aDrawFont = rRenderContext.GetFont();
Size aSzWnd(GetOutputSizePixel());
@@ -164,7 +171,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
if (nNumCharsToInsert > 0)
{
for (int i = 0; i < nNumCharsToInsert; ++i)
- aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar));
+ aTmpStr = aTmpStr.replaceAt(mnPos, 0, rtl::OUStringChar(mnChar));
}
}
@@ -195,7 +202,7 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia
, nInitFormat(std::numeric_limits<sal_uInt32>::max())
, m_nLbFormatSelPosEdComment(SELPOS_NONE)
, bLegacyAutomaticCurrency(false)
- , sAutomaticLangEntry(CuiResId(RID_SVXSTR_AUTO_ENTRY))
+ , sAutomaticLangEntry(CuiResId(RID_CUISTR_AUTO_ENTRY))
, m_xFtCategory(m_xBuilder->weld_label("categoryft"))
, m_xLbCategory(m_xBuilder->weld_tree_view("categorylb"))
, m_xFtFormat(m_xBuilder->weld_label("formatft"))
@@ -223,7 +230,7 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia
, m_xLbLanguage(new SvxLanguageBox(m_xBuilder->weld_combo_box("languagelb")))
, m_xWndPreview(new weld::CustomWeld(*m_xBuilder, "preview", m_aWndPreview))
{
- for (size_t i = 0; i < SAL_N_ELEMENTS(NUM_CATEGORIES); ++i)
+ for (size_t i = 0; i < std::size(NUM_CATEGORIES); ++i)
m_xLbCategory->append_text(CuiResId(NUM_CATEGORIES[i]));
auto nWidth = m_xLbCategory->get_approximate_digit_width() * 22;
@@ -276,7 +283,7 @@ void SvxNumberFormatTabPage::Init_Impl()
m_xLbLanguage->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
m_xLbCurrency->connect_changed(aLink3);
m_xLbCurrency->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xCbSourceFormat->connect_clicked(LINK(this, SvxNumberFormatTabPage, SelFormatClickHdl_Impl));
+ m_xCbSourceFormat->connect_toggled(LINK(this, SvxNumberFormatTabPage, SelFormatClickHdl_Impl));
m_xCbSourceFormat->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
Link<weld::SpinButton&,void> aLink = LINK( this, SvxNumberFormatTabPage, OptEditHdl_Impl );
@@ -288,11 +295,11 @@ void SvxNumberFormatTabPage::Init_Impl()
m_xEdLeadZeroes->connect_value_changed(aLink);
m_xEdLeadZeroes->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xBtnNegRed->connect_clicked(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
+ m_xBtnNegRed->connect_toggled(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
m_xBtnNegRed->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xBtnThousand->connect_clicked(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
+ m_xBtnThousand->connect_toggled(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
m_xBtnThousand->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xBtnEngineering->connect_clicked(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
+ m_xBtnEngineering->connect_toggled(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
m_xBtnEngineering->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
m_xLbFormat->connect_row_activated(LINK(this, SvxNumberFormatTabPage, DoubleClickHdl_Impl));
m_xEdFormat->connect_changed(LINK(this, SvxNumberFormatTabPage, EditModifyHdl_Impl));
@@ -368,14 +375,9 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
double nValDouble = 0;
OUString aValString;
- SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_NOLANGUAGE ),true,&pItem);
-
- if(eState==SfxItemState::SET)
+ if(const SfxBoolItem* pBoolLangItem = rSet->GetItemIfSet( SID_ATTR_NUMBERFORMAT_NOLANGUAGE ))
{
- const SfxBoolItem* pBoolLangItem = static_cast<const SfxBoolItem*>(
- GetItem( *rSet, SID_ATTR_NUMBERFORMAT_NOLANGUAGE));
-
- if(pBoolLangItem!=nullptr && pBoolLangItem->GetValue())
+ if(pBoolLangItem->GetValue())
{
HideLanguage();
}
@@ -386,7 +388,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
}
- eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),true,&pItem);
+ SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),true,&pItem);
if(eState==SfxItemState::SET)
{
@@ -410,8 +412,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
if(eState==SfxItemState::SET)
{
- const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(
- GetItem( *rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA));
+ const SfxBoolItem* pBoolItem = GetItem( *rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA);
if(pBoolItem!=nullptr)
{
@@ -419,12 +420,12 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
}
}
- eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ) );
+ eState = rSet->GetItemState( SID_ATTR_NUMBERFORMAT_SOURCE );
if ( eState == SfxItemState::SET )
{
- const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(
- GetItem( *rSet, SID_ATTR_NUMBERFORMAT_SOURCE ));
+ const SfxBoolItem* pBoolItem =
+ GetItem( *rSet, SID_ATTR_NUMBERFORMAT_SOURCE );
if ( pBoolItem )
m_xCbSourceFormat->set_active(pBoolItem->GetValue());
else
@@ -445,7 +446,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) );
- if ( SfxItemState::DONTCARE != eState )
+ if ( SfxItemState::INVALID != eState )
pValFmtAttr = GetItem( *rSet, SID_ATTR_NUMBERFORMAT_VALUE );
eValType = pNumItem->GetValueType();
@@ -488,8 +489,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
bool bUseStarFormat = false;
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- if ( pDocSh )
+ if (SfxObjectShell* pDocSh = SfxObjectShell::Current())
{
// is this a calc document
Reference< XServiceInfo > xSI( pDocSh->GetModel(), UNO_QUERY );
@@ -520,10 +520,9 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
{
SetCategory(nCatLbSelPos );
}
- eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ADD_AUTO ) );
+ eState = rSet->GetItemState( SID_ATTR_NUMBERFORMAT_ADD_AUTO );
if(SfxItemState::SET == eState)
- pAutoEntryAttr = static_cast<const SfxBoolItem*>(
- GetItem( *rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO ));
+ pAutoEntryAttr = GetItem( *rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO );
// no_NO is an alias for nb_NO and normally isn't listed, we need it for
// backwards compatibility, but only if the format passed is of
// LanguageType no_NO.
@@ -642,7 +641,7 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl()
#*------------------------------------------------------------------------
#*
#* Class: SvxNumberFormatTabPage
-#* Function: Hides the language settings:
+#* Function: Hides the Languages and Locales:
#* Input: sal_Bool nFlag
#* Output: ---
#*
@@ -673,7 +672,7 @@ bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if ( bDataChanged )
{
const SfxItemSet& rMyItemSet = GetItemSet();
- sal_uInt16 nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
+ TypedWhichId<SfxUInt32Item> nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
SfxItemState eItemState = rMyItemSet.GetItemState( nWhich, false );
// OK chosen - Is format code input entered already taken over?
@@ -719,7 +718,7 @@ bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if ( !aDelFormats.empty() )
{
- pNumItem->SetDelFormats( aDelFormats );
+ pNumItem->SetDelFormats( std::vector(aDelFormats) );
if(bNumItemFlag)
{
@@ -728,11 +727,8 @@ bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
else
{
SfxObjectShell* pDocSh = SfxObjectShell::Current();
-
DBG_ASSERT( pDocSh, "DocShell not found!" );
-
-
- if ( pDocSh )
+ if (pDocSh)
pDocSh->PutItem( *pNumItem );
}
}
@@ -742,12 +738,11 @@ bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if ( m_xCbSourceFormat->get_sensitive() )
{
- sal_uInt16 _nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE );
- SfxItemState _eItemState = rMyItemSet.GetItemState( _nWhich, false );
- const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(
- GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE ));
+ SfxItemState _eItemState = rMyItemSet.GetItemState( SID_ATTR_NUMBERFORMAT_SOURCE, false );
+ const SfxBoolItem* pBoolItem =
+ GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE );
bool bOld = pBoolItem && pBoolItem->GetValue();
- rCoreAttrs->Put( SfxBoolItem( _nWhich, m_xCbSourceFormat->get_active() ) );
+ rCoreAttrs->Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_xCbSourceFormat->get_active() ) );
if ( !bDataChanged )
bDataChanged = (bOld != m_xCbSourceFormat->get_active() ||
_eItemState != SfxItemState::SET);
@@ -946,7 +941,8 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
m_xBtnNegRed->set_active( bNegRed );
if ( nCategory != CAT_SCIENTIFIC )
{
- m_xBtnThousand->set_sensitive( nCategory != CAT_TIME );
+ m_xBtnThousand->set_sensitive( nCategory != CAT_TIME
+ && !pNumFmtShell->IsNatNum12( theFormat ) );
m_xBtnThousand->set_active( bThousand && nCategory != CAT_TIME );
}
break;
@@ -1148,7 +1144,7 @@ IMPL_LINK(SvxNumberFormatTabPage, DoubleClickHdl_Impl, weld::TreeView&, rLb, boo
#*
#************************************************************************/
-IMPL_LINK(SvxNumberFormatTabPage, SelFormatClickHdl_Impl, weld::Button&, rLb, void)
+IMPL_LINK(SvxNumberFormatTabPage, SelFormatClickHdl_Impl, weld::Toggleable&, rLb, void)
{
SelFormatHdl_Impl(&rLb);
}
@@ -1294,12 +1290,12 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, weld::Button&, rIB, void)
Click_Impl(rIB);
}
-bool SvxNumberFormatTabPage::Click_Impl(weld::Button& rIB)
+bool SvxNumberFormatTabPage::Click_Impl(const weld::Button& rIB)
{
- sal_uLong nReturn = 0;
- constexpr sal_uLong nReturnChanged = 0x1; // THE boolean return value
- constexpr sal_uLong nReturnAdded = 0x2; // temp: format added
- constexpr sal_uLong nReturnOneArea = 0x4; // temp: one area but category changed => ignored
+ sal_uInt8 nReturn = 0;
+ constexpr sal_uInt8 nReturnChanged = 0x1; // THE boolean return value
+ constexpr sal_uInt8 nReturnAdded = 0x2; // temp: format added
+ constexpr sal_uInt8 nReturnOneArea = 0x4; // temp: one area but category changed => ignored
if (&rIB == m_xIbAdd.get())
{ // Also called from FillItemSet() if a temporary currency format has
@@ -1540,7 +1536,7 @@ void SvxNumberFormatTabPage::EditHdl_Impl(const weld::Entry* pEdFormat)
#*
#************************************************************************/
-IMPL_LINK(SvxNumberFormatTabPage, OptClickHdl_Impl, weld::Button&, rOptCtrl, void)
+IMPL_LINK(SvxNumberFormatTabPage, OptClickHdl_Impl, weld::Toggleable&, rOptCtrl, void)
{
OptHdl_Impl(&rOptCtrl);
}
@@ -1680,6 +1676,16 @@ OUString SvxNumberFormatTabPage::GetExpColorString(
}
double fVal = fSvxNumValConst[i];
+ // use lower number for long NatNum12 transliteration
+ if ( ( CAT_CURRENCY == nTmpCatPos || CAT_NUMBER == nTmpCatPos ) &&
+ rFormatStr.indexOf("NatNum12") >= 0 )
+ {
+ if ( CAT_CURRENCY == nTmpCatPos )
+ fVal = 1.2;
+ else
+ fVal = 100; // show also title case for English: One Hundred
+ }
+
OUString aPreviewString;
pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, fVal );
return aPreviewString;
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 48f1a246b0ce..2d084a1cd9af 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <numpages.hxx>
@@ -29,6 +28,7 @@
#include <svl/eitem.hxx>
#include <vcl/svapp.hxx>
#include <svx/colorbox.hxx>
+#include <svx/dlgutil.hxx>
#include <svx/strarray.hxx>
#include <svx/gallery.hxx>
#include <editeng/brushitem.hxx>
@@ -36,13 +36,14 @@
#include <sfx2/objsh.hxx>
#include <vcl/graph.hxx>
#include <vcl/settings.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
#include <editeng/flstitem.hxx>
#include <svx/numvset.hxx>
#include <sfx2/htmlmode.hxx>
#include <unotools/pathoptions.hxx>
#include <svtools/ctrltool.hxx>
#include <svtools/unitconv.hxx>
+#include <svtools/colorcfg.hxx>
#include <com/sun/star/style/NumberingType.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
@@ -50,7 +51,11 @@
#include <com/sun/star/text/XNumberingFormatter.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
+#include <comphelper/lok.hxx>
#include <svx/svxids.hrc>
+#include <o3tl/string_view.hxx>
+#include <officecfg/Office/Common.hxx>
#include <algorithm>
#include <memory>
@@ -71,13 +76,14 @@
#include <o3tl/temporary.hxx>
#include <osl/diagnose.h>
+#include <bitmaps.hlst>
+
using namespace css;
using namespace css::uno;
using namespace css::beans;
using namespace css::lang;
using namespace css::text;
using namespace css::container;
-using namespace css::style;
#define SHOW_NUMBERING 0
#define SHOW_BULLET 1
@@ -116,19 +122,6 @@ static SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const Sequence<PropertyValu
return pNew;
}
-// the selection of bullets from the OpenSymbol
-const sal_Unicode aBulletTypes[] =
-{
- 0x2022,
- 0x25cf,
- 0xe00c,
- 0xe00a,
- 0x2794,
- 0x27a2,
- 0x2717,
- 0x2714
-};
-
// Is one of the masked formats set?
static bool lcl_IsNumFmtSet(SvxNumRule const * pNum, sal_uInt16 nLevelMask)
{
@@ -143,9 +136,9 @@ static bool lcl_IsNumFmtSet(SvxNumRule const * pNum, sal_uInt16 nLevelMask)
return bRet;
}
-static const vcl::Font& lcl_GetDefaultBulletFont()
+static vcl::Font& lcl_GetDefaultBulletFont()
{
- static vcl::Font aDefBulletFont = [&]()
+ static vcl::Font aDefBulletFont = []()
{
vcl::Font tmp("OpenSymbol", "", Size(0, 14));
tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL );
@@ -226,20 +219,19 @@ bool SvxSingleNumPickTabPage::FillItemSet( SfxItemSet* rSet )
void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bIsPreset = pPresetItem->GetValue();
+ if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nActNumLvl = pLevelItem->GetValue();
}
- if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if(const SvxNumBulletItem* pNumItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pNumItem->GetNumRule()) );
}
if(pActNum && *pSaveNum != *pActNum)
{
@@ -273,17 +265,17 @@ void SvxSingleNumPickTabPage::Reset( const SfxItemSet* rSet )
SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
if(eState != SfxItemState::SET)
{
- nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
eState = rSet->GetItemState(nNumItemId, false, &pItem);
if( eState != SfxItemState::SET )
{
- pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
+ pItem = & rSet->Get( nNumItemId );
eState = SfxItemState::SET;
}
}
DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
if(!pActNum)
pActNum.reset( new SvxNumRule(*pSaveNum) );
@@ -314,14 +306,8 @@ IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
{
SvxNumberFormat aFmt(pActNum->GetLevel(i));
aFmt.SetNumberingType(eNewType);
- if(cLocalPrefix == ' ')
- aFmt.SetPrefix( "" );
- else
- aFmt.SetPrefix(_pSet->sPrefix);
- if(cLocalSuffix == ' ')
- aFmt.SetSuffix( "" );
- else
- aFmt.SetSuffix(_pSet->sSuffix);
+ aFmt.SetListFormat(cLocalPrefix == ' ' ? "" : _pSet->sPrefix,
+ cLocalSuffix == ' ' ? "" : _pSet->sSuffix, i);
aFmt.SetCharFormatName("");
aFmt.SetBulletRelSize(100);
pActNum->SetLevel(i, aFmt);
@@ -377,20 +363,19 @@ bool SvxBulletPickTabPage::FillItemSet( SfxItemSet* rSet )
void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bIsPreset = pPresetItem->GetValue();
+ if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nActNumLvl = pLevelItem->GetValue();
}
- if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if(const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
}
if(pActNum && *pSaveNum != *pActNum)
{
@@ -417,23 +402,20 @@ DeactivateRC SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet)
void SvxBulletPickTabPage::Reset( const SfxItemSet* rSet )
{
- const SfxPoolItem* pItem;
// in Draw the item exists as WhichId, in Writer only as SlotId
- SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
- if(eState != SfxItemState::SET)
+ const SvxNumBulletItem* pItem = rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
+ if(!pItem)
{
- nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- eState = rSet->GetItemState(nNumItemId, false, &pItem);
+ nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
+ pItem = rSet->GetItemIfSet(nNumItemId, false);
- if( eState != SfxItemState::SET )
+ if( !pItem )
{
- pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
- eState = SfxItemState::SET;
+ pItem = & rSet->Get( nNumItemId );
}
}
- DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pItem->GetNumRule()) );
if(!pActNum)
pActNum.reset( new SvxNumRule(*pSaveNum) );
@@ -448,8 +430,11 @@ IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
bPreset = false;
bModified = true;
- sal_Unicode cChar = aBulletTypes[m_xExamplesVS->GetSelectedItemId() - 1];
- const vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
+ sal_uInt16 nIndex = m_xExamplesVS->GetSelectedItemId() - 1;
+ sal_Unicode cChar = officecfg::Office::Common::BulletsNumbering::DefaultBullets::get()[nIndex].toChar();
+ vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
+ rActBulletFont.SetFamilyName(
+ officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get()[nIndex]);
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
@@ -459,8 +444,7 @@ IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
SvxNumberFormat aFmt(pActNum->GetLevel(i));
aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
// #i93908# clear suffix for bullet lists
- aFmt.SetPrefix( OUString() );
- aFmt.SetSuffix( OUString() );
+ aFmt.SetListFormat("", "", i);
aFmt.SetBulletFont(&rActBulletFont);
aFmt.SetBulletChar(cChar );
aFmt.SetCharFormatName(sBulletCharFormatName);
@@ -518,11 +502,14 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* pPage, weld::DialogControl
SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
- for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
+ for(sal_Int32 nLevel = 0; nLevel < SVX_MAX_NUM; nLevel++)
{
- Any aValueAny = xLevel->getByIndex(nLevel);
+ // use the last locale-defined level for all remaining levels.
+ sal_Int32 nLocaleLevel = std::min(nLevel, xLevel->getCount() - 1);
Sequence<PropertyValue> aLevelProps;
- aValueAny >>= aLevelProps;
+ if (nLocaleLevel >= 0)
+ xLevel->getByIndex(nLocaleLevel) >>= aLevelProps;
+
SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aLevelProps);
rItemArr.push_back( std::unique_ptr<SvxNumSettings_Impl>(pNew) );
}
@@ -560,20 +547,19 @@ bool SvxNumPickTabPage::FillItemSet( SfxItemSet* rSet )
void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bIsPreset = pPresetItem->GetValue();
+ if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nActNumLvl = pLevelItem->GetValue();
}
- if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if(const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
}
if(pActNum && *pSaveNum != *pActNum)
{
@@ -600,23 +586,19 @@ DeactivateRC SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
void SvxNumPickTabPage::Reset( const SfxItemSet* rSet )
{
- const SfxPoolItem* pItem;
// in Draw the item exists as WhichId, in Writer only as SlotId
- SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
- if(eState != SfxItemState::SET)
+ const SvxNumBulletItem* pItem = rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
+ if(!pItem)
{
- nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- eState = rSet->GetItemState(nNumItemId, false, &pItem);
+ nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
+ pItem = rSet->GetItemIfSet(nNumItemId, false);
- if( eState != SfxItemState::SET )
+ if( !pItem )
{
- pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
- eState = SfxItemState::SET;
+ pItem = & rSet->Get( nNumItemId );
}
-
}
- DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pItem->GetNumRule()) );
if(!pActNum)
pActNum.reset( new SvxNumRule(*pSaveNum) );
@@ -652,25 +634,25 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
{
// #i93908# clear suffix for bullet lists
- aFmt.SetPrefix(OUString());
- aFmt.SetSuffix(OUString());
+ aFmt.SetListFormat("", "", i);
if( !pLevelSettings->sBulletFont.isEmpty() &&
pLevelSettings->sBulletFont != rActBulletFont.GetFamilyName())
{
//search for the font
if(!pList)
{
- SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
- const SvxFontListItem* pFontListItem =
- static_cast<const SvxFontListItem*>( pCurDocShell
- ->GetItem( SID_ATTR_CHAR_FONTLIST ));
- pList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
+ if (SfxObjectShell* pCurDocShell = SfxObjectShell::Current())
+ {
+ const SvxFontListItem* pFontListItem =
+ static_cast<const SvxFontListItem*>( pCurDocShell
+ ->GetItem( SID_ATTR_CHAR_FONTLIST ));
+ pList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
+ }
}
if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )
{
- FontMetric aFontMetric = pList->Get(
- pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);
- vcl::Font aFont(aFontMetric);
+ vcl::Font aFont(pList->Get(
+ pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE));
aFmt.SetBulletFont(&aFont);
}
else
@@ -698,12 +680,16 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
}
else
{
- aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0));
+ aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 1));
aFmt.SetCharFormatName(sNumCharFmtName);
aFmt.SetBulletRelSize(100);
+
+ // Completely ignore the Left/Right value provided by the locale outline definition,
+ // because this function doesn't actually modify the indents at all,
+ // and right-adjusted numbering definitely needs a different FirstLineIndent.
+
// #i93908#
- aFmt.SetPrefix(pLevelSettings->sPrefix);
- aFmt.SetSuffix(pLevelSettings->sSuffix);
+ aFmt.SetListFormat(pLevelSettings->sPrefix, pLevelSettings->sSuffix, i);
}
pActNum->SetLevel(i, aFmt);
}
@@ -744,7 +730,10 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(weld::Container* pPage, weld::DialogC
m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
m_xBtBrowseFile->connect_clicked(LINK(this, SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl));
- eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
+ if(comphelper::LibreOfficeKit::isActive())
+ m_xBtBrowseFile->hide();
+
+ eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE));
// determine graphic name
GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
@@ -755,8 +744,12 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(weld::Container* pPage, weld::DialogC
m_xExamplesVS->InsertItem( i + 1, i);
INetURLObject aObj(grfName);
- if(aObj.GetProtocol() == INetProtocol::File)
- grfName = aObj.PathToFileName();
+ if (aObj.GetProtocol() == INetProtocol::File)
+ {
+ // tdf#114070 - only show the last name of the filename without its extension
+ aObj.removeExtension();
+ grfName = aObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous);
+ }
m_xExamplesVS->SetItemText( i + 1, grfName );
++i;
@@ -788,20 +781,19 @@ std::unique_ptr<SfxTabPage> SvxBitmapPickTabPage::Create(weld::Container* pPage,
void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bIsPreset = pPresetItem->GetValue();
+ if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nActNumLvl = pLevelItem->GetValue();
}
- if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if(const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
}
if(pActNum && *pSaveNum != *pActNum)
{
@@ -845,23 +837,21 @@ bool SvxBitmapPickTabPage::FillItemSet( SfxItemSet* rSet )
void SvxBitmapPickTabPage::Reset( const SfxItemSet* rSet )
{
- const SfxPoolItem* pItem;
// in Draw the item exists as WhichId, in Writer only as SlotId
- SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
- if(eState != SfxItemState::SET)
+ const SvxNumBulletItem* pItem = rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
+ if(!pItem)
{
- nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- eState = rSet->GetItemState(nNumItemId, false, &pItem);
+ nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
+ pItem = rSet->GetItemIfSet(nNumItemId, false);
- if( eState != SfxItemState::SET )
+ if( !pItem )
{
- pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
- eState = SfxItemState::SET;
+ pItem = & rSet->Get( nNumItemId );
}
}
- DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ DBG_ASSERT(pItem, "no item found!");
+ pSaveNum.reset( new SvxNumRule(pItem->GetNumRule()) );
if(!pActNum)
pActNum.reset( new SvxNumRule(*pSaveNum) );
@@ -885,8 +875,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
{
SvxNumberFormat aFmt(pActNum->GetLevel(i));
aFmt.SetNumberingType(SVX_NUM_BITMAP);
- aFmt.SetPrefix( "" );
- aFmt.SetSuffix( "" );
+ aFmt.SetListFormat("", "", i);
aFmt.SetCharFormatName( "" );
Graphic aGraphic;
@@ -916,12 +905,13 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, void)
IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, void)
{
sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, GetFrameWeld());
- aFileDialog.SetTitle(CuiResId(RID_SVXSTR_ADD_IMAGE));
+ aFileDialog.SetContext(sfx2::FileDialogHelper::BulletsAddImage);
+ aFileDialog.SetTitle(CuiResId(RID_CUISTR_ADD_IMAGE));
if ( aFileDialog.Execute() != ERRCODE_NONE )
return;
OUString aPath = SvtPathOptions().GetGalleryPath();
- OUString aPathToken = aPath.getToken( 1 , SEARCHPATH_DELIMITER );
+ std::u16string_view aPathToken = o3tl::getToken(aPath, 1 , SEARCHPATH_DELIMITER );
OUString aUserImageURL = aFileDialog.GetPath();
@@ -932,7 +922,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
else if (nPos<aUserImageURL.getLength())
aFileName = aUserImageURL.copy(nPos);
- OUString aUserGalleryURL = aPathToken + "/" + aFileName;
+ OUString aUserGalleryURL = OUString::Concat(aPathToken) + "/" + aFileName;
INetURLObject aURL( aUserImageURL );
DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
@@ -975,11 +965,10 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
Graphic aScaledGraphic( aBitmap );
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
- Sequence< PropertyValue > aFilterData( 2 );
- aFilterData[ 0 ].Name = "Compression";
- aFilterData[ 0 ].Value <<= sal_Int32(-1) ;
- aFilterData[ 1 ].Name = "Quality";
- aFilterData[ 1 ].Value <<= sal_Int32(1);
+ Sequence< PropertyValue > aFilterData{
+ comphelper::makePropertyValue("Compression", sal_Int32(-1)),
+ comphelper::makePropertyValue("Quality", sal_Int32(1))
+ };
sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( gURL.GetFileExtension() );
rFilter.ExportGraphic( aScaledGraphic, gURL , nFilterFormat, &aFilterData );
@@ -991,8 +980,12 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
{
m_xExamplesVS->InsertItem( i + 1, i);
INetURLObject aObj(grfName);
- if(aObj.GetProtocol() == INetProtocol::File)
- grfName = aObj.PathToFileName();
+ if (aObj.GetProtocol() == INetProtocol::File)
+ {
+ // tdf#114070 - only show the last name of the filename without its extension
+ aObj.removeExtension();
+ grfName = aObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous);
+ }
m_xExamplesVS->SetItemText( i + 1, grfName );
++i;
}
@@ -1012,6 +1005,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/numberingoptionspage.ui", "NumberingOptionsPage", &rSet)
+ , aInvalidateTimer("cui SvxNumOptionsTabPage aInvalidateTimer")
, m_pLevelHdlEvent(nullptr)
, bLastWidthModified(false)
, bModified(false)
@@ -1021,6 +1015,8 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
, nBullet(0xff)
, nActNumLvl(1)
, nNumItemId(SID_ATTR_NUMBERING_RULE)
+ , m_aRatioTop(ConnectorType::Top)
+ , m_aRatioBottom(ConnectorType::Bottom)
, m_xGrid(m_xBuilder->weld_widget("grid2"))
, m_xLevelLB(m_xBuilder->weld_tree_view("levellb"))
, m_xFmtLB(m_xBuilder->weld_combo_box("numfmtlb"))
@@ -1032,11 +1028,13 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
, m_xCharFmtFT(m_xBuilder->weld_label("charstyleft"))
, m_xCharFmtLB(m_xBuilder->weld_combo_box("charstyle"))
, m_xBulColorFT(m_xBuilder->weld_label("colorft"))
- , m_xBulColLB(new ColorListBox(m_xBuilder->weld_menu_button("color"), pController->getDialog()))
+ , m_xBulColLB(new ColorListBox(m_xBuilder->weld_menu_button("color"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xBulRelSizeFT(m_xBuilder->weld_label("relsizeft"))
, m_xBulRelSizeMF(m_xBuilder->weld_metric_spin_button("relsize", FieldUnit::PERCENT))
, m_xAllLevelFT(m_xBuilder->weld_label("sublevelsft"))
, m_xAllLevelNF(m_xBuilder->weld_spin_button("sublevels"))
+ , m_xIsLegalCB(m_xBuilder->weld_check_button("islegal"))
, m_xStartFT(m_xBuilder->weld_label("startatft"))
, m_xStartED(m_xBuilder->weld_spin_button("startat"))
, m_xBulletFT(m_xBuilder->weld_label("bulletft"))
@@ -1048,6 +1046,9 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
, m_xHeightFT(m_xBuilder->weld_label("heightft"))
, m_xHeightMF(m_xBuilder->weld_metric_spin_button("heightmf", FieldUnit::CM))
, m_xRatioCB(m_xBuilder->weld_check_button("keepratio"))
+ , m_xCbxScaleImg(m_xBuilder->weld_image("imRatio"))
+ , m_xImgRatioTop(new weld::CustomWeld(*m_xBuilder, "daRatioTop", m_aRatioTop))
+ , m_xImgRatioBottom(new weld::CustomWeld(*m_xBuilder, "daRatioBottom", m_aRatioBottom))
, m_xOrientFT(m_xBuilder->weld_label("orientft"))
, m_xOrientLB(m_xBuilder->weld_combo_box("orientlb"))
, m_xAllLevelsFrame(m_xBuilder->weld_widget("levelsframe"))
@@ -1059,6 +1060,18 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xBulRelSizeMF->set_increments(5, 50, FieldUnit::PERCENT);
SetExchangeSupport();
aActBulletFont = lcl_GetDefaultBulletFont();
+ // vertical alignment = fill makes the drawingarea expand the associated spinedits so we have to size it here
+ const sal_Int16 aHeight
+ = static_cast<sal_Int16>(std::max(int(m_xRatioCB->get_preferred_size().getHeight() / 2
+ - m_xWidthMF->get_preferred_size().getHeight() / 2),
+ 12));
+ const sal_Int16 aWidth
+ = static_cast<sal_Int16>(m_xRatioCB->get_preferred_size().getWidth() / 2);
+ m_xImgRatioTop->set_size_request(aWidth, aHeight);
+ m_xImgRatioBottom->set_size_request(aWidth, aHeight);
+ //init needed for gtk3
+ m_xCbxScaleImg->set_from_icon_name(m_xRatioCB->get_active() ? RID_SVXBMP_LOCKED
+ : RID_SVXBMP_UNLOCKED);
m_xBulletPB->connect_clicked(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
m_xFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
@@ -1074,6 +1087,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xPrefixED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
m_xSuffixED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
m_xAllLevelNF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
+ m_xIsLegalCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, IsLegalHdl_Impl));
m_xOrientLB->connect_changed(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
m_xSameLevelCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
m_xBulRelSizeMF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
@@ -1081,13 +1095,15 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
aInvalidateTimer.SetInvokeHandler(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
aInvalidateTimer.SetTimeout(50);
- eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
+ eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE));
// Fill ListBox with predefined / translated numbering types.
sal_uInt32 nCount = SvxNumberingTypeTable::Count();
for (sal_uInt32 i = 0; i < nCount; ++i)
{
- m_xFmtLB->append(OUString::number(SvxNumberingTypeTable::GetValue(i)), SvxNumberingTypeTable::GetString(i));
+ int nValue = SvxNumberingTypeTable::GetValue(i);
+ if (comphelper::LibreOfficeKit::isActive() && (nValue & SVX_NUM_BITMAP)) continue;
+ m_xFmtLB->append(OUString::number(nValue), SvxNumberingTypeTable::GetString(i));
}
// Get advanced numbering types from the component.
@@ -1135,19 +1151,18 @@ std::unique_ptr<SfxTabPage> SvxNumOptionsTabPage::Create(weld::Container* pPage,
void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const SfxPoolItem* pItem;
const SfxItemSet* pExampleSet = GetDialogExampleSet();
sal_uInt16 nTmpNumLvl = 1;
if(pExampleSet)
{
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nTmpNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bPreset = pPresetItem->GetValue();
+ if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nTmpNumLvl = pLevelItem->GetValue();
}
- if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if(const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
}
bModified = (!pActNum->Get( 0 ) || bPreset);
@@ -1194,23 +1209,21 @@ bool SvxNumOptionsTabPage::FillItemSet( SfxItemSet* rSet )
void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
{
- const SfxPoolItem* pItem;
// in Draw the item exists as WhichId, in Writer only as SlotId
- SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
- if(eState != SfxItemState::SET)
+ const SvxNumBulletItem* pBulletItem =
+ rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
+ if(!pBulletItem)
{
- nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- eState = rSet->GetItemState(nNumItemId, false, &pItem);
+ nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
+ pBulletItem = rSet->GetItemIfSet(nNumItemId, false);
- if( eState != SfxItemState::SET )
+ if( !pBulletItem )
{
- pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
- eState = SfxItemState::SET;
+ pBulletItem = & rSet->Get( nNumItemId );
}
-
}
- DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ DBG_ASSERT(pBulletItem, "no item found!");
+ pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
// insert levels
if (!m_xLevelLB->n_children())
@@ -1252,12 +1265,16 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
m_aPreviewWIN.SetNumRule(pActNum.get());
m_xSameLevelCB->set_active(pActNum->IsContinuousNumbering());
- SfxObjectShell* pShell;
- if ( SfxItemState::SET == rSet->GetItemState( SID_HTML_MODE, false, &pItem )
- || ( nullptr != ( pShell = SfxObjectShell::Current()) &&
- nullptr != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
+ const SfxUInt16Item* pHtmlModeItem =
+ rSet->GetItemIfSet( SID_HTML_MODE, false );
+ if (!pHtmlModeItem)
{
- sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem( SID_HTML_MODE );
+ }
+ if ( pHtmlModeItem )
+ {
+ sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
}
@@ -1270,6 +1287,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
bool bAllLevel = bContinuous && !bHTMLMode;
m_xAllLevelFT->set_visible(bAllLevel);
m_xAllLevelNF->set_visible(bAllLevel);
+ m_xIsLegalCB->set_visible(bAllLevel);
m_xAllLevelsFrame->set_visible(bContinuous);
@@ -1333,6 +1351,8 @@ void SvxNumOptionsTabPage::InitControls()
bool bSameBulColor = true;
bool bSameBulRelSize= true;
+ TriState isLegal = TRISTATE_INDET;
+
const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
OUString sFirstCharFmt;
sal_Int16 eFirstOrient = text::VertOrientation::NONE;
@@ -1357,6 +1377,7 @@ void SvxNumOptionsTabPage::InitControls()
eFirstOrient = aNumFmtArr[i]->GetVertOrient();
if(bShowBitmap)
aFirstSize = aNumFmtArr[i]->GetGraphicSize();
+ isLegal = aNumFmtArr[i]->GetIsLegal() ? TRISTATE_TRUE : TRISTATE_FALSE;
}
if( i > nLvl)
{
@@ -1366,6 +1387,8 @@ void SvxNumOptionsTabPage::InitControls()
bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
+ if (aNumFmtArr[i]->GetIsLegal() != aNumFmtArr[nLvl]->GetIsLegal())
+ isLegal = TRISTATE_INDET;
bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFormatName();
bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
if(bShowBitmap && bSameSize)
@@ -1438,6 +1461,9 @@ void SvxNumOptionsTabPage::InitControls()
m_xAllLevelNF->set_text("");
}
+ m_xIsLegalCB->set_state(isLegal);
+ m_xIsLegalCB->set_sensitive(!m_xSameLevelCB->get_active());
+
if(bBullRelSize)
{
if(bSameBulRelSize)
@@ -1452,6 +1478,7 @@ void SvxNumOptionsTabPage::InitControls()
else
m_xBulColLB->SetNoSelection();
}
+ m_xStartED->set_value(1); // If this isn't set then changing the bullet type to a numbered type doesn't reset the start level
switch(nBullet)
{
case SHOW_NUMBERING:
@@ -1481,7 +1508,7 @@ void SvxNumOptionsTabPage::InitControls()
{
if (!sFirstCharFmt.isEmpty())
m_xCharFmtLB->set_active_text(sFirstCharFmt);
- else
+ else if (m_xCharFmtLB->get_count())
m_xCharFmtLB->set_active(0);
}
else
@@ -1517,6 +1544,7 @@ void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType )
bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
m_xAllLevelFT->set_visible(bAllLevel);
m_xAllLevelNF->set_visible(bAllLevel);
+ m_xIsLegalCB->set_visible(bAllLevel);
m_xStartFT->set_visible(!(bBullet||bBitmap));
m_xStartED->set_visible(!(bBullet||bBitmap));
@@ -1538,6 +1566,9 @@ void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType )
m_xHeightFT->set_visible(bBitmap);
m_xHeightMF->set_visible(bBitmap);
m_xRatioCB->set_visible(bBitmap);
+ m_xCbxScaleImg->set_visible(bBitmap);
+ m_xImgRatioTop->set_visible(bBitmap);
+ m_xImgRatioBottom->set_visible(bBitmap);
m_xOrientFT->set_visible(bBitmap && bAllLevelFeature);
m_xOrientLB->set_visible(bBitmap && bAllLevelFeature);
@@ -1616,7 +1647,9 @@ IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void)
if(nActNumLvl & nMask)
{
SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
- aNumFmt.SetIncludeUpperLevels(static_cast<sal_uInt8>(std::min(rBox.get_value(), int(e + 1))) );
+ aNumFmt.SetIncludeUpperLevels(static_cast<sal_uInt8>(std::min(rBox.get_value(), sal_Int64(e + 1))) );
+ // Set the same prefix/suffix to generate list format with changed IncludedUpperLevels
+ aNumFmt.SetListFormat(aNumFmt.GetPrefix(), aNumFmt.GetSuffix(), e);
pActNum->SetLevel(e, aNumFmt);
}
nMask <<= 1;
@@ -1624,6 +1657,21 @@ IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void)
SetModified();
}
+IMPL_LINK(SvxNumOptionsTabPage, IsLegalHdl_Impl, weld::Toggleable&, rBox, void)
+{
+ bool bSet = rBox.get_active();
+ for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ {
+ if (nActNumLvl & (sal_uInt16(1) << i))
+ {
+ SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ aNumFmt.SetIsLegal(bSet);
+ pActNum->SetLevel(i, aNumFmt);
+ }
+ }
+ SetModified();
+}
+
IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, void)
{
OUString sSelectStyle;
@@ -1642,9 +1690,8 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN)))
{
bBmp |= nullptr != aNumFmt.GetBrush();
- aNumFmt.SetIncludeUpperLevels( 0 );
- aNumFmt.SetSuffix( "" );
- aNumFmt.SetPrefix( "" );
+ aNumFmt.SetIncludeUpperLevels( 1 );
+ aNumFmt.SetListFormat("", "", i);
if(!bBmp)
aNumFmt.SetGraphic("");
pActNum->SetLevel(i, aNumFmt);
@@ -1653,9 +1700,8 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
}
else if( SVX_NUM_CHAR_SPECIAL == nNumberingType )
{
- aNumFmt.SetIncludeUpperLevels( 0 );
- aNumFmt.SetSuffix( "" );
- aNumFmt.SetPrefix( "" );
+ aNumFmt.SetIncludeUpperLevels( 1 );
+ aNumFmt.SetListFormat("", "", i);
if( !aNumFmt.GetBulletFont() )
aNumFmt.SetBulletFont(&aActBulletFont);
if( !aNumFmt.GetBulletChar() )
@@ -1670,8 +1716,8 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
}
else
{
- aNumFmt.SetPrefix( m_xPrefixED->get_text() );
- aNumFmt.SetSuffix( m_xSuffixED->get_text() );
+ aNumFmt.SetListFormat(m_xPrefixED->get_text(), m_xSuffixED->get_text(), i);
+
SwitchNumberType(SHOW_NUMBERING);
pActNum->SetLevel(i, aNumFmt);
CheckForStartValue_Impl(nNumberingType);
@@ -1741,7 +1787,7 @@ IMPL_LINK(SvxNumOptionsTabPage, OrientHdl_Impl, weld::ComboBox&, rBox, void)
SetModified(false);
}
-IMPL_LINK(SvxNumOptionsTabPage, SameLevelHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxNumOptionsTabPage, SameLevelHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bSet = rBox.get_active();
pActNum->SetContinuousNumbering(bSet);
@@ -1795,14 +1841,14 @@ IMPL_LINK(SvxNumOptionsTabPage, BulRelSizeHdl_Impl, weld::MetricSpinButton&, rFi
SetModified();
}
-IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
+IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
{
OUString aGrfName;
Size aSize;
bool bSucc(false);
- SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetFrameWeld());
+ SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_CUISTR_EDIT_GRAPHIC), GetFrameWeld());
- OString sNumber;
+ OUString sNumber;
if (rIdent.startsWith("gallery", &sNumber))
{
auto idx = sNumber.toUInt32();
@@ -1873,7 +1919,7 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
aInvalidateTimer.Start();
}
-IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::Toggleable&, void)
{
if (m_xGalleryMenu)
return;
@@ -1895,8 +1941,12 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::ToggleButton&
sGrfName = grfName;
OUString sItemId = "gallery" + OUString::number(i);
INetURLObject aObj(sGrfName);
- if(aObj.GetProtocol() == INetProtocol::File)
- sGrfName = aObj.PathToFileName();
+ if (aObj.GetProtocol() == INetProtocol::File)
+ {
+ // tdf#141334 - only show the last name of the filename without its extension
+ aObj.removeExtension();
+ sGrfName = aObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous);
+ }
if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
{
BitmapEx aBitmap(aGraphic.GetBitmapEx());
@@ -1928,7 +1978,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
SvxCharacterMap aMap(GetFrameWeld(), nullptr, nullptr);
sal_uInt16 nMask = 1;
- const vcl::Font* pFmtFont = nullptr;
+ std::optional<vcl::Font> pFmtFont;
bool bSameBullet = true;
sal_UCS4 cBullet = 0;
bool bFirst = true;
@@ -2049,8 +2099,9 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
SetModified(bRepaint);
}
-IMPL_LINK(SvxNumOptionsTabPage, RatioHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxNumOptionsTabPage, RatioHdl_Impl, weld::Toggleable&, rBox, void)
{
+ m_xCbxScaleImg->set_from_icon_name(m_xRatioCB->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED);
if (rBox.get_active())
{
if (bLastWidthModified)
@@ -2097,8 +2148,7 @@ IMPL_LINK(SvxNumOptionsTabPage, SpinModifyHdl_Impl, weld::SpinButton&, rSpinButt
void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit)
{
- bool bPrefix = pEdit == m_xPrefixED.get();
- bool bSuffix = pEdit == m_xSuffixED.get();
+ bool bPrefixSuffix = (pEdit == m_xPrefixED.get())|| (pEdit == m_xSuffixED.get());
bool bStart = pEdit == m_xStartED.get();
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
@@ -2106,10 +2156,8 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit)
if(nActNumLvl & nMask)
{
SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
- if(bPrefix)
- aNumFmt.SetPrefix(m_xPrefixED->get_text());
- else if(bSuffix)
- aNumFmt.SetSuffix(m_xSuffixED->get_text());
+ if (bPrefixSuffix)
+ aNumFmt.SetListFormat(m_xPrefixED->get_text(), m_xSuffixED->get_text(), i);
else if(bStart)
aNumFmt.SetStart(m_xStartED->get_value());
pActNum->SetLevel(i, aNumFmt);
@@ -2119,353 +2167,6 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit)
SetModified();
}
-static tools::Long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, tools::Long nXStart,
- tools::Long nYMiddle, tools::Long nDivision)
-{
- const SvxBrushItem* pBrushItem = rFmt.GetBrush();
- tools::Long nRet = 0;
- if(pBrushItem)
- {
- const Graphic* pGrf = pBrushItem->GetGraphic();
- if(pGrf)
- {
- Size aGSize( rFmt.GetGraphicSize() );
- aGSize.setWidth( aGSize.Width() / nDivision );
- nRet = aGSize.Width();
- aGSize.setHeight( aGSize.Height() / nDivision );
- pGrf->Draw( pVDev, Point(nXStart,nYMiddle - ( aGSize.Height() / 2) ),
- pVDev->PixelToLogic( aGSize ) );
- }
- }
- return nRet;
-
-}
-
-static tools::Long lcl_DrawBullet(VirtualDevice* pVDev,
- const SvxNumberFormat& rFmt, tools::Long nXStart,
- tools::Long nYStart, const Size& rSize)
-{
- vcl::Font aTmpFont(pVDev->GetFont());
-
- // via Uno it's possible that no font has been set!
- vcl::Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont);
- Size aTmpSize(rSize);
- aTmpSize.setWidth( aTmpSize.Width() * ( rFmt.GetBulletRelSize()) );
- aTmpSize.setWidth( aTmpSize.Width() / 100 ) ;
- aTmpSize.setHeight( aTmpSize.Height() * ( rFmt.GetBulletRelSize()) );
- aTmpSize.setHeight( aTmpSize.Height() / 100 ) ;
- // in case of a height of zero it is drawn in original height
- if(!aTmpSize.Height())
- aTmpSize.setHeight( 1 );
- aFont.SetFontSize(aTmpSize);
- aFont.SetTransparent(true);
- Color aBulletColor = rFmt.GetBulletColor();
- if(aBulletColor == COL_AUTO)
- aBulletColor = pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK;
- else if(aBulletColor == pVDev->GetFillColor())
- aBulletColor.Invert();
- aFont.SetColor(aBulletColor);
- pVDev->SetFont( aFont );
- sal_UCS4 cChar = rFmt.GetBulletChar();
- OUString aText(&cChar, 1);
- tools::Long nY = nYStart;
- nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
- pVDev->DrawText( Point(nXStart, nY), aText );
- tools::Long nRet = pVDev->GetTextWidth(aText);
-
- pVDev->SetFont(aTmpFont);
- return nRet;
-}
-
-SvxNumberingPreview::SvxNumberingPreview()
- : pActNum(nullptr)
- , bPosition(false)
- , nActLevel(SAL_MAX_UINT16)
-{
-}
-
-// paint preview of numeration
-void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
-{
- Size aSize(rRenderContext.PixelToLogic(GetOutputSizePixel()));
-
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- const Color aBackColor = rStyleSettings.GetFieldColor();
- const Color aTextColor = rStyleSettings.GetFieldTextColor();
-
- ScopedVclPtrInstance<VirtualDevice> pVDev(rRenderContext);
- pVDev->EnableRTL(rRenderContext.IsRTLEnabled());
- pVDev->SetMapMode(rRenderContext.GetMapMode());
- pVDev->SetOutputSize(aSize);
-
- Color aLineColor(COL_LIGHTGRAY);
- if (aLineColor == aBackColor)
- aLineColor.Invert();
- pVDev->SetLineColor(aLineColor);
- pVDev->SetFillColor(aBackColor);
-
- if (pActNum)
- {
- tools::Long nWidthRelation = 30; // chapter dialog
-
- // height per level
- tools::Long nXStep = aSize.Width() / (3 * pActNum->GetLevelCount());
- if (pActNum->GetLevelCount() < 10)
- nXStep /= 2;
- tools::Long nYStart = 4;
- // the whole height mustn't be used for a single level
- tools::Long nYStep = (aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5);
-
- aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getSystemLanguage(), GetDefaultFontFlags::OnlyOne);
- aStdFont.SetColor(aTextColor);
- aStdFont.SetFillColor(aBackColor);
-
- tools::Long nFontHeight = nYStep * 6 / 10;
- if (bPosition)
- nFontHeight = nYStep * 15 / 10;
- aStdFont.SetFontSize(Size( 0, nFontHeight ));
-
- SvxNodeNum aNum;
- sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart();
-
- if (bPosition)
- {
- tools::Long nLineHeight = nFontHeight * 8 / 7;
- sal_uInt8 nStart = 0;
- while (!(nActLevel & (1<<nStart)))
- {
- nStart++;
- }
- if (nStart)
- nStart--;
- sal_uInt8 nEnd = std::min(sal_uInt8(nStart + 3), sal_uInt8(pActNum->GetLevelCount()));
- for (sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel)
- {
- const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
- aNum.GetLevelVal()[nLevel] = rFmt.GetStart();
-
- tools::Long nXStart( 0 );
- short nTextOffset( 0 );
- tools::Long nNumberXPos( 0 );
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
- nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
- nNumberXPos = nXStart;
- tools::Long nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
-
- if (nFirstLineOffset <= nNumberXPos)
- nNumberXPos = nNumberXPos - nFirstLineOffset;
- else
- nNumberXPos = 0;
- // in draw this is valid
- if (nTextOffset < 0)
- nNumberXPos = nNumberXPos + nTextOffset;
- }
- else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
- {
- const tools::Long nTmpNumberXPos((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
- if (nTmpNumberXPos < 0)
- {
- nNumberXPos = 0;
- }
- else
- {
- nNumberXPos = nTmpNumberXPos;
- }
- }
-
- tools::Long nBulletWidth = 0;
- if (SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
- {
- tools::Long nYMiddle = nYStart + ( nFontHeight / 2 );
- nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev.get(), rFmt, nNumberXPos, nYMiddle, nWidthRelation) : 0;
- }
- else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
- {
- nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawBullet(pVDev.get(), rFmt, nNumberXPos, nYStart, aStdFont.GetFontSize()) : 0;
- }
- else
- {
- pVDev->SetFont(aStdFont);
- aNum.SetLevel(nLevel);
- if (pActNum->IsContinuousNumbering())
- aNum.GetLevelVal()[nLevel] = nPreNum;
- OUString aText(pActNum->MakeNumString( aNum ));
- vcl::Font aSaveFont = pVDev->GetFont();
- vcl::Font aColorFont(aSaveFont);
- Color aTmpBulletColor = rFmt.GetBulletColor();
- if (aTmpBulletColor == COL_AUTO)
- aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
- else if (aTmpBulletColor == aBackColor)
- aTmpBulletColor.Invert();
- aColorFont.SetColor(aTmpBulletColor);
- pVDev->SetFont(aColorFont);
- pVDev->DrawText(Point(nNumberXPos, nYStart), aText);
- pVDev->SetFont(aSaveFont);
- nBulletWidth = pVDev->GetTextWidth(aText);
- nPreNum++;
- }
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
- rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
- {
- pVDev->SetFont(aStdFont);
- OUString aText(' ');
- pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
- nBulletWidth = nBulletWidth + pVDev->GetTextWidth(aText);
- }
-
- tools::Long nTextXPos( 0 );
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nTextXPos = nXStart;
- if (nTextOffset < 0)
- nTextXPos = nTextXPos + nTextOffset;
- if (nNumberXPos + nBulletWidth + nTextOffset > nTextXPos)
- nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
- }
- else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
- {
- switch (rFmt.GetLabelFollowedBy())
- {
- case SvxNumberFormat::LISTTAB:
- {
- nTextXPos = rFmt.GetListtabPos() / nWidthRelation;
- if (nTextXPos < nNumberXPos + nBulletWidth)
- {
- nTextXPos = nNumberXPos + nBulletWidth;
- }
- }
- break;
- case SvxNumberFormat::SPACE:
- case SvxNumberFormat::NOTHING:
- case SvxNumberFormat::NEWLINE:
- {
- nTextXPos = nNumberXPos + nBulletWidth;
- }
- break;
- }
-
- nXStart = rFmt.GetIndentAt() / nWidthRelation;
- }
-
- ::tools::Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
- pVDev->SetFillColor(aBackColor);
- pVDev->DrawRect(aRect1);
-
- ::tools::Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
- pVDev->DrawRect(aRect2);
- nYStart += 2 * nLineHeight;
- }
- }
- else
- {
- //#i5153# painting gray or black rectangles as 'normal' numbering text
- tools::Long nWidth = pVDev->GetTextWidth("Preview");
- tools::Long nTextHeight = pVDev->GetTextHeight();
- tools::Long nRectHeight = nTextHeight * 2 / 3;
- tools::Long nTopOffset = nTextHeight - nRectHeight;
- Color aBlackColor(COL_BLACK);
- if (aBlackColor == aBackColor)
- aBlackColor.Invert();
-
- for (sal_uInt16 nLevel = 0; nLevel < pActNum->GetLevelCount(); ++nLevel, nYStart = nYStart + nYStep)
- {
- const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
- aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
- tools::Long nXStart( 0 );
- pVDev->SetFillColor( aBackColor );
-
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
- }
- else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
- {
- const tools::Long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
- if (nTmpXStart < 0)
- {
- nXStart = 0;
- }
- else
- {
- nXStart = nTmpXStart;
- }
- }
- nXStart /= 2;
- nXStart += 2;
- tools::Long nTextOffset = 2 * nXStep;
- if (SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)))
- {
- if (rFmt.IsShowSymbol())
- {
- tools::Long nYMiddle = nYStart + ( nFontHeight / 2 );
- nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYMiddle, nWidthRelation);
- nTextOffset = nTextOffset + nXStep;
- }
- }
- else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
- {
- if (rFmt.IsShowSymbol())
- {
- nTextOffset = lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetFontSize());
- nTextOffset = nTextOffset + nXStep;
- }
- }
- else
- {
- vcl::Font aFont(aStdFont);
- Size aTmpSize(aStdFont.GetFontSize());
- if(pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE))
- {
- aTmpSize.setWidth( aTmpSize.Width() * ( rFmt.GetBulletRelSize()) );
- aTmpSize.setWidth( aTmpSize.Width() / 100 ) ;
- aTmpSize.setHeight( aTmpSize.Height() * ( rFmt.GetBulletRelSize()) );
- aTmpSize.setHeight( aTmpSize.Height() / 100 ) ;
- }
- if(!aTmpSize.Height())
- aTmpSize.setHeight( 1 );
- aFont.SetFontSize(aTmpSize);
- Color aTmpBulletColor = rFmt.GetBulletColor();
- if (aTmpBulletColor == COL_AUTO)
- aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
- else if (aTmpBulletColor == aBackColor)
- aTmpBulletColor.Invert();
- aFont.SetColor(aTmpBulletColor);
- pVDev->SetFont(aFont);
- aNum.SetLevel( nLevel );
- if (pActNum->IsContinuousNumbering())
- aNum.GetLevelVal()[nLevel] = nPreNum;
- OUString aText(pActNum->MakeNumString(aNum));
- tools::Long nY = nYStart;
- nY -= (pVDev->GetTextHeight() - nTextHeight - pVDev->GetFontMetric().GetDescent());
- pVDev->DrawText(Point(nXStart, nY), aText);
- nTextOffset = pVDev->GetTextWidth(aText);
- nTextOffset = nTextOffset + nXStep;
- nPreNum++;
- pVDev->SetFont(aStdFont);
- }
- //#i5153# the selected rectangle(s) should be black
- if (0 != (nActLevel & (1<<nLevel)))
- {
- pVDev->SetFillColor( aBlackColor );
- pVDev->SetLineColor( aBlackColor );
- }
- else
- {
- //#i5153# unselected levels are gray
- pVDev->SetFillColor( aLineColor );
- pVDev->SetLineColor( aLineColor );
- }
- ::tools::Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
- pVDev->DrawRect(aRect1);
- }
- }
- }
- rRenderContext.DrawOutDev(Point(), aSize, Point(), aSize, *pVDev);
-}
-
-
//See uiconfig/swriter/ui/outlinepositionpage.ui for effectively a duplicate
//dialog to this one, except with a different preview window impl.
//TODO, determine if SwNumPositionTabPage and SvxNumPositionTabPage can be
@@ -2504,6 +2205,13 @@ SvxNumPositionTabPage::SvxNumPositionTabPage(weld::Container* pPage, weld::Dialo
{
SetExchangeSupport();
+ // set metric
+ FieldUnit eFUnit = GetModuleFieldUnit(rSet);
+
+ SetFieldUnit( *m_xDistBorderMF, eFUnit );
+ SetFieldUnit( *m_xIndentMF, eFUnit );
+ SetFieldUnit( *m_xDistNumMF, eFUnit );
+
m_xAlignedAtMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
m_xListtabMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
m_xIndentAtMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
@@ -2534,7 +2242,7 @@ SvxNumPositionTabPage::SvxNumPositionTabPage(weld::Container* pPage, weld::Dialo
m_xRelativeCB->set_active(bLastRelative);
m_aPreviewWIN.SetPositionMode();
- eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
+ eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE));
}
SvxNumPositionTabPage::~SvxNumPositionTabPage()
@@ -2745,19 +2453,18 @@ void SvxNumPositionTabPage::InitControls()
void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const SfxPoolItem* pItem;
sal_uInt16 nTmpNumLvl = 1;
const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nTmpNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bPreset = pPresetItem->GetValue();
+ if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nTmpNumLvl = pLevelItem->GetValue();
}
- if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if(const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
}
bModified = (!pActNum->Get( 0 ) || bPreset);
if(*pSaveNum != *pActNum ||
@@ -2814,23 +2521,21 @@ bool SvxNumPositionTabPage::FillItemSet( SfxItemSet* rSet )
void SvxNumPositionTabPage::Reset( const SfxItemSet* rSet )
{
- const SfxPoolItem* pItem;
// in Draw the item exists as WhichId, in Writer only as SlotId
- SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
- if(eState != SfxItemState::SET)
+ const SvxNumBulletItem* pItem =
+ rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
+ if(!pItem)
{
- nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- eState = rSet->GetItemState(nNumItemId, false, &pItem);
+ nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
+ pItem = rSet->GetItemIfSet(nNumItemId, false);
- if( eState != SfxItemState::SET )
+ if( !pItem )
{
- pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
- eState = SfxItemState::SET;
+ pItem = & rSet->Get( nNumItemId );
}
-
}
- DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
+ DBG_ASSERT(pItem, "no item found!");
+ pSaveNum.reset( new SvxNumRule(pItem->GetNumRule()) );
// insert levels
if (!m_xLevelLB->count_selected_rows())
@@ -3099,7 +2804,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
}
}
-IMPL_LINK(SvxNumPositionTabPage, RelativeHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxNumPositionTabPage, RelativeHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bOn = rBox.get_active();
bool bSingleSelection = m_xLevelLB->count_selected_rows() == 1 && SAL_MAX_UINT16 != nActNumLvl;
@@ -3338,9 +3043,8 @@ void SvxNumOptionsTabPage::PageCreated(const SfxAllItemSet& aSet)
if (pListItem)
{
const std::vector<OUString> &aList = pListItem->GetList();
- sal_uInt32 nCount = aList.size();
- for(sal_uInt32 i = 0; i < nCount; i++)
- m_xCharFmtLB->append_text(aList[i]);
+ for (const auto& rItem : aList)
+ m_xCharFmtLB->append_text(rItem);
}
if (pMetricItem)
SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index cc3cbcff0bb2..0fec60690e9a 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -18,10 +18,12 @@
*/
#include <memory>
+#include <o3tl/unit_conversion.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/viewsh.hxx>
-#include <svl/languageoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <svtools/unitconv.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -47,29 +49,24 @@
#include <editeng/eerdll.hxx>
#include <editeng/editrids.hrc>
#include <svx/svxids.hrc>
-#include <svtools/optionsdrawinglayer.hxx>
#include <svl/slstitm.hxx>
#include <svx/xdef.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <svx/SvxNumOptionsTabPageHelper.hxx>
#include <sal/log.hxx>
#include <svl/grabbagitem.hxx>
+#include <officecfg/Office/Common.hxx>
// static ----------------------------------------------------------------
// #i19922# - tdf#126051 see svx/source/dialog/hdft.cxx and sw/source/uibase/sidebar/PageMarginControl.hxx
-const tools::Long MINBODY = 56; // 1mm in twips rounded
+constexpr tools::Long MINBODY = o3tl::toTwips(1, o3tl::Length::mm); // 1mm in twips rounded
-const sal_uInt16 SvxPageDescPage::pRanges[] =
-{
- SID_ATTR_BORDER_OUTER,
- SID_ATTR_BORDER_SHADOW,
- SID_ATTR_LRSPACE,
- SID_ATTR_PAGE_SHARED,
- SID_SWREGISTER_COLLECTION,
- SID_SWREGISTER_MODE,
- 0
-};
+const WhichRangesContainer SvxPageDescPage::pRanges(
+ svl::Items<
+ SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_LRSPACE, SID_ATTR_PAGE_SHARED,
+ SID_SWREGISTER_COLLECTION, SID_SWREGISTER_MODE>);
// ------- Mapping page layout ------------------------------------------
const SvxPageUsage aArr[] =
@@ -83,7 +80,7 @@ const SvxPageUsage aArr[] =
static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
{
- for ( size_t i = 0; i < SAL_N_ELEMENTS(aArr); ++i )
+ for ( size_t i = 0; i < std::size(aArr); ++i )
if ( aArr[i] == nUsage )
return i;
return 3;
@@ -92,7 +89,7 @@ static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos )
{
- if ( nPos >= SAL_N_ELEMENTS(aArr) )
+ if ( nPos >= std::size(aArr) )
return SvxPageUsage::NONE;
return aArr[nPos];
}
@@ -152,7 +149,6 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
, m_xPaperSizeBox(new SvxPaperSizeListBox(m_xBuilder->weld_combo_box("comboPageFormat")))
, m_xPaperWidthEdit(m_xBuilder->weld_metric_spin_button("spinWidth", FieldUnit::CM))
, m_xPaperHeightEdit(m_xBuilder->weld_metric_spin_button("spinHeight", FieldUnit::CM))
- , m_xOrientationFT(m_xBuilder->weld_label("labelOrientation"))
, m_xPortraitBtn(m_xBuilder->weld_radio_button("radiobuttonPortrait"))
, m_xLandscapeBtn(m_xBuilder->weld_radio_button("radiobuttonLandscape"))
, m_xTextFlowLbl(m_xBuilder->weld_label("labelTextFlow"))
@@ -179,6 +175,8 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
, m_xRegisterLB(m_xBuilder->weld_combo_box("comboRegisterStyle"))
, m_xGutterPositionFT(m_xBuilder->weld_label("labelGutterPosition"))
, m_xGutterPositionLB(m_xBuilder->weld_combo_box("comboGutterPosition"))
+ , m_xRtlGutterCB(m_xBuilder->weld_check_button("checkRtlGutter"))
+ , m_xBackgroundFullSizeCB(m_xBuilder->weld_check_button("checkBackgroundFullSize"))
// Strings stored in UI
, m_xInsideLbl(m_xBuilder->weld_label("labelInner"))
, m_xOutsideLbl(m_xBuilder->weld_label("labelOuter"))
@@ -193,17 +191,18 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
// this page needs ExchangeSupport
SetExchangeSupport();
- SvtLanguageOptions aLangOptions;
- bool bCJK = aLangOptions.IsAsianTypographyEnabled();
- bool bCTL = aLangOptions.IsCTLFontEnabled();
+ bool bCJK = SvtCJKOptions::IsAsianTypographyEnabled();
+ bool bCTL = SvtCTLOptions::IsCTLFontEnabled();
bool bWeb = false;
- const SfxPoolItem* pItem;
- SfxObjectShell* pShell;
- if(SfxItemState::SET == rAttr.GetItemState(SID_HTML_MODE, false, &pItem) ||
- ( nullptr != (pShell = SfxObjectShell::Current()) &&
- nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
- bWeb = 0 != (static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
+ const SfxUInt16Item* pHtmlModeItem = rAttr.GetItemIfSet(SID_HTML_MODE, false);
+ if (!pHtmlModeItem)
+ {
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem(SID_HTML_MODE);
+ }
+ if (pHtmlModeItem)
+ bWeb = 0 != (pHtmlModeItem->GetValue() & HTMLMODE_ON);
// fill text flow listbox with valid entries
@@ -275,21 +274,18 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
nLastTopMargin = m_xTopMarginEdit->convert_value_from(m_xTopMarginEdit->normalize(aPrintOffset.Y() + aPrintSize.Height()), FieldUnit::TWIP);
nLastBottomMargin = m_xBottomMarginEdit->convert_value_from(m_xBottomMarginEdit->normalize(aPrintOffset.Y() + aPrintSize.Height()), FieldUnit::TWIP);
- // #i4219# get DrawingLayer options
- const SvtOptionsDrawinglayer aDrawinglayerOpt;
-
// #i4219# take Maximum now from configuration (1/100th cm)
// was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
- m_xPaperWidthEdit->set_max(m_xPaperWidthEdit->normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FieldUnit::CM);
- m_xPaperHeightEdit->set_max(m_xPaperHeightEdit->normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FieldUnit::CM);
+ m_xPaperWidthEdit->set_max(m_xPaperWidthEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperWidth::get()), FieldUnit::CM);
+ m_xPaperHeightEdit->set_max(m_xPaperHeightEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperHeight::get()), FieldUnit::CM);
// #i4219# also for margins (1/100th cm). Was: 9999, keeping.
- m_xLeftMarginEdit->set_max(m_xLeftMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperLeftMargin()), FieldUnit::MM);
- m_xRightMarginEdit->set_max(m_xRightMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperRightMargin()), FieldUnit::MM);
- m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperTopMargin()), FieldUnit::MM);
- m_xBottomMarginEdit->set_max(m_xBottomMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperBottomMargin()), FieldUnit::MM);
+ m_xLeftMarginEdit->set_max(m_xLeftMarginEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperLeftMargin::get()), FieldUnit::MM);
+ m_xRightMarginEdit->set_max(m_xRightMarginEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperRightMargin::get()), FieldUnit::MM);
+ m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperTopMargin::get()), FieldUnit::MM);
+ m_xBottomMarginEdit->set_max(m_xBottomMarginEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperBottomMargin::get()), FieldUnit::MM);
m_xGutterMarginEdit->set_max(
- m_xGutterMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperLeftMargin()),
+ m_xGutterMarginEdit->normalize(officecfg::Office::Common::Drawinglayer::MaximumPaperLeftMargin::get()),
FieldUnit::MM);
// Get the i18n framework numberings and add them to the listbox.
@@ -314,8 +310,8 @@ void SvxPageDescPage::Init_Impl()
m_xPaperSizeBox->connect_changed(LINK(this, SvxPageDescPage, PaperSizeSelect_Impl));
m_xPaperWidthEdit->connect_value_changed( LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
m_xPaperHeightEdit->connect_value_changed(LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
- m_xLandscapeBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
- m_xPortraitBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
+ m_xLandscapeBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
+ m_xPortraitBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
Link<weld::MetricSpinButton&, void> aLink = LINK(this, SvxPageDescPage, BorderModify_Impl);
m_xLeftMarginEdit->connect_value_changed(aLink);
@@ -363,12 +359,11 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetLower()), eUnit )) );
}
- if (rSet->HasItem(SID_ATTR_CHAR_GRABBAG, &pItem))
+ if (const SfxGrabBagItem* pGragbagItem = rSet->GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
{
- const auto& rGrabBagItem = static_cast<const SfxGrabBagItem&>(*pItem);
bool bGutterAtTop{};
- auto it = rGrabBagItem.GetGrabBag().find("GutterAtTop");
- if (it != rGrabBagItem.GetGrabBag().end())
+ auto it = pGragbagItem->GetGrabBag().find("GutterAtTop");
+ if (it != pGragbagItem->GetGrabBag().end())
{
it->second >>= bGutterAtTop;
}
@@ -382,6 +377,22 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
// Left.
m_xGutterPositionLB->set_active(0);
}
+ it = pGragbagItem->GetGrabBag().find("RtlGutter");
+ bool bRtlGutter{};
+ if (it != pGragbagItem->GetGrabBag().end())
+ {
+ it->second >>= bRtlGutter;
+ m_xRtlGutterCB->set_active(bRtlGutter);
+ m_xRtlGutterCB->show();
+ }
+ it = pGragbagItem->GetGrabBag().find("BackgroundFullSize");
+ bool isBackgroundFullSize{};
+ if (it != pGragbagItem->GetGrabBag().end())
+ {
+ it->second >>= isBackgroundFullSize;
+ m_xBackgroundFullSizeCB->set_active(isBackgroundFullSize);
+ m_xBackgroundFullSizeCB->show();
+ }
}
// general page data
@@ -447,14 +458,14 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
// tdf#130548 disable callbacks on the other of a pair of the radiogroup
// when toggling its partner
- m_xLandscapeBtn->connect_clicked(Link<weld::Button&, void>());
- m_xPortraitBtn->connect_clicked(Link<weld::Button&, void>());
+ m_xLandscapeBtn->connect_toggled(Link<weld::Toggleable&, void>());
+ m_xPortraitBtn->connect_toggled(Link<weld::Toggleable&, void>());
m_xLandscapeBtn->set_active(bLandscape);
m_xPortraitBtn->set_active(!bLandscape);
- m_xLandscapeBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
- m_xPortraitBtn->connect_clicked(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
+ m_xLandscapeBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
+ m_xPortraitBtn->connect_toggled(LINK(this, SvxPageDescPage, SwapOrientation_Impl));
m_aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
@@ -563,21 +574,22 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_xHorzBox->save_state();
m_xAdaptBox->save_state();
m_xGutterPositionLB->save_value();
+ m_xRtlGutterCB->save_state();
+ m_xBackgroundFullSizeCB->save_state();
CheckMarginEdits( true );
if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_MODE))
{
- m_xRegisterCB->set_active(static_cast<const SfxBoolItem&>(rSet->Get(
- SID_SWREGISTER_MODE)).GetValue());
+ m_xRegisterCB->set_active(rSet->Get(SID_SWREGISTER_MODE).GetValue());
m_xRegisterCB->save_state();
RegisterModify(*m_xRegisterCB);
}
if(SfxItemState::SET == rSet->GetItemState(SID_SWREGISTER_COLLECTION))
{
m_xRegisterLB->set_active_text(
- static_cast<const SfxStringItem&>(rSet->Get(SID_SWREGISTER_COLLECTION)).GetValue());
+ rSet->Get(SID_SWREGISTER_COLLECTION).GetValue());
m_xRegisterLB->save_value();
}
@@ -651,14 +663,25 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
if (rOldSet.HasItem(SID_ATTR_CHAR_GRABBAG))
{
// Set gutter position.
- SfxGrabBagItem aGrabBagItem(
- static_cast<const SfxGrabBagItem&>(rOldSet.Get(SID_ATTR_CHAR_GRABBAG)));
+ SfxGrabBagItem aGrabBagItem(rOldSet.Get(SID_ATTR_CHAR_GRABBAG));
if (m_xGutterPositionLB->get_value_changed_from_saved())
{
bool bGutterAtTop = m_xGutterPositionLB->get_active() == 1;
aGrabBagItem.GetGrabBag()["GutterAtTop"] <<= bGutterAtTop;
bModified = true;
}
+ if (m_xRtlGutterCB->get_state_changed_from_saved())
+ {
+ bool const bRtlGutter(m_xRtlGutterCB->get_active());
+ aGrabBagItem.GetGrabBag()["RtlGutter"] <<= bRtlGutter;
+ bModified = true;
+ }
+ if (m_xBackgroundFullSizeCB->get_state_changed_from_saved())
+ {
+ bool const isBackgroundFullSize(m_xBackgroundFullSizeCB->get_active());
+ aGrabBagItem.GetGrabBag()["BackgroundFullSize"] <<= isBackgroundFullSize;
+ bModified = true;
+ }
if (bModified)
{
@@ -699,14 +722,14 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
}
// paper tray
- nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
+ TypedWhichId<SvxPaperBinItem> nPaperWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
sal_Int32 nPos = m_xPaperTrayBox->get_active();
sal_uInt16 nBin = m_xPaperTrayBox->get_id(nPos).toInt32();
pOld = GetOldItem( *rSet, SID_ATTR_PAGE_PAPERBIN );
if ( !pOld || static_cast<const SvxPaperBinItem*>(pOld)->GetValue() != nBin )
{
- rSet->Put( SvxPaperBinItem( nWhich, static_cast<sal_uInt8>(nBin) ) );
+ rSet->Put( SvxPaperBinItem( nPaperWhich, static_cast<sal_uInt8>(nBin) ) );
bModified = true;
}
@@ -825,7 +848,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
if (m_xRegisterCB->get_visible() &&
(m_xRegisterCB->get_active() || m_xRegisterCB->get_state_changed_from_saved()))
{
- const SfxBoolItem& rRegItem = static_cast<const SfxBoolItem&>(rOldSet.Get(SID_SWREGISTER_MODE));
+ const SfxBoolItem& rRegItem = rOldSet.Get(SID_SWREGISTER_MODE);
std::unique_ptr<SfxBoolItem> pRegItem(rRegItem.Clone());
bool bCheck = m_xRegisterCB->get_active();
pRegItem->SetValue(bCheck);
@@ -897,8 +920,8 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
}
m_xPaperTrayBox->append(OUString::number(i), aName);
}
- m_xPaperTrayBox->set_active_text(aOldName);
m_xPaperTrayBox->thaw();
+ m_xPaperTrayBox->set_active_text(aOldName);
// tdf#123650 explicitly grab-focus after the modification otherwise gtk loses track
// of there the focus should be
@@ -936,7 +959,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
// Draw: if paper format the margin shall be 1 cm
tools::Long nTmp = 0;
- bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper));
+ bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper)||( PAPER_WIDESCREEN == ePaper)||( PAPER_ONSCREENSHOW_4_3 == ePaper)||( PAPER_ONSCREENSHOW_16_9 == ePaper)||( PAPER_ONSCREENSHOW_16_10 == ePaper));
if ( !bScreen )
// no margin if screen
@@ -978,12 +1001,9 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeModify_Impl, weld::MetricSpinButton&,
RangeHdl_Impl();
}
-IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Button&, rBtn, void)
+IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Toggleable&, rBtn, void)
{
- if (
- !((!bLandscape && &rBtn == m_xLandscapeBtn.get()) ||
- (bLandscape && &rBtn == m_xPortraitBtn.get()))
- )
+ if (!rBtn.get_active())
return;
bLandscape = m_xLandscapeBtn->get_active();
@@ -1113,7 +1133,7 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
{
const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
- const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
+ const SfxBoolItem& rOn = rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON));
if(rOn.GetValue())
{
@@ -1132,7 +1152,7 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
{
// create FillAttributes from SvxBrushItem
const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
- SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*rTmpSet.GetPool());
setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
@@ -1149,7 +1169,7 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
{
const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,false));
const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
- const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
+ const SfxBoolItem& rOn = rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON));
if(rOn.GetValue())
{
@@ -1168,7 +1188,7 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
{
// create FillAttributes from SvxBrushItem
const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
- SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*rTmpSet.GetPool());
setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
@@ -1194,7 +1214,7 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
{
// create FillAttributes from SvxBrushItem
const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem);
- SfxItemSet aTempSet(*rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*rSet.GetPool());
setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
@@ -1222,19 +1242,19 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
{
const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
const SfxBoolItem& rHeaderOn =
- static_cast<const SfxBoolItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
+ rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
if ( rHeaderOn.GetValue() )
{
- const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
- rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
- rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
+ const SvxSizeItem& rSize =
+ rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL =
+ rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
tools::Long nDist = rUL.GetLower();
m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
m_aBspWin.SetHdDist( nDist );
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
- rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxLRSpaceItem& rLR =
+ rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
m_aBspWin.SetHdLeft( rLR.GetLeft() );
m_aBspWin.SetHdRight( rLR.GetRight() );
m_aBspWin.SetHeader( true );
@@ -1258,7 +1278,7 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
{
// aBspWin.SetHdColor(rItem.GetColor());
const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich));
- SfxItemSet aTempSet(*rHeaderSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*rHeaderSet.GetPool());
setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
@@ -1277,19 +1297,19 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
const SfxBoolItem& rFooterOn =
- static_cast<const SfxBoolItem&>(rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
+ rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
if ( rFooterOn.GetValue() )
{
- const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
+ const SvxSizeItem& rSize =
+ rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL =
+ rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
tools::Long nDist = rUL.GetUpper();
m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
m_aBspWin.SetFtDist( nDist );
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxLRSpaceItem& rLR =
+ rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
m_aBspWin.SetFtLeft( rLR.GetLeft() );
m_aBspWin.SetFtRight( rLR.GetRight() );
m_aBspWin.SetFooter( true );
@@ -1313,7 +1333,7 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
{
// aBspWin.SetFtColor(rItem.GetColor());
const SvxBrushItem& rItem = static_cast<const SvxBrushItem&>(rFooterSet.Get(nWhich));
- SfxItemSet aTempSet(*rFooterSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*rFooterSet.GetPool());
setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
@@ -1338,7 +1358,7 @@ DeactivateRC SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
// If not, stay on the TabPage.
Paper ePaper = m_xPaperSizeBox->get_active_id();
- if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && IsMarginOutOfRange() )
+ if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && ePaper != PAPER_WIDESCREEN && ePaper != PAPER_ONSCREENSHOW_4_3 && ePaper != PAPER_ONSCREENSHOW_16_9 && ePaper != PAPER_ONSCREENSHOW_16_10 && IsMarginOutOfRange() )
{
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Question, VclButtonsType::YesNo,
@@ -1414,8 +1434,8 @@ void SvxPageDescPage::RangeHdl_Impl()
SfxItemState::DEFAULT )
{
aBorder = GetMinBorderSpace_Impl(
- static_cast<const SvxShadowItem&>(_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW))),
- static_cast<const SvxBoxItem&>(_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER))));
+ _pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)),
+ _pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER)));
}
// limits paper
@@ -1493,7 +1513,7 @@ void SvxPageDescPage::CalcMargin_Impl()
}
}
-IMPL_LINK_NOARG(SvxPageDescPage, CenterHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxPageDescPage, CenterHdl_Impl, weld::Toggleable&, void)
{
m_aBspWin.SetHorz(m_xHorzBox->get_active());
m_aBspWin.SetVert(m_xVertBox->get_active());
@@ -1516,7 +1536,7 @@ void SvxPageDescPage::SetCollectionList(const std::vector<OUString> &aList)
m_xRegisterCB->connect_toggled(LINK(this, SvxPageDescPage, RegisterModify));
}
-IMPL_LINK(SvxPageDescPage, RegisterModify, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxPageDescPage, RegisterModify, weld::Toggleable&, rBox, void)
{
bool bEnable = false;
if (rBox.get_active())
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index eaa0daf23cfe..11fefa11ed07 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -25,8 +25,8 @@
#include <vcl/settings.hxx>
#include <svx/flagsdef.hxx>
#include <svx/svxids.hrc>
+#include <svx/sdtaitm.hxx>
-#include <svl/languageoptions.hxx>
#include <svl/cjkoptions.hxx>
#include <editeng/pgrditem.hxx>
#include <svx/strings.hrc>
@@ -45,41 +45,47 @@
#include <editeng/lrspitem.hxx>
#include <editeng/formatbreakitem.hxx>
#include <editeng/keepitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+#include <editeng/hngpnctitem.hxx>
+#include <editeng/forbiddenruleitem.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <i18nlangtag/mslangid.hxx>
#include <svx/dlgutil.hxx>
#include <sfx2/htmlmode.hxx>
#include <editeng/paravertalignitem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
-
-const sal_uInt16 SvxStdParagraphTabPage::pStdRanges[] =
-{
- SID_ATTR_PARA_LINESPACE, // 10033
- SID_ATTR_PARA_LINESPACE,
- SID_ATTR_LRSPACE, // 10048 -
- SID_ATTR_ULSPACE, // 10049
- SID_ATTR_PARA_REGISTER, // 10413
- SID_ATTR_PARA_REGISTER,
- 0
-};
-
-const sal_uInt16 SvxParaAlignTabPage::pAlignRanges[] =
-{
- SID_ATTR_PARA_ADJUST, // 10027
- SID_ATTR_PARA_ADJUST,
- 0
-};
-
-const sal_uInt16 SvxExtParagraphTabPage::pExtRanges[] =
-{
- SID_ATTR_PARA_PAGEBREAK, // 10037 -
- SID_ATTR_PARA_WIDOWS, // 10041
- SID_ATTR_PARA_MODEL, // 10065 -
- SID_ATTR_PARA_KEEP, // 10066
- 0
-};
-
-#define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
- // according to BP
+#include <unotools/syslocaleoptions.hxx>
+#include <com/sun/star/text/ParagraphHyphenationKeepType.hpp>
+
+const WhichRangesContainer SvxStdParagraphTabPage::pStdRanges(
+ svl::Items<
+ SID_ATTR_PARA_LINESPACE, SID_ATTR_PARA_LINESPACE, // 10033
+ SID_ATTR_PARA_LEFTSPACE, SID_ATTR_PARA_FIRSTLINESPACE,
+ SID_ATTR_LRSPACE, SID_ATTR_ULSPACE, // 10048 - 10049
+ SID_ATTR_PARA_REGISTER, SID_ATTR_PARA_REGISTER // 10413
+ >);
+
+const WhichRangesContainer SvxParaAlignTabPage::pAlignRanges(
+ svl::Items<
+ SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST, // 10027
+ // tdf#154543 - reset snap to grid to parent
+ SID_ATTR_PARA_SNAPTOGRID, SID_ATTR_PARA_SNAPTOGRID // 10945
+ >);
+
+const WhichRangesContainer SvxParaAlignTabPage::pSdrAlignRanges(
+ svl::Items<
+ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, // 1076
+ SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST , // 10027
+ SID_ATTR_FRAMEDIRECTION, SID_ATTR_FRAMEDIRECTION // 10944
+ >);
+
+const WhichRangesContainer SvxExtParagraphTabPage::pExtRanges(svl::Items<
+ SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS, // 10037 - 10041
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP // 10065 - 10066
+>);
+
+#define MAX_DURCH 31680 // tdf#68335: 1584 pt for UX interoperability with Word
#define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
namespace {
@@ -151,13 +157,15 @@ void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
{
sal_uInt16 nHtmlMode = 0;
- const SfxPoolItem* pItem = nullptr;
- SfxObjectShell* pShell;
- if(SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem) ||
- ( nullptr != (pShell = SfxObjectShell::Current()) &&
- nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ const SfxUInt16Item* pItem = rSet.GetItemIfSet(SID_HTML_MODE, false);
+ if (!pItem)
{
- nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pItem = pShell->GetItem(SID_HTML_MODE);
+ }
+ if(pItem)
+ {
+ nHtmlMode = pItem->GetValue();
}
return nHtmlMode;
@@ -170,34 +178,34 @@ void SvxStdParagraphTabPage::ELRLoseFocus()
FieldUnit eUnit =
MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
- sal_Int64 nL = m_xLeftIndent->denormalize(m_xLeftIndent->get_value(eUnit));
- sal_Int64 nR = m_xRightIndent->denormalize(m_xRightIndent->get_value(eUnit));
- OUString aTmp = m_xFLineIndent->get_text();
+ sal_Int64 nL = m_aLeftIndent.denormalize(m_aLeftIndent.get_value(eUnit));
+ sal_Int64 nR = m_aRightIndent.denormalize(m_aRightIndent.get_value(eUnit));
+ OUString aTmp = m_aFLineIndent.get_text();
- if (m_xLeftIndent->get_min(FieldUnit::NONE) < 0)
- m_xFLineIndent->set_min(-99999, FieldUnit::MM);
+ if (m_aLeftIndent.get_min(FieldUnit::NONE) < 0)
+ m_aFLineIndent.set_min(-99999, FieldUnit::MM);
else
- m_xFLineIndent->set_min(m_xFLineIndent->normalize(-nL), eUnit);
+ m_aFLineIndent.set_min(m_aFLineIndent.normalize(-nL), eUnit);
// Check only for concrete width (Shell)
sal_Int64 nTmp = nWidth - nL - nR - MM50;
- m_xFLineIndent->set_max(m_xFLineIndent->normalize(nTmp), eUnit);
+ m_aFLineIndent.set_max(m_aFLineIndent.normalize(nTmp), eUnit);
if (aTmp.isEmpty())
- m_xFLineIndent->set_text(OUString());
+ m_aFLineIndent.set_text(OUString());
// maximum left right
- aTmp = m_xLeftIndent->get_text();
+ aTmp = m_aLeftIndent.get_text();
nTmp = nWidth - nR - MM50;
- m_xLeftIndent->set_max(m_xLeftIndent->normalize(nTmp), eUnit);
+ m_aLeftIndent.set_max(m_aLeftIndent.normalize(nTmp), eUnit);
if ( aTmp.isEmpty() )
- m_xLeftIndent->set_text(OUString());
- aTmp = m_xRightIndent->get_text();
+ m_aLeftIndent.set_text(OUString());
+ aTmp = m_aRightIndent.get_text();
nTmp = nWidth - nL - MM50;
- m_xRightIndent->set_max(m_xRightIndent->normalize(nTmp), eUnit);
+ m_aRightIndent.set_max(m_aRightIndent.normalize(nTmp), eUnit);
if ( aTmp.isEmpty() )
- m_xRightIndent->set_text(OUString());
+ m_aRightIndent.set_text(OUString());
UpdateExample_Impl();
}
@@ -214,7 +222,6 @@ std::unique_ptr<SfxTabPage> SvxStdParagraphTabPage::Create( weld::Container* pPa
bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
{
- SfxItemState eState = SfxItemState::UNKNOWN;
const SfxPoolItem* pOld = nullptr;
SfxItemPool* pPool = rOutSet->GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
@@ -260,19 +267,18 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
OSL_FAIL( "unknown LineDist entry" );
break;
}
- eState = GetItemSet().GetItemState( nWhich );
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_LINESPACE );
if ( m_bLineDistToggled ||
!pOld || !( *static_cast<const SvxLineSpacingItem*>(pOld) == aSpacing ) ||
- SfxItemState::DONTCARE == eState )
+ SfxItemState::INVALID == GetItemSet().GetItemState( nWhich ) )
{
rOutSet->Put( aSpacing );
bModified = true;
}
}
- if ( m_xTopDist->get_value_changed_from_saved() || m_xBottomDist->get_value_changed_from_saved()
+ if ( m_aTopDist.get_value_changed_from_saved() || m_aBottomDist.get_value_changed_from_saved()
|| m_xContextualCB->get_state_changed_from_saved())
{
nWhich = GetWhich( SID_ATTR_ULSPACE );
@@ -287,29 +293,28 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
const SvxULSpaceItem& rOldItem =
static_cast<const SvxULSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
- if ( m_xTopDist->IsRelative() )
+ if ( m_aTopDist.IsRelative() )
aMargin.SetUpper( rOldItem.GetUpper(),
- static_cast<sal_uInt16>(m_xTopDist->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aTopDist.get_value(FieldUnit::NONE)) );
else
- aMargin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)) );
+ aMargin.SetUpper( static_cast<sal_uInt16>(m_aTopDist.GetCoreValue(eUnit)) );
- if ( m_xBottomDist->IsRelative() )
+ if ( m_aBottomDist.IsRelative() )
aMargin.SetLower( rOldItem.GetLower(),
- static_cast<sal_uInt16>(m_xBottomDist->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aBottomDist.get_value(FieldUnit::NONE)) );
else
- aMargin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)) );
+ aMargin.SetLower( static_cast<sal_uInt16>(m_aBottomDist.GetCoreValue(eUnit)) );
}
else
{
- aMargin.SetUpper(static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)));
- aMargin.SetLower(static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)));
+ aMargin.SetUpper(static_cast<sal_uInt16>(m_aTopDist.GetCoreValue(eUnit)));
+ aMargin.SetLower(static_cast<sal_uInt16>(m_aBottomDist.GetCoreValue(eUnit)));
}
aMargin.SetContextValue(m_xContextualCB->get_active());
- eState = GetItemSet().GetItemState( nWhich );
if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aMargin ||
- SfxItemState::DONTCARE == eState )
+ SfxItemState::INVALID == GetItemSet().GetItemState( nWhich ) )
{
rOutSet->Put( aMargin );
bModified = true;
@@ -317,10 +322,126 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
bool bNullTab = false;
- if ( m_xLeftIndent->get_value_changed_from_saved() ||
- m_xFLineIndent->get_value_changed_from_saved() ||
- m_xRightIndent->get_value_changed_from_saved() ||
- m_xAutoCB->get_state_changed_from_saved() )
+ if (m_bSplitLRSpace && m_aLeftIndent.get_value_changed_from_saved())
+ {
+ nWhich = GetWhich(SID_ATTR_PARA_LEFTSPACE);
+ MapUnit const eUnit = pPool->GetMetric(nWhich);
+ SvxTextLeftMarginItem item(nWhich);
+ pOld = GetOldItem(*rOutSet, SID_ATTR_PARA_LEFTSPACE);
+
+ if (bRelativeMode)
+ {
+ assert(GetItemSet().GetParent());
+
+ const SvxTextLeftMarginItem & rOldItem(
+ static_cast<const SvxTextLeftMarginItem&>(GetItemSet().GetParent()->Get(nWhich)));
+
+ if (m_aLeftIndent.IsRelative())
+ {
+ item.SetTextLeft(rOldItem.GetTextLeft(),
+ static_cast<sal_uInt16>(m_aLeftIndent.get_value(FieldUnit::NONE)));
+ }
+ else
+ {
+ item.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
+ }
+ }
+ else
+ {
+ item.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
+ }
+ if (!pOld || *static_cast<const SvxTextLeftMarginItem*>(pOld) != item
+ || SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
+ {
+ rOutSet->Put(item);
+ bModified = true;
+ }
+ }
+
+ if (m_bSplitLRSpace && m_aRightIndent.get_value_changed_from_saved())
+ {
+ nWhich = GetWhich(SID_ATTR_PARA_RIGHTSPACE);
+ MapUnit const eUnit = pPool->GetMetric(nWhich);
+ SvxRightMarginItem item(nWhich);
+ pOld = GetOldItem(*rOutSet, SID_ATTR_PARA_RIGHTSPACE);
+
+ if (bRelativeMode)
+ {
+ assert(GetItemSet().GetParent());
+
+ const SvxRightMarginItem & rOldItem(
+ static_cast<const SvxRightMarginItem&>(GetItemSet().GetParent()->Get(nWhich)));
+
+ if (m_aRightIndent.IsRelative())
+ {
+ item.SetRight(rOldItem.GetRight(),
+ static_cast<sal_uInt16>(m_aRightIndent.get_value(FieldUnit::NONE)));
+ }
+ else
+ {
+ item.SetRight(m_aRightIndent.GetCoreValue(eUnit));
+ }
+ }
+ else
+ {
+ item.SetRight(m_aRightIndent.GetCoreValue(eUnit));
+ }
+ if (!pOld || *static_cast<const SvxRightMarginItem*>(pOld) != item
+ || SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
+ {
+ rOutSet->Put(item);
+ bModified = true;
+ }
+ }
+
+ if (m_bSplitLRSpace && (m_aFLineIndent.get_value_changed_from_saved()
+ || m_xAutoCB->get_state_changed_from_saved()))
+ {
+ nWhich = GetWhich(SID_ATTR_PARA_FIRSTLINESPACE);
+ MapUnit const eUnit = pPool->GetMetric(nWhich);
+ SvxFirstLineIndentItem item(nWhich);
+ pOld = GetOldItem(*rOutSet, SID_ATTR_PARA_FIRSTLINESPACE);
+
+ if (bRelativeMode)
+ {
+ assert(GetItemSet().GetParent());
+
+ const SvxFirstLineIndentItem & rOldItem(
+ static_cast<const SvxFirstLineIndentItem&>(GetItemSet().GetParent()->Get(nWhich)));
+
+ if (m_aFLineIndent.IsRelative())
+ {
+ item.SetTextFirstLineOffset(rOldItem.GetTextFirstLineOffset(),
+ static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)));
+ }
+ else
+ {
+ item.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
+ }
+ }
+ else
+ {
+ item.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
+ }
+ item.SetAutoFirst(m_xAutoCB->get_active());
+ if (item.GetTextFirstLineOffset() < 0)
+ {
+ bNullTab = true;
+ }
+
+ if (!pOld || *static_cast<const SvxFirstLineIndentItem*>(pOld) != item
+ || SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
+ {
+ rOutSet->Put(item);
+ bModified = true;
+ }
+ }
+
+ if (!m_bSplitLRSpace &&
+ (m_aLeftIndent.get_value_changed_from_saved() ||
+ m_aFLineIndent.get_value_changed_from_saved() ||
+ m_aRightIndent.get_value_changed_from_saved() ||
+ m_xAutoCB->get_state_changed_from_saved()))
{
nWhich = GetWhich( SID_ATTR_LRSPACE );
MapUnit eUnit = pPool->GetMetric( nWhich );
@@ -334,37 +455,36 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
const SvxLRSpaceItem& rOldItem =
static_cast<const SvxLRSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
- if (m_xLeftIndent->IsRelative())
+ if (m_aLeftIndent.IsRelative())
aMargin.SetTextLeft( rOldItem.GetTextLeft(),
- static_cast<sal_uInt16>(m_xLeftIndent->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aLeftIndent.get_value(FieldUnit::NONE)) );
else
- aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
+ aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
- if ( m_xRightIndent->IsRelative() )
+ if ( m_aRightIndent.IsRelative() )
aMargin.SetRight( rOldItem.GetRight(),
- static_cast<sal_uInt16>(m_xRightIndent->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aRightIndent.get_value(FieldUnit::NONE)) );
else
- aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
+ aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
- if ( m_xFLineIndent->IsRelative() )
+ if ( m_aFLineIndent.IsRelative() )
aMargin.SetTextFirstLineOffset( rOldItem.GetTextFirstLineOffset(),
- static_cast<sal_uInt16>(m_xFLineIndent->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)) );
else
- aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
+ aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
}
else
{
- aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
- aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
- aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
+ aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
+ aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
+ aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
}
aMargin.SetAutoFirst(m_xAutoCB->get_active());
if ( aMargin.GetTextFirstLineOffset() < 0 )
bNullTab = true;
- eState = GetItemSet().GetItemState( nWhich );
if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
- SfxItemState::DONTCARE == eState )
+ SfxItemState::INVALID == GetItemSet().GetItemState( nWhich ) )
{
rOutSet->Put( aMargin );
bModified = true;
@@ -398,14 +518,14 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
*rOutSet, SID_ATTR_PARA_REGISTER));
if (!pBoolItem)
return bModified;
- std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone());
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
- bool bSet = pRegItem->GetValue();
+ bool bSet = pBoolItem->GetValue();
if (m_xRegisterCB->get_active() != bSet)
{
+ std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone());
pRegItem->SetValue(!bSet);
- rOutSet->Put(*pRegItem);
+ rOutSet->Put(std::move(pRegItem));
bModified = true;
}
else if ( SfxItemState::DEFAULT == GetItemSet().GetItemState( _nWhich, false ) )
@@ -415,6 +535,19 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
return bModified;
}
+static bool UseCharUnitInUI(const SfxItemSet& rSet)
+{
+ const bool bApplyCharUnit = GetApplyCharUnit(rSet);
+ if (!bApplyCharUnit)
+ return false;
+ if (!SvtCJKOptions::IsAsianTypographyEnabled())
+ return false;
+ // tdf#101895 Given that we choose to show cm vs inch based on this Locale
+ // setting, also choose to use ch[ar] and line based on that locale when
+ // bApplyCharUnit is enabled.
+ return MsLangId::isCJK(SvtSysLocaleOptions().GetRealLanguageTag().getLanguageType());
+}
+
void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
SfxItemPool* pPool = rSet->GetPool();
@@ -422,33 +555,134 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
// adjust metric
FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
-
- bool bApplyCharUnit = GetApplyCharUnit( *rSet );
-
- SvtCJKOptions aCJKOptions;
- if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
+ if (UseCharUnitInUI(*rSet))
eFUnit = FieldUnit::CHAR;
- m_xLeftIndent->SetFieldUnit(eFUnit);
- m_xRightIndent->SetFieldUnit(eFUnit);
- m_xFLineIndent->SetFieldUnit(eFUnit);
+ m_aLeftIndent.SetFieldUnit(eFUnit);
+ m_aRightIndent.SetFieldUnit(eFUnit);
+ m_aFLineIndent.SetFieldUnit(eFUnit);
if ( eFUnit == FieldUnit::CHAR )
{
- m_xTopDist->SetFieldUnit(FieldUnit::LINE);
- m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
+ m_aTopDist.SetFieldUnit(FieldUnit::LINE);
+ m_aBottomDist.SetFieldUnit(FieldUnit::LINE);
SetFieldUnit(*m_xLineDistAtMetricBox, FieldUnit::POINT);
}
else
{
- m_xTopDist->SetFieldUnit(eFUnit);
- m_xBottomDist->SetFieldUnit(eFUnit);
+ m_aTopDist.SetFieldUnit(eFUnit);
+ m_aBottomDist.SetFieldUnit(eFUnit);
SetFieldUnit(*m_xLineDistAtMetricBox, eFUnit);
}
+ sal_uInt16 const nWhichFL(GetWhich(SID_ATTR_PARA_FIRSTLINESPACE));
+ m_bSplitLRSpace = (nWhichFL != SID_ATTR_PARA_FIRSTLINESPACE);
+ SfxItemState const eItemStateFL(rSet->GetItemState(nWhichFL));
+ sal_uInt16 const nWhichLM(GetWhich(SID_ATTR_PARA_LEFTSPACE));
+ SfxItemState const eItemStateLM(rSet->GetItemState(nWhichLM));
+ sal_uInt16 const nWhichRM(GetWhich(SID_ATTR_PARA_RIGHTSPACE));
+ SfxItemState const eItemStateRM(rSet->GetItemState(nWhichRM));
+
+ if (m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemStateLM)
+ {
+ const SvxTextLeftMarginItem & rOldLeftMargin(
+ static_cast<const SvxTextLeftMarginItem &>(rSet->Get(nWhichLM)));
+
+ MapUnit const eUnit = pPool->GetMetric(nWhichLM);
+
+ if (bRelativeMode)
+ {
+ if (rOldLeftMargin.GetPropLeft() != 100)
+ {
+ m_aLeftIndent.SetRelative( true );
+ m_aLeftIndent.set_value(rOldLeftMargin.GetPropLeft(), FieldUnit::NONE);
+ }
+ else
+ {
+ m_aLeftIndent.SetRelative(false);
+ m_aLeftIndent.SetFieldUnit(eFUnit);
+ m_aLeftIndent.SetMetricValue(rOldLeftMargin.GetTextLeft(), eUnit);
+ }
+ }
+ else
+ {
+ m_aLeftIndent.SetMetricValue(rOldLeftMargin.GetTextLeft(), eUnit);
+ }
+ }
+ else if (m_bSplitLRSpace)
+ {
+ m_aLeftIndent.set_text(OUString());
+ }
+
+ if (m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemStateRM)
+ {
+ const SvxRightMarginItem & rOldRightMargin(
+ static_cast<const SvxRightMarginItem &>(rSet->Get(nWhichRM)));
+
+ MapUnit const eUnit = pPool->GetMetric(nWhichRM);
+
+ if (bRelativeMode)
+ {
+ if (rOldRightMargin.GetPropRight() != 100)
+ {
+ m_aRightIndent.SetRelative( true );
+ m_aRightIndent.set_value(rOldRightMargin.GetPropRight(), FieldUnit::NONE);
+ }
+ else
+ {
+ m_aRightIndent.SetRelative(false);
+ m_aRightIndent.SetFieldUnit(eFUnit);
+ m_aRightIndent.SetMetricValue(rOldRightMargin.GetRight(), eUnit);
+ }
+ }
+ else
+ {
+ m_aRightIndent.SetMetricValue(rOldRightMargin.GetRight(), eUnit);
+ }
+ }
+ else if (m_bSplitLRSpace)
+ {
+ m_aRightIndent.set_text(OUString());
+ }
+
+ if (m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemStateFL)
+ {
+ const SvxFirstLineIndentItem & rOldFirstLine(
+ static_cast<const SvxFirstLineIndentItem &>(rSet->Get(nWhichFL)));
+
+ MapUnit const eUnit = pPool->GetMetric(nWhichFL);
+
+ if (bRelativeMode)
+ {
+ if (rOldFirstLine.GetPropTextFirstLineOffset() != 100)
+ {
+ m_aFLineIndent.SetRelative(true);
+ m_aFLineIndent.set_value(rOldFirstLine.GetPropTextFirstLineOffset(), FieldUnit::NONE);
+ }
+ else
+ {
+ m_aFLineIndent.SetRelative(false);
+ m_aFLineIndent.set_min(-9999, FieldUnit::NONE);
+ m_aFLineIndent.SetFieldUnit(eFUnit);
+ m_aFLineIndent.SetMetricValue(rOldFirstLine.GetTextFirstLineOffset(), eUnit);
+ }
+ m_xAutoCB->set_active(rOldFirstLine.IsAutoFirst());
+ }
+ else
+ {
+ m_aFLineIndent.SetMetricValue(rOldFirstLine.GetTextFirstLineOffset(), eUnit);
+ m_xAutoCB->set_active(rOldFirstLine.IsAutoFirst());
+ }
+ AutoHdl_Impl(*m_xAutoCB);
+ }
+ else if (m_bSplitLRSpace)
+ {
+ m_aFLineIndent.set_text(OUString());
+ }
+
sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
SfxItemState eItemState = rSet->GetItemState( _nWhich );
- if ( eItemState >= SfxItemState::DEFAULT )
+ if (!m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemState)
{
MapUnit eUnit = pPool->GetMetric( _nWhich );
@@ -459,39 +693,39 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
if ( rOldItem.GetPropLeft() != 100 )
{
- m_xLeftIndent->SetRelative( true );
- m_xLeftIndent->set_value(rOldItem.GetPropLeft(), FieldUnit::NONE);
+ m_aLeftIndent.SetRelative( true );
+ m_aLeftIndent.set_value(rOldItem.GetPropLeft(), FieldUnit::NONE);
}
else
{
- m_xLeftIndent->SetRelative(false);
- m_xLeftIndent->SetFieldUnit(eFUnit);
- m_xLeftIndent->SetMetricValue(rOldItem.GetTextLeft(), eUnit);
+ m_aLeftIndent.SetRelative(false);
+ m_aLeftIndent.SetFieldUnit(eFUnit);
+ m_aLeftIndent.SetMetricValue(rOldItem.GetTextLeft(), eUnit);
}
if ( rOldItem.GetPropRight() != 100 )
{
- m_xRightIndent->SetRelative( true );
- m_xRightIndent->set_value(rOldItem.GetPropRight(), FieldUnit::NONE);
+ m_aRightIndent.SetRelative( true );
+ m_aRightIndent.set_value(rOldItem.GetPropRight(), FieldUnit::NONE);
}
else
{
- m_xRightIndent->SetRelative(false);
- m_xRightIndent->SetFieldUnit(eFUnit);
- m_xRightIndent->SetMetricValue(rOldItem.GetRight(), eUnit);
+ m_aRightIndent.SetRelative(false);
+ m_aRightIndent.SetFieldUnit(eFUnit);
+ m_aRightIndent.SetMetricValue(rOldItem.GetRight(), eUnit);
}
if ( rOldItem.GetPropTextFirstLineOffset() != 100 )
{
- m_xFLineIndent->SetRelative(true);
- m_xFLineIndent->set_value(rOldItem.GetPropTextFirstLineOffset(), FieldUnit::NONE);
+ m_aFLineIndent.SetRelative(true);
+ m_aFLineIndent.set_value(rOldItem.GetPropTextFirstLineOffset(), FieldUnit::NONE);
}
else
{
- m_xFLineIndent->SetRelative(false);
- m_xFLineIndent->set_min(-9999, FieldUnit::NONE);
- m_xFLineIndent->SetFieldUnit(eFUnit);
- m_xFLineIndent->SetMetricValue(rOldItem.GetTextFirstLineOffset(), eUnit);
+ m_aFLineIndent.SetRelative(false);
+ m_aFLineIndent.set_min(-9999, FieldUnit::NONE);
+ m_aFLineIndent.SetFieldUnit(eFUnit);
+ m_aFLineIndent.SetMetricValue(rOldItem.GetTextFirstLineOffset(), eUnit);
}
m_xAutoCB->set_active(rOldItem.IsAutoFirst());
}
@@ -500,18 +734,18 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
const SvxLRSpaceItem& rSpace =
static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
- m_xLeftIndent->SetMetricValue(rSpace.GetTextLeft(), eUnit);
- m_xRightIndent->SetMetricValue(rSpace.GetRight(), eUnit);
- m_xFLineIndent->SetMetricValue(rSpace.GetTextFirstLineOffset(), eUnit);
+ m_aLeftIndent.SetMetricValue(rSpace.GetTextLeft(), eUnit);
+ m_aRightIndent.SetMetricValue(rSpace.GetRight(), eUnit);
+ m_aFLineIndent.SetMetricValue(rSpace.GetTextFirstLineOffset(), eUnit);
m_xAutoCB->set_active(rSpace.IsAutoFirst());
}
AutoHdl_Impl(*m_xAutoCB);
}
- else
+ else if (!m_bSplitLRSpace)
{
- m_xLeftIndent->set_text(OUString());
- m_xRightIndent->set_text(OUString());
- m_xFLineIndent->set_text(OUString());
+ m_aLeftIndent.set_text(OUString());
+ m_aRightIndent.set_text(OUString());
+ m_aFLineIndent.set_text(OUString());
}
_nWhich = GetWhich( SID_ATTR_ULSPACE );
@@ -528,45 +762,45 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
if ( rOldItem.GetPropUpper() != 100 )
{
- m_xTopDist->SetRelative( true );
- m_xTopDist->set_value(rOldItem.GetPropUpper(), FieldUnit::NONE);
+ m_aTopDist.SetRelative( true );
+ m_aTopDist.set_value(rOldItem.GetPropUpper(), FieldUnit::NONE);
}
else
{
- m_xTopDist->SetRelative(false);
+ m_aTopDist.SetRelative(false);
if (eFUnit == FieldUnit::CHAR)
- m_xTopDist->SetFieldUnit(FieldUnit::LINE);
+ m_aTopDist.SetFieldUnit(FieldUnit::LINE);
else
- m_xTopDist->SetFieldUnit(eFUnit);
- m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
+ m_aTopDist.SetFieldUnit(eFUnit);
+ m_aTopDist.SetMetricValue(rOldItem.GetUpper(), eUnit);
}
if ( rOldItem.GetPropLower() != 100 )
{
- m_xBottomDist->SetRelative( true );
- m_xBottomDist->set_value(rOldItem.GetPropLower(), FieldUnit::NONE);
+ m_aBottomDist.SetRelative( true );
+ m_aBottomDist.set_value(rOldItem.GetPropLower(), FieldUnit::NONE);
}
else
{
- m_xBottomDist->SetRelative(false);
+ m_aBottomDist.SetRelative(false);
if (eFUnit == FieldUnit::CHAR)
- m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
+ m_aBottomDist.SetFieldUnit(FieldUnit::LINE);
else
- m_xBottomDist->SetFieldUnit(eFUnit);
- m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
+ m_aBottomDist.SetFieldUnit(eFUnit);
+ m_aBottomDist.SetMetricValue(rOldItem.GetLower(), eUnit);
}
}
else
{
- m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
- m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
+ m_aTopDist.SetMetricValue(rOldItem.GetUpper(), eUnit);
+ m_aBottomDist.SetMetricValue(rOldItem.GetLower(), eUnit);
}
m_xContextualCB->set_active(rOldItem.GetContext());
}
else
{
- m_xTopDist->set_text(OUString());
- m_xBottomDist->set_text(OUString());
+ m_aTopDist.set_text(OUString());
+ m_aBottomDist.set_text(OUString());
}
_nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
@@ -599,15 +833,15 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
void SvxStdParagraphTabPage::ChangesApplied()
{
- m_xLeftIndent->save_value();
- m_xRightIndent->save_value();
- m_xFLineIndent->save_value();
+ m_aLeftIndent.save_value();
+ m_aRightIndent.save_value();
+ m_aFLineIndent.save_value();
m_xLineDist->save_value();
m_xLineDistAtPercentBox->save_value();
m_xLineDistAtMetricBox->save_value();
m_xRegisterCB->save_state();
- m_xTopDist->save_value();
- m_xBottomDist->save_value();
+ m_aTopDist.save_value();
+ m_aBottomDist.save_value();
m_xContextualCB->save_state();
m_xAutoCB->save_state();
}
@@ -616,11 +850,11 @@ void SvxStdParagraphTabPage::EnableRelativeMode()
{
DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
- m_xLeftIndent->EnableRelativeMode( 0, 999 );
- m_xFLineIndent->EnableRelativeMode( 0, 999 );
- m_xRightIndent->EnableRelativeMode( 0, 999 );
- m_xTopDist->EnableRelativeMode( 0, 999 );
- m_xBottomDist->EnableRelativeMode( 0, 999 );
+ m_aLeftIndent.EnableRelativeMode( 0, 999 );
+ m_aFLineIndent.EnableRelativeMode( 0, 999 );
+ m_aRightIndent.EnableRelativeMode( 0, 999 );
+ m_aTopDist.EnableRelativeMode( 0, 999 );
+ m_aBottomDist.EnableRelativeMode( 0, 999 );
bRelativeMode = true;
}
@@ -675,32 +909,32 @@ SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container* pPage, weld::Dia
, nWidth(11905 /*567 * 50*/)
, nMinFixDist(0)
, bRelativeMode(false)
- , m_xLeftIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM)))
- , m_xRightLabel(m_xBuilder->weld_label("labelFT_RIGHTINDENT"))
- , m_xRightIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM)))
+ , m_aLeftIndent(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM))
+ , m_aRightIndent(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM))
, m_xFLineLabel(m_xBuilder->weld_label("labelFT_FLINEINDENT"))
- , m_xFLineIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM)))
+ , m_aFLineIndent(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM))
, m_xAutoCB(m_xBuilder->weld_check_button("checkCB_AUTO"))
- , m_xTopDist(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM)))
- , m_xBottomDist(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM)))
+ , m_aTopDist(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM))
+ , m_aBottomDist(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM))
, m_xContextualCB(m_xBuilder->weld_check_button("checkCB_CONTEXTUALSPACING"))
, m_xLineDist(m_xBuilder->weld_combo_box("comboLB_LINEDIST"))
, m_xLineDistAtPercentBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT))
, m_xLineDistAtMetricBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM))
+ , m_xLineDistAtPlaceHolderBox(m_xBuilder->weld_metric_spin_button("spinED_BLANK", FieldUnit::CM))
, m_xLineDistAtLabel(m_xBuilder->weld_label("labelFT_LINEDIST"))
, m_xAbsDist(m_xBuilder->weld_label("labelST_LINEDIST_ABS"))
, m_xRegisterCB(m_xBuilder->weld_check_button("checkCB_REGISTER"))
, m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
{
- sAbsDist = m_xAbsDist->get_label();
-
// this page needs ExchangeSupport
SetExchangeSupport();
m_xLineDistAtMetricBox->hide();
+ m_xLineDistAtPlaceHolderBox->hide();
+ m_xLineDistAtPlaceHolderBox->set_text(OUString());
Init_Impl();
- m_xFLineIndent->set_min(-9999, FieldUnit::NONE); // is set to 0 on default
+ m_aFLineIndent.set_min(-9999, FieldUnit::NONE); // is set to 0 on default
}
SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
@@ -709,10 +943,10 @@ SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
void SvxStdParagraphTabPage::EnableNegativeMode()
{
- m_xLeftIndent->set_min(-9999, FieldUnit::NONE);
- m_xRightIndent->set_min(-9999, FieldUnit::NONE);
- m_xRightIndent->EnableNegativeMode();
- m_xLeftIndent->EnableNegativeMode();
+ m_aLeftIndent.set_min(-9999, FieldUnit::NONE);
+ m_aRightIndent.set_min(-9999, FieldUnit::NONE);
+ m_aRightIndent.EnableNegativeMode();
+ m_aLeftIndent.EnableNegativeMode();
}
void SvxStdParagraphTabPage::SetLineSpacing_Impl
@@ -801,10 +1035,9 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
case LLINESPACE_15:
case LLINESPACE_2:
m_xLineDistAtLabel->set_sensitive(false);
- m_xLineDistAtPercentBox->set_sensitive(false);
- m_xLineDistAtPercentBox->set_text(OUString());
- m_xLineDistAtMetricBox->set_sensitive(false);
- m_xLineDistAtMetricBox->set_text(OUString());
+ m_xLineDistAtPercentBox->hide();
+ m_xLineDistAtMetricBox->hide();
+ m_xLineDistAtPlaceHolderBox->show();
break;
case LLINESPACE_DURCH:
@@ -812,32 +1045,32 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
// limit MS min(10, aPageSize)
m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
- if (m_xLineDistAtMetricBox->get_text().isEmpty())
+ if (m_xLineDistAtPlaceHolderBox->get_visible())
m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(1), FieldUnit::NONE);
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtPercentBox->hide();
m_xLineDistAtMetricBox->show();
- m_xLineDistAtMetricBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
break;
case LLINESPACE_MIN:
m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
- if (m_xLineDistAtMetricBox->get_text().isEmpty())
+ if (m_xLineDistAtPlaceHolderBox->get_visible())
m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(10), FieldUnit::TWIP);
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtPercentBox->hide();
m_xLineDistAtMetricBox->show();
- m_xLineDistAtMetricBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
break;
case LLINESPACE_PROP:
- if (m_xLineDistAtPercentBox->get_text().isEmpty())
+ if (m_xLineDistAtPlaceHolderBox->get_visible())
m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(100), FieldUnit::TWIP);
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtMetricBox->hide();
m_xLineDistAtPercentBox->show();
- m_xLineDistAtPercentBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
break;
case LLINESPACE_FIX:
@@ -849,9 +1082,9 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
// it is time for the default
if (m_xLineDistAtMetricBox->get_value(FieldUnit::NONE) != nTemp)
SetMetricValue( *m_xLineDistAtMetricBox, FIX_DIST_DEF, MapUnit::MapTwip ); // fix is only in Writer
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtPercentBox->hide();
m_xLineDistAtMetricBox->show();
- m_xLineDistAtMetricBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
}
break;
@@ -870,31 +1103,31 @@ void SvxStdParagraphTabPage::Init_Impl()
m_xLineDist->connect_changed(LINK(this, SvxStdParagraphTabPage, LineDistHdl_Impl));
Link<weld::MetricSpinButton&,void> aLink2 = LINK(this, SvxStdParagraphTabPage, ELRLoseFocusHdl);
- m_xFLineIndent->connect_value_changed(aLink2);
- m_xLeftIndent->connect_value_changed(aLink2);
- m_xRightIndent->connect_value_changed(aLink2);
+ m_aFLineIndent.connect_value_changed(aLink2);
+ m_aLeftIndent.connect_value_changed(aLink2);
+ m_aRightIndent.connect_value_changed(aLink2);
Link<weld::MetricSpinButton&,void> aLink = LINK(this, SvxStdParagraphTabPage, ModifyHdl_Impl);
- m_xTopDist->connect_value_changed(aLink);
- m_xBottomDist->connect_value_changed(aLink);
+ m_aTopDist.connect_value_changed(aLink);
+ m_aBottomDist.connect_value_changed(aLink);
m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl));
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
- m_xTopDist->set_max( m_xTopDist->normalize( MAX_DURCH ), eUnit );
- m_xBottomDist->set_max( m_xBottomDist->normalize( MAX_DURCH ), eUnit );
+ m_aTopDist.set_max( m_aTopDist.normalize( MAX_DURCH ), eUnit );
+ m_aBottomDist.set_max( m_aBottomDist.normalize( MAX_DURCH ), eUnit );
m_xLineDistAtMetricBox->set_max( m_xLineDistAtMetricBox->normalize( MAX_DURCH ), eUnit );
}
void SvxStdParagraphTabPage::UpdateExample_Impl()
{
- m_aExampleWin.SetFirstLineOffset( static_cast<short>(m_xFLineIndent->denormalize( m_xFLineIndent->get_value( FieldUnit::TWIP ) )) );
- m_aExampleWin.SetLeftMargin( static_cast<tools::Long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
- m_aExampleWin.SetRightMargin( static_cast<tools::Long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
- m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->denormalize( m_xTopDist->get_value( FieldUnit::TWIP ) )) );
- m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->denormalize( m_xBottomDist->get_value( FieldUnit::TWIP ) )) );
+ m_aExampleWin.SetFirstLineOffset( static_cast<short>(m_aFLineIndent.denormalize( m_aFLineIndent.get_value( FieldUnit::TWIP ) )) );
+ m_aExampleWin.SetLeftMargin( static_cast<tools::Long>(m_aLeftIndent.denormalize( m_aLeftIndent.get_value( FieldUnit::TWIP ) ) ) );
+ m_aExampleWin.SetRightMargin( static_cast<tools::Long>(m_aRightIndent.denormalize( m_aRightIndent.get_value( FieldUnit::TWIP ) ) ) );
+ m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_aTopDist.denormalize( m_aTopDist.get_value( FieldUnit::TWIP ) )) );
+ m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_aBottomDist.denormalize( m_aBottomDist.get_value( FieldUnit::TWIP ) )) );
int nPos = m_xLineDist->get_active();
@@ -924,11 +1157,11 @@ void SvxStdParagraphTabPage::EnableContextualMode()
m_xContextualCB->show();
}
-IMPL_LINK(SvxStdParagraphTabPage, AutoHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxStdParagraphTabPage, AutoHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bEnable = !rBox.get_active();
m_xFLineLabel->set_sensitive(bEnable);
- m_xFLineIndent->set_sensitive(bEnable);
+ m_aFLineIndent.set_sensitive(bEnable);
}
void SvxStdParagraphTabPage::EnableAutoFirstLine()
@@ -936,12 +1169,6 @@ void SvxStdParagraphTabPage::EnableAutoFirstLine()
m_xAutoCB->show();
}
-void SvxStdParagraphTabPage::EnableAbsLineDist(tools::Long nMinTwip)
-{
- m_xLineDist->append_text(sAbsDist);
- nMinFixDist = nMinTwip;
-}
-
void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
{
@@ -954,7 +1181,6 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
*/
const SfxUInt16Item* pPageWidthItem = aSet.GetItem<SfxUInt16Item>(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, false);
const SfxUInt32Item* pFlagSetItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET, false);
- const SfxUInt32Item* pLineDistItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, false);
if (pPageWidthItem)
nWidth = pPageWidthItem->GetValue();
@@ -971,9 +1197,6 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
EnableAutoFirstLine();
}
- if(pLineDistItem)
- EnableAbsLineDist(pLineDistItem->GetValue());
-
if (pFlagSetItem)
{
if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
@@ -992,6 +1215,7 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet)
+ , m_bSdrVertAlign(false)
, m_xLeft(m_xBuilder->weld_radio_button("radioBTN_LEFTALIGN"))
, m_xRight(m_xBuilder->weld_radio_button("radioBTN_RIGHTALIGN"))
, m_xCenter(m_xBuilder->weld_radio_button("radioBTN_CENTERALIGN"))
@@ -1005,15 +1229,15 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogCon
, m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
, m_xVertAlignFL(m_xBuilder->weld_widget("frameFL_VERTALIGN"))
, m_xVertAlignLB(m_xBuilder->weld_combo_box("comboLB_VERTALIGN"))
- , m_xPropertiesFL(m_xBuilder->weld_widget("framePROPERTIES"))
+ , m_xVertAlign(m_xBuilder->weld_label("labelFL_VERTALIGN"))
+ , m_xVertAlignSdr(m_xBuilder->weld_label("labelST_VERTALIGN_SDR"))
, m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION")))
{
SetExchangeSupport();
- SvtLanguageOptions aLangOptions;
sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
- if ( aLangOptions.IsAsianTypographyEnabled() )
+ if ( SvtCJKOptions::IsAsianTypographyEnabled() )
{
m_xLeft->set_label(m_xLeftBottom->get_label());
m_xRight->set_label(m_xRightTop->get_label());
@@ -1034,7 +1258,7 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogCon
if (m_xLastLineLB->get_count() == LASTLINECOUNT_NEW)
m_xLastLineLB->remove(nLastLinePos);
- Link<weld::ToggleButton&, void> aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
+ Link<weld::Toggleable&, void> aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
m_xLeft->connect_toggled(aLink);
m_xRight->connect_toggled(aLink);
m_xCenter->connect_toggled(aLink);
@@ -1122,7 +1346,10 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
if (m_xVertAlignLB->get_value_changed_from_saved())
{
- rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN )));
+ if (m_bSdrVertAlign)
+ rOutSet->Put(SdrTextVertAdjustItem(static_cast<SdrTextVertAdjust>(m_xVertAlignLB->get_active())));
+ else
+ rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN )));
bModified = true;
}
@@ -1208,16 +1435,23 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
m_xSnapToGridCB->set_active(rSnap.GetValue());
}
- _nWhich = GetWhich( SID_PARA_VERTALIGN );
+ _nWhich = m_bSdrVertAlign ? SDRATTR_TEXT_VERTADJUST : GetWhich( SID_PARA_VERTALIGN );
eItemState = rSet->GetItemState( _nWhich );
if ( eItemState >= SfxItemState::DEFAULT )
{
m_xVertAlignFL->show();
- const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich ));
-
- m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue()));
+ if (m_bSdrVertAlign)
+ {
+ const SdrTextVertAdjustItem& rAlign = static_cast<const SdrTextVertAdjustItem&>(rSet->Get( _nWhich ));
+ m_xVertAlignLB->set_active(rAlign.GetValue());
+ }
+ else
+ {
+ const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich ));
+ m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue()));
+ }
}
_nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
@@ -1254,7 +1488,7 @@ void SvxParaAlignTabPage::ChangesApplied()
m_xExpandCB->save_state();
}
-IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl, weld::Toggleable&, void)
{
bool bJustify = m_xJustify->get_active();
m_xLastLineFT->set_sensitive(bJustify);
@@ -1342,12 +1576,20 @@ void SvxParaAlignTabPage::EnableJustifyExt()
m_xLastLineFT->show();
m_xLastLineLB->show();
m_xExpandCB->show();
- SvtLanguageOptions aCJKOptions;
- if (aCJKOptions.IsAsianTypographyEnabled())
+ if (SvtCJKOptions::IsAsianTypographyEnabled())
m_xSnapToGridCB->show();
}
+void SvxParaAlignTabPage::EnableSdrVertAlign()
+{
+ m_bSdrVertAlign = true;
+
+ m_xVertAlignLB->remove_id("0");
+ m_xVertAlignLB->remove_id("1");
+ m_xVertAlign->set_label(m_xVertAlignSdr->get_label());
+}
+
void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet)
{
const SfxBoolItem* pBoolItem = aSet.GetItem<SfxBoolItem>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT, false);
@@ -1369,22 +1611,68 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
if ( m_xHyphenBox->get_state_changed_from_saved() ||
m_xHyphenNoCapsBox->get_state_changed_from_saved() ||
+ m_xHyphenNoLastWordBox->get_state_changed_from_saved() ||
m_xExtHyphenBeforeBox->get_value_changed_from_saved() ||
m_xExtHyphenAfterBox->get_value_changed_from_saved() ||
- m_xMaxHyphenEdit->get_value_changed_from_saved() )
+ m_xExtCompoundHyphenBeforeBox->get_value_changed_from_saved() ||
+ m_xMaxHyphenEdit->get_value_changed_from_saved() ||
+ m_xMinWordLength->get_value_changed_from_saved() ||
+ m_aHyphenZone.get_value_changed_from_saved() ||
+ m_xAcrossColumnBox->get_state_changed_from_saved() ||
+ m_xAcrossPageBox->get_state_changed_from_saved() ||
+ m_xAcrossSpreadBox->get_state_changed_from_saved() )
{
SvxHyphenZoneItem aHyphen(
static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) );
aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
- aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() == TRISTATE_TRUE);
+ aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() != TRISTATE_TRUE);
+ aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() != TRISTATE_TRUE);
if ( eHyphenState == TRISTATE_TRUE )
{
aHyphen.GetMinLead() = static_cast<sal_uInt8>(m_xExtHyphenBeforeBox->get_value());
aHyphen.GetMinTrail() = static_cast<sal_uInt8>(m_xExtHyphenAfterBox->get_value());
+ aHyphen.GetCompoundMinLead() = static_cast<sal_uInt8>(m_xExtCompoundHyphenBeforeBox->get_value());
+ aHyphen.GetMinWordLength() = static_cast<sal_uInt8>(m_xMinWordLength->get_value());
}
aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Where is the pool?" );
+ MapUnit eUnit = pPool->GetMetric( _nWhich );
+ aHyphen.GetTextHyphenZone() = static_cast<sal_uInt16>(m_aHyphenZone.GetCoreValue(eUnit));
+ aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
+ aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() != TRISTATE_TRUE);
+ const TriState eAcrossColumnState = m_xAcrossColumnBox->get_state();
+ const TriState eAcrossPageState = m_xAcrossPageBox->get_state();
+ const TriState eAcrossSpreadState = m_xAcrossSpreadBox->get_state();
+ aHyphen.SetKeep( eAcrossSpreadState != TRISTATE_TRUE );
+ if ( eAcrossSpreadState == TRISTATE_TRUE )
+ {
+ // hyphenate across column, page and spread -> ParaHyphenationKeep = false and
+ // set default value 3 (COLUMN)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::COLUMN);
+ }
+ else if ( eAcrossPageState == TRISTATE_TRUE )
+ {
+ // hyphenate across column and page, but not spread -> 1 (SPREAD)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::SPREAD);
+ }
+ else if ( eAcrossColumnState == TRISTATE_TRUE )
+ {
+ // hyphenate across column, but not page and spread -> 2 (PAGE)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::PAGE);
+ }
+ else
+ {
+ // don't hyphenate across column, page and spread -> 3 (COLUMN)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::COLUMN);
+ }
+
if ( !pOld ||
*static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen ||
m_xHyphenBox->get_state_changed_from_saved())
@@ -1422,7 +1710,6 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
TriState eState = m_xApplyCollBtn->get_state();
bool bIsPageModel = false;
- _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
OUString sPage;
if ( m_xApplyCollBtn->get_state_changed_from_saved() ||
( TRISTATE_TRUE == eState &&
@@ -1437,7 +1724,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
if ( !pOld || static_cast<const SvxPageModelItem*>(pOld)->GetValue() != sPage )
{
- rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
+ rOutSet->Put( SvxPageModelItem( sPage, false, SID_ATTR_PARA_MODEL ) );
bModified = true;
}
else
@@ -1446,7 +1733,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
else if(TRISTATE_TRUE == eState && m_xApplyCollBtn->get_sensitive())
bIsPageModel = true;
else
- rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
+ rOutSet->Put( SvxPageModelItem( sPage, false, SID_ATTR_PARA_MODEL ) );
_nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
@@ -1508,9 +1795,9 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
// paragraph split
_nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
- eState = m_xKeepTogetherBox->get_state();
+ eState = m_xAllowSplitBox->get_state();
- if (m_xKeepTogetherBox->get_state_changed_from_saved())
+ if (m_xAllowSplitBox->get_state_changed_from_saved())
{
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_SPLIT );
@@ -1534,14 +1821,14 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
// widows and orphans
- _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
+ TypedWhichId<SvxWidowsItem> nWidowsWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
eState = m_xWidowBox->get_state();
if ( m_xWidowBox->get_state_changed_from_saved() ||
m_xWidowRowNo->get_value_changed_from_saved() )
{
SvxWidowsItem rItem( eState == TRISTATE_TRUE ?
- static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, _nWhich );
+ static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, nWidowsWhich );
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_WIDOWS );
if ( m_xWidowBox->get_state_changed_from_saved() || !pOld || !( *static_cast<const SvxWidowsItem*>(pOld) == rItem ) )
@@ -1551,14 +1838,14 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
}
- _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
+ TypedWhichId<SvxOrphansItem> nOrphansWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
eState = m_xOrphanBox->get_state();
if ( m_xOrphanBox->get_state_changed_from_saved() ||
m_xOrphanRowNo->get_value_changed_from_saved() )
{
SvxOrphansItem rItem( eState == TRISTATE_TRUE ?
- static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, _nWhich );
+ static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, nOrphansWhich );
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_ORPHANS );
if ( m_xOrphanBox->get_state_changed_from_saved() ||
@@ -1574,6 +1861,14 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
{
+ SfxItemPool* pPool = rSet->GetPool();
+ DBG_ASSERT( pPool, "Where is the pool?" );
+
+ // adjust metric
+ FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
+ if (UseCharUnitInUI(*rSet))
+ eFUnit = FieldUnit::CHAR;
+
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
SfxItemState eItemState = rSet->GetItemState( _nWhich );
@@ -1587,40 +1882,61 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
bIsHyphen = rHyphen.IsHyphen();
m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? TRISTATE_FALSE : TRISTATE_TRUE);
+ m_xHyphenNoLastWordBox->set_state(rHyphen.IsNoLastWordHyphenation() ? TRISTATE_FALSE : TRISTATE_TRUE);
m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead());
m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail());
+ m_xExtCompoundHyphenBeforeBox->set_value(rHyphen.GetCompoundMinLead());
m_xMaxHyphenEdit->set_value(rHyphen.GetMaxHyphens());
+ m_xMinWordLength->set_value(rHyphen.GetMinWordLength());
+ m_aHyphenZone.SetFieldUnit(eFUnit);
+ m_aHyphenZone.SetMetricValue(rHyphen.GetTextHyphenZone(), MapUnit::MapTwip);
+ m_xAcrossColumnBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 3 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xAcrossPageBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 2 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xAcrossSpreadBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() == 0 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ aAcrossColumnState.bTriStateEnabled = false;
+ aAcrossPageState.bTriStateEnabled = false;
+ aAcrossSpreadState.bTriStateEnabled = false;
}
else
{
m_xHyphenBox->set_state(TRISTATE_INDET);
m_xHyphenNoCapsBox->set_state(TRISTATE_INDET);
+ m_xHyphenNoLastWordBox->set_state(TRISTATE_INDET);
}
bool bEnable = bItemAvailable && bIsHyphen;
m_xHyphenNoCapsBox->set_sensitive(bEnable);
+ m_xHyphenNoLastWordBox->set_sensitive(bEnable);
m_xExtHyphenBeforeBox->set_sensitive(bEnable);
m_xExtHyphenAfterBox->set_sensitive(bEnable);
+ m_xExtCompoundHyphenBeforeBox->set_sensitive(bEnable);
m_xBeforeText->set_sensitive(bEnable);
m_xAfterText->set_sensitive(bEnable);
+ m_xCompoundBeforeText->set_sensitive(bEnable);
m_xMaxHyphenLabel->set_sensitive(bEnable);
m_xMaxHyphenEdit->set_sensitive(bEnable);
+ m_xMinWordLabel->set_sensitive(bEnable);
+ m_xMinWordLength->set_sensitive(bEnable);
+ m_xHyphenZoneLabel->set_sensitive(bEnable);
+ m_aHyphenZone.set_sensitive(bEnable);
+ m_xAcrossText->set_sensitive(bEnable);
+ m_xAcrossColumnBox->set_sensitive(bEnable);
+ m_xAcrossPageBox->set_sensitive(bEnable);
+ m_xAcrossSpreadBox->set_sensitive(bEnable);
- _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
-
- switch (rSet->GetItemState(_nWhich))
+ switch (rSet->GetItemState(SID_ATTR_PARA_PAGENUM))
{
case SfxItemState::SET:
{
aPageNumState.bTriStateEnabled = false;
m_xPageNumBox->set_state(TRISTATE_TRUE);
- SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(_nWhich));
+ SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(SID_ATTR_PARA_PAGENUM));
const sal_uInt16 nPageNum(pItem->GetValue());
m_xPagenumEdit->set_value(nPageNum);
break;
}
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
{
aPageNumState.bTriStateEnabled = true;
m_xPageNumBox->set_state(TRISTATE_INDET);
@@ -1642,16 +1958,14 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
if ( bPageBreak )
{
// first handle PageModel
- _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
bool bIsPageModel = false;
- eItemState = rSet->GetItemState( _nWhich );
+ eItemState = rSet->GetItemState( SID_ATTR_PARA_MODEL );
if ( eItemState >= SfxItemState::SET )
{
aApplyCollState.bTriStateEnabled = false;
- const SvxPageModelItem& rModel =
- static_cast<const SvxPageModelItem&>(rSet->Get( _nWhich ));
+ const SvxPageModelItem& rModel = rSet->Get( SID_ATTR_PARA_MODEL );
const OUString& aStr( rModel.GetValue() );
if (!aStr.isEmpty() && m_xApplyCollBox->find_text(aStr) != -1)
@@ -1680,7 +1994,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_xApplyCollBtn->set_state(TRISTATE_FALSE);
}
}
- else if ( SfxItemState::DONTCARE == eItemState )
+ else if ( SfxItemState::INVALID == eItemState )
{
aApplyCollState.bTriStateEnabled = true;
m_xApplyCollBtn->set_state(TRISTATE_INDET);
@@ -1752,7 +2066,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_xBreakTypeLB->set_active(nType);
m_xBreakPositionLB->set_active(nPosition);
}
- else if ( SfxItemState::DONTCARE == eItemState )
+ else if ( SfxItemState::INVALID == eItemState )
m_xPageBreakBox->set_state(TRISTATE_INDET);
else
{
@@ -1782,7 +2096,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
else
m_xKeepParaBox->set_state(TRISTATE_FALSE);
}
- else if ( SfxItemState::DONTCARE == eItemState )
+ else if ( SfxItemState::INVALID == eItemState )
m_xKeepParaBox->set_state(TRISTATE_INDET);
else
m_xKeepParaBox->set_sensitive(false);
@@ -1794,70 +2108,69 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
{
const SvxFormatSplitItem& rSplit =
static_cast<const SvxFormatSplitItem&>(rSet->Get( _nWhich ));
- aKeepTogetherState.bTriStateEnabled = false;
+ aAllowSplitState.bTriStateEnabled = false;
if ( !rSplit.GetValue() )
- m_xKeepTogetherBox->set_state(TRISTATE_TRUE);
+ m_xAllowSplitBox->set_state(TRISTATE_FALSE);
else
{
- m_xKeepTogetherBox->set_state(TRISTATE_FALSE);
-
- // widows and orphans
+ m_xAllowSplitBox->set_state(TRISTATE_TRUE);
+ // default widows and orphans to enabled
m_xWidowBox->set_sensitive(true);
- _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
- SfxItemState eTmpState = rSet->GetItemState( _nWhich );
-
- if ( eTmpState >= SfxItemState::DEFAULT )
- {
- const SvxWidowsItem& rWidow =
- static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
- aWidowState.bTriStateEnabled = false;
- const sal_uInt16 nLines = rWidow.GetValue();
+ m_xOrphanBox->set_sensitive(true);
+ }
- bool _bEnable = nLines > 0;
- m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
- m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xWidowRowNo->set_sensitive(_bEnable);
- //m_xWidowRowLabel->set_sensitive(_bEnable);
+ // widows and orphans
+ _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
+ SfxItemState eTmpState = rSet->GetItemState( _nWhich );
- }
- else if ( SfxItemState::DONTCARE == eTmpState )
- m_xWidowBox->set_state( TRISTATE_INDET );
- else
- m_xWidowBox->set_sensitive(false);
+ if ( eTmpState >= SfxItemState::DEFAULT )
+ {
+ const SvxWidowsItem& rWidow =
+ static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
+ aWidowState.bTriStateEnabled = false;
+ const sal_uInt16 nLines = rWidow.GetValue();
+
+ bool _bEnable = nLines > 0;
+ m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
+ m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xWidowRowNo->set_sensitive(_bEnable);
+ }
+ else if ( SfxItemState::INVALID == eTmpState )
+ m_xWidowBox->set_state( TRISTATE_INDET );
+ else
+ m_xWidowBox->set_sensitive(false);
- m_xOrphanBox->set_sensitive(true);
- _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
- eTmpState = rSet->GetItemState( _nWhich );
+ _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
+ eTmpState = rSet->GetItemState( _nWhich );
- if ( eTmpState >= SfxItemState::DEFAULT )
- {
- const SvxOrphansItem& rOrphan =
- static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
- const sal_uInt16 nLines = rOrphan.GetValue();
- aOrphanState.bTriStateEnabled = false;
+ if ( eTmpState >= SfxItemState::DEFAULT )
+ {
+ const SvxOrphansItem& rOrphan =
+ static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
+ const sal_uInt16 nLines = rOrphan.GetValue();
+ aOrphanState.bTriStateEnabled = false;
- bool _bEnable = nLines > 0;
- m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
- m_xOrphanRowNo->set_sensitive(_bEnable);
- m_xOrphanRowLabel->set_sensitive(_bEnable);
+ bool _bEnable = nLines > 0;
+ m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
+ m_xOrphanRowNo->set_sensitive(_bEnable);
+ m_xOrphanRowLabel->set_sensitive(_bEnable);
- }
- else if ( SfxItemState::DONTCARE == eTmpState )
- m_xOrphanBox->set_state(TRISTATE_INDET);
- else
- m_xOrphanBox->set_sensitive(false);
- aOrphanState.eState = m_xOrphanBox->get_state();
}
+ else if ( SfxItemState::INVALID == eTmpState )
+ m_xOrphanBox->set_state(TRISTATE_INDET);
+ else
+ m_xOrphanBox->set_sensitive(false);
+ aOrphanState.eState = m_xOrphanBox->get_state();
}
- else if ( SfxItemState::DONTCARE == eItemState )
- m_xKeepTogetherBox->set_state(TRISTATE_INDET);
+ else if ( SfxItemState::INVALID == eItemState )
+ m_xAllowSplitBox->set_state(TRISTATE_INDET);
else
- m_xKeepTogetherBox->set_sensitive(false);
+ m_xAllowSplitBox->set_sensitive(false);
// so that everything is enabled correctly
- KeepTogetherHdl();
+ AllowSplitHdl();
WidowHdl();
OrphanHdl();
ChangesApplied();
@@ -1866,9 +2179,16 @@ void SvxExtParagraphTabPage::ChangesApplied()
{
m_xHyphenBox->save_state();
m_xHyphenNoCapsBox->save_state();
- m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value());
- m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value());
- m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value());
+ m_xHyphenNoLastWordBox->save_state();
+ m_xExtHyphenBeforeBox->save_value();
+ m_xExtHyphenAfterBox->save_value();
+ m_xExtCompoundHyphenBeforeBox->save_value();
+ m_xMaxHyphenEdit->save_value();
+ m_xMinWordLength->save_value();
+ m_aHyphenZone.save_value();
+ m_xAcrossColumnBox->save_state();
+ m_xAcrossPageBox->save_state();
+ m_xAcrossSpreadBox->save_state();
m_xPageBreakBox->save_state();
m_xBreakPositionLB->save_value();
m_xBreakTypeLB->save_value();
@@ -1876,7 +2196,7 @@ void SvxExtParagraphTabPage::ChangesApplied()
m_xApplyCollBox->save_value();
m_xPageNumBox->save_state();
m_xPagenumEdit->save_value();
- m_xKeepTogetherBox->save_state();
+ m_xAllowSplitBox->save_state();
m_xKeepParaBox->save_state();
m_xWidowBox->save_state();
m_xOrphanBox->save_state();
@@ -1912,12 +2232,19 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
// Hyphenation
, m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto"))
, m_xHyphenNoCapsBox(m_xBuilder->weld_check_button("checkNoCaps"))
+ , m_xHyphenNoLastWordBox(m_xBuilder->weld_check_button("checkNoLastWord"))
, m_xBeforeText(m_xBuilder->weld_label("labelLineBegin"))
, m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd"))
, m_xAfterText(m_xBuilder->weld_label("labelLineEnd"))
, m_xExtHyphenAfterBox(m_xBuilder->weld_spin_button("spinLineBegin"))
+ , m_xCompoundBeforeText(m_xBuilder->weld_label("labelCompoundLineEnd"))
+ , m_xExtCompoundHyphenBeforeBox(m_xBuilder->weld_spin_button("spinCompoundLineEnd"))
, m_xMaxHyphenLabel(m_xBuilder->weld_label("labelMaxNum"))
, m_xMaxHyphenEdit(m_xBuilder->weld_spin_button("spinMaxNum"))
+ , m_xMinWordLabel(m_xBuilder->weld_label("labelMinLen"))
+ , m_xMinWordLength(m_xBuilder->weld_spin_button("spinMinLen"))
+ , m_xHyphenZoneLabel(m_xBuilder->weld_label("labelHyphenZone"))
+ , m_aHyphenZone(m_xBuilder->weld_metric_spin_button("spinHyphenZone", FieldUnit::CM))
//Page break
, m_xPageBreakBox(m_xBuilder->weld_check_button("checkInsert"))
, m_xBreakTypeFT(m_xBuilder->weld_label("labelType"))
@@ -1929,7 +2256,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
, m_xPageNumBox(m_xBuilder->weld_check_button("labelPageNum"))
, m_xPagenumEdit(m_xBuilder->weld_spin_button("spinPageNumber"))
// Options
- , m_xKeepTogetherBox(m_xBuilder->weld_check_button("checkSplitPara"))
+ , m_xAllowSplitBox(m_xBuilder->weld_check_button("checkSplitPara"))
, m_xKeepParaBox(m_xBuilder->weld_check_button("checkKeepPara"))
, m_xOrphanBox(m_xBuilder->weld_check_button("checkOrphan"))
, m_xOrphanRowNo(m_xBuilder->weld_spin_button("spinOrphan"))
@@ -1937,13 +2264,18 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
, m_xWidowBox(m_xBuilder->weld_check_button("checkWidow"))
, m_xWidowRowNo(m_xBuilder->weld_spin_button("spinWidow"))
, m_xWidowRowLabel(m_xBuilder->weld_label("labelWidow"))
+ // Avoid hyphenation across
+ , m_xAcrossText(m_xBuilder->weld_label("labelHyphenAcross"))
+ , m_xAcrossColumnBox(m_xBuilder->weld_check_button("checkAcrossColumn"))
+ , m_xAcrossPageBox(m_xBuilder->weld_check_button("checkAcrossPage"))
+ , m_xAcrossSpreadBox(m_xBuilder->weld_check_button("checkAcrossSpread"))
{
// this page needs ExchangeSupport
SetExchangeSupport();
m_xHyphenBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, HyphenClickHdl_Impl));
m_xPageBreakBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageBreakHdl_Impl));
- m_xKeepTogetherBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl));
+ m_xAllowSplitBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AllowSplitHdl_Impl));
m_xWidowBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, WidowHdl_Impl));
m_xOrphanBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, OrphanHdl_Impl));
m_xApplyCollBtn->connect_toggled(LINK(this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl));
@@ -1951,14 +2283,18 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl));
m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl));
m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl));
+ m_xAcrossColumnBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossColumnHdl_Impl));
+ m_xAcrossPageBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossPageHdl_Impl));
+ m_xAcrossSpreadBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossSpreadHdl_Impl));
- SfxObjectShell* pSh = SfxObjectShell::Current();
- if ( pSh )
+ if (SfxObjectShell* pSh = SfxObjectShell::Current())
{
SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
SfxStyleSheetBase* pStyle = pPool->First(SfxStyleFamily::Page);
OUString aStdName;
+ // tdf139131 - sort page styles
+ m_xApplyCollBox->make_sorted();
while( pStyle )
{
if ( aStdName.isEmpty() )
@@ -1977,14 +2313,25 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
bHtmlMode = true;
m_xHyphenBox->set_sensitive(false);
m_xHyphenNoCapsBox->set_sensitive(false);
+ m_xHyphenNoLastWordBox->set_sensitive(false);
m_xBeforeText->set_sensitive(false);
m_xExtHyphenBeforeBox->set_sensitive(false);
m_xAfterText->set_sensitive(false);
m_xExtHyphenAfterBox->set_sensitive(false);
+ m_xCompoundBeforeText->set_sensitive(false);
+ m_xExtCompoundHyphenBeforeBox->set_sensitive(false);
m_xMaxHyphenLabel->set_sensitive(false);
m_xMaxHyphenEdit->set_sensitive(false);
+ m_xMinWordLabel->set_sensitive(false);
+ m_xMinWordLength->set_sensitive(false);
+ m_xHyphenZoneLabel->set_sensitive(false);
+ m_aHyphenZone.set_sensitive(false);
m_xPageNumBox->set_sensitive(false);
m_xPagenumEdit->set_sensitive(false);
+ m_xAcrossText->set_sensitive(false);
+ m_xAcrossColumnBox->set_sensitive(false);
+ m_xAcrossPageBox->set_sensitive(false);
+ m_xAcrossSpreadBox->set_sensitive(false);
// no column break in HTML
m_xBreakTypeLB->remove(1);
}
@@ -2033,23 +2380,23 @@ void SvxExtParagraphTabPage::PageBreakHdl()
}
}
-IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::Toggleable&, rToggle, void)
{
aPageBreakState.ButtonToggled(rToggle);
PageBreakHdl();
}
-void SvxExtParagraphTabPage::KeepTogetherHdl()
+void SvxExtParagraphTabPage::AllowSplitHdl()
{
- bool bEnable = m_xKeepTogetherBox->get_state() == TRISTATE_FALSE;
+ bool bEnable = m_xAllowSplitBox->get_state() == TRISTATE_TRUE;
m_xWidowBox->set_sensitive(bEnable);
m_xOrphanBox->set_sensitive(bEnable);
}
-IMPL_LINK(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, AllowSplitHdl_Impl, weld::Toggleable&, rToggle, void)
{
- aKeepTogetherState.ButtonToggled(rToggle);
- KeepTogetherHdl();
+ aAllowSplitState.ButtonToggled(rToggle);
+ AllowSplitHdl();
}
void SvxExtParagraphTabPage::WidowHdl()
@@ -2059,11 +2406,11 @@ void SvxExtParagraphTabPage::WidowHdl()
case TRISTATE_TRUE:
m_xWidowRowNo->set_sensitive(true);
m_xWidowRowLabel->set_sensitive(true);
- m_xKeepTogetherBox->set_sensitive(false);
+ m_xAllowSplitBox->set_sensitive(true);
break;
case TRISTATE_FALSE:
if (m_xOrphanBox->get_state() == TRISTATE_FALSE)
- m_xKeepTogetherBox->set_sensitive(true);
+ m_xAllowSplitBox->set_sensitive(false);
[[fallthrough]];
case TRISTATE_INDET:
m_xWidowRowNo->set_sensitive(false);
@@ -2072,13 +2419,13 @@ void SvxExtParagraphTabPage::WidowHdl()
}
}
-IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::Toggleable&, rToggle, void)
{
aWidowState.ButtonToggled(rToggle);
WidowHdl();
}
-IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::Toggleable&, rToggle, void)
{
aOrphanState.ButtonToggled(rToggle);
OrphanHdl();
@@ -2091,12 +2438,12 @@ void SvxExtParagraphTabPage::OrphanHdl()
case TRISTATE_TRUE:
m_xOrphanRowNo->set_sensitive(true);
m_xOrphanRowLabel->set_sensitive(true);
- m_xKeepTogetherBox->set_sensitive(false);
+ m_xAllowSplitBox->set_sensitive(true);
break;
case TRISTATE_FALSE:
if (m_xWidowBox->get_state() == TRISTATE_FALSE)
- m_xKeepTogetherBox->set_sensitive(true);
+ m_xAllowSplitBox->set_sensitive(true);
[[fallthrough]];
case TRISTATE_INDET:
m_xOrphanRowNo->set_sensitive(false);
@@ -2109,16 +2456,27 @@ void SvxExtParagraphTabPage::HyphenClickHdl()
{
bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE;
m_xHyphenNoCapsBox->set_sensitive(bEnable);
+ m_xHyphenNoLastWordBox->set_sensitive(bEnable);
m_xBeforeText->set_sensitive(bEnable);
m_xExtHyphenBeforeBox->set_sensitive(bEnable);
m_xAfterText->set_sensitive(bEnable);
m_xExtHyphenAfterBox->set_sensitive(bEnable);
+ m_xCompoundBeforeText->set_sensitive(bEnable);
+ m_xExtCompoundHyphenBeforeBox->set_sensitive(bEnable);
m_xMaxHyphenLabel->set_sensitive(bEnable);
m_xMaxHyphenEdit->set_sensitive(bEnable);
+ m_xMinWordLabel->set_sensitive(bEnable);
+ m_xMinWordLength->set_sensitive(bEnable);
+ m_xHyphenZoneLabel->set_sensitive(bEnable);
+ m_aHyphenZone.set_sensitive(bEnable);
+ m_xAcrossText->set_sensitive(bEnable);
+ m_xAcrossColumnBox->set_sensitive(bEnable);
+ m_xAcrossPageBox->set_sensitive(bEnable);
+ m_xAcrossSpreadBox->set_sensitive(bEnable);
m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
}
-IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::Toggleable&, rToggle, void)
{
aHyphenState.ButtonToggled(rToggle);
HyphenClickHdl();
@@ -2144,7 +2502,7 @@ void SvxExtParagraphTabPage::ApplyCollClickHdl()
}
}
-IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::Toggleable&, rToggle, void)
{
aApplyCollState.ButtonToggled(rToggle);
ApplyCollClickHdl();
@@ -2196,13 +2554,13 @@ void SvxExtParagraphTabPage::PageNumBoxClickHdl()
m_xPagenumEdit->set_sensitive(m_xPageNumBox->get_state() == TRISTATE_TRUE);
}
-IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::Toggleable&, rToggle, void)
{
aPageNumState.ButtonToggled(rToggle);
PageNumBoxClickHdl();
}
-IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::Toggleable&, rToggle, void)
{
aKeepParaState.ButtonToggled(rToggle);
}
@@ -2216,6 +2574,35 @@ void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
DisablePageBreak();
}
+IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rToggle, void)
+{
+ aAcrossColumnState.ButtonToggled(rToggle);
+ if (m_xAcrossColumnBox->get_state() != TRISTATE_TRUE )
+ {
+ m_xAcrossPageBox->set_state( TRISTATE_FALSE );
+ m_xAcrossSpreadBox->set_state( TRISTATE_FALSE );
+ }
+}
+
+IMPL_LINK(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, rToggle, void)
+{
+ aAcrossPageState.ButtonToggled(rToggle);
+ if (m_xAcrossPageBox->get_state() == TRISTATE_TRUE )
+ m_xAcrossColumnBox->set_state( TRISTATE_TRUE );
+ else
+ m_xAcrossSpreadBox->set_state( TRISTATE_FALSE );
+}
+
+IMPL_LINK(SvxExtParagraphTabPage, AcrossSpreadHdl_Impl, weld::Toggleable&, rToggle, void)
+{
+ aAcrossSpreadState.ButtonToggled(rToggle);
+ if (m_xAcrossSpreadBox->get_state() == TRISTATE_TRUE )
+ {
+ m_xAcrossColumnBox->set_state( TRISTATE_TRUE );
+ m_xAcrossPageBox->set_state( TRISTATE_TRUE );
+ }
+}
+
SvxAsianTabPage::SvxAsianTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/asiantypography.ui", "AsianTypography", &rSet)
, m_xForbiddenRulesCB(m_xBuilder->weld_check_button("checkForbidList"))
@@ -2233,14 +2620,9 @@ std::unique_ptr<SfxTabPage> SvxAsianTabPage::Create(weld::Container* pPage, weld
return std::make_unique<SvxAsianTabPage>(pPage, pController, *rSet);
}
-const sal_uInt16* SvxAsianTabPage::GetRanges()
+WhichRangesContainer SvxAsianTabPage::GetRanges()
{
- static const sal_uInt16 pRanges[] =
- {
- SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
- 0
- };
- return pRanges;
+ return WhichRangesContainer(svl::Items<SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES>);
}
bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
@@ -2250,7 +2632,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xScriptSpaceCB->get_sensitive() && m_xScriptSpaceCB->get_state_changed_from_saved())
{
std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
+ pPool->GetWhichIDFromSlotID(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
pNewItem->SetValue(m_xScriptSpaceCB->get_active());
rSet->Put(std::move(pNewItem));
bRet = true;
@@ -2258,7 +2640,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xHangingPunctCB->get_sensitive() && m_xHangingPunctCB->get_state_changed_from_saved())
{
std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
+ pPool->GetWhichIDFromSlotID(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
pNewItem->SetValue(m_xHangingPunctCB->get_active());
rSet->Put(std::move(pNewItem));
bRet = true;
@@ -2266,7 +2648,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xForbiddenRulesCB->get_sensitive() && m_xForbiddenRulesCB->get_state_changed_from_saved())
{
std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
+ pPool->GetWhichIDFromSlotID(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
pNewItem->SetValue(m_xForbiddenRulesCB->get_active());
rSet->Put(std::move(pNewItem));
bRet = true;
@@ -2276,7 +2658,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, weld::CheckButton& rBox)
{
- sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
+ sal_uInt16 _nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId);
SfxItemState eState = rSet.GetItemState(_nWhich);
if( eState == SfxItemState::UNKNOWN || eState == SfxItemState::DISABLED )
rBox.set_sensitive(false);
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 2b9c8c70a4b4..1a0d14759eac 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -19,6 +19,7 @@
#include <memory>
#include <cstddef>
+#include <type_traits>
#include <swpossizetabpage.hxx>
#include <svx/dlgutil.hxx>
#include <svx/anchorid.hxx>
@@ -35,6 +36,9 @@
#include <com/sun/star/text/RelOrientation.hpp>
#include <svx/svxids.hrc>
#include <svtools/unitconv.hxx>
+#include <osl/diagnose.h>
+
+#include <bitmaps.hlst>
using namespace ::com::sun::star::text;
@@ -204,7 +208,7 @@ FrmMap const aHFlyHtmlMap[] =
// #i18732# - own vertical alignment map for to frame anchored objects
// #i22305#
-#define VERT_FRAME_REL (LB::VertFrame|LB::FlyVertPrintArea)
+#define VERT_FRAME_REL (LB::FlyVertFrame|LB::FlyVertPrintArea)
FrmMap const aVFrameMap[] =
{
@@ -378,55 +382,54 @@ FrmMap const aVAsCharHtmlMap[] =
static std::size_t lcl_GetFrmMapCount(const FrmMap* pMap)
{
- if( pMap )
- {
- if( pMap == aVParaHtmlMap )
- return SAL_N_ELEMENTS(aVParaHtmlMap);
- if( pMap == aVAsCharHtmlMap )
- return SAL_N_ELEMENTS( aVAsCharHtmlMap );
- if( pMap == aHParaHtmlMap )
- return SAL_N_ELEMENTS( aHParaHtmlMap );
- if( pMap == aHParaHtmlAbsMap )
- return SAL_N_ELEMENTS( aHParaHtmlAbsMap );
- if( pMap == aVPageMap )
- return SAL_N_ELEMENTS( aVPageMap );
- if( pMap == aVPageHtmlMap )
- return SAL_N_ELEMENTS( aVPageHtmlMap );
- if( pMap == aVAsCharMap )
- return SAL_N_ELEMENTS( aVAsCharMap );
- if( pMap == aVParaMap )
- return SAL_N_ELEMENTS( aVParaMap );
- if( pMap == aHParaMap )
- return SAL_N_ELEMENTS( aHParaMap );
- if( pMap == aHFrameMap )
- return SAL_N_ELEMENTS( aHFrameMap );
- if( pMap == aVFrameMap )
- return SAL_N_ELEMENTS( aVFrameMap );
- if( pMap == aHCharMap )
- return SAL_N_ELEMENTS( aHCharMap );
- if( pMap == aHCharHtmlMap )
- return SAL_N_ELEMENTS( aHCharHtmlMap );
- if( pMap == aHCharHtmlAbsMap )
- return SAL_N_ELEMENTS( aHCharHtmlAbsMap );
- if( pMap == aVCharMap )
- return SAL_N_ELEMENTS( aVCharMap );
- if( pMap == aVCharHtmlMap )
- return SAL_N_ELEMENTS( aVCharHtmlMap );
- if( pMap == aVCharHtmlAbsMap )
- return SAL_N_ELEMENTS( aVCharHtmlAbsMap );
- if( pMap == aHPageHtmlMap )
- return SAL_N_ELEMENTS( aHPageHtmlMap );
- if( pMap == aHFlyHtmlMap )
- return SAL_N_ELEMENTS( aHFlyHtmlMap );
- if( pMap == aVFlyHtmlMap )
- return SAL_N_ELEMENTS( aVFlyHtmlMap );
- if( pMap == aVMultiSelectionMap )
- return SAL_N_ELEMENTS( aVMultiSelectionMap );
- if( pMap == aHMultiSelectionMap )
- return SAL_N_ELEMENTS( aHMultiSelectionMap );
- return SAL_N_ELEMENTS(aHPageMap);
- }
- return 0;
+ if( !pMap )
+ return 0;
+
+ if( pMap == aVParaHtmlMap )
+ return std::size(aVParaHtmlMap);
+ if( pMap == aVAsCharHtmlMap )
+ return std::size( aVAsCharHtmlMap );
+ if( pMap == aHParaHtmlMap )
+ return std::size( aHParaHtmlMap );
+ if( pMap == aHParaHtmlAbsMap )
+ return std::size( aHParaHtmlAbsMap );
+ if( pMap == aVPageMap )
+ return std::size( aVPageMap );
+ if( pMap == aVPageHtmlMap )
+ return std::size( aVPageHtmlMap );
+ if( pMap == aVAsCharMap )
+ return std::size( aVAsCharMap );
+ if( pMap == aVParaMap )
+ return std::size( aVParaMap );
+ if( pMap == aHParaMap )
+ return std::size( aHParaMap );
+ if( pMap == aHFrameMap )
+ return std::size( aHFrameMap );
+ if( pMap == aVFrameMap )
+ return std::size( aVFrameMap );
+ if( pMap == aHCharMap )
+ return std::size( aHCharMap );
+ if( pMap == aHCharHtmlMap )
+ return std::size( aHCharHtmlMap );
+ if( pMap == aHCharHtmlAbsMap )
+ return std::size( aHCharHtmlAbsMap );
+ if( pMap == aVCharMap )
+ return std::size( aVCharMap );
+ if( pMap == aVCharHtmlMap )
+ return std::size( aVCharHtmlMap );
+ if( pMap == aVCharHtmlAbsMap )
+ return std::size( aVCharHtmlAbsMap );
+ if( pMap == aHPageHtmlMap )
+ return std::size( aHPageHtmlMap );
+ if( pMap == aHFlyHtmlMap )
+ return std::size( aHFlyHtmlMap );
+ if( pMap == aVFlyHtmlMap )
+ return std::size( aVFlyHtmlMap );
+ if( pMap == aVMultiSelectionMap )
+ return std::size( aVMultiSelectionMap );
+ if( pMap == aHMultiSelectionMap )
+ return std::size( aHMultiSelectionMap );
+ return std::size(aHPageMap);
}
static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(
@@ -465,19 +468,19 @@ static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(
{SvxSwFramePosString::REL_FRM_TOP, SvxSwFramePosString::REL_FRM_LEFT },
{SvxSwFramePosString::REL_FRM_BOTTOM, SvxSwFramePosString::REL_FRM_RIGHT }
};
- for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex)
+ for(const auto &a : aHoriIds)
{
- if(aHoriIds[nIndex].eHori == eStringId)
+ if(a.eHori == eStringId)
{
- eStringId = aHoriIds[nIndex].eVert;
+ eStringId = a.eVert;
return eStringId;
}
}
- for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex)
+ for(const auto &a : aVertIds)
{
- if(aVertIds[nIndex].eHori == eStringId)
+ if(a.eHori == eStringId)
{
- eStringId = aVertIds[nIndex].eVert;
+ eStringId = a.eVert;
break;
}
}
@@ -538,9 +541,14 @@ SvxSwPosSizeTabPage::SvxSwPosSizeTabPage(weld::Container* pPage, weld::DialogCon
, m_bIsMultiSelection(false)
, m_bIsInRightToLeft(false)
, m_nProtectSizeState(TRISTATE_FALSE)
+ , m_aRatioTop(ConnectorType::Top)
+ , m_aRatioBottom(ConnectorType::Bottom)
, m_xWidthMF(m_xBuilder->weld_metric_spin_button("width", FieldUnit::CM))
, m_xHeightMF(m_xBuilder->weld_metric_spin_button("height", FieldUnit::CM))
, m_xKeepRatioCB(m_xBuilder->weld_check_button("ratio"))
+ , m_xCbxScaleImg(m_xBuilder->weld_image("imRatio"))
+ , m_xImgRatioTop(new weld::CustomWeld(*m_xBuilder, "daRatioTop", m_aRatioTop))
+ , m_xImgRatioBottom(new weld::CustomWeld(*m_xBuilder, "daRatioBottom", m_aRatioBottom))
, m_xToPageRB(m_xBuilder->weld_radio_button("topage"))
, m_xToParaRB(m_xBuilder->weld_radio_button("topara"))
, m_xToCharRB(m_xBuilder->weld_radio_button("tochar"))
@@ -574,6 +582,20 @@ SvxSwPosSizeTabPage::SvxSwPosSizeTabPage(weld::Container* pPage, weld::DialogCon
SetFieldUnit(*m_xWidthMF , eDlgUnit, true);
SetFieldUnit(*m_xHeightMF, eDlgUnit, true);
+ // vertical alignment = fill makes the drawingarea expand the associated spinedits so we have to size it here
+ const sal_Int16 aHeight
+ = static_cast<sal_Int16>(std::max(int(m_xKeepRatioCB->get_preferred_size().getHeight() / 2
+ - m_xWidthMF->get_preferred_size().getHeight() / 2),
+ 12));
+ const sal_Int16 aWidth
+ = static_cast<sal_Int16>(m_xKeepRatioCB->get_preferred_size().getWidth() / 2);
+ m_xImgRatioTop->set_size_request(aWidth, aHeight);
+ m_xImgRatioBottom->set_size_request(aWidth, aHeight);
+ //init needed for gtk3
+ m_xCbxScaleImg->set_from_icon_name(m_xKeepRatioCB->get_active() ? RID_SVXBMP_LOCKED
+ : RID_SVXBMP_UNLOCKED);
+ m_xKeepRatioCB->connect_toggled(LINK(this, SvxSwPosSizeTabPage, RatioHdl_Impl));
+
SetExchangeSupport();
Link<weld::Widget&,void> aLk3 = LINK(this, SvxSwPosSizeTabPage, RangeModifyHdl);
@@ -589,7 +611,7 @@ SvxSwPosSizeTabPage::SvxSwPosSizeTabPage(weld::Container* pPage, weld::DialogCon
m_xHoriByMF->connect_value_changed( aLk );
m_xVertByMF->connect_value_changed( aLk );
- Link<weld::ToggleButton&,void> aLk2 = LINK(this, SvxSwPosSizeTabPage, AnchorTypeHdl);
+ Link<weld::Toggleable&,void> aLk2 = LINK(this, SvxSwPosSizeTabPage, AnchorTypeHdl);
m_xToPageRB->connect_toggled( aLk2 );
m_xToParaRB->connect_toggled( aLk2 );
m_xToCharRB->connect_toggled( aLk2 );
@@ -626,27 +648,27 @@ namespace
void SvxSwPosSizeTabPage::setOptimalFrmWidth()
{
static const FrmMaps aMaps[] = {
- { aHPageMap, SAL_N_ELEMENTS(aHPageMap) },
- { aHPageHtmlMap, SAL_N_ELEMENTS(aHPageHtmlMap) },
- { aVPageMap, SAL_N_ELEMENTS(aVPageMap) },
- { aVPageHtmlMap, SAL_N_ELEMENTS(aVPageHtmlMap) },
- { aHFrameMap, SAL_N_ELEMENTS(aHFrameMap) },
- { aHFlyHtmlMap, SAL_N_ELEMENTS(aHFlyHtmlMap) },
- { aVFrameMap, SAL_N_ELEMENTS(aVFrameMap) },
- { aVFlyHtmlMap, SAL_N_ELEMENTS(aVFlyHtmlMap) },
- { aHParaMap, SAL_N_ELEMENTS(aHParaMap) },
- { aHParaHtmlMap, SAL_N_ELEMENTS(aHParaHtmlMap) },
- { aHParaHtmlAbsMap, SAL_N_ELEMENTS(aHParaHtmlAbsMap) },
- { aVParaMap, SAL_N_ELEMENTS(aVParaMap) },
- { aVParaHtmlMap, SAL_N_ELEMENTS(aVParaHtmlMap) },
- { aHCharMap, SAL_N_ELEMENTS(aHCharMap) },
- { aHCharHtmlMap, SAL_N_ELEMENTS(aHCharHtmlMap) },
- { aHCharHtmlAbsMap, SAL_N_ELEMENTS(aHCharHtmlAbsMap) },
- { aVCharMap, SAL_N_ELEMENTS(aVCharMap) },
- { aVCharHtmlMap, SAL_N_ELEMENTS(aVCharHtmlMap) },
- { aVCharHtmlAbsMap, SAL_N_ELEMENTS(aVCharHtmlAbsMap) },
- { aVAsCharMap, SAL_N_ELEMENTS(aVAsCharMap) },
- { aVAsCharHtmlMap, SAL_N_ELEMENTS(aVAsCharHtmlMap) }
+ { aHPageMap, std::size(aHPageMap) },
+ { aHPageHtmlMap, std::size(aHPageHtmlMap) },
+ { aVPageMap, std::size(aVPageMap) },
+ { aVPageHtmlMap, std::size(aVPageHtmlMap) },
+ { aHFrameMap, std::size(aHFrameMap) },
+ { aHFlyHtmlMap, std::size(aHFlyHtmlMap) },
+ { aVFrameMap, std::size(aVFrameMap) },
+ { aVFlyHtmlMap, std::size(aVFlyHtmlMap) },
+ { aHParaMap, std::size(aHParaMap) },
+ { aHParaHtmlMap, std::size(aHParaHtmlMap) },
+ { aHParaHtmlAbsMap, std::size(aHParaHtmlAbsMap) },
+ { aVParaMap, std::size(aVParaMap) },
+ { aVParaHtmlMap, std::size(aVParaHtmlMap) },
+ { aHCharMap, std::size(aHCharMap) },
+ { aHCharHtmlMap, std::size(aHCharHtmlMap) },
+ { aHCharHtmlAbsMap, std::size(aHCharHtmlAbsMap) },
+ { aVCharMap, std::size(aVCharMap) },
+ { aVCharHtmlMap, std::size(aVCharHtmlMap) },
+ { aVCharHtmlAbsMap, std::size(aVCharHtmlAbsMap) },
+ { aVAsCharMap, std::size(aVAsCharMap) },
+ { aVAsCharHtmlMap, std::size(aVAsCharHtmlMap) }
};
std::vector<SvxSwFramePosString::StringId> aFrames;
@@ -685,8 +707,8 @@ namespace
void SvxSwPosSizeTabPage::setOptimalRelWidth()
{
static const RelationMaps aMaps[] = {
- { aRelationMap, SAL_N_ELEMENTS(aRelationMap) },
- { aAsCharRelationMap, SAL_N_ELEMENTS(aAsCharRelationMap) }
+ { aRelationMap, std::size(aRelationMap) },
+ { aAsCharRelationMap, std::size(aAsCharRelationMap) }
};
std::vector<SvxSwFramePosString::StringId> aRels;
@@ -718,33 +740,18 @@ std::unique_ptr<SfxTabPage> SvxSwPosSizeTabPage::Create(weld::Container* pPage,
return std::make_unique<SvxSwPosSizeTabPage>(pPage, pController, *rSet);
}
-const sal_uInt16* SvxSwPosSizeTabPage::GetRanges()
+WhichRangesContainer SvxSwPosSizeTabPage::GetRanges()
{
- static const sal_uInt16 pSwPosRanges[] =
- {
- SID_ATTR_TRANSFORM_POS_X,
- SID_ATTR_TRANSFORM_POS_Y,
- SID_ATTR_TRANSFORM_PROTECT_POS,
- SID_ATTR_TRANSFORM_PROTECT_POS,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_ANCHOR,
- SID_ATTR_TRANSFORM_VERT_ORIENT,
- SID_ATTR_TRANSFORM_WIDTH,
- SID_ATTR_TRANSFORM_SIZE_POINT,
- SID_ATTR_TRANSFORM_PROTECT_POS,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_AUTOWIDTH,
- SID_ATTR_TRANSFORM_VERT_ORIENT,
- SID_HTML_MODE,
- SID_HTML_MODE,
- SID_SW_FOLLOW_TEXT_FLOW,
- SID_SW_FOLLOW_TEXT_FLOW,
- SID_ATTR_TRANSFORM_HORI_POSITION,
- SID_ATTR_TRANSFORM_VERT_POSITION,
- 0
- };
- return pSwPosRanges;
+ static const WhichRangesContainer ranges(svl::Items<
+ SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_POS_Y,
+ SID_ATTR_TRANSFORM_WIDTH, SID_ATTR_TRANSFORM_SIZE_POINT,
+ SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_AUTOWIDTH, SID_ATTR_TRANSFORM_VERT_ORIENT,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_SW_FOLLOW_TEXT_FLOW, SID_SW_FOLLOW_TEXT_FLOW,
+ SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION
+ >);
+ return ranges;
}
bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
@@ -763,7 +770,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
rSet->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS );
else
rSet->Put(
- SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ),
+ SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_POS,
m_xPositionCB->get_state() == TRISTATE_TRUE ) );
bModified = true;
}
@@ -774,7 +781,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
rSet->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE );
else
rSet->Put(
- SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ),
+ SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE,
m_xSizeCB->get_state() == TRISTATE_TRUE ) );
bModified = true;
}
@@ -798,8 +805,8 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
nHoriByPos += m_aAnchorPos.X();
nVertByPos += m_aAnchorPos.Y();
- rSet->Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_X ), nHoriByPos ) );
- rSet->Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_Y ), nVertByPos ) );
+ rSet->Put( SfxInt32Item( SID_ATTR_TRANSFORM_POS_X, nHoriByPos ) );
+ rSet->Put( SfxInt32Item( SID_ATTR_TRANSFORM_POS_Y, nVertByPos ) );
bModified = true;
}
@@ -809,11 +816,11 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
if ( m_pHMap )
{
const SfxInt16Item& rHoriOrient =
- static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_ORIENT));
+ rOldSet.Get( SID_ATTR_TRANSFORM_HORI_ORIENT );
const SfxInt16Item& rHoriRelation =
- static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_RELATION));
+ rOldSet.Get( SID_ATTR_TRANSFORM_HORI_RELATION);
const SfxInt32Item& rHoriPosition =
- static_cast<const SfxInt32Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_POSITION)) ;
+ rOldSet.Get( SID_ATTR_TRANSFORM_HORI_POSITION);
sal_uInt16 nMapPos = GetMapPos(m_pHMap, *m_xHoriLB);
short nAlign = GetAlignment(m_pHMap, nMapPos, *m_xHoriToLB);
@@ -838,11 +845,11 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
if ( m_pVMap )
{
const SfxInt16Item& rVertOrient =
- static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_ORIENT));
+ rOldSet.Get( SID_ATTR_TRANSFORM_VERT_ORIENT);
const SfxInt16Item& rVertRelation =
- static_cast<const SfxInt16Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_RELATION));
+ rOldSet.Get( SID_ATTR_TRANSFORM_VERT_RELATION);
const SfxInt32Item& rVertPosition =
- static_cast<const SfxInt32Item&>(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_POSITION));
+ rOldSet.Get( SID_ATTR_TRANSFORM_VERT_POSITION);
sal_uInt16 nMapPos = GetMapPos(m_pVMap, *m_xVertLB);
short nAlign = GetAlignment(m_pVMap, nMapPos, *m_xVertToLB);
@@ -876,7 +883,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
{
std::unique_ptr<SfxBoolItem> pFollow(static_cast<SfxBoolItem*>(pItem->Clone()));
pFollow->SetValue(m_xFollowCB->get_active());
- bModified |= nullptr != rSet->Put(*pFollow);
+ bModified |= nullptr != rSet->Put(std::move(pFollow));
}
}
}
@@ -885,10 +892,10 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
{
sal_uInt32 nWidth = static_cast<sal_uInt32>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::TWIP)));
sal_uInt32 nHeight = static_cast<sal_uInt32>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::TWIP)));
- rSet->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), nWidth ) );
- rSet->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), nHeight ) );
+ rSet->Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, nWidth ) );
+ rSet->Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, nHeight ) );
//this item is required by SdrEditView::SetGeoAttrToMarked()
- rSet->Put( SfxUInt16Item( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal_uInt16(RectPoint::LT) ) );
+ rSet->Put( SfxUInt16Item( SID_ATTR_TRANSFORM_SIZE_POINT, sal_uInt16(RectPoint::LT) ) );
bModified = true;
}
@@ -1064,9 +1071,9 @@ DeactivateRC SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet )
{
if( _pSet )
{
- _pSet->Put(SfxBoolItem(GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ),
+ _pSet->Put(SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_POS,
m_xPositionCB->get_active()));
- _pSet->Put(SfxBoolItem(GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ),
+ _pSet->Put(SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE,
m_xSizeCB->get_active()));
FillItemSet( _pSet );
}
@@ -1123,7 +1130,12 @@ RndStdIds SvxSwPosSizeTabPage::GetAnchorType(bool* pbHasChanged)
return nRet;
}
-IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyClickHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RatioHdl_Impl, weld::Toggleable&, void)
+{
+ m_xCbxScaleImg->set_from_icon_name(m_xKeepRatioCB->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED);
+}
+
+IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyClickHdl, weld::Toggleable&, void)
{
RangeModifyHdl(m_xWidthMF->get_widget());
}
@@ -1203,7 +1215,7 @@ IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyHdl, weld::Widget&, void)
m_xVertByMF->set_value(m_xVertByMF->normalize(aVal.nVPos), FieldUnit::TWIP);
}
-IMPL_LINK_NOARG(SvxSwPosSizeTabPage, AnchorTypeHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxSwPosSizeTabPage, AnchorTypeHdl, weld::Toggleable&, void)
{
m_xHoriMirrorCB->set_sensitive(!m_xAsCharRB->get_active() && !m_bIsMultiSelection);
@@ -1223,7 +1235,7 @@ IMPL_LINK_NOARG(SvxSwPosSizeTabPage, AnchorTypeHdl, weld::ToggleButton&, void)
}
}
-IMPL_LINK_NOARG(SvxSwPosSizeTabPage, MirrorHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxSwPosSizeTabPage, MirrorHdl, weld::Toggleable&, void)
{
RndStdIds nId = GetAnchorType();
InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
@@ -1283,7 +1295,7 @@ IMPL_LINK(SvxSwPosSizeTabPage, PosHdl, weld::ComboBox&, rLB, void)
if (rLB.get_active() != -1)
{
if (pRelLB->get_active() != -1)
- nRel = reinterpret_cast<RelationMap*>(pRelLB->get_active_id().toUInt64())->nRelation;
+ nRel = weld::fromId<RelationMap*>(pRelLB->get_active_id())->nRelation;
FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
}
@@ -1369,7 +1381,7 @@ IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, weld::MetricSpinButton&, rEdit, void
UpdateExample();
}
-IMPL_LINK_NOARG(SvxSwPosSizeTabPage, ProtectHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxSwPosSizeTabPage, ProtectHdl, weld::Toggleable&, void)
{
if (m_xSizeCB->get_sensitive())
{
@@ -1386,7 +1398,7 @@ short SvxSwPosSizeTabPage::GetRelation(const weld::ComboBox& rRelationLB)
int nPos = rRelationLB.get_active();
if (nPos != -1)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rRelationLB.get_id(nPos).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rRelationLB.get_id(nPos));
nRel = pEntry->nRelation;
}
@@ -1404,7 +1416,7 @@ short SvxSwPosSizeTabPage::GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos,
{
if (rRelationLB.get_active() != -1)
{
- LB nRel = reinterpret_cast<RelationMap*>(rRelationLB.get_active_id().toUInt64())->nLBRelation;
+ LB nRel = weld::fromId<RelationMap*>(rRelationLB.get_active_id())->nLBRelation;
std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
@@ -1474,7 +1486,7 @@ void SvxSwPosSizeTabPage::InitPos(RndStdIds nAnchor,
m_nOldV = m_pVMap[nPos].nAlign;
nPos = m_xVertToLB->get_active();
if (nPos != -1)
- m_nOldVRel = reinterpret_cast<RelationMap*>(m_xVertToLB->get_id(nPos).toUInt64())->nRelation;
+ m_nOldVRel = weld::fromId<RelationMap*>(m_xVertToLB->get_id(nPos))->nRelation;
}
nPos = m_xHoriLB->get_active();
@@ -1484,7 +1496,7 @@ void SvxSwPosSizeTabPage::InitPos(RndStdIds nAnchor,
nPos = m_xHoriToLB->get_active();
if (nPos != -1)
- m_nOldHRel = reinterpret_cast<RelationMap*>(m_xHoriToLB->get_id(nPos).toUInt64())->nRelation;
+ m_nOldHRel = weld::fromId<RelationMap*>(m_xHoriToLB->get_id(nPos))->nRelation;
}
bool bEnable = true;
@@ -1659,7 +1671,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
if (pMap[_nMapPos].eStrId == eStrId)
{
nLBRelations = pMap[_nMapPos].nLBRelations;
- for (size_t nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aAsCharRelationMap); nRelPos++)
+ for (size_t nRelPos = 0; nRelPos < std::size(aAsCharRelationMap); nRelPos++)
{
if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation)
{
@@ -1667,7 +1679,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
- rLB.append(OUString::number(reinterpret_cast<sal_uInt64>(&aAsCharRelationMap[nRelPos])), sEntry);
+ rLB.append(weld::toId(&aAsCharRelationMap[nRelPos]), sEntry);
if (pMap[_nMapPos].nAlign == nAlign)
sSelEntry = sEntry;
break;
@@ -1684,7 +1696,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
{
for (int i = 0; i < rLB.get_count(); i++)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rLB.get_id(i).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rLB.get_id(i));
if (pEntry->nLBRelation == LB::RelChar) // Default
{
rLB.set_active(i);
@@ -1711,18 +1723,18 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
nLBRelations = pMap[nMapPos].nLBRelations;
}
- for (sal_uLong nBit = 1; nBit < sal_uLong(LB::LAST); nBit <<= 1)
+ for (std::underlying_type_t<LB> nBit = 1; nBit < o3tl::to_underlying(LB::LAST) ; nBit <<= 1)
{
if (nLBRelations & static_cast<LB>(nBit))
{
- for (size_t nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aRelationMap); nRelPos++)
+ for (size_t nRelPos = 0; nRelPos < std::size(aRelationMap); nRelPos++)
{
if (aRelationMap[nRelPos].nLBRelation == static_cast<LB>(nBit))
{
SvxSwFramePosString::StringId sStrId1 = m_xHoriMirrorCB->get_active() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
- rLB.append(OUString::number(reinterpret_cast<sal_uInt64>(&aRelationMap[nRelPos])), sEntry);
+ rLB.append(weld::toId(&aRelationMap[nRelPos]), sEntry);
if (sSelEntry.isEmpty() && aRelationMap[nRelPos].nRelation == nRel)
sSelEntry = sEntry;
}
@@ -1748,7 +1760,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
default:
if (rLB.get_count())
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rLB.get_id(rLB.get_count() - 1).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rLB.get_id(rLB.get_count() - 1));
nRel = pEntry->nRelation;
}
break;
@@ -1756,7 +1768,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
for (int i = 0; i < rLB.get_count(); ++i)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rLB.get_id(i).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rLB.get_id(i));
if (pEntry->nRelation == nRel)
{
rLB.set_active(i);
@@ -1881,7 +1893,7 @@ void SvxSwPosSizeTabPage::SetView( const SdrView* pSdrView )
const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
if( ( pObj->GetObjInventor() == SdrInventor::Default ) &&
- ( eKind==OBJ_TEXT || eKind==OBJ_TITLETEXT || eKind==OBJ_OUTLINETEXT) &&
+ ( eKind==SdrObjKind::Text || eKind==SdrObjKind::TitleText || eKind==SdrObjKind::OutlineText) &&
pObj->HasText() )
{
OSL_FAIL("AutoWidth/AutoHeight should be enabled");
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index a400c0207839..a568eb08223b 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -31,7 +31,8 @@ SvxAreaTabDialog::SvxAreaTabDialog
weld::Window* pParent,
const SfxItemSet* pAttr,
SdrModel* pModel,
- bool bShadow
+ bool bShadow,
+ bool bSlideBackground
)
: SfxTabDialogController(pParent, "cui/ui/areadialog.ui", "AreaDialog", pAttr)
, mpDrawModel ( pModel ),
@@ -52,7 +53,10 @@ SvxAreaTabDialog::SvxAreaTabDialog
mnGradientListState ( ChangeType::NONE ),
mnHatchingListState ( ChangeType::NONE )
{
- AddTabPage("RID_SVXPAGE_AREA", SvxAreaTabPage::Create, nullptr);
+ if (bSlideBackground)
+ AddTabPage("RID_SVXPAGE_AREA", SvxAreaTabPage::CreateWithSlideBackground, nullptr);
+ else
+ AddTabPage("RID_SVXPAGE_AREA", SvxAreaTabPage::Create, nullptr);
if (bShadow)
{
@@ -71,55 +75,46 @@ SvxAreaTabDialog::SvxAreaTabDialog
void SvxAreaTabDialog::SavePalettes()
{
- SfxObjectShell* pShell = SfxObjectShell::Current();
+ SfxObjectShell* pShell(SfxObjectShell::Current());
+ if (!pShell)
+ {
+ SAL_WARN("cui.dialogs", "SvxAreaTabDialog: No SfxObjectShell!");
+ return;
+ }
+
if( mpNewColorList != mpDrawModel->GetColorList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorList.get()) );
SvxColorListItem aColorListItem( mpNewColorList, SID_COLOR_TABLE );
- if ( pShell )
- pShell->PutItem( aColorListItem );
- else
- mpDrawModel->GetItemPool().Put(aColorListItem,SID_COLOR_TABLE);
+ pShell->PutItem( aColorListItem );
mpColorList = mpDrawModel->GetColorList();
}
if( mpNewGradientList != mpDrawModel->GetGradientList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewGradientList.get()) );
SvxGradientListItem aItem( mpNewGradientList, SID_GRADIENT_LIST );
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().Put(aItem,SID_GRADIENT_LIST);
+ pShell->PutItem( aItem );
mpGradientList = mpDrawModel->GetGradientList();
}
if( mpNewHatchingList != mpDrawModel->GetHatchList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewHatchingList.get()) );
SvxHatchListItem aItem( mpNewHatchingList, SID_HATCH_LIST );
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().Put(aItem,SID_HATCH_LIST);
+ pShell->PutItem( aItem );
mpHatchingList = mpDrawModel->GetHatchList();
}
if( mpNewBitmapList != mpDrawModel->GetBitmapList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewBitmapList.get()) );
SvxBitmapListItem aItem( mpNewBitmapList, SID_BITMAP_LIST );
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().Put(aItem,SID_BITMAP_LIST);
+ pShell->PutItem( aItem );
mpBitmapList = mpDrawModel->GetBitmapList();
}
if( mpNewPatternList != mpDrawModel->GetPatternList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewPatternList.get()) );
SvxPatternListItem aItem( mpNewPatternList, SID_PATTERN_LIST );
- if( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().Put(aItem,SID_PATTERN_LIST);
+ pShell->PutItem( aItem );
mpPatternList = mpDrawModel->GetPatternList();
}
@@ -141,10 +136,7 @@ void SvxAreaTabDialog::SavePalettes()
SvxHatchListItem aItem( mpHatchingList, SID_HATCH_LIST );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().Put(aItem);
+ pShell->PutItem( aItem );
}
if( mnBitmapListState & ChangeType::MODIFIED )
@@ -154,12 +146,7 @@ void SvxAreaTabDialog::SavePalettes()
SvxBitmapListItem aItem( mpBitmapList, SID_BITMAP_LIST );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- {
- mpDrawModel->GetItemPool().Put(aItem);
- }
+ pShell->PutItem( aItem );
}
if( mnPatternListState & ChangeType::MODIFIED )
@@ -169,10 +156,7 @@ void SvxAreaTabDialog::SavePalettes()
SvxPatternListItem aItem( mpPatternList, SID_PATTERN_LIST );
// ToolBoxControls are informed:
- if( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().Put(aItem);
+ pShell->PutItem( aItem );
}
if( mnGradientListState & ChangeType::MODIFIED )
@@ -182,24 +166,14 @@ void SvxAreaTabDialog::SavePalettes()
SvxGradientListItem aItem( mpGradientList, SID_GRADIENT_LIST );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- {
- mpDrawModel->GetItemPool().Put(aItem);
- }
+ pShell->PutItem( aItem );
}
if (mnColorListState & ChangeType::MODIFIED && mpColorList.is())
{
SvxColorListItem aItem( mpColorList, SID_COLOR_TABLE );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- {
- mpDrawModel->GetItemPool().Put(aItem);
- }
+ pShell->PutItem( aItem );
}
}
@@ -218,7 +192,7 @@ IMPL_LINK_NOARG(SvxAreaTabDialog, CancelHdlImpl, weld::Button&, void)
m_xDialog->response(RET_CANCEL);
}
-void SvxAreaTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SvxAreaTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "RID_SVXPAGE_AREA")
{
diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx
index f4e0a1268013..ac6cadd51109 100644
--- a/cui/source/tabpages/tabline.cxx
+++ b/cui/source/tabpages/tabline.cxx
@@ -50,12 +50,12 @@ SvxLineTabDialog::SvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAtt
{
switch( pObj->GetObjIdentifier() )
{
- case OBJ_LINE:
- case OBJ_PLIN:
- case OBJ_PATHLINE:
- case OBJ_FREELINE:
- case OBJ_MEASURE:
- case OBJ_EDGE:
+ case SdrObjKind::Line:
+ case SdrObjKind::PolyLine:
+ case SdrObjKind::PathLine:
+ case SdrObjKind::FreehandLine:
+ case SdrObjKind::Measure:
+ case SdrObjKind::Edge:
bLineOnly = true;
break;
@@ -160,7 +160,7 @@ IMPL_LINK_NOARG(SvxLineTabDialog, CancelHdlImpl, weld::Button&, void)
m_xDialog->response(RET_CANCEL);
}
-void SvxLineTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SvxLineTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "RID_SVXPAGE_LINE")
{
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 202576bff30d..b3a1745c26f9 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -32,12 +32,8 @@
constexpr FieldUnit eDefUnit = FieldUnit::MM_100TH;
-const sal_uInt16 SvxTabulatorTabPage::pRanges[] =
-{
- SID_ATTR_TABSTOP,
- SID_ATTR_TABSTOP_OFFSET,
- 0
-};
+const WhichRangesContainer SvxTabulatorTabPage::pRanges(
+ svl::Items<SID_ATTR_TABSTOP, SID_ATTR_TABSTOP_OFFSET>);
static void FillUpWithDefTabs_Impl( tools::Long nDefDist, SvxTabStopItem& rTabs )
{
@@ -56,7 +52,11 @@ void TabWin_Impl::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
Size aSize(GetOutputSizePixel());
aPoint.setX( aSize.Width() / 2 );
aPoint.setY( aSize.Height() / 2 );
- Ruler::DrawTab(rRenderContext, rRenderContext.GetSettings().GetStyleSettings().GetFontColor(), aPoint, nTabStyle);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetDialogColor());
+ rRenderContext.DrawRect(tools::Rectangle(Point(0,0), rRenderContext.GetOutputSize()));
+ Ruler::DrawTab(rRenderContext, rStyleSettings.GetDialogTextColor(), aPoint, nTabStyle);
}
SvxTabulatorTabPage::SvxTabulatorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttr)
@@ -94,9 +94,8 @@ SvxTabulatorTabPage::SvxTabulatorTabPage(weld::Container* pPage, weld::DialogCon
m_aCenterWin.SetTabStyle(sal_uInt16(RULER_TAB_CENTER|WB_HORZ));
m_aDezWin.SetTabStyle(sal_uInt16(RULER_TAB_DECIMAL|WB_HORZ));
//upper radiobuttons
- SvtCJKOptions aCJKOptions;
- m_xLeftTab = m_xBuilder->weld_radio_button(aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT");
- m_xRightTab = m_xBuilder->weld_radio_button(aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT");
+ m_xLeftTab = m_xBuilder->weld_radio_button(SvtCJKOptions::IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT");
+ m_xRightTab = m_xBuilder->weld_radio_button(SvtCJKOptions::IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT");
m_xLeftTab->show();
m_xRightTab->show();
@@ -112,7 +111,7 @@ SvxTabulatorTabPage::SvxTabulatorTabPage(weld::Container* pPage, weld::DialogCon
m_xDelBtn->connect_clicked(LINK(this,SvxTabulatorTabPage, DelHdl_Impl));
m_xDelAllBtn->connect_clicked(LINK(this,SvxTabulatorTabPage, DelAllHdl_Impl));
- Link<weld::ToggleButton&,void> aLink = LINK(this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl);
+ Link<weld::Toggleable&,void> aLink = LINK(this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl);
m_xLeftTab->connect_toggled(aLink);
m_xRightTab->connect_toggled(aLink);
m_xDezTab->connect_toggled(aLink);
@@ -195,7 +194,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != *aTmp)
{
- rSet->Put(*aTmp);
+ rSet->Put(std::move(aTmp));
bModified = true;
}
}
@@ -317,10 +316,9 @@ void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
m_xTabBox->clear();
tools::Long nOffset = 0;
- const SfxPoolItem* pItem = nullptr;
- if (GetItemSet().GetItemState(SID_ATTR_TABSTOP_OFFSET, true, &pItem) == SfxItemState::SET)
+ if (const SfxInt32Item* pOffSetItem = GetItemSet().GetItemIfSet(SID_ATTR_TABSTOP_OFFSET))
{
- nOffset = static_cast<const SfxInt32Item*>(pItem)->GetValue();
+ nOffset = pOffSetItem->GetValue();
MapUnit eUnit = GetItemSet().GetPool()->GetMetric(GetWhich(SID_ATTR_TABSTOP));
nOffset = OutputDevice::LogicToLogic(nOffset, eUnit, MapUnit::Map100thMM);
}
@@ -431,12 +429,10 @@ void SvxTabulatorTabPage::NewHdl_Impl(const weld::Button* pBtn)
return;
tools::Long nOffset = 0;
- const SfxPoolItem* pItem = nullptr;
- if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, true, &pItem ) ==
- SfxItemState::SET )
+ if ( const SfxInt32Item* pOffsetItem = GetItemSet().GetItemIfSet( SID_ATTR_TABSTOP_OFFSET ) )
{
- nOffset = static_cast<const SfxInt32Item*>(pItem)->GetValue();
+ nOffset = pOffsetItem->GetValue();
MapUnit eUnit = GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MapUnit::Map100thMM );
}
@@ -525,7 +521,7 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, DelAllHdl_Impl, weld::Button&, void)
}
}
-IMPL_LINK(SvxTabulatorTabPage, TabTypeCheckHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxTabulatorTabPage, TabTypeCheckHdl_Impl, weld::Toggleable&, rBox, void)
{
if (!rBox.get_active())
return;
@@ -558,7 +554,7 @@ IMPL_LINK(SvxTabulatorTabPage, TabTypeCheckHdl_Impl, weld::ToggleButton&, rBox,
}
}
-IMPL_LINK(SvxTabulatorTabPage, FillTypeCheckHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxTabulatorTabPage, FillTypeCheckHdl_Impl, weld::Toggleable&, rBox, void)
{
if (!rBox.get_active())
return;
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
index a7ee4b3aade9..f0964e4957d6 100644
--- a/cui/source/tabpages/textanim.cxx
+++ b/cui/source/tabpages/textanim.cxx
@@ -19,6 +19,7 @@
#include <textanim.hxx>
#include <textattr.hxx>
+#include <TextColumnsPage.hxx>
#include <svx/dlgutil.hxx>
#include <svx/svdmark.hxx>
#include <svx/svdview.hxx>
@@ -28,12 +29,8 @@
#include <svx/sdtayitm.hxx>
#include <svtools/unitconv.hxx>
-const sal_uInt16 SvxTextAnimationPage::pRanges[] =
-{
- SDRATTR_TEXT_ANIKIND,
- SDRATTR_TEXT_ANIAMOUNT,
- 0
-};
+const WhichRangesContainer SvxTextAnimationPage::pRanges(
+ svl::Items<SDRATTR_TEXT_ANIKIND, SDRATTR_TEXT_ANIAMOUNT>);
/*************************************************************************
|*
@@ -47,6 +44,7 @@ SvxTextTabDialog::SvxTextTabDialog(weld::Window* pParent, const SfxItemSet* pAtt
{
AddTabPage("RID_SVXPAGE_TEXTATTR", SvxTextAttrPage::Create, nullptr);
AddTabPage("RID_SVXPAGE_TEXTANIMATION", SvxTextAnimationPage::Create, nullptr);
+ AddTabPage("RID_SVXPAGE_TEXTCOLUMNS", SvxTextColumnsPage::Create, nullptr);
}
/*************************************************************************
@@ -55,12 +53,12 @@ SvxTextTabDialog::SvxTextTabDialog(weld::Window* pParent, const SfxItemSet* pAtt
|*
\************************************************************************/
-void SvxTextTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SvxTextTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId != "RID_SVXPAGE_TEXTATTR")
return;
- SdrObjKind eKind = OBJ_NONE;
+ SdrObjKind eKind = SdrObjKind::NONE;
if (pView)
{
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
@@ -113,9 +111,9 @@ SvxTextAnimationPage::SvxTextAnimationPage(weld::Container* pPage, weld::DialogC
eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
m_xLbEffect->connect_changed( LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) );
- m_xTsbEndless->connect_clicked( LINK( this, SvxTextAnimationPage, ClickEndlessHdl_Impl ) );
- m_xTsbAuto->connect_clicked( LINK( this, SvxTextAnimationPage, ClickAutoHdl_Impl ) );
- m_xTsbPixel->connect_clicked( LINK( this, SvxTextAnimationPage, ClickPixelHdl_Impl ) );
+ m_xTsbEndless->connect_toggled( LINK( this, SvxTextAnimationPage, ClickEndlessHdl_Impl ) );
+ m_xTsbAuto->connect_toggled( LINK( this, SvxTextAnimationPage, ClickAutoHdl_Impl ) );
+ m_xTsbPixel->connect_toggled( LINK( this, SvxTextAnimationPage, ClickPixelHdl_Impl ) );
Link<weld::Button&,void> aLink( LINK( this, SvxTextAnimationPage, ClickDirectionHdl_Impl ) );
m_xBtnUp->connect_clicked( aLink );
@@ -142,7 +140,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
const SfxPoolItem* pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIKIND );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANIKIND );
eAniKind = static_cast<const SdrTextAniKindItem*>(pItem)->GetValue();
m_xLbEffect->set_active(sal::static_int_cast<sal_Int32>(eAniKind));
@@ -151,7 +149,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
// animation direction
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIDIRECTION );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANIDIRECTION );
SelectDirection(static_cast<const SdrTextAniDirectionItem*>(pItem)->GetValue());
m_aUpState = m_xBtnUp->get_state();
@@ -162,7 +160,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
// Start inside
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANISTARTINSIDE );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE );
if (static_cast<const SdrTextAniStartInsideItem*>(pItem)->GetValue())
m_xTsbStartInside->set_state(TRISTATE_TRUE);
@@ -173,7 +171,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
// Stop inside
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANISTOPINSIDE );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE );
if (static_cast<const SdrTextAniStopInsideItem*>(pItem)->GetValue())
m_xTsbStopInside->set_state(TRISTATE_TRUE);
@@ -184,7 +182,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
// quantity
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANICOUNT );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANICOUNT );
tools::Long nValue = static_cast<tools::Long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
m_xNumFldCount->set_value(nValue);
@@ -209,7 +207,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
// delay
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIDELAY );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANIDELAY );
nValue = static_cast<tools::Long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
m_xMtrFldDelay->set_value(nValue, FieldUnit::NONE);
@@ -226,7 +224,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
// step size
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIAMOUNT );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_ANIAMOUNT );
nValue = static_cast<tools::Long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
if (nValue <= 0)
@@ -438,7 +436,7 @@ IMPL_LINK_NOARG(SvxTextAnimationPage, SelectEffectHdl_Impl, weld::ComboBox&, voi
}
}
-IMPL_LINK_NOARG(SvxTextAnimationPage, ClickEndlessHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxTextAnimationPage, ClickEndlessHdl_Impl, weld::Toggleable&, void)
{
if( eAniKind == SdrTextAniKind::Slide )
return;
@@ -456,7 +454,7 @@ IMPL_LINK_NOARG(SvxTextAnimationPage, ClickEndlessHdl_Impl, weld::Button&, void)
}
}
-IMPL_LINK_NOARG(SvxTextAnimationPage, ClickAutoHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxTextAnimationPage, ClickAutoHdl_Impl, weld::Toggleable&, void)
{
TriState eState = m_xTsbAuto->get_state();
if( eState != TRISTATE_FALSE )
@@ -471,7 +469,7 @@ IMPL_LINK_NOARG(SvxTextAnimationPage, ClickAutoHdl_Impl, weld::Button&, void)
}
}
-IMPL_LINK_NOARG(SvxTextAnimationPage, ClickPixelHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxTextAnimationPage, ClickPixelHdl_Impl, weld::Toggleable&, void)
{
TriState eState = m_xTsbPixel->get_state();
if (eState == TRISTATE_TRUE)
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index 43fea9f6c830..a803efffe5cb 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -24,24 +24,21 @@
#include <svx/sdtaitm.hxx>
#include <svx/sdtfsitm.hxx>
#include <svx/sdtcfitm.hxx>
-#include <svx/svdobj.hxx>
#include <svx/svxids.hrc>
#include <textattr.hxx>
#include <svx/dlgutil.hxx>
#include <editeng/writingmodeitem.hxx>
#include <svtools/unitconv.hxx>
+#include <osl/diagnose.h>
using namespace ::com::sun::star;
-const sal_uInt16 SvxTextAttrPage::pRanges[] =
-{
- SDRATTR_MISC_FIRST
- , SDRATTR_TEXT_HORZADJUST
- , SDRATTR_TEXT_WORDWRAP
- , SDRATTR_TEXT_WORDWRAP
- , 0
-};
+const WhichRangesContainer SvxTextAttrPage::pRanges(
+ svl::Items<
+ SDRATTR_MISC_FIRST ,SDRATTR_TEXT_HORZADJUST,
+ SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_WORDWRAP
+>);
/*************************************************************************
|*
@@ -51,7 +48,7 @@ const sal_uInt16 SvxTextAttrPage::pRanges[] =
SvxTextAttrPage::SvxTextAttrPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
: SvxTabPage(pPage, pController, "cui/ui/textattrtabpage.ui", "TextAttributesPage", rInAttrs)
, rOutAttrs(rInAttrs)
- , m_eObjKind(OBJ_NONE)
+ , m_eObjKind(SdrObjKind::NONE)
, bAutoGrowSizeEnabled(false)
, bContourEnabled(false)
, bAutoGrowWidthEnabled(false)
@@ -84,14 +81,14 @@ SvxTextAttrPage::SvxTextAttrPage(weld::Container* pPage, weld::DialogController*
SetFieldUnit( *m_xMtrFldTop, eFUnit );
SetFieldUnit( *m_xMtrFldBottom, eFUnit );
- Link<weld::Button&,void> aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
- m_xTsbAutoGrowWidth->connect_clicked( aLink );
- m_xTsbAutoGrowHeight->connect_clicked( aLink );
- m_xTsbAutoGrowSize->connect_clicked( aLink );
- m_xTsbFitToSize->connect_clicked( aLink );
- m_xTsbContour->connect_clicked( aLink );
+ Link<weld::Toggleable&,void> aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
+ m_xTsbAutoGrowWidth->connect_toggled( aLink );
+ m_xTsbAutoGrowHeight->connect_toggled( aLink );
+ m_xTsbAutoGrowSize->connect_toggled( aLink );
+ m_xTsbFitToSize->connect_toggled( aLink );
+ m_xTsbContour->connect_toggled( aLink );
- m_xTsbFullWidth->connect_clicked(LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
+ m_xTsbFullWidth->connect_toggled(LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
}
SvxTextAttrPage::~SvxTextAttrPage()
@@ -110,36 +107,36 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
DBG_ASSERT( pPool, "Where is the pool?" );
MapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
- const SfxPoolItem* pItem = GetItem( *rAttrs, SDRATTR_TEXT_LEFTDIST );
+ const SdrMetricItem* pItem = GetItem(*rAttrs, SDRATTR_TEXT_LEFTDIST);
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_LEFTDIST );
- SetMetricValue(*m_xMtrFldLeft, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
+ SetMetricValue(*m_xMtrFldLeft, pItem->GetValue(), eUnit);
m_xMtrFldLeft->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_RIGHTDIST );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_RIGHTDIST );
- SetMetricValue(*m_xMtrFldRight, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
+ SetMetricValue(*m_xMtrFldRight, pItem->GetValue(), eUnit);
m_xMtrFldRight->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_UPPERDIST );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_UPPERDIST );
- SetMetricValue(*m_xMtrFldTop, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
+ SetMetricValue(*m_xMtrFldTop, pItem->GetValue(), eUnit);
m_xMtrFldTop->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_LOWERDIST );
if( !pItem )
- pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST );
+ pItem = &pPool->GetUserOrPoolDefaultItem( SDRATTR_TEXT_LOWERDIST );
- SetMetricValue(*m_xMtrFldBottom, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
+ SetMetricValue(*m_xMtrFldBottom, pItem->GetValue(), eUnit);
m_xMtrFldBottom->save_value();
// adjust to height and autogrowsize
- if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SfxItemState::INVALID )
{
m_xTsbAutoGrowHeight->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -156,7 +153,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
m_xTsbAutoGrowSize->save_state();
// adjust to width
- if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SfxItemState::INVALID )
{
m_xTsbAutoGrowWidth->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWWIDTH ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -166,7 +163,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
m_xTsbAutoGrowWidth->save_state();
// wordwrap text
- if ( rAttrs->GetItemState( SDRATTR_TEXT_WORDWRAP ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_TEXT_WORDWRAP ) != SfxItemState::INVALID )
{
m_xTsbWordWrapText->set_state( rAttrs->Get( SDRATTR_TEXT_WORDWRAP ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -181,7 +178,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
SfxItemState eVState = rAttrs->GetItemState( SDRATTR_TEXT_VERTADJUST );
SfxItemState eHState = rAttrs->GetItemState( SDRATTR_TEXT_HORZADJUST );
- if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
+ if(SfxItemState::INVALID != eVState && SfxItemState::INVALID != eHState)
{
// VertAdjust and HorAdjust are unequivocal, thus
SdrTextVertAdjust eTVA = rAttrs->Get(SDRATTR_TEXT_VERTADJUST).GetValue();
@@ -257,7 +254,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
}
// adjust to border
- if (rAttrs->GetItemState(SDRATTR_TEXT_FITTOSIZE) != SfxItemState::DONTCARE)
+ if (rAttrs->GetItemState(SDRATTR_TEXT_FITTOSIZE) != SfxItemState::INVALID)
{
drawing::TextFitToSizeType const eFTS =
rAttrs->Get( SDRATTR_TEXT_FITTOSIZE ).GetValue();
@@ -270,7 +267,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
m_xTsbFitToSize->set_state( TRISTATE_INDET );
m_xTsbFitToSize->save_state();
- if( rAttrs->GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SfxItemState::INVALID )
{
bool bContour = rAttrs->Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
m_xTsbContour->set_state( bContour ? TRISTATE_TRUE : TRISTATE_FALSE );
@@ -397,34 +394,34 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
// #103516# Do not change values if adjust controls were disabled.
bool bIsDisabled(m_aCtlPosition.IsCompletelyDisabled());
- if(!bIsDisabled)
- {
- if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE )
- {
- if (IsTextDirectionLeftToRight())
- eTHA = SDRTEXTHORZADJUST_BLOCK;
- else
- eTVA = SDRTEXTVERTADJUST_BLOCK;
- }
+ if(bIsDisabled)
+ return true;
- if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SfxItemState::DONTCARE )
- {
- SdrTextVertAdjust eOldTVA = rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ).GetValue();
- if( eOldTVA != eTVA )
- rAttrs->Put( SdrTextVertAdjustItem( eTVA ) );
- }
+ if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE )
+ {
+ if (IsTextDirectionLeftToRight())
+ eTHA = SDRTEXTHORZADJUST_BLOCK;
else
+ eTVA = SDRTEXTVERTADJUST_BLOCK;
+ }
+
+ if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SfxItemState::INVALID )
+ {
+ SdrTextVertAdjust eOldTVA = rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ).GetValue();
+ if( eOldTVA != eTVA )
rAttrs->Put( SdrTextVertAdjustItem( eTVA ) );
+ }
+ else
+ rAttrs->Put( SdrTextVertAdjustItem( eTVA ) );
- if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SfxItemState::DONTCARE )
- {
- SdrTextHorzAdjust eOldTHA = rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ).GetValue();
- if( eOldTHA != eTHA )
- rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) );
- }
- else
+ if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SfxItemState::INVALID )
+ {
+ SdrTextHorzAdjust eOldTHA = rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ).GetValue();
+ if( eOldTHA != eTHA )
rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) );
}
+ else
+ rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) );
return true;
}
@@ -433,17 +430,17 @@ void SvxTextAttrPage::Construct()
{
switch (m_eObjKind)
{
- case OBJ_NONE:
+ case SdrObjKind::NONE:
// indeterminate, show them all
bFitToSizeEnabled = bContourEnabled = bWordWrapTextEnabled =
bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = true;
m_xCustomShapeText->show();
m_xDrawingText->show();
break;
- case OBJ_TEXT:
- case OBJ_TITLETEXT:
- case OBJ_OUTLINETEXT:
- case OBJ_CAPTION:
+ case SdrObjKind::Text:
+ case SdrObjKind::TitleText:
+ case SdrObjKind::OutlineText:
+ case SdrObjKind::Caption:
// contour NOT possible for pure text objects
bContourEnabled = bWordWrapTextEnabled = bAutoGrowSizeEnabled = false;
@@ -452,7 +449,7 @@ void SvxTextAttrPage::Construct()
m_xCustomShapeText->hide();
m_xDrawingText->show();
break;
- case OBJ_CUSTOMSHAPE:
+ case SdrObjKind::CustomShape:
bFitToSizeEnabled = bContourEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = false;
bWordWrapTextEnabled = bAutoGrowSizeEnabled = true;
m_xDrawingText->hide();
@@ -527,7 +524,7 @@ void SvxTextAttrPage::PointChanged(weld::DrawingArea*, RectPoint eRP)
to be moved to a valid and adjacent position. This position depends on
the current anchor position and the text writing direction.
*/
-IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Toggleable&, void)
{
if( m_xTsbFullWidth->get_state() != TRISTATE_TRUE )
return;
@@ -584,7 +581,7 @@ IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Button&, void)
|*
\************************************************************************/
-IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Button&, rButton, void)
+IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Toggleable&, rButton, void)
{
if (&rButton == m_xTsbAutoGrowSize.get())
{
@@ -633,7 +630,7 @@ IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Button&, rButton, void)
// #103516# Do the setup based on states of hor/ver adjust
SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
- bool bHorAndVer(SfxItemState::DONTCARE == eVState || SfxItemState::DONTCARE == eHState);
+ bool bHorAndVer(SfxItemState::INVALID == eVState || SfxItemState::INVALID == eHState);
// #83698# enable/disable text anchoring dependent of contour
m_xFlPosition->set_sensitive(!bContour && !bHorAndVer);
@@ -646,7 +643,7 @@ bool SvxTextAttrPage::IsTextDirectionLeftToRight() const
bool bLeftToRightDirection = true;
SfxItemState eState = rOutAttrs.GetItemState(SDRATTR_TEXTDIRECTION);
- if(SfxItemState::DONTCARE != eState)
+ if(SfxItemState::INVALID != eState)
{
const SvxWritingModeItem& rItem = rOutAttrs.Get(SDRATTR_TEXTDIRECTION);
if (rItem.GetValue() == css::text::WritingMode_TB_RL)
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 079b717c3efe..b67990e29625 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -19,12 +19,14 @@
#include <svx/svxids.hrc>
#include <svx/xfillit0.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/xflbckit.hxx>
#include <svx/drawitem.hxx>
#include <svx/xflclit.hxx>
#include <svx/xflgrit.hxx>
#include <svx/xflhtit.hxx>
#include <svx/xbtmpit.hxx>
+#include <svx/xgrscit.hxx>
#include <cuitabarea.hxx>
#include <sfx2/tabdlg.hxx>
@@ -41,19 +43,16 @@ enum FillType
GRADIENT,
HATCH,
BITMAP,
- PATTERN
+ PATTERN,
+ USE_BACKGROUND_FILL
};
}
-const sal_uInt16 SvxAreaTabPage::pAreaRanges[] =
-{
- XATTR_GRADIENTSTEPCOUNT,
- XATTR_GRADIENTSTEPCOUNT,
- SID_ATTR_FILL_STYLE,
- SID_ATTR_FILL_BITMAP,
- 0
-};
+const WhichRangesContainer SvxAreaTabPage::pAreaRanges(
+ svl::Items<
+ XATTR_GRADIENTSTEPCOUNT, XATTR_GRADIENTSTEPCOUNT,
+ SID_ATTR_FILL_STYLE, SID_ATTR_FILL_BITMAP>);
namespace
{
@@ -74,7 +73,8 @@ void lclExtendSize(Size& rSize, const Size& rInputSize)
|*
\************************************************************************/
-SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
+SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs, bool bSlideBackground)
: SfxTabPage(pPage, pController, "cui/ui/areatabpage.ui", "AreaTabPage", &rInAttrs)
// local fixed not o be changed values for local pointers
, maFixed_ChangeType(ChangeType::NONE)
@@ -93,6 +93,7 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p
, m_xBtnHatch(m_xBuilder->weld_toggle_button("btnhatch"))
, m_xBtnBitmap(m_xBuilder->weld_toggle_button("btnbitmap"))
, m_xBtnPattern(m_xBuilder->weld_toggle_button("btnpattern"))
+ , m_xBtnUseBackground(m_xBuilder->weld_toggle_button("btnusebackground"))
{
maBox.AddButton(m_xBtnNone.get());
maBox.AddButton(m_xBtnColor.get());
@@ -100,13 +101,21 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p
maBox.AddButton(m_xBtnHatch.get());
maBox.AddButton(m_xBtnBitmap.get());
maBox.AddButton(m_xBtnPattern.get());
- Link<weld::ToggleButton&, void> aLink = LINK(this, SvxAreaTabPage, SelectFillTypeHdl_Impl);
+
+ Link<weld::Toggleable&, void> aLink = LINK(this, SvxAreaTabPage, SelectFillTypeHdl_Impl);
m_xBtnNone->connect_toggled(aLink);
m_xBtnColor->connect_toggled(aLink);
m_xBtnGradient->connect_toggled(aLink);
m_xBtnHatch->connect_toggled(aLink);
m_xBtnBitmap->connect_toggled(aLink);
m_xBtnPattern->connect_toggled(aLink);
+ if (bSlideBackground)
+ {
+ maBox.AddButton(m_xBtnUseBackground.get());
+ m_xBtnUseBackground->connect_toggled(aLink);
+ }
+ else
+ m_xBtnUseBackground->hide();
SetExchangeSupport();
}
@@ -158,9 +167,9 @@ SvxAreaTabPage::~SvxAreaTabPage()
void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
{
drawing::FillStyle eXFS = drawing::FillStyle_NONE;
- if( rSet.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::DONTCARE )
+ if( rSet.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::INVALID )
{
- XFillStyleItem aFillStyleItem( static_cast<const XFillStyleItem&>( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) ) );
+ XFillStyleItem aFillStyleItem( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) );
eXFS = aFillStyleItem.GetValue();
m_rXFSet.Put( aFillStyleItem );
}
@@ -170,33 +179,37 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
default:
case drawing::FillStyle_NONE:
{
- SelectFillType(*m_xBtnNone);
+ XFillUseSlideBackgroundItem aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND));
+ if (aBckItem.GetValue())
+ SelectFillType(*m_xBtnUseBackground);
+ else
+ SelectFillType(*m_xBtnNone);
break;
}
case drawing::FillStyle_SOLID:
{
- m_rXFSet.Put( static_cast<const XFillColorItem&>( rSet.Get( GetWhich( XATTR_FILLCOLOR ) ) ) );
+ m_rXFSet.Put( rSet.Get( GetWhich( XATTR_FILLCOLOR ) ) );
SelectFillType(*m_xBtnColor);
break;
}
case drawing::FillStyle_GRADIENT:
{
- m_rXFSet.Put( static_cast<const XFillGradientItem&>( rSet.Get( GetWhich( XATTR_FILLGRADIENT ) ) ) );
+ m_rXFSet.Put( rSet.Get( GetWhich( XATTR_FILLGRADIENT ) ) );
+ m_rXFSet.Put(rSet.Get(GetWhich(XATTR_GRADIENTSTEPCOUNT)));
SelectFillType(*m_xBtnGradient);
break;
}
case drawing::FillStyle_HATCH:
{
m_rXFSet.Put( rSet.Get(XATTR_FILLHATCH) );
- m_rXFSet.Put( rSet.Get(XATTR_FILLBACKGROUND) );
+ m_rXFSet.Put( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND) );
m_rXFSet.Put( rSet.Get(XATTR_FILLCOLOR) );
SelectFillType(*m_xBtnHatch);
break;
}
case drawing::FillStyle_BITMAP:
{
- const bool bPattern
- = rSet.Get(TypedWhichId<XFillBitmapItem>(GetWhich(XATTR_FILLBITMAP))).isPattern();
+ const bool bPattern = rSet.Get(GetWhich(XATTR_FILLBITMAP)).isPattern();
// pass full item set here, bitmap fill has many attributes (tiling, size, offset etc.)
m_rXFSet.Put( rSet );
if (!bPattern)
@@ -227,6 +240,8 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
{
XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
_pSet->Put( aStyleItem );
+ XFillUseSlideBackgroundItem aFillBgItem( false );
+ _pSet->Put( aFillBgItem );
}
break;
}
@@ -240,6 +255,17 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivatePage_Impl<SvxBitmapTabPage&>(_pSet);
case PATTERN:
return DeactivatePage_Impl<SvxPatternTabPage>(_pSet);
+ case USE_BACKGROUND_FILL:
+ {
+ if ( m_bBtnClicked )
+ {
+ XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
+ _pSet->Put( aStyleItem );
+ XFillUseSlideBackgroundItem aFillBgItem( true );
+ _pSet->Put( aFillBgItem );
+ }
+ break;
+ }
default:
break;
}
@@ -252,6 +278,21 @@ bool SvxAreaTabPage::FillItemSet_Impl( SfxItemSet* rAttrs)
return static_cast<TTabPage&>( *m_xFillTabPage ).FillItemSet( rAttrs );
}
+OUString SvxAreaTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString toggleButton[] = { "btnnone", "btncolor", "btngradient", "btnbitmap",
+ "btnpattern", "btnhatch", "btnusebackground" };
+
+ for (const auto& toggle : toggleButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_toggle_button(toggle))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
{
FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos());
@@ -260,6 +301,7 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
case TRANSPARENT:
{
rAttrs->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
+ rAttrs->Put( XFillUseSlideBackgroundItem( false ) );
return true;
}
case SOLID:
@@ -282,6 +324,12 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
{
return FillItemSet_Impl<SvxPatternTabPage>( rAttrs );
}
+ case USE_BACKGROUND_FILL:
+ {
+ rAttrs->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
+ rAttrs->Put( XFillUseSlideBackgroundItem( true ) );
+ return true;
+ }
default:
return false;
}
@@ -336,6 +384,14 @@ std::unique_ptr<SfxTabPage> SvxAreaTabPage::Create(weld::Container* pPage, weld:
return xRet;
}
+std::unique_ptr<SfxTabPage> SvxAreaTabPage::CreateWithSlideBackground(
+ weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrs)
+{
+ auto xRet = std::make_unique<SvxAreaTabPage>(pPage, pController, *rAttrs, true);
+ xRet->SetOptimalSize(pController);
+ return xRet;
+}
+
namespace {
std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
@@ -349,13 +405,14 @@ std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, weld::Con
case HATCH: fnCreate = &SvxHatchTabPage::Create; break;
case BITMAP: fnCreate = &SvxBitmapTabPage::Create; break;
case PATTERN: fnCreate = &SvxPatternTabPage::Create; break;
+ case USE_BACKGROUND_FILL: fnCreate = nullptr; break;
}
return fnCreate ? (*fnCreate)( pPage, pController, &rSet ) : nullptr;
}
}
-IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::ToggleButton&, rButton, void)
+IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::Toggleable&, rButton, void)
{
//tdf#124549 - If the button is already active do not toggle it back.
if(!rButton.get_active())
@@ -365,7 +422,7 @@ IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::ToggleButton&, rButton,
m_bBtnClicked = true;
}
-void SvxAreaTabPage::SelectFillType(weld::ToggleButton& rButton, const SfxItemSet* _pSet)
+void SvxAreaTabPage::SelectFillType(weld::Toggleable& rButton, const SfxItemSet* _pSet)
{
if (_pSet)
m_rXFSet.Set(*_pSet);
@@ -377,8 +434,10 @@ void SvxAreaTabPage::SelectFillType(weld::ToggleButton& rButton, const SfxItemSe
FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos());
m_xFillTabPage = lcl_CreateFillStyleTabPage(eFillType, m_xFillTab.get(), GetDialogController(), m_rXFSet);
if (m_xFillTabPage)
+ {
m_xFillTabPage->SetDialogController(GetDialogController());
- CreatePage(eFillType, m_xFillTabPage.get());
+ CreatePage(eFillType, *m_xFillTabPage);
+ }
}
}
@@ -402,63 +461,63 @@ void SvxAreaTabPage::PageCreated(const SfxAllItemSet& aSet)
SetPatternList(pPatternListItem->GetPatternList());
}
-void SvxAreaTabPage::CreatePage( sal_Int32 nId, SfxTabPage* pTab )
+void SvxAreaTabPage::CreatePage(sal_Int32 nId, SfxTabPage& rTab)
{
if(nId == SOLID )
{
- auto* pColorTab = static_cast<SvxColorTabPage*>(pTab);
- pColorTab->SetColorList(m_pColorList);
- pColorTab->SetColorChgd(m_pnColorListState);
- pColorTab->Construct();
- pColorTab->ActivatePage(m_rXFSet);
- pColorTab->Reset(&m_rXFSet);
- pColorTab->set_visible(true);
+ auto& rColorTab = static_cast<SvxColorTabPage&>(rTab);
+ rColorTab.SetColorList(m_pColorList);
+ rColorTab.SetColorChgd(m_pnColorListState);
+ rColorTab.Construct();
+ rColorTab.ActivatePage(m_rXFSet);
+ rColorTab.Reset(&m_rXFSet);
+ rColorTab.set_visible(true);
}
else if(nId == GRADIENT)
{
- auto* pGradientTab = static_cast<SvxGradientTabPage*>(pTab);
- pGradientTab->SetColorList(m_pColorList);
- pGradientTab->SetGradientList(m_pGradientList);
- pGradientTab->SetGrdChgd(m_pnGradientListState);
- pGradientTab->SetColorChgd(m_pnColorListState);
- pGradientTab->Construct();
- pGradientTab->ActivatePage(m_rXFSet);
- pGradientTab->Reset(&m_rXFSet);
- pGradientTab->set_visible(true);
+ auto& rGradientTab = static_cast<SvxGradientTabPage&>(rTab);
+ rGradientTab.SetColorList(m_pColorList);
+ rGradientTab.SetGradientList(m_pGradientList);
+ rGradientTab.SetGrdChgd(m_pnGradientListState);
+ rGradientTab.SetColorChgd(m_pnColorListState);
+ rGradientTab.Construct();
+ rGradientTab.ActivatePage(m_rXFSet);
+ rGradientTab.Reset(&m_rXFSet);
+ rGradientTab.set_visible(true);
}
else if(nId == HATCH)
{
- auto* pHatchTab = static_cast<SvxHatchTabPage*>(pTab);
- pHatchTab->SetColorList(m_pColorList);
- pHatchTab->SetHatchingList(m_pHatchingList);
- pHatchTab->SetHtchChgd(m_pnHatchingListState);
- pHatchTab->SetColorChgd(m_pnColorListState);
- pHatchTab->Construct();
- pHatchTab->ActivatePage(m_rXFSet);
- pHatchTab->Reset(&m_rXFSet);
- pHatchTab->set_visible(true);
+ auto& rHatchTab = static_cast<SvxHatchTabPage&>(rTab);
+ rHatchTab.SetColorList(m_pColorList);
+ rHatchTab.SetHatchingList(m_pHatchingList);
+ rHatchTab.SetHtchChgd(m_pnHatchingListState);
+ rHatchTab.SetColorChgd(m_pnColorListState);
+ rHatchTab.Construct();
+ rHatchTab.ActivatePage(m_rXFSet);
+ rHatchTab.Reset(&m_rXFSet);
+ rHatchTab.set_visible(true);
}
else if(nId == BITMAP)
{
- auto* pBitmapTab = static_cast<SvxBitmapTabPage*>(pTab);
- pBitmapTab->SetBitmapList(m_pBitmapList);
- pBitmapTab->SetBmpChgd(m_pnBitmapListState);
- pBitmapTab->Construct();
- pBitmapTab->ActivatePage(m_rXFSet);
- pBitmapTab->Reset(&m_rXFSet);
- pBitmapTab->set_visible(true);
+ auto& rBitmapTab = static_cast<SvxBitmapTabPage&>(rTab);
+ rBitmapTab.SetBitmapList(m_pBitmapList);
+ rBitmapTab.SetBmpChgd(m_pnBitmapListState);
+ rBitmapTab.Construct();
+ rBitmapTab.ActivatePage(m_rXFSet);
+ rBitmapTab.Reset(&m_rXFSet);
+ rBitmapTab.set_visible(true);
}
else if(nId == PATTERN)
{
- auto* pPatternTab = static_cast<SvxPatternTabPage*>(pTab);
- pPatternTab->SetColorList(m_pColorList);
- pPatternTab->SetPatternList(m_pPatternList);
- pPatternTab->SetPtrnChgd(m_pnPatternListState);
- pPatternTab->SetColorChgd(m_pnColorListState);
- pPatternTab->Construct();
- pPatternTab->ActivatePage(m_rXFSet);
- pPatternTab->Reset(&m_rXFSet);
- pPatternTab->set_visible(true);
+ auto& rPatternTab = static_cast<SvxPatternTabPage&>(rTab);
+ rPatternTab.SetColorList(m_pColorList);
+ rPatternTab.SetPatternList(m_pPatternList);
+ rPatternTab.SetPtrnChgd(m_pnPatternListState);
+ rPatternTab.SetColorChgd(m_pnColorListState);
+ rPatternTab.Construct();
+ rPatternTab.ActivatePage(m_rXFSet);
+ rPatternTab.Reset(&m_rXFSet);
+ rPatternTab.set_visible(true);
}
}
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 647bcaa105e3..2990f4473e91 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -67,7 +67,7 @@ enum TileOffset
}
SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
- : SfxTabPage(pPage, pController, "cui/ui/bitmaptabpage.ui", "BitmapTabPage", &rInAttrs)
+ : SfxTabPage(pPage, pController, "cui/ui/imagetabpage.ui", "ImageTabPage", &rInAttrs)
, m_rOutAttrs(rInAttrs)
, m_pnBitmapListState(nullptr)
, m_fObjectWidth(0.0)
@@ -76,8 +76,8 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle
, m_aXFillAttr(rInAttrs.GetPool())
, m_rXFSet(m_aXFillAttr.GetItemSet())
, mpView(nullptr)
- , m_xBitmapLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("bitmapwin", true)))
- , m_xBitmapStyleLB(m_xBuilder->weld_combo_box("bitmapstyle"))
+ , m_xBitmapLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("imagewin", true)))
+ , m_xBitmapStyleLB(m_xBuilder->weld_combo_box("imagestyle"))
, m_xSizeBox(m_xBuilder->weld_container("sizebox"))
, m_xTsbScale(m_xBuilder->weld_check_button("scaletsb"))
, m_xBitmapWidth(m_xBuilder->weld_metric_spin_button("width", FieldUnit::PERCENT))
@@ -91,8 +91,8 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle
, m_xTileOffLB(m_xBuilder->weld_combo_box("tileofflb"))
, m_xTileOffset(m_xBuilder->weld_metric_spin_button("tileoffmtr", FieldUnit::PERCENT))
, m_xBtnImport(m_xBuilder->weld_button("BTN_IMPORT"))
- , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder, "CTL_BITMAP_PREVIEW", m_aCtlBitmapPreview))
- , m_xBitmapLBWin(new weld::CustomWeld(*m_xBuilder, "BITMAP", *m_xBitmapLB))
+ , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder, "CTL_IMAGE_PREVIEW", m_aCtlBitmapPreview))
+ , m_xBitmapLBWin(new weld::CustomWeld(*m_xBuilder, "IMAGE", *m_xBitmapLB))
{
// setting the output device
m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) );
@@ -106,7 +106,7 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle
Link<weld::MetricSpinButton&, void> aLink1( LINK(this, SvxBitmapTabPage, ModifyBitmapSizeHdl) );
m_xBitmapWidth->connect_value_changed( aLink1 );
m_xBitmapHeight->connect_value_changed( aLink1 );
- m_xTsbScale->connect_clicked(LINK(this, SvxBitmapTabPage, ClickScaleHdl));
+ m_xTsbScale->connect_toggled(LINK(this, SvxBitmapTabPage, ClickScaleHdl));
m_xPositionLB->connect_changed( LINK( this, SvxBitmapTabPage, ModifyBitmapPositionHdl ) );
Link<weld::MetricSpinButton&, void> aLink( LINK( this, SvxBitmapTabPage, ModifyPositionOffsetHdl ) );
m_xPositionOffX->connect_value_changed(aLink);
@@ -127,6 +127,8 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle
SetFieldUnit( *m_xBitmapWidth, meFieldUnit, true );
SetFieldUnit( *m_xBitmapHeight, meFieldUnit, true );
+ m_xBitmapLB->SetStyle(WB_FLATVALUESET | WB_NO_DIRECTSELECT | WB_TABSTOP);
+
SfxViewShell* pViewShell = SfxViewShell::Current();
if( pViewShell )
mpView = pViewShell->GetDrawView();
@@ -258,7 +260,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
double fUIScale = 1.0;
if (mpView)
{
- fUIScale = ( mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
+ fUIScale = double(mpView->GetModel().GetUIScale());
if (mpView->AreObjectsMarked())
@@ -296,9 +298,9 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
CalculateBitmapPresetSize();
bool bTiled = false; bool bStretched = false;
- if(rAttrs->GetItemState( XATTR_FILLBMP_TILE ) != SfxItemState::DONTCARE)
+ if(rAttrs->GetItemState( XATTR_FILLBMP_TILE ) != SfxItemState::INVALID)
bTiled = rAttrs->Get( XATTR_FILLBMP_TILE ).GetValue();
- if(rAttrs->GetItemState( XATTR_FILLBMP_STRETCH ) != SfxItemState::DONTCARE)
+ if(rAttrs->GetItemState( XATTR_FILLBMP_STRETCH ) != SfxItemState::INVALID)
bStretched = rAttrs->Get( XATTR_FILLBMP_STRETCH ).GetValue();
if (bTiled)
@@ -311,42 +313,38 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
tools::Long nWidth = 0;
tools::Long nHeight = 0;
- if(rAttrs->GetItemState(XATTR_FILLBMP_SIZELOG) != SfxItemState::DONTCARE)
+ if(rAttrs->GetItemState(XATTR_FILLBMP_SIZELOG) != SfxItemState::INVALID)
{
if (rAttrs->Get( XATTR_FILLBMP_SIZELOG ).GetValue())
- {
m_xTsbScale->set_state(TRISTATE_FALSE);
- m_bLogicalSize = true;
- }
else
- {
m_xTsbScale->set_state(TRISTATE_TRUE);
- m_bLogicalSize = false;
- }
}
else
m_xTsbScale->set_state(TRISTATE_INDET);
TriState eRelative = TRISTATE_FALSE;
- if(rAttrs->GetItemState(XATTR_FILLBMP_SIZEX) != SfxItemState::DONTCARE)
+ if(rAttrs->GetItemState(XATTR_FILLBMP_SIZEX) != SfxItemState::INVALID)
{
nWidth = static_cast<const XFillBmpSizeXItem&>( rAttrs->Get( XATTR_FILLBMP_SIZEX ) ).GetValue();
if(nWidth == 0)
nWidth = rBitmapSize.Width();
else if(nWidth < 0)
{
+ m_bLogicalSize = true;
eRelative = TRISTATE_TRUE;
nWidth = std::abs(nWidth);
}
}
- if(rAttrs->GetItemState( XATTR_FILLBMP_SIZEY ) != SfxItemState::DONTCARE)
+ if(rAttrs->GetItemState( XATTR_FILLBMP_SIZEY ) != SfxItemState::INVALID)
{
nHeight = rAttrs->Get( XATTR_FILLBMP_SIZEY ).GetValue();
if(nHeight == 0)
nHeight = rBitmapSize.Height();
else if(nHeight < 0)
{
+ m_bLogicalSize = true;
eRelative = TRISTATE_TRUE;
nHeight = std::abs(nHeight);
}
@@ -369,13 +367,13 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
}
}
- if( rAttrs->GetItemState( XATTR_FILLBMP_POS ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_FILLBMP_POS ) != SfxItemState::INVALID )
{
RectPoint eValue = rAttrs->Get( XATTR_FILLBMP_POS ).GetValue();
m_xPositionLB->set_active( static_cast< sal_Int32 >(eValue) );
}
- if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SfxItemState::INVALID )
{
sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_POSOFFSETX ).GetValue();
m_xPositionOffX->set_value(nValue, FieldUnit::PERCENT);
@@ -383,7 +381,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
else
m_xPositionOffX->set_text("");
- if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SfxItemState::INVALID )
{
sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_POSOFFSETY ).GetValue();
m_xPositionOffY->set_value(nValue, FieldUnit::PERCENT);
@@ -391,7 +389,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
else
m_xPositionOffY->set_text("");
- if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SfxItemState::DONTCARE)
+ if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SfxItemState::INVALID)
{
sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_TILEOFFSETX ).GetValue();
if(nValue > 0)
@@ -401,7 +399,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
}
}
- if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SfxItemState::INVALID )
{
sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_TILEOFFSETY ).GetValue();
if(nValue > 0)
@@ -462,15 +460,14 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void)
}
else
{
- const SfxPoolItem* pPoolItem = nullptr;
-
- if(SfxItemState::SET == m_rOutAttrs.GetItemState(GetWhich(XATTR_FILLSTYLE), true, &pPoolItem))
+ if(const XFillStyleItem* pFillStyleItem = m_rOutAttrs.GetItemIfSet(GetWhich(XATTR_FILLSTYLE)))
{
- const drawing::FillStyle eXFS(static_cast<const XFillStyleItem*>(pPoolItem)->GetValue());
+ const drawing::FillStyle eXFS(pFillStyleItem->GetValue());
- if((drawing::FillStyle_BITMAP == eXFS) && (SfxItemState::SET == m_rOutAttrs.GetItemState(GetWhich(XATTR_FILLBITMAP), true, &pPoolItem)))
+ const XFillBitmapItem* pBitmapItem;
+ if((drawing::FillStyle_BITMAP == eXFS) && (pBitmapItem = m_rOutAttrs.GetItemIfSet(GetWhich(XATTR_FILLBITMAP))))
{
- pGraphicObject.reset(new GraphicObject(static_cast<const XFillBitmapItem*>(pPoolItem)->GetGraphicObject()));
+ pGraphicObject.reset(new GraphicObject(pBitmapItem->GetGraphicObject()));
}
}
@@ -490,10 +487,11 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void)
{
BitmapEx aBmpEx(pGraphicObject->GetGraphic().GetBitmapEx());
Size aTempBitmapSize = aBmpEx.GetSizePixel();
- const double fUIScale = ( (mpView && mpView->GetModel()) ? double(mpView->GetModel()->GetUIScale()) : 1.0);
+ const double fUIScale = mpView ? double(mpView->GetModel().GetUIScale()) : 1.0;
+ Size aBitmapSize100mm = o3tl::convert(aTempBitmapSize, o3tl::Length::pt, o3tl::Length::mm100);
- rBitmapSize.setWidth( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
- rBitmapSize.setHeight( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
+ rBitmapSize.setWidth(aBitmapSize100mm.Width() / fUIScale);
+ rBitmapSize.setHeight(aBitmapSize100mm.Height() / fUIScale);
CalculateBitmapPresetSize();
ModifyBitmapStyleHdl( *m_xBitmapStyleLB );
ModifyBitmapPositionHdl( *m_xPositionLB );
@@ -520,7 +518,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void)
if( nPos == VALUESET_ITEM_NOTFOUND )
return;
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_NEW_BITMAP ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_NEW_BITMAP ) );
OUString aName( m_pBitmapList->GetBitmap( nPos )->GetName() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
@@ -529,7 +527,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void)
bool bLoop = true;
while( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
sal_Int32 nBitmapPos = SearchBitmapList( aName );
bool bValidBitmapName = (nBitmapPos == static_cast<sal_Int32>(nPos) ) || (nBitmapPos == -1);
@@ -563,21 +561,21 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl, SvxPresetListBox*, void)
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui"));
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog"));
- if (xQueryBox->run() == RET_YES)
- {
- sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1);
- if (!nNextId)
- nNextId = m_xBitmapLB->GetItemId(nPos - 1);
+ if (xQueryBox->run() != RET_YES)
+ return;
- m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) );
- m_xBitmapLB->RemoveItem( nId );
+ sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1);
+ if (!nNextId)
+ nNextId = m_xBitmapLB->GetItemId(nPos - 1);
- m_xBitmapLB->SelectItem(nNextId);
+ m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) );
+ m_xBitmapLB->RemoveItem( nId );
- m_aCtlBitmapPreview.Invalidate();
- ModifyBitmapHdl(m_xBitmapLB.get());
- *m_pnBitmapListState |= ChangeType::MODIFIED;
- }
+ m_xBitmapLB->SelectItem(nNextId);
+
+ m_aCtlBitmapPreview.Invalidate();
+ ModifyBitmapHdl(m_xBitmapLB.get());
+ *m_pnBitmapListState |= ChangeType::MODIFIED;
}
IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&, void )
@@ -596,7 +594,7 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&,
m_aCtlBitmapPreview.Invalidate();
}
-IMPL_LINK_NOARG( SvxBitmapTabPage, ClickScaleHdl, weld::Button&, void )
+IMPL_LINK_NOARG( SvxBitmapTabPage, ClickScaleHdl, weld::Toggleable&, void )
{
if (m_xTsbScale->get_state() == TRISTATE_TRUE)
{
@@ -715,7 +713,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void)
{
weld::Window* pDialogFrameWeld = GetFrameWeld();
- SvxOpenGraphicDialog aDlg(CuiResId(RID_SVXSTR_ADD_IMAGE), pDialogFrameWeld);
+ SvxOpenGraphicDialog aDlg(CuiResId(RID_CUISTR_ADD_IMAGE), pDialogFrameWeld);
aDlg.EnableLink(false);
tools::Long nCount = m_pBitmapList->Count();
@@ -730,7 +728,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void)
if( !nError )
{
- OUString aDesc(CuiResId(RID_SVXSTR_DESC_EXT_BITMAP));
+ OUString aDesc(CuiResId(RID_CUISTR_DESC_EXT_BITMAP));
// convert file URL to UI name
OUString aName;
@@ -742,7 +740,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void)
while( pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bool bDifferent = true;
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index e6eadad2075b..ccfe75232bef 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -34,6 +34,10 @@
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
#include <officecfg/Office/Common.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/lok.hxx>
+#include <comphelper/propertyvalue.hxx>
using namespace com::sun::star;
@@ -45,7 +49,6 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController*
, aXFillAttr( rInAttrs.GetPool() )
, rXFSet( aXFillAttr.GetItemSet() )
, eCM( ColorModel::RGB )
- , m_context(comphelper::getProcessComponentContext())
, m_xValSetColorList(new SvxColorValueSet(m_xBuilder->weld_scrolled_window("colorsetwin", true)))
, m_xValSetRecentList(new SvxColorValueSet(nullptr))
, m_xSelectPalette(m_xBuilder->weld_combo_box("paletteselector"))
@@ -74,6 +77,7 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController*
, m_xBtnAdd(m_xBuilder->weld_button("add"))
, m_xBtnDelete(m_xBuilder->weld_button("delete"))
, m_xBtnWorkOn(m_xBuilder->weld_button("edit"))
+ , m_xMoreColors(m_xBuilder->weld_button("btnMoreColors"))
, m_xCtlPreviewOld(new weld::CustomWeld(*m_xBuilder, "oldpreview", m_aCtlPreviewOld))
, m_xCtlPreviewNew(new weld::CustomWeld(*m_xBuilder, "newpreview", m_aCtlPreviewNew))
, m_xValSetColorListWin(new weld::CustomWeld(*m_xBuilder, "colorset", *m_xValSetColorList))
@@ -113,7 +117,7 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController*
m_xMcustom->connect_value_changed(aMetricSpinLink);
m_xKcustom->connect_value_changed(aMetricSpinLink);
- Link<weld::ToggleButton&,void> aLink2 = LINK( this, SvxColorTabPage, SelectColorModeHdl_Impl );
+ Link<weld::Toggleable&,void> aLink2 = LINK( this, SvxColorTabPage, SelectColorModeHdl_Impl );
m_xRbRGB->connect_toggled(aLink2);
m_xRbCMYK->connect_toggled(aLink2);
SetColorModel( eCM );
@@ -125,22 +129,32 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController*
// disable modify buttons
// Color palettes can't be modified
m_xBtnDelete->set_sensitive(false);
- m_xBtnDelete->set_tooltip_text( SvxResId(RID_SVXSTR_DELETEUSERCOLOR1) );
+ m_xBtnDelete->set_tooltip_text( CuiResId(RID_CUISTR_DELETEUSERCOLOR1) );
+
+ m_xMoreColors->connect_clicked(LINK(this, SvxColorTabPage, OnMoreColorsClick));
// disable preset color values
m_xRGBpreset->set_sensitive(false);
m_xCMYKpreset->set_sensitive(false);
// ValueSet
- m_xValSetColorList->SetStyle(m_xValSetColorList->GetStyle() | WB_ITEMBORDER);
+ m_xValSetColorList->SetStyle(m_xValSetColorList->GetStyle() |
+ WB_FLATVALUESET | WB_ITEMBORDER | WB_NO_DIRECTSELECT | WB_TABSTOP);
m_xValSetColorList->Show();
- m_xValSetRecentList->SetStyle(m_xValSetRecentList->GetStyle() | WB_ITEMBORDER);
+ m_xValSetRecentList->SetStyle(m_xValSetRecentList->GetStyle() |
+ WB_FLATVALUESET | WB_ITEMBORDER | WB_NO_DIRECTSELECT | WB_TABSTOP);
m_xValSetRecentList->Show();
maPaletteManager.ReloadRecentColorSet(*m_xValSetRecentList);
aSize = m_xValSetRecentList->layoutAllVisible(maPaletteManager.GetRecentColorCount());
m_xValSetRecentList->set_size_request(aSize.Width(), aSize.Height());
+
+ // it is not possible to install color palette extensions in Online or mobile apps
+ if(comphelper::LibreOfficeKit::isActive())
+ {
+ m_xMoreColors->hide();
+ }
}
SvxColorTabPage::~SvxColorTabPage()
@@ -189,14 +203,15 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& )
if( !pColorList.is() )
return;
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), true, &pPoolItem ) )
+ if( const XFillColorItem* pFillColorItem = rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLCOLOR ) ) )
{
SetColorModel( ColorModel::RGB );
ChangeColorModel();
- const Color aColor = static_cast<const XFillColorItem*>(pPoolItem)->GetColorValue();
- ChangeColor( aColor );
+ const Color aColor = pFillColorItem->GetColorValue();
+ NamedColor aNamedColor;
+ aNamedColor.m_aColor = aColor;
+ ChangeColor(aNamedColor);
sal_Int32 nPos = FindInPalette( aColor );
if ( nPos != -1 )
@@ -223,13 +238,16 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet )
{
Color aColor = m_xValSetColorList->GetItemColor( m_xValSetColorList->GetSelectedItemId() );
OUString sColorName;
- if ( aCurrentColor == aColor )
+ if (m_aCurrentColor.m_aColor == aColor)
sColorName = m_xValSetColorList->GetItemText( m_xValSetColorList->GetSelectedItemId() );
else
- sColorName = "#" + aCurrentColor.AsRGBHexString().toAsciiUpperCase();
- maPaletteManager.AddRecentColor( aCurrentColor, sColorName );
- rSet->Put( XFillColorItem( sColorName, aCurrentColor ) );
- rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
+ sColorName = "#" + m_aCurrentColor.m_aColor.AsRGBHexString().toAsciiUpperCase();
+
+ maPaletteManager.AddRecentColor(m_aCurrentColor.m_aColor, sColorName);
+ XFillColorItem aColorItem(sColorName, m_aCurrentColor.m_aColor);
+ aColorItem.setComplexColor(m_aCurrentColor.getComplexColor());
+ rSet->Put(aColorItem);
+ rSet->Put(XFillStyleItem(drawing::FillStyle_SOLID));
return true;
}
@@ -248,7 +266,7 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet )
if ( nState >= SfxItemState::DEFAULT )
{
XFillColorItem aColorItem( rSet->Get( XATTR_FILLCOLOR ) );
- aPreviousColor = aColorItem.GetColorValue();
+ m_aPreviousColor = aColorItem.GetColorValue();
aNewColor = aColorItem.GetColorValue();
}
@@ -258,7 +276,9 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet )
SetColorModel( eCM );
ChangeColorModel();
- ChangeColor(aNewColor);
+ NamedColor aColor;
+ aColor.m_aColor = aNewColor;
+ ChangeColor(aColor);
UpdateModified();
}
@@ -272,12 +292,12 @@ std::unique_ptr<SfxTabPage> SvxColorTabPage::Create(weld::Container* pPage, weld
IMPL_LINK_NOARG(SvxColorTabPage, SpinValueHdl_Impl, weld::SpinButton&, void)
{
// read current MtrFields, if cmyk, then k-value as transparency
- aCurrentColor = Color(static_cast<sal_uInt8>(PercentToColor_Impl(m_xRcustom->get_value())),
+ m_aCurrentColor.m_aColor = Color(static_cast<sal_uInt8>(PercentToColor_Impl(m_xRcustom->get_value())),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xGcustom->get_value())),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xBcustom->get_value())));
UpdateColorValues();
- rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
+ rXFSet.Put( XFillColorItem( OUString(), m_aCurrentColor.m_aColor ) );
m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
m_aCtlPreviewNew.Invalidate();
@@ -286,13 +306,13 @@ IMPL_LINK_NOARG(SvxColorTabPage, SpinValueHdl_Impl, weld::SpinButton&, void)
IMPL_LINK_NOARG(SvxColorTabPage, MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void)
{
// read current MtrFields, if cmyk, then k-value as transparency
- aCurrentColor = Color(ColorTransparency, static_cast<sal_uInt8>(PercentToColor_Impl(m_xKcustom->get_value(FieldUnit::NONE))),
+ m_aCurrentColor.m_aColor = Color(ColorTransparency, static_cast<sal_uInt8>(PercentToColor_Impl(m_xKcustom->get_value(FieldUnit::NONE))),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xCcustom->get_value(FieldUnit::NONE))),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xYcustom->get_value(FieldUnit::NONE))),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xMcustom->get_value(FieldUnit::NONE))));
- ConvertColorValues (aCurrentColor, ColorModel::RGB);
+ ConvertColorValues (m_aCurrentColor.m_aColor, ColorModel::RGB);
- rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
+ rXFSet.Put( XFillColorItem( OUString(), m_aCurrentColor.m_aColor ) );
m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
m_aCtlPreviewNew.Invalidate();
@@ -300,10 +320,10 @@ IMPL_LINK_NOARG(SvxColorTabPage, MetricSpinValueHdl_Impl, weld::MetricSpinButton
IMPL_LINK_NOARG(SvxColorTabPage, ModifiedHdl_Impl, weld::Entry&, void)
{
- aCurrentColor = m_xHexcustom->GetColor();
+ m_aCurrentColor.m_aColor = m_xHexcustom->GetColor();
UpdateColorValues();
- rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
+ rXFSet.Put( XFillColorItem( OUString(), m_aCurrentColor.m_aColor ) );
m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
m_aCtlPreviewNew.Invalidate();
@@ -312,7 +332,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ModifiedHdl_Impl, weld::Entry&, void)
IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
OUString aNewName( SvxResId( RID_SVXSTR_COLOR ) );
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_COLOR ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_COLOR ) );
OUString aName;
tools::Long j = 1;
@@ -330,7 +350,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void)
while (pDlg->Execute() == RET_OK)
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bValidColorName = (FindInCustomColors(aName) == -1);
if (bValidColorName)
@@ -351,22 +371,22 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
m_xSelectPalette->set_active(0);
SelectPaletteLBHdl(*m_xSelectPalette);
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context));
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
css::uno::Sequence< sal_Int32 > aCustomColorList(officecfg::Office::Common::UserColors::CustomColor::get());
css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get());
sal_Int32 nSize = aCustomColorList.getLength();
aCustomColorList.realloc( nSize + 1 );
aCustomColorNameList.realloc( nSize + 1 );
- aCustomColorList[nSize] = sal_Int32(aCurrentColor);
- aCustomColorNameList[nSize] = aName;
+ aCustomColorList.getArray()[nSize] = sal_Int32(m_aCurrentColor.m_aColor);
+ aCustomColorNameList.getArray()[nSize] = aName;
officecfg::Office::Common::UserColors::CustomColor::set(aCustomColorList, batch);
officecfg::Office::Common::UserColors::CustomColorName::set(aCustomColorNameList, batch);
batch->commit();
sal_uInt16 nId = m_xValSetColorList->GetItemId(nSize - 1);
- m_xValSetColorList->InsertItem( nId + 1 , aCurrentColor, aName );
+ m_xValSetColorList->InsertItem( nId + 1 , m_aCurrentColor.m_aColor, aName );
m_xValSetColorList->SelectItem( nId + 1 );
m_xBtnDelete->set_sensitive(false);
- m_xBtnDelete->set_tooltip_text( SvxResId(RID_SVXSTR_DELETEUSERCOLOR2) );
+ m_xBtnDelete->set_tooltip_text( CuiResId(RID_CUISTR_DELETEUSERCOLOR2) );
ImpColorCountChanged();
}
@@ -377,13 +397,13 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, weld::Button&, void)
{
SvColorDialog aColorDlg;
- aColorDlg.SetColor (aCurrentColor);
+ aColorDlg.SetColor (m_aCurrentColor.m_aColor);
aColorDlg.SetMode( svtools::ColorPickerMode::Modify );
if (aColorDlg.Execute(GetFrameWeld()) == RET_OK)
{
Color aPreviewColor = aColorDlg.GetColor();
- aCurrentColor = aPreviewColor;
+ m_aCurrentColor.m_aColor = aPreviewColor;
UpdateColorValues( false );
// fill ItemSet and pass it on to XOut
rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) );
@@ -401,14 +421,16 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, weld::Button&, void)
if (m_xSelectPalette->get_active() != 0 || nPos == VALUESET_ITEM_NOTFOUND)
return;
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context));
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
css::uno::Sequence< sal_Int32 > aCustomColorList(officecfg::Office::Common::UserColors::CustomColor::get());
+ auto aCustomColorListRange = asNonConstRange(aCustomColorList);
css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get());
+ auto aCustomColorNameListRange = asNonConstRange(aCustomColorNameList);
sal_Int32 nSize = aCustomColorList.getLength() - 1;
for(sal_Int32 nIndex = static_cast<sal_Int32>(nPos);nIndex < nSize;nIndex++)
{
- aCustomColorList[nIndex] = aCustomColorList[nIndex+1];
- aCustomColorNameList[nIndex] = aCustomColorNameList[nIndex+1];
+ aCustomColorListRange[nIndex] = aCustomColorList[nIndex+1];
+ aCustomColorNameListRange[nIndex] = aCustomColorNameList[nIndex+1];
}
aCustomColorList.realloc(nSize);
aCustomColorNameList.realloc(nSize);
@@ -425,7 +447,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, weld::Button&, void)
else
{
m_xBtnDelete->set_sensitive(false);
- m_xBtnDelete->set_tooltip_text( SvxResId(RID_SVXSTR_DELETEUSERCOLOR2) );
+ m_xBtnDelete->set_tooltip_text( CuiResId(RID_CUISTR_DELETEUSERCOLOR2) );
}
}
@@ -461,7 +483,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, SelectPaletteLBHdl, weld::ComboBox&, void)
if (nPos != 0)
{
m_xBtnDelete->set_sensitive(false);
- m_xBtnDelete->set_tooltip_text( SvxResId(RID_SVXSTR_DELETEUSERCOLOR1) );
+ m_xBtnDelete->set_tooltip_text( CuiResId(RID_CUISTR_DELETEUSERCOLOR1) );
}
m_xValSetColorList->Resize();
@@ -478,7 +500,22 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void)
rXFSet.Put( XFillColorItem( OUString(), aColor ) );
m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() );
m_aCtlPreviewNew.Invalidate();
- ChangeColor(aColor, false);
+
+ NamedColor aNamedColor;
+ aNamedColor.m_aColor = aColor;
+
+ if (pValSet == m_xValSetColorList.get() && maPaletteManager.IsThemePaletteSelected())
+ {
+ sal_uInt16 nThemeIndex;
+ sal_uInt16 nEffectIndex;
+ if (PaletteManager::GetThemeAndEffectIndex(nPos, nThemeIndex, nEffectIndex))
+ {
+ aNamedColor.m_nThemeIndex = nThemeIndex;
+ maPaletteManager.GetLumModOff(nThemeIndex, nEffectIndex, aNamedColor.m_nLumMod, aNamedColor.m_nLumOff);
+ }
+ }
+
+ ChangeColor(aNamedColor, false);
if (pValSet == m_xValSetColorList.get())
{
@@ -491,14 +528,14 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void)
else
{
m_xBtnDelete->set_sensitive(false);
- m_xBtnDelete->set_tooltip_text( SvxResId(RID_SVXSTR_DELETEUSERCOLOR1) );
+ m_xBtnDelete->set_tooltip_text( CuiResId(RID_CUISTR_DELETEUSERCOLOR1) );
}
}
if (pValSet == m_xValSetRecentList.get())
{
m_xValSetColorList->SetNoSelection();
m_xBtnDelete->set_sensitive(false);
- m_xBtnDelete->set_tooltip_text( SvxResId(RID_SVXSTR_DELETEUSERCOLOR2) );
+ m_xBtnDelete->set_tooltip_text( CuiResId(RID_CUISTR_DELETEUSERCOLOR2) );
}
}
@@ -523,7 +560,7 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell)
}
}
-IMPL_LINK_NOARG(SvxColorTabPage, SelectColorModeHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxColorTabPage, SelectColorModeHdl_Impl, weld::Toggleable&, void)
{
if (m_xRbRGB->get_active())
eCM = ColorModel::RGB;
@@ -533,13 +570,24 @@ IMPL_LINK_NOARG(SvxColorTabPage, SelectColorModeHdl_Impl, weld::ToggleButton&, v
UpdateColorValues();
}
-void SvxColorTabPage::ChangeColor(const Color &rNewColor, bool bUpdatePreset )
+
+IMPL_STATIC_LINK_NOARG(SvxColorTabPage, OnMoreColorsClick, weld::Button&, void)
+{
+ css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue(
+ "AdditionsTag", OUString("Color Palette")) };
+ comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs);
+}
+
+void SvxColorTabPage::ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset )
{
- aPreviousColor = rNewColor;
- aCurrentColor = rNewColor;
+ m_aPreviousColor = rNewColor.m_aColor;
+ m_aCurrentColor = rNewColor;
UpdateColorValues( bUpdatePreset );
// fill ItemSet and pass it on to XOut
- rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
+ XFillColorItem aItem(OUString(), m_aCurrentColor.m_aColor);
+ aItem.setComplexColor(m_aCurrentColor.getComplexColor());
+ rXFSet.Put(aItem);
+
m_aCtlPreviewNew.SetAttributes(aXFillAttr.GetItemSet());
m_aCtlPreviewNew.Invalidate();
}
@@ -580,42 +628,42 @@ void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset )
{
if (eCM != ColorModel::RGB)
{
- ConvertColorValues (aPreviousColor, eCM );
- ConvertColorValues (aCurrentColor, eCM);
+ ConvertColorValues (m_aPreviousColor, eCM );
+ ConvertColorValues (m_aCurrentColor.m_aColor, eCM);
- m_xCcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetRed() ), FieldUnit::PERCENT );
- m_xMcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetBlue() ), FieldUnit::PERCENT );
- m_xYcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetGreen() ), FieldUnit::PERCENT );
- m_xKcustom->set_value( ColorToPercent_Impl( 255 - aCurrentColor.GetAlpha() ), FieldUnit::PERCENT );
+ m_xCcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetRed() ), FieldUnit::PERCENT );
+ m_xMcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetBlue() ), FieldUnit::PERCENT );
+ m_xYcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetGreen() ), FieldUnit::PERCENT );
+ m_xKcustom->set_value( ColorToPercent_Impl( 255 - m_aCurrentColor.m_aColor.GetAlpha() ), FieldUnit::PERCENT );
if( bUpdatePreset )
{
- m_xCpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetRed()),
+ m_xCpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(m_aPreviousColor.GetRed()),
Application::GetSettings().GetUILanguageTag()));
- m_xMpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetBlue()),
+ m_xMpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(m_aPreviousColor.GetBlue()),
Application::GetSettings().GetUILanguageTag()));
- m_xYpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetGreen()),
+ m_xYpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(m_aPreviousColor.GetGreen()),
Application::GetSettings().GetUILanguageTag()));
- m_xKpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(255 - aPreviousColor.GetAlpha()),
+ m_xKpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(255 - m_aPreviousColor.GetAlpha()),
Application::GetSettings().GetUILanguageTag()));
}
- ConvertColorValues (aPreviousColor, ColorModel::RGB);
- ConvertColorValues (aCurrentColor, ColorModel::RGB);
+ ConvertColorValues (m_aPreviousColor, ColorModel::RGB);
+ ConvertColorValues (m_aCurrentColor.m_aColor, ColorModel::RGB);
}
else
{
- m_xRcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetRed() ) );
- m_xGcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
- m_xBcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetBlue() ) );
- m_xHexcustom->SetColor( aCurrentColor );
+ m_xRcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetRed() ) );
+ m_xGcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetGreen() ) );
+ m_xBcustom->set_value( ColorToPercent_Impl( m_aCurrentColor.m_aColor.GetBlue() ) );
+ m_xHexcustom->SetColor( m_aCurrentColor.m_aColor );
if( bUpdatePreset )
{
- m_xRpreset->set_text(OUString::number(ColorToPercent_Impl(aPreviousColor.GetRed())));
- m_xGpreset->set_text(OUString::number(ColorToPercent_Impl(aPreviousColor.GetGreen())));
- m_xBpreset->set_text(OUString::number(ColorToPercent_Impl(aPreviousColor.GetBlue())));
- m_xHexpreset->SetColor( aPreviousColor );
+ m_xRpreset->set_text(OUString::number(ColorToPercent_Impl(m_aPreviousColor.GetRed())));
+ m_xGpreset->set_text(OUString::number(ColorToPercent_Impl(m_aPreviousColor.GetGreen())));
+ m_xBpreset->set_text(OUString::number(ColorToPercent_Impl(m_aPreviousColor.GetBlue())));
+ m_xHexpreset->SetColor( m_aPreviousColor );
}
}
}
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 573659a471aa..2fb57742e0b3 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -34,10 +34,9 @@
#include <dialmgr.hxx>
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
+#include <basegfx/utils/gradienttools.hxx>
#include <sal/log.hxx>
-#define DEFAULT_GRADIENTSTEP 64
-
using namespace com::sun::star;
SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
@@ -56,9 +55,11 @@ SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogContr
, m_xSliderAngle(m_xBuilder->weld_scale("angleslider"))
, m_xMtrBorder(m_xBuilder->weld_metric_spin_button("bordermtr", FieldUnit::PERCENT))
, m_xSliderBorder(m_xBuilder->weld_scale("borderslider"))
- , m_xLbColorFrom(new ColorListBox(m_xBuilder->weld_menu_button("colorfromlb"), pController->getDialog()))
+ , m_xLbColorFrom(new ColorListBox(m_xBuilder->weld_menu_button("colorfromlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xMtrColorFrom(m_xBuilder->weld_metric_spin_button("colorfrommtr", FieldUnit::PERCENT))
- , m_xLbColorTo(new ColorListBox(m_xBuilder->weld_menu_button("colortolb"), pController->getDialog()))
+ , m_xLbColorTo(new ColorListBox(m_xBuilder->weld_menu_button("colortolb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xMtrColorTo(m_xBuilder->weld_metric_spin_button("colortomtr", FieldUnit::PERCENT))
, m_xGradientLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("gradientpresetlistwin", true)))
, m_xMtrIncrement(m_xBuilder->weld_spin_button("incrementmtr"))
@@ -81,7 +82,7 @@ SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogContr
// setting the output device
m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_GRADIENT) );
- m_rXFSet.Put( XFillGradientItem(OUString(), XGradient( COL_BLACK, COL_WHITE )) );
+ m_rXFSet.Put( XFillGradientItem(OUString(), basegfx::BGradient()));
m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet());
// set handler
@@ -108,6 +109,8 @@ SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogContr
m_xMtrColorTo->connect_value_changed( aLink );
m_xLbColorTo->SetSelectHdl( aLink3 );
+ m_xGradientLB->SetStyle(WB_FLATVALUESET | WB_NO_DIRECTSELECT | WB_TABSTOP);
+
// #i76307# always paint the preview in LTR, because this is what the document does
m_aCtlPreview.EnableRTL(false);
}
@@ -145,7 +148,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet )
// determining (and possibly cutting) the name and
// displaying it in the GroupBox
- OUString aString = CuiResId( RID_SVXSTR_TABLE ) + ": ";
+ OUString aString = CuiResId( RID_CUISTR_TABLE ) + ": ";
INetURLObject aURL( m_pGradientList->GetPath() );
aURL.Append( m_pGradientList->GetName() );
@@ -179,19 +182,26 @@ DeactivateRC SvxGradientTabPage::DeactivatePage( SfxItemSet* _pSet )
bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
{
- std::unique_ptr<XGradient> pXGradient;
+ std::unique_ptr<basegfx::BGradient> pBGradient;
size_t nPos = m_xGradientLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_xGradientLB->GetSelectItemPos();
+
+ sal_uInt16 nValue = 0; // automatic step count
+ if (!m_xCbIncrement->get_active())
+ nValue = m_xMtrIncrement->get_value();
+
if( nPos != VALUESET_ITEM_NOTFOUND )
{
- pXGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() ));
+ pBGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() ));
OUString aString = m_xGradientLB->GetItemText( m_xGradientLB->GetSelectedItemId() );
- rSet->Put( XFillGradientItem( aString, *pXGradient ) );
+ // update StepCount to current value to be in sync with FillGradientStepCount
+ pBGradient->SetSteps(nValue);
+ rSet->Put( XFillGradientItem( aString, *pBGradient ) );
}
else
// gradient was passed (unidentified)
{
- pXGradient.reset(new XGradient( m_xLbColorFrom->GetSelectEntryColor(),
- m_xLbColorTo->GetSelectEntryColor(),
+ pBGradient.reset(new basegfx::BGradient(
+ createColorStops(),
static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()),
Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource
static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)),
@@ -199,15 +209,11 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)),
- static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) ));
- rSet->Put( XFillGradientItem( OUString(), *pXGradient ) );
+ nValue));
+ rSet->Put( XFillGradientItem( OUString(), *pBGradient ) );
}
- sal_uInt16 nValue = 0;
- if (!m_xCbIncrement->get_active())
- nValue = m_xMtrIncrement->get_value();
-
- assert( pXGradient && "XGradient could not be created" );
+ assert( pBGradient && "basegfx::BGradient could not be created" );
rSet->Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
rSet->Put( XGradientStepCountItem( nValue ) );
return true;
@@ -215,8 +221,7 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
void SvxGradientTabPage::Reset( const SfxItemSet* )
{
- m_xMtrIncrement->set_value(DEFAULT_GRADIENTSTEP);
- ChangeGradientHdl_Impl();
+ ChangeGradientHdl_Impl(); // includes setting m_xCbIncrement and m_xMtrIncrement
// determine state of the buttons
if( m_pGradientList->Count() )
@@ -262,7 +267,7 @@ IMPL_LINK( SvxGradientTabPage, ModifiedSliderHdl_Impl, weld::Scale&, rSlider, vo
m_xGradientLB->SetNoSelection();
}
-IMPL_LINK_NOARG( SvxGradientTabPage, ChangeAutoStepHdl_Impl, weld::ToggleButton&, void )
+IMPL_LINK_NOARG( SvxGradientTabPage, ChangeAutoStepHdl_Impl, weld::Toggleable&, void )
{
if (m_xCbIncrement->get_active())
{
@@ -288,8 +293,12 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl )
css::awt::GradientStyle eXGS = static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active());
- XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(),
- m_xLbColorTo->GetSelectEntryColor(),
+ sal_uInt16 nValue = 0; // automatic
+ if (!m_xCbIncrement->get_active())
+ nValue = static_cast<sal_uInt16>(m_xMtrIncrement->get_value());
+
+ basegfx::BGradient aBGradient(
+ createColorStops(),
eXGS,
Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource
static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)),
@@ -297,19 +306,16 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl )
static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)),
- static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) );
+ nValue);
// enable/disable controls
if (pControl == m_xLbGradientType.get() || pControl == this)
SetControlState_Impl( eXGS );
- sal_uInt16 nValue = 0;
- if (!m_xCbIncrement->get_active())
- nValue = static_cast<sal_uInt16>(m_xMtrIncrement->get_value());
m_rXFSet.Put( XGradientStepCountItem( nValue ) );
// displaying in XOutDev
- m_rXFSet.Put( XFillGradientItem( OUString(), aXGradient ) );
+ m_rXFSet.Put( XFillGradientItem( OUString(), aBGradient ) );
m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet());
m_aCtlPreview.Invalidate();
}
@@ -317,7 +323,7 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl )
IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
OUString aNewName( SvxResId( RID_SVXSTR_GRADIENT ) );
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_GRADIENT ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_GRADIENT ) );
OUString aName;
tools::Long nCount = m_pGradientList->Count();
@@ -336,7 +342,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void)
while (pDlg->Execute() == RET_OK)
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bValidGradientName = (SearchGradientList(aName) == -1);
@@ -355,8 +361,11 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void)
if( !nError )
{
- XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(),
- m_xLbColorTo->GetSelectEntryColor(),
+ sal_uInt16 nValue = 0; // automatic step count
+ if (!m_xCbIncrement->get_active())
+ nValue = m_xMtrIncrement->get_value();
+ basegfx::BGradient aBGradient(
+ createColorStops(),
static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()),
Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource
static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)),
@@ -364,9 +373,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void)
static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)),
- static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) );
+ nValue);
- m_pGradientList->Insert(std::make_unique<XGradientEntry>(aXGradient, aName), nCount);
+ m_pGradientList->Insert(std::make_unique<XGradientEntry>(aBGradient, aName), nCount);
sal_Int32 nId = m_xGradientLB->GetItemId(nCount - 1); //calculate the last ID
BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( nCount, m_xGradientLB->GetIconSize() );
@@ -395,8 +404,12 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void)
OUString aName( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetName() );
- XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(),
- m_xLbColorTo->GetSelectEntryColor(),
+ sal_uInt16 nValue = 0; // automatic step count
+ if (!m_xCbIncrement->get_active())
+ nValue = m_xMtrIncrement->get_value();
+
+ basegfx::BGradient aBGradient(
+ createColorStops(),
static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()),
Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource
static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)),
@@ -404,9 +417,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void)
static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FieldUnit::NONE)),
static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)),
- static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) );
+ nValue);
- m_pGradientList->Replace(std::make_unique<XGradientEntry>(aXGradient, aName), nPos);
+ m_pGradientList->Replace(std::make_unique<XGradientEntry>(aBGradient, aName), nPos);
BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_xGradientLB->GetIconSize() );
m_xGradientLB->RemoveItem( nId );
@@ -453,7 +466,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void
if ( nPos == VALUESET_ITEM_NOTFOUND )
return;
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_GRADIENT ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_GRADIENT ) );
OUString aName( m_pGradientList->GetGradient( nPos )->GetName() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
@@ -462,7 +475,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void
bool bLoop = true;
while( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
sal_Int32 nGradientPos = SearchGradientList(aName);
bool bValidGradientName = (nGradientPos == static_cast<sal_Int32>(nPos) ) || (nGradientPos == -1);
@@ -492,20 +505,20 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ChangeGradientHdl, ValueSet*, void)
void SvxGradientTabPage::ChangeGradientHdl_Impl()
{
- std::unique_ptr<XGradient> pGradient;
+ std::unique_ptr<basegfx::BGradient> pGradient;
size_t nPos = m_xGradientLB->GetSelectItemPos();
if( nPos != VALUESET_ITEM_NOTFOUND )
- pGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>( nPos ) )->GetGradient() ));
+ pGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>( nPos ) )->GetGradient() ));
else
{
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == m_rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), true, &pPoolItem ) )
+ if( const XFillStyleItem* pFillStyleItem = m_rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLSTYLE ) ) )
{
- if( ( drawing::FillStyle_GRADIENT == static_cast<const XFillStyleItem*>( pPoolItem )->GetValue() ) &&
- ( SfxItemState::SET == m_rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), true, &pPoolItem ) ) )
+ const XFillGradientItem* pGradientItem;
+ if( ( drawing::FillStyle_GRADIENT == pFillStyleItem->GetValue() ) &&
+ ( pGradientItem = m_rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLGRADIENT ) ) ) )
{
- pGradient.reset(new XGradient( static_cast<const XFillGradientItem*>( pPoolItem )->GetGradientValue() ));
+ pGradient.reset(new basegfx::BGradient( pGradientItem->GetGradientValue() ));
}
}
if( !pGradient )
@@ -513,7 +526,7 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl()
sal_uInt16 nPosition = m_xGradientLB->GetItemId(0);
m_xGradientLB->SelectItem( nPosition );
if( nPosition != 0 )
- pGradient.reset(new XGradient( m_pGradientList->GetGradient( 0 )->GetGradient() ));
+ pGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( 0 )->GetGradient() ));
}
}
@@ -522,6 +535,10 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl()
css::awt::GradientStyle eXGS = pGradient->GetGradientStyle();
sal_uInt16 nValue = pGradient->GetSteps();
+ if (const XGradientStepCountItem* pGradientStepCountItem = m_rOutAttrs.GetItemIfSet(GetWhich(XATTR_GRADIENTSTEPCOUNT)))
+ {
+ nValue = pGradientStepCountItem->GetValue();
+ }
if( nValue == 0 )
{
m_xCbIncrement->set_state(TRISTATE_TRUE);
@@ -538,10 +555,17 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl()
// if the entry is not in the listbox,
// colors are added temporarily
m_xLbColorFrom->SetNoSelection();
- m_xLbColorFrom->SelectEntry( pGradient->GetStartColor() );
+ m_xLbColorFrom->SelectEntry(Color(pGradient->GetColorStops().front().getStopColor()));
m_xLbColorTo->SetNoSelection();
- m_xLbColorTo->SelectEntry( pGradient->GetEndColor() );
+ m_xLbColorTo->SelectEntry(Color(pGradient->GetColorStops().back().getStopColor()));
+
+ // MCGR: preserve ColorStops if given.
+ // tdf#155901 We need offset of first and last stop, so include them.
+ if (pGradient->GetColorStops().size() >= 2)
+ m_aColorStops = pGradient->GetColorStops();
+ else
+ m_aColorStops.clear();
m_xMtrAngle->set_value(pGradient->GetAngle().get() / 10, FieldUnit::NONE); // should be changed in resource
m_xSliderAngle->set_value(pGradient->GetAngle().get() / 10);
@@ -626,4 +650,25 @@ sal_Int32 SvxGradientTabPage::SearchGradientList(std::u16string_view rGradientNa
return nPos;
}
+basegfx::BColorStops SvxGradientTabPage::createColorStops()
+{
+ basegfx::BColorStops aColorStops;
+
+ if(m_aColorStops.size() >= 2)
+ {
+ aColorStops = m_aColorStops;
+ aColorStops.front() = basegfx::BColorStop(m_aColorStops.front().getStopOffset(),
+ m_xLbColorFrom->GetSelectEntryColor().getBColor());
+ aColorStops.back() = basegfx::BColorStop(m_aColorStops.back().getStopOffset(),
+ m_xLbColorTo->GetSelectEntryColor().getBColor());
+ }
+ else
+ {
+ aColorStops.emplace_back(0.0, m_xLbColorFrom->GetSelectEntryColor().getBColor());
+ aColorStops.emplace_back(1.0, m_xLbColorTo->GetSelectEntryColor().getBColor());
+ }
+
+ return aColorStops;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index ec391dba935d..ccfc12a7b445 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -54,9 +54,11 @@ SvxHatchTabPage::SvxHatchTabPage(weld::Container* pPage, weld::DialogController*
, m_xMtrAngle(m_xBuilder->weld_metric_spin_button("anglemtr", FieldUnit::DEGREE))
, m_xSliderAngle(m_xBuilder->weld_scale("angleslider"))
, m_xLbLineType(m_xBuilder->weld_combo_box("linetypelb"))
- , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"), pController->getDialog()))
+ , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xCbBackgroundColor(m_xBuilder->weld_check_button("backgroundcolor"))
- , m_xLbBackgroundColor(new ColorListBox(m_xBuilder->weld_menu_button("backgroundcolorlb"), pController->getDialog()))
+ , m_xLbBackgroundColor(new ColorListBox(m_xBuilder->weld_menu_button("backgroundcolorlb"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xHatchLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("hatchpresetlistwin", true)))
, m_xBtnAdd(m_xBuilder->weld_button("add"))
, m_xBtnModify(m_xBuilder->weld_button("modify"))
@@ -110,6 +112,8 @@ SvxHatchTabPage::SvxHatchTabPage(weld::Container* pPage, weld::DialogController*
m_xBtnAdd->connect_clicked( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) );
m_xBtnModify->connect_clicked( LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) );
+ m_xHatchLB->SetStyle(WB_FLATVALUESET | WB_NO_DIRECTSELECT | WB_TABSTOP);
+
m_aCtlPreview.SetDrawMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
}
@@ -145,7 +149,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet )
// determining (possibly cutting) the name
// and displaying it in the GroupBox
- OUString aString = CuiResId( RID_SVXSTR_TABLE ) + ": ";
+ OUString aString = CuiResId( RID_CUISTR_TABLE ) + ": ";
INetURLObject aURL( m_pHatchingList->GetPath() );
aURL.Append( m_pHatchingList->GetName() );
@@ -241,7 +245,7 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xCbBackgroundColor->get_active())
{
NamedColor aColor = m_xLbBackgroundColor->GetSelectedEntry();
- rSet->Put(XFillColorItem(aColor.second, aColor.first));
+ rSet->Put(XFillColorItem(aColor.m_aName, aColor.m_aColor));
}
return true;
}
@@ -284,7 +288,7 @@ IMPL_LINK( SvxHatchTabPage, ModifiedColorListBoxHdl_Impl, ColorListBox&, rListBo
m_xHatchLB->SetNoSelection();
}
-IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, weld::ToggleButton&, void )
+IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, weld::Toggleable&, void )
{
if (m_xCbBackgroundColor->get_active())
m_xLbBackgroundColor->set_sensitive(true);
@@ -354,13 +358,13 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl()
pHatch.reset(new XHatch( m_pHatchingList->GetHatch( static_cast<sal_uInt16>(nPos) )->GetHatch() ));
else
{
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == m_rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), true, &pPoolItem ) )
+ if( const XFillStyleItem* pFillStyleItem = m_rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLSTYLE ) ) )
{
- if( ( drawing::FillStyle_HATCH == static_cast<const XFillStyleItem*>( pPoolItem )->GetValue() ) &&
- ( SfxItemState::SET == m_rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), true, &pPoolItem ) ) )
+ const XFillHatchItem* pFillHatchItem;
+ if( ( drawing::FillStyle_HATCH == pFillStyleItem->GetValue() ) &&
+ ( pFillHatchItem = m_rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLHATCH ) ) ) )
{
- pHatch.reset(new XHatch( static_cast<const XFillHatchItem*>( pPoolItem )->GetHatchValue() ));
+ pHatch.reset(new XHatch( pFillHatchItem->GetHatchValue() ));
}
}
if( !pHatch )
@@ -399,7 +403,7 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl()
IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
OUString aNewName( SvxResId( RID_SVXSTR_HATCH ) );
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_HATCH ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_HATCH ) );
OUString aName;
tools::Long nCount = m_pHatchingList->Count();
@@ -418,7 +422,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void)
while( pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bValidHatchName = (SearchHatchList(aName) == -1);
if( bValidHatchName )
@@ -522,7 +526,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void )
if( nPos == VALUESET_ITEM_NOTFOUND )
return;
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_HATCH ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_HATCH ) );
OUString aName( m_pHatchingList->GetHatch( nPos )->GetName() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
@@ -531,7 +535,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void )
bool bLoop = true;
while( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
sal_Int32 nHatchPos = SearchHatchList( aName );
bool bValidHatchName = (nHatchPos == static_cast<sal_Int32>(nPos) ) || (nHatchPos == -1);
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index aba1fafc6735..1c1635293823 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -71,21 +71,16 @@ using namespace com::sun::star;
// static ----------------------------------------------------------------
-const sal_uInt16 SvxLineTabPage::pLineRanges[] =
-{
- XATTR_LINETRANSPARENCE,
- XATTR_LINETRANSPARENCE,
- SID_ATTR_LINE_STYLE,
- SID_ATTR_LINE_ENDCENTER,
- 0
-};
+const WhichRangesContainer SvxLineTabPage::pLineRanges(svl::Items<
+ XATTR_LINETRANSPARENCE, XATTR_LINETRANSPARENCE,
+ SID_ATTR_LINE_STYLE, SID_ATTR_LINE_ENDCENTER
+>);
SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
: SfxTabPage(pPage, pController, "cui/ui/linetabpage.ui", "LineTabPage", &rInAttrs)
, m_pSymbolList(nullptr)
, m_bNewSize(false)
, m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN) // unknown respectively unchanged
- , m_pSymbolAttr(nullptr)
, m_bLastWidthModified(false)
, m_aSymbolLastSize(Size(0,0))
, m_bSymbols(false)
@@ -102,7 +97,8 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* p
, m_pPosLineEndLb(nullptr)
, m_xBoxColor(m_xBuilder->weld_widget("boxCOLOR"))
, m_xLbLineStyle(new SvxLineLB(m_xBuilder->weld_combo_box("LB_LINE_STYLE")))
- , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"), pController->getDialog()))
+ , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xBoxWidth(m_xBuilder->weld_widget("boxWIDTH"))
, m_xMtrLineWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_WIDTH", FieldUnit::CM))
, m_xBoxTransparency(m_xBuilder->weld_widget("boxTRANSPARENCY"))
@@ -173,8 +169,8 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* p
m_xLbEndStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeEndListBoxHdl_Impl));
m_xMtrStartWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangeStartModifyHdl_Impl));
m_xMtrEndWidth->connect_value_changed(LINK( this, SvxLineTabPage, ChangeEndModifyHdl_Impl));
- m_xTsbCenterStart->connect_clicked(LINK(this, SvxLineTabPage, ChangeStartClickHdl_Impl));
- m_xTsbCenterEnd->connect_clicked(LINK(this, SvxLineTabPage, ChangeEndClickHdl_Impl));
+ m_xTsbCenterStart->connect_toggled(LINK(this, SvxLineTabPage, ChangeStartClickHdl_Impl));
+ m_xTsbCenterEnd->connect_toggled(LINK(this, SvxLineTabPage, ChangeEndClickHdl_Impl));
Link<weld::ComboBox&,void> aEdgeStyle = LINK(this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl);
m_xLBEdgeStyle->connect_changed(aEdgeStyle);
@@ -246,7 +242,7 @@ void SvxLineTabPage::FillListboxes()
void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
{
- const CntUInt16Item* pPageTypeItem = rSet.GetItem<CntUInt16Item>(SID_PAGE_TYPE, false);
+ const SfxUInt16Item* pPageTypeItem = rSet.GetItem<SfxUInt16Item>(SID_PAGE_TYPE, false);
if (pPageTypeItem)
SetPageType(static_cast<PageType>(pPageTypeItem->GetValue()));
if( m_nDlgType == 0 && m_pDashList.is() )
@@ -417,7 +413,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
pOld = GetOldItem( *rAttrs, XATTR_LINESTYLE );
if ( !pOld || !( *static_cast<const XLineStyleItem*>(pOld) == *pStyleItem ) )
{
- rAttrs->Put( *pStyleItem );
+ rAttrs->Put( std::move(pStyleItem) );
bModified = true;
}
}
@@ -460,8 +456,10 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
// Line color
if (m_xLbColor->IsValueChangedFromSaved())
{
- NamedColor aColor = m_xLbColor->GetSelectedEntry();
- XLineColorItem aItem(aColor.second, aColor.first);
+ NamedColor aNamedColor = m_xLbColor->GetSelectedEntry();
+ XLineColorItem aItem(aNamedColor.m_aName, aNamedColor.m_aColor);
+ aItem.setComplexColor(aNamedColor.getComplexColor());
+
pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR );
if ( !pOld || !( *static_cast<const XLineColorItem*>(pOld) == aItem ) )
{
@@ -484,7 +482,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
pOld = GetOldItem( *rAttrs, XATTR_LINESTART );
if( pItem && ( !pOld || *pOld != *pItem ) )
{
- rAttrs->Put( *pItem );
+ rAttrs->Put( std::move(pItem) );
bModified = true;
}
}
@@ -501,7 +499,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
if( pItem &&
( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) )
{
- rAttrs->Put( *pItem );
+ rAttrs->Put( std::move(pItem) );
bModified = true;
}
}
@@ -579,7 +577,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
if(!pOld || !(*static_cast<const XLineJointItem*>(pOld) == *pNew))
{
- rAttrs->Put( *pNew );
+ rAttrs->Put( std::move(pNew) );
bModified = true;
}
}
@@ -616,7 +614,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
if(!pOld || !(*static_cast<const XLineCapItem*>(pOld) == *pNew))
{
- rAttrs->Put( *pNew );
+ rAttrs->Put( std::move(pNew) );
bModified = true;
}
}
@@ -625,8 +623,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
if(m_nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || m_bNewSize)
{
// Was set by selection or the size is different
- SvxSizeItem aSItem(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),m_aSymbolSize);
- const SfxPoolItem* pSOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
+ SvxSizeItem aSItem(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLSIZE),m_aSymbolSize);
+ const SfxPoolItem* pSOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLSIZE) );
m_bNewSize = pSOld ? *static_cast<const SvxSizeItem *>(pSOld) != aSItem : m_bNewSize ;
if(m_bNewSize)
{
@@ -634,8 +632,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
bModified=true;
}
- SfxInt32Item aTItem(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),m_nSymbolType);
- const SfxPoolItem* pTOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
+ SfxInt32Item aTItem(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLTYPE),m_nSymbolType);
+ const SfxPoolItem* pTOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLTYPE) );
bool bNewType = pTOld == nullptr || *static_cast<const SfxInt32Item*>(pTOld) != aTItem;
if(bNewType && m_nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
bNewType=false; // a small fix, type wasn't set -> don't create a type item after all!
@@ -647,8 +645,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
if(m_nSymbolType!=SVX_SYMBOLTYPE_NONE)
{
- SvxBrushItem aBItem(m_aSymbolGraphic,GPOS_MM,rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH));
- const SfxPoolItem* pBOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH) );
+ SvxBrushItem aBItem(m_aSymbolGraphic,GPOS_MM,rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH));
+ const SfxPoolItem* pBOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH) );
bool bNewBrush =
pBOld == nullptr || *static_cast<const SvxBrushItem*>(pBOld) != aBItem;
if(bNewBrush)
@@ -762,8 +760,10 @@ void SvxLineTabPage::FillXLSet_Impl()
m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ) );
m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ) );
- NamedColor aColor = m_xLbColor->GetSelectedEntry();
- m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first));
+ NamedColor aNamedColor = m_xLbColor->GetSelectedEntry();
+ XLineColorItem aLineColor(aNamedColor.m_aName, aNamedColor.m_aColor);
+ aLineColor.setComplexColor(aNamedColor.getComplexColor());
+ m_rXLSet.Put(aLineColor);
// Centered line end
if( m_xTsbCenterStart->get_state() == TRISTATE_TRUE )
@@ -789,15 +789,14 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
drawing::LineStyle eXLS; // drawing::LineStyle_NONE, drawing::LineStyle_SOLID, drawing::LineStyle_DASH
// Line style
- const SfxPoolItem *pPoolItem;
tools::Long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
bool bPrevSym=false;
bool bEnable=true;
bool bIgnoreGraphic=false;
bool bIgnoreSize=false;
- if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),true,&pPoolItem) == SfxItemState::SET)
+ if(const SfxInt32Item* pSymbolTypeItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLTYPE)))
{
- nSymType=static_cast<const SfxInt32Item *>(pPoolItem)->GetValue();
+ nSymType = pSymbolTypeItem->GetValue();
}
if(nSymType == SVX_SYMBOLTYPE_AUTO)
@@ -819,50 +818,49 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
std::unique_ptr<SdrModel> pModel(
new SdrModel(nullptr, nullptr, true));
- pModel->GetItemPool().FreezeIdRanges();
- SdrPage* pPage = new SdrPage( *pModel, false );
+ rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
pPage->SetSize(Size(1000,1000));
- pModel->InsertPage( pPage, 0 );
+ pModel->InsertPage( pPage.get(), 0 );
{
- std::unique_ptr<SdrView> pView(new SdrView( *pModel, pVDev ));
- pView->hideMarkHandles();
- pView->ShowSdrPage(pPage);
+ SdrView aView( *pModel, pVDev );
+ aView.hideMarkHandles();
+ aView.ShowSdrPage(pPage.get());
size_t nSymTmp = static_cast<size_t>(nSymType);
if(m_pSymbolList)
{
if(m_pSymbolList->GetObjCount())
{
nSymTmp %= m_pSymbolList->GetObjCount(); // Treat list as cyclic!
- SdrObject *pObj=m_pSymbolList->GetObj(nSymTmp);
+ rtl::Reference<SdrObject> pObj=m_pSymbolList->GetObj(nSymTmp);
if(pObj)
{
// directly clone to target SdrModel
pObj = pObj->CloneSdrObject(*pModel);
- if(m_pSymbolAttr)
+ if(m_xSymbolAttr)
{
- pObj->SetMergedItemSet(*m_pSymbolAttr);
+ pObj->SetMergedItemSet(*m_xSymbolAttr);
}
else
{
pObj->SetMergedItemSet(m_rOutAttrs);
}
- pPage->NbcInsertObject(pObj);
+ pPage->NbcInsertObject(pObj.get());
// Generate invisible square to give all symbol types a
// bitmap size, which is independent from specific glyph
- SdrObject* pInvisibleSquare(m_pSymbolList->GetObj(0));
+ rtl::Reference<SdrObject> pInvisibleSquare(m_pSymbolList->GetObj(0));
// directly clone to target SdrModel
pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel);
- pPage->NbcInsertObject(pInvisibleSquare);
+ pPage->NbcInsertObject(pInvisibleSquare.get());
pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
- pView->MarkAll();
- GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
+ aView.MarkAll();
+ GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
m_aSymbolGraphic=Graphic(aMeta);
m_aSymbolSize=pObj->GetSnapRect().GetSize();
@@ -872,19 +870,19 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
bEnable=true;
bIgnoreGraphic=true;
- pView->UnmarkAll();
- pInvisibleSquare=pPage->RemoveObject(1);
- SdrObject::Free( pInvisibleSquare);
- pObj=pPage->RemoveObject(0);
- SdrObject::Free( pObj );
+ aView.UnmarkAll();
+ pPage->RemoveObject(1);
+ pInvisibleSquare.clear();
+ pPage->RemoveObject(0);
+ pObj.clear();
}
}
}
}
}
- if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH),true,&pPoolItem) == SfxItemState::SET)
+ if(const SvxBrushItem* pBrushItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH)))
{
- const Graphic* pGraphic = static_cast<const SvxBrushItem *>(pPoolItem)->GetGraphic();
+ const Graphic* pGraphic = pBrushItem->GetGraphic();
if( pGraphic )
{
if(!bIgnoreGraphic)
@@ -901,9 +899,9 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
}
}
- if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),true,&pPoolItem) == SfxItemState::SET)
+ if(const SvxSizeItem* pSymbolSizeItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLSIZE)))
{
- m_aSymbolSize = static_cast<const SvxSizeItem *>(pPoolItem)->GetSize();
+ m_aSymbolSize = pSymbolSizeItem->GetSize();
}
m_xGridIconSize->set_sensitive(bEnable);
@@ -916,7 +914,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
m_aSymbolLastSize=m_aSymbolSize;
}
- if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::INVALID )
{
eXLS = rAttrs->Get( XATTR_LINESTYLE ).GetValue();
@@ -944,7 +942,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
}
// Line strength
- if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::INVALID )
{
SetMetricValue( *m_xMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit );
}
@@ -954,7 +952,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
// Line color
m_xLbColor->SetNoSelection();
- if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::INVALID )
{
Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue();
m_xLbColor->SelectEntry( aCol );
@@ -965,7 +963,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xLbStartStyle->set_sensitive(false);
}
- else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::DONTCARE )
+ else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::INVALID )
{
// #86265# select entry using list and polygon, not string
bool bSelected(false);
@@ -997,7 +995,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xLbEndStyle->set_sensitive(false);
}
- else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::DONTCARE )
+ else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::INVALID )
{
// #86265# select entry using list and polygon, not string
bool bSelected(false);
@@ -1029,7 +1027,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xMtrStartWidth->set_sensitive(false);
}
- else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE )
+ else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::INVALID )
{
SetMetricValue( *m_xMtrStartWidth,
rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(),
@@ -1043,7 +1041,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xMtrEndWidth->set_sensitive(false);
}
- else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE )
+ else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::INVALID )
{
SetMetricValue( *m_xMtrEndWidth,
rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(),
@@ -1057,7 +1055,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xTsbCenterStart->set_sensitive(false);
}
- else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::DONTCARE )
+ else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::INVALID )
{
if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() )
m_xTsbCenterStart->set_state(TRISTATE_TRUE);
@@ -1074,7 +1072,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xTsbCenterEnd->set_sensitive(false);
}
- else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::DONTCARE )
+ else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::INVALID )
{
if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() )
m_xTsbCenterEnd->set_state(TRISTATE_TRUE);
@@ -1087,7 +1085,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
}
// Transparency
- if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::INVALID )
{
sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue();
m_xMtrTransparent->set_value(nTransp, FieldUnit::PERCENT);
@@ -1117,7 +1115,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
// maFTEdgeStyle.set_sensitive(false);
m_xLBEdgeStyle->set_sensitive(false);
}
- else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT))
+ else if(SfxItemState::INVALID != rAttrs->GetItemState(XATTR_LINEJOINT))
{
const css::drawing::LineJoint eLineJoint = rAttrs->Get(XATTR_LINEJOINT).GetValue();
@@ -1141,7 +1139,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
{
m_xLBCapStyle->set_sensitive(false);
}
- else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP))
+ else if(SfxItemState::INVALID != rAttrs->GetItemState(XATTR_LINECAP))
{
const css::drawing::LineCap eLineCap(rAttrs->Get(XATTR_LINECAP).GetValue());
@@ -1254,7 +1252,7 @@ void SvxLineTabPage::ChangePreviewHdl_Impl(const weld::MetricSpinButton* pCntrl)
m_xBoxEnd->set_sensitive(bHasLineEnd && bHasLineStyle);
}
-IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartClickHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartClickHdl_Impl, weld::Toggleable&, void)
{
if (m_xCbxSynchronize->get_active())
m_xTsbCenterEnd->set_state(m_xTsbCenterStart->get_state());
@@ -1311,6 +1309,18 @@ void SvxLineTabPage::ClickInvisibleHdl_Impl()
}
else
{
+ // set cap style associated to the line style
+ sal_Int32 nPos = m_xLbLineStyle->get_active();
+ if( nPos > 1 && m_pDashList->Count() > static_cast<tools::Long>( nPos - 2 ) )
+ {
+ css::drawing::DashStyle eStyle =
+ m_pDashList->GetDash( nPos - 2 )->GetDash().GetDashStyle();
+ if ( eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE)
+ m_xLBCapStyle->set_active(0);
+ else
+ m_xLBCapStyle->set_active(1);
+ }
+
m_xBoxColor->set_sensitive(true);
m_xBoxWidth->set_sensitive(true);
@@ -1323,7 +1333,7 @@ void SvxLineTabPage::ClickInvisibleHdl_Impl()
ChangePreviewHdl_Impl( nullptr );
}
-IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndClickHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndClickHdl_Impl, weld::Toggleable&, void)
{
if (m_xCbxSynchronize->get_active())
m_xTsbCenterStart->set_state(m_xTsbCenterEnd->get_state());
@@ -1368,7 +1378,7 @@ void SvxLineTabPage::FillUserData()
// #58425# Symbols on a list (e.g. StarChart)
// Handler for the symbol selection's popup menu (NumMenueButton)
// The following link originates from SvxNumOptionsTabPage
-IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void)
{
ScopedVclPtrInstance< VirtualDevice > pVD;
@@ -1435,52 +1445,51 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::ToggleButton&, void)
pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
std::unique_ptr<SdrModel> pModel(
new SdrModel(nullptr, nullptr, true));
- pModel->GetItemPool().FreezeIdRanges();
// Page
- SdrPage* pPage = new SdrPage( *pModel, false );
+ rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
pPage->SetSize(Size(1000,1000));
- pModel->InsertPage( pPage, 0 );
+ pModel->InsertPage( pPage.get(), 0 );
{
// 3D View
- std::unique_ptr<SdrView> pView(new SdrView( *pModel, pVDev ));
- pView->hideMarkHandles();
- pView->ShowSdrPage(pPage);
+ SdrView aView( *pModel, pVDev );
+ aView.hideMarkHandles();
+ aView.ShowSdrPage(pPage.get());
// Generate invisible square to give all symbols a
// bitmap size, which is independent from specific glyph
- SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0);
+ rtl::Reference<SdrObject> pInvisibleSquare=m_pSymbolList->GetObj(0);
// directly clone to target SdrModel
pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel);
- pPage->NbcInsertObject(pInvisibleSquare);
+ pPage->NbcInsertObject(pInvisibleSquare.get());
pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
for(size_t i=0; i < m_pSymbolList->GetObjCount(); ++i)
{
- SdrObject *pObj=m_pSymbolList->GetObj(i);
+ rtl::Reference<SdrObject> pObj=m_pSymbolList->GetObj(i);
assert(pObj);
// directly clone to target SdrModel
pObj = pObj->CloneSdrObject(*pModel);
m_aGrfNames.emplace_back("");
- pPage->NbcInsertObject(pObj);
- if(m_pSymbolAttr)
+ pPage->NbcInsertObject(pObj.get());
+ if(m_xSymbolAttr)
{
- pObj->SetMergedItemSet(*m_pSymbolAttr);
+ pObj->SetMergedItemSet(*m_xSymbolAttr);
}
else
{
pObj->SetMergedItemSet(m_rOutAttrs);
}
- pView->MarkAll();
- BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx());
- GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
- pView->UnmarkAll();
- pObj=pPage->RemoveObject(1);
- SdrObject::Free(pObj);
+ aView.MarkAll();
+ BitmapEx aBitmapEx(aView.GetMarkedObjBitmapEx());
+ GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
+ aView.UnmarkAll();
+ pPage->RemoveObject(1);
+ pObj.clear();
SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH));
@@ -1500,8 +1509,8 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::ToggleButton&, void)
pVD->DrawBitmapEx(Point(), aBitmapEx);
m_xSymbolsMenu->append(pInfo->sItemId, "", *pVD);
}
- pInvisibleSquare=pPage->RemoveObject(0);
- SdrObject::Free(pInvisibleSquare);
+ pPage->RemoveObject(0);
+ pInvisibleSquare.clear();
if (m_aGrfNames.empty())
m_xSymbolMB->set_item_sensitive("symbols", false);
@@ -1510,7 +1519,7 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::ToggleButton&, void)
// #58425# Symbols on a list (e.g. StarChart)
// Handler for menu button
-IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
+IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
{
const Graphic* pGraphic = nullptr;
Graphic aGraphic;
@@ -1518,7 +1527,7 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
bool bEnable = true;
tools::Long nPreviousSymbolType = m_nSymbolType;
- OString sNumber;
+ OUString sNumber;
if (rIdent.startsWith("gallery", &sNumber))
{
SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get();
@@ -1545,7 +1554,7 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
}
else if (rIdent == "file")
{
- SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetFrameWeld());
+ SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_CUISTR_EDIT_GRAPHIC), GetFrameWeld());
aGrfDlg.EnableLink(false);
aGrfDlg.AsLink(false);
if( !aGrfDlg.Execute() )
@@ -1643,7 +1652,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
m_aSymbolLastSize=m_aSymbolSize;
}
-IMPL_LINK(SvxLineTabPage, RatioHdl_Impl, weld::ToggleButton&, rBox, void)
+IMPL_LINK(SvxLineTabPage, RatioHdl_Impl, weld::Toggleable&, rBox, void)
{
if (rBox.get_active())
{
@@ -1679,7 +1688,7 @@ void SvxLineTabPage::PageCreated(const SfxAllItemSet& aSet)
ShowSymbolControls(true);
m_pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
if (pSymbolAttrItem)
- m_pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
+ m_xSymbolAttr.reset(new SfxItemSet(pSymbolAttrItem->GetItemSet()));
if(pGraphicItem)
m_aAutoSymbolGraphic = pGraphicItem->GetGraphic();
}
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 2af5b2558421..c8c180b047e3 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -43,6 +43,7 @@
#include <svx/svxids.hrc>
#include <cuitabarea.hxx>
#include <svtools/unitconv.hxx>
+#include <osl/diagnose.h>
#define XOUT_WIDTH 150
@@ -165,7 +166,7 @@ void SvxLineDefTabPage::ActivatePage( const SfxItemSet& )
// determining (and possibly cutting) the name
// and displaying it in the GroupBox
-// OUString aString( CuiResId( RID_SVXSTR_TABLE ) );
+// OUString aString( CuiResId( RID_CUISTR_TABLE ) );
// aString += ": ";
INetURLObject aURL( pDashList->GetPath() );
@@ -202,10 +203,10 @@ void SvxLineDefTabPage::CheckChanges_Impl()
{
std::unique_ptr<weld::MessageDialog> xMessDlg(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Cancel,
- CuiResId(RID_SVXSTR_ASK_CHANGE_LINESTYLE)));
+ CuiResId(RID_CUISTR_ASK_CHANGE_LINESTYLE)));
xMessDlg->set_title(SvxResId(RID_SVXSTR_LINESTYLE));
- xMessDlg->add_button(CuiResId(RID_SVXSTR_CHANGE), RET_BTN_1);
- xMessDlg->add_button(CuiResId(RID_SVXSTR_ADD), RET_BTN_2);
+ xMessDlg->add_button(CuiResId(RID_CUISTR_CHANGE), RET_BTN_1);
+ xMessDlg->add_button(CuiResId(RID_CUISTR_ADD), RET_BTN_2);
short nRet = xMessDlg->run();
@@ -255,9 +256,9 @@ bool SvxLineDefTabPage::FillItemSet( SfxItemSet* rAttrs )
void SvxLineDefTabPage::Reset( const SfxItemSet* rAttrs )
{
- if( rAttrs->GetItemState( GetWhich( XATTR_LINESTYLE ) ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( GetWhich( XATTR_LINESTYLE ) ) != SfxItemState::INVALID )
{
- drawing::LineStyle eXLS = static_cast<const XLineStyleItem&>( rAttrs->Get( GetWhich( XATTR_LINESTYLE ) ) ).GetValue();
+ drawing::LineStyle eXLS = rAttrs->Get( GetWhich( XATTR_LINESTYLE ) ).GetValue();
switch( eXLS )
{
@@ -368,12 +369,12 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber2Hdl_Impl, weld::SpinButton&, voi
ChangePreviewHdl_Impl(*m_xMtrLength1);
}
-IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, weld::ToggleButton&, r, void)
+IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, weld::Toggleable&, r, void)
{
ChangeMetricHdl_Impl(&r);
}
-void SvxLineDefTabPage::ChangeMetricHdl_Impl(const weld::ToggleButton* p)
+void SvxLineDefTabPage::ChangeMetricHdl_Impl(const weld::Toggleable* p)
{
if( !m_xCbxSynchronize->get_active() && m_xMtrLength1->get_unit() != eFUnit )
{
@@ -488,7 +489,7 @@ void SvxLineDefTabPage::SelectTypeHdl_Impl(const weld::ComboBox* p)
IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
OUString aNewName(SvxResId(RID_SVXSTR_LINESTYLE));
- OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINESTYLE));
+ OUString aDesc(CuiResId(RID_CUISTR_DESC_LINESTYLE));
OUString aName;
tools::Long nCount = pDashList->Count();
@@ -511,7 +512,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
while ( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bDifferent = true;
for( tools::Long i = 0; i < nCount && bDifferent; i++ )
@@ -568,7 +569,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, weld::Button&, void)
if (nPos == -1)
return;
- OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINESTYLE));
+ OUString aDesc(CuiResId(RID_CUISTR_DESC_LINESTYLE));
OUString aName( pDashList->GetDash( nPos )->GetName() );
OUString aOldName = aName;
@@ -580,7 +581,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, weld::Button&, void)
while ( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bool bDifferent = true;
for( tools::Long i = 0; i < nCount && bDifferent; i++ )
@@ -758,7 +759,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl, weld::Button&, void)
aFile.Append( pDashList->GetName() );
if( aFile.getExtension().isEmpty() )
- aFile.SetExtension( "sod" );
+ aFile.SetExtension( u"sod" );
}
aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index e51119dcdefc..2d181a3f5cb9 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -45,6 +45,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/strings.hrc>
+#include <osl/diagnose.h>
#define XOUT_WIDTH 150
@@ -108,7 +109,7 @@ void SvxLineEndDefTabPage::Construct()
{
SdrObjTransformInfoRec aInfoRec;
pPolyObj->TakeObjInfo( aInfoRec );
- SdrObjectUniquePtr pNewObj;
+ rtl::Reference<SdrObject> pNewObj;
if( aInfoRec.bCanConvToPath )
pNewObj = pPolyObj->ConvertToPolyObj( true, false );
@@ -269,7 +270,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, weld::Button&, void)
if (nPos == -1)
return;
- OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINEEND));
+ OUString aDesc(CuiResId(RID_CUISTR_DESC_LINEEND));
OUString aName(m_xEdtName->get_text());
tools::Long nCount = pLineEndList->Count();
bool bDifferent = true;
@@ -292,7 +293,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, weld::Button&, void)
while( !bDifferent && bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bDifferent = true;
for( tools::Long i = 0; i < nCount && bDifferent; i++ )
@@ -340,7 +341,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
if( pPolyObj )
{
const SdrObject* pNewObj;
- SdrObjectUniquePtr pConvPolyObj;
+ rtl::Reference<SdrObject> pConvPolyObj;
if( nullptr != dynamic_cast<const SdrPathObj*>( pPolyObj) )
{
@@ -369,10 +370,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
// normalize
aNewPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix( -aNewRange.getMinX(), -aNewRange.getMinY()));
- pConvPolyObj.reset();
+ pConvPolyObj.clear();
OUString aNewName(SvxResId(RID_SVXSTR_LINEEND));
- OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINEEND));
+ OUString aDesc(CuiResId(RID_CUISTR_DESC_LINEEND));
OUString aName;
tools::Long nCount = pLineEndList->Count();
@@ -395,7 +396,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
while ( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bDifferent = true;
for( tools::Long i = 0; i < nCount && bDifferent; i++ )
@@ -578,7 +579,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl, weld::Button&, void)
aFile.Append( pLineEndList->GetName() );
if( aFile.getExtension().isEmpty() )
- aFile.SetExtension( "soe" );
+ aFile.SetExtension( u"soe" );
}
aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index 9dfa12799c93..9a37685951dd 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -77,8 +77,10 @@ SvxPatternTabPage::SvxPatternTabPage(weld::Container* pPage, weld::DialogControl
, m_aXFillAttr(rInAttrs.GetPool())
, m_rXFSet(m_aXFillAttr.GetItemSet())
, m_xCtlPixel(new SvxPixelCtl(this))
- , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"), pController->getDialog()))
- , m_xLbBackgroundColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_BACKGROUND_COLOR"), pController->getDialog()))
+ , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"),
+ [this]{ return GetDialogController()->getDialog(); }))
+ , m_xLbBackgroundColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_BACKGROUND_COLOR"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xPatternLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("patternpresetlistwin", true)))
, m_xBtnAdd(m_xBuilder->weld_button("BTN_ADD"))
, m_xBtnModify(m_xBuilder->weld_button("BTN_MODIFY"))
@@ -108,6 +110,8 @@ SvxPatternTabPage::SvxPatternTabPage(weld::Container* pPage, weld::DialogControl
m_xPatternLB->SetDeleteHdl( LINK( this, SvxPatternTabPage, ClickDeleteHdl_Impl ) );
m_xLbColor->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangeColorHdl_Impl ) );
m_xLbBackgroundColor->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangeColorHdl_Impl ) );
+
+ m_xPatternLB->SetStyle(WB_FLATVALUESET | WB_NO_DIRECTSELECT | WB_TABSTOP);
}
SvxPatternTabPage::~SvxPatternTabPage()
@@ -143,7 +147,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet )
// determining (possibly cutting) the name and
// displaying it in the GroupBox
- OUString aString = CuiResId( RID_SVXSTR_TABLE ) + ": ";
+ OUString aString = CuiResId( RID_CUISTR_TABLE ) + ": ";
INetURLObject aURL( m_pPatternList->GetPath() );
aURL.Append( m_pPatternList->GetName() );
@@ -249,15 +253,14 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, ValueSet*, void)
}
else
{
- const SfxPoolItem* pPoolItem = nullptr;
-
- if(SfxItemState::SET == m_rOutAttrs.GetItemState(GetWhich(XATTR_FILLSTYLE), true, &pPoolItem))
+ if(const XFillStyleItem* pFillStyleItem = m_rOutAttrs.GetItemIfSet(GetWhich(XATTR_FILLSTYLE)))
{
- const drawing::FillStyle eXFS(static_cast<const XFillStyleItem*>(pPoolItem)->GetValue());
+ const drawing::FillStyle eXFS(pFillStyleItem->GetValue());
- if((drawing::FillStyle_BITMAP == eXFS) && (SfxItemState::SET == m_rOutAttrs.GetItemState(GetWhich(XATTR_FILLBITMAP), true, &pPoolItem)))
+ const XFillBitmapItem* pBitmapItem;
+ if((drawing::FillStyle_BITMAP == eXFS) && (pBitmapItem = m_rOutAttrs.GetItemIfSet(GetWhich(XATTR_FILLBITMAP))))
{
- pGraphicObject.reset(new GraphicObject(static_cast<const XFillBitmapItem*>(pPoolItem)->GetGraphicObject()));
+ pGraphicObject.reset(new GraphicObject(pBitmapItem->GetGraphicObject()));
}
}
@@ -319,7 +322,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, weld::Button&, void)
{
OUString aNewName( SvxResId( RID_SVXSTR_PATTERN_UNTITLED ) );
- OUString aDesc( CuiResId( RID_SVXSTR_DESC_NEW_PATTERN ) );
+ OUString aDesc( CuiResId( RID_CUISTR_DESC_NEW_PATTERN ) );
OUString aName;
tools::Long nCount = m_pPatternList->Count();
@@ -338,7 +341,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, weld::Button&, void)
while( pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bValidPatternName = (SearchPatternList(aName) == -1);
@@ -366,12 +369,8 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, weld::Button&, void)
}
else // it must be a not existing imported bitmap
{
- const SfxPoolItem* pPoolItem = nullptr;
-
- if(SfxItemState::SET == m_rOutAttrs.GetItemState(XATTR_FILLBITMAP, true, &pPoolItem))
+ if(const XFillBitmapItem* pFillBmpItem = m_rOutAttrs.GetItemIfSet(XATTR_FILLBITMAP))
{
- auto pFillBmpItem = dynamic_cast<const XFillBitmapItem*>(pPoolItem);
- assert(pFillBmpItem);
pEntry.reset(new XBitmapEntry(pFillBmpItem->GetGraphicObject(), aName));
}
else
@@ -432,7 +431,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void)
if ( nPos == VALUESET_ITEM_NOTFOUND )
return;
- OUString aDesc(CuiResId(RID_SVXSTR_DESC_NEW_PATTERN));
+ OUString aDesc(CuiResId(RID_CUISTR_DESC_NEW_PATTERN));
OUString aName(m_pPatternList->GetBitmap(nPos)->GetName());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
@@ -442,7 +441,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void)
while( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
sal_Int32 nPatternPos = SearchPatternList(aName);
bool bValidPatternName = (nPatternPos == static_cast<sal_Int32>(nPos) ) || (nPatternPos == -1);
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index a02d7d6b92b8..ca2bc3b8a574 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -41,18 +41,13 @@
using namespace com::sun::star;
-const sal_uInt16 SvxShadowTabPage::pShadowRanges[] =
-{
- SDRATTR_SHADOWCOLOR,
- SDRATTR_SHADOWTRANSPARENCE,
- SDRATTR_SHADOWBLUR,
- SID_ATTR_FILL_SHADOW,
- SID_ATTR_FILL_SHADOW,
- SID_ATTR_SHADOW_TRANSPARENCE,
- SID_ATTR_SHADOW_BLUR,
- SID_ATTR_SHADOW_YDISTANCE,
- 0
-};
+const WhichRangesContainer SvxShadowTabPage::pShadowRanges(svl::Items<
+ SDRATTR_SHADOWCOLOR, SDRATTR_SHADOWTRANSPARENCE,
+ SDRATTR_SHADOWBLUR, SDRATTR_SHADOWBLUR,
+ SID_ATTR_FILL_SHADOW, SID_ATTR_FILL_SHADOW,
+ SID_ATTR_SHADOW_BLUR, SID_ATTR_SHADOW_BLUR,
+ SID_ATTR_SHADOW_TRANSPARENCE, SID_ATTR_SHADOW_YDISTANCE
+>);
SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
: SvxTabPage(pPage, pController, "cui/ui/shadowtabpage.ui", "ShadowTabPage", rInAttrs)
@@ -66,7 +61,8 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle
, m_xTsbShowShadow(m_xBuilder->weld_check_button("TSB_SHOW_SHADOW"))
, m_xGridShadow(m_xBuilder->weld_widget("gridSHADOW"))
, m_xMtrDistance(m_xBuilder->weld_metric_spin_button("MTR_FLD_DISTANCE", FieldUnit::CM))
- , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_SHADOW_COLOR"), pController->getDialog()))
+ , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_SHADOW_COLOR"),
+ [this]{ return GetDialogController()->getDialog(); }))
, m_xMtrTransparent(m_xBuilder->weld_metric_spin_button("MTR_SHADOW_TRANSPARENT", FieldUnit::PERCENT))
, m_xLbShadowBlurMetric(m_xBuilder->weld_metric_spin_button("LB_SHADOW_BLUR", FieldUnit::POINT))
, m_xCtlPosition(new weld::CustomWeld(*m_xBuilder, "CTL_POSITION", m_aCtlPosition))
@@ -95,28 +91,27 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle
// setting the output device
drawing::FillStyle eXFS = drawing::FillStyle_SOLID;
- if( m_rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::DONTCARE )
+ if( m_rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::INVALID )
{
- eXFS = static_cast<const XFillStyleItem&>( m_rOutAttrs.
- Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue();
+ eXFS = m_rOutAttrs.Get( GetWhich( XATTR_FILLSTYLE ) ).GetValue();
switch( eXFS )
{
case drawing::FillStyle_SOLID:
- if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )
+ if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )
{
m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLCOLOR ) );
}
break;
case drawing::FillStyle_GRADIENT:
- if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) )
+ if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) )
{
m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLGRADIENT ) );
}
break;
case drawing::FillStyle_HATCH:
- if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLHATCH ) )
+ if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLHATCH ) )
{
m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLHATCH ) );
}
@@ -124,7 +119,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle
case drawing::FillStyle_BITMAP:
{
- if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLBITMAP ) )
+ if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLBITMAP ) )
{
m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLBITMAP ) );
}
@@ -262,18 +257,18 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
case RectPoint::MM: break;
}
- // If the values of the shadow distances==SfxItemState::DONTCARE and the displayed
+ // If the values of the shadow distances==SfxItemState::INVALID and the displayed
// string in the respective MetricField=="", then the comparison of the old
// and the new distance values would return a wrong result because in such a
// case the new distance values would match the default values of the MetricField !!!!
if ( !m_xMtrDistance->get_text().isEmpty() ||
- m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE ||
- m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
+ m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::INVALID ||
+ m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::INVALID )
{
sal_Int32 nOldX = 9876543; // impossible value, so DontCare
sal_Int32 nOldY = 9876543;
- if( m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
- m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
+ if( m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::INVALID &&
+ m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::INVALID )
{
nOldX = m_rOutAttrs.Get( SDRATTR_SHADOWXDIST ).GetValue();
nOldY = m_rOutAttrs.Get( SDRATTR_SHADOWYDIST ).GetValue();
@@ -343,7 +338,7 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
// at the moment there are only 8 possible positions where a shadow can be set
// has a shadow been set?
- if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::INVALID )
{
if( rAttrs->Get( SDRATTR_SHADOW ).GetValue() )
m_xTsbShowShadow->set_state(TRISTATE_TRUE);
@@ -358,8 +353,8 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
// distance (only 8 possible positions),
// so there is only one item evaluated
- if( rAttrs->GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
- rAttrs->GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::INVALID &&
+ rAttrs->GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::INVALID )
{
sal_Int32 nX = rAttrs->Get( SDRATTR_SHADOWXDIST ).GetValue();
sal_Int32 nY = rAttrs->Get( SDRATTR_SHADOWYDIST ).GetValue();
@@ -386,9 +381,9 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
// determine default-distance
SfxItemPool* pPool = m_rOutAttrs.GetPool();
{
- sal_Int32 n = pPool->GetDefaultItem(SDRATTR_SHADOWXDIST).GetValue();
+ sal_Int32 n = pPool->GetUserOrPoolDefaultItem(SDRATTR_SHADOWXDIST).GetValue();
if (n == 0)
- n = pPool->GetDefaultItem(SDRATTR_SHADOWYDIST).GetValue();
+ n = pPool->GetUserOrPoolDefaultItem(SDRATTR_SHADOWYDIST).GetValue();
SetMetricValue(*m_xMtrDistance, std::abs(n), m_ePoolUnit);
}
@@ -399,14 +394,14 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
m_aCtlPosition.SetActualRP( RectPoint::MM );
}
- if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::INVALID )
{
m_xLbShadowColor->SelectEntry( rAttrs->Get( SDRATTR_SHADOWCOLOR ).GetColorValue() );
}
else
m_xLbShadowColor->SetNoSelection();
- if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::INVALID )
{
sal_uInt16 nTransp = rAttrs->Get( SDRATTR_SHADOWTRANSPARENCE ).GetValue();
m_xMtrTransparent->set_value(nTransp, FieldUnit::PERCENT);
@@ -414,7 +409,7 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
else
m_xMtrTransparent->set_text("");
- if( rAttrs->GetItemState( SDRATTR_SHADOWBLUR ) != SfxItemState::DONTCARE )
+ if( rAttrs->GetItemState( SDRATTR_SHADOWBLUR ) != SfxItemState::INVALID )
{
sal_uInt16 nBlur = rAttrs->Get( SDRATTR_SHADOWBLUR ).GetValue();
m_xLbShadowBlurMetric->set_value(nBlur, FieldUnit::MM_100TH);
@@ -443,7 +438,7 @@ std::unique_ptr<SfxTabPage> SvxShadowTabPage::Create( weld::Container* pPage, we
return std::make_unique<SvxShadowTabPage>(pPage, pController, *rAttrs);
}
-IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, weld::Toggleable&, void)
{
if (m_xTsbShowShadow->get_state() == TRISTATE_FALSE)
{
diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx
index 6aa38b8df941..b2d6a10dea0a 100644
--- a/cui/source/tabpages/tptrans.cxx
+++ b/cui/source/tabpages/tptrans.cxx
@@ -33,16 +33,11 @@
using namespace com::sun::star;
-const sal_uInt16 SvxTransparenceTabPage::pTransparenceRanges[] =
-{
- XATTR_FILLTRANSPARENCE,
- XATTR_FILLTRANSPARENCE,
- SDRATTR_SHADOWTRANSPARENCE,
- SDRATTR_SHADOWTRANSPARENCE,
- XATTR_FILLFLOATTRANSPARENCE,
- XATTR_FILLFLOATTRANSPARENCE,
- 0
-};
+const WhichRangesContainer SvxTransparenceTabPage::pTransparenceRanges(svl::Items<
+ XATTR_FILLTRANSPARENCE, XATTR_FILLTRANSPARENCE,
+ XATTR_FILLFLOATTRANSPARENCE, XATTR_FILLFLOATTRANSPARENCE,
+ SDRATTR_SHADOWTRANSPARENCE, SDRATTR_SHADOWTRANSPARENCE
+>);
/*************************************************************************
|*
@@ -50,7 +45,7 @@ const sal_uInt16 SvxTransparenceTabPage::pTransparenceRanges[] =
|*
\************************************************************************/
-IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransOffHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransOffHdl_Impl, weld::Toggleable&, void)
{
// disable all other controls
ActivateLinear(false);
@@ -65,7 +60,7 @@ IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransOffHdl_Impl, weld::ToggleButto
InvalidatePreview(false);
}
-IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, weld::Toggleable&, void)
{
// enable linear, disable other
ActivateLinear(true);
@@ -76,7 +71,7 @@ IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, weld::ToggleBu
ModifyTransparentHdl_Impl(*m_xMtrTransparent);
}
-IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, weld::Toggleable&, void)
{
// enable gradient, disable other
ActivateLinear(false);
@@ -124,11 +119,8 @@ void SvxTransparenceTabPage::ModifiedTrgrHdl_Impl(const weld::ComboBox* pControl
}
// preview
- sal_uInt8 nStartCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(m_xMtrTrgrStartValue->get_value(FieldUnit::PERCENT)) * 255) / 100);
- sal_uInt8 nEndCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(m_xMtrTrgrEndValue->get_value(FieldUnit::PERCENT)) * 255) / 100);
- XGradient aTmpGradient(
- Color(nStartCol, nStartCol, nStartCol),
- Color(nEndCol, nEndCol, nEndCol),
+ basegfx::BGradient aTmpGradient(
+ createColorStops(),
static_cast<css::awt::GradientStyle>(m_xLbTrgrGradientType->get_active()),
Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10),
static_cast<sal_uInt16>(m_xMtrTrgrCenterX->get_value(FieldUnit::PERCENT)),
@@ -216,7 +208,7 @@ SvxTransparenceTabPage::SvxTransparenceTabPage(weld::Container* pPage, weld::Dia
, m_xMtrTrgrEndValue(m_xBuilder->weld_metric_spin_button("MTR_TRGR_END_VALUE", FieldUnit::PERCENT))
, m_xCtlBitmapBorder(m_xBuilder->weld_widget("bitmap_border"))
, m_xCtlXRectBorder(m_xBuilder->weld_widget("trans_border"))
- , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder, "CTL_BITMAP_PREVIEW", m_aCtlBitmapPreview))
+ , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder, "CTL_IMAGE_PREVIEW", m_aCtlBitmapPreview))
, m_xCtlXRectPreview(new weld::CustomWeld(*m_xBuilder, "CTL_TRANS_PREVIEW", m_aCtlXRectPreview))
{
// main selection
@@ -258,8 +250,8 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
bool bGradActive = (eStateGradient == SfxItemState::SET && static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled());
bool bLinearActive = (eStateLinear == SfxItemState::SET && static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue() != 0);
- bool bGradUsed = (eStateGradient == SfxItemState::DONTCARE);
- bool bLinearUsed = (eStateLinear == SfxItemState::DONTCARE);
+ bool bGradUsed = (eStateGradient == SfxItemState::INVALID);
+ bool bLinearUsed = (eStateLinear == SfxItemState::INVALID);
bool bModified(false);
bool bSwitchOffLinear(false);
@@ -295,11 +287,8 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
|| m_xMtrTrgrStartValue->get_value_changed_from_saved()
|| m_xMtrTrgrEndValue->get_value_changed_from_saved())
{
- sal_uInt8 nStartCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(m_xMtrTrgrStartValue->get_value(FieldUnit::PERCENT)) * 255) / 100);
- sal_uInt8 nEndCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(m_xMtrTrgrEndValue->get_value(FieldUnit::PERCENT)) * 255) / 100);
- XGradient aTmpGradient(
- Color(nStartCol, nStartCol, nStartCol),
- Color(nEndCol, nEndCol, nEndCol),
+ basegfx::BGradient aTmpGradient(
+ createColorStops(),
static_cast<css::awt::GradientStyle>(m_xLbTrgrGradientType->get_active()),
Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10),
static_cast<sal_uInt16>(m_xMtrTrgrCenterX->get_value(FieldUnit::PERCENT)),
@@ -328,9 +317,10 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
// disable unused XFillFloatTransparenceItem
if(bSwitchOffGradient && (bGradActive || bGradUsed))
{
- XGradient aGrad(COL_BLACK, COL_WHITE);
- aGrad.SetStartIntens(100);
- aGrad.SetEndIntens(100);
+ // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] with same defaults
+ // basegfx::BGradient() default also sets the Start/EndIntensity to 100 already
+ basegfx::BGradient aGrad;
+
XFillFloatTransparenceItem aItem(aGrad);
aItem.SetEnabled(false);
rAttrs->Put(aItem);
@@ -352,31 +342,40 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs)
{
- const SfxPoolItem* pGradientItem = nullptr;
- SfxItemState eStateGradient(rAttrs->GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem));
+ const XFillFloatTransparenceItem* pGradientItem =
+ rAttrs->GetItemIfSet(XATTR_FILLFLOATTRANSPARENCE);
+ bool bGradActive = (pGradientItem && pGradientItem->IsEnabled());
if(!pGradientItem)
pGradientItem = &rAttrs->Get(XATTR_FILLFLOATTRANSPARENCE);
- bool bGradActive = (eStateGradient == SfxItemState::SET && static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled());
- const SfxPoolItem* pLinearItem = nullptr;
- SfxItemState eStateLinear(rAttrs->GetItemState(XATTR_FILLTRANSPARENCE, true, &pLinearItem));
+ const XFillTransparenceItem* pLinearItem =
+ rAttrs->GetItemIfSet(XATTR_FILLTRANSPARENCE);
+ bool bLinearActive = (pLinearItem && pLinearItem->GetValue() != 0);
if(!pLinearItem)
pLinearItem = &rAttrs->Get(XATTR_FILLTRANSPARENCE);
- bool bLinearActive = (eStateLinear == SfxItemState::SET && static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue() != 0);
// transparence gradient
- const XGradient& rGradient = static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->GetGradientValue();
+ const basegfx::BGradient& rGradient = pGradientItem->GetGradientValue();
css::awt::GradientStyle eXGS(rGradient.GetGradientStyle());
m_xLbTrgrGradientType->set_active(sal::static_int_cast< sal_Int32 >(eXGS));
m_xMtrTrgrAngle->set_value(rGradient.GetAngle().get() / 10, FieldUnit::DEGREE);
m_xMtrTrgrBorder->set_value(rGradient.GetBorder(), FieldUnit::PERCENT);
m_xMtrTrgrCenterX->set_value(rGradient.GetXOffset(), FieldUnit::PERCENT);
m_xMtrTrgrCenterY->set_value(rGradient.GetYOffset(), FieldUnit::PERCENT);
- m_xMtrTrgrStartValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetStartColor().GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT);
- m_xMtrTrgrEndValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetEndColor().GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT);
+ const Color aStart(rGradient.GetColorStops().front().getStopColor());
+ const Color aEnd(rGradient.GetColorStops().back().getStopColor());
+ m_xMtrTrgrStartValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aStart.GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT);
+ m_xMtrTrgrEndValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aEnd.GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT);
+
+ // MCGR: preserve ColorStops if given
+ // tdf#155901 We need offset of first and last stop, so include them.
+ if (rGradient.GetColorStops().size() >= 2)
+ maColorStops = rGradient.GetColorStops();
+ else
+ maColorStops.clear();
// linear transparence
- sal_uInt16 nTransp = static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue();
+ sal_uInt16 nTransp = pLinearItem->GetValue();
m_xMtrTransparent->set_value(bLinearActive ? nTransp : 50, FieldUnit::PERCENT);
ModifyTransparentHdl_Impl(*m_xMtrTransparent);
@@ -421,7 +420,7 @@ void SvxTransparenceTabPage::ChangesApplied()
void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet)
{
- const CntUInt16Item* pPageTypeItem = rSet.GetItem<CntUInt16Item>(SID_PAGE_TYPE, false);
+ const CntUInt16Item* pPageTypeItem = rSet.GetItem<SfxUInt16Item>(SID_PAGE_TYPE, false);
if (pPageTypeItem)
SetPageType(static_cast<PageType>(pPageTypeItem->GetValue()));
@@ -510,6 +509,29 @@ void SvxTransparenceTabPage::InvalidatePreview (bool bEnable)
}
}
+basegfx::BColorStops SvxTransparenceTabPage::createColorStops()
+{
+ basegfx::BColorStops aColorStops;
+ basegfx::BColor aStartBColor(m_xMtrTrgrStartValue->get_value(FieldUnit::PERCENT) / 100.0);
+ aStartBColor.clamp();
+ basegfx::BColor aEndBColor(m_xMtrTrgrEndValue->get_value(FieldUnit::PERCENT) / 100.0);
+ aEndBColor.clamp();
+
+ if(maColorStops.size() >= 2)
+ {
+ aColorStops = maColorStops;
+ aColorStops.front() = basegfx::BColorStop(maColorStops.front().getStopOffset(), aStartBColor);
+ aColorStops.back() = basegfx::BColorStop(maColorStops.back().getStopOffset(), aEndBColor);
+ }
+ else
+ {
+ aColorStops.emplace_back(0.0, aStartBColor);
+ aColorStops.emplace_back(1.0, aEndBColor);
+ }
+
+ return aColorStops;
+}
+
void SvxTransparenceTabPage::PageCreated(const SfxAllItemSet& aSet)
{
const SfxUInt16Item* pPageTypeItem = aSet.GetItem<SfxUInt16Item>(SID_PAGE_TYPE, false);
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index a76f1413c39c..78294eb5d584 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -34,53 +34,34 @@
#include <svtools/unitconv.hxx>
#include <transfrm.hxx>
-#include <svx/dlgutil.hxx>
#include <svx/anchorid.hxx>
#include <svl/rectitem.hxx>
#include <swpossizetabpage.hxx>
#include <vcl/canvastools.hxx>
#include <vcl/fieldvalues.hxx>
+#include <bitmaps.hlst>
+
// static ----------------------------------------------------------------
-const sal_uInt16 SvxPositionSizeTabPage::pPosSizeRanges[] =
-{
- SID_ATTR_TRANSFORM_POS_X,
- SID_ATTR_TRANSFORM_POS_Y,
- SID_ATTR_TRANSFORM_PROTECT_POS,
- SID_ATTR_TRANSFORM_PROTECT_POS,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_ANCHOR,
- SID_ATTR_TRANSFORM_VERT_ORIENT,
- SID_ATTR_TRANSFORM_WIDTH,
- SID_ATTR_TRANSFORM_SIZE_POINT,
- SID_ATTR_TRANSFORM_PROTECT_POS,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_AUTOWIDTH,
- SID_ATTR_TRANSFORM_AUTOHEIGHT,
- 0
-};
-
-const sal_uInt16 SvxAngleTabPage::pAngleRanges[] =
-{
- SID_ATTR_TRANSFORM_ROT_X,
- SID_ATTR_TRANSFORM_ANGLE,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_INTERN,
- 0
-};
-
-const sal_uInt16 SvxSlantTabPage::pSlantRanges[] =
-{
- SDRATTR_ECKENRADIUS,
- SDRATTR_ECKENRADIUS,
- SID_ATTR_TRANSFORM_SHEAR,
- SID_ATTR_TRANSFORM_SHEAR_VERTICAL,
- SID_ATTR_TRANSFORM_INTERN,
- SID_ATTR_TRANSFORM_INTERN,
- 0
-};
+const WhichRangesContainer SvxPositionSizeTabPage::pPosSizeRanges(svl::Items<
+ SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_POS_Y,
+ SID_ATTR_TRANSFORM_WIDTH, SID_ATTR_TRANSFORM_SIZE_POINT,
+ SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_AUTOWIDTH, SID_ATTR_TRANSFORM_AUTOHEIGHT,
+ SID_ATTR_TRANSFORM_ANCHOR, SID_ATTR_TRANSFORM_VERT_ORIENT
+>);
+
+const WhichRangesContainer SvxAngleTabPage::pAngleRanges(svl::Items<
+ SID_ATTR_TRANSFORM_ROT_X, SID_ATTR_TRANSFORM_ANGLE,
+ SID_ATTR_TRANSFORM_INTERN, SID_ATTR_TRANSFORM_INTERN
+>);
+
+const WhichRangesContainer SvxSlantTabPage::pSlantRanges(svl::Items<
+ SDRATTR_CORNER_RADIUS, SDRATTR_CORNER_RADIUS,
+ SID_ATTR_TRANSFORM_INTERN, SID_ATTR_TRANSFORM_INTERN,
+ SID_ATTR_TRANSFORM_SHEAR, SID_ATTR_TRANSFORM_SHEAR_VERTICAL
+>);
/*************************************************************************
|*
@@ -113,7 +94,7 @@ SvxTransformTabDialog::SvxTransformTabDialog(weld::Window* pParent, const SfxIte
}
-void SvxTransformTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
+void SvxTransformTabDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "RID_SVXPAGE_POSITION_SIZE")
{
@@ -227,7 +208,7 @@ void SvxAngleTabPage::Construct()
}
// take scale into account
- const Fraction aUIScale(pView->GetModel()->GetUIScale());
+ const Fraction aUIScale(pView->GetModel().GetUIScale());
TransfrmHelper::ScaleRect(maRange, aUIScale);
// take UI units into account
@@ -247,13 +228,13 @@ bool SvxAngleTabPage::FillItemSet(SfxItemSet* rSet)
if (m_xCtlAngle->IsValueModified() || m_xMtrPosX->get_value_changed_from_saved() || m_xMtrPosY->get_value_changed_from_saved())
{
- const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fUIScale(double(pView->GetModel().GetUIScale()));
const double fTmpX((GetCoreValue(*m_xMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale);
const double fTmpY((GetCoreValue(*m_xMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale);
- rSet->Put(SdrAngleItem(GetWhich(SID_ATTR_TRANSFORM_ANGLE), m_xCtlAngle->GetRotation()));
- rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX)));
- rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY)));
+ rSet->Put(SdrAngleItem(SID_ATTR_TRANSFORM_ANGLE, m_xCtlAngle->GetRotation()));
+ rSet->Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(fTmpX)));
+ rSet->Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(fTmpY)));
bModified = true;
}
@@ -264,7 +245,7 @@ bool SvxAngleTabPage::FillItemSet(SfxItemSet* rSet)
void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs)
{
- const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fUIScale(double(pView->GetModel().GetUIScale()));
const SfxPoolItem* pItem = GetItem( *rAttrs, SID_ATTR_TRANSFORM_ROT_X );
if(pItem)
@@ -309,8 +290,7 @@ std::unique_ptr<SfxTabPage> SvxAngleTabPage::Create(weld::Container* pPage, weld
void SvxAngleTabPage::ActivatePage(const SfxItemSet& rSet)
{
- SfxBoolItem const * bPosProtect = nullptr;
- if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_POS ) , false, reinterpret_cast<SfxPoolItem const **>(&bPosProtect) ))
+ if(SfxBoolItem const * bPosProtect = rSet.GetItemIfSet( SID_ATTR_TRANSFORM_PROTECT_POS, false ))
{
m_xFlPosition->set_sensitive(!bPosProtect->GetValue());
m_xFlAngle->set_sensitive(!bPosProtect->GetValue());
@@ -407,11 +387,11 @@ SvxSlantTabPage::SvxSlantTabPage(weld::Container* pPage, weld::DialogController*
{
for (int i = 0; i < 2; ++i)
{
- m_aControlGroups[i] = m_xBuilder->weld_widget("controlgroups" + OString::number(i+1));
- m_aControlGroupX[i] = m_xBuilder->weld_widget("controlgroupx" + OString::number(i+1));
- m_aControlX[i] = m_xBuilder->weld_metric_spin_button("controlx" + OString::number(i+1), FieldUnit::CM);
- m_aControlGroupY[i] = m_xBuilder->weld_widget("controlgroupy" + OString::number(i+1));
- m_aControlY[i] = m_xBuilder->weld_metric_spin_button("controly" + OString::number(i+1), FieldUnit::CM);
+ m_aControlGroups[i] = m_xBuilder->weld_widget("controlgroups" + OUString::number(i+1));
+ m_aControlGroupX[i] = m_xBuilder->weld_widget("controlgroupx" + OUString::number(i+1));
+ m_aControlX[i] = m_xBuilder->weld_metric_spin_button("controlx" + OUString::number(i+1), FieldUnit::CM);
+ m_aControlGroupY[i] = m_xBuilder->weld_widget("controlgroupy" + OUString::number(i+1));
+ m_aControlY[i] = m_xBuilder->weld_metric_spin_button("controly" + OUString::number(i+1), FieldUnit::CM);
}
// this page needs ExchangeSupport
@@ -451,7 +431,7 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
if (m_xMtrRadius->get_value_changed_from_saved())
{
- Fraction aUIScale = pView->GetModel()->GetUIScale();
+ Fraction aUIScale = pView->GetModel().GetUIScale();
tools::Long nTmp = tools::Long(GetCoreValue(*m_xMtrRadius, ePoolUnit) * aUIScale);
rAttrs->Put( makeSdrEckenradiusItem( nTmp ) );
@@ -578,11 +558,11 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
}
else
{
- pItem = GetItem( *rAttrs, SDRATTR_ECKENRADIUS );
+ pItem = GetItem( *rAttrs, SDRATTR_CORNER_RADIUS );
if( pItem )
{
- const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fUIScale(double(pView->GetModel().GetUIScale()));
const double fTmp(static_cast<double>(static_cast<const SdrMetricItem*>(pItem)->GetValue()) / fUIScale);
SetMetricValue(*m_xMtrRadius, basegfx::fround(fTmp), ePoolUnit);
}
@@ -648,6 +628,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
*pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()));
//save geometry
+ const bool bOrigModelChangeState = pView->GetModel().IsChanged();
SdrCustomShapeGeometryItem aInitialGeometry(rSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
EnhancedCustomShape2d aShape(rSdrObjCustomShape);
@@ -691,6 +672,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
//restore geometry
rSdrObjCustomShape.SetMergedItem(aInitialGeometry);
+ pView->GetModel().SetChanged(bOrigModelChangeState);
}
for (int i = 0; i < 2; ++i)
@@ -707,13 +689,11 @@ std::unique_ptr<SfxTabPage> SvxSlantTabPage::Create(weld::Container* pPage, weld
void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet )
{
- SfxBoolItem const * bPosProtect = nullptr;
- if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_POS ) , false, reinterpret_cast<SfxPoolItem const **>(&bPosProtect) ))
+ if(SfxBoolItem const * bPosProtect = rSet.GetItemIfSet( SID_ATTR_TRANSFORM_PROTECT_POS, false ))
{
m_xFlAngle->set_sensitive(!bPosProtect->GetValue());
}
- SfxBoolItem const * bSizeProtect = nullptr;
- if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_SIZE ) , false, reinterpret_cast<SfxPoolItem const **>(&bSizeProtect) ))
+ if(SfxBoolItem const * bSizeProtect = rSet.GetItemIfSet( SID_ATTR_TRANSFORM_PROTECT_SIZE, false ))
{
m_xFlAngle->set_sensitive(!bSizeProtect->GetValue());
}
@@ -752,6 +732,8 @@ SvxPositionSizeTabPage::SvxPositionSizeTabPage(weld::Container* pPage, weld::Dia
, mfOldHeight(0.0)
, m_aCtlPos(this)
, m_aCtlSize(this)
+ , m_aRatioTop(ConnectorType::Top)
+ , m_aRatioBottom(ConnectorType::Bottom)
, m_xFlPosition(m_xBuilder->weld_widget("FL_POSITION"))
, m_xMtrPosX(m_xBuilder->weld_metric_spin_button("MTR_FLD_POS_X", FieldUnit::CM))
, m_xMtrPosY(m_xBuilder->weld_metric_spin_button("MTR_FLD_POS_Y", FieldUnit::CM))
@@ -762,6 +744,9 @@ SvxPositionSizeTabPage::SvxPositionSizeTabPage(weld::Container* pPage, weld::Dia
, m_xFtHeight(m_xBuilder->weld_label("FT_HEIGHT"))
, m_xMtrHeight(m_xBuilder->weld_metric_spin_button("MTR_FLD_HEIGHT", FieldUnit::CM))
, m_xCbxScale(m_xBuilder->weld_check_button("CBX_SCALE"))
+ , m_xCbxScaleImg(m_xBuilder->weld_image("imRatio"))
+ , m_xImgRatioTop(new weld::CustomWeld(*m_xBuilder, "daRatioTop", m_aRatioTop))
+ , m_xImgRatioBottom(new weld::CustomWeld(*m_xBuilder, "daRatioBottom", m_aRatioBottom))
, m_xCtlSize(new weld::CustomWeld(*m_xBuilder, "CTL_SIZERECT", m_aCtlSize))
, m_xFlProtect(m_xBuilder->weld_widget("FL_PROTECT"))
, m_xTsbPosProtect(m_xBuilder->weld_check_button("TSB_POSPROTECT"))
@@ -782,9 +767,19 @@ SvxPositionSizeTabPage::SvxPositionSizeTabPage(weld::Container* pPage, weld::Dia
m_aCtlSize.SetActualRP(RectPoint::LT);
meRP = RectPoint::LT; // see above
- m_xMtrWidth->connect_value_changed( LINK( this, SvxPositionSizeTabPage, ChangeWidthHdl ) );
- m_xMtrHeight->connect_value_changed( LINK( this, SvxPositionSizeTabPage, ChangeHeightHdl ) );
- m_xCbxScale->connect_toggled( LINK( this, SvxPositionSizeTabPage, ClickAutoHdl ) );
+ m_xMtrWidth->connect_value_changed(LINK(this, SvxPositionSizeTabPage, ChangeWidthHdl));
+ m_xMtrHeight->connect_value_changed(LINK(this, SvxPositionSizeTabPage, ChangeHeightHdl));
+
+ m_xCbxScale->connect_toggled(LINK(this, SvxPositionSizeTabPage, ClickAutoHdl));
+ // vertical alignment = fill makes the drawingarea expand the associated spinedits so we have to size it here
+ const sal_Int16 aHeight
+ = static_cast<sal_Int16>(std::max(int(m_xCbxScale->get_preferred_size().getHeight() / 2
+ - m_xFtWidth->get_preferred_size().getHeight() / 2),
+ 12));
+ const sal_Int16 aWidth
+ = static_cast<sal_Int16>(m_xCbxScale->get_preferred_size().getWidth() / 2);
+ m_xImgRatioTop->set_size_request(aWidth, aHeight);
+ m_xImgRatioBottom->set_size_request(aWidth, aHeight);
m_xFlAdjust->set_sensitive(false);
@@ -864,7 +859,7 @@ void SvxPositionSizeTabPage::Construct()
const SdrObjKind eKind(pObj->GetObjIdentifier());
if((pObj->GetObjInventor() == SdrInventor::Default) &&
- (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) &&
+ (SdrObjKind::Text == eKind || SdrObjKind::TitleText == eKind || SdrObjKind::OutlineText == eKind) &&
pObj->HasText())
{
mbAdjustDisabled = false;
@@ -874,14 +869,14 @@ void SvxPositionSizeTabPage::Construct()
m_xTsbAutoGrowWidth->connect_toggled( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) );
m_xTsbAutoGrowHeight->connect_toggled( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) );
- // is used as flag to evaluate if its selectable
+ // is used as flag to evaluate if it's selectable
mbIgnoreAutoGrowWidth = false;
mbIgnoreAutoGrowHeight = false;
}
}
// take scale into account
- const Fraction aUIScale(mpView->GetModel()->GetUIScale());
+ const Fraction aUIScale(mpView->GetModel().GetUIScale());
TransfrmHelper::ScaleRect( maWorkRange, aUIScale );
TransfrmHelper::ScaleRect( maRange, aUIScale );
@@ -912,7 +907,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
{
if (m_xMtrPosX->get_value_changed_from_saved() || m_xMtrPosY->get_value_changed_from_saved())
{
- const double fUIScale(double(mpView->GetModel()->GetUIScale()));
+ const double fUIScale(double(mpView->GetModel().GetUIScale()));
double fX((GetCoreValue( *m_xMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale);
double fY((GetCoreValue( *m_xMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale);
@@ -925,8 +920,8 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
// #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions
GetTopLeftPosition(fX, fY, maRange);
- rOutAttrs->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX)));
- rOutAttrs->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY)));
+ rOutAttrs->Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_X, basegfx::fround(fX)));
+ rOutAttrs->Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_Y, basegfx::fround(fY)));
bModified = true;
}
@@ -940,7 +935,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
else
{
rOutAttrs->Put(
- SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ),
+ SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_POS,
m_xTsbPosProtect->get_active() ) );
}
@@ -950,7 +945,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
if (m_xMtrWidth->get_value_changed_from_saved() || m_xMtrHeight->get_value_changed_from_saved())
{
- Fraction aUIScale = mpView->GetModel()->GetUIScale();
+ Fraction aUIScale = mpView->GetModel().GetUIScale();
// get Width
double nWidth = static_cast<double>(m_xMtrWidth->get_value(FieldUnit::MM_100TH));
@@ -965,9 +960,9 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
lHeight = static_cast<tools::Long>(m_xMtrHeight->denormalize( lHeight ));
// put Width & Height to itemset
- rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), static_cast<sal_uInt32>(lWidth) ) );
- rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), static_cast<sal_uInt32>(lHeight) ) );
- rOutAttrs->Put( SfxUInt16Item( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< sal_uInt16 >( meRP ) ) );
+ rOutAttrs->Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, static_cast<sal_uInt32>(lWidth) ) );
+ rOutAttrs->Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, static_cast<sal_uInt32>(lHeight) ) );
+ rOutAttrs->Put( SfxUInt16Item( SID_ATTR_TRANSFORM_SIZE_POINT, sal::static_int_cast< sal_uInt16 >( meRP ) ) );
bModified = true;
}
@@ -977,7 +972,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
rOutAttrs->InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE );
else
rOutAttrs->Put(
- SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ),
+ SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE,
m_xTsbSizeProtect->get_active() ) );
bModified = true;
}
@@ -990,7 +985,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
rOutAttrs->InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH );
else
rOutAttrs->Put(
- SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOWIDTH ),
+ SfxBoolItem( SID_ATTR_TRANSFORM_AUTOWIDTH,
m_xTsbAutoGrowWidth->get_active() ) );
}
bModified = true;
@@ -1007,7 +1002,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
else
{
rOutAttrs->Put(
- SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOHEIGHT ),
+ SfxBoolItem( SID_ATTR_TRANSFORM_AUTOHEIGHT,
m_xTsbAutoGrowHeight->get_active() ) );
}
}
@@ -1020,7 +1015,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
{
const SfxPoolItem* pItem;
- const double fUIScale(double(mpView->GetModel()->GetUIScale()));
+ const double fUIScale(double(mpView->GetModel().GetUIScale()));
if ( !mbPageDisabled )
{
@@ -1062,7 +1057,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), mePoolUnit, MapUnit::Map100thMM)) / fUIScale);
if (m_xMtrWidth->get_digits())
fTmpWidth *= pow(10.0, m_xMtrWidth->get_digits());
- m_xMtrWidth->set_value(static_cast<int>(fTmpWidth), FieldUnit::MM_100TH);
+ m_xMtrWidth->set_value(fTmpWidth, FieldUnit::MM_100TH);
}
{ // #i75273# set height
@@ -1071,7 +1066,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), mePoolUnit, MapUnit::Map100thMM)) / fUIScale);
if (m_xMtrHeight->get_digits())
fTmpHeight *= pow(10.0, m_xMtrHeight->get_digits());
- m_xMtrHeight->set_value(static_cast<int>(fTmpHeight), FieldUnit::MM_100TH);
+ m_xMtrHeight->set_value(fTmpHeight, FieldUnit::MM_100TH);
}
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE );
@@ -1101,6 +1096,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
// Is matching set?
OUString aStr = GetUserData();
m_xCbxScale->set_active(aStr.toInt32() != 0);
+ m_xCbxScaleImg->set_from_icon_name(m_xCbxScale->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED);
m_xMtrPosX->save_value();
m_xMtrPosY->save_value();
@@ -1123,9 +1119,7 @@ std::unique_ptr<SfxTabPage> SvxPositionSizeTabPage::Create(weld::Container* pPag
void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet )
{
- SfxRectangleItem const * pRectItem = nullptr;
-
- if( SfxItemState::SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , false, reinterpret_cast<SfxPoolItem const **>(&pRectItem) ) )
+ if( SfxRectangleItem const * pRectItem = rSet.GetItemIfSet( SID_ATTR_TRANSFORM_INTERN, false ) )
{
{ // #i75273#
const ::tools::Rectangle aTempRect(pRectItem->GetValue());
@@ -1146,12 +1140,12 @@ DeactivateRC SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet )
GetTopLeftPosition(fX, fY, maRange);
const ::tools::Rectangle aOutRectangle(
- basegfx::fround(fX), basegfx::fround(fY),
- basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight()));
+ basegfx::fround<tools::Long>(fX), basegfx::fround<tools::Long>(fY),
+ basegfx::fround<tools::Long>(fX + maRange.getWidth()), basegfx::fround<tools::Long>(fY + maRange.getHeight()));
_pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle));
- _pSet->Put(SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ),
+ _pSet->Put(SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_POS,
m_xTsbPosProtect->get_state() == TRISTATE_TRUE ));
- _pSet->Put(SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ),
+ _pSet->Put(SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE,
m_xTsbSizeProtect->get_state() == TRISTATE_TRUE ));
FillItemSet(_pSet);
}
@@ -1160,7 +1154,7 @@ DeactivateRC SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet )
}
-IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangePosProtectHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangePosProtectHdl, weld::Toggleable&, void)
{
// #106572# Remember user's last choice
m_xTsbSizeProtect->set_state(m_xTsbPosProtect->get_state() == TRISTATE_TRUE ? TRISTATE_TRUE : mnProtectSizeState);
@@ -1199,7 +1193,7 @@ void SvxPositionSizeTabPage::UpdateControlStates()
m_aCtlPos.Invalidate();
}
-IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeSizeProtectHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeSizeProtectHdl, weld::Toggleable&, void)
{
if (m_xTsbSizeProtect->get_sensitive())
{
@@ -1289,7 +1283,7 @@ void SvxPositionSizeTabPage::SetMinMaxPosition()
}
}
- const double fMaxLong(static_cast<double>(vcl::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1));
+ const double fMaxLong(vcl::ConvertValue(std::numeric_limits<sal_Int64>::max(), 0, MapUnit::Map100thMM, meDlgUnit) - 1);
fLeft = std::clamp(fLeft, -fMaxLong, fMaxLong);
fRight = std::clamp(fRight, -fMaxLong, fMaxLong);
fTop = std::clamp(fTop, - fMaxLong, fMaxLong);
@@ -1521,7 +1515,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeWidthHdl, weld::MetricSpinButton&,
return;
sal_Int64 nHeight(basegfx::fround64((mfOldHeight * static_cast<double>(m_xMtrWidth->get_value(FieldUnit::NONE))) / mfOldWidth));
- int nMin, nMax;
+ sal_Int64 nMin, nMax;
m_xMtrHeight->get_range(nMin, nMax, FieldUnit::NONE);
if (nHeight <= nMax)
@@ -1544,7 +1538,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeHeightHdl, weld::MetricSpinButton&
return;
sal_Int64 nWidth(basegfx::fround64((mfOldWidth * static_cast<double>(m_xMtrHeight->get_value(FieldUnit::NONE))) / mfOldHeight));
- int nMin, nMax;
+ sal_Int64 nMin, nMax;
m_xMtrWidth->get_range(nMin, nMax, FieldUnit::NONE);
if (nWidth <= nMax)
@@ -1561,13 +1555,14 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeHeightHdl, weld::MetricSpinButton&
}
}
-IMPL_LINK_NOARG(SvxPositionSizeTabPage, ClickSizeProtectHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxPositionSizeTabPage, ClickSizeProtectHdl, weld::Toggleable&, void)
{
UpdateControlStates();
}
-IMPL_LINK_NOARG(SvxPositionSizeTabPage, ClickAutoHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(SvxPositionSizeTabPage, ClickAutoHdl, weld::Toggleable&, void)
{
+ m_xCbxScaleImg->set_from_icon_name(m_xCbxScale->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED);
if (m_xCbxScale->get_active())
{
mfOldWidth = std::max( static_cast<double>(GetCoreValue( *m_xMtrWidth, mePoolUnit )), 1.0 );
diff --git a/cui/source/util/FontFeatures.cxx b/cui/source/util/FontFeatures.cxx
new file mode 100644
index 000000000000..f50980aabfa7
--- /dev/null
+++ b/cui/source/util/FontFeatures.cxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <FontFeatures.hxx>
+
+std::vector<vcl::font::Feature> getFontFeatureList(OUString const& rFontName, VirtualDevice& rVDev)
+{
+ rVDev.SetOutputSizePixel(Size(10, 10));
+
+ vcl::Font aFont = rVDev.GetFont();
+ aFont.SetFamilyName(rFontName);
+ rVDev.SetFont(aFont);
+
+ std::vector<vcl::font::Feature> vFontFeatures;
+
+ if (!rVDev.GetFontFeatures(vFontFeatures))
+ {
+ vFontFeatures.clear();
+ }
+
+ return vFontFeatures;
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file