summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx308
-rw-r--r--cui/source/customize/CustomNotebookbarGenerator.cxx44
-rw-r--r--cui/source/customize/SvxConfigPageHelper.cxx291
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx277
-rw-r--r--cui/source/customize/SvxNotebookbarConfigPage.cxx133
-rw-r--r--cui/source/customize/SvxToolbarConfigPage.cxx502
-rw-r--r--cui/source/customize/acccfg.cxx170
-rw-r--r--cui/source/customize/cfg.cxx404
-rw-r--r--cui/source/customize/cfgutil.cxx402
-rw-r--r--cui/source/customize/eventdlg.cxx6
-rw-r--r--cui/source/customize/macropg.cxx343
-rw-r--r--cui/source/customize/macropg_impl.hxx3
-rw-r--r--cui/source/dialogs/AdditionsDialog.cxx910
-rw-r--r--cui/source/dialogs/DiagramDialog.cxx95
-rw-r--r--cui/source/dialogs/FontFeaturesDialog.cxx135
-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.cxx41
-rw-r--r--cui/source/dialogs/SignatureLineDialog.cxx8
-rw-r--r--cui/source/dialogs/SignatureLineDialogBase.cxx16
-rw-r--r--cui/source/dialogs/SpellAttrib.hxx32
-rw-r--r--cui/source/dialogs/SpellDialog.cxx266
-rw-r--r--cui/source/dialogs/about.cxx148
-rw-r--r--cui/source/dialogs/colorpicker.cxx198
-rw-r--r--cui/source/dialogs/cuicharmap.cxx1247
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx88
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx62
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx49
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx74
-rw-r--r--cui/source/dialogs/cuiimapwnd.cxx12
-rw-r--r--cui/source/dialogs/cuitbxform.cxx6
-rw-r--r--cui/source/dialogs/dlgname.cxx192
-rw-r--r--cui/source/dialogs/fileextcheckdlg.cxx55
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx82
-rw-r--r--cui/source/dialogs/hldocntp.cxx75
-rw-r--r--cui/source/dialogs/hldoctp.cxx17
-rw-r--r--cui/source/dialogs/hlinettp.cxx159
-rw-r--r--cui/source/dialogs/hlmailtp.cxx20
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx107
-rw-r--r--cui/source/dialogs/hltpbase.cxx112
-rw-r--r--cui/source/dialogs/hyphen.cxx21
-rw-r--r--cui/source/dialogs/iconcdlg.cxx44
-rw-r--r--cui/source/dialogs/insdlg.cxx109
-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/newtabledlg.cxx4
-rw-r--r--cui/source/dialogs/passwdomdlg.cxx186
-rw-r--r--cui/source/dialogs/pastedlg.cxx6
-rw-r--r--cui/source/dialogs/postdlg.cxx44
-rw-r--r--cui/source/dialogs/screenshotannotationdlg.cxx52
-rw-r--r--cui/source/dialogs/scriptdlg.cxx209
-rw-r--r--cui/source/dialogs/sdrcelldlg.cxx52
-rw-r--r--cui/source/dialogs/showcols.cxx34
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx52
-rw-r--r--cui/source/dialogs/srchxtra.cxx96
-rw-r--r--cui/source/dialogs/thesdlg.cxx19
-rw-r--r--cui/source/dialogs/tipofthedaydlg.cxx219
-rw-r--r--cui/source/dialogs/toolbarmodedlg.cxx210
-rw-r--r--cui/source/dialogs/whatsnew.cxx172
-rw-r--r--cui/source/dialogs/widgettestdlg.cxx57
-rw-r--r--cui/source/dialogs/zoom.cxx43
-rw-r--r--cui/source/factory/cuiexp.cxx46
-rw-r--r--cui/source/factory/cuiresmgr.cxx5
-rw-r--r--cui/source/factory/dlgfact.cxx569
-rw-r--r--cui/source/factory/dlgfact.hxx739
-rw-r--r--cui/source/factory/init.cxx7
-rw-r--r--cui/source/inc/AdditionsDialog.hxx172
-rw-r--r--cui/source/inc/CommandCategoryListBox.hxx50
-rw-r--r--cui/source/inc/CustomNotebookbarGenerator.hxx4
-rw-r--r--cui/source/inc/DiagramDialog.hxx15
-rw-r--r--cui/source/inc/FontFeatures.hxx17
-rw-r--r--cui/source/inc/FontFeaturesDialog.hxx29
-rw-r--r--cui/source/inc/GraphicsTestsDialog.hxx54
-rw-r--r--cui/source/inc/ImageViewerDialog.hxx20
-rw-r--r--cui/source/inc/QrCodeGenDialog.hxx25
-rw-r--r--cui/source/inc/SignSignatureLineDialog.hxx8
-rw-r--r--cui/source/inc/SignatureLineDialog.hxx9
-rw-r--r--cui/source/inc/SignatureLineDialogBase.hxx14
-rw-r--r--cui/source/inc/SpellDialog.hxx31
-rw-r--r--cui/source/inc/SvxConfigPageHelper.hxx77
-rw-r--r--cui/source/inc/SvxMenuConfigPage.hxx47
-rw-r--r--cui/source/inc/SvxNotebookbarConfigPage.hxx6
-rw-r--r--cui/source/inc/SvxToolbarConfigPage.hxx53
-rw-r--r--cui/source/inc/TextColumnsPage.hxx40
-rw-r--r--cui/source/inc/about.hxx11
-rw-r--r--cui/source/inc/acccfg.hxx7
-rw-r--r--cui/source/inc/align.hxx24
-rw-r--r--cui/source/inc/autocdlg.hxx28
-rw-r--r--cui/source/inc/backgrnd.hxx22
-rw-r--r--cui/source/inc/bbdlg.hxx7
-rw-r--r--cui/source/inc/border.hxx27
-rw-r--r--cui/source/inc/cfg.hxx73
-rw-r--r--cui/source/inc/cfgutil.hxx39
-rw-r--r--cui/source/inc/chardlg.hxx62
-rw-r--r--cui/source/inc/connect.hxx11
-rw-r--r--cui/source/inc/cuifmsearch.hxx63
-rw-r--r--cui/source/inc/cuigaldlg.hxx21
-rw-r--r--cui/source/inc/cuigrfflt.hxx11
-rw-r--r--cui/source/inc/cuihyperdlg.hxx37
-rw-r--r--cui/source/inc/cuiimapwnd.hxx5
-rw-r--r--cui/source/inc/cuioptgenrl.hxx13
-rw-r--r--cui/source/inc/cuisrchdlg.hxx5
-rw-r--r--cui/source/inc/cuitabarea.hxx114
-rw-r--r--cui/source/inc/cuitabline.hxx30
-rw-r--r--cui/source/inc/cuitbxform.hxx5
-rw-r--r--cui/source/inc/dbregister.hxx12
-rw-r--r--cui/source/inc/defdlgname.hxx5
-rw-r--r--cui/source/inc/dialmgr.hxx3
-rw-r--r--cui/source/inc/dlgname.hxx125
-rw-r--r--cui/source/inc/dstribut.hxx72
-rw-r--r--cui/source/inc/fileextcheckdlg.hxx39
-rw-r--r--cui/source/inc/grfpage.hxx33
-rw-r--r--cui/source/inc/hangulhanjadlg.hxx18
-rw-r--r--cui/source/inc/headertablistbox.hxx11
-rw-r--r--cui/source/inc/helpids.h54
-rw-r--r--cui/source/inc/hldocntp.hxx10
-rw-r--r--cui/source/inc/hldoctp.hxx9
-rw-r--r--cui/source/inc/hlinettp.hxx37
-rw-r--r--cui/source/inc/hlmailtp.hxx12
-rw-r--r--cui/source/inc/hlmarkwn.hxx11
-rw-r--r--cui/source/inc/hlmarkwn_def.hxx11
-rw-r--r--cui/source/inc/hltpbase.hxx12
-rw-r--r--cui/source/inc/hyphen.hxx9
-rw-r--r--cui/source/inc/iconcdlg.hxx38
-rw-r--r--cui/source/inc/insdlg.hxx15
-rw-r--r--cui/source/inc/insrc.hxx24
-rw-r--r--cui/source/inc/labdlg.hxx13
-rw-r--r--cui/source/inc/linkdlg.hxx36
-rw-r--r--cui/source/inc/macroass.hxx6
-rw-r--r--cui/source/inc/macropg.hxx27
-rw-r--r--cui/source/inc/measure.hxx13
-rw-r--r--cui/source/inc/multipat.hxx19
-rw-r--r--cui/source/inc/newtabledlg.hxx17
-rw-r--r--cui/source/inc/numfmt.hxx22
-rw-r--r--cui/source/inc/numpages.hxx39
-rw-r--r--cui/source/inc/optasian.hxx22
-rw-r--r--cui/source/inc/optdict.hxx10
-rw-r--r--cui/source/inc/optlingu.hxx16
-rw-r--r--cui/source/inc/optpath.hxx15
-rw-r--r--cui/source/inc/page.hxx45
-rw-r--r--cui/source/inc/paragrph.hxx93
-rw-r--r--cui/source/inc/passwdomdlg.hxx14
-rw-r--r--cui/source/inc/pastedlg.hxx5
-rw-r--r--cui/source/inc/postdlg.hxx13
-rw-r--r--cui/source/inc/screenshotannotationdlg.hxx11
-rw-r--r--cui/source/inc/scriptdlg.hxx24
-rw-r--r--cui/source/inc/sdrcelldlg.hxx11
-rw-r--r--cui/source/inc/securityoptions.hxx (renamed from cui/source/options/securityoptions.hxx)31
-rw-r--r--cui/source/inc/showcols.hxx5
-rw-r--r--cui/source/inc/splitcelldlg.hxx35
-rw-r--r--cui/source/inc/srchxtra.hxx9
-rw-r--r--cui/source/inc/swpossizetabpage.hxx24
-rw-r--r--cui/source/inc/tabstpge.hxx15
-rw-r--r--cui/source/inc/textanim.hxx17
-rw-r--r--cui/source/inc/textattr.hxx15
-rw-r--r--cui/source/inc/thesdlg.hxx10
-rw-r--r--cui/source/inc/tipofthedaydlg.hxx20
-rw-r--r--cui/source/inc/toolbarmodedlg.hxx37
-rw-r--r--cui/source/inc/transfrm.hxx34
-rw-r--r--cui/source/inc/treeopt.hxx111
-rw-r--r--cui/source/inc/whatsnew.hxx79
-rw-r--r--cui/source/inc/zoom.hxx11
-rw-r--r--cui/source/options/certpath.cxx12
-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.cxx76
-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.cxx144
-rw-r--r--cui/source/options/fontsubs.hxx13
-rw-r--r--cui/source/options/optaboutconfig.cxx1128
-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.cxx99
-rw-r--r--cui/source/options/optbasic.cxx23
-rw-r--r--cui/source/options/optbasic.hxx8
-rw-r--r--cui/source/options/optchart.cxx53
-rw-r--r--cui/source/options/optchart.hxx9
-rw-r--r--cui/source/options/optcolor.cxx457
-rw-r--r--cui/source/options/optcolor.hxx13
-rw-r--r--cui/source/options/optctl.cxx46
-rw-r--r--cui/source/options/optctl.hxx10
-rw-r--r--cui/source/options/optdeepl.cxx78
-rw-r--r--cui/source/options/optdeepl.hxx39
-rw-r--r--cui/source/options/optdict.cxx72
-rw-r--r--cui/source/options/optfltr.cxx333
-rw-r--r--cui/source/options/optfltr.hxx24
-rw-r--r--cui/source/options/optgdlg.cxx1019
-rw-r--r--cui/source/options/optgdlg.hxx99
-rw-r--r--cui/source/options/optgenrl.cxx108
-rw-r--r--cui/source/options/opthtml.cxx210
-rw-r--r--cui/source/options/opthtml.hxx24
-rw-r--r--cui/source/options/optinet2.cxx328
-rw-r--r--cui/source/options/optinet2.hxx43
-rw-r--r--cui/source/options/optjava.cxx181
-rw-r--r--cui/source/options/optjava.hxx12
-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.cxx384
-rw-r--r--cui/source/options/optopencl.cxx19
-rw-r--r--cui/source/options/optopencl.hxx2
-rw-r--r--cui/source/options/optpath.cxx220
-rw-r--r--cui/source/options/optsave.cxx246
-rw-r--r--cui/source/options/optsave.hxx22
-rw-r--r--cui/source/options/optupdt.cxx376
-rw-r--r--cui/source/options/optupdt.hxx27
-rw-r--r--cui/source/options/personalization.cxx66
-rw-r--r--cui/source/options/personalization.hxx9
-rw-r--r--cui/source/options/sdbcdriverenum.cxx11
-rw-r--r--cui/source/options/sdbcdriverenum.hxx8
-rw-r--r--cui/source/options/securityoptions.cxx107
-rw-r--r--cui/source/options/treeopt.cxx1397
-rw-r--r--cui/source/options/treeopthelper.cxx184
-rw-r--r--cui/source/options/tsaurls.cxx32
-rw-r--r--cui/source/options/tsaurls.hxx5
-rw-r--r--cui/source/options/webconninfo.cxx15
-rw-r--r--cui/source/options/webconninfo.hxx5
-rw-r--r--cui/source/tabpages/TextColumnsPage.cxx82
-rw-r--r--cui/source/tabpages/align.cxx163
-rw-r--r--cui/source/tabpages/autocdlg.cxx310
-rw-r--r--cui/source/tabpages/backgrnd.cxx241
-rw-r--r--cui/source/tabpages/bbdlg.cxx13
-rw-r--r--cui/source/tabpages/border.cxx416
-rw-r--r--cui/source/tabpages/chardlg.cxx691
-rw-r--r--cui/source/tabpages/chardlg.h5
-rw-r--r--cui/source/tabpages/connect.cxx80
-rw-r--r--cui/source/tabpages/dstribut.cxx152
-rw-r--r--cui/source/tabpages/grfpage.cxx320
-rw-r--r--cui/source/tabpages/labdlg.cxx35
-rw-r--r--cui/source/tabpages/macroass.cxx41
-rw-r--r--cui/source/tabpages/measure.cxx57
-rw-r--r--cui/source/tabpages/numfmt.cxx215
-rw-r--r--cui/source/tabpages/numpages.cxx864
-rw-r--r--cui/source/tabpages/page.cxx359
-rw-r--r--cui/source/tabpages/paragrph.cxx1037
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx308
-rw-r--r--cui/source/tabpages/tabarea.cxx74
-rw-r--r--cui/source/tabpages/tabline.cxx14
-rw-r--r--cui/source/tabpages/tabstpge.cxx48
-rw-r--r--cui/source/tabpages/textanim.cxx48
-rw-r--r--cui/source/tabpages/textattr.cxx129
-rw-r--r--cui/source/tabpages/tparea.cxx187
-rw-r--r--cui/source/tabpages/tpbitmap.cxx127
-rw-r--r--cui/source/tabpages/tpcolor.cxx196
-rw-r--r--cui/source/tabpages/tpgradnt.cxx174
-rw-r--r--cui/source/tabpages/tphatch.cxx56
-rw-r--r--cui/source/tabpages/tpline.cxx232
-rw-r--r--cui/source/tabpages/tplnedef.cxx45
-rw-r--r--cui/source/tabpages/tplneend.cxx31
-rw-r--r--cui/source/tabpages/tppattern.cxx49
-rw-r--r--cui/source/tabpages/tpshadow.cxx82
-rw-r--r--cui/source/tabpages/tptrans.cxx108
-rw-r--r--cui/source/tabpages/transfrm.cxx204
-rw-r--r--cui/source/util/FontFeatures.cxx30
267 files changed, 16704 insertions, 12510 deletions
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index d9e3f57b1352..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>
@@ -51,39 +52,36 @@
#include <cfg.hxx> //for SaveInData
CommandCategoryListBox::CommandCategoryListBox(std::unique_ptr<weld::ComboBox> xControl)
- : pStylesInfo( nullptr )
+ : pStylesInfo(nullptr)
, m_xControl(std::move(xControl))
{
//Initialize search util
m_searchOptions.AlgorithmType2 = css::util::SearchAlgorithms2::ABSOLUTE;
m_searchOptions.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
m_searchOptions.searchFlag |= (css::util::SearchFlags::REG_NOT_BEGINOFLINE
- | css::util::SearchFlags::REG_NOT_ENDOFLINE);
+ | css::util::SearchFlags::REG_NOT_ENDOFLINE);
}
-CommandCategoryListBox::~CommandCategoryListBox()
-{
- ClearAll();
-}
+CommandCategoryListBox::~CommandCategoryListBox() { ClearAll(); }
void CommandCategoryListBox::ClearAll()
{
// Clear objects from m_aGroupInfo vector to avoid memory leak
- for (const auto & It : m_aGroupInfo)
+ for (const auto& It : m_aGroupInfo)
{
- if ( It->nKind == SfxCfgKind::GROUP_STYLES && It->pObject )
+ if (It->nKind == SfxCfgKind::GROUP_STYLES && It->pObject)
{
SfxStyleInfo_Impl* pStyle = static_cast<SfxStyleInfo_Impl*>(It->pObject);
delete pStyle;
}
- else if ( It->nKind == SfxCfgKind::FUNCTION_SCRIPT && It->pObject )
+ else if (It->nKind == SfxCfgKind::FUNCTION_SCRIPT && It->pObject)
{
OUString* pScriptURI = static_cast<OUString*>(It->pObject);
delete pScriptURI;
}
- else if ( It->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER && It->pObject)
+ else if (It->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER && It->pObject)
{
- css::uno::XInterface* xi = static_cast<css::uno::XInterface *>(It->pObject);
+ css::uno::XInterface* xi = static_cast<css::uno::XInterface*>(It->pObject);
if (xi != nullptr)
{
xi->release();
@@ -95,10 +93,9 @@ void CommandCategoryListBox::ClearAll()
m_xControl->clear();
}
-void CommandCategoryListBox::Init(
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::frame::XFrame >& xFrame,
- const OUString& sModuleLongName)
+void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponentContext>& xContext,
+ const css::uno::Reference<css::frame::XFrame>& xFrame,
+ const OUString& sModuleLongName)
{
// User will not see incomplete UI
m_xControl->freeze();
@@ -108,9 +105,10 @@ void CommandCategoryListBox::Init(
m_xFrame = xFrame;
m_sModuleLongName = sModuleLongName;
- m_xGlobalCategoryInfo = css::ui::theUICategoryDescription::get( m_xContext );
- m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
- m_xUICmdDescription = css::frame::theUICommandDescription::get( m_xContext );
+ m_xGlobalCategoryInfo = css::ui::theUICategoryDescription::get(m_xContext);
+ m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName),
+ css::uno::UNO_QUERY_THROW);
+ m_xUICmdDescription = css::frame::theUICommandDescription::get(m_xContext);
// Support style commands
css::uno::Reference<css::frame::XController> xController;
@@ -125,16 +123,19 @@ void CommandCategoryListBox::Init(
try
{
- css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW);
- css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups();
+ css::uno::Reference<css::frame::XDispatchInformationProvider> xProvider(
+ m_xFrame, css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence<sal_Int16> lGroups = xProvider->getSupportedCommandGroups();
sal_Int32 nGroupsLength = lGroups.getLength();
- if ( nGroupsLength > 0 )
+ if (nGroupsLength > 0)
{
// 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_aGroupInfo.push_back(
+ std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
+ CuiResId(RID_CUISTR_ALLFUNCTIONS));
}
// Separate the "All commands"category from the actual categories
@@ -146,9 +147,9 @@ void CommandCategoryListBox::Init(
// Add the actual categories
for (sal_Int32 i = 0; i < nGroupsLength; ++i)
{
- sal_Int16 nGroupID = lGroups[i];
- OUString sGroupID = OUString::number(nGroupID);
- OUString sGroupName;
+ sal_Int16 nGroupID = lGroups[i];
+ OUString sGroupID = OUString::number(nGroupID);
+ OUString sGroupName;
try
{
@@ -156,7 +157,7 @@ void CommandCategoryListBox::Init(
if (sGroupName.isEmpty())
continue;
}
- catch(const css::container::NoSuchElementException&)
+ catch (const css::container::NoSuchElementException&)
{
continue;
}
@@ -168,16 +169,18 @@ void CommandCategoryListBox::Init(
Application::GetSettings().GetUILanguageTag().getLocale());
std::sort(aCategories.begin(), aCategories.end(),
- [&sort](const str_id& a, const str_id& b)
- { return sort.compare(a.first, b.first) < 0; });
+ [&sort](const str_id& a, const str_id& b) {
+ return sort.compare(a.first, b.first) < 0;
+ });
// Add the actual categories
- for (const auto &a : aCategories)
+ for (const auto& a : aCategories)
{
const OUString& rGroupName = a.first;
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_aGroupInfo.push_back(
+ std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_FUNCTION, nGroupID));
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()), rGroupName);
}
// Separate regular commands from styles and macros
@@ -185,19 +188,23 @@ void CommandCategoryListBox::Init(
// 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));
+ std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, nullptr));
+ 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));
+ std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, nullptr));
+ m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
+ CuiResId(RID_CUISTR_GROUP_STYLES));
+ }
+ catch (const css::uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch (const css::uno::Exception&)
+ {
}
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- {}
// Reveal the updated UI to user
m_xControl->thaw();
@@ -206,31 +213,36 @@ void CommandCategoryListBox::Init(
void CommandCategoryListBox::FillFunctionsList(
const css::uno::Sequence<css::frame::DispatchInformation>& xCommands,
- CuiConfigFunctionListBox* pFunctionListBox,
- const OUString& filterTerm,
- SaveInData *pCurrentSaveInData )
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
+ SaveInData* pCurrentSaveInData)
{
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
- utl::TextSearch textSearch( m_searchOptions );
+ utl::TextSearch textSearch(m_searchOptions);
+ const bool bInExperimentalMode = officecfg::Office::Common::Misc::ExperimentalMode::get();
- for (const auto & rInfo : xCommands)
+ for (const auto& rInfo : xCommands)
{
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rInfo.Command, m_sModuleLongName);
+ auto aProperties
+ = vcl::CommandInfoProvider::GetCommandProperties(rInfo.Command, m_sModuleLongName);
- OUString sUIName = getCommandName(rInfo.Command);
- OUString sLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
- OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(rInfo.Command, aProperties, m_xFrame);
- OUString sPopupLabel =
- (vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties))
- .replaceFirst("~", "");
+ OUString sUIName = getCommandName(rInfo.Command);
+ OUString sLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+ OUString sTooltipLabel
+ = 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;
}
@@ -239,12 +251,12 @@ void CommandCategoryListBox::FillFunctionsList(
if (pCurrentSaveInData)
xImage = pCurrentSaveInData->GetImage(rInfo.Command);
- m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
+ m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::FUNCTION_SLOT, 0));
SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
pGrpInfo->sCommand = rInfo.Command;
- pGrpInfo->sLabel = sUIName;
+ 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);
}
}
@@ -253,7 +265,7 @@ OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
OUString sUIName;
try
{
- css::uno::Reference< css::container::XNameAccess > xModuleConf;
+ css::uno::Reference<css::container::XNameAccess> xModuleConf;
m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
if (xModuleConf.is())
{
@@ -261,10 +273,14 @@ OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
sUIName = lProps.getUnpackedValueOrDefault("Name", OUString());
}
}
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(css::uno::Exception&)
- { sUIName.clear(); }
+ catch (const css::uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch (css::uno::Exception&)
+ {
+ sUIName.clear();
+ }
// fallback for missing UINames !?
if (sUIName.isEmpty())
@@ -276,39 +292,41 @@ OUString CommandCategoryListBox::getCommandName(const OUString& sCommand)
}
void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctionListBox,
- const OUString& filterTerm, SaveInData *pCurrentSaveInData)
+ 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();
- switch ( pInfo->nKind )
+ switch (pInfo->nKind)
{
case SfxCfgKind::GROUP_ALLFUNCTIONS:
{
- css::uno::Reference< css::frame::XDispatchInformationProvider >
- xProvider( m_xFrame, css::uno::UNO_QUERY );
+ css::uno::Reference<css::frame::XDispatchInformationProvider> xProvider(
+ m_xFrame, css::uno::UNO_QUERY);
sal_Int32 nEntryCount = m_xControl->get_count();
for (sal_Int32 nCurPos = 0; nCurPos < nEntryCount; ++nCurPos)
{
- SfxGroupInfo_Impl *pCurrentInfo =
- reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos).toInt64());
+ SfxGroupInfo_Impl* pCurrentInfo
+ = weld::fromId<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos));
if (!pCurrentInfo) //separator
continue;
if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
{
- css::uno::Sequence< css::frame::DispatchInformation > lCommands;
+ css::uno::Sequence<css::frame::DispatchInformation> lCommands;
try
{
lCommands = xProvider->getConfigurableDispatchInformation(
- pCurrentInfo->nUniqueID );
- FillFunctionsList( lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData );
+ pCurrentInfo->nUniqueID);
+ FillFunctionsList(lCommands, pFunctionListBox, filterTerm,
+ pCurrentSaveInData);
}
- catch( css::container::NoSuchElementException& )
+ catch (css::container::NoSuchElementException&)
{
}
}
@@ -319,56 +337,59 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
case SfxCfgKind::GROUP_FUNCTION:
{
sal_uInt16 nGroup = pInfo->nUniqueID;
- css::uno::Reference< css::frame::XDispatchInformationProvider >
- xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
- css::uno::Sequence< css::frame::DispatchInformation > lCommands =
- xProvider->getConfigurableDispatchInformation(nGroup);
- FillFunctionsList( lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData );
+ css::uno::Reference<css::frame::XDispatchInformationProvider> xProvider(
+ m_xFrame, css::uno::UNO_QUERY_THROW);
+ css::uno::Sequence<css::frame::DispatchInformation> lCommands
+ = xProvider->getConfigurableDispatchInformation(nGroup);
+ FillFunctionsList(lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData);
break;
}
case SfxCfgKind::GROUP_SCRIPTCONTAINER: //Macros
{
SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
// Add Scripting Framework entries
- css::uno::Reference< css::script::browse::XBrowseNode > rootNode;
+ css::uno::Reference<css::script::browse::XBrowseNode> rootNode;
try
{
- css::uno::Reference< css::script::browse::XBrowseNodeFactory > xFac
- = css::script::browse::theBrowseNodeFactory::get( m_xContext );
- rootNode.set( xFac->createView( css::script::browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
+ css::uno::Reference<css::script::browse::XBrowseNodeFactory> xFac
+ = css::script::browse::theBrowseNodeFactory::get(m_xContext);
+ rootNode.set(xFac->createView(
+ css::script::browse::BrowseNodeFactoryViewTypes::MACROSELECTOR));
}
- catch( css::uno::Exception const & )
+ catch (css::uno::Exception const&)
{
- TOOLS_WARN_EXCEPTION("cui.customize", "Caught some exception whilst retrieving browse nodes from factory");
+ TOOLS_WARN_EXCEPTION(
+ "cui.customize",
+ "Caught some exception whilst retrieving browse nodes from factory");
// TODO exception handling
}
- if ( rootNode.is() && rootNode->hasChildNodes() )
+ if (rootNode.is() && rootNode->hasChildNodes())
{
//We call acquire on the XBrowseNode so that it does not
//get autodestructed and become invalid when accessed later.
rootNode->acquire();
- m_aGroupInfo.push_back(
- std::make_unique<SfxGroupInfo_Impl>(
- SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, static_cast<void *>(rootNode.get()) ) );
+ m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
+ SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, static_cast<void*>(rootNode.get())));
// Add main macro groups
- const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> aChildNodes = rootNode->getChildNodes();
- for ( auto const & childGroup : aChildNodes )
+ const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>>
+ aChildNodes = rootNode->getChildNodes();
+ for (auto const& childGroup : aChildNodes)
{
- OUString sUIName;
childGroup->acquire();
- if ( childGroup->hasChildNodes() )
+ if (childGroup->hasChildNodes())
{
- if ( childGroup->getName() == "user" )
+ OUString sUIName;
+ if (childGroup->getName() == "user")
{
- sUIName = CuiResId( RID_SVXSTR_MYMACROS );
+ sUIName = CuiResId(RID_CUISTR_MYMACROS);
}
- else if ( childGroup->getName() == "share" )
+ else if (childGroup->getName() == "share")
{
- sUIName = CuiResId( RID_SVXSTR_PRODMACROS );
+ sUIName = CuiResId(RID_CUISTR_PRODMACROS);
}
else
{
@@ -380,10 +401,10 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
continue;
}
- 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));
+ m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
+ SfxCfgKind::GROUP_SCRIPTCONTAINER, 0));
+ std::unique_ptr<weld::TreeIter> xMacroGroup(pFunctionListBox->tree_append(
+ weld::toId(m_aGroupInfo.back().get()), sUIName));
{
// tdf#128010: Do not nag user asking to enable JRE: if it's disabled,
@@ -412,28 +433,29 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
}
case SfxCfgKind::GROUP_STYLES:
{
- const std::vector< SfxStyleInfo_Impl > lStyleFamilies = pStylesInfo->getStyleFamilies();
+ const std::vector<SfxStyleInfo_Impl> lStyleFamilies = pStylesInfo->getStyleFamilies();
- for ( const auto & pIt : lStyleFamilies )
+ for (const auto& pIt : lStyleFamilies)
{
- if ( pIt.sLabel.isEmpty() )
+ if (pIt.sLabel.isEmpty())
{
continue;
}
-
- m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0 ) );
+ m_aGroupInfo.push_back(
+ 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));
+ std::unique_ptr<weld::TreeIter> xFuncEntry(pFunctionListBox->tree_append(
+ weld::toId(m_aGroupInfo.back().get()), pIt.sLabel));
- const std::vector< SfxStyleInfo_Impl > lStyles = pStylesInfo->getStyles(pIt.sFamily);
+ const std::vector<SfxStyleInfo_Impl> lStyles = pStylesInfo->getStyles(pIt.sFamily);
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
- utl::TextSearch textSearch( m_searchOptions );
+ utl::TextSearch textSearch(m_searchOptions);
// Insert children (styles)
- for ( const auto & pStyleIt : lStyles )
+ for (const auto& pStyleIt : lStyles)
{
OUString sUIName = pStyleIt.sLabel;
sal_Int32 aStartPos = 0;
@@ -441,7 +463,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
// Apply the search filter
if (!filterTerm.isEmpty()
- && !textSearch.SearchForward( sUIName, &aStartPos, &aEndPos ) )
+ && !textSearch.SearchForward(sUIName, &aStartPos, &aEndPos))
{
continue;
}
@@ -449,13 +471,13 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(pStyleIt);
m_aGroupInfo.push_back(
- std::make_unique<SfxGroupInfo_Impl>(
- SfxCfgKind::GROUP_STYLES, 0, pStyle ) );
+ std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, pStyle));
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
@@ -473,7 +495,8 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
}
default:
// Do nothing, the list box will stay empty
- SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind) );
+ SAL_INFO("cui.customize",
+ "Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind));
break;
}
@@ -487,22 +510,21 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
pFunctionListBox->expand_row(*it);
}
-void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
-{
- pStylesInfo = pStyles;
-}
+void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles) { pStylesInfo = pStyles; }
void CommandCategoryListBox::addChildren(
- const weld::TreeIter* parentEntry, const css::uno::Reference< css::script::browse::XBrowseNode > &parentNode,
- CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm , SaveInData *pCurrentSaveInData,
- std::vector<std::unique_ptr<weld::TreeIter>> &rNodesToExpand)
+ const weld::TreeIter* parentEntry,
+ const css::uno::Reference<css::script::browse::XBrowseNode>& parentNode,
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
+ SaveInData* pCurrentSaveInData, std::vector<std::unique_ptr<weld::TreeIter>>& rNodesToExpand)
{
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
- utl::TextSearch textSearch( m_searchOptions );
+ utl::TextSearch textSearch(m_searchOptions);
- const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> aChildNodes = parentNode->getChildNodes();
- for (auto const & child : aChildNodes)
+ const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> aChildNodes
+ = parentNode->getChildNodes();
+ for (auto const& child : aChildNodes)
{
// Acquire to prevent auto-destruction
child->acquire();
@@ -511,11 +533,13 @@ void CommandCategoryListBox::addChildren(
{
OUString sUIName = child->getName();
- 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));
+ 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(
+ weld::toId(m_aGroupInfo.back().get()), sUIName, parentEntry));
- addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, pCurrentSaveInData, rNodesToExpand);
+ addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, pCurrentSaveInData,
+ rNodesToExpand);
// Remove the group if empty
if (!pFunctionListBox->iter_has_child(*xNewEntry))
@@ -523,7 +547,7 @@ void CommandCategoryListBox::addChildren(
else
rNodesToExpand.emplace_back(std::move(xNewEntry));
}
- else if ( child->getType() == css::script::browse::BrowseNodeTypes::SCRIPT )
+ else if (child->getType() == css::script::browse::BrowseNodeTypes::SCRIPT)
{
// Prepare for filtering
OUString sUIName = child->getName();
@@ -531,15 +555,14 @@ void CommandCategoryListBox::addChildren(
sal_Int32 aEndPos = sUIName.getLength();
// Apply the search filter
- if (!filterTerm.isEmpty()
- && !textSearch.SearchForward( sUIName, &aStartPos, &aEndPos ) )
+ if (!filterTerm.isEmpty() && !textSearch.SearchForward(sUIName, &aStartPos, &aEndPos))
{
continue;
}
OUString uri, description;
- css::uno::Reference < css::beans::XPropertySet >xPropSet( child, css::uno::UNO_QUERY );
+ css::uno::Reference<css::beans::XPropertySet> xPropSet(child, css::uno::UNO_QUERY);
if (!xPropSet.is())
{
@@ -554,26 +577,29 @@ void CommandCategoryListBox::addChildren(
value = xPropSet->getPropertyValue("Description");
value >>= description;
}
- catch (css::uno::Exception &) {
+ catch (css::uno::Exception&)
+ {
// do nothing, the description will be empty
}
if (description.isEmpty())
{
- description = CuiResId( RID_SVXSTR_NOMACRODESC );
+ description = CuiResId(RID_CUISTR_NOMACRODESC);
}
- OUString* pScriptURI = new OUString( uri );
+ OUString* pScriptURI = new OUString(uri);
css::uno::Reference<css::graphic::XGraphic> xImage;
if (pCurrentSaveInData)
xImage = pCurrentSaveInData->GetImage(uri);
- m_aGroupInfo.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
+ m_aGroupInfo.push_back(
+ std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI));
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 89310849537a..1d013654d8f7 100644
--- a/cui/source/customize/CustomNotebookbarGenerator.cxx
+++ b/cui/source/customize/CustomNotebookbarGenerator.cxx
@@ -23,12 +23,13 @@
#include <CustomNotebookbarGenerator.hxx>
#include <osl/file.hxx>
#include <osl/thread.h>
-#include <vcl/builder.hxx>
#include <vcl/EnumContext.hxx>
+#include <vcl/settings.hxx>
#include <sfx2/viewfrm.hxx>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <unotools/confignode.hxx>
#include <libxml/parser.h>
+#include <o3tl/string_view.hxx>
#define aUIPropertiesCount 3
@@ -42,19 +43,14 @@ static OUString lcl_activeAppName(vcl::EnumContext::Application eApp)
{
case vcl::EnumContext::Application::Writer:
return "ActiveWriter";
- break;
case vcl::EnumContext::Application::Calc:
return "ActiveCalc";
- break;
case vcl::EnumContext::Application::Impress:
return "ActiveImpress";
- break;
case vcl::EnumContext::Application::Draw:
return "ActiveDraw";
- break;
default:
return OUString();
- break;
}
}
@@ -64,30 +60,28 @@ static OUString lcl_getAppName(vcl::EnumContext::Application eApp)
{
case vcl::EnumContext::Application::Writer:
return "Writer";
- break;
case vcl::EnumContext::Application::Calc:
return "Calc";
- break;
case vcl::EnumContext::Application::Impress:
return "Impress";
- break;
case vcl::EnumContext::Application::Draw:
return "Draw";
- break;
default:
return OUString();
- break;
}
}
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;
@@ -113,7 +107,7 @@ OUString CustomNotebookbarGenerator::getOriginalUIPath()
{
OUString sAppName, sNotebookbarUIFileName;
CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sNotebookbarUIFileName);
- return VclBuilderContainer::getUIRootDir() + "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"
+ return AllSettings::GetUIRootDir() + "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"
+ sNotebookbarUIFileName;
}
@@ -190,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],
@@ -267,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 ffe288506508..59a2cdb64017 100644
--- a/cui/source/customize/SvxConfigPageHelper.cxx
+++ b/cui/source/customize/SvxConfigPageHelper.cxx
@@ -19,97 +19,86 @@
#include <SvxConfigPageHelper.hxx>
-#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/ui/ImageType.hpp>
#include <com/sun/star/ui/ItemType.hpp>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/random.hxx>
-#include <comphelper/processfactory.hxx>
#include <svtools/imgdef.hxx>
#include <svtools/miscopt.hxx>
-static sal_Int16 theImageType =
- css::ui::ImageType::COLOR_NORMAL |
- css::ui::ImageType::SIZE_DEFAULT;
+static sal_Int16 theImageType = css::ui::ImageType::COLOR_NORMAL | css::ui::ImageType::SIZE_DEFAULT;
-void SvxConfigPageHelper::RemoveEntry( SvxEntries* pEntries, SvxConfigEntry const * pChildEntry )
+void SvxConfigPageHelper::RemoveEntry(SvxEntries* pEntries, SvxConfigEntry const* pChildEntry)
{
SvxEntries::iterator iter = pEntries->begin();
- while ( iter != pEntries->end() )
+ while (iter != pEntries->end())
{
- if ( pChildEntry == *iter )
+ if (pChildEntry == *iter)
{
- pEntries->erase( iter );
+ pEntries->erase(iter);
break;
}
++iter;
}
}
-OUString SvxConfigPageHelper::replaceSaveInName( const OUString& rMessage, const OUString& rSaveInName )
+OUString SvxConfigPageHelper::replaceSaveInName(const OUString& rMessage,
+ std::u16string_view rSaveInName)
{
OUString name = rMessage.replaceFirst("%SAVE IN SELECTION%", rSaveInName);
return name;
}
-OUString SvxConfigPageHelper::stripHotKey( const OUString& str )
-{
- return str.replaceFirst("~", "");
-}
+OUString SvxConfigPageHelper::stripHotKey(const OUString& str) { return str.replaceFirst("~", ""); }
-OUString SvxConfigPageHelper::replaceSixteen( const OUString& str, sal_Int32 nReplacement )
+OUString SvxConfigPageHelper::replaceSixteen(const OUString& str, sal_Int32 nReplacement)
{
- return str.replaceAll( OUString::number( 16 ), OUString::number( nReplacement ));
+ return str.replaceAll(OUString::number(16), OUString::number(nReplacement));
}
-sal_Int16 SvxConfigPageHelper::GetImageType()
-{
- return theImageType;
-}
+sal_Int16 SvxConfigPageHelper::GetImageType() { return theImageType; }
void SvxConfigPageHelper::InitImageType()
{
- theImageType =
- css::ui::ImageType::COLOR_NORMAL |
- css::ui::ImageType::SIZE_DEFAULT;
+ 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;
}
}
-css::uno::Reference< css::graphic::XGraphic > SvxConfigPageHelper::GetGraphic(
- const css::uno::Reference< css::ui::XImageManager >& xImageManager,
- const OUString& rCommandURL )
+css::uno::Reference<css::graphic::XGraphic>
+SvxConfigPageHelper::GetGraphic(const css::uno::Reference<css::ui::XImageManager>& xImageManager,
+ const OUString& rCommandURL)
{
- css::uno::Reference< css::graphic::XGraphic > result;
+ css::uno::Reference<css::graphic::XGraphic> result;
- if ( xImageManager.is() )
+ if (xImageManager.is())
{
// TODO handle large graphics
- css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > > aGraphicSeq;
+ css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq;
- css::uno::Sequence<OUString> aImageCmdSeq { rCommandURL };
+ css::uno::Sequence<OUString> aImageCmdSeq{ rCommandURL };
try
{
- aGraphicSeq =
- xImageManager->getImages( GetImageType(), aImageCmdSeq );
+ aGraphicSeq = xImageManager->getImages(GetImageType(), aImageCmdSeq);
- if ( aGraphicSeq.hasElements() )
+ if (aGraphicSeq.hasElements())
{
- result = aGraphicSeq[0];
+ result = aGraphicSeq[0];
}
}
- catch ( css::uno::Exception& )
+ catch (css::uno::Exception&)
{
// will return empty XGraphic
}
@@ -118,22 +107,19 @@ css::uno::Reference< css::graphic::XGraphic > SvxConfigPageHelper::GetGraphic(
return result;
}
-OUString
-SvxConfigPageHelper::generateCustomName(
- const OUString& prefix,
- SvxEntries* entries,
- sal_Int32 suffix /*= 1*/ )
+OUString SvxConfigPageHelper::generateCustomName(const OUString& prefix, SvxEntries* entries,
+ sal_Int32 suffix /*= 1*/)
{
OUString name;
sal_Int32 pos = 0;
// find and replace the %n placeholder in the prefix string
- name = prefix.replaceFirst( "%n", OUString::number( suffix ), &pos );
+ name = prefix.replaceFirst("%n", OUString::number(suffix), &pos);
- if ( pos == -1 )
+ if (pos == -1)
{
// no placeholder found so just append the suffix
- name += OUString::number( suffix );
+ name += OUString::number(suffix);
}
if (!entries)
@@ -143,7 +129,7 @@ SvxConfigPageHelper::generateCustomName(
bool bFoundEntry = false;
for (auto const& entry : *entries)
{
- if ( name.equals(entry->GetName()) )
+ if (name.equals(entry->GetName()))
{
bFoundEntry = true;
break;
@@ -153,17 +139,15 @@ SvxConfigPageHelper::generateCustomName(
if (bFoundEntry)
{
// name already exists so try the next number up
- return generateCustomName( prefix, entries, ++suffix );
+ return generateCustomName(prefix, entries, ++suffix);
}
return name;
}
-OUString SvxConfigPageHelper::generateCustomMenuURL(
- SvxEntries* entries,
- sal_Int32 suffix /*= 1*/ )
+OUString SvxConfigPageHelper::generateCustomMenuURL(SvxEntries* entries, sal_Int32 suffix /*= 1*/)
{
- OUString url = "vnd.openoffice.org:CustomMenu" + OUString::number( suffix );
+ OUString url = "vnd.openoffice.org:CustomMenu" + OUString::number(suffix);
if (!entries)
return url;
@@ -171,7 +155,7 @@ OUString SvxConfigPageHelper::generateCustomMenuURL(
bool bFoundEntry = false;
for (auto const& entry : *entries)
{
- if ( url.equals(entry->GetCommand()) )
+ if (url.equals(entry->GetCommand()))
{
bFoundEntry = true;
break;
@@ -181,7 +165,7 @@ OUString SvxConfigPageHelper::generateCustomMenuURL(
if (bFoundEntry)
{
// url already exists so try the next number up
- return generateCustomMenuURL( entries, ++suffix );
+ return generateCustomMenuURL(entries, ++suffix);
}
return url;
@@ -192,17 +176,17 @@ sal_uInt32 SvxConfigPageHelper::generateRandomValue()
return comphelper::rng::uniform_uint_distribution(0, std::numeric_limits<unsigned int>::max());
}
-OUString SvxConfigPageHelper::generateCustomURL( SvxEntries* entries )
+OUString SvxConfigPageHelper::generateCustomURL(SvxEntries* entries)
{
- OUString url = OUStringLiteral(ITEM_TOOLBAR_URL) + CUSTOM_TOOLBAR_STR +
- // use a random number to minimize possible clash with existing custom toolbars
- OUString::number( generateRandomValue(), 16 );
+ 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);
// now check is there is an already existing entry with this url
bool bFoundEntry = false;
for (auto const& entry : *entries)
{
- if ( url.equals(entry->GetCommand()) )
+ if (url.equals(entry->GetCommand()))
{
bFoundEntry = true;
break;
@@ -212,38 +196,38 @@ OUString SvxConfigPageHelper::generateCustomURL( SvxEntries* entries )
if (bFoundEntry)
{
// url already exists so try the next number up
- return generateCustomURL( entries );
+ return generateCustomURL(entries);
}
return url;
}
-OUString SvxConfigPageHelper::GetModuleName( const OUString& aModuleId )
+OUString SvxConfigPageHelper::GetModuleName(std::u16string_view aModuleId)
{
- if ( aModuleId == "com.sun.star.text.TextDocument" ||
- aModuleId == "com.sun.star.text.GlobalDocument" )
+ if (aModuleId == u"com.sun.star.text.TextDocument"
+ || aModuleId == u"com.sun.star.text.GlobalDocument")
return "Writer";
- else if ( aModuleId == "com.sun.star.text.WebDocument" )
+ else if (aModuleId == u"com.sun.star.text.WebDocument")
return "Writer/Web";
- else if ( aModuleId == "com.sun.star.drawing.DrawingDocument" )
+ else if (aModuleId == u"com.sun.star.drawing.DrawingDocument")
return "Draw";
- else if ( aModuleId == "com.sun.star.presentation.PresentationDocument" )
+ else if (aModuleId == u"com.sun.star.presentation.PresentationDocument")
return "Impress";
- else if ( aModuleId == "com.sun.star.sheet.SpreadsheetDocument" )
+ else if (aModuleId == u"com.sun.star.sheet.SpreadsheetDocument")
return "Calc";
- else if ( aModuleId == "com.sun.star.script.BasicIDE" )
+ else if (aModuleId == u"com.sun.star.script.BasicIDE")
return "Basic";
- else if ( aModuleId == "com.sun.star.formula.FormulaProperties" )
+ else if (aModuleId == u"com.sun.star.formula.FormulaProperties")
return "Math";
- else if ( aModuleId == "com.sun.star.sdb.RelationDesign" )
+ else if (aModuleId == u"com.sun.star.sdb.RelationDesign")
return "Relation Design";
- else if ( aModuleId == "com.sun.star.sdb.QueryDesign" )
+ else if (aModuleId == u"com.sun.star.sdb.QueryDesign")
return "Query Design";
- else if ( aModuleId == "com.sun.star.sdb.TableDesign" )
+ else if (aModuleId == u"com.sun.star.sdb.TableDesign")
return "Table Design";
- else if ( aModuleId == "com.sun.star.sdb.DataSourceBrowser" )
+ else if (aModuleId == u"com.sun.star.sdb.DataSourceBrowser")
return "Data Source Browser";
- else if ( aModuleId == "com.sun.star.sdb.DatabaseDocument" )
+ else if (aModuleId == u"com.sun.star.sdb.DatabaseDocument")
return "Database";
return OUString();
@@ -251,7 +235,7 @@ OUString SvxConfigPageHelper::GetModuleName( const OUString& aModuleId )
OUString SvxConfigPageHelper::GetUIModuleName(
const OUString& aModuleId,
- const css::uno::Reference< css::frame::XModuleManager2 >& rModuleManager )
+ const css::uno::Reference<css::frame::XModuleManager2>& rModuleManager)
{
assert(rModuleManager.is());
@@ -259,14 +243,14 @@ OUString SvxConfigPageHelper::GetUIModuleName(
try
{
- css::uno::Any a = rModuleManager->getByName( aModuleId );
- css::uno::Sequence< css::beans::PropertyValue > aSeq;
+ css::uno::Any a = rModuleManager->getByName(aModuleId);
+ css::uno::Sequence<css::beans::PropertyValue> aSeq;
- if ( a >>= aSeq )
+ if (a >>= aSeq)
{
- for ( css::beans::PropertyValue const & rProp : std::as_const(aSeq) )
+ for (css::beans::PropertyValue const& rProp : aSeq)
{
- if ( rProp.Name == "ooSetupFactoryUIName" )
+ if (rProp.Name == "ooSetupFactoryUIName")
{
rProp.Value >>= aModuleUIName;
break;
@@ -274,53 +258,49 @@ OUString SvxConfigPageHelper::GetUIModuleName(
}
}
}
- catch ( css::uno::RuntimeException& )
+ catch (css::uno::RuntimeException&)
{
throw;
}
- catch ( css::uno::Exception& )
+ catch (css::uno::Exception&)
{
}
- if ( aModuleUIName.isEmpty() )
- aModuleUIName = GetModuleName( aModuleId );
+ if (aModuleUIName.isEmpty())
+ aModuleUIName = GetModuleName(aModuleId);
return aModuleUIName;
}
bool SvxConfigPageHelper::GetMenuItemData(
- const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
- sal_Int32 nIndex,
- OUString& rCommandURL,
- OUString& rLabel,
- sal_uInt16& rType,
- sal_Int32& rStyle,
- css::uno::Reference< css::container::XIndexAccess >& rSubMenu )
+ const css::uno::Reference<css::container::XIndexAccess>& rItemContainer, sal_Int32 nIndex,
+ OUString& rCommandURL, OUString& rLabel, sal_uInt16& rType, sal_Int32& rStyle,
+ css::uno::Reference<css::container::XIndexAccess>& rSubMenu)
{
try
{
- css::uno::Sequence< css::beans::PropertyValue > aProps;
- if ( rItemContainer->getByIndex( nIndex ) >>= aProps )
+ 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 )
+ if (rProp.Name == ITEM_DESCRIPTOR_COMMANDURL)
{
rProp.Value >>= rCommandURL;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_CONTAINER )
+ else if (rProp.Name == ITEM_DESCRIPTOR_CONTAINER)
{
rProp.Value >>= rSubMenu;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_STYLE )
+ else if (rProp.Name == ITEM_DESCRIPTOR_STYLE)
{
rProp.Value >>= rStyle;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_LABEL )
+ else if (rProp.Name == ITEM_DESCRIPTOR_LABEL)
{
rProp.Value >>= rLabel;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_TYPE )
+ else if (rProp.Name == ITEM_DESCRIPTOR_TYPE)
{
rProp.Value >>= rType;
}
@@ -329,7 +309,7 @@ bool SvxConfigPageHelper::GetMenuItemData(
return true;
}
}
- catch ( css::lang::IndexOutOfBoundsException& )
+ catch (css::lang::IndexOutOfBoundsException&)
{
}
@@ -337,38 +317,33 @@ bool SvxConfigPageHelper::GetMenuItemData(
}
bool SvxConfigPageHelper::GetToolbarItemData(
- const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
- sal_Int32 nIndex,
- OUString& rCommandURL,
- OUString& rLabel,
- sal_uInt16& rType,
- bool& rIsVisible,
- sal_Int32& rStyle )
+ const css::uno::Reference<css::container::XIndexAccess>& rItemContainer, sal_Int32 nIndex,
+ OUString& rCommandURL, OUString& rLabel, sal_uInt16& rType, bool& rIsVisible, sal_Int32& rStyle)
{
try
{
- css::uno::Sequence< css::beans::PropertyValue > aProps;
- if ( rItemContainer->getByIndex( nIndex ) >>= aProps )
+ 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 )
+ if (rProp.Name == ITEM_DESCRIPTOR_COMMANDURL)
{
rProp.Value >>= rCommandURL;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_STYLE )
+ else if (rProp.Name == ITEM_DESCRIPTOR_STYLE)
{
rProp.Value >>= rStyle;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_LABEL )
+ else if (rProp.Name == ITEM_DESCRIPTOR_LABEL)
{
rProp.Value >>= rLabel;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_TYPE )
+ else if (rProp.Name == ITEM_DESCRIPTOR_TYPE)
{
rProp.Value >>= rType;
}
- else if ( rProp.Name == ITEM_DESCRIPTOR_ISVISIBLE )
+ else if (rProp.Name == ITEM_DESCRIPTOR_ISVISIBLE)
{
rProp.Value >>= rIsVisible;
}
@@ -377,90 +352,70 @@ bool SvxConfigPageHelper::GetToolbarItemData(
return true;
}
}
- catch ( css::lang::IndexOutOfBoundsException& )
+ catch (css::lang::IndexOutOfBoundsException&)
{
}
return false;
}
-css::uno::Sequence< css::beans::PropertyValue > SvxConfigPageHelper::ConvertSvxConfigEntry(
- const SvxConfigEntry* pEntry )
+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;
}
-css::uno::Sequence< css::beans::PropertyValue > SvxConfigPageHelper::ConvertToolbarEntry(
- 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;
}
-bool SvxConfigPageHelper::EntrySort( SvxConfigEntry const * a, SvxConfigEntry const * b )
+bool SvxConfigPageHelper::EntrySort(SvxConfigEntry const* a, SvxConfigEntry const* b)
{
- return a->GetName().compareTo( b->GetName() ) < 0;
+ return a->GetName().compareTo(b->GetName()) < 0;
}
-bool SvxConfigPageHelper::SvxConfigEntryModified( SvxConfigEntry const * pEntry )
+bool SvxConfigPageHelper::SvxConfigEntryModified(SvxConfigEntry const* pEntry)
{
SvxEntries* pEntries = pEntry->GetEntries();
- if ( !pEntries )
+ if (!pEntries)
return false;
- for ( const auto& entry : *pEntries )
+ for (const auto& entry : *pEntries)
{
- if ( entry->IsModified() || SvxConfigEntryModified( entry ) )
+ if (entry->IsModified() || SvxConfigEntryModified(entry))
return true;
}
return false;
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index ca685311e8d3..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>
@@ -33,17 +34,16 @@
#include <dialmgr.hxx>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/ImageType.hpp>
-
-#include <dlgname.hxx>
-SvxMenuConfigPage::SvxMenuConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet, bool bIsMenuBar)
+SvxMenuConfigPage::SvxMenuConfigPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet, bool bIsMenuBar)
: SvxConfigPage(pPage, pController, rSet)
, m_bIsMenuBar(bIsMenuBar)
{
m_xGearBtn = m_xBuilder->weld_menu_button("menugearbtn");
m_xGearBtn->show();
- m_xContentsListBox.reset(new SvxMenuEntriesListBox(m_xBuilder->weld_tree_view("menucontents"), this));
+ m_xContentsListBox.reset(
+ new SvxMenuEntriesListBox(m_xBuilder->weld_tree_view("menucontents"), this));
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
m_xDropTargetHelper.reset(new SvxConfigPageFunctionDropTarget(*this, rTreeView));
rTreeView.connect_size_allocate(LINK(this, SvxMenuConfigPage, MenuEntriesSizeAllocHdl));
@@ -54,36 +54,32 @@ SvxMenuConfigPage::SvxMenuConfigPage(weld::Container* pPage, weld::DialogControl
rTreeView.set_vexpand(true);
rTreeView.show();
- rTreeView.connect_changed(
- LINK( this, SvxMenuConfigPage, SelectMenuEntry ) );
- rTreeView.connect_popup_menu( LINK( this, SvxMenuConfigPage, ContentContextMenuHdl ) );
+ rTreeView.connect_changed(LINK(this, SvxMenuConfigPage, SelectMenuEntry));
+ rTreeView.connect_popup_menu(LINK(this, SvxMenuConfigPage, ContentContextMenuHdl));
m_xFunctions->get_widget().connect_popup_menu(
- LINK( this, SvxMenuConfigPage, FunctionContextMenuHdl ) );
+ LINK(this, SvxMenuConfigPage, FunctionContextMenuHdl));
m_xGearBtn->connect_selected(LINK(this, SvxMenuConfigPage, GearHdl));
m_xCommandCategoryListBox->connect_changed(LINK(this, SvxMenuConfigPage, SelectCategory));
- m_xMoveUpButton->connect_clicked( LINK( this, SvxConfigPage, MoveHdl) );
- m_xMoveDownButton->connect_clicked( LINK( this, SvxConfigPage, MoveHdl) );
+ m_xMoveUpButton->connect_clicked(LINK(this, SvxConfigPage, MoveHdl));
+ m_xMoveDownButton->connect_clicked(LINK(this, SvxConfigPage, MoveHdl));
- m_xAddCommandButton->connect_clicked( LINK( this, SvxMenuConfigPage, AddCommandHdl ) );
- m_xRemoveCommandButton->connect_clicked( LINK( this, SvxMenuConfigPage, RemoveCommandHdl ) );
+ m_xAddCommandButton->connect_clicked(LINK(this, SvxMenuConfigPage, AddCommandHdl));
+ m_xRemoveCommandButton->connect_clicked(LINK(this, SvxMenuConfigPage, RemoveCommandHdl));
- m_xInsertBtn->connect_selected(
- LINK( this, SvxMenuConfigPage, InsertHdl ) );
- m_xModifyBtn->connect_selected(
- LINK( this, SvxMenuConfigPage, ModifyItemHdl ) );
- m_xResetBtn->connect_clicked(
- LINK( this, SvxMenuConfigPage, ResetMenuHdl ) );
+ m_xInsertBtn->connect_selected(LINK(this, SvxMenuConfigPage, InsertHdl));
+ m_xModifyBtn->connect_selected(LINK(this, SvxMenuConfigPage, ModifyItemHdl));
+ m_xResetBtn->connect_clicked(LINK(this, SvxMenuConfigPage, ResetMenuHdl));
// These operations are not possible on menus/context menus yet
m_xModifyBtn->remove_item("changeIcon");
m_xModifyBtn->remove_item("resetIcon");
m_xModifyBtn->remove_item("restoreItem");
- if ( !bIsMenuBar )
+ if (!bIsMenuBar)
{
//TODO: Remove this when the gear button is implemented for context menus
m_xGearBtn->set_sensitive(false);
@@ -103,7 +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();
@@ -125,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();
}
@@ -138,39 +134,34 @@ 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, m_aModuleId);
+ m_xCommandCategoryListBox->Init(comphelper::getProcessComponentContext(), m_xFrame,
+ m_aModuleId);
m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), OUString(), GetSaveInData());
SelectFunctionHdl(m_xFunctions->get_widget());
}
-IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView&, void)
-{
- UpdateButtonStates();
-}
+IMPL_LINK_NOARG(SvxMenuConfigPage, SelectMenuEntry, weld::TreeView&, void) { UpdateButtonStates(); }
void SvxMenuConfigPage::UpdateButtonStates()
{
// Disable Up and Down buttons depending on current selection
int selection = m_xContentsListBox->get_selected_index();
- bool bIsSeparator =
- selection != -1 && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())->IsSeparator();
- bool bIsValidSelection =
- (m_xContentsListBox->n_children() != 0 && selection != -1);
+ bool bIsSeparator
+ = selection != -1
+ && 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 );
- m_xMoveDownButton->set_sensitive(
- bIsValidSelection && selection != m_xContentsListBox->n_children() - 1);
+ m_xMoveUpButton->set_sensitive(bIsValidSelection && selection != 0);
+ m_xMoveDownButton->set_sensitive(bIsValidSelection
+ && selection != m_xContentsListBox->n_children() - 1);
- m_xRemoveCommandButton->set_sensitive( bIsValidSelection );
+ m_xRemoveCommandButton->set_sensitive(bIsValidSelection);
- m_xModifyBtn->set_sensitive( bIsValidSelection && !bIsSeparator);
+ m_xModifyBtn->set_sensitive(bIsValidSelection && !bIsSeparator);
// If there is no top level selection (menu), then everything working on the right box
// which contains the functions of the selected menu/toolbar needs to be disabled
@@ -178,16 +169,25 @@ 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)
{
// Add option (gear_add) will always be enabled
- m_xGearBtn->set_item_sensitive( "menu_gear_delete", pMenuData->IsDeletable() );
- m_xGearBtn->set_item_sensitive( "menu_gear_rename", pMenuData->IsRenamable() );
- m_xGearBtn->set_item_sensitive( "menu_gear_move", pMenuData->IsMovable() );
+ m_xGearBtn->set_item_sensitive("menu_gear_delete", pMenuData->IsDeletable());
+ m_xGearBtn->set_item_sensitive("menu_gear_rename", pMenuData->IsRenamable());
+ m_xGearBtn->set_item_sensitive("menu_gear_move", pMenuData->IsMovable());
}
}
@@ -195,15 +195,14 @@ void SvxMenuConfigPage::DeleteSelectedTopLevel()
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- SvxEntries* pParentEntries =
- FindParentForChild( GetSaveInData()->GetEntries(), pMenuData );
+ SvxEntries* pParentEntries = FindParentForChild(GetSaveInData()->GetEntries(), pMenuData);
- SvxConfigPageHelper::RemoveEntry( pParentEntries, pMenuData );
+ SvxConfigPageHelper::RemoveEntry(pParentEntries, pMenuData);
delete pMenuData;
ReloadTopLevelListBox();
- GetSaveInData()->SetModified( );
+ GetSaveInData()->SetModified();
}
void SvxMenuConfigPage::DeleteSelectedContent()
@@ -214,20 +213,20 @@ void SvxMenuConfigPage::DeleteSelectedContent()
return;
// get currently selected menu entry
- SvxConfigEntry* pMenuEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ SvxConfigEntry* pMenuEntry
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
// get currently selected menu
SvxConfigEntry* pMenu = GetTopLevelSelection();
// remove menu entry from the list for this menu
- SvxConfigPageHelper::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
+ SvxConfigPageHelper::RemoveEntry(pMenu->GetEntries(), pMenuEntry);
// remove menu entry from UI
m_xContentsListBox->remove(nActEntry);
// if this is a submenu entry, redraw the menus list box
- if ( pMenuEntry->IsPopup() )
+ if (pMenuEntry->IsPopup())
{
ReloadTopLevelListBox();
}
@@ -241,15 +240,14 @@ 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();
- OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
+ OUString label = SvxConfigPageHelper::replaceSaveInName(msg, saveInName);
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- label));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
+ GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, label));
return xQueryBox->run();
}
@@ -264,23 +262,24 @@ void SvxMenuConfigPage::SelectElement()
{
SvxEntries* pEntries = pMenuData->GetEntries();
- 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)));
- rTreeView.set_id(rIter, sId);
- InsertEntryIntoUI(entry, rTreeView, rIter, true);
- });
+ rTreeView.bulk_insert_for_each(
+ pEntries->size(), [this, &rTreeView, pEntries](weld::TreeIter& rIter, int nIdx) {
+ auto const& entry = (*pEntries)[nIdx];
+ OUString sId(weld::toId(entry));
+ rTreeView.set_id(rIter, sId);
+ InsertEntryIntoUI(entry, rTreeView, rIter, true);
+ });
}
UpdateButtonStates();
}
-IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
+IMPL_LINK(SvxMenuConfigPage, GearHdl, const OUString&, rIdent, void)
{
if (rIdent == "menu_gear_add")
{
- SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(),
- GetSaveInData()->GetEntries(), nullptr, true );
+ SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(), nullptr,
+ true);
if (aDialog.run() == RET_OK)
{
@@ -297,21 +296,21 @@ 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 sCurrentName(SvxConfigPageHelper::stripHotKey(pMenuData->GetName()));
+ 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 )
+ if (aNameDialog.run() == RET_OK)
{
OUString sNewName = aNameDialog.GetName();
- if ( sCurrentName == sNewName )
+ if (sCurrentName == sNewName)
return;
- pMenuData->SetName( sNewName );
+ pMenuData->SetName(sNewName);
ReloadTopLevelListBox();
@@ -322,8 +321,8 @@ IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(),
- pMenuData, false );
+ SvxMainMenuOrganizerDialog aDialog(GetFrameWeld(), GetSaveInData()->GetEntries(), pMenuData,
+ false);
if (aDialog.run() == RET_OK)
{
GetSaveInData()->SetEntries(aDialog.ReleaseEntries());
@@ -345,34 +344,33 @@ IMPL_LINK(SvxMenuConfigPage, GearHdl, const OString&, rIdent, void)
IMPL_LINK_NOARG(SvxMenuConfigPage, SelectCategory, weld::ComboBox&, void)
{
- OUString aSearchTerm( m_xSearchEdit->get_text() );
+ OUString aSearchTerm(m_xSearchEdit->get_text());
m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), aSearchTerm, GetSaveInData());
SelectFunctionHdl(m_xFunctions->get_widget());
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, AddCommandHdl, weld::Button&, void )
+IMPL_LINK_NOARG(SvxMenuConfigPage, AddCommandHdl, weld::Button&, void)
{
- int nPos = AddFunction(-1, /*bAllowDuplicates*/false);
+ int nPos = AddFunction(-1, /*bAllowDuplicates*/ false);
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);
}
-IMPL_LINK_NOARG( SvxMenuConfigPage, RemoveCommandHdl, weld::Button&, void )
+IMPL_LINK_NOARG(SvxMenuConfigPage, RemoveCommandHdl, weld::Button&, void)
{
DeleteSelectedContent();
- if ( GetSaveInData()->IsModified() )
+ if (GetSaveInData()->IsModified())
{
UpdateButtonStates();
}
}
-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")
@@ -385,19 +383,19 @@ 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)
{
aNewName = aNameDialog.GetName();
- SvxConfigEntry* pNewEntryData =
- new SvxConfigEntry( aNewName, aNewName, true, /*bParentData*/false );
- pNewEntryData->SetName( aNewName );
+ SvxConfigEntry* pNewEntryData
+ = new SvxConfigEntry(aNewName, aNewName, true, /*bParentData*/ false);
+ pNewEntryData->SetName(aNewName);
pNewEntryData->SetUserDefined();
int nPos = AppendEntry(pNewEntryData, -1);
@@ -410,7 +408,6 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
GetSaveInData()->SetModified();
}
-
}
else
{
@@ -419,33 +416,33 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
return;
}
- if ( GetSaveInData()->IsModified() )
+ if (GetSaveInData()->IsModified())
{
UpdateButtonStates();
}
}
-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());
+ SvxConfigEntry* pEntry
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
- OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
- OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
+ OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
+ 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)
{
aNewName = aNameDialog.GetName();
- pEntry->SetName( aNewName );
- m_xContentsListBox->set_text(nActEntry, aNewName, 1);
+ pEntry->SetName(aNewName);
+ m_xContentsListBox->set_text(nActEntry, aNewName, 0);
GetSaveInData()->SetModified();
GetTopLevelSelection()->SetModified();
@@ -458,7 +455,7 @@ IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OString&, rIdent, void)
return;
}
- if ( GetSaveInData()->IsModified() )
+ if (GetSaveInData()->IsModified())
{
UpdateButtonStates();
}
@@ -470,13 +467,14 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void)
if (pMenuData == nullptr)
{
- SAL_WARN("cui.customize", "RHB top level selection is null. A menu must be selected to reset!");
+ SAL_WARN("cui.customize",
+ "RHB top level selection is null. A menu must be selected to reset!");
return;
}
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT_MENU)));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
+ GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ 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
@@ -484,7 +482,7 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void)
return;
sal_Int32 nPos = m_xTopLevelListBox->get_active();
- ContextMenuSaveInData* pSaveInData = static_cast< ContextMenuSaveInData* >(GetSaveInData());
+ ContextMenuSaveInData* pSaveInData = static_cast<ContextMenuSaveInData*>(GetSaveInData());
pSaveInData->ResetContextMenu(pMenuData);
@@ -500,18 +498,19 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void)
}
SaveInData* SvxMenuConfigPage::CreateSaveInData(
- const css::uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr,
- const css::uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
- const OUString& aModuleId,
- bool bDocConfig )
+ const css::uno::Reference<css::ui::XUIConfigurationManager>& xCfgMgr,
+ const css::uno::Reference<css::ui::XUIConfigurationManager>& xParentCfgMgr,
+ const OUString& aModuleId, bool bDocConfig)
{
- if ( !m_bIsMenuBar )
- return static_cast< SaveInData* >( new ContextMenuSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig ) );
+ if (!m_bIsMenuBar)
+ return static_cast<SaveInData*>(
+ new ContextMenuSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
- return static_cast< SaveInData* >( new MenuSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig ) );
+ return static_cast<SaveInData*>(
+ new MenuSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
}
-IMPL_LINK( SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool )
+IMPL_LINK(SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool)
{
if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
return false;
@@ -520,18 +519,20 @@ IMPL_LINK( SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt,
// Select clicked entry
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
- rTreeView.get_dest_row_at_pos( rCEvt.GetMousePosPixel(), xIter.get(), false );
+ if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
+ return false;
rTreeView.select(*xIter);
- SelectMenuEntry( rTreeView );
+ SelectMenuEntry(rTreeView);
int nSelectIndex = m_xContentsListBox->get_selected_index();
- bool bIsSeparator =
- nSelectIndex != -1 && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())->IsSeparator();
- bool bIsValidSelection =
- ( m_xContentsListBox->n_children() != 0 && nSelectIndex != -1 );
+ bool bIsSeparator
+ = nSelectIndex != -1
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
+ bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && nSelectIndex != -1);
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) );
+ std::unique_ptr<weld::Builder> xBuilder(
+ Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
auto xContextMenu = xBuilder->weld_menu("menu");
xContextMenu->set_visible("add", false);
xContextMenu->set_visible("remove", bIsValidSelection);
@@ -539,22 +540,23 @@ 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( &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1) ) ) );
+ OUString sCommand(xContextMenu->popup_at_rect(
+ &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
- if ( sCommand == "remove")
+ if (sCommand == "remove")
{
- RemoveCommandHdl( *m_xRemoveCommandButton );
+ RemoveCommandHdl(*m_xRemoveCommandButton);
}
- else if ( sCommand == "rename" )
+ else if (sCommand == "rename")
{
- ModifyItemHdl( "renameItem" );
+ ModifyItemHdl("renameItem");
}
- else if ( !sCommand.isEmpty() )
- SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand );
+ else if (!sCommand.isEmpty())
+ SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
return true;
}
-IMPL_LINK( SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt, bool )
+IMPL_LINK(SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt, bool)
{
if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
return false;
@@ -563,11 +565,13 @@ IMPL_LINK( SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt
// Select clicked entry
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
- rTreeView.get_dest_row_at_pos( rCEvt.GetMousePosPixel(), xIter.get(), false );
+ if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
+ return false;
rTreeView.select(*xIter);
- SelectFunctionHdl( rTreeView );
+ SelectFunctionHdl(rTreeView);
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) );
+ std::unique_ptr<weld::Builder> xBuilder(
+ Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
auto xContextMenu = xBuilder->weld_menu("menu");
xContextMenu->set_visible("add", true);
xContextMenu->set_visible("remove", false);
@@ -575,15 +579,16 @@ 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( &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1) ) ) );
+ OUString sCommand(xContextMenu->popup_at_rect(
+ &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
- if ( sCommand == "add")
+ if (sCommand == "add")
{
- AddCommandHdl( *m_xAddCommandButton );
+ AddCommandHdl(*m_xAddCommandButton);
}
- else if ( !sCommand.isEmpty() )
- SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand );
+ else if (!sCommand.isEmpty())
+ SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
return true;
}
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx
index aa4101ed1657..7389d05b91d2 100644
--- a/cui/source/customize/SvxNotebookbarConfigPage.cxx
+++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx
@@ -40,22 +40,20 @@
#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>
-#include <com/sun/star/ui/ImageType.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(const OUString& sClassId, const OUString& sUIItemId,
- const OUString& sActiveCategory, bool& isCategory)
+static bool isCategoryAvailable(std::u16string_view sClassId, std::u16string_view sUIItemId,
+ std::u16string_view sActiveCategory, bool& isCategory)
{
if (sUIItemId == sActiveCategory)
return true;
- else if ((sClassId == "GtkMenu" || sClassId == "GtkGrid") && sUIItemId != sActiveCategory)
+ else if ((sClassId == u"GtkMenu" || sClassId == u"GtkGrid") && sUIItemId != sActiveCategory)
{
isCategory = false;
return false;
@@ -68,29 +66,29 @@ static OUString charToString(const char* cString)
return OUString(cString, strlen(cString), RTL_TEXTENCODING_UTF8);
}
-static OUString getFileName(const OUString& aFileName)
+static OUString getFileName(std::u16string_view aFileName)
{
- if (aFileName == "notebookbar.ui")
- return "Tabbed";
- else if (aFileName == "notebookbar_compact.ui")
- return "TabbedCompact";
- else if (aFileName == "notebookbar_groupedbar_full.ui")
- return "Groupedbar";
- else if (aFileName == "notebookbar_groupedbar_compact.ui")
- return "GroupedbarCompact";
+ if (aFileName == u"notebookbar.ui")
+ return CuiResId(RID_CUISTR_TABBED);
+ else if (aFileName == u"notebookbar_compact.ui")
+ return CuiResId(RID_CUISTR_TABBED_COMPACT);
+ else if (aFileName == u"notebookbar_groupedbar_full.ui")
+ return CuiResId(RID_CUISTR_GROUPEDBAR);
+ else if (aFileName == u"notebookbar_groupedbar_compact.ui")
+ return CuiResId(RID_CUISTR_GROUPEDBAR_COMPACT);
else
return "None";
}
-static OUString getModuleId(const OUString& sModuleName)
+static OUString getModuleId(std::u16string_view sModuleName)
{
- if (sModuleName == "Writer")
+ if (sModuleName == u"Writer")
return "com.sun.star.text.TextDocument";
- else if (sModuleName == "Draw")
+ else if (sModuleName == u"Draw")
return "com.sun.star.drawing.DrawingDocument";
- else if (sModuleName == "Impress")
+ else if (sModuleName == u"Impress")
return "com.sun.star.presentation.PresentationDocument";
- else if (sModuleName == "Calc")
+ else if (sModuleName == u"Calc")
return "com.sun.star.sheet.SpreadsheetDocument";
else
return "None";
@@ -107,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();
@@ -145,7 +140,6 @@ void SvxNotebookbarConfigPage::Init()
m_xTopLevelListBox->clear();
m_xContentsListBox->clear();
m_xSaveInListBox->clear();
- CustomNotebookbarGenerator::createCustomizedUIFile();
OUString sNotebookbarInterface = getFileName(m_sFileName);
OUString sScopeName
@@ -155,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();
}
@@ -173,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();
@@ -184,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);
@@ -196,11 +189,11 @@ short SvxNotebookbarConfigPage::QueryReset()
return nValue;
}
-void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId,
+void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId,
const OUString& sUIItemId,
const OUString& sUIItemCommand,
weld::TreeView& rTreeView,
- weld::TreeIter& rIter)
+ const weld::TreeIter& rIter)
{
css::uno::Reference<css::container::XNameAccess> m_xCommandToLabelMap;
uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
@@ -222,13 +215,13 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId,
}
OUString aLabel;
- for (auto const& prop : std::as_const(aPropSeq))
+ for (auto const& prop : aPropSeq)
if (prop.Name == "Name")
prop.Value >>= aLabel;
OUString aName = SvxConfigPageHelper::stripHotKey(aLabel);
- if (sClassId == "GtkSeparatorMenuItem" || sClassId == "GtkSeparator")
+ if (sClassId == u"GtkSeparatorMenuItem" || sClassId == u"GtkSeparator")
{
rTreeView.set_text(rIter, "--------------------------------------------", 0);
}
@@ -318,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;
@@ -399,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);
@@ -409,11 +410,10 @@ 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);
}
- unsigned long nStart = 0;
+ tools::ULong nStart = 0;
if (aEntries[nStart].sClassId == "sfxlo-PriorityHBox"
|| aEntries[nStart].sClassId == "sfxlo-PriorityMergedHBox")
nStart = 1;
@@ -424,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")
@@ -457,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();
@@ -471,33 +472,37 @@ 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() {}
-static void EditRegistryFile(const OUString& sUIItemId, const OUString& sSetEntry,
+static void EditRegistryFile(std::u16string_view sUIItemId, const OUString& sSetEntry,
const OUString& sNotebookbarInterface)
{
int nFlag = 0;
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
@@ -517,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/";
@@ -544,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 ea17c407c0f2..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,20 +38,22 @@
#include <SvxConfigPageHelper.hxx>
#include <dialmgr.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/ImageType.hpp>
-
#include <dlgname.hxx>
+#include <comphelper/processfactory.hxx>
-SvxToolbarConfigPage::SvxToolbarConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
+SvxToolbarConfigPage::SvxToolbarConfigPage(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet& rSet)
: SvxConfigPage(pPage, pController, rSet)
{
m_xGearBtn = m_xBuilder->weld_menu_button("toolbargearbtn");
m_xGearBtn->show();
m_xContainer->set_help_id(HID_SVX_CONFIG_TOOLBAR);
- m_xContentsListBox.reset(new SvxToolbarEntriesListBox(m_xBuilder->weld_tree_view("toolcontents"), this));
- m_xDropTargetHelper.reset(new SvxConfigPageFunctionDropTarget(*this, m_xContentsListBox->get_widget()));
+ m_xContentsListBox.reset(
+ new SvxToolbarEntriesListBox(m_xBuilder->weld_tree_view("toolcontents"), this));
+ m_xDropTargetHelper.reset(
+ new SvxConfigPageFunctionDropTarget(*this, m_xContentsListBox->get_widget()));
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
Size aSize(m_xFunctions->get_size_request());
@@ -59,44 +61,38 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(weld::Container* pPage, weld::DialogC
rTreeView.set_hexpand(true);
rTreeView.set_vexpand(true);
- rTreeView.set_help_id( HID_SVX_CONFIG_TOOLBAR_CONTENTS );
+ rTreeView.set_help_id(HID_SVX_CONFIG_TOOLBAR_CONTENTS);
rTreeView.show();
- rTreeView.connect_changed(
- LINK( this, SvxToolbarConfigPage, SelectToolbarEntry ) );
- rTreeView.connect_popup_menu( LINK( this, SvxToolbarConfigPage, ContentContextMenuHdl ) );
+ rTreeView.connect_changed(LINK(this, SvxToolbarConfigPage, SelectToolbarEntry));
+ rTreeView.connect_popup_menu(LINK(this, SvxToolbarConfigPage, ContentContextMenuHdl));
m_xFunctions->get_widget().connect_popup_menu(
- LINK( this, SvxToolbarConfigPage, FunctionContextMenuHdl ) );
+ LINK(this, SvxToolbarConfigPage, FunctionContextMenuHdl));
- m_xTopLevelListBox->set_help_id ( HID_SVX_TOPLEVELLISTBOX );
- m_xSaveInListBox->set_help_id( HID_SVX_SAVE_IN );
- m_xMoveUpButton->set_help_id( HID_SVX_UP_TOOLBAR_ITEM );
- m_xMoveDownButton->set_help_id( HID_SVX_DOWN_TOOLBAR_ITEM );
- m_xDescriptionField->set_help_id ( HID_SVX_DESCFIELD );
+ m_xTopLevelListBox->set_help_id(HID_SVX_TOPLEVELLISTBOX);
+ m_xSaveInListBox->set_help_id(HID_SVX_SAVE_IN);
+ m_xMoveUpButton->set_help_id(HID_SVX_UP_TOOLBAR_ITEM);
+ m_xMoveDownButton->set_help_id(HID_SVX_DOWN_TOOLBAR_ITEM);
+ m_xDescriptionField->set_help_id(HID_SVX_DESCFIELD);
- m_xCommandCategoryListBox->connect_changed(
- LINK( this, SvxToolbarConfigPage, SelectCategory ) );
+ m_xCommandCategoryListBox->connect_changed(LINK(this, SvxToolbarConfigPage, SelectCategory));
- m_xGearBtn->connect_selected(
- LINK( this, SvxToolbarConfigPage, GearHdl ) );
+ m_xGearBtn->connect_selected(LINK(this, SvxToolbarConfigPage, GearHdl));
- m_xMoveUpButton->connect_clicked( LINK( this, SvxToolbarConfigPage, MoveHdl) );
- m_xMoveDownButton->connect_clicked( LINK( this, SvxToolbarConfigPage, MoveHdl) );
+ m_xMoveUpButton->connect_clicked(LINK(this, SvxToolbarConfigPage, MoveHdl));
+ m_xMoveDownButton->connect_clicked(LINK(this, SvxToolbarConfigPage, MoveHdl));
// Always enable Up and Down buttons
// added for issue i53677 by shizhoubo
m_xMoveDownButton->set_sensitive(true);
m_xMoveUpButton->set_sensitive(true);
- m_xAddCommandButton->connect_clicked( LINK( this, SvxToolbarConfigPage, AddCommandHdl ) );
- m_xRemoveCommandButton->connect_clicked( LINK( this, SvxToolbarConfigPage, RemoveCommandHdl ) );
+ m_xAddCommandButton->connect_clicked(LINK(this, SvxToolbarConfigPage, AddCommandHdl));
+ m_xRemoveCommandButton->connect_clicked(LINK(this, SvxToolbarConfigPage, RemoveCommandHdl));
- m_xInsertBtn->connect_selected(
- LINK( this, SvxToolbarConfigPage, InsertHdl ) );
- m_xModifyBtn->connect_selected(
- LINK( this, SvxToolbarConfigPage, ModifyItemHdl ) );
- m_xResetBtn->connect_clicked(
- LINK( this, SvxToolbarConfigPage, ResetToolbarHdl ) );
+ m_xInsertBtn->connect_selected(LINK(this, SvxToolbarConfigPage, InsertHdl));
+ m_xModifyBtn->connect_selected(LINK(this, SvxToolbarConfigPage, ModifyItemHdl));
+ m_xResetBtn->connect_clicked(LINK(this, SvxToolbarConfigPage, ResetToolbarHdl));
// "Insert Submenu" is irrelevant to the toolbars
m_xInsertBtn->remove_item("insertsubmenu");
@@ -109,15 +105,14 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(weld::Container* pPage, weld::DialogC
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 )
+ if (pItem)
{
OUString text = static_cast<const SfxStringItem*>(pItem)->GetValue();
- if (text.startsWith( ITEM_TOOLBAR_URL ))
+ if (text.startsWith(ITEM_TOOLBAR_URL))
{
- m_aURLToSelect = text.copy( 0 );
+ m_aURLToSelect = text.copy(0);
}
}
}
@@ -129,22 +124,21 @@ 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();
SvxConfigEntry* pToolbar = GetTopLevelSelection();
- if ( pToolbar )
- static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar( pToolbar );
+ if (pToolbar)
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar(pToolbar);
}
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();
@@ -153,8 +147,8 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
void SvxToolbarConfigPage::DeleteSelectedTopLevel()
{
const sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
- ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
- pSaveInData->RemoveToolbar( GetTopLevelSelection() );
+ ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
+ pSaveInData->RemoveToolbar(GetTopLevelSelection());
int nCount = m_xTopLevelListBox->get_count();
if (nCount > 1)
@@ -189,13 +183,12 @@ 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();
// remove entry from the list for this toolbar
- SvxConfigPageHelper::RemoveEntry( pToolbar->GetEntries(), pEntry );
+ SvxConfigPageHelper::RemoveEntry(pToolbar->GetEntries(), pEntry);
// remove toolbar entry from UI
m_xContentsListBox->remove(nActEntry);
@@ -203,18 +196,17 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
// delete data for toolbar entry
delete pEntry;
- static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar( pToolbar );
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar(pToolbar);
UpdateButtonStates();
// if this is the last entry in the toolbar and it is a user
// defined toolbar pop up a dialog asking the user if they
// want to delete the toolbar
- if ( m_xContentsListBox->n_children() == 0 &&
- GetTopLevelSelection()->IsDeletable() )
+ if (m_xContentsListBox->n_children() == 0 && GetTopLevelSelection()->IsDeletable())
{
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR)));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
+ GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR)));
if (xQueryBox->run() == RET_YES)
{
DeleteSelectedTopLevel();
@@ -222,22 +214,22 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
}
}
-IMPL_LINK( SvxToolbarConfigPage, MoveHdl, weld::Button&, rButton, void )
+IMPL_LINK(SvxToolbarConfigPage, MoveHdl, weld::Button&, rButton, void)
{
MoveEntry(&rButton == m_xMoveUpButton.get());
}
-void SvxToolbarConfigPage::MoveEntry( bool bMoveUp )
+void SvxToolbarConfigPage::MoveEntry(bool bMoveUp)
{
- SvxConfigPage::MoveEntry( bMoveUp );
+ SvxConfigPage::MoveEntry(bMoveUp);
// Apply change to currently selected toolbar
SvxConfigEntry* pToolbar = GetTopLevelSelection();
- if ( pToolbar )
- static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar( pToolbar );
+ if (pToolbar)
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar(pToolbar);
else
{
- SAL_WARN( "cui.customize", "SvxToolbarConfigPage::MoveEntry(): no entry" );
+ SAL_WARN("cui.customize", "SvxToolbarConfigPage::MoveEntry(): no entry");
UpdateButtonStates();
}
}
@@ -250,15 +242,16 @@ void SvxToolbarConfigPage::Init()
ReloadTopLevelListBox();
- sal_Int32 nPos = 0;
- if ( !m_aURLToSelect.isEmpty() )
+ 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 ) )
+ if (pData->GetCommand().equals(m_aURLToSelect))
{
nPos = i;
break;
@@ -273,21 +266,19 @@ void SvxToolbarConfigPage::Init()
m_xTopLevelListBox->set_active(nPos);
SelectElement();
- m_xCommandCategoryListBox->Init(
- comphelper::getProcessComponentContext(),
- m_xFrame, m_aModuleId);
+ m_xCommandCategoryListBox->Init(comphelper::getProcessComponentContext(), m_xFrame,
+ m_aModuleId);
m_xCommandCategoryListBox->categorySelected(m_xFunctions.get(), OUString(), GetSaveInData());
SelectFunctionHdl(m_xFunctions->get_widget());
}
SaveInData* SvxToolbarConfigPage::CreateSaveInData(
- const css::uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr,
- const css::uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr,
- const OUString& aModuleId,
- bool bDocConfig )
+ const css::uno::Reference<css::ui::XUIConfigurationManager>& xCfgMgr,
+ const css::uno::Reference<css::ui::XUIConfigurationManager>& xParentCfgMgr,
+ const OUString& aModuleId, bool bDocConfig)
{
- return static_cast< SaveInData* >(
- new ToolbarSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig ));
+ return static_cast<SaveInData*>(
+ new ToolbarSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
}
IMPL_LINK_NOARG(SvxToolbarConfigPage, SelectToolbarEntry, weld::TreeView&, void)
@@ -295,19 +286,18 @@ 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() );
+ OUString aNewName
+ = SvxConfigPageHelper::generateCustomName(prefix, GetSaveInData()->GetEntries());
- OUString aNewURL =
- SvxConfigPageHelper::generateCustomURL( GetSaveInData()->GetEntries() );
+ OUString aNewURL = SvxConfigPageHelper::generateCustomURL(GetSaveInData()->GetEntries());
SvxNewToolbarDialog aNameDialog(GetFrameWeld(), aNewName);
@@ -324,25 +314,23 @@ 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 )
+ if (GetSaveInData() != pData)
{
m_xSaveInListBox->set_active(nInsertPos);
SelectSaveInLocation(*m_xSaveInListBox);
}
- SvxConfigEntry* pToolbar =
- new SvxConfigEntry( aNewName, aNewURL, true, false );
+ SvxConfigEntry* pToolbar = new SvxConfigEntry(aNewName, aNewURL, true, false);
pToolbar->SetUserDefined();
pToolbar->SetMain();
- pData->CreateToolbar( pToolbar );
+ 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,7 +340,7 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
}
else if (rIdent == "toolbar_gear_delete")
{
- if ( pCurrentToolbar && pCurrentToolbar->IsDeletable() )
+ if (pCurrentToolbar && pCurrentToolbar->IsDeletable())
{
DeleteSelectedTopLevel();
UpdateButtonStates();
@@ -361,38 +349,39 @@ 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());
- ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
+ 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 sCurrentName(SvxConfigPageHelper::stripHotKey(pToolbar->GetName()));
+ 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 )
+ if (aNameDialog.run() == RET_OK)
{
OUString sNewName = aNameDialog.GetName();
if (sCurrentName == sNewName)
return;
- pToolbar->SetName( sNewName );
- pSaveInData->ApplyToolbar( pToolbar );
+ pToolbar->SetName(sNewName);
+ pSaveInData->ApplyToolbar(pToolbar);
// 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);
}
}
- else if (rIdent == "toolbar_gear_iconOnly" || rIdent == "toolbar_gear_textOnly" || rIdent == "toolbar_gear_iconAndText")
+ else if (rIdent == "toolbar_gear_iconOnly" || rIdent == "toolbar_gear_textOnly"
+ || rIdent == "toolbar_gear_iconAndText")
{
- ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>( GetSaveInData() );
+ ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
if (pCurrentToolbar == nullptr || pSaveInData == nullptr)
{
@@ -408,8 +397,8 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
else if (rIdent == "toolbar_gear_iconAndText")
nStyle = 2;
- pCurrentToolbar->SetStyle( nStyle );
- pSaveInData->SetSystemStyle( m_xFrame, pCurrentToolbar->GetCommand(), nStyle );
+ pCurrentToolbar->SetStyle(nStyle);
+ pSaveInData->SetSystemStyle(m_xFrame, pCurrentToolbar->GetCommand(), nStyle);
SelectElement();
}
@@ -421,7 +410,7 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, const OString&, rIdent, void )
}
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, weld::ComboBox&, void )
+IMPL_LINK_NOARG(SvxToolbarConfigPage, SelectCategory, weld::ComboBox&, void)
{
OUString aSearchTerm(m_xSearchEdit->get_text());
@@ -430,17 +419,14 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, weld::ComboBox&, void )
SelectFunctionHdl(m_xFunctions->get_widget());
}
-IMPL_LINK_NOARG( SvxToolbarConfigPage, AddCommandHdl, weld::Button&, void )
-{
- AddFunction();
-}
+IMPL_LINK_NOARG(SvxToolbarConfigPage, AddCommandHdl, weld::Button&, void) { AddFunction(); }
-IMPL_LINK_NOARG( SvxToolbarConfigPage, RemoveCommandHdl, weld::Button&, void )
+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")
{
@@ -453,7 +439,7 @@ IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OString&, rIdent, void)
int nPos = AppendEntry(pNewEntryData, -1);
InsertEntryIntoUI(pNewEntryData, m_xContentsListBox->get_widget(), nPos);
- static_cast<ToolbarSaveInData*>( GetSaveInData())->ApplyToolbar( pToolbar );
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar(pToolbar);
UpdateButtonStates();
}
@@ -465,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;
@@ -481,24 +467,24 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
if (rIdent == "renameItem")
{
int nActEntry = m_xContentsListBox->get_selected_index();
- SvxConfigEntry* pEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ SvxConfigEntry* pEntry
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
- OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
- OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
+ OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
+ 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)
{
aNewName = aNameDialog.GetName();
- if( aNewName.isEmpty() ) // tdf#80758 - Accelerator character ("~") is passed as
- pEntry->SetName( "~" ); // the button name in case of empty values.
+ if (aNewName.isEmpty()) // tdf#80758 - Accelerator character ("~") is passed as
+ pEntry->SetName("~"); // the button name in case of empty values.
else
- pEntry->SetName( aNewName );
+ pEntry->SetName(aNewName);
m_xContentsListBox->set_text(nActEntry, aNewName, 0);
bNeedsApply = true;
@@ -507,57 +493,54 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
else if (rIdent == "changeIcon")
{
int nActEntry = m_xContentsListBox->get_selected_index();
- SvxConfigEntry* pEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ SvxConfigEntry* pEntry
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
- SvxIconSelectorDialog aIconDialog(GetFrameWeld(),
- GetSaveInData()->GetImageManager(),
- GetSaveInData()->GetParentImageManager());
+ SvxIconSelectorDialog aIconDialog(GetFrameWeld(), GetSaveInData()->GetImageManager(),
+ GetSaveInData()->GetParentImageManager());
if (aIconDialog.run() == RET_OK)
{
- css::uno::Reference< css::graphic::XGraphic > newgraphic =
- aIconDialog.GetSelectedIcon();
+ css::uno::Reference<css::graphic::XGraphic> newgraphic = aIconDialog.GetSelectedIcon();
- if ( newgraphic.is() )
+ if (newgraphic.is())
{
- css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > >
- aGraphicSeq( 1 );
-
- css::uno::Sequence<OUString> aURLSeq { pEntry->GetCommand() };
+ css::uno::Sequence<OUString> aURLSeq{ pEntry->GetCommand() };
- if ( !pEntry->GetBackupGraphic().is() )
+ if (!pEntry->GetBackupGraphic().is())
{
- css::uno::Reference< css::graphic::XGraphic > backup =
- SvxConfigPageHelper::GetGraphic(GetSaveInData()->GetImageManager(),
- aURLSeq[0]);
+ css::uno::Reference<css::graphic::XGraphic> backup
+ = SvxConfigPageHelper::GetGraphic(GetSaveInData()->GetImageManager(),
+ aURLSeq[0]);
- if ( backup.is() )
+ if (backup.is())
{
pEntry->SetBackupGraphic(backup);
}
}
- aGraphicSeq[ 0 ] = newgraphic;
+ css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq{
+ newgraphic
+ };
try
{
GetSaveInData()->GetImageManager()->replaceImages(
- SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
+ SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq);
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);
+ m_xContentsListBox->set_toggle(nActEntry, pEntry->IsVisible() ? TRISTATE_TRUE
+ : TRISTATE_FALSE);
InsertEntryIntoUI(pEntry, m_xContentsListBox->get_widget(), nActEntry);
m_xContentsListBox->select(nActEntry);
m_xContentsListBox->scroll_to_row(nActEntry);
- GetSaveInData()->PersistChanges(
- GetSaveInData()->GetImageManager() );
+ GetSaveInData()->PersistChanges(GetSaveInData()->GetImageManager());
}
- catch ( const css::uno::Exception&)
+ catch (const css::uno::Exception&)
{
TOOLS_WARN_EXCEPTION("cui.customize", "Error replacing image");
}
@@ -567,41 +550,37 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
else if (rIdent == "resetIcon")
{
int nActEntry = m_xContentsListBox->get_selected_index();
- SvxConfigEntry* pEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ SvxConfigEntry* pEntry
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
- css::uno::Reference< css::graphic::XGraphic > backup =
- pEntry->GetBackupGraphic();
+ css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq{
+ pEntry->GetBackupGraphic()
+ };
- css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > >
- aGraphicSeq( 1 );
- aGraphicSeq[ 0 ] = backup;
-
- css::uno::Sequence<OUString> aURLSeq { pEntry->GetCommand() };
+ css::uno::Sequence<OUString> aURLSeq{ pEntry->GetCommand() };
try
{
- GetSaveInData()->GetImageManager()->replaceImages(
- SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
+ GetSaveInData()->GetImageManager()->replaceImages(SvxConfigPageHelper::GetImageType(),
+ aURLSeq, aGraphicSeq);
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);
+ m_xContentsListBox->set_toggle(nActEntry,
+ pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
InsertEntryIntoUI(pEntry, m_xContentsListBox->get_widget(), nActEntry);
m_xContentsListBox->select(nActEntry);
m_xContentsListBox->scroll_to_row(nActEntry);
// reset backup in entry
- pEntry->SetBackupGraphic(
- css::uno::Reference< css::graphic::XGraphic >() );
+ pEntry->SetBackupGraphic(css::uno::Reference<css::graphic::XGraphic>());
- GetSaveInData()->PersistChanges(
- GetSaveInData()->GetImageManager() );
+ GetSaveInData()->PersistChanges(GetSaveInData()->GetImageManager());
}
- catch ( const css::uno::Exception& )
+ catch (const css::uno::Exception&)
{
TOOLS_WARN_EXCEPTION("cui.customize", "Error resetting image");
}
@@ -609,43 +588,39 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
else if (rIdent == "restoreItem")
{
int nActEntry = m_xContentsListBox->get_selected_index();
- SvxConfigEntry* pEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ SvxConfigEntry* pEntry
+ = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
- ToolbarSaveInData* pSaveInData =
- static_cast<ToolbarSaveInData*>( GetSaveInData() );
+ ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
- OUString aSystemName =
- pSaveInData->GetSystemUIName( pEntry->GetCommand() );
+ OUString aSystemName = pSaveInData->GetSystemUIName(pEntry->GetCommand());
- if ( !pEntry->GetName().equals( aSystemName ) )
+ if (!pEntry->GetName().equals(aSystemName))
{
- pEntry->SetName( aSystemName );
- m_xContentsListBox->set_text(
- nActEntry, SvxConfigPageHelper::stripHotKey(aSystemName), 0);
+ pEntry->SetName(aSystemName);
+ m_xContentsListBox->set_text(nActEntry, SvxConfigPageHelper::stripHotKey(aSystemName),
+ 0);
bNeedsApply = true;
}
- css::uno::Sequence<OUString> aURLSeq { pEntry->GetCommand() };
+ css::uno::Sequence<OUString> aURLSeq{ pEntry->GetCommand() };
try
{
- GetSaveInData()->GetImageManager()->removeImages(
- SvxConfigPageHelper::GetImageType(), aURLSeq );
+ GetSaveInData()->GetImageManager()->removeImages(SvxConfigPageHelper::GetImageType(),
+ aURLSeq);
// reset backup in entry
- pEntry->SetBackupGraphic(
- css::uno::Reference< css::graphic::XGraphic >() );
+ pEntry->SetBackupGraphic(css::uno::Reference<css::graphic::XGraphic>());
- GetSaveInData()->PersistChanges(
- GetSaveInData()->GetImageManager() );
+ GetSaveInData()->PersistChanges(GetSaveInData()->GetImageManager());
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);
+ pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
InsertEntryIntoUI(pEntry, m_xContentsListBox->get_widget(), nActEntry);
m_xContentsListBox->select(nActEntry);
@@ -653,7 +628,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
bNeedsApply = true;
}
- catch ( const css::uno::Exception& )
+ catch (const css::uno::Exception&)
{
TOOLS_WARN_EXCEPTION("cui.customize", "Error restoring image");
}
@@ -665,9 +640,9 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
return;
}
- if ( bNeedsApply )
+ if (bNeedsApply)
{
- static_cast<ToolbarSaveInData*>( GetSaveInData())->ApplyToolbar( pToolbar );
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar(pToolbar);
UpdateButtonStates();
}
}
@@ -676,18 +651,17 @@ 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());
+ SvxConfigEntry* pToolbar
+ = 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)));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
+ GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ CuiResId(RID_CUISTR_CONFIRM_RESTORE_DEFAULT)));
if (xQueryBox->run() == RET_YES)
{
- ToolbarSaveInData* pSaveInData =
- static_cast<ToolbarSaveInData*>(GetSaveInData());
+ ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData());
- pSaveInData->RestoreToolbar( pToolbar );
+ pSaveInData->RestoreToolbar(pToolbar);
SelectElement();
}
@@ -698,17 +672,17 @@ void SvxToolbarConfigPage::UpdateButtonStates()
SvxConfigEntry* pToolbar = GetTopLevelSelection();
int selection = m_xContentsListBox->get_selected_index();
- bool bIsSeparator =
- selection != -1 && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())->IsSeparator();
- bool bIsValidSelection =
- (m_xContentsListBox->n_children() != 0 && selection != -1);
+ bool bIsSeparator
+ = selection != -1
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(selection))->IsSeparator();
+ bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && selection != -1);
- m_xMoveUpButton->set_sensitive( bIsValidSelection );
- m_xMoveDownButton->set_sensitive( bIsValidSelection );
+ m_xMoveUpButton->set_sensitive(bIsValidSelection);
+ m_xMoveDownButton->set_sensitive(bIsValidSelection);
- m_xRemoveCommandButton->set_sensitive( bIsValidSelection );
+ m_xRemoveCommandButton->set_sensitive(bIsValidSelection);
- m_xModifyBtn->set_sensitive( bIsValidSelection && !bIsSeparator );
+ m_xModifyBtn->set_sensitive(bIsValidSelection && !bIsSeparator);
// Handle the gear button
// "toolbar_gear_add" option is always enabled
@@ -718,15 +692,14 @@ 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();
- OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
+ OUString label = SvxConfigPageHelper::replaceSaveInName(msg, saveInName);
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- label));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
+ GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, label));
return xQueryBox->run();
}
@@ -735,12 +708,12 @@ void SvxToolbarConfigPage::SelectElement()
m_xContentsListBox->clear();
SvxConfigEntry* pToolbar = GetTopLevelSelection();
- if ( pToolbar == nullptr )
+ if (pToolbar == nullptr)
{
//TODO: Disable related buttons
- m_xInsertBtn->set_sensitive( false );
- m_xResetBtn->set_sensitive( false );
- m_xGearBtn->set_sensitive( false );
+ m_xInsertBtn->set_sensitive(false);
+ m_xResetBtn->set_sensitive(false);
+ m_xGearBtn->set_sensitive(false);
return;
}
@@ -774,10 +747,10 @@ 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);
+ m_xContentsListBox->set_toggle(i, entry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE);
InsertEntryIntoUI(entry, m_xContentsListBox->get_widget(), i);
++i;
}
@@ -793,15 +766,14 @@ void SvxToolbarConfigPage::AddFunction(int nTarget)
return;
// Add the command to the contents listbox of the selected toolbar
- int nNewLBEntry =
- SvxConfigPage::AddFunction(nTarget, true/*bAllowDuplicates*/);
+ int nNewLBEntry = SvxConfigPage::AddFunction(nTarget, true /*bAllowDuplicates*/);
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 ?
+ if (pEntry->IsBinding()) //TODO sep ?
{
pEntry->SetVisible(true);
m_xContentsListBox->set_toggle(nNewLBEntry, TRISTATE_TRUE);
@@ -813,28 +785,28 @@ void SvxToolbarConfigPage::AddFunction(int nTarget)
// TODO: Figure out a way to show the changes on the toolbar, but revert if
// the dialog is closed by pressing "Cancel"
// get currently selected toolbar and apply change
- if ( pToolbar != nullptr )
+ if (pToolbar != nullptr)
{
- static_cast<ToolbarSaveInData*>( GetSaveInData() )->ApplyToolbar( pToolbar );
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar(pToolbar);
}
}
-SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(std::unique_ptr<weld::TreeView> xParent, SvxToolbarConfigPage* pPg)
+SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(std::unique_ptr<weld::TreeView> xParent,
+ SvxToolbarConfigPage* pPg)
: SvxMenuEntriesListBox(std::move(xParent), pPg)
{
m_xControl->connect_toggled(LINK(this, SvxToolbarEntriesListBox, CheckButtonHdl));
- m_xControl->connect_key_press(Link<const KeyEvent&, bool>()); //acknowledge we first remove the old one
- m_xControl->connect_key_press(LINK(this, SvxToolbarEntriesListBox, KeyInputHdl)); // then add the new one
+ m_xControl->connect_key_press(
+ Link<const KeyEvent&, bool>()); //acknowledge we first remove the old one
+ m_xControl->connect_key_press(
+ LINK(this, SvxToolbarEntriesListBox, KeyInputHdl)); // then add the new one
}
-SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
-{
-}
+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())
{
@@ -842,10 +814,10 @@ void SvxToolbarEntriesListBox::ChangedVisibility(int nRow)
SvxConfigEntry* pToolbar = m_pPage->GetTopLevelSelection();
- ToolbarSaveInData* pToolbarSaveInData = static_cast<ToolbarSaveInData*>(
- m_pPage->GetSaveInData() );
+ ToolbarSaveInData* pToolbarSaveInData
+ = static_cast<ToolbarSaveInData*>(m_pPage->GetSaveInData());
- pToolbarSaveInData->ApplyToolbar( pToolbar );
+ pToolbarSaveInData->ApplyToolbar(pToolbar);
}
}
@@ -857,13 +829,15 @@ IMPL_LINK(SvxToolbarEntriesListBox, CheckButtonHdl, const weld::TreeView::iter_c
IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
{
// space key will change visibility of toolbar items
- if ( rKeyEvent.GetKeyCode() == KEY_SPACE )
+ 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 ? TRISTATE_FALSE : TRISTATE_TRUE);
+ m_xControl->set_toggle(nRow, m_xControl->get_toggle(nRow) == TRISTATE_TRUE
+ ? TRISTATE_FALSE
+ : TRISTATE_TRUE);
ChangedVisibility(nRow);
}
return true;
@@ -871,7 +845,7 @@ IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, boo
return SvxMenuEntriesListBox::KeyInputHdl(rKeyEvent);
}
-IMPL_LINK( SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool )
+IMPL_LINK(SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt, bool)
{
if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
return false;
@@ -880,18 +854,20 @@ IMPL_LINK( SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCE
// Select clicked entry
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
- rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false);
+ if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
+ return false;
rTreeView.select(*xIter);
- SelectToolbarEntry( rTreeView );
+ SelectToolbarEntry(rTreeView);
int nSelectIndex = m_xContentsListBox->get_selected_index();
- bool bIsSeparator =
- nSelectIndex != -1 && reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())->IsSeparator();
- bool bIsValidSelection =
- ( m_xContentsListBox->n_children() != 0 && nSelectIndex != -1 );
+ bool bIsSeparator
+ = nSelectIndex != -1
+ && weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
+ bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && nSelectIndex != -1);
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) );
+ std::unique_ptr<weld::Builder> xBuilder(
+ Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
auto xContextMenu = xBuilder->weld_menu("menu");
xContextMenu->set_visible("add", false);
xContextMenu->set_visible("remove", bIsValidSelection);
@@ -899,24 +875,25 @@ IMPL_LINK( SvxToolbarConfigPage, ContentContextMenuHdl, const CommandEvent&, rCE
xContextMenu->set_visible("changeIcon", bIsValidSelection && !bIsSeparator);
xContextMenu->set_visible("resetIcon", bIsValidSelection && !bIsSeparator);
xContextMenu->set_visible("restoreDefault", bIsValidSelection && !bIsSeparator);
- OString sCommand(xContextMenu->popup_at_rect( &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1) ) ) );
-
- if ( sCommand == "remove")
- RemoveCommandHdl( *m_xRemoveCommandButton );
- else if ( sCommand == "rename" )
- ModifyItemHdl( "renameItem" );
- else if ( sCommand == "changeIcon" )
- ModifyItemHdl( "changeIcon" );
- else if ( sCommand == "resetIcon" )
- ModifyItemHdl( "resetIcon" );
- else if ( sCommand == "restoreDefault" )
- ModifyItemHdl( "restoreItem" );
- else if ( !sCommand.isEmpty() )
- SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand );
+ OUString sCommand(xContextMenu->popup_at_rect(
+ &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
+
+ if (sCommand == "remove")
+ RemoveCommandHdl(*m_xRemoveCommandButton);
+ else if (sCommand == "rename")
+ ModifyItemHdl("renameItem");
+ else if (sCommand == "changeIcon")
+ ModifyItemHdl("changeIcon");
+ else if (sCommand == "resetIcon")
+ ModifyItemHdl("resetIcon");
+ else if (sCommand == "restoreDefault")
+ ModifyItemHdl("restoreItem");
+ else if (!sCommand.isEmpty())
+ SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
return true;
}
-IMPL_LINK( SvxToolbarConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt, bool )
+IMPL_LINK(SvxToolbarConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt, bool)
{
if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
return false;
@@ -925,10 +902,12 @@ IMPL_LINK( SvxToolbarConfigPage, FunctionContextMenuHdl, const CommandEvent&, rC
// Select clicked entry
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
- rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false);
+ if (!rTreeView.get_dest_row_at_pos(rCEvt.GetMousePosPixel(), xIter.get(), false))
+ return false;
rTreeView.select(*xIter);
- SelectFunctionHdl( rTreeView );
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) );
+ SelectFunctionHdl(rTreeView);
+ std::unique_ptr<weld::Builder> xBuilder(
+ Application::CreateBuilder(&rTreeView, "cui/ui/entrycontextmenu.ui"));
auto xContextMenu = xBuilder->weld_menu("menu");
xContextMenu->set_visible("add", true);
xContextMenu->set_visible("remove", false);
@@ -936,12 +915,13 @@ IMPL_LINK( SvxToolbarConfigPage, FunctionContextMenuHdl, const CommandEvent&, rC
xContextMenu->set_visible("changeIcon", false);
xContextMenu->set_visible("resetIcon", false);
xContextMenu->set_visible("restoreDefault", false);
- OString sCommand(xContextMenu->popup_at_rect( &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1) ) ) );
+ OUString sCommand(xContextMenu->popup_at_rect(
+ &rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))));
- if ( sCommand == "add")
- AddCommandHdl( *m_xAddCommandButton );
- else if ( !sCommand.isEmpty() )
- SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand );
+ if (sCommand == "add")
+ AddCommandHdl(*m_xAddCommandButton);
+ else if (!sCommand.isEmpty())
+ SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand);
return true;
}
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 5fc6a95dd4fe..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;
-const char FOLDERNAME_UICONFIG[] = "Configurations2";
+constexpr OUString FOLDERNAME_UICONFIG = u"Configurations2"_ustr;
-const char MEDIATYPE_PROPNAME[] = "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();
@@ -1206,8 +1240,8 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
m_xRemoveButton->set_sensitive(false);
m_xChangeButton->set_sensitive(false);
- // #i36994 First selected can return zero!
- TAccInfo* pEntry = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_selected_id().toInt64());
+ // #i36994 First selected can return null!
+ TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_selected_id());
if (pEntry)
{
OUString sPossibleNewCommand = m_xFunctionBox->GetCurCommand();
@@ -1216,19 +1250,21 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
{
if (pEntry->isConfigured())
m_xRemoveButton->set_sensitive(true);
- m_xChangeButton->set_sensitive(pEntry->m_sCommand != sPossibleNewCommand);
+ m_xChangeButton->set_sensitive(pEntry->m_sCommand != sPossibleNewCommand
+ && !sPossibleNewCommand.isEmpty());
}
// update key box
m_xKeyBox->clear();
- for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
+ if (!sPossibleNewCommand.isEmpty())
{
- TAccInfo* pUserData
- = reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
- if (pUserData && pUserData->m_sCommand == sPossibleNewCommand)
+ for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
{
- m_xKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pUserData)),
- pUserData->m_aKey.GetName());
+ TAccInfo* pUserData = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
+ if (pUserData && pUserData->m_sCommand == sPossibleNewCommand)
+ {
+ m_xKeyBox->append(weld::toId(pUserData), pUserData->m_aKey.GetName());
+ }
}
}
}
@@ -1237,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)
@@ -1249,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;
@@ -1308,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
@@ -1379,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);
@@ -1451,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)
@@ -1464,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&)
{
@@ -1501,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
@@ -1514,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 401f48f7a664..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;
@@ -157,9 +162,9 @@ void printEntries(SvxEntries* entries)
#endif
bool
-SvxConfigPage::CanConfig( const OUString& aModuleId )
+SvxConfigPage::CanConfig( std::u16string_view aModuleId )
{
- return !(aModuleId == "com.sun.star.script.BasicIDE" || aModuleId == "com.sun.star.frame.Bibliography");
+ return aModuleId != u"com.sun.star.script.BasicIDE" && aModuleId != u"com.sun.star.frame.Bibliography";
}
static std::unique_ptr<SfxTabPage> CreateSvxMenuConfigPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
@@ -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)
@@ -1355,15 +1397,15 @@ void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry const * pToSelect )
}
void SvxConfigPage::AddSubMenusToUI(
- const OUString& rBaseTitle, SvxConfigEntry const * pParentData )
+ std::u16string_view rBaseTitle, SvxConfigEntry const * pParentData )
{
for (auto const& entryData : *pParentData->GetEntries())
{
if (entryData->IsPopup())
{
- OUString subMenuTitle = rBaseTitle + aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey(entryData->GetName());
+ 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 )
{
@@ -1973,7 +2052,7 @@ void ToolbarSaveInData::SetSystemStyle(
if ( xUIElement.is() )
xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY );
- window = VCLUnoHelper::GetWindow( xWindow ).get();
+ window = VCLUnoHelper::GetWindow( xWindow );
}
if ( window == nullptr || window->GetType() != WindowType::TOOLBOX )
@@ -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 )
{
@@ -2030,7 +2109,7 @@ void ToolbarSaveInData::SetSystemStyle(
catch ( uno::Exception& )
{
// do nothing, a default value is returned
- SAL_WARN("cui.customize", "Exception setting toolbar style");
+ TOOLS_WARN_EXCEPTION("cui.customize", "Exception setting toolbar 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,12 +2709,12 @@ 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_xTbSymbol(new ValueSet(m_xBuilder->weld_scrolled_window("symbolswin")))
+ , 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"))
, m_xBtnImport(m_xBuilder->weld_button("importButton"))
@@ -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;
@@ -3072,10 +3145,10 @@ void SvxIconSelectorDialog::ImportGraphics(
OUStringBuffer message;
OUString fPath;
if (rejectedCount > 1)
- fPath = rPaths[0].copy(8) + "/";
+ 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,12 +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;
- css::awt::Size aSize;
- aMediaProps[0].Value <<= aURL;
try
{
uno::Reference< beans::XPropertySet > props =
@@ -3099,10 +3168,11 @@ 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;
+ css::awt::Size aSize;
a >>= aSize;
if ( 0 == aSize.Width || 0 == aSize.Height )
@@ -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 1d863889610c..3a2cdbc1b05e 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -42,16 +42,23 @@
#include <sfx2/minfitem.hxx>
#include <comphelper/SetFlagContextHelper.hxx>
#include <comphelper/documentinfo.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <svtools/imagemgr.hxx>
#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;
@@ -72,11 +79,14 @@ const char CMDURL_STYLEPROT_ONLY[] = ".uno:StyleApply?";
const char CMDURL_SPART_ONLY [] = "Style:string=";
const char CMDURL_FPART_ONLY [] = "FamilyName:string=";
-const char STYLEPROP_UINAME[] = "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(const OUString& sFamily, const OUString& sStyle)
+OUString SfxStylesInfo_Impl::generateCommand(
+ std::u16string_view sFamily, std::u16string_view sStyle)
{
- return ".uno:StyleApply?Style:string="
+ return OUString::Concat(".uno:StyleApply?Style:string=")
+ sStyle
+ "&FamilyName:string="
+ sFamily;
@@ -236,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 )
@@ -256,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;
@@ -264,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())
@@ -288,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;
}
@@ -330,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();
@@ -340,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))
{
}
@@ -435,7 +445,17 @@ void CuiConfigGroupListBox::ClearAll()
for ( sal_uInt16 i=0; i<nCount; ++i )
{
SfxGroupInfo_Impl *pData = aArr[i].get();
- if (pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER)
+ if (pData->nKind == SfxCfgKind::GROUP_STYLES && pData->pObject)
+ {
+ SfxStyleInfo_Impl* pStyle = static_cast<SfxStyleInfo_Impl*>(pData->pObject);
+ delete pStyle;
+ }
+ else if (pData->nKind == SfxCfgKind::FUNCTION_SCRIPT && pData->pObject )
+ {
+ OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
+ delete pScriptURI;
+ }
+ else if (pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER)
{
XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != nullptr)
@@ -449,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
@@ -481,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() )
@@ -555,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();
@@ -569,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);
}
@@ -608,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();
}
@@ -623,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;
@@ -630,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");
@@ -647,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 )
@@ -659,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();
@@ -746,7 +775,7 @@ OUString CuiConfigGroupListBox::GetImage(
}
Reference< XInterface >
-CuiConfigGroupListBox::getDocumentModel( Reference< XComponentContext > const & xCtx, OUString const & docName )
+CuiConfigGroupListBox::getDocumentModel( Reference< XComponentContext > const & xCtx, std::u16string_view docName )
{
Reference< XInterface > xModel;
Reference< frame::XDesktop2 > desktop = frame::Desktop::create( xCtx );
@@ -810,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();
@@ -822,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;
@@ -895,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);
}
}
@@ -920,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) );
@@ -944,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:
@@ -953,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;
}
@@ -967,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);
}
}
@@ -981,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( const OUString& rBasic,
- const OUString& rMacro )
-{
- const OUString aBasicName(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 );
}
}
@@ -1014,48 +1062,65 @@ void CuiConfigGroupListBox::SelectMacro( const OUString& 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
@@ -1071,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());
@@ -1095,6 +1157,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
m_xCommands->connect_changed( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
m_xCommands->connect_row_activated( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
+ m_xCommands->connect_popup_menu( LINK( this, SvxScriptSelectorDialog, ContextMenuHdl ) );
m_xOKButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
m_xCancelButton->connect_clicked( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
@@ -1112,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()
@@ -1135,6 +1205,36 @@ IMPL_LINK_NOARG(SvxScriptSelectorDialog, FunctionDoubleClickHdl, weld::TreeView&
return true;
}
+IMPL_LINK(SvxScriptSelectorDialog, ContextMenuHdl, const CommandEvent&, rCEvt, bool)
+{
+ weld::TreeView& xTreeView = m_xCommands->get_widget();
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu || !xTreeView.n_children())
+ return false;
+
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(&xTreeView, "modules/BasicIDE/ui/sortmenu.ui"));
+ std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("sortmenu"));
+ std::unique_ptr<weld::Menu> xDropMenu(xBuilder->weld_menu("sortsubmenu"));
+ xDropMenu->set_active("alphabetically", xTreeView.get_sort_order());
+ xDropMenu->set_active("properorder", !xTreeView.get_sort_order());
+
+ OUString sCommand(xPopup->popup_at_rect(&xTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+ if (sCommand == "alphabetically")
+ {
+ xTreeView.make_sorted();
+ }
+ else if (sCommand == "properorder")
+ {
+ xTreeView.make_unsorted();
+ m_xCategories->GroupSelected();
+ }
+ else if (!sCommand.isEmpty())
+ {
+ SAL_WARN("cui.customize", "Unknown context menu action: " << sCommand );
+ }
+
+ return true;
+}
+
// Check if command is selected and enable the OK button accordingly
// Grab the help text for this id if available and update the description field
void
@@ -1145,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
@@ -1163,6 +1262,7 @@ IMPL_LINK(SvxScriptSelectorDialog, ClickHdl, weld::Button&, rButton, void)
}
else if (&rButton == m_xOKButton.get())
{
+ SaveLastUsedMacro();
m_xDialog->response(RET_OK);
}
}
@@ -1170,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
@@ -1181,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 )
@@ -1194,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 19860e19b2d3..79197be4bf43 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -20,26 +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 <algorithm>
-#include <iterator>
-#include <set>
+#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)
@@ -62,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)
@@ -92,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
@@ -272,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;
}
}
@@ -308,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)
@@ -323,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)
{
@@ -344,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();
@@ -374,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)
{
@@ -395,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)
- {
- 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
+ if (const EventPair* pEventPair = LookupEvent(sEventName))
{
- 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.
@@ -496,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();
@@ -546,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;
@@ -562,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;
@@ -587,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 );
@@ -623,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"))
{
@@ -634,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 ba49e07b9365..4d39ad937664 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -7,171 +7,114 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
+
+#include <sal/config.h>
+
+#include <algorithm>
+#include <cmath>
+
#include <config_folders.h>
#include <AdditionsDialog.hxx>
+#include <dialmgr.hxx>
+#include <strings.hrc>
-#include <rtl/ustrbuf.hxx>
-#include <unordered_set>
#include <sal/log.hxx>
-#include <strings.hrc>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/inspection/PropertyLineElement.hpp>
#include <com/sun/star/graphic/GraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
-#include <rtl/strbuf.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-#include <dialmgr.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
#include <vcl/graphicfilter.hxx>
-#include <vcl/mnemonic.hxx>
+#include <cppuhelper/exc_hlp.hxx>
-#include <com/sun/star/task/InteractionHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/util/SearchAlgorithms2.hpp>
+#include <unotools/textsearch.hxx>
+#include <unotools/ucbstreamhelper.hxx>
#include <ucbhelper/content.hxx>
-#include <comphelper/simplefileaccessinteraction.hxx>
-#include <curl/curl.h>
+#include <com/sun/star/deployment/DeploymentException.hpp>
+#include <com/sun/star/deployment/ExtensionManager.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/CommandFailedException.hpp>
+
+#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;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
-#ifdef UNX
-const char kUserAgent[] = "LibreOffice AdditionsDownloader/1.0 (Linux)";
-#else
-const char kUserAgent[] = "LibreOffice AdditionsDownloader/1.0 (unknown platform)";
-#endif
-
namespace
{
-struct AdditionInfo
-{
- OUString sExtensionID;
- OUString sName;
- OUString sAuthorName;
- OUString sExtensionURL;
- OUString sScreenshotURL;
- OUString sIntroduction;
- OUString sDescription;
- OUString sCompatibleVersion;
- OUString sReleaseVersion;
- OUString sLicense;
- OUString sCommentNumber;
- OUString sCommentURL;
- OUString sRating;
- OUString sDownloadNumber;
- OUString sDownloadURL;
-};
-
-size_t WriteCallback(void* ptr, size_t size, size_t nmemb, void* userp)
-{
- if (!userp)
- return 0;
-
- std::string* response = static_cast<std::string*>(userp);
- size_t real_size = size * nmemb;
- response->append(static_cast<char*>(ptr), real_size);
- return real_size;
-}
-
-// Callback to get the response data from server to a file.
-size_t WriteCallbackFile(void* ptr, size_t size, size_t nmemb, void* userp)
-{
- if (!userp)
- return 0;
-
- SvStream* response = static_cast<SvStream*>(userp);
- size_t real_size = size * nmemb;
- response->WriteBytes(ptr, real_size);
- return real_size;
-}
-
// Gets the content of the given URL and returns as a standard string
-std::string curlGet(const OString& rURL)
+std::string ucbGet(const OUString& rURL)
{
- CURL* curl = curl_easy_init();
-
- if (!curl)
- return std::string();
-
- curl_easy_setopt(curl, CURLOPT_URL, rURL.getStr());
-
- std::string response_body;
-
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, static_cast<void*>(&response_body));
-
- CURLcode cc = curl_easy_perform(curl);
- long http_code = 0;
- curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
-
- if (http_code != 200)
+ try
{
- SAL_WARN("cui.dialogs", "Download failed. Error code: " << http_code);
+ auto const s = utl::UcbStreamHelper::CreateStream(rURL, StreamMode::STD_READ);
+ if (!s)
+ {
+ SAL_WARN("cui.dialogs", "CreateStream <" << rURL << "> failed");
+ return {};
+ }
+ std::string response_body;
+ do
+ {
+ char buf[4096];
+ auto const n = s->ReadBytes(buf, sizeof buf);
+ response_body.append(buf, n);
+ } while (s->good());
+ if (s->bad())
+ {
+ SAL_WARN("cui.dialogs", "Reading <" << rURL << "> failed with " << s->GetError());
+ return {};
+ }
+ return response_body;
}
-
- if (cc != CURLE_OK)
+ catch (css::uno::Exception&)
{
- SAL_WARN("cui.dialogs", "curl error: " << cc);
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "Download failed");
+ return {};
}
-
- return response_body;
}
-// Downloads and saves the file at the given rURL to a local path (sFileURL)
-void curlDownload(const OString& rURL, const OUString& sFileURL)
+// Downloads and saves the file at the given rURL to a local path (sFolderURL/fileName)
+void ucbDownload(const OUString& rURL, const OUString& sFolderURL, const OUString& fileName)
{
- CURL* curl = curl_easy_init();
- SvFileStream aFile(sFileURL, StreamMode::WRITE);
-
- if (!curl)
- return;
-
- curl_easy_setopt(curl, CURLOPT_URL, rURL.getStr());
- curl_easy_setopt(curl, CURLOPT_USERAGENT, kUserAgent);
-
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallbackFile);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, static_cast<void*>(&aFile));
-
- CURLcode cc = curl_easy_perform(curl);
- long http_code = 0;
- curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
-
- if (http_code != 200)
+ try
{
- SAL_WARN("cui.dialogs", "Download failed. Error code: " << http_code);
+ ucbhelper::Content(sFolderURL, {}, comphelper::getProcessComponentContext())
+ .transferContent(ucbhelper::Content(rURL, {}, comphelper::getProcessComponentContext()),
+ ucbhelper::InsertOperation::Copy, fileName,
+ css::ucb::NameClash::OVERWRITE);
}
-
- if (cc != CURLE_OK)
+ catch (css::uno::Exception&)
{
- SAL_WARN("cui.dialogs", "curl error: " << cc);
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "Download failed");
}
}
@@ -183,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)
@@ -201,55 +152,37 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd
try
{
AdditionInfo aNewAddition = {
- OStringToOUString(OString(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(OString(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(OString(arrayElement.child("author").string_value().get()),
+ OStringToOUString(arrayElement.child("extensionIntroduction").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("URL").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("screenshotURL").string_value().get()),
+ OStringToOUString(arrayElement.child("extensionDescription").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- OString(arrayElement.child("extensionIntroduction").string_value().get()),
+ arrayElement.child("releases").child(0).child("compatibility").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- OString(arrayElement.child("extensionDescription").string_value().get()),
+ arrayElement.child("releases").child(0).child("releaseName").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("releases")
- .child(0)
- .child("compatibleVersion")
- .string_value()
- .get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("releases")
- .child(0)
- .child("releaseNumber")
- .string_value()
- .get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("releases")
- .child(0)
- .child("license")
- .string_value()
- .get()),
+ OStringToOUString(
+ arrayElement.child("releases").child(0).child("license").string_value(),
+ RTL_TEXTENCODING_UTF8),
+ OStringToOUString(arrayElement.child("commentNumber").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("commentNumber").string_value().get()),
+ OStringToOUString(arrayElement.child("commentURL").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("commentURL").string_value().get()),
+ OStringToOUString(arrayElement.child("rating").string_value(),
RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(arrayElement.child("rating").string_value().get()),
+ OStringToOUString(arrayElement.child("downloadNumber").string_value(),
RTL_TEXTENCODING_UTF8),
OStringToOUString(
- OString(arrayElement.child("downloadNumber").string_value().get()),
- RTL_TEXTENCODING_UTF8),
- OStringToOUString(OString(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);
@@ -267,7 +200,6 @@ bool getPreviewFile(const AdditionInfo& aAdditionInfo, OUString& sPreviewFile)
{
uno::Reference<ucb::XSimpleFileAccess3> xFileAccess
= ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
- Reference<XComponentContext> xContext(::comphelper::getProcessComponentContext());
// copy the images to the user's additions folder
OUString userFolder = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
@@ -276,14 +208,14 @@ bool getPreviewFile(const AdditionInfo& aAdditionInfo, OUString& sPreviewFile)
userFolder += "/user/additions/" + aAdditionInfo.sExtensionID + "/";
OUString aPreviewFile(INetURLObject(aAdditionInfo.sScreenshotURL).getName());
- OString aPreviewURL = OUStringToOString(aAdditionInfo.sScreenshotURL, RTL_TEXTENCODING_UTF8);
+ OUString aPreviewURL = aAdditionInfo.sScreenshotURL;
try
{
osl::Directory::createPath(userFolder);
if (!xFileAccess->exists(userFolder + aPreviewFile))
- curlDownload(aPreviewURL, userFolder + aPreviewFile);
+ ucbDownload(aPreviewURL, userFolder, aPreviewFile);
}
catch (const uno::Exception&)
{
@@ -293,118 +225,196 @@ bool getPreviewFile(const AdditionInfo& aAdditionInfo, OUString& sPreviewFile)
return true;
}
+void LoadImage(std::u16string_view rPreviewFile, std::shared_ptr<AdditionsItem> pCurrentItem)
+{
+ const sal_Int8 Margin = 6;
+
+ SolarMutexGuard aGuard;
+
+ GraphicFilter aFilter;
+ Graphic aGraphic;
+
+ INetURLObject aURLObj(rPreviewFile);
+
+ // for VCL to be able to create bitmaps / do visual changes in the thread
+ aFilter.ImportGraphic(aGraphic, aURLObj);
+ BitmapEx aBmp = aGraphic.GetBitmapEx();
+ Size aBmpSize = aBmp.GetSizePixel();
+ Size aThumbSize(pCurrentItem->m_xImageScreenshot->get_size_request());
+ if (!aBmp.IsEmpty())
+ {
+ double aScale;
+ if (aBmpSize.Width() > aThumbSize.Width() - 2 * Margin)
+ {
+ aScale = static_cast<double>(aBmpSize.Width()) / (aThumbSize.Width() - 2 * Margin);
+ aBmp.Scale(Size(aBmpSize.Width() / aScale, aBmpSize.Height() / aScale));
+ }
+ else if (aBmpSize.Height() > aThumbSize.Height() - 2 * Margin)
+ {
+ aScale = static_cast<double>(aBmpSize.Height()) / (aThumbSize.Height() - 2 * Margin);
+ aBmp.Scale(Size(aBmpSize.Width() / aScale, aBmpSize.Height() / aScale));
+ };
+ aBmpSize = aBmp.GetSizePixel();
+ }
+
+ ScopedVclPtr<VirtualDevice> xVirDev = pCurrentItem->m_xImageScreenshot->create_virtual_device();
+ xVirDev->SetOutputSizePixel(aThumbSize);
+ //white background since images come with a white border
+ xVirDev->SetBackground(Wallpaper(COL_WHITE));
+ xVirDev->Erase();
+ xVirDev->DrawBitmapEx(Point(aThumbSize.Width() / 2 - aBmpSize.Width() / 2, Margin), aBmp);
+ pCurrentItem->m_xImageScreenshot->set_image(xVirDev.get());
+ xVirDev.disposeAndClear();
+}
+
} // End of the anonymous namespace
-SearchAndParseThread::SearchAndParseThread(AdditionsDialog* pDialog, const OUString& rURL,
- const bool& isFirstLoading)
+SearchAndParseThread::SearchAndParseThread(AdditionsDialog* pDialog, const bool isFirstLoading)
: Thread("cuiAdditionsSearchThread")
, m_pAdditionsDialog(pDialog)
- , m_aURL(rURL)
, 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() {}
-void SearchAndParseThread::execute()
+void SearchAndParseThread::Append(AdditionInfo& additionInfo)
{
- //m_pAdditionsDialog->ClearSearchResults();
- OUString sProgress;
- if (m_bIsFirstLoading)
- sProgress = CuiResId(RID_SVXSTR_ADDITIONS_LOADING);
- else
- sProgress = CuiResId(RID_SVXSTR_ADDITIONS_SEARCHING);
+ if (!m_bExecute)
+ return;
+ OUString aPreviewFile;
+ bool bResult
+ = !m_bUITest && getPreviewFile(additionInfo, aPreviewFile); // info vector json data
- m_pAdditionsDialog->SetProgress(sProgress);
+ if (!bResult)
+ {
+ SAL_INFO("cui.dialogs", "Couldn't get the preview file. Skipping: " << aPreviewFile);
+ return;
+ }
- uno::Reference<ucb::XSimpleFileAccess3> xFileAccess
- = ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
- OString rURL = OUStringToOString(m_aURL, RTL_TEXTENCODING_UTF8);
- std::string sResponse = curlGet(rURL);
+ SolarMutexGuard aGuard;
- std::vector<AdditionInfo> additionInfos;
+ auto newItem = std::make_shared<AdditionsItem>(m_pAdditionsDialog->m_xContentGrid.get(),
+ m_pAdditionsDialog, additionInfo);
+ m_pAdditionsDialog->m_aAdditionsItems.push_back(newItem);
+ std::shared_ptr<AdditionsItem> aCurrentItem = m_pAdditionsDialog->m_aAdditionsItems.back();
- parseResponse(sResponse, additionInfos);
+ LoadImage(aPreviewFile, aCurrentItem);
+ m_pAdditionsDialog->m_nCurrentListItemCount++;
- if (additionInfos.empty())
+ if (m_pAdditionsDialog->m_nCurrentListItemCount == m_pAdditionsDialog->m_nMaxItemCount)
{
- sProgress = CuiResId(RID_SVXSTR_ADDITIONS_NORESULTS);
- m_pAdditionsDialog->SetProgress(sProgress);
- return;
+ if (m_pAdditionsDialog->m_nCurrentListItemCount
+ != m_pAdditionsDialog->m_aAllExtensionsVector.size())
+ aCurrentItem->m_xButtonShowMore->set_visible(true);
}
- else
+}
+
+void SearchAndParseThread::Search()
+{
+ m_pAdditionsDialog->m_searchOptions.searchString
+ = m_pAdditionsDialog->m_xEntrySearch->get_text();
+ utl::TextSearch textSearch(m_pAdditionsDialog->m_searchOptions);
+
+ size_t nIteration = 0;
+ for (auto& rInfo : m_pAdditionsDialog->m_aAllExtensionsVector)
{
- //Get Preview Files
- sal_Int32 i = 0;
- for (const auto& additionInfo : additionInfos)
+ if (m_pAdditionsDialog->m_nCurrentListItemCount == m_pAdditionsDialog->m_nMaxItemCount)
+ break;
+
+ OUString sExtensionName = rInfo.sName;
+ OUString sExtensionDescription = rInfo.sDescription;
+
+ if (!m_pAdditionsDialog->m_xEntrySearch->get_text().isEmpty()
+ && !textSearch.searchForward(sExtensionName)
+ && !textSearch.searchForward(sExtensionDescription))
{
- if (!m_bExecute)
- return;
+ continue;
+ }
+ else
+ {
+ if (nIteration >= m_pAdditionsDialog->m_nCurrentListItemCount)
+ Append(rInfo);
+ nIteration++;
+ }
+ }
+ CheckInstalledExtensions();
+}
+
+void SearchAndParseThread::CheckInstalledExtensions()
+{
+ const uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> xAllPackages
+ = m_pAdditionsDialog->getInstalledExtensions();
- OUString aPreviewFile;
- bool bResult = getPreviewFile(additionInfo, aPreviewFile);
+ if (!xAllPackages.hasElements())
+ return;
+
+ OUString currentExtensionName;
- if (!bResult)
+ for (auto& package : xAllPackages)
+ {
+ for (auto& extensionVersion : package)
+ {
+ if (extensionVersion.is())
{
- SAL_INFO("cui.dialogs",
- "Couldn't get the preview file. Skipping: " << aPreviewFile);
- continue;
+ currentExtensionName = extensionVersion->getName();
+ if (currentExtensionName.isEmpty())
+ continue;
+
+ m_pAdditionsDialog->m_searchOptions.searchString = currentExtensionName;
+ utl::TextSearch textSearch(m_pAdditionsDialog->m_searchOptions);
+
+ for (auto& rInfo : m_pAdditionsDialog->m_aAdditionsItems)
+ {
+ OUString sExtensionDownloadURL = rInfo->m_sDownloadURL;
+
+ if (!textSearch.searchForward(sExtensionDownloadURL))
+ {
+ continue;
+ }
+ else
+ {
+ SolarMutexGuard aGuard;
+ rInfo->m_xButtonInstall->set_sensitive(false);
+ rInfo->m_xButtonInstall->set_label(
+ CuiResId(RID_CUISTR_ADDITIONS_INSTALLEDBUTTON));
+ }
+ }
}
-
- SolarMutexGuard aGuard;
- m_pAdditionsDialog->m_aAdditionsItems.emplace_back(
- m_pAdditionsDialog->m_xContentGrid.get());
- AdditionsItem& aCurrentItem = m_pAdditionsDialog->m_aAdditionsItems.back();
-
- sal_Int32 nGridPositionY = i++;
- aCurrentItem.m_xContainer->set_grid_left_attach(0);
- aCurrentItem.m_xContainer->set_grid_top_attach(nGridPositionY);
-
- aCurrentItem.m_xLinkButtonName->set_label(additionInfo.sName);
- aCurrentItem.m_xLinkButtonName->set_uri(additionInfo.sExtensionURL);
- aCurrentItem.m_xLabelDescription->set_label(additionInfo.sIntroduction);
- aCurrentItem.m_xLabelAuthor->set_label(additionInfo.sAuthorName);
- aCurrentItem.m_xButtonInstall->set_label(CuiResId(RID_SVXSTR_ADDITIONS_INSTALLBUTTON));
- OUString sLicenseString
- = CuiResId(RID_SVXSTR_ADDITIONS_LICENCE) + additionInfo.sLicense;
- aCurrentItem.m_xLabelLicense->set_label(sLicenseString);
- OUString sVersionString
- = CuiResId(RID_SVXSTR_ADDITIONS_REQUIREDVERSION) + additionInfo.sCompatibleVersion;
- aCurrentItem.m_xLabelVersion->set_label(sVersionString);
- aCurrentItem.m_xLinkButtonComments->set_label(additionInfo.sCommentNumber);
- aCurrentItem.m_xLinkButtonComments->set_uri(additionInfo.sCommentURL);
- aCurrentItem.m_xLabelDownloadNumber->set_label(additionInfo.sDownloadNumber);
-
- GraphicFilter aFilter;
- Graphic aGraphic;
-
- INetURLObject aURLObj(aPreviewFile);
-
- // This block may be added according to need
- /*OUString aAdditionsSetting = additionInfo.sSlug
- + ";" + additionInfo.sName
- + ";" + additionInfo.sPreviewURL
- + ";" + additionInfo.sHeaderURL
- + ";" + additionInfo.sFooterURL
- + ";" + additionInfo.sTextColor;
-
- m_pAdditionsDialog->AddPersonaSetting( aPersonaSetting );
- */
-
- // for VCL to be able to create bitmaps / do visual changes in the thread
- aFilter.ImportGraphic(aGraphic, aURLObj);
- BitmapEx aBmp = aGraphic.GetBitmapEx();
-
- ScopedVclPtr<VirtualDevice> xVirDev
- = aCurrentItem.m_xImageScreenshot->create_virtual_device();
- xVirDev->SetOutputSizePixel(aBmp.GetSizePixel());
- xVirDev->DrawBitmapEx(Point(0, 0), aBmp);
-
- aCurrentItem.m_xImageScreenshot->set_image(xVirDev.get());
- xVirDev.disposeAndClear();
}
}
+}
+
+void SearchAndParseThread::execute()
+{
+ OUString sProgress;
+ if (m_bIsFirstLoading)
+ sProgress = CuiResId(RID_CUISTR_ADDITIONS_LOADING);
+ else
+ 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 = !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(),
+ AdditionsDialog::sortByDownload);
+ Search();
+ }
+ else // Searching
+ {
+ Search();
+ }
if (!m_bExecute)
return;
@@ -414,27 +424,85 @@ void SearchAndParseThread::execute()
m_pAdditionsDialog->SetProgress(sProgress);
}
-AdditionsDialog::AdditionsDialog(weld::Window* pParent)
+AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag)
: GenericDialogController(pParent, "cui/ui/additionsdialog.ui", "AdditionsDialog")
+ , m_aSearchDataTimer("AdditionsDialog SearchDataTimer")
, m_xEntrySearch(m_xBuilder->weld_entry("entrySearch"))
- , m_xMenuButtonSettings(m_xBuilder->weld_menu_button("buttonGear"))
+ , m_xButtonClose(m_xBuilder->weld_button("buttonClose"))
, m_xContentWindow(m_xBuilder->weld_scrolled_window("contentWindow"))
, m_xContentGrid(m_xBuilder->weld_container("contentGrid"))
, m_xLabelProgress(m_xBuilder->weld_label("labelProgress"))
+ , m_xGearBtn(m_xBuilder->weld_menu_button("buttonGear"))
{
- // TODO - Temporary URL
- OString rURL = "https://yusufketen.com/extensionTest.json";
+ m_xGearBtn->connect_selected(LINK(this, AdditionsDialog, GearHdl));
+ m_xGearBtn->set_item_active("gear_sort_voting", true);
+
+ m_aSearchDataTimer.SetInvokeHandler(LINK(this, AdditionsDialog, ImplUpdateDataHdl));
+ m_aSearchDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
+
+ m_xEntrySearch->connect_changed(LINK(this, AdditionsDialog, SearchUpdateHdl));
+ m_xEntrySearch->connect_focus_out(LINK(this, AdditionsDialog, FocusOut_Impl));
+ m_xButtonClose->connect_clicked(LINK(this, AdditionsDialog, CloseButtonHdl));
- m_pSearchThread
- = new SearchAndParseThread(this, OStringToOUString(rURL, RTL_TEXTENCODING_UTF8), true);
+ m_sTag = sAdditionsTag;
+ m_nMaxItemCount = PAGE_SIZE; // Dialog initialization item count
+ m_nCurrentListItemCount = 0; // First, there is no item on the list.
+
+ OUString titlePrefix = CuiResId(RID_CUISTR_ADDITIONS_DIALOG_TITLE_PREFIX);
+ if (!m_sTag.isEmpty())
+ { // 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
+ }
+
+ 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());
+
+ //Initialize search util
+ m_searchOptions.AlgorithmType2 = css::util::SearchAlgorithms2::ABSOLUTE;
+ m_searchOptions.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
+ m_searchOptions.searchFlag |= (css::util::SearchFlags::REG_NOT_BEGINOFLINE
+ | css::util::SearchFlags::REG_NOT_ENDOFLINE);
+ m_pSearchThread = new SearchAndParseThread(this, true);
m_pSearchThread->launch();
- // fillGrid();
}
AdditionsDialog::~AdditionsDialog()
{
if (m_pSearchThread.is())
{
+ m_pSearchThread->StopExecution();
// Release the solar mutex, so the thread is not affected by the race
// when it's after the m_bExecute check but before taking the solar
// mutex.
@@ -443,10 +511,43 @@ AdditionsDialog::~AdditionsDialog()
}
}
+uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>>
+AdditionsDialog::getInstalledExtensions()
+{
+ uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> xAllPackages;
+
+ try
+ {
+ xAllPackages = m_xExtensionManager->getAllExtensions(
+ uno::Reference<task::XAbortChannel>(), uno::Reference<ucb::XCommandEnvironment>());
+ }
+ catch (const deployment::DeploymentException&)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "");
+ }
+ catch (const ucb::CommandFailedException&)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "");
+ }
+ catch (const ucb::CommandAbortedException&)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "");
+ }
+ catch (const lang::IllegalArgumentException& e)
+ {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(e.Message, e.Context, anyEx);
+ }
+ return xAllPackages;
+}
+
void AdditionsDialog::SetProgress(const OUString& rProgress)
{
if (rProgress.isEmpty())
+ {
m_xLabelProgress->hide();
+ m_xButtonClose->set_sensitive(true);
+ }
else
{
SolarMutexGuard aGuard;
@@ -456,4 +557,311 @@ void AdditionsDialog::SetProgress(const OUString& rProgress)
}
}
+void AdditionsDialog::ClearList()
+{
+ // for VCL to be able to destroy bitmaps
+ SolarMutexGuard aGuard;
+
+ for (auto& item : this->m_aAdditionsItems)
+ {
+ item->m_xContainer->hide();
+ }
+ this->m_aAdditionsItems.clear();
+}
+
+void AdditionsDialog::RefreshUI()
+{
+ if (m_pSearchThread.is())
+ m_pSearchThread->StopExecution();
+ ClearList();
+ m_nCurrentListItemCount = 0;
+ m_nMaxItemCount = PAGE_SIZE;
+ m_pSearchThread = new SearchAndParseThread(this, false);
+ m_pSearchThread->launch();
+}
+
+bool AdditionsDialog::sortByRating(const AdditionInfo& a, const AdditionInfo& b)
+{
+ return a.sRating.toDouble() > b.sRating.toDouble();
+}
+
+bool AdditionsDialog::sortByComment(const AdditionInfo& a, const AdditionInfo& b)
+{
+ return a.sCommentNumber.toUInt32() > b.sCommentNumber.toUInt32();
+}
+
+bool AdditionsDialog::sortByDownload(const AdditionInfo& a, const AdditionInfo& b)
+{
+ return a.sDownloadNumber.toUInt32() > b.sDownloadNumber.toUInt32();
+}
+
+AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDialog,
+ const AdditionInfo& additionInfo)
+ : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/additionsfragment.ui"))
+ , m_xContainer(m_xBuilder->weld_widget("additionsEntry"))
+ , m_xImageScreenshot(m_xBuilder->weld_image("imageScreenshot"))
+ , m_xButtonInstall(m_xBuilder->weld_button("buttonInstall"))
+ , m_xLinkButtonWebsite(m_xBuilder->weld_link_button("btnWebsite"))
+ , m_xLabelName(m_xBuilder->weld_label("lbName"))
+ , m_xLabelAuthor(m_xBuilder->weld_label("labelAuthor"))
+ , m_xLabelDescription(m_xBuilder->weld_label("labelDescription"))
+ , m_xLabelLicense(m_xBuilder->weld_label("lbLicenseText"))
+ , m_xLabelVersion(m_xBuilder->weld_label("lbVersionText"))
+ , 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_xLabelDownloadNumber(m_xBuilder->weld_label("labelDownloadNumber"))
+ , m_xButtonShowMore(m_xBuilder->weld_button("buttonShowMore"))
+ , m_pParentDialog(pParentDialog)
+ , m_sDownloadURL("")
+ , m_sExtensionID("")
+{
+ SolarMutexGuard aGuard;
+
+ // AdditionsItem set location
+ m_xContainer->set_grid_left_attach(0);
+ m_xContainer->set_grid_top_attach(pParentDialog->m_aAdditionsItems.size());
+
+ // Set maximum length of the extension title
+ OUString sExtensionName;
+ const sal_Int32 maxExtensionNameLength = 30;
+
+ if (additionInfo.sName.getLength() > maxExtensionNameLength)
+ {
+ std::u16string_view sShortName = additionInfo.sName.subView(0, maxExtensionNameLength - 3);
+ sExtensionName = OUString::Concat(sShortName) + "...";
+ }
+ else
+ {
+ sExtensionName = additionInfo.sName;
+ }
+
+ m_xLabelName->set_label(sExtensionName);
+
+ double aExtensionRating = additionInfo.sRating.toDouble();
+ switch (std::isnan(aExtensionRating) ? 0 : int(std::clamp(aExtensionRating, 0.0, 5.0)))
+ {
+ case 5:
+ m_xImageVoting5->set_from_icon_name(RID_SVXBMP_STARS_FULL);
+ [[fallthrough]];
+ case 4:
+ m_xImageVoting4->set_from_icon_name(RID_SVXBMP_STARS_FULL);
+ [[fallthrough]];
+ case 3:
+ m_xImageVoting3->set_from_icon_name(RID_SVXBMP_STARS_FULL);
+ [[fallthrough]];
+ case 2:
+ m_xImageVoting2->set_from_icon_name(RID_SVXBMP_STARS_FULL);
+ [[fallthrough]];
+ case 1:
+ m_xImageVoting1->set_from_icon_name(RID_SVXBMP_STARS_FULL);
+ break;
+ }
+
+ m_xLinkButtonWebsite->set_uri(additionInfo.sExtensionURL);
+ m_xLabelDescription->set_label(additionInfo.sIntroduction);
+
+ if (!additionInfo.sAuthorName.equalsIgnoreAsciiCase("null"))
+ m_xLabelAuthor->set_label(additionInfo.sAuthorName);
+
+ 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);
+ m_xLinkButtonComments->set_uri(additionInfo.sCommentURL);
+ m_xLabelDownloadNumber->set_label(additionInfo.sDownloadNumber);
+ m_pParentDialog = pParentDialog;
+ m_sDownloadURL = additionInfo.sDownloadURL;
+ m_sExtensionID = additionInfo.sExtensionID;
+
+ m_xButtonShowMore->connect_clicked(LINK(this, AdditionsItem, ShowMoreHdl));
+ m_xButtonInstall->connect_clicked(LINK(this, AdditionsItem, InstallHdl));
+}
+
+bool AdditionsItem::getExtensionFile(OUString& sExtensionFile)
+{
+ uno::Reference<ucb::XSimpleFileAccess3> xFileAccess
+ = ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
+
+ // copy the extensions' files to the user's additions folder
+ OUString userFolder = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
+ "/" SAL_CONFIGFILE("bootstrap") "::UserInstallation}";
+ rtl::Bootstrap::expandMacros(userFolder);
+ userFolder += "/user/additions/" + m_sExtensionID + "/";
+
+ OUString aExtensionsFile(INetURLObject(m_sDownloadURL).getName());
+ OUString aExtensionsURL = m_sDownloadURL;
+
+ try
+ {
+ osl::Directory::createPath(userFolder);
+
+ if (!xFileAccess->exists(userFolder + aExtensionsFile))
+ ucbDownload(aExtensionsURL, userFolder, aExtensionsFile);
+ }
+ catch (const uno::Exception&)
+ {
+ return false;
+ }
+ sExtensionFile = userFolder + aExtensionsFile;
+ return true;
+}
+
+IMPL_LINK_NOARG(AdditionsDialog, ImplUpdateDataHdl, Timer*, void) { RefreshUI(); }
+
+IMPL_LINK_NOARG(AdditionsDialog, SearchUpdateHdl, weld::Entry&, void)
+{
+ m_aSearchDataTimer.Start();
+}
+
+IMPL_LINK_NOARG(AdditionsDialog, FocusOut_Impl, weld::Widget&, void)
+{
+ if (m_aSearchDataTimer.IsActive())
+ {
+ m_aSearchDataTimer.Stop();
+ m_aSearchDataTimer.Invoke();
+ }
+}
+
+IMPL_LINK_NOARG(AdditionsDialog, CloseButtonHdl, weld::Button&, void)
+{
+ if (m_pSearchThread.is())
+ m_pSearchThread->StopExecution();
+ this->response(RET_CLOSE);
+}
+
+IMPL_LINK_NOARG(AdditionsItem, ShowMoreHdl, weld::Button&, void)
+{
+ this->m_xButtonShowMore->set_visible(false);
+ m_pParentDialog->m_nMaxItemCount += PAGE_SIZE;
+ if (m_pParentDialog->m_pSearchThread.is())
+ m_pParentDialog->m_pSearchThread->StopExecution();
+ m_pParentDialog->m_pSearchThread = new SearchAndParseThread(m_pParentDialog, false);
+ m_pParentDialog->m_pSearchThread->launch();
+}
+
+IMPL_LINK_NOARG(AdditionsItem, InstallHdl, weld::Button&, void)
+{
+ 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_CUISTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_sensitive(true);
+
+ SAL_INFO("cui.dialogs", "Couldn't get the extension file.");
+ return;
+ }
+
+ rtl::Reference<TmpRepositoryCommandEnv> pCmdEnv = new TmpRepositoryCommandEnv();
+ uno::Reference<task::XAbortChannel> xAbortChannel;
+ try
+ {
+ m_pParentDialog->m_xExtensionManager->addExtension(
+ aExtensionFile, uno::Sequence<beans::NamedValue>(), "user", xAbortChannel, pCmdEnv);
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLEDBUTTON));
+ }
+ catch (const ucb::CommandFailedException)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "");
+ 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_CUISTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_sensitive(true);
+ }
+ catch (const deployment::DeploymentException)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "");
+ 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_CUISTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_sensitive(true);
+ }
+ catch (const css::uno::Exception)
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "");
+ m_xButtonInstall->set_label(CuiResId(RID_CUISTR_ADDITIONS_INSTALLBUTTON));
+ m_xButtonInstall->set_sensitive(true);
+ }
+}
+
+// TmpRepositoryCommandEnv
+
+TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() {}
+
+TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() {}
+// XCommandEnvironment
+
+uno::Reference<task::XInteractionHandler> TmpRepositoryCommandEnv::getInteractionHandler()
+{
+ return this;
+}
+
+uno::Reference<ucb::XProgressHandler> TmpRepositoryCommandEnv::getProgressHandler() { return this; }
+
+// XInteractionHandler
+void TmpRepositoryCommandEnv::handle(uno::Reference<task::XInteractionRequest> const& xRequest)
+{
+ OSL_ASSERT(xRequest->getRequest().getValueTypeClass() == uno::TypeClass_EXCEPTION);
+
+ bool approve = true;
+
+ // select:
+ uno::Sequence<Reference<task::XInteractionContinuation>> conts(xRequest->getContinuations());
+ Reference<task::XInteractionContinuation> const* pConts = conts.getConstArray();
+ sal_Int32 len = conts.getLength();
+ for (sal_Int32 pos = 0; pos < len; ++pos)
+ {
+ if (approve)
+ {
+ uno::Reference<task::XInteractionApprove> xInteractionApprove(pConts[pos],
+ uno::UNO_QUERY);
+ if (xInteractionApprove.is())
+ {
+ xInteractionApprove->select();
+ // don't query again for ongoing continuations:
+ approve = false;
+ }
+ }
+ }
+}
+
+// XProgressHandler
+void TmpRepositoryCommandEnv::push(uno::Any const& /*Status*/) {}
+
+void TmpRepositoryCommandEnv::update(uno::Any const& /*Status */) {}
+
+void TmpRepositoryCommandEnv::pop() {}
+
+IMPL_LINK(AdditionsDialog, GearHdl, const OUString&, rIdent, void)
+{
+ if (rIdent == "gear_sort_voting")
+ {
+ std::sort(m_aAllExtensionsVector.begin(), m_aAllExtensionsVector.end(), sortByRating);
+ }
+ else if (rIdent == "gear_sort_comments")
+ {
+ std::sort(m_aAllExtensionsVector.begin(), m_aAllExtensionsVector.end(), sortByComment);
+ }
+ else if (rIdent == "gear_sort_downloads")
+ {
+ std::sort(m_aAllExtensionsVector.begin(), m_aAllExtensionsVector.end(), sortByDownload);
+ }
+ // After the sorting, UI will be refreshed to update extension list.
+ RefreshUI();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 a34912d5d0f2..e9aba0a6e409 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -10,25 +10,27 @@
#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))
{
- svtools::ColorConfig aColorConfig;
- Color aFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
- m_aPreviewWindow.SetBackColor(aFillColor);
initialize();
}
@@ -53,70 +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(), 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)
@@ -132,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()
@@ -157,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();
}
@@ -173,19 +221,20 @@ 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(OUString(vcl::font::FeatureSeparator));
+ sNameSuffix.append(vcl::font::FeatureSeparator);
else
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");
}
}
@@ -195,20 +244,18 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
if (nSelection != int(rItem.m_nDefault))
{
if (!bFirst)
- sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
+ sNameSuffix.append(vcl::font::FeatureSeparator);
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 85ed9309df9c..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,19 +18,40 @@
#include <utility>
#include <vcl/svapp.hxx>
-#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>
@@ -40,7 +62,6 @@
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextViewCursor.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-#include <config_fuzzers.h>
#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
@@ -51,25 +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;
-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"))
+ , 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
@@ -88,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;
@@ -104,6 +220,7 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
short QrCodeGenDialog::run()
{
+#if ENABLE_ZXING
short nRet;
while (true)
{
@@ -115,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();
}
}
@@ -127,12 +244,47 @@ short QrCodeGenDialog::run()
break;
}
return nRet;
+#else
+ return RET_CANCEL;
+#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()
{
- 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());
@@ -140,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();
@@ -184,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;
@@ -250,72 +402,29 @@ void QrCodeGenDialog::Apply()
//Not implemented for math,base and other apps.
throw uno::RuntimeException("Not implemented");
}
-}
-
-OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRBorder)
-{
-#if ENABLE_FUZZERS
- return OUString();
-#else
- //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());
#endif
}
-void QrCodeGenDialog::GetErrorCorrection(long ErrorCorrection)
+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 80e8f9815053..d3e0bfb5b65e 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -17,32 +17,22 @@
#include <comphelper/graphicmimetype.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/xmlsechelper.hxx>
-#include <comphelper/storagehelper.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/docfilt.hxx>
+#include <comphelper/propertyvalue.hxx>
+#include <sfx2/filedlghelper.hxx>
#include <sfx2/objsh.hxx>
#include <svx/xoutbmp.hxx>
-#include <tools/date.hxx>
-#include <tools/stream.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/streamwrap.hxx>
-#include <unotools/syslocale.hxx>
#include <utility>
#include <vcl/graph.hxx>
#include <vcl/weld.hxx>
#include <svx/signaturelinehelper.hxx>
+#include <tools/urlobj.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/graphic/GraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/security/CertificateKind.hpp>
-#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/security/XCertificate.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.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>
@@ -51,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;
@@ -132,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;
@@ -142,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();
@@ -156,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();
}
@@ -165,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
@@ -202,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,
@@ -216,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/SignatureLineDialog.cxx b/cui/source/dialogs/SignatureLineDialog.cxx
index 7f6caabc49d9..224dcdecd4bb 100644
--- a/cui/source/dialogs/SignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignatureLineDialog.cxx
@@ -9,10 +9,7 @@
#include <SignatureLineDialog.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/xmltools.hxx>
-#include <tools/stream.hxx>
-#include <unotools/streamwrap.hxx>
#include <utility>
#include <vcl/weld.hxx>
#include <svx/signaturelinehelper.hxx>
@@ -20,12 +17,8 @@
#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/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
@@ -40,7 +33,6 @@ using namespace css::uno;
using namespace css::beans;
using namespace css::container;
using namespace css::frame;
-using namespace css::io;
using namespace css::lang;
using namespace css::frame;
using namespace css::sheet;
diff --git a/cui/source/dialogs/SignatureLineDialogBase.cxx b/cui/source/dialogs/SignatureLineDialogBase.cxx
index 50214308fe10..fb154c34319d 100644
--- a/cui/source/dialogs/SignatureLineDialogBase.cxx
+++ b/cui/source/dialogs/SignatureLineDialogBase.cxx
@@ -11,18 +11,14 @@
#include <utility>
-#include <config_folders.h>
#include <vcl/weld.hxx>
-#include <sal/log.hxx>
-#include <rtl/bootstrap.hxx>
-#include <tools/stream.hxx>
using namespace css;
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))
{
@@ -30,15 +26,13 @@ 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(const OUString& rString)
+OUString SignatureLineDialogBase::getCDataString(std::u16string_view rString)
{
- return "<![CDATA[" + rString + "]]>";
+ return OUString::Concat("<![CDATA[") + rString + "]]>";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
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 449e18056788..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>
@@ -90,14 +92,14 @@ class SpellUndoAction_Impl : public SfxUndoAction
bool m_bEnableChangePB;
bool m_bEnableChangeAllPB;
//undo of MarkNextError - used in change and change all, ignore and ignore all
- long m_nOldErrorStart;
- long m_nOldErrorEnd;
+ tools::Long m_nOldErrorStart;
+ tools::Long m_nOldErrorEnd;
bool m_bIsErrorLanguageSelected;
//undo of AddToDictionary
Reference<XDictionary> m_xDictionary;
OUString m_sAddedWord;
//move end of error - ::ChangeMarkedWord()
- long m_nOffset;
+ tools::Long m_nOffset;
public:
SpellUndoAction_Impl(sal_uInt16 nId, const Link<SpellUndoAction_Impl&,void>& rActionLink) :
@@ -120,13 +122,13 @@ public:
void SetEnableChangeAllPB(){m_bEnableChangeAllPB = true;}
bool IsEnableChangeAllPB() const {return m_bEnableChangeAllPB;}
- void SetErrorMove(long nOldStart, long nOldEnd)
+ void SetErrorMove(tools::Long nOldStart, tools::Long nOldEnd)
{
m_nOldErrorStart = nOldStart;
m_nOldErrorEnd = nOldEnd;
}
- long GetOldErrorStart() const { return m_nOldErrorStart;}
- long GetOldErrorEnd() const { return m_nOldErrorEnd;}
+ tools::Long GetOldErrorStart() const { return m_nOldErrorStart;}
+ tools::Long GetOldErrorEnd() const { return m_nOldErrorEnd;}
void SetErrorLanguageSelected(bool bSet){ m_bIsErrorLanguageSelected = bSet;}
bool IsErrorLanguageSelected() const {return m_bIsErrorLanguageSelected;}
@@ -136,8 +138,8 @@ public:
void SetAddedWord(const OUString& rWord) {m_sAddedWord = rWord;}
const OUString& GetAddedWord() const { return m_sAddedWord;}
- void SetOffset(long nSet) {m_nOffset = nSet;}
- long GetOffset() const {return m_nOffset;}
+ void SetOffset(tools::Long nSet) {m_nOffset = nSet;}
+ tools::Long GetOffset() const {return m_nOffset;}
};
}//namespace svx
using namespace ::svx;
@@ -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();
@@ -441,12 +454,14 @@ IMPL_LINK( SpellDialog, ExtClickHdl, weld::Button&, rBtn, void )
SvxPrepareAutoCorrect( sWrong, sCurrentErrorText );
LanguageType eLang = GetSelectedLang_Impl();
rParent.AddAutoCorrection( sWrong, sCurrentErrorText, eLang );
+ //correct the word immediately
+ ChangeHdl(*m_xAutoCorrPB);
}
}
}
}
-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);
@@ -454,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
@@ -711,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());
}
@@ -826,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));
@@ -902,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();
}
@@ -917,7 +937,7 @@ void SpellDialog::ToplevelFocusChanged()
* The only sensible thing would be to call the new Method differently,
* e.g. DialogGot/LostFocus or so.
*/
- if (!(m_xDialog->get_visible() && !bFocusLocked))
+ if (!m_xDialog->get_visible() || bFocusLocked)
return;
if (m_xDialog->has_toplevel_focus())
@@ -940,7 +960,7 @@ void SpellDialog::Activate()
void SpellDialog::Deactivate()
{
- SfxModelessDialogController::Activate();
+ SfxModelessDialogController::Deactivate();
ToplevelFocusChanged();
}
@@ -964,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();
}
@@ -1065,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;
}
@@ -1114,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)
@@ -1131,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()
@@ -1158,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);
}
}
@@ -1482,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)
@@ -1513,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")
{
@@ -1522,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());
@@ -1662,15 +1769,30 @@ 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));
m_xEditEngine->QuickSetAttribs(aSet, ESelection(0, nStart, 0, nEnd));
- // so the editview will autoscroll to make this visible
- m_xEditView->SetSelection(ESelection(0, nStart));
+
+ // Set the selection so the editview will autoscroll to make this visible
+ // unless (tdf#133958) the selection already overlaps this range
+ ESelection aCurrentSelection = m_xEditView->GetSelection();
+ aCurrentSelection.Adjust();
+ bool bCurrentSelectionInRange = nStart <= aCurrentSelection.nEndPos && aCurrentSelection.nStartPos <= nEnd;
+ if (!bCurrentSelectionInRange)
+ {
+ m_xEditView->SetSelection(ESelection(0, nStart));
+ // tdf#157148 ensure current location is auto-scrolled to be visible
+ m_xEditView->ShowCursor();
+ }
+
Invalidate();
m_nErrorStart = nStart;
@@ -1735,7 +1857,7 @@ int SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Language
m_xEditEngine->SetModified();
//adjust end position
- long nEndTemp = m_nErrorEnd;
+ tools::Long nEndTemp = m_nErrorEnd;
nEndTemp += nDiffLen;
m_nErrorEnd = static_cast<sal_Int32>(nEndTemp);
@@ -1802,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);
@@ -1931,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 )
{
@@ -1963,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;
}
@@ -1975,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;
@@ -1994,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);
}
@@ -2020,7 +2141,7 @@ void SentenceEditWindow_Impl::UndoActionEnd()
m_xEditEngine->UndoActionEnd();
}
-void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset)
+void SentenceEditWindow_Impl::MoveErrorEnd(tools::Long nOffset)
{
// Shouldn't we always add the real signed value instead???
if(nOffset > 0)
@@ -2049,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 c4e88e37dd73..ce82e418cf9e 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -17,26 +17,29 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
+
#include <about.hxx>
-#include <osl/diagnose.h> //OSL_ENSURE
#include <osl/process.h> //osl_getProcessLocale
-#include <rtl/character.hxx> //rtl::isAsciiHexDigit
+#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
#include <config_buildid.h> //EXTRA_BUILDID
+#include <config_features.h>
#include <dialmgr.hxx> //CuiResId
#include <i18nlangtag/languagetag.hxx>
#include <sfx2/app.hxx> //SfxApplication::loadBrandSvg
-#include <sfx2/sfxresid.hxx>
-#include <sfx2/strings.hrc>
#include <strings.hrc>
#include <svtools/langhelp.hxx>
-#include <unotools/bootstrap.hxx> //utl::Bootstrap::getBuildVersion
+#include <unotools/bootstrap.hxx> //utl::Bootstrap::getBuildIdData
#include <unotools/configmgr.hxx> //ConfigManager::
#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
@@ -67,19 +70,18 @@ AboutDialog::AboutDialog(weld::Window *pParent)
m_pUILabel(m_xBuilder->weld_label("lbUIString")),
m_pLocaleLabel(m_xBuilder->weld_label("lbLocaleString")),
m_pMiscLabel(m_xBuilder->weld_label("lbMiscString")),
- m_pAboutLabel(m_xBuilder->weld_label("lbAbout")),
m_pCopyrightLabel(m_xBuilder->weld_label("lbCopyright")) {
// Labels
m_pVersionLabel->set_label(GetVersionString());
OUString sbuildId = GetBuildString();
- const long nMaxChar = 25;
if (IsStringValidGitHash(sbuildId)) {
+ const tools::Long nMaxChar = 25;
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();
@@ -90,16 +92,10 @@ AboutDialog::AboutDialog(weld::Window *pParent)
m_pUILabel->set_label(Application::GetHWOSConfInfo(2));
m_pLocaleLabel->set_label(GetLocaleString());
m_pMiscLabel->set_label(GetMiscString());
-
- if (std::string_view(PRODUCTFLAVOR) == "Personal")
- {
- m_pAboutLabel->set_label(SfxResId(STR_PERSONALDESC));
- }
-
m_pCopyrightLabel->set_label(GetCopyrightString());
// Images
- const long nWidth(m_pCopyrightLabel->get_preferred_size().getWidth());
+ const tools::Long nWidth(m_pCopyrightLabel->get_preferred_size().getWidth());
BitmapEx aBackgroundBitmap;
if (SfxApplication::loadBrandSvg(Application::GetSettings()
@@ -109,32 +105,33 @@ 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);
m_pWebsiteButton->set_uri(sURL);
+ // See also SID_WHATSNEW in sfx2/source/appl/appserv.cxx
sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() +
"?LOvers=" + utl::ConfigManager::getProductVersion() + "&LOlocale=" +
- LanguageTag(utl::ConfigManager::getUILocale()).getLanguage();
+ LanguageTag(utl::ConfigManager::getUILocale()).getBcp47();
m_pReleaseNotesButton->set_uri(sURL);
// Handler
@@ -144,41 +141,33 @@ 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");
+ OUString arch;
+ auto const ok = rtl::Bootstrap::get("_ARCH", arch);
+ assert(ok); (void) ok;
+ OUString sVersion = CuiResId(TranslateId(nullptr, "%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX")) + " (" + arch + ")";
-#ifdef _WIN64
- sVersion += " (x64)";
-#elif defined(_WIN32)
- sVersion += " (x86)";
+#if HAVE_FEATURE_COMMUNITY_FLAVOR
+ sVersion += " / LibreOffice Community";
#endif
+
return sVersion;
}
-OUString AboutDialog::GetBuildString() {
-
- OUString sDefault;
- OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault));
- if (sBuildId.isEmpty())
- sBuildId = utl::Bootstrap::getBuildIdData(sDefault);
- if (sBuildId.isEmpty()) {
- sBuildId = sBuildId.getToken(0, '-');
- }
- OSL_ENSURE(!sBuildId.isEmpty(), "No BUILDID in bootstrap file");
+OUString AboutDialog::GetBuildString()
+{
+ OUString sBuildId(utl::Bootstrap::getBuildIdData(""));
+ SAL_WARN_IF(sBuildId.isEmpty(), "cui.dialogs", "No BUILDID in bootstrap file");
return sBuildId;
}
-OUString AboutDialog::GetLocaleString() {
+OUString AboutDialog::GetLocaleString(const bool bLocalized) {
OUString sLocaleStr;
@@ -199,7 +188,12 @@ OUString AboutDialog::GetLocaleString() {
OUString aUILocaleStr =
Application::GetSettings().GetUILanguageTag().getBcp47();
- OUString sUILocaleStr(CuiResId(RID_SVXSTR_ABOUT_UILOCALE));
+ OUString sUILocaleStr;
+ if (bLocalized)
+ sUILocaleStr = CuiResId(RID_CUISTR_ABOUT_UILOCALE);
+ else
+ 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 "
"doesn't contain $LOCALE placeholder");
@@ -220,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 =
@@ -235,41 +226,48 @@ 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())
+ {
+ 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;
}
+// special labels to comply with previous version info
+// untranslated English for QA
IMPL_LINK_NOARG(AboutDialog, HandleClick, weld::Button &, void) {
css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
css::datatransfer::clipboard::SystemClipboard::create(
comphelper::getProcessComponentContext());
- OUString sInfo = "Version: " + m_pVersionLabel->get_label() // version
- + "\nBuild ID: " + GetBuildString() // build id
- + "\n" + m_pEnvLabel->get_label() + "; " + m_pUILabel->get_label() // env+UI
- + "\nLocale: " + m_pLocaleLabel->get_label() // locale
- + "\n" + m_pMiscLabel->get_label(); // misc
+ OUString sInfo = "Version: " + m_pVersionLabel->get_label() + "\n" // version
+ "Build ID: " + GetBuildString() + "\n" + // build id
+ Application::GetHWOSConfInfo(0,false) + "\n" // env+UI
+ "Locale: " + GetLocaleString(false) + "\n" + // locale
+ GetMiscString(); // misc
vcl::unohelper::TextDataObject::CopyStringTo(sInfo, xClipboard);
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 2dc7e779740c..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>
@@ -110,9 +113,9 @@ static void CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKe
fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey;
fYellow = (fYellow * ( 1.0 - fKey )) + fKey;
- dR = std::max( std::min( ( 1.0 - fCyan ), 1.0), 0.0 );
- dG = std::max( std::min( ( 1.0 - fMagenta ), 1.0), 0.0 );
- dB = std::max( std::min( ( 1.0 - fYellow ), 1.0), 0.0 );
+ dR = std::clamp( 1.0 - fCyan, 0.0, 1.0 );
+ dG = std::clamp( 1.0 - fMagenta, 0.0, 1.0 );
+ dB = std::clamp( 1.0 - fYellow, 0.0, 1.0 );
}
// CMY results from 0 to 1
@@ -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)
@@ -402,8 +415,8 @@ void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
const Size aSize(mxBitmap->GetOutputSizePixel());
- long nX = rPos.X();
- long nY = rPos.Y();
+ tools::Long nX = rPos.X();
+ tools::Long nY = rPos.Y();
if (nX < 0)
nX = 0;
else if (nX >= aSize.Width())
@@ -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;
@@ -510,7 +522,7 @@ void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, doub
void ColorFieldControl::UpdatePosition()
{
Size aSize(GetOutputSizePixel());
- ShowPosition(Point(static_cast<long>(mdX * aSize.Width()), static_cast<long>((1.0 - mdY) * aSize.Height())), false);
+ ShowPosition(Point(static_cast<tools::Long>(mdX * aSize.Width()), static_cast<tools::Long>((1.0 - mdY) * aSize.Height())), false);
}
namespace {
@@ -530,7 +542,7 @@ public:
virtual void Resize() override;
void UpdateBitmap();
- void ChangePosition( long nY );
+ void ChangePosition( tools::Long nY );
void Modify();
void SetValue( const Color& rColor, ColorMode eMode, double dValue );
@@ -582,7 +594,7 @@ void ColorSliderControl::UpdateBitmap()
mxBitmap->SetOutputSizePixel(aSize);
}
- const long nY = aSize.Height() - 1;
+ const tools::Long nY = aSize.Height() - 1;
Color aBitmapColor(maColor);
@@ -596,7 +608,7 @@ void ColorSliderControl::UpdateBitmap()
case HUE:
nSat = 100;
nBri = 100;
- for (long y = 0; y <= nY; y++)
+ for (tools::Long y = 0; y <= nY; y++)
{
nHue = static_cast<sal_uInt16>((359 * y) / nY);
mxBitmap->DrawPixel(Point(0, nY - y), Color::HSBtoRGB(nHue, nSat, nBri));
@@ -605,7 +617,7 @@ void ColorSliderControl::UpdateBitmap()
case SATURATION:
nBri = std::max(sal_uInt16(32), nBri);
- for (long y = 0; y <= nY; y++)
+ for (tools::Long y = 0; y <= nY; y++)
{
nSat = static_cast<sal_uInt16>((100 * y) / nY);
mxBitmap->DrawPixel(Point(0, nY - y), Color::HSBtoRGB(nHue, nSat, nBri));
@@ -613,7 +625,7 @@ void ColorSliderControl::UpdateBitmap()
break;
case BRIGHTNESS:
- for (long y = 0; y <= nY; y++)
+ for (tools::Long y = 0; y <= nY; y++)
{
nBri = static_cast<sal_uInt16>((100 * y) / nY);
mxBitmap->DrawPixel(Point(0, nY - y), Color::HSBtoRGB(nHue, nSat, nBri));
@@ -621,34 +633,34 @@ void ColorSliderControl::UpdateBitmap()
break;
case RED:
- for (long y = 0; y <= nY; y++)
+ for (tools::Long y = 0; y <= nY; y++)
{
- aBitmapColor.SetRed(sal_uInt8((long(255) * y) / nY));
+ aBitmapColor.SetRed(sal_uInt8((tools::Long(255) * y) / nY));
mxBitmap->DrawPixel(Point(0, nY - y), aBitmapColor);
}
break;
case GREEN:
- for (long y = 0; y <= nY; y++)
+ for (tools::Long y = 0; y <= nY; y++)
{
- aBitmapColor.SetGreen(sal_uInt8((long(255) * y) / nY));
+ aBitmapColor.SetGreen(sal_uInt8((tools::Long(255) * y) / nY));
mxBitmap->DrawPixel(Point(0, nY - y), aBitmapColor);
}
break;
case BLUE:
- for (long y = 0; y <= nY; y++)
+ for (tools::Long y = 0; y <= nY; y++)
{
- aBitmapColor.SetBlue(sal_uInt8((long(255) * y) / nY));
+ aBitmapColor.SetBlue(sal_uInt8((tools::Long(255) * y) / nY));
mxBitmap->DrawPixel(Point(0, nY - y), aBitmapColor);
}
break;
}
}
-void ColorSliderControl::ChangePosition(long nY)
+void ColorSliderControl::ChangePosition(tools::Long nY)
{
- const long nHeight = GetOutputSizePixel().Height() - 1;
+ const tools::Long nHeight = GetOutputSizePixel().Height() - 1;
if (nY < 0)
nY = 0;
@@ -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)
@@ -1080,7 +1096,7 @@ IMPL_LINK_NOARG(ColorPickerDialog, ColorModifyEditHdl, weld::Entry&, void)
Color aColor = m_xEDHex->GetColor();
- if (aColor != Color(0xffffffff) && aColor != GetColor())
+ if (aColor != COL_AUTO && aColor != GetColor())
{
mdRed = static_cast<double>(aColor.GetRed()) / 255.0;
mdGreen = static_cast<double>(aColor.GetGreen()) / 255.0;
@@ -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(
}
-const OUStringLiteral gsColorKey( "Color" );
-const OUStringLiteral gsModeKey( "Mode" );
+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 3f3651bce366..000000000000
--- a/cui/source/dialogs/cuicharmap.cxx
+++ /dev/null
@@ -1,1247 +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 <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"), m_xVirDev))
- , m_xShowSetArea(new weld::CustomWeld(*m_xBuilder, "showcharset", *m_xShowSet))
- , m_xSearchSet(new SvxSearchCharSet(m_xBuilder->weld_scrolled_window("searchscroll"), 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().toChar();
-}
-
-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_Int32 tmp = 0;
- sal_UCS4 cChar = sGlyph.iterateCodePoints(&tmp);
- 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 );
- if (isSearchMode)
- {
- SearchUpdateHdl(*m_xSearchText);
- SearchCharHighlightHdl(m_xSearchSet.get());
- }
-
- // 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);
-
- // 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_Int32 tmp = 1;
- sal_UCS4 cChar = charValue.iterateCodePoints(&tmp, -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;
- OUString aHexText;
- OUString aDecimalText;
- 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
- aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
- // Get the decimal code
- 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;
- OUString aHexText;
- OUString aDecimalText;
- sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
- bool bSelect = (cChar > 0);
-
- // show char sample
- if ( bSelect )
- {
- aText = OUString( &cChar, 1 );
- // Get the hexadecimal code
- aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
- // Get the decimal code
- 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());
- long nAvailWidth = aSize.Width();
- long nWinHeight = aSize.Height();
-
- bool bGotBoundary = true;
- bool bShrankFont = false;
- vcl::Font aOrigFont(rRenderContext.GetFont());
- Size aFontSize(aOrigFont.GetFontSize());
- ::tools::Rectangle aBoundRect;
-
- for (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
- 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 )
-{
- 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 de0b0c1663f5..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,10 +528,10 @@ 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->GetSdgURL().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
+ m_xFtMSShowPath->set_label(pThm->getThemeURL().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
// singular or plural?
if ( 1 == pThm->GetObjectCount() )
@@ -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 )
{
@@ -645,12 +643,12 @@ std::unique_ptr<SfxTabPage> TPGalleryThemeProperties::Create(weld::Container* pP
return std::make_unique<TPGalleryThemeProperties>(pPage, pController, *rSet);
}
-OUString TPGalleryThemeProperties::addExtension( const OUString& _rDisplayText, const OUString& _rExtension )
+OUString TPGalleryThemeProperties::addExtension( const OUString& _rDisplayText, std::u16string_view _rExtension )
{
OUString sRet = _rDisplayText;
if ( sRet.indexOf( "(*.*)" ) == -1 )
{
- sRet += " (" + _rExtension + ")";
+ sRet += OUString::Concat(" (") + _rExtension + ")";
}
return sRet;
}
@@ -709,7 +707,7 @@ void TPGalleryThemeProperties::FillFilterList()
#if HAVE_FEATURE_AVMEDIA
// media filters
- static const char aWildcard[] = "*.";
+ 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);
@@ -825,7 +823,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void)
css::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
if ( xAsyncDlg.is() )
- xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ xAsyncDlg->startExecuteModal( xDialogListener );
else
{
if( xFolderPicker->execute() == RET_OK )
@@ -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 baaa6603c60d..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);
}
}
@@ -93,13 +93,13 @@ void CuiGraphicPreviewWindow::ScaleImageToFit()
if( fGrfWH < fPreWH )
{
- aGrfSize.setWidth( static_cast<long>( aPreviewSize.Height() * fGrfWH ) );
+ aGrfSize.setWidth( static_cast<tools::Long>( aPreviewSize.Height() * fGrfWH ) );
aGrfSize.setHeight( aPreviewSize.Height() );
}
else
{
aGrfSize.setWidth( aPreviewSize.Width() );
- aGrfSize.setHeight( static_cast<long>( aPreviewSize.Width() / fGrfWH ) );
+ aGrfSize.setHeight( static_cast<tools::Long>( aPreviewSize.Width() / fGrfWH ) );
}
mfScaleX = static_cast<double>(aGrfSize.Width()) / maOrigGraphicSizePixel.Width();
@@ -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);
}
@@ -189,10 +190,10 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
double fScaleX, double fScaleY )
{
Graphic aRet;
- long nTileWidth = static_cast<long>(mxMtrWidth->get_value(FieldUnit::PIXEL));
- long nTileHeight = static_cast<long>(mxMtrHeight->get_value(FieldUnit::PIXEL));
- const Size aSize( std::max( FRound( nTileWidth * fScaleX ), 1L ),
- std::max( FRound( nTileHeight * fScaleY ), 1L ) );
+ 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( 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 9ca722680a15..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,11 +147,13 @@ 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();
+ GetBindings().Update(SID_HYPERLINK_GETLINK);
GetBindings().Update(SID_READONLY_MODE);
m_xResetBtn->connect_clicked( LINK( this, SvxHpLinkDlg, ResetHdl ) );
@@ -149,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();
@@ -163,34 +179,37 @@ SvxHpLinkDlg::~SvxHpLinkDlg()
pOutSet.reset();
}
+void SvxHpLinkDlg::Activate() {
+ if (mbGrabFocus) {
+ static_cast<SvxHyperlinkTabPageBase *>(GetTabPage(GetCurPageId()))->SetInitFocus();
+ mbGrabFocus = false;
+ }
+ SfxModelessDialogController::Activate();
+}
+
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
@@ -217,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);
@@ -259,11 +278,6 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
aPageSet.Put ( *pItem );
pCurrentPage->Reset( aPageSet );
- if ( mbGrabFocus )
- {
- pCurrentPage->SetInitFocus(); // #92535# grab the focus only once at initialization
- mbGrabFocus = false;
- }
}
}
@@ -282,7 +296,7 @@ void SvxHpLinkDlg::SetReadOnlyMode( bool bRdOnly )
|* late-initialization of newly created pages
|*
|************************************************************************/
-void SvxHpLinkDlg::PageCreated(const OString& /*rId*/, IconChoicePage& rPage)
+void SvxHpLinkDlg::PageCreated(IconChoicePage& rPage)
{
SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage );
Reference< XFrame > xDocumentFrame = GetBindings().GetActiveFrame();
diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx
index 60346dc69816..d613e1a804ee 100644
--- a/cui/source/dialogs/cuiimapwnd.cxx
+++ b/cui/source/dialogs/cuiimapwnd.cxx
@@ -38,10 +38,10 @@ URLDlg::URLDlg(weld::Widget* pWindow, const OUString& rURL, const OUString& rAlt
m_xEdtDescription->set_size_request(m_xEdtDescription->get_approximate_digit_width() * 51,
m_xEdtDescription->get_height_rows(5));
- m_xEdtURL->set_text( rURL );
- m_xEdtAlternativeText->set_text( rAlternativeText );
- m_xEdtDescription->set_text( rDescription );
- m_xEdtName->set_text( rName );
+ m_xEdtURL->set_text(rURL);
+ m_xEdtAlternativeText->set_text(rAlternativeText);
+ m_xEdtDescription->set_text(rDescription);
+ m_xEdtName->set_text(rName);
for (const OUString& a : rTargetList)
m_xCbbTargets->append_text(a);
@@ -52,8 +52,6 @@ URLDlg::URLDlg(weld::Widget* pWindow, const OUString& rURL, const OUString& rAlt
m_xCbbTargets->set_entry_text(rTarget);
}
-URLDlg::~URLDlg()
-{
-}
+URLDlg::~URLDlg() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx
index eb0a768149d5..55d21325d5bc 100644
--- a/cui/source/dialogs/cuitbxform.cxx
+++ b/cui/source/dialogs/cuitbxform.cxx
@@ -19,15 +19,13 @@
#include <cuitbxform.hxx>
-FmInputRecordNoDialog::FmInputRecordNoDialog(weld::Window * pParent)
+FmInputRecordNoDialog::FmInputRecordNoDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/recordnumberdialog.ui", "RecordNumberDialog")
, m_xRecordNo(m_xBuilder->weld_spin_button("entry"))
{
m_xRecordNo->set_range(1, 0x7FFFFFFF);
}
-FmInputRecordNoDialog::~FmInputRecordNoDialog()
-{
-}
+FmInputRecordNoDialog::~FmInputRecordNoDialog() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index d8044366b470..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,26 +39,51 @@ 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);
// tdf#129032: feedback on reason to disabled controls
- m_xEdtName->set_message_type(bEnable ? weld::EntryMessageType::Normal : weld::EntryMessageType::Error);
+ m_xEdtName->set_message_type(bEnable ? weld::EntryMessageType::Normal
+ : weld::EntryMessageType::Error);
OUString rTip = "";
if (!bEnable && m_aCheckNameTooltipHdl.IsSet())
- rTip = m_aCheckNameTooltipHdl.Call(*this);
+ rTip = m_aCheckNameTooltipHdl.Call(*this);
m_xBtnOK->set_tooltip_text(rTip);
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
@@ -86,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);
@@ -99,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 25fadc445c5b..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
@@ -132,7 +132,7 @@ namespace svx
// the font for the secondary text:
vcl::Font aSmallerFont(rRenderContext.GetFont());
// heuristic: 80% of the original size
- aSmallerFont.SetFontHeight( static_cast<long>( 0.8 * aSmallerFont.GetFontHeight() ) );
+ aSmallerFont.SetFontHeight( static_cast<tools::Long>( 0.8 * aSmallerFont.GetFontHeight() ) );
// let's calculate the size of our two texts
::tools::Rectangle aPrimaryRect = rRenderContext.GetTextRect( _rRect, m_sPrimaryText, nTextStyle );
@@ -172,7 +172,7 @@ namespace svx
// now draw the texts
// as we already calculated the precise rectangles for the texts, we don't want to
- // use the alignment flags given - within it's rect, every text is centered
+ // use the alignment flags given - within its rect, every text is centered
DrawTextFlags nDrawTextStyle( nTextStyle );
nDrawTextStyle &= ~DrawTextFlags( DrawTextFlags::Right | DrawTextFlags::Left | DrawTextFlags::Bottom | DrawTextFlags::Top );
nDrawTextStyle |= DrawTextFlags::Center | DrawTextFlags::VCenter;
@@ -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)
@@ -249,7 +254,7 @@ namespace svx
Size RubyRadioButton::GetOptimalSize() const
{
vcl::Font aSmallerFont(m_xVirDev->GetFont());
- aSmallerFont.SetFontHeight( static_cast<long>( 0.8 * aSmallerFont.GetFontHeight() ) );
+ aSmallerFont.SetFontHeight( static_cast<tools::Long>( 0.8 * aSmallerFont.GetFontHeight() ) );
::tools::Rectangle rect( Point(), Size( SAL_MAX_INT32, SAL_MAX_INT32 ) );
Size aPrimarySize = m_xVirDev->GetTextRect( rect, m_aRubyText.getPrimaryText() ).GetSize();
@@ -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;
}
@@ -284,7 +289,7 @@ namespace svx
SuggestionDisplay::SuggestionDisplay(weld::Builder& rBuilder)
: m_bDisplayListBox( true )
, m_bInSelectionUpdate( false )
- , m_xValueSet(new SuggestionSet(rBuilder.weld_scrolled_window("scrollwin")))
+ , m_xValueSet(new SuggestionSet(rBuilder.weld_scrolled_window("scrollwin", true)))
, m_xValueSetWin(new weld::CustomWeld(rBuilder, "valueset", *m_xValueSet))
, m_xListBox(rBuilder.weld_tree_view("listbox"))
{
@@ -416,7 +421,7 @@ namespace svx
m_xListBox->set_help_id(HID_HANGULDLG_SUGGESTIONS_LIST);
}
- HangulHanjaConversionDialog::HangulHanjaConversionDialog(weld::Window* pParent)
+ HangulHanjaConversionDialog::HangulHanjaConversionDialog(weld::Widget* pParent)
: GenericDialogController(pParent, "cui/ui/hangulhanjaconversiondialog.ui", "HangulHanjaConversionDialog")
, m_bDocumentMode( true )
, m_xFind(m_xBuilder->weld_button("find"))
@@ -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 )
@@ -1435,12 +1443,10 @@ namespace svx
, m_xEdit3(new SuggestionEdit(m_xBuilder->weld_entry("edit3"), this))
, m_xEdit4(new SuggestionEdit(m_xBuilder->weld_entry("edit4"), this))
, m_xContents(m_xBuilder->weld_widget("box"))
- , m_xScrollSB(m_xBuilder->weld_scrolled_window("scrollbar"))
+ , m_xScrollSB(m_xBuilder->weld_scrolled_window("scrollbar", true))
, m_xNewPB(m_xBuilder->weld_button("new"))
, m_xDeletePB(m_xBuilder->weld_button("delete"))
{
- m_xScrollSB->set_user_managed_scrolling();
-
Size aSize(m_xContents->get_preferred_size());
m_xScrollSB->set_size_request(-1, aSize.Height());
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 50d7131ad8fa..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,23 +156,13 @@ void SvxHyperlinkNewDocTp::FillDocumentList()
{
weld::WaitObject aWaitObj(mpDialog->getDialog());
- uno::Sequence< uno::Sequence< beans::PropertyValue > >
- aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( EDynamicMenuType::NewMenu ) );
+ std::vector<SvtDynMenuEntry> aDynamicMenuEntries( SvtDynamicMenuOptions::GetMenu( EDynamicMenuType::NewMenu ) );
- sal_uInt32 i, nCount = aDynamicMenuEntries.getLength();
- for ( i = 0; i < nCount; i++ )
+ for ( const SvtDynMenuEntry & rDynamicMenuEntry : aDynamicMenuEntries )
{
- const uno::Sequence< beans::PropertyValue >& rDynamicMenuEntry = aDynamicMenuEntries[ i ];
+ OUString aDocumentUrl = rDynamicMenuEntry.sURL;
+ OUString aTitle = rDynamicMenuEntry.sTitle;
- OUString aDocumentUrl, aTitle;
-
- for ( const beans::PropertyValue& e : rDynamicMenuEntry )
- {
- if ( e.Name == DYNAMICMENU_PROPERTYNAME_URL )
- e.Value >>= aDocumentUrl;
- else if ( e.Name == DYNAMICMENU_PROPERTYNAME_TITLE )
- e.Value >>= aTitle;
- }
//#i96822# business cards, labels and database should not be inserted here
if( aDocumentUrl == "private:factory/swriter?slot=21051" ||
aDocumentUrl == "private:factory/swriter?slot=21052" ||
@@ -195,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);
}
}
@@ -209,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 )
{
@@ -245,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
@@ -303,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();
@@ -316,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 });
@@ -377,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;
}
}
@@ -385,7 +354,7 @@ void SvxHyperlinkNewDocTp::DoApply()
{
}
- if (!(bCreate && !aStrNewName.isEmpty()))
+ if (!bCreate || aStrNewName.isEmpty())
return;
ExecuteInfo* pExecuteInfo = new ExecuteInfo;
@@ -397,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();
@@ -415,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() );
@@ -461,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 f2deeb9b3c78..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>
-char const sAnonymous[] = "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 ();
@@ -279,7 +185,7 @@ void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme)
|*
|************************************************************************/
-void SvxHyperlinkInternetTp::RemoveImproperProtocol(const OUString& aProperScheme)
+void SvxHyperlinkInternetTp::RemoveImproperProtocol(std::u16string_view aProperScheme)
{
OUString aStrURL ( m_xCbbTarget->get_active_text() );
if ( !aStrURL.isEmpty() )
@@ -293,62 +199,13 @@ void SvxHyperlinkInternetTp::RemoveImproperProtocol(const OUString& aProperSchem
}
}
-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 4e2e111fcc9b..2d25bed91747 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -36,8 +36,7 @@ using namespace ::com::sun::star;
SvxHyperlinkMailTp::SvxHyperlinkMailTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
: SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinkmailpage.ui", "HyperlinkMailPage", pItemSet)
, m_xCbbReceiver(new SvxHyperURLBox(xBuilder->weld_combo_box("receiver")))
- , m_xBtAdrBook(xBuilder->weld_button("adressbook"))
- , m_xFtSubject(xBuilder->weld_label("subject_label"))
+ , m_xBtAdrBook(xBuilder->weld_button("addressbook"))
, 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 )
@@ -167,7 +160,7 @@ void SvxHyperlinkMailTp::SetInitFocus()
/*************************************************************************
|************************************************************************/
-void SvxHyperlinkMailTp::SetScheme(const OUString& rScheme)
+void SvxHyperlinkMailTp::SetScheme(std::u16string_view rScheme)
{
//update target:
RemoveImproperProtocol(rScheme);
@@ -183,7 +176,7 @@ void SvxHyperlinkMailTp::SetScheme(const OUString& rScheme)
|* Remove protocol if it does not fit to the current button selection
|*
|************************************************************************/
-void SvxHyperlinkMailTp::RemoveImproperProtocol(const OUString& aProperScheme)
+void SvxHyperlinkMailTp::RemoveImproperProtocol(std::u16string_view aProperScheme)
{
OUString aStrURL(m_xCbbReceiver->get_active_text());
if ( !aStrURL.isEmpty() )
@@ -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 bac63d088f73..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& )
@@ -283,15 +298,18 @@ bool SvxHlinkDlgMarkWnd::RefreshFromDoc(const OUString& aURL)
// Fill Tree-Control
int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >& xLinks, const weld::TreeIter* pParentEntry )
{
+ // used to create the Headings outline parent children tree view relation
+ std::stack<std::pair<std::unique_ptr<weld::TreeIter>, const sal_Int32>> aHeadingsParentEntryStack;
+
int nEntries=0;
const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
- const sal_uLong nLinks = aNames.getLength();
+ 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" );
- for( sal_uLong i = 0; i < nLinks; i++ )
+ 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;
OUString aLink( *pNames++ );
@@ -328,10 +346,52 @@ 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());
- mxLbTree->insert(pParentEntry, -1, &aStrDisplayname, &sId, nullptr, nullptr, false, xEntry.get());
+ if (pParentEntry)
+ {
+ OUString sContentType = mxLbTree->get_text(*pParentEntry);
+ if (sContentType == "Headings")
+ {
+ if (aHeadingsParentEntryStack.empty())
+ aHeadingsParentEntryStack.push(
+ std::pair(mxLbTree->make_iterator(pParentEntry), -1));
+
+ // get the headings name to display
+ aAny = xTarget->getPropertyValue("ActualOutlineName");
+ OUString sActualOutlineName;
+ aAny >>= sActualOutlineName;
+
+ // get the headings outline level
+ aAny = xTarget->getPropertyValue("OutlineLevel");
+ 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
+ while (nOutlineLevel <= aHeadingsParentEntryStack.top().second)
+ aHeadingsParentEntryStack.pop();
+
+ mxLbTree->insert(aHeadingsParentEntryStack.top().first.get(), -1,
+ &sActualOutlineName, &sId, nullptr, nullptr, false,
+ xEntry.get());
+
+ // push if the inserted entry is a child
+ if (nOutlineLevel > aHeadingsParentEntryStack.top().second)
+ aHeadingsParentEntryStack.push(
+ std::pair(mxLbTree->make_iterator(xEntry.get()), nOutlineLevel));
+ }
+ else
+ {
+ mxLbTree->insert(pParentEntry, -1, &aStrDisplayname, &sId, nullptr,
+ nullptr, false, xEntry.get());
+ }
+ }
+ else
+ {
+ mxLbTree->insert(pParentEntry, -1, &aStrDisplayname, &sId, nullptr, nullptr,
+ false, xEntry.get());
+ }
try
{
@@ -372,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);
@@ -382,7 +442,7 @@ void SvxHlinkDlgMarkWnd::ClearTree()
}
// Find Entry for String
-std::unique_ptr<weld::TreeIter> SvxHlinkDlgMarkWnd::FindEntry (const OUString& aStrName)
+std::unique_ptr<weld::TreeIter> SvxHlinkDlgMarkWnd::FindEntry (std::u16string_view aStrName)
{
bool bFound=false;
std::unique_ptr<weld::TreeIter> xEntry = mxLbTree->make_iterator();
@@ -390,7 +450,7 @@ std::unique_ptr<weld::TreeIter> SvxHlinkDlgMarkWnd::FindEntry (const OUString& a
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
@@ -404,13 +464,12 @@ std::unique_ptr<weld::TreeIter> SvxHlinkDlgMarkWnd::FindEntry (const OUString& a
}
// Select Entry
-bool SvxHlinkDlgMarkWnd::SelectEntry(const OUString& aStrMark)
+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;
}
@@ -427,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);
@@ -442,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 f79f5644e710..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 ) );
}
}
}
@@ -204,13 +204,13 @@ void SvxHyperlinkTabPageBase::ShowMarkWnd()
else
{
// Pos Extrawindow on the left side of Dialog
- MoveToExtraWnd( Point(0,0) - Point( long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
+ MoveToExtraWnd( Point(0,0) - Point( tools::Long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
}
}
else
{
// Pos Extrawindow on the right side of Dialog
- MoveToExtraWnd ( Point( long(1.05*aDlgSize.getWidth()), 0 ) );
+ MoveToExtraWnd ( Point( tools::Long(1.05*aDlgSize.getWidth()), 0 ) );
}
// Set size of Extra-Window
@@ -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 bca5984f8817..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,12 +71,12 @@ 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)));
maPageList.back()->xPage->Reset(*pSet);
- PageCreated(rId, *maPageList.back()->xPage);
+ PageCreated(*maPageList.back()->xPage);
}
/**********************************************************************
@@ -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 ( const OString& rId )
+IconChoicePageData* SvxHpLinkDlg::GetPageData ( std::u16string_view rId )
{
IconChoicePageData *pRet = nullptr;
for (const auto & pData : maPageList)
@@ -303,7 +305,7 @@ IconChoicePageData* SvxHpLinkDlg::GetPageData ( const OString& 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 4f34b461eba5..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>
@@ -36,10 +38,11 @@
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
-#include <sal/log.hxx>
#include <tools/urlobj.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
+#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,16 +88,17 @@ 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& )
{
- SAL_WARN( "cui.dialogs", "caught IllegalArgumentException when registering filter" );
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "caught IllegalArgumentException when registering filter" );
}
if( xFilePicker->execute() == ExecutableDialogResults::OK )
@@ -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);
}
@@ -156,16 +163,16 @@ short SvInsertOleDlg::run()
// fill listbox and select default
m_xLbObjecttype->freeze();
- for ( sal_uLong i = 0; i < m_pServers->Count(); i++ )
+ for ( size_t i = 0; i < m_pServers->Count(); i++ )
m_xLbObjecttype->append_text((*m_pServers)[i].GetHumanName());
m_xLbObjecttype->thaw();
m_xLbObjecttype->select(0);
- OUString aName;
DBG_ASSERT( m_xStorage.is(), "No storage!");
if ( m_xStorage.is() && ( nRet = InsertObjectDialog_Impl::run() ) == RET_OK )
{
OUString aFileName;
+ OUString aName;
bool bCreateNew = IsCreateNew();
if ( bCreateNew )
{
@@ -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);
@@ -508,15 +557,15 @@ short SfxInsertFloatingFrameDialog::run()
bool bHasBorder = m_xRBFrameBorderOn->get_active();
- long lMarginWidth;
+ tools::Long lMarginWidth;
if (!m_xCBMarginWidthDefault->get_active())
- lMarginWidth = static_cast<long>(m_xNMMarginWidth->get_text().toInt32());
+ lMarginWidth = static_cast<tools::Long>(m_xNMMarginWidth->get_text().toInt32());
else
lMarginWidth = SIZE_NOT_SET;
- long lMarginHeight;
+ tools::Long lMarginHeight;
if (!m_xCBMarginHeightDefault->get_active())
- lMarginHeight = static_cast<long>(m_xNMMarginHeight->get_text().toInt32());
+ lMarginHeight = static_cast<tools::Long>(m_xNMMarginHeight->get_text().toInt32());
else
lMarginHeight = SIZE_NOT_SET;
@@ -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/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx
index 16e81f8d90ea..9eb50987ea9a 100644
--- a/cui/source/dialogs/newtabledlg.cxx
+++ b/cui/source/dialogs/newtabledlg.cxx
@@ -28,12 +28,12 @@ SvxNewTableDialog::SvxNewTableDialog(weld::Window* pWindow)
sal_Int32 SvxNewTableDialog::getRows() const
{
- return sal::static_int_cast< sal_Int32 >( mxNumRows->get_value() );
+ return sal::static_int_cast<sal_Int32>(mxNumRows->get_value());
}
sal_Int32 SvxNewTableDialog::getColumns() const
{
- return sal::static_int_cast< sal_Int32 >( mxNumColumns->get_value() );
+ return sal::static_int_cast<sal_Int32>(mxNumColumns->get_value());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 375a966c7786..423637e9d9e9 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -26,8 +26,8 @@
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
#include <tools/lineend.hxx>
-#include <comphelper/propertysequence.hxx>
#include <comphelper/dispatchcommand.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
SvPasteObjectDialog::SvPasteObjectDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/pastespecial.ui", "PasteSpecialDialog")
@@ -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 b96c1dd85fbf..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();
}
@@ -110,21 +101,15 @@ SvxPostItDialog::~SvxPostItDialog()
{
}
-void SvxPostItDialog::ShowLastAuthor(const OUString& rAuthor, const OUString& rDate)
+void SvxPostItDialog::ShowLastAuthor(std::u16string_view rAuthor, std::u16string_view rDate)
{
- OUString sTxt = rAuthor + ", " + rDate;
+ OUString sTxt = OUString::Concat(rAuthor) + ", " + rDate;
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 b0513931bde8..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>
@@ -43,12 +43,13 @@
#include <svtools/optionsdrawinglayer.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <set>
+#include <string_view>
using namespace com::sun::star;
namespace
{
- OUString lcl_genRandom( const OUString &rId )
+ OUString lcl_genRandom( std::u16string_view rId )
{
//FIXME: plus timestamp
unsigned int nRand = comphelper::rng::uniform_uint_distribution(0, 0xFFFF);
@@ -61,18 +62,18 @@ namespace
OUString aTempl("<alt id=\"%1\">"
" " //FIXME real dialog title or something
"</alt>");
- aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("alt_id") );
+ aTempl = aTempl.replaceFirst( "%1", lcl_genRandom(u"alt_id") );
return aTempl;
}
- OUString lcl_Image( const OUString& rScreenshotId, const Size& rSize )
+ OUString lcl_Image( std::u16string_view rScreenshotId, const Size& rSize )
{
OUString aTempl("<image id=\"%1\" src=\"media/screenshots/%2.png\""
" width=\"%3cm\" height=\"%4cm\">"
"%5"
"</image>");
- aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("img_id") );
+ aTempl = aTempl.replaceFirst( "%1", lcl_genRandom(u"img_id") );
aTempl = aTempl.replaceFirst( "%2", rScreenshotId );
aTempl = aTempl.replaceFirst( "%3", OUString::number( rSize.Width() ) );
aTempl = aTempl.replaceFirst( "%4", OUString::number( rSize.Height() ) );
@@ -81,23 +82,23 @@ namespace
return aTempl;
}
- OUString lcl_ParagraphWithImage( const OUString& rScreenshotId, const Size& rSize )
+ OUString lcl_ParagraphWithImage( std::u16string_view rScreenshotId, const Size& rSize )
{
OUString aTempl( "<paragraph id=\"%1\" role=\"paragraph\">%2"
"</paragraph>" SAL_NEWLINE_STRING );
- aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("par_id") );
+ aTempl = aTempl.replaceFirst( "%1", lcl_genRandom(u"par_id") );
aTempl = aTempl.replaceFirst( "%2", lcl_Image(rScreenshotId, rSize) );
return aTempl;
}
- OUString lcl_Bookmark( const OUString& rWidgetId )
+ OUString lcl_Bookmark( std::u16string_view rWidgetId )
{
OUString aTempl = "<!-- Bookmark for widget %1 -->" SAL_NEWLINE_STRING
"<bookmark branch=\"hid/%2\" id=\"%3\" localize=\"false\"/>" SAL_NEWLINE_STRING;
aTempl = aTempl.replaceFirst( "%1", rWidgetId );
aTempl = aTempl.replaceFirst( "%2", rWidgetId );
- aTempl = aTempl.replaceFirst( "%3", lcl_genRandom("bm_id") );
+ aTempl = aTempl.replaceFirst( "%3", lcl_genRandom(u"bm_id") );
return aTempl;
}
@@ -199,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();
@@ -233,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);
@@ -253,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 );
@@ -277,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();
@@ -293,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)
@@ -321,7 +321,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&,
if (aCurrentExtension.isEmpty())
{
- aConfirmedURL.setExtension("png");
+ aConfirmedURL.setExtension(u"png");
}
// open stream
@@ -341,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)
@@ -438,15 +438,14 @@ 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)
{
- mxVirtualBufferDevice->SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
+ mxVirtualBufferDevice->SetAntialiasing(AntialiasingFlags::Enable);
}
// paint selected entries
@@ -547,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 ed09844aa771..67bb456b7d61 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -18,6 +18,7 @@
*/
#include <memory>
+#include <string_view>
#include <utility>
#include <sfx2/objsh.hxx>
@@ -45,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;
@@ -61,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;
@@ -73,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);
@@ -113,7 +116,7 @@ void SvxScriptOrgDialog::deleteAllTree()
while (bNextEntry);
}
-void SvxScriptOrgDialog::Init( const OUString& language )
+void SvxScriptOrgDialog::Init( std::u16string_view language )
{
m_xScriptsBox->freeze();
@@ -125,9 +128,6 @@ void SvxScriptOrgDialog::Init( const OUString& language )
Sequence< Reference< browse::XBrowseNode > > children;
- OUString userStr("user");
- OUString const shareStr("share");
-
try
{
Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get(xCtx);
@@ -147,22 +147,20 @@ void SvxScriptOrgDialog::Init( const OUString& 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
{
@@ -180,7 +178,7 @@ void SvxScriptOrgDialog::Init( const OUString& language )
} catch(const uno::Exception&)
{}
- for ( const beans::PropertyValue& prop : std::as_const(moduleDescr))
+ for (const beans::PropertyValue& prop : moduleDescr)
{
if ( prop.Name == "ooSetupFactoryEmptyDocumentURL" )
{
@@ -194,7 +192,7 @@ void SvxScriptOrgDialog::Init( const OUString& language )
Reference< browse::XBrowseNode > langEntries =
getLangNodeFromRootNode( childNode, language );
- insertEntry( uiName, app ? OUStringLiteral(RID_CUIBMP_HARDDISK) : OUStringLiteral(RID_CUIBMP_DOC),
+ insertEntry( uiName, app ? RID_CUIBMP_HARDDISK : RID_CUIBMP_DOC,
nullptr, true, std::make_unique< SFEntry >( langEntries, xDocumentModel ), factoryURL, false );
}
@@ -202,7 +200,7 @@ void SvxScriptOrgDialog::Init( const OUString& language )
}
Reference< XInterface >
-SvxScriptOrgDialog::getDocumentModel( Reference< XComponentContext > const & xCtx, OUString const & docName )
+SvxScriptOrgDialog::getDocumentModel( Reference< XComponentContext > const & xCtx, std::u16string_view docName )
{
Reference< XInterface > xModel;
Reference< frame::XDesktop2 > desktop = frame::Desktop::create(xCtx);
@@ -229,7 +227,7 @@ SvxScriptOrgDialog::getDocumentModel( Reference< XComponentContext > const & xCt
}
Reference< browse::XBrowseNode >
-SvxScriptOrgDialog::getLangNodeFromRootNode( Reference< browse::XBrowseNode > const & rootNode, OUString const & language )
+SvxScriptOrgDialog::getLangNodeFromRootNode( Reference< browse::XBrowseNode > const & rootNode, std::u16string_view language )
{
Reference< browse::XBrowseNode > langNode;
@@ -280,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)
@@ -296,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);
@@ -311,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);
@@ -324,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;
@@ -368,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"))
@@ -527,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)
@@ -555,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;
@@ -599,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);
}
@@ -620,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();
@@ -676,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();
@@ -687,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();
@@ -695,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;
@@ -752,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;
@@ -779,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;
@@ -809,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 & )
@@ -850,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();
@@ -891,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 & )
@@ -925,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);
@@ -1033,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()
@@ -1047,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)
@@ -1079,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
{
@@ -1103,26 +1100,26 @@ OUString ReplaceString(
OUString FormatErrorString(
const OUString& unformatted,
- const OUString& language,
- const OUString& script,
- const OUString& line,
- const OUString& type,
- const OUString& message )
+ 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.isEmpty() )
+ 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.isEmpty() )
+ 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;
@@ -1131,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;
@@ -1156,21 +1153,21 @@ 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(
- unformatted, language, script, line, "", message );
+ unformatted, language, script, line, u"", message );
}
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;
@@ -1196,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() )
@@ -1215,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");
@@ -1233,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
@@ -1243,7 +1239,7 @@ OUString GetErrorMessage(
message = sError.Message;
}
return FormatErrorString(
- unformatted, language, script, OUString(), OUString(), message );
+ unformatted, language, script, u"", std::u16string_view(), message );
}
OUString GetErrorMessage( const css::uno::Any& aException )
@@ -1298,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 ),
@@ -1316,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 3c745692f7ea..6b10e5c688e3 100644
--- a/cui/source/dialogs/sdrcelldlg.cxx
+++ b/cui/source/dialogs/sdrcelldlg.cxx
@@ -21,12 +21,18 @@
#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())
, mpHatchingList(rModel.GetHatchList())
, mpBitmapList(rModel.GetBitmapList())
@@ -36,9 +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);
+
+ 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")
{
@@ -55,6 +84,21 @@ void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
SvxBorderTabPage& rBorderPage = static_cast<SvxBorderTabPage&>(rPage);
rBorderPage.SetTableMode();
}
+ else if (rId == "shadow")
+ {
+ 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 895ed485ec1c..ae468b02009a 100644
--- a/cui/source/dialogs/showcols.cxx
+++ b/cui/source/dialogs/showcols.cxx
@@ -19,34 +19,35 @@
#include <showcols.hxx>
-#include <osl/diagnose.h>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/types.hxx>
#include <tools/debug.hxx>
+#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")
, m_xList(m_xBuilder->weld_tree_view("treeview"))
, m_xOK(m_xBuilder->weld_button("ok"))
{
- m_xList->set_size_request(m_xList->get_approximate_digit_width() * 40, m_xList->get_height_rows(8));
+ m_xList->set_size_request(m_xList->get_approximate_digit_width() * 40,
+ m_xList->get_height_rows(8));
m_xList->set_selection_mode(SelectionMode::Multiple);
m_xOK->connect_clicked(LINK(this, FmShowColsDialog, OnClickedOk));
}
-FmShowColsDialog::~FmShowColsDialog()
-{
-}
+FmShowColsDialog::~FmShowColsDialog() {}
IMPL_LINK_NOARG(FmShowColsDialog, OnClickedOk, weld::Button&, void)
{
- DBG_ASSERT(m_xColumns.is(), "FmShowColsDialog::OnClickedOk : you should call SetColumns before executing the dialog !");
+ DBG_ASSERT(
+ m_xColumns.is(),
+ "FmShowColsDialog::OnClickedOk : you should call SetColumns before executing the dialog !");
if (m_xColumns.is())
{
- css::uno::Reference< css::beans::XPropertySet > xCol;
+ css::uno::Reference<css::beans::XPropertySet> xCol;
auto nSelectedRows = m_xList->get_selected_rows();
for (auto i : nSelectedRows)
{
@@ -57,9 +58,10 @@ IMPL_LINK_NOARG(FmShowColsDialog, OnClickedOk, weld::Button&, void)
{
xCol->setPropertyValue(CUIFM_PROP_HIDDEN, css::uno::Any(false));
}
- catch(...)
+ catch (...)
{
- OSL_FAIL("FmShowColsDialog::OnClickedOk Exception occurred!");
+ TOOLS_WARN_EXCEPTION("cui.dialogs",
+ "FmShowColsDialog::OnClickedOk Exception occurred!");
}
}
}
@@ -68,7 +70,7 @@ IMPL_LINK_NOARG(FmShowColsDialog, OnClickedOk, weld::Button&, void)
m_xDialog->response(RET_OK);
}
-void FmShowColsDialog::SetColumns(const css::uno::Reference< css::container::XIndexContainer>& xCols)
+void FmShowColsDialog::SetColumns(const css::uno::Reference<css::container::XIndexContainer>& xCols)
{
DBG_ASSERT(xCols.is(), "FmShowColsDialog::SetColumns : invalid columns !");
if (!xCols.is())
@@ -77,9 +79,9 @@ void FmShowColsDialog::SetColumns(const css::uno::Reference< css::container::XIn
m_xList->clear();
- css::uno::Reference< css::beans::XPropertySet> xCurCol;
+ css::uno::Reference<css::beans::XPropertySet> xCurCol;
OUString sCurName;
- for (sal_Int32 i=0; i<xCols->getCount(); ++i)
+ for (sal_Int32 i = 0; i < xCols->getCount(); ++i)
{
sCurName.clear();
xCurCol.set(xCols->getByIndex(i), css::uno::UNO_QUERY);
@@ -93,9 +95,9 @@ void FmShowColsDialog::SetColumns(const css::uno::Reference< css::container::XIn
xCurCol->getPropertyValue(CUIFM_PROP_LABEL) >>= sName;
sCurName = sName;
}
- catch(...)
+ catch (...)
{
- OSL_FAIL("FmShowColsDialog::SetColumns Exception occurred!");
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "FmShowColsDialog::SetColumns Exception occurred!");
}
// if the col is hidden, put it into the list
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index 40b798b7c2c9..14146b44c373 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -19,7 +19,7 @@
#include <splitcelldlg.hxx>
-SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal)
+SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, tools::Long nMaxVertical, tools::Long nMaxHorizontal)
: GenericDialogController(pParent, "cui/ui/splitcellsdialog.ui", "SplitCellsDialog")
, m_xCountEdit(m_xBuilder->weld_spin_button("countnf"))
, m_xHorzBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("hori") : m_xBuilder->weld_radio_button("vert"))
@@ -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,10 +50,12 @@ 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();
- long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
+ 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);
}
@@ -69,20 +70,45 @@ bool SvxSplitTableDlg::IsProportional() const
return m_xPropCB->get_active() && m_xHorzBox->get_active();
}
-long SvxSplitTableDlg::GetCount() const
+tools::Long SvxSplitTableDlg::GetCount() const
{
return m_xCountEdit->get_value();
}
-short SvxSplitTableDlg::Execute()
-{
- return run();
-}
-
void SvxSplitTableDlg::SetSplitVerticalByDefault()
{
if( mnMaxVertical >= 2 )
m_xVertBox->set_active(true); // tdf#60242
}
+bool SvxAbstractSplitTableDialog_Impl::IsHorizontal() const
+{
+ return m_xDlg->IsHorizontal();
+}
+
+bool SvxAbstractSplitTableDialog_Impl::IsProportional() const
+{
+ return m_xDlg->IsProportional();
+}
+
+tools::Long SvxAbstractSplitTableDialog_Impl::GetCount() const
+{
+ return m_xDlg->GetCount();
+}
+
+void SvxAbstractSplitTableDialog_Impl::SetSplitVerticalByDefault()
+{
+ m_xDlg->SetSplitVerticalByDefault();
+}
+
+short SvxAbstractSplitTableDialog_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
+bool SvxAbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext& rContext)
+{
+ return weld::DialogController::runAsync(m_xDlg, rContext.maEndDialogFn);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 612f5fe019b2..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
@@ -234,13 +236,12 @@ IMPL_LINK_NOARG(SvxThesaurusDialog, SelectFirstHdl_Impl, void *, void)
// class SvxThesaurusDialog ----------------------------------------------
SvxThesaurusDialog::SvxThesaurusDialog(
- weld::Window* pParent,
+ weld::Widget* pParent,
uno::Reference< linguistic2::XThesaurus > const & xThes,
const OUString &rWord,
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 7d6a05b72a0f..40bb606130f2 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -17,51 +17,98 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
#include <tipofthedaydlg.hxx>
+#include <tipoftheday.hrc>
+
+#include <sfx2/viewfrm.hxx>
+#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/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
+
+#include <comphelper/dispatchcommand.hxx>
#include <dialmgr.hxx>
+#include <i18nlangtag/languagetag.hxx>
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
-#include <tipoftheday.hrc>
-#include <vcl/graphicfilter.hxx>
-#include <vcl/help.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/svapp.hxx>
-#include <i18nlangtag/languagetag.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_pImage(m_xBuilder->weld_image("imImage"))
+ , 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"))
, m_pLink(m_xBuilder->weld_link_button("btnLink"))
+ , m_pPreview(new weld::CustomWeld(*m_xBuilder, "imPreview", m_aPreview))
{
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());
- nNumberOfTips = SAL_N_ELEMENTS(TIPOFTHEDAY_STRINGARRAY);
- nCurrentTip = officecfg::Office::Common::Misc::LastTipOfTheDayID::get();
+ 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();
- nDay = std::chrono::duration_cast<std::chrono::hours>(t0).count() / 24; //days since 1970-01-01
+ 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())
- nCurrentTip++;
+ 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(nDay, xChanges);
- officecfg::Office::Common::Misc::LastTipOfTheDayID::set(nCurrentTip, 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)
@@ -72,13 +119,32 @@ static bool file_exists(const OUString& fileName)
void TipOfTheDayDialog::UpdateTip()
{
- if ((nCurrentTip + 1 > nNumberOfTips) || (nCurrentTip < 0))
- nCurrentTip = 0;
- m_xDialog->set_title(CuiResId(STR_TITLE) + ": " + OUString::number(nCurrentTip + 1) + "/"
- + OUString::number(nNumberOfTips));
+ constexpr sal_Int32 nNumberOfTips = std::size(TIPOFTHEDAY_STRINGARRAY);
+
+ 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, nType] = TIPOFTHEDAY_STRINGARRAY[m_nCurrentTip];
// text
- OUString aText = CuiResId(std::get<0>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]));
//replace MOD1 & MOD2 shortcuts depending on platform
#ifdef MACOSX
const OUString aMOD1 = CuiResId(STR_CMD);
@@ -87,75 +153,118 @@ void TipOfTheDayDialog::UpdateTip()
const OUString aMOD1 = CuiResId(STR_CTRL);
const OUString aMOD2 = CuiResId(STR_Alt);
#endif
- sal_Int32 aPos;
- aPos = aText.indexOf("%MOD1");
- if (aPos != -1)
- aText = aText.replaceAt(aPos, 5, aMOD1);
- aPos = aText.indexOf("%MOD2");
- if (aPos != -1)
- aText = aText.replaceAt(aPos, 5, aMOD2);
- m_pText->set_label(aText);
+ m_pText->set_label(CuiResId(sTip).replaceAll("%MOD1", aMOD1).replaceAll("%MOD2", aMOD2));
// hyperlink
- aLink = std::get<1>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]);
- if (aLink.isEmpty())
+ if (sLink.isEmpty())
{
m_pLink->set_visible(false);
}
- else if (aLink.startsWith("http"))
+ else if (sLink.startsWith(".uno:"))
{
- // Links may have some %PRODUCTVERSION which need to be expanded
- aText = Translate::ExpandVariables(aLink);
- aPos = aText.indexOf("%LANGUAGENAME");
- if (aPos != -1)
+ m_pLink->set_visible(false);
+ //show the link only if the UNO command is available in the current module
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
{
- OUString aLang = LanguageTag(utl::ConfigManager::getUILocale()).getLanguage();
- if (aLang == "en" || aLang == "pt" || aLang == "zh") //en-US/GB, pt-BR, zh-CH/TW
- aLang = LanguageTag(utl::ConfigManager::getUILocale()).getBcp47();
- aText = aText.replaceAt(aPos, 13, aLang);
- }
- m_pLink->set_uri(aText);
+ const auto xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ const css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(
+ xFrame, css::uno::UNO_QUERY);
+ if (xDispatchProvider.is())
+ {
+ css::util::URL aCommandURL;
+ aCommandURL.Complete = sLink;
+ const css::uno::Reference<css::uno::XComponentContext> xContext
+ = comphelper::getProcessComponentContext();
+ const css::uno::Reference<css::util::XURLTransformer> xParser
+ = css::util::URLTransformer::create(xContext);
+ xParser->parseStrict(aCommandURL);
+ const css::uno::Reference<css::frame::XDispatch> xDisp
+ = xDispatchProvider->queryDispatch(aCommandURL, OUString(), 0);
+ if (xDisp.is())
+ {
+ m_pLink->set_label(CuiResId(STR_UNO_LINK));
+ m_pLink->set_uri(sLink);
+
+ const OUString aModuleName(
+ vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
+ const auto aProperties
+ = vcl::CommandInfoProvider::GetCommandProperties(sLink, aModuleName);
+ m_pLink->set_tooltip_text(
+ vcl::CommandInfoProvider::GetTooltipForCommand(sLink, aProperties, xFrame));
+ m_pLink->set_visible(true);
+ m_pLink->connect_activate_link(LINK(this, TipOfTheDayDialog, OnLinkClick));
+ }
+ }
+ }
+ }
+ else if (sLink.startsWith("http"))
+ {
+ // Links may have some %PRODUCTVERSION which need to be expanded
+ OUString aText = Translate::ExpandVariables(sLink);
+ OUString aLang = LanguageTag(utl::ConfigManager::getUILocale()).getLanguage();
+ if (aLang == "en" || aLang == "pt" || aLang == "zh") //en-US/GB, pt-BR, zh-CH/TW
+ aLang = LanguageTag(utl::ConfigManager::getUILocale()).getBcp47();
+ m_pLink->set_uri(aText.replaceFirst("%LANGUAGENAME", aLang));
m_pLink->set_label(CuiResId(STR_MORE_LINK));
m_pLink->set_visible(true);
m_pLink->connect_activate_link(Link<weld::LinkButton&, bool>());
}
else
{
- m_pLink->set_uri("");
+ m_pLink->set_uri(sLink);
m_pLink->set_label(CuiResId(STR_HELP_LINK));
m_pLink->set_visible(true);
- //converts aLink into the proper offline/online hyperlink
m_pLink->connect_activate_link(LINK(this, TipOfTheDayDialog, OnLinkClick));
}
// image
OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/tipoftheday/");
rtl::Bootstrap::expandMacros(aURL);
- OUString aImage = std::get<2>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]);
- // use default image if none is available with the number
- if (aImage.isEmpty() || !file_exists(aURL + aImage))
- aImage = "tipoftheday.png";
- // draw image
+ OUString aImageName = sImage;
Graphic aGraphic;
- if (GraphicFilter::LoadGraphic(aURL + aImage, OUString(), aGraphic) == ERRCODE_NONE)
+
+ if (!aImageName.isEmpty() && file_exists(aURL + aImageName))
+ GraphicFilter::LoadGraphic(aURL + aImageName, OUString(), aGraphic);
+ else
{
- ScopedVclPtr<VirtualDevice> m_pVirDev = m_pImage->create_virtual_device();
- m_pVirDev->SetOutputSizePixel(aGraphic.GetSizePixel());
- m_pVirDev->DrawBitmapEx(Point(0, 0), aGraphic.GetBitmapEx());
- m_pImage->set_image(m_pVirDev.get());
- m_pVirDev.disposeAndClear();
+ 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);
}
-IMPL_LINK_NOARG(TipOfTheDayDialog, OnLinkClick, weld::LinkButton&, bool)
+IMPL_LINK(TipOfTheDayDialog, OnLinkClick, weld::LinkButton&, rButton, bool)
{
- Application::GetHelp()->Start(aLink, static_cast<weld::Widget*>(nullptr));
+ const OUString sLink = rButton.get_uri();
+ if (sLink.startsWith(".uno:"))
+ {
+ comphelper::dispatchCommand(sLink, {});
+ TipOfTheDayDialog::response(RET_OK);
+ }
+ else
+ {
+ Application::GetHelp()->Start(sLink, static_cast<weld::Widget*>(nullptr));
+ }
return true;
}
IMPL_LINK_NOARG(TipOfTheDayDialog, OnNextClick, weld::Button&, void)
{
- nCurrentTip++; //zeroed at updatetip when out of range
+ m_nCurrentTip++; //zeroed at updatetip when out of range
UpdateTip();
}
diff --git a/cui/source/dialogs/toolbarmodedlg.cxx b/cui/source/dialogs/toolbarmodedlg.cxx
new file mode 100644
index 000000000000..54918e7fdcd4
--- /dev/null
+++ b/cui/source/dialogs/toolbarmodedlg.cxx
@@ -0,0 +1,210 @@
+/* -*- 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 <toolbarmodedlg.hxx>
+#include <toolbarmode.hrc>
+
+#include <com/sun/star/frame/ModuleManager.hpp>
+#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/types.hxx>
+#include <dialmgr.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/UI/ToolbarMode.hxx>
+#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <strings.hrc>
+#include <unotools/confignode.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <vcl/EnumContext.hxx>
+#include <vcl/weld.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+static OUString GetCurrentApp()
+{
+ OUString sResult;
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ {
+ const auto xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
+ const auto xContext = comphelper::getProcessComponentContext();
+ const auto xModuleManager = css::frame::ModuleManager::create(xContext);
+ switch (vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xCurrentFrame)))
+ {
+ case vcl::EnumContext::Application::Writer:
+ sResult = "Writer";
+ break;
+ case vcl::EnumContext::Application::Calc:
+ sResult = "Calc";
+ break;
+ case vcl::EnumContext::Application::Impress:
+ sResult = "Impress";
+ break;
+ case vcl::EnumContext::Application::Draw:
+ sResult = "Draw";
+ break;
+ case vcl::EnumContext::Application::Formula:
+ sResult = "Formula";
+ break;
+ case vcl::EnumContext::Application::Base:
+ sResult = "Base";
+ break;
+ default:
+ sResult = "Unsupported";
+ }
+ }
+ return sResult;
+}
+
+static OUString GetCurrentMode()
+{
+ OUString sResult;
+ if (SfxViewFrame::Current())
+ {
+ const auto xContext = comphelper::getProcessComponentContext();
+ const utl::OConfigurationTreeRoot aAppNode(
+ xContext, "org.openoffice.Office.UI.ToolbarMode/Applications/" + GetCurrentApp(), true);
+ if (aAppNode.isValid())
+ sResult = comphelper::getString(aAppNode.getNodeValue("Active"));
+ };
+ return sResult;
+}
+
+ToolbarmodeDialog::ToolbarmodeDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "cui/ui/toolbarmodedialog.ui", "ToolbarmodeDialog")
+ , m_pImage(m_xBuilder->weld_image("imImage"))
+ , m_pApply(m_xBuilder->weld_button("btnApply"))
+ , m_pApplyAll(m_xBuilder->weld_button("btnApplyAll"))
+ , m_pRadioButtons{ (m_xBuilder->weld_radio_button("rbButton1")),
+ (m_xBuilder->weld_radio_button("rbButton2")),
+ (m_xBuilder->weld_radio_button("rbButton3")),
+ (m_xBuilder->weld_radio_button("rbButton4")),
+ (m_xBuilder->weld_radio_button("rbButton5")),
+ (m_xBuilder->weld_radio_button("rbButton6")),
+ (m_xBuilder->weld_radio_button("rbButton7")),
+ (m_xBuilder->weld_radio_button("rbButton8")),
+ (m_xBuilder->weld_radio_button("rbButton9")) }
+ , m_pInfoLabel(m_xBuilder->weld_label("lbInfo"))
+{
+ static_assert(SAL_N_ELEMENTS(m_pRadioButtons) == std::size(TOOLBARMODES_ARRAY));
+
+ Link<weld::Toggleable&, void> aLink = LINK(this, ToolbarmodeDialog, SelectToolbarmode);
+
+ const OUString sCurrentMode = GetCurrentMode();
+ 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]))
+ {
+ m_pRadioButtons[i]->set_active(true);
+ UpdateImage(std::get<2>(TOOLBARMODES_ARRAY[i]));
+ m_pInfoLabel->set_label(CuiResId(std::get<0>(TOOLBARMODES_ARRAY[i])));
+ }
+ }
+
+ 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));
+
+ if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
+ {
+ m_pRadioButtons[nGroupedbarFull]->set_visible(false);
+ m_pRadioButtons[nContextualGroups]->set_visible(false);
+ }
+}
+
+ToolbarmodeDialog::~ToolbarmodeDialog() = default;
+
+static bool file_exists(const OUString& fileName)
+{
+ osl::File aFile(fileName);
+ return aFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None;
+}
+
+int ToolbarmodeDialog::GetActiveRadioButton()
+{
+ for (std::size_t i = 0; i < std::size(m_pRadioButtons); ++i)
+ {
+ if (m_pRadioButtons[i]->get_active())
+ return i;
+ }
+ return -1;
+}
+
+void ToolbarmodeDialog::UpdateImage(std::u16string_view sFileName)
+{
+ // load image
+ OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/toolbarmode/");
+ rtl::Bootstrap::expandMacros(aURL);
+ aURL += sFileName;
+ if (sFileName.empty() || !file_exists(aURL))
+ return;
+ // draw image
+ Graphic aGraphic;
+ if (GraphicFilter::LoadGraphic(aURL, OUString(), aGraphic) == ERRCODE_NONE)
+ {
+ ScopedVclPtr<VirtualDevice> m_pVirDev = m_pImage->create_virtual_device();
+ m_pVirDev->SetOutputSizePixel(aGraphic.GetSizePixel());
+ m_pVirDev->DrawBitmapEx(Point(0, 0), aGraphic.GetBitmapEx());
+ m_pImage->set_image(m_pVirDev.get());
+ m_pVirDev.disposeAndClear();
+ }
+}
+
+IMPL_LINK_NOARG(ToolbarmodeDialog, SelectToolbarmode, weld::Toggleable&, void)
+{
+ const int i = GetActiveRadioButton();
+ if (i > -1)
+ {
+ UpdateImage(std::get<2>(TOOLBARMODES_ARRAY[i]));
+ m_pInfoLabel->set_label(CuiResId(std::get<0>(TOOLBARMODES_ARRAY[i])));
+ }
+}
+
+IMPL_LINK(ToolbarmodeDialog, OnApplyClick, weld::Button&, rButton, void)
+{
+ const int i = GetActiveRadioButton();
+ if (i == -1)
+ return;
+ const OUString sCmd = std::get<1>(TOOLBARMODES_ARRAY[i]);
+ //apply to all except current module
+ if (&rButton == m_pApplyAll.get())
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> aBatch(
+ 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);
+ officecfg::Office::UI::ToolbarMode::ActiveDraw::set(sCmd, aBatch);
+ aBatch->commit();
+
+ OUString sCurrentApp = GetCurrentApp();
+ if (SfxViewFrame::Current())
+ {
+ const auto xContext = comphelper::getProcessComponentContext();
+ const utl::OConfigurationTreeRoot aAppNode(
+ xContext, "org.openoffice.Office.UI.ToolbarMode/Applications/", true);
+ if (sCurrentApp != "Writer")
+ aAppNode.setNodeValue("Writer/Active", css::uno::Any(sCmd));
+ if (sCurrentApp != "Calc")
+ aAppNode.setNodeValue("Calc/Active", css::uno::Any(sCmd));
+ if (sCurrentApp != "Impress")
+ aAppNode.setNodeValue("Impress/Active", css::uno::Any(sCmd));
+ if (sCurrentApp != "Draw")
+ aAppNode.setNodeValue("Draw/Active", css::uno::Any(sCmd));
+ aAppNode.commit();
+ };
+ }
+ //apply to current module
+ comphelper::dispatchCommand(".uno:ToolbarMode?Mode:string=" + sCmd, {});
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
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 b80080dfa352..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,14 +183,13 @@ 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 (nullptr != dynamic_cast<const SvxZoomItem*>(&rItem))
+ if (auto pZoomItem = dynamic_cast<const SvxZoomItem*>(&rItem))
{
- const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>(rItem);
- const sal_uInt16 nZoom = rZoomItem.GetValue();
- const SvxZoomType eType = rZoomItem.GetType();
- const SvxZoomEnableFlags nValSet = rZoomItem.GetValueSet();
+ const sal_uInt16 nZoom = pZoomItem->GetValue();
+ const SvxZoomType eType = pZoomItem->GetType();
+ const SvxZoomEnableFlags nValSet = pZoomItem->GetValueSet();
ZoomButtonId nButtonId = ZoomButtonId::NONE;
switch (eType)
@@ -229,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();
@@ -270,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;
@@ -297,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;
@@ -333,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;
@@ -345,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();
@@ -389,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 bbe1d743120a..28b83f6a8780 100644
--- a/cui/source/factory/cuiexp.cxx
+++ b/cui/source/factory/cuiexp.cxx
@@ -19,22 +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>
+{
+public:
+ // css::lang::XServiceInfo:
+ virtual OUString SAL_CALL getImplementationName() override
{
- static AbstractDialogFactory_Impl* pFactory = new AbstractDialogFactory_Impl;
- return pFactory;
+ 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" };
}
-}
-extern "C"
-{
- SAL_DLLPUBLIC_EXPORT VclAbstractDialogFactory* CreateDialogFactory()
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL
+ getSomething(const ::css::uno::Sequence<::sal_Int8>& /*aIdentifier*/) override
{
- return ::cui::GetFactory();
+ // 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 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 b59f73cf8530..2b58e5854f6e 100644
--- a/cui/source/factory/cuiresmgr.cxx
+++ b/cui/source/factory/cuiresmgr.cxx
@@ -20,9 +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 a31e987202eb..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>
@@ -30,9 +32,8 @@
#include <svx/svxids.hrc>
#include <numfmt.hxx>
#include <splitcelldlg.hxx>
-#include <dstribut.hxx>
#include <cuiimapwnd.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
#include <srchxtra.hxx>
#include <textanim.hxx>
#include <autocdlg.hxx>
@@ -47,7 +48,6 @@
#include <cuisrchdlg.hxx>
#include <cuitbxform.hxx>
#include <optdict.hxx>
-#include <dlgname.hxx>
#include <multipat.hxx>
#include <cuihyperdlg.hxx>
#include <cuifmsearch.hxx>
@@ -89,7 +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 AbstractSvxDistributeDialog_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();
-}
-
-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();
}
@@ -397,15 +221,6 @@ void CuiAbstractSingleTabController_Impl::SetText(const OUString& rStr)
m_xDlg->set_title(rStr);
}
-SvxDistributeHorizontal AbstractSvxDistributeDialog_Impl::GetDistributeHor()const
-{
- return m_xDlg->GetDistributeHor();
-}
-SvxDistributeVertical AbstractSvxDistributeDialog_Impl::GetDistributeVer()const
-{
- return m_xDlg->GetDistributeVer();
-}
-
void AbstractHangulHanjaConversionDialog_Impl::EndDialog(sal_Int32 nResult)
{
m_xDlg->response(nResult);
@@ -456,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);
}
@@ -651,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 );
}
@@ -661,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 );
}
@@ -683,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);
}
@@ -693,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 );
}
@@ -718,12 +533,12 @@ TransliterationFlags AbstractSvxJSearchOptionsDialog_Impl::GetTransliterationFla
return m_xDlg->GetTransliterationFlags();
}
-void AbstractFmInputRecordNoDialog_Impl::SetValue(long nNew)
+void AbstractFmInputRecordNoDialog_Impl::SetValue(tools::Long nNew)
{
m_xDlg->SetValue(nNew);
}
-long AbstractFmInputRecordNoDialog_Impl::GetValue() const
+tools::Long AbstractFmInputRecordNoDialog_Impl::GetValue() const
{
return m_xDlg->GetValue();
}
@@ -733,18 +548,18 @@ 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)
@@ -756,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);
}
@@ -781,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)
@@ -805,14 +620,19 @@ IMPL_LINK_NOARG(AbstractSvxObjectNameDialog_Impl, CheckNameHdl, SvxObjectNameDia
return aCheckNameHdl.Call(*this);
}
-void AbstractSvxObjectTitleDescDialog_Impl::GetTitle(OUString& rTitle)
+OUString AbstractSvxObjectTitleDescDialog_Impl::GetTitle()
+{
+ return m_xDlg->GetTitle();
+}
+
+OUString AbstractSvxObjectTitleDescDialog_Impl::GetDescription()
{
- rTitle = m_xDlg->GetTitle();
+ return m_xDlg->GetDescription();
}
-void AbstractSvxObjectTitleDescDialog_Impl::GetDescription(OUString& rDescription)
+bool AbstractSvxObjectTitleDescDialog_Impl::IsDecorative()
{
- rDescription = m_xDlg->GetDescription();
+ return m_xDlg->IsDecorative();
}
OUString AbstractSvxMultiPathDialog_Impl::GetPath() const
@@ -876,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 );
}
@@ -886,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 );
}
@@ -989,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 );
}
@@ -1044,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)
{
@@ -1075,30 +917,33 @@ VclPtr<AbstractSvxCaptionDialog> AbstractDialogFactory_Impl::CreateCaptionDialog
return VclPtr<AbstractSvxCaptionDialog_Impl>::Create(std::make_shared<SvxCaptionTabDialog>(pParent, pView, nAnchorTypes));
}
-VclPtr<AbstractSvxDistributeDialog> AbstractDialogFactory_Impl::CreateSvxDistributeDialog(weld::Window* pParent,
- const SfxItemSet& rAttr)
-{
- return VclPtr<AbstractSvxDistributeDialog_Impl>::Create(std::make_unique<SvxDistributeDialog>(pParent, rAttr, SvxDistributeHorizontal::NONE, SvxDistributeVertical::NONE));
-}
-
-VclPtr<AbstractHangulHanjaConversionDialog> AbstractDialogFactory_Impl::CreateHangulHanjaConversionDialog(weld::Window* pParent)
+VclPtr<AbstractHangulHanjaConversionDialog> AbstractDialogFactory_Impl::CreateHangulHanjaConversionDialog(weld::Widget* pParent)
{
return VclPtr<AbstractHangulHanjaConversionDialog_Impl>::Create(std::make_unique<HangulHanjaConversionDialog>(pParent));
}
-VclPtr<AbstractThesaurusDialog> AbstractDialogFactory_Impl::CreateThesaurusDialog(weld::Window* pParent,
+VclPtr<AbstractThesaurusDialog> AbstractDialogFactory_Impl::CreateThesaurusDialog(weld::Widget* pParent,
css::uno::Reference<css::linguistic2::XThesaurus> xThesaurus,
const OUString &rWord, LanguageType nLanguage)
{
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)
@@ -1133,7 +978,7 @@ void AbstractDialogFactory_Impl::ShowAsyncScriptErrorDialog(weld::Window* pParen
VclPtr<AbstractScriptSelectorDialog> AbstractDialogFactory_Impl::CreateScriptSelectorDialog(weld::Window* pParent,
const Reference<frame::XFrame>& rxFrame)
{
- return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_unique<SvxScriptSelectorDialog>(pParent, rxFrame));
+ return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_shared<SvxScriptSelectorDialog>(pParent, rxFrame));
}
OUString AbstractScriptSelectorDialog_Impl::GetScriptURL() const
@@ -1191,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));
}
@@ -1260,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)
@@ -1270,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)
@@ -1340,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
@@ -1393,56 +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 AbstractAboutDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractAdditionsDialog_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
-short AbstractTipOfTheDayDialog_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
@@ -1513,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;
}
@@ -1576,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;
}
@@ -1594,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;
@@ -1606,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;
@@ -1625,14 +1454,14 @@ 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, long nMaxVertical)
+VclPtr<SvxAbstractSplitTableDialog> AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical)
{
- return VclPtr<SvxSplitTableDlg>::Create( pParent, bIsTableVertical, nMaxVertical, 99 );
+ return VclPtr<SvxAbstractSplitTableDialog_Impl>::Create( std::make_shared<SvxSplitTableDlg>(pParent, bIsTableVertical, nMaxVertical, 99 ));
}
std::shared_ptr<SvxAbstractNewTableDialog> AbstractDialogFactory_Impl::CreateSvxNewTableDialog(weld::Window* pParent)
@@ -1645,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(
@@ -1680,39 +1509,85 @@ 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(
- weld::Window* pParent)
+ weld::Window* pParent, const OUString& sAdditionsTag)
{
#if HAVE_FEATURE_EXTENSIONS
return VclPtr<AbstractAdditionsDialog_Impl>::Create(
- std::make_unique<AdditionsDialog>(pParent));
+ std::make_unique<AdditionsDialog>(pParent, sAdditionsTag));
#else
(void) pParent;
- return VclPtr<AbstractAdditionsDialog>(nullptr);
+ (void) sAdditionsTag;
+ return nullptr;
#endif
}
-VclPtr<AbstractAboutDialog>
+VclPtr<VclAbstractDialog>
AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent)
{
- return VclPtr<AbstractAboutDialog_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<AbstractTipOfTheDayDialog>
+VclPtr<VclAbstractDialog>
AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent)
{
- return VclPtr<AbstractTipOfTheDayDialog_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>
+AbstractDialogFactory_Impl::CreateToolbarmodeDialog(weld::Window* pParent)
+{
+ return VclPtr<CuiAbstractController_Impl>::Create(
+ std::make_unique<ToolbarmodeDialog>(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 3c0655f30c08..6b4a548fe3fc 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_FACTORY_DLGFACT_HXX
-#define INCLUDED_CUI_SOURCE_FACTORY_DLGFACT_HXX
+#pragma once
#include <svx/svxdlg.hxx>
#include <svx/zoom_def.hxx>
@@ -26,9 +25,9 @@
#include <tools/link.hxx>
#include <com/sun/star/frame/XFrame.hpp>
-#include <about.hxx>
#include <cfgutil.hxx>
-#include <cui/cuicharmap.hxx>
+#include <svx/cuicharmap.hxx>
+#include <dlgname.hxx>
#include <cuifmsearch.hxx>
#include <cuigaldlg.hxx>
#include <cuigrfflt.hxx>
@@ -37,9 +36,7 @@
#include <cuisrchdlg.hxx>
#include <cuitabarea.hxx>
#include <cuitbxform.hxx>
-#include <dlgname.hxx>
#include <DiagramDialog.hxx>
-#include <dstribut.hxx>
#include <hangulhanjadlg.hxx>
#include <hyphen.hxx>
#include <insdlg.hxx>
@@ -52,142 +49,95 @@
#include <postdlg.hxx>
#include <QrCodeGenDialog.hxx>
#include <screenshotannotationdlg.hxx>
+#include <securityoptions.hxx>
#include <showcols.hxx>
#include <SignatureLineDialog.hxx>
#include <SignSignatureLineDialog.hxx>
#include <SpellDialog.hxx>
#include <srchxtra.hxx>
#include <thesdlg.hxx>
-#include <tipofthedaydlg.hxx>
#include <transfrm.hxx>
#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;
+
+#define DECL_ABSTDLG_CLASS_UNIQUE(Class,Base,Dialog) \
+DECL_ABSTDLG_CLASS_(Class,Base,Dialog,std::unique_ptr)
-// #i68101#
-class SvxObjectNameDialog;
-class SvxObjectTitleDescDialog;
+#define DECL_ABSTDLG_CLASS_SHARED(Class,Base,Dialog) \
+DECL_ABSTDLG_CLASS_(Class,Base,Dialog,std::shared_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 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 SvxDistributeDialog;
-class AbstractSvxDistributeDialog_Impl: public AbstractSvxDistributeDialog
-{
- std::unique_ptr<SvxDistributeDialog> m_xDlg;
-public:
- explicit AbstractSvxDistributeDialog_Impl(std::unique_ptr<SvxDistributeDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
-public:
- virtual SvxDistributeHorizontal GetDistributeHor() const override;
- virtual SvxDistributeVertical GetDistributeVer() 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 ;
@@ -198,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
@@ -216,128 +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::unique_ptr<SvxScriptSelectorDialog> m_xDlg;
-public:
- explicit AbstractScriptSelectorDialog_Impl(std::unique_ptr<SvxScriptSelectorDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() 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;
@@ -345,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;
- virtual void SetValue(long nNew) override ;
- virtual long GetValue() const 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);
@@ -464,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;
@@ -618,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;
@@ -651,150 +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 AboutDialog;
-class AbstractAboutDialog_Impl : public AbstractAboutDialog
-{
-protected:
- std::unique_ptr<AboutDialog> m_xDlg;
-
-public:
- explicit AbstractAboutDialog_Impl(std::unique_ptr<AboutDialog> 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 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;
+// AbstractAdditionsDialog_Impl
+DECL_ABSTDLG_CLASS_ASYNC(AbstractAdditionsDialog,weld::GenericDialogController)
};
-class TipOfTheDayDialog;
-class AbstractTipOfTheDayDialog_Impl : public AbstractTipOfTheDayDialog
-{
-protected:
- std::unique_ptr<TipOfTheDayDialog> m_xDlg;
-
-public:
- explicit AbstractTipOfTheDayDialog_Impl(std::unique_ptr<TipOfTheDayDialog> p)
- : m_xDlg(std::move(p))
- {
- }
- virtual short Execute() override;
-};
-
-class DiagramDialog;
-
-/** Edit Diagram dialog */
-class AbstractDiagramDialog_Impl : public AbstractDiagramDialog
-{
-protected:
- std::unique_ptr<DiagramDialog> m_xDlg;
-
-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
@@ -814,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,
@@ -828,23 +460,21 @@ public:
CreateCaptionDialog(weld::Window* pParent,
const SdrView* pView,
SvxAnchorIds nAnchorTypes = SvxAnchorIds::NONE) override;
- virtual VclPtr<AbstractSvxDistributeDialog>
- CreateSvxDistributeDialog(weld::Window* pParent, const SfxItemSet& rAttr) override;
virtual VclPtr<SfxAbstractInsertObjectDialog>
- CreateInsertObjectDialog(weld::Window* pParent, const OUString& rCommmand,
+ CreateInsertObjectDialog(weld::Window* pParent, const OUString& rCommand,
const css::uno::Reference < css::embed::XStorage >& xStor,
const SvObjectServerList* pList ) override;
- virtual VclPtr<VclAbstractDialog> CreateEditObjectDialog(weld::Window* pParent, const OUString& rCommmand,
+ virtual VclPtr<VclAbstractDialog> CreateEditObjectDialog(weld::Window* pParent, const OUString& rCommand,
const css::uno::Reference < css::embed::XEmbeddedObject >& xObj ) override;
virtual VclPtr<SfxAbstractPasteDialog> CreatePasteDialog(weld::Window* pParent) override;
virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML = false, sfx2::SvBaseLink* p=nullptr) override;
- virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog(weld::Window* pParent) override;
- virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog(weld::Window*,
+ virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog(weld::Widget* pParent) override;
+ virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog(weld::Widget*,
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;
@@ -885,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,
@@ -898,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;
@@ -925,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,
@@ -954,21 +585,23 @@ 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, long nMaxVertical) override;
+ virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) override;
virtual std::shared_ptr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) override ;
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;
@@ -982,17 +615,27 @@ public:
const css::uno::Reference<css::frame::XModel> xModel, bool bEditExisting) override;
virtual VclPtr<AbstractAdditionsDialog>
- CreateAdditionsDialog(weld::Window* pParent) override;
+ CreateAdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag) override;
- virtual VclPtr<AbstractAboutDialog> CreateAboutDialog(weld::Window* pParent) override;
+ virtual VclPtr<VclAbstractDialog> CreateAboutDialog(weld::Window* pParent) override;
- virtual VclPtr<AbstractTipOfTheDayDialog> CreateTipOfTheDayDialog(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 8b3211bb3d1a..559a4ca911ff 100644
--- a/cui/source/inc/AdditionsDialog.hxx
+++ b/cui/source/inc/AdditionsDialog.hxx
@@ -10,88 +10,170 @@
#pragma once
-#include <vcl/svapp.hxx>
#include <salhelper/thread.hxx>
#include <rtl/ref.hxx>
#include <vcl/weld.hxx>
-struct AdditionsItem
-{
- AdditionsItem(weld::Widget* pParent)
- : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/additionsfragment.ui"))
- , m_xContainer(m_xBuilder->weld_widget("additionsEntry"))
- , m_xImageScreenshot(m_xBuilder->weld_image("imageScreenshot"))
- , m_xButtonInstall(m_xBuilder->weld_button("buttonInstall"))
- , m_xLinkButtonName(m_xBuilder->weld_link_button("linkButtonName"))
- , 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("labelLicense"))
- , m_xLabelVersion(m_xBuilder->weld_label("labelVersion"))
- , m_xLabelComments(m_xBuilder->weld_label("labelComments")) // no change
- , m_xLinkButtonComments(m_xBuilder->weld_link_button("linkButtonComments"))
- , m_xImageVoting(m_xBuilder->weld_image("imageVoting"))
- , m_xImageDownloadNumber(m_xBuilder->weld_image("imageDownloadNumber"))
- , m_xLabelDownloadNumber(m_xBuilder->weld_label("labelDownloadNumber"))
- {
- }
+// Detect changes on the UI
+#include <vcl/timer.hxx>
- std::unique_ptr<weld::Builder> m_xBuilder;
- std::unique_ptr<weld::Widget> m_xContainer;
- std::unique_ptr<weld::Image> m_xImageScreenshot;
- std::unique_ptr<weld::Button> m_xButtonInstall;
- std::unique_ptr<weld::LinkButton> m_xLinkButtonName;
- 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_xImageVoting;
- std::unique_ptr<weld::Image> m_xImageDownloadNumber;
- std::unique_ptr<weld::Label> m_xLabelDownloadNumber;
-};
+// Search and filter
+#include <i18nutil/searchopt.hxx>
+
+// Extension Manager Connection
+#include <com/sun/star/deployment/XExtensionManager.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XProgressHandler.hpp>
+#include <cppuhelper/implbase.hxx>
+
+#include <atomic>
+
+class AdditionsDialog;
class SearchAndParseThread;
+class AdditionsItem;
+
+struct AdditionInfo
+{
+ OUString sExtensionID;
+ OUString sName;
+ OUString sAuthorName;
+ OUString sExtensionURL;
+ OUString sScreenshotURL;
+ OUString sIntroduction;
+ OUString sDescription;
+ OUString sCompatibleVersion;
+ OUString sReleaseVersion;
+ OUString sLicense;
+ OUString sCommentNumber;
+ OUString sCommentURL;
+ OUString sRating;
+ OUString sDownloadNumber;
+ OUString sDownloadURL;
+};
class AdditionsDialog : public weld::GenericDialogController
{
private:
- // void fillGrid();
+ Timer m_aSearchDataTimer;
+
+ DECL_LINK(GearHdl, const OUString&, void);
+ DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
+ DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(FocusOut_Impl, weld::Widget&, void);
+ DECL_LINK(CloseButtonHdl, weld::Button&, void);
public:
+ css::uno::Reference<css::deployment::XExtensionManager> m_xExtensionManager;
std::unique_ptr<weld::Entry> m_xEntrySearch;
- std::unique_ptr<weld::MenuButton> m_xMenuButtonSettings;
- std::vector<AdditionsItem> m_aAdditionsItems;
+ std::unique_ptr<weld::Button> m_xButtonClose;
+ std::vector<std::shared_ptr<AdditionsItem>> m_aAdditionsItems; // UI components
+ std::vector<AdditionInfo> m_aAllExtensionsVector; // Stores the all extensions' info
std::unique_ptr<weld::ScrolledWindow> m_xContentWindow;
std::unique_ptr<weld::Container> m_xContentGrid;
std::unique_ptr<weld::Label> m_xLabelProgress;
+ std::unique_ptr<weld::MenuButton> m_xGearBtn;
+
::rtl::Reference<SearchAndParseThread> m_pSearchThread;
- AdditionsDialog(weld::Window* pParent);
- ~AdditionsDialog() override;
+ OUString m_sURL;
+ OUString m_sTag;
+ size_t
+ m_nMaxItemCount; // Max number of item which will appear on the list before the press to the show more button.
+ size_t m_nCurrentListItemCount; // Current number of item on the list
+ i18nutil::SearchOptions2 m_searchOptions;
+ AdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag);
+ ~AdditionsDialog() override;
+ css::uno::Sequence<css::uno::Sequence<css::uno::Reference<css::deployment::XPackage>>>
+ getInstalledExtensions();
void SetProgress(const OUString& rProgress);
+ void ClearList();
+ void RefreshUI();
+
+ static bool sortByComment(const AdditionInfo& a, const AdditionInfo& b);
+ static bool sortByRating(const AdditionInfo& a, const AdditionInfo& b);
+ static bool sortByDownload(const AdditionInfo& a, const AdditionInfo& b);
+};
+
+class AdditionsItem
+{
+public:
+ AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDialog,
+ const AdditionInfo& additionInfo);
+ bool getExtensionFile(OUString& sExtensionFile);
+
+ DECL_LINK(ShowMoreHdl, weld::Button&, void);
+ DECL_LINK(InstallHdl, weld::Button&, void);
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Widget> m_xContainer;
+ std::unique_ptr<weld::Image> m_xImageScreenshot;
+ std::unique_ptr<weld::Button> m_xButtonInstall;
+ 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_xLabelDescription;
+ std::unique_ptr<weld::Label> m_xLabelLicense;
+ std::unique_ptr<weld::Label> m_xLabelVersion;
+ 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_xLabelDownloadNumber;
+ std::unique_ptr<weld::Button> m_xButtonShowMore;
+ AdditionsDialog* m_pParentDialog;
+ OUString m_sDownloadURL;
+ OUString m_sExtensionID;
};
class SearchAndParseThread : public salhelper::Thread
{
private:
AdditionsDialog* m_pAdditionsDialog;
- OUString m_aURL;
std::atomic<bool> m_bExecute;
bool m_bIsFirstLoading;
+ bool m_bUITest;
+
+ void Search();
+ void Append(AdditionInfo& additionInfo);
+ void CheckInstalledExtensions();
virtual ~SearchAndParseThread() override;
virtual void execute() override;
public:
- SearchAndParseThread(AdditionsDialog* pDialog, const OUString& rURL,
- const bool& bIsFirstLoading);
+ SearchAndParseThread(AdditionsDialog* pDialog, bool bIsFirstLoading);
void StopExecution() { m_bExecute = false; }
};
+class TmpRepositoryCommandEnv
+ : public ::cppu::WeakImplHelper<css::ucb::XCommandEnvironment, css::task::XInteractionHandler,
+ css::ucb::XProgressHandler>
+{
+public:
+ virtual ~TmpRepositoryCommandEnv() override;
+ TmpRepositoryCommandEnv();
+
+ // XCommandEnvironment
+ virtual css::uno::Reference<css::task::XInteractionHandler>
+ SAL_CALL getInteractionHandler() override;
+ virtual css::uno::Reference<css::ucb::XProgressHandler> SAL_CALL getProgressHandler() override;
+
+ // XInteractionHandler
+ virtual void SAL_CALL
+ handle(css::uno::Reference<css::task::XInteractionRequest> const& xRequest) override;
+
+ // XProgressHandler
+ virtual void SAL_CALL push(css::uno::Any const& Status) override;
+ virtual void SAL_CALL update(css::uno::Any const& Status) override;
+ virtual void SAL_CALL pop() override;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/CommandCategoryListBox.hxx b/cui/source/inc/CommandCategoryListBox.hxx
index 059c1474f1cd..c4882ae1745d 100644
--- a/cui/source/inc/CommandCategoryListBox.hxx
+++ b/cui/source/inc/CommandCategoryListBox.hxx
@@ -26,11 +26,11 @@ class CommandCategoryListBox
{
SfxGroupInfoArr_Impl m_aGroupInfo;
OUString m_sModuleLongName;
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::frame::XFrame > m_xFrame;
- css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo;
- css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo;
- css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription;
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
+ css::uno::Reference<css::container::XNameAccess> m_xGlobalCategoryInfo;
+ css::uno::Reference<css::container::XNameAccess> m_xModuleCategoryInfo;
+ css::uno::Reference<css::container::XNameAccess> m_xUICmdDescription;
// For search
i18nutil::SearchOptions2 m_searchOptions;
@@ -45,36 +45,38 @@ public:
~CommandCategoryListBox();
void ClearAll();
- void Init(
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::frame::XFrame >& xFrame,
- const OUString& sModuleLongName);
- void FillFunctionsList(
- const css::uno::Sequence< css::frame::DispatchInformation >& xCommands,
- CuiConfigFunctionListBox* pFunctionListBox,
- const OUString& filterTerm,
- SaveInData *pCurrentSaveInData );
- OUString getCommandName(const OUString& sCommand);
+ void Init(const css::uno::Reference<css::uno::XComponentContext>& xContext,
+ const css::uno::Reference<css::frame::XFrame>& xFrame,
+ const OUString& sModuleLongName);
+ void FillFunctionsList(const css::uno::Sequence<css::frame::DispatchInformation>& xCommands,
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
+ SaveInData* pCurrentSaveInData);
+ OUString getCommandName(const OUString& sCommand);
- void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ void connect_changed(const Link<weld::ComboBox&, void>& rLink)
+ {
+ m_xControl->connect_changed(rLink);
+ }
/**
Signals that a command category has been selected.
And updates the functions list box to include
the commands in the selected category.
*/
- void categorySelected(CuiConfigFunctionListBox* pFunctionListBox,
- const OUString& filterTerm, SaveInData* pCurrentSaveInData = nullptr);
+ void categorySelected(CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
+ SaveInData* pCurrentSaveInData = nullptr);
- void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
+ void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
// Adds children of the given macro group to the functions list
- void addChildren(
- const weld::TreeIter* parentEntry, const css::uno::Reference<com::sun::star::script::browse::XBrowseNode> &parentNode,
- CuiConfigFunctionListBox* pFunctionListBox, const OUString &filterTerm , SaveInData *pCurrentSaveInData,
- std::vector<std::unique_ptr<weld::TreeIter>> &rNodesToExpand);
+ void
+ addChildren(const weld::TreeIter* parentEntry,
+ const css::uno::Reference<com::sun::star::script::browse::XBrowseNode>& parentNode,
+ CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
+ SaveInData* pCurrentSaveInData,
+ std::vector<std::unique_ptr<weld::TreeIter>>& rNodesToExpand);
- void set_visible(bool bVisible) {m_xControl->set_visible(bVisible);}
+ void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
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 e97144050a0e..a612e092a8e7 100644
--- a/cui/source/inc/DiagramDialog.hxx
+++ b/cui/source/inc/DiagramDialog.hxx
@@ -7,36 +7,35 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_DIAGRAMDIALOG_HXX
-#define INCLUDED_CUI_SOURCE_INC_DIAGRAMDIALOG_HXX
+#pragma once
#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);
void populateTree(const weld::TreeIter* pParent, const OUString& rParentId);
};
-#endif // INCLUDED_CUI_SOURCE_INC_DIAGRAMDIALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 93e5f7c4a76e..93ba0cb9f80d 100644
--- a/cui/source/inc/FontFeaturesDialog.hxx
+++ b/cui/source/inc/FontFeaturesDialog.hxx
@@ -8,8 +8,7 @@
*
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_FONTFEATURESDIALOG_HXX
-#define INCLUDED_CUI_SOURCE_INC_FONTFEATURESDIALOG_HXX
+#pragma once
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -23,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;
@@ -73,6 +84,4 @@ public:
} // end svx namespaces
-#endif // INCLUDED_CUI_SOURCE_INC_FONTFEATURESDIALOG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 563182d7a043..02037ad4cdf6 100644
--- a/cui/source/inc/QrCodeGenDialog.hxx
+++ b/cui/source/inc/QrCodeGenDialog.hxx
@@ -6,8 +6,9 @@
* 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/.
*/
-#ifndef INCLUDED_CUI_INC_QRCODEGENDIALOG_HXX
-#define INCLUDED_CUI_INC_QRCODEGENDIALOG_HXX
+#pragma once
+
+#include <config_zxing.h>
#include <vcl/weld.hxx>
@@ -23,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;
+ std::unique_ptr<weld::ComboBox> m_xComboType;
+
+#if ENABLE_ZXING
weld::Widget* mpParent;
+#endif
css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;
- void GetErrorCorrection(long);
- //Function contains QR Code Generating Library Calls
- static OUString GenerateQRCode(OUString aQrText, long aQrECC, int aQrBorder);
+ void GetErrorCorrection(tools::Long);
};
-#endif
-
/* 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 6bd08ff4baef..7c894a16a0b3 100644
--- a/cui/source/inc/SignSignatureLineDialog.hxx
+++ b/cui/source/inc/SignSignatureLineDialog.hxx
@@ -6,8 +6,7 @@
* 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/.
*/
-#ifndef INCLUDED_CUI_INC_SIGNSIGNATURELINEDIALOG_HXX
-#define INCLUDED_CUI_INC_SIGNSIGNATURELINEDIALOG_HXX
+#pragma once
#include "SignatureLineDialogBase.hxx"
@@ -21,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;
@@ -43,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);
@@ -51,6 +51,4 @@ private:
DECL_LINK(entryChanged, weld::Entry&, void);
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/SignatureLineDialog.hxx b/cui/source/inc/SignatureLineDialog.hxx
index fd671acd51fd..e686cb4a4123 100644
--- a/cui/source/inc/SignatureLineDialog.hxx
+++ b/cui/source/inc/SignatureLineDialog.hxx
@@ -6,8 +6,7 @@
* 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/.
*/
-#ifndef INCLUDED_CUI_INC_SIGNATURELINEDIALOG_HXX
-#define INCLUDED_CUI_INC_SIGNATURELINEDIALOG_HXX
+#pragma once
#include "SignatureLineDialogBase.hxx"
@@ -20,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;
@@ -30,10 +31,6 @@ private:
css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;
OUString m_aSignatureLineId;
-
- virtual void Apply() override;
};
-#endif
-
/* 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 3b065fe87838..4e0a3f298e5b 100644
--- a/cui/source/inc/SignatureLineDialogBase.hxx
+++ b/cui/source/inc/SignatureLineDialogBase.hxx
@@ -6,8 +6,11 @@
* 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/.
*/
-#ifndef INCLUDED_CUI_INC_SIGNATURELINEDIALOGBASE_HXX
-#define INCLUDED_CUI_INC_SIGNATURELINEDIALOGBASE_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
#include <vcl/weld.hxx>
@@ -18,16 +21,13 @@ 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(const OUString& rString);
+ static OUString getCDataString(std::u16string_view rString);
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index cb23f1004400..81d68e214314 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SPELLDIALOG_HXX
-#define INCLUDED_CUI_SOURCE_INC_SPELLDIALOG_HXX
+#pragma once
#include <sfx2/basedlgs.hxx>
#include <com/sun/star/uno/Reference.hxx>
@@ -47,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;
@@ -62,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;
@@ -111,9 +118,11 @@ public:
void UndoActionStart( sal_uInt16 nId );
void UndoActionEnd();
- void MoveErrorEnd(long nOffset);
+ void MoveErrorEnd(tools::Long nOffset);
void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); }
+
+ void SetDocumentColor(weld::DrawingArea* pDrawingArea);
};
// class SvxSpellDialog ---------------------------------------------
@@ -131,7 +140,7 @@ private:
OUString m_sTitleSpellingGrammar;
Link<SpellUndoAction_Impl&,void> aDialogUndoLink;
-
+ ImplSVEvent * m_pInitHdlEvent;
bool bFocusLocked;
svx::SpellDialogChildWindow& rParent;
@@ -144,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;
@@ -167,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);
@@ -226,6 +235,4 @@ public:
} //namespace svx
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/SvxConfigPageHelper.hxx b/cui/source/inc/SvxConfigPageHelper.hxx
index 8beed6069be3..025c4aad18c0 100644
--- a/cui/source/inc/SvxConfigPageHelper.hxx
+++ b/cui/source/inc/SvxConfigPageHelper.hxx
@@ -26,64 +26,51 @@
class SvxConfigPageHelper
{
public:
- static void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry const * pChildEntry );
+ static void RemoveEntry(SvxEntries* pEntries, SvxConfigEntry const* pChildEntry);
- static OUString replaceSaveInName( const OUString& rMessage, const OUString& rSaveInName );
- static OUString stripHotKey( const OUString& str );
- static OUString replaceSixteen( const OUString& str, sal_Int32 nReplacement );
+ static OUString replaceSaveInName(const OUString& rMessage, std::u16string_view rSaveInName);
+ static OUString stripHotKey(const OUString& str);
+ static OUString replaceSixteen(const OUString& str, sal_Int32 nReplacement);
- static sal_Int16 GetImageType();
- static void InitImageType();
- static css::uno::Reference< css::graphic::XGraphic > GetGraphic(
- const css::uno::Reference< css::ui::XImageManager >& xImageManager,
- const OUString& rCommandURL );
+ static sal_Int16 GetImageType();
+ static void InitImageType();
+ static css::uno::Reference<css::graphic::XGraphic>
+ GetGraphic(const css::uno::Reference<css::ui::XImageManager>& xImageManager,
+ const OUString& rCommandURL);
- static OUString generateCustomName(
- const OUString& prefix,
- SvxEntries* entries,
- sal_Int32 suffix = 1 );
- static OUString generateCustomMenuURL(
- SvxEntries* entries,
- sal_Int32 suffix = 1 );
- static sal_uInt32 generateRandomValue();
+ static OUString generateCustomName(const OUString& prefix, SvxEntries* entries,
+ sal_Int32 suffix = 1);
+ static OUString generateCustomMenuURL(SvxEntries* entries, sal_Int32 suffix = 1);
+ static sal_uInt32 generateRandomValue();
/**
Generates a custom resource URL for a new toolbar.
Typically something like: private:resource/toolbar/custom_toolbar_########
The last 8 letters are randomly generated alphanumeric characters.
*/
- static OUString generateCustomURL( SvxEntries* entries );
+ static OUString generateCustomURL(SvxEntries* entries);
- static OUString GetModuleName( const OUString& aModuleId );
- static OUString GetUIModuleName(
- const OUString& aModuleId,
- const css::uno::Reference< css::frame::XModuleManager2 >& rModuleManager );
+ static OUString GetModuleName(std::u16string_view aModuleId);
+ static OUString
+ GetUIModuleName(const OUString& aModuleId,
+ const css::uno::Reference<css::frame::XModuleManager2>& rModuleManager);
- static bool GetMenuItemData(
- const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
- sal_Int32 nIndex,
- OUString& rCommandURL,
- OUString& rLabel,
- sal_uInt16& rType,
- sal_Int32& rStyle,
- css::uno::Reference< css::container::XIndexAccess >& rSubMenu );
- static bool GetToolbarItemData(
- const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
- sal_Int32 nIndex,
- OUString& rCommandURL,
- OUString& rLabel,
- sal_uInt16& rType,
- bool& rIsVisible,
- sal_Int32& rStyle );
+ static bool
+ GetMenuItemData(const css::uno::Reference<css::container::XIndexAccess>& rItemContainer,
+ sal_Int32 nIndex, OUString& rCommandURL, OUString& rLabel, sal_uInt16& rType,
+ sal_Int32& rStyle, css::uno::Reference<css::container::XIndexAccess>& rSubMenu);
+ static bool
+ GetToolbarItemData(const css::uno::Reference<css::container::XIndexAccess>& rItemContainer,
+ sal_Int32 nIndex, OUString& rCommandURL, OUString& rLabel, sal_uInt16& rType,
+ bool& rIsVisible, sal_Int32& rStyle);
- static css::uno::Sequence< css::beans::PropertyValue > ConvertSvxConfigEntry(
- const SvxConfigEntry* pEntry );
- static css::uno::Sequence< css::beans::PropertyValue > ConvertToolbarEntry(
- const SvxConfigEntry* pEntry );
+ static css::uno::Sequence<css::beans::PropertyValue>
+ ConvertSvxConfigEntry(const SvxConfigEntry* pEntry);
+ static css::uno::Sequence<css::beans::PropertyValue>
+ ConvertToolbarEntry(const SvxConfigEntry* pEntry);
- static bool EntrySort( SvxConfigEntry const * a, SvxConfigEntry const * b );
-
- static bool SvxConfigEntryModified( SvxConfigEntry const * pEntry );
+ static bool EntrySort(SvxConfigEntry const* a, SvxConfigEntry const* b);
+ static bool SvxConfigEntryModified(SvxConfigEntry const* pEntry);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/SvxMenuConfigPage.hxx b/cui/source/inc/SvxMenuConfigPage.hxx
index 50124e46ab10..36fee041de76 100644
--- a/cui/source/inc/SvxMenuConfigPage.hxx
+++ b/cui/source/inc/SvxMenuConfigPage.hxx
@@ -29,44 +29,41 @@ class SvxMenuConfigPage : public SvxConfigPage
private:
bool m_bIsMenuBar;
- DECL_LINK( SelectMenuEntry, weld::TreeView&, void );
- DECL_LINK( ContentContextMenuHdl, const CommandEvent&, bool );
- DECL_LINK( FunctionContextMenuHdl, const CommandEvent&, bool );
+ DECL_LINK(SelectMenuEntry, weld::TreeView&, void);
+ 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(SelectCategory, weld::ComboBox&, void);
- DECL_LINK( AddCommandHdl, weld::Button&, void );
- DECL_LINK( RemoveCommandHdl, weld::Button&, 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( ResetMenuHdl, weld::Button&, 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 );
+ DECL_LINK(MenuEntriesSizeAllocHdl, const Size&, void);
virtual void ListModified() override;
- void Init() override;
- void UpdateButtonStates() override;
- short QueryReset() override;
- void DeleteSelectedContent() override;
- void DeleteSelectedTopLevel() override;
+ void Init() override;
+ void UpdateButtonStates() override;
+ short QueryReset() override;
+ void DeleteSelectedContent() override;
+ void DeleteSelectedTopLevel() override;
- virtual void SelectElement() override;
+ virtual void SelectElement() override;
public:
- SvxMenuConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rItemSet, bool bIsMenuBar = true);
+ SvxMenuConfigPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rItemSet, bool bIsMenuBar = true);
virtual ~SvxMenuConfigPage() override;
- SaveInData* CreateSaveInData(
- const css::uno::Reference <
- css::ui::XUIConfigurationManager >&,
- const css::uno::Reference <
- css::ui::XUIConfigurationManager >&,
- const OUString& aModuleId,
- bool docConfig ) override;
+ SaveInData* CreateSaveInData(const css::uno::Reference<css::ui::XUIConfigurationManager>&,
+ const css::uno::Reference<css::ui::XUIConfigurationManager>&,
+ const OUString& aModuleId, bool docConfig) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 00672453df1b..28fe658f2cca 100644
--- a/cui/source/inc/SvxToolbarConfigPage.hxx
+++ b/cui/source/inc/SvxToolbarConfigPage.hxx
@@ -29,48 +29,44 @@
class SvxToolbarConfigPage : public SvxConfigPage
{
private:
+ DECL_LINK(SelectToolbarEntry, weld::TreeView&, void);
+ DECL_LINK(MoveHdl, weld::Button&, void);
- DECL_LINK( SelectToolbarEntry, weld::TreeView&, void );
- DECL_LINK( MoveHdl, weld::Button&, void );
+ DECL_LINK(GearHdl, const OUString&, void);
- DECL_LINK( GearHdl, const OString&, void );
+ DECL_LINK(SelectCategory, weld::ComboBox&, void);
- DECL_LINK( SelectCategory, weld::ComboBox&, void );
+ DECL_LINK(ContentContextMenuHdl, const CommandEvent&, bool);
+ DECL_LINK(FunctionContextMenuHdl, const CommandEvent&, bool);
- DECL_LINK( ContentContextMenuHdl, const CommandEvent&, bool );
- DECL_LINK( FunctionContextMenuHdl, const CommandEvent&, bool );
+ DECL_LINK(AddCommandHdl, weld::Button&, void);
+ DECL_LINK(RemoveCommandHdl, weld::Button&, 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( ResetToolbarHdl, weld::Button&, void );
+ DECL_LINK(InsertHdl, const OUString&, void);
+ DECL_LINK(ModifyItemHdl, const OUString&, void);
+ DECL_LINK(ResetToolbarHdl, weld::Button&, void);
virtual void ListModified() override;
- void UpdateButtonStates() override;
- short QueryReset() override;
- void Init() override;
- void DeleteSelectedContent() override;
- void DeleteSelectedTopLevel() override;
- virtual void SelectElement() override;
+ void UpdateButtonStates() override;
+ short QueryReset() override;
+ void Init() override;
+ void DeleteSelectedContent() override;
+ void DeleteSelectedTopLevel() override;
+ virtual void SelectElement() override;
public:
- SvxToolbarConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rItemSet);
+ SvxToolbarConfigPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rItemSet);
virtual ~SvxToolbarConfigPage() override;
- void AddFunction(int nTarget = -1);
+ void AddFunction(int nTarget = -1);
- void MoveEntry( bool bMoveUp ) override;
+ void MoveEntry(bool bMoveUp) override;
- SaveInData* CreateSaveInData(
- const css::uno::Reference <
- css::ui::XUIConfigurationManager >&,
- const css::uno::Reference <
- css::ui::XUIConfigurationManager >&,
- const OUString& aModuleId,
- bool docConfig ) override;
+ SaveInData* CreateSaveInData(const css::uno::Reference<css::ui::XUIConfigurationManager>&,
+ const css::uno::Reference<css::ui::XUIConfigurationManager>&,
+ const OUString& aModuleId, bool docConfig) override;
};
class SvxToolbarEntriesListBox final : public SvxMenuEntriesListBox
@@ -81,7 +77,6 @@ class SvxToolbarEntriesListBox final : public SvxMenuEntriesListBox
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
public:
-
SvxToolbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxToolbarConfigPage* pPg);
virtual ~SvxToolbarEntriesListBox() 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 37d1710a7f93..42eae5467eab 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -16,10 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_ABOUT_HXX
-#define INCLUDED_CUI_SOURCE_INC_ABOUT_HXX
+#pragma once
-#include <vcl/bitmapex.hxx>
#include <vcl/weld.hxx>
class AboutDialog : public weld::GenericDialogController
@@ -40,16 +38,15 @@ private:
std::unique_ptr<weld::Label> m_pUILabel;
std::unique_ptr<weld::Label> m_pLocaleLabel;
std::unique_ptr<weld::Label> m_pMiscLabel;
- std::unique_ptr<weld::Label> m_pAboutLabel;
std::unique_ptr<weld::Label> m_pCopyrightLabel;
static OUString GetVersionString();
static OUString GetBuildString();
- static OUString GetLocaleString();
+ static OUString GetLocaleString(bool bLocalized = true);
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);
@@ -58,6 +55,4 @@ public:
virtual ~AboutDialog() override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_ABOUT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 43c2fe0ee9eb..caea33e42150 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_ALIGN_HXX
-#define INCLUDED_CUI_SOURCE_INC_ALIGN_HXX
+#pragma once
// list box indexes
#define ALIGNDLG_HORALIGN_STD 0
@@ -41,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;
@@ -63,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;
@@ -93,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;
@@ -117,6 +117,4 @@ private:
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index e0c780fe831e..2677b8535ebe 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -16,18 +16,17 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_AUTOCDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_AUTOCDLG_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/langbox.hxx>
-#include <vcl/metric.hxx>
+#include <unotools/collatorwrapper.hxx>
#include <map>
#include <set>
+#include <utility>
class CharClass;
-class CollatorWrapper;
class SmartTagMgr;
namespace editeng { class SortedAutoCompleteStrings; }
@@ -58,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;
@@ -93,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;
@@ -137,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;
@@ -161,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;
@@ -222,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;
@@ -241,7 +249,7 @@ private:
DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
DECL_LINK(SelectHdl, weld::TreeView&, void);
DECL_LINK(ModifyHdl, weld::Entry&, void);
- void NewDelHdl(const weld::Widget*);
+ bool NewDelHdl(const weld::Widget*);
/// Box filled with new language
void RefillReplaceBoxes(bool bFromReset,
LanguageType eOldLanguage,
@@ -336,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:
@@ -384,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
@@ -412,6 +420,4 @@ public:
virtual void ActivatePage( const SfxItemSet& ) override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index 14d30703e745..3d50d69e95f4 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_BACKGRND_HXX
-#define INCLUDED_CUI_SOURCE_INC_BACKGRND_HXX
+#pragma once
#include <memory>
@@ -38,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;
@@ -64,7 +68,5 @@ public:
virtual void Reset( const SfxItemSet * ) override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_BACKGRND_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/bbdlg.hxx b/cui/source/inc/bbdlg.hxx
index b25b7cc098da..c18b5b3da4e6 100644
--- a/cui/source/inc/bbdlg.hxx
+++ b/cui/source/inc/bbdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_BBDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_BBDLG_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -33,12 +32,10 @@ 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
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 7af464924259..accb555930dc 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_BORDER_HXX
-#define INCLUDED_CUI_SOURCE_INC_BORDER_HXX
+#pragma once
#include <editeng/shaditem.hxx>
#include <svtools/ctrlbox.hxx>
@@ -28,6 +27,7 @@
#include <svx/colorbox.hxx>
#include <svx/frmsel.hxx>
#include <svx/flagsdef.hxx>
+#include <unotools/resmgr.hxx>
#include <set>
@@ -76,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;
@@ -99,7 +99,7 @@ private:
std::vector<Image> m_aShadowImgVec;
std::vector<Image> m_aBorderImgVec;
- long nMinValue; ///< minimum distance
+ tools::Long nMinValue; ///< minimum distance
SwBorderModes nSWMode; ///< table, textframe, paragraph
sal_uInt16 mnBoxSlot;
sal_uInt16 mnShadowSlot;
@@ -128,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;
@@ -153,8 +154,8 @@ private:
std::unique_ptr<weld::CheckButton> m_xMergeWithNextCB;
// #i29550#
std::unique_ptr<weld::CheckButton> m_xMergeAdjacentBordersCB;
- std::unique_ptr<weld::CheckButton> m_xRemoveAdjcentCellBordersCB;
- std::unique_ptr<weld::Label> m_xRemoveAdjcentCellBordersFT;
+ std::unique_ptr<weld::CheckButton> m_xRemoveAdjacentCellBordersCB;
+ std::unique_ptr<weld::Label> m_xRemoveAdjacentCellBordersFT;
std::unique_ptr<ShadowControlsWrapper> m_xShadowControls;
std::unique_ptr<MarginControlsWrapper> m_xMarginControls;
@@ -165,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();
@@ -189,6 +192,4 @@ private:
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 699434ac04fa..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>
@@ -34,28 +34,30 @@
#include <sfx2/tabdlg.hxx>
#include <memory>
+#include <string_view>
#include <vector>
#include "cfgutil.hxx"
#include "CommandCategoryListBox.hxx"
-#define notebookbarTabScope "notebookbarTabScope"
+inline constexpr OUString notebookbarTabScope = u"notebookbarTabScope"_ustr;
-const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
-const char ITEM_DESCRIPTOR_CONTAINER[] = "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";
-const char ITEM_DESCRIPTOR_UINAME[] = "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;
-const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar";
-const char ITEM_TOOLBAR_URL[] = "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;
-const char CUSTOM_TOOLBAR_STR[] = "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;
@@ -67,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);
};
@@ -112,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 );
@@ -252,8 +256,8 @@ private:
public:
- SvxConfigEntry( const OUString& rDisplayName,
- const OUString& rCommandURL,
+ SvxConfigEntry( OUString aDisplayName,
+ OUString aCommandURL,
bool bPopup,
bool bParentData );
@@ -333,10 +337,6 @@ public:
void remove(int nPos) { m_xControl->remove(nPos); }
int n_children() const { return m_xControl->n_children(); }
void set_text(int row, const OUString& rText, int col) { m_xControl->set_text(row, rText, col); }
- OUString get_text(int row) { return m_xControl->get_text(row); }
- void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) { m_xControl->set_image(row, rImage, col); }
- void set_dropdown(int row, int col) { m_xControl->set_image(row, *m_xDropDown, col); }
- void set_id(int row, const OUString& rId) { m_xControl->set_id(row, rId); }
void clear() { m_xControl->clear(); } //need frees ?
void set_toggle(int row, TriState eState) { m_xControl->set_toggle(row, eState); }
void scroll_to_row(int pos) { m_xControl->scroll_to_row(pos); }
@@ -351,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:
@@ -413,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;
@@ -450,7 +451,7 @@ protected:
int AppendEntry(SvxConfigEntry* pNewEntryData,
int nTarget);
- void AddSubMenusToUI( const OUString& rBaseTitle,
+ void AddSubMenusToUI( std::u16string_view rBaseTitle,
SvxConfigEntry const * pParentData );
void InsertEntryIntoUI(SvxConfigEntry* pNewEntryData,
@@ -460,20 +461,25 @@ protected:
weld::TreeView& rTreeView, weld::TreeIter& rIter,
bool bMenu = false);
- void InsertEntryIntoNotebookbarTabUI(const OUString& sClassId, const OUString& sUIItemId,
+ void InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId, const OUString& sUIItemId,
const OUString& sUIItemCommand,
- weld::TreeView& rTreeView, weld::TreeIter& rIter);
+ weld::TreeView& rTreeView, const weld::TreeIter& rIter);
SvxEntries* FindParentForChild( SvxEntries* pParentEntries,
SvxConfigEntry* pChildData );
void ReloadTopLevelListBox( SvxConfigEntry const * pSelection = nullptr );
+ static bool IsCommandInMenuList(const SvxConfigEntry *pEntryData,
+ const SvxEntries *pEntries);
+
+ SvxConfigEntry *CreateCommandFromSelection(const OUString &aURL);
+
public:
virtual ~SvxConfigPage() override;
- static bool CanConfig( const OUString& rModuleId );
+ static bool CanConfig( std::u16string_view rModuleId );
SaveInData* GetSaveInData() { return pCurrentSaveInData; }
const OUString& GetAppName() const { return m_sAppName; }
@@ -496,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
@@ -599,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;
@@ -647,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 b3b7d091b61a..b1f22e4065b9 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -16,11 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CFGUTIL_HXX
-#define INCLUDED_CUI_SOURCE_INC_CFGUTIL_HXX
+#pragma once
#include <vector>
#include <memory>
+#include <string_view>
+
#include <rtl/ustring.hxx>
#include <com/sun/star/frame/DispatchInformation.hpp>
@@ -30,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
{
@@ -71,7 +75,7 @@ public:
std::vector< SfxStyleInfo_Impl > getStyleFamilies() const;
std::vector< SfxStyleInfo_Impl > getStyles(const OUString& sFamily);
- static OUString generateCommand(const OUString& sFamily, const OUString& sStyle);
+ static OUString generateCommand(std::u16string_view sFamily, std::u16string_view sStyle);
};
enum class SfxCfgKind
@@ -81,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
@@ -112,6 +117,7 @@ public:
CuiConfigFunctionListBox(std::unique_ptr<weld::TreeView> xTreeView);
void set_sensitive(bool bSensitive) { m_xTreeView->set_sensitive(bSensitive); }
void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
+ void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink) { m_xTreeView->connect_popup_menu(rLink); }
void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xTreeView->connect_row_activated(rLink); }
void freeze() { m_xTreeView->freeze(); }
void thaw() { m_xTreeView->thaw(); }
@@ -141,15 +147,9 @@ public:
void expand_row(const weld::TreeIter& rIter) { m_xTreeView->expand_row(rIter); }
int n_children() const { return m_xTreeView->n_children(); }
std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const { return m_xTreeView->make_iterator(pOrig); }
- bool get_iter_first(weld::TreeIter& rIter) const { return m_xTreeView->get_iter_first(rIter); }
- // set iter to point to next node, depth first, then sibling
- bool iter_next(weld::TreeIter& rIter) const { return m_xTreeView->iter_next(rIter); }
- bool iter_next_sibling(weld::TreeIter& rIter) const { return m_xTreeView->iter_next_sibling(rIter); }
bool iter_has_child(const weld::TreeIter& rIter) const { return m_xTreeView->iter_has_child(rIter); }
- OUString get_text(const weld::TreeIter& rIter) const { return m_xTreeView->get_text(rIter); }
OUString get_text(int nPos) const { return m_xTreeView->get_text(nPos); }
OUString get_id(const weld::TreeIter& rIter) const { return m_xTreeView->get_id(rIter); }
- OUString get_id(int nPos) const { return m_xTreeView->get_id(nPos); }
bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); }
OUString get_selected_text() const
{
@@ -163,8 +163,6 @@ public:
return OUString();
return m_xTreeView->get_id(*m_xScratchIter);
}
- int get_selected_index() const { return m_xTreeView->get_selected_index(); }
- void select(const weld::TreeIter& rIter) { m_xTreeView->select(rIter); }
void select(int pos) { m_xTreeView->select(pos); }
void set_size_request(int nWidth, int nHeight) { m_xTreeView->set_size_request(nWidth, nHeight); }
Size get_size_request() const { return m_xTreeView->get_size_request(); }
@@ -204,11 +202,11 @@ class CuiConfigGroupListBox
static css::uno::Reference< css::uno::XInterface > getDocumentModel(
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
- OUString const & docName);
+ 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);
@@ -230,8 +228,9 @@ public:
void SetFunctionListBox( CuiConfigFunctionListBox *pBox )
{ m_pFunctionListBox = pBox; }
void GroupSelected();
+#if HAVE_FEATURE_SCRIPTING
void SelectMacro(const SfxMacroInfoItem*);
- void SelectMacro(const OUString&, const OUString&);
+#endif
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
};
@@ -244,16 +243,16 @@ 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);
DECL_LINK(FunctionDoubleClickHdl, weld::TreeView&, bool);
+ DECL_LINK(ContextMenuHdl, const CommandEvent&, bool);
void UpdateUI();
@@ -264,8 +263,8 @@ public:
OUString GetScriptURL() const;
void SetRunLabel();
+ void SaveLastUsedMacro();
+ void LoadLastUsedMacro();
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index e84ea0f162fa..b484c7419b83 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX
+#pragma once
#include <svtools/ctrlbox.hxx>
#include <sfx2/tabdlg.hxx>
@@ -40,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 );
@@ -62,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;
@@ -75,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;
@@ -87,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;
@@ -99,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
{
@@ -141,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;
@@ -160,12 +162,16 @@ 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;
+ weld::TriStateEnabled m_aHiddenState;
+ weld::TriStateEnabled m_aIndividualWordsState;
std::unique_ptr<weld::Label> m_xFontColorFT;
std::unique_ptr<ColorListBox> m_xFontColorLB;
@@ -197,13 +203,14 @@ private:
void SetCaseMap_Impl( SvxCaseMap eCaseMap );
void ResetColor_Impl( const SfxItemSet& rSet );
bool FillItemSetColor_Impl( SfxItemSet& rSet );
- Color GetPreviewFontColor(const Color& rColor) const;
void EnableNoneFontColor();
void SelectHdl_Impl(const weld::ComboBox*);
DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBox&, void);
- DECL_LINK(CbClickHdl_Impl, weld::ToggleButton&, void);
- DECL_LINK(TristClickHdl_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);
@@ -215,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;
@@ -228,7 +235,7 @@ public:
// class SvxCharPositionPage ---------------------------------------------
class SvxCharPositionPage : public SvxCharBasePage
{
- static const sal_uInt16 pPositionRanges[];
+ static const WhichRangesContainer pPositionRanges;
private:
short m_nSuperEsc;
@@ -262,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);
@@ -284,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;
@@ -298,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;
@@ -312,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:
@@ -323,13 +331,11 @@ 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;
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx
index 1b41851476a1..73891d0ff8e6 100644
--- a/cui/source/inc/connect.hxx
+++ b/cui/source/inc/connect.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CONNECT_HXX
-#define INCLUDED_CUI_SOURCE_INC_CONNECT_HXX
+#pragma once
#include <svx/connctrl.hxx>
#include <sfx2/tabdlg.hxx>
@@ -31,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;
@@ -56,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;
@@ -81,6 +82,4 @@ public:
const SdrView* pView);
};
-#endif // INCLUDED_CUI_SOURCE_INC_CONNECT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
index 42183e6278b4..29484ef8f69c 100644
--- a/cui/source/inc/cuifmsearch.hxx
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSet.hpp>
@@ -27,8 +26,9 @@
#include <tools/link.hxx>
#include <rtl/ustring.hxx>
-namespace svxform {
- class FmSearchConfigItem;
+namespace svxform
+{
+class FmSearchConfigItem;
}
struct FmSearchProgress;
@@ -40,13 +40,14 @@ class FmSearchDialog final : public weld::GenericDialogController
{
friend class FmSearchEngine;
- OUString m_sSearch;
- OUString m_sCancel;
+ OUString m_sSearch;
+ OUString m_sCancel;
- Link<FmFoundRecordInformation&,void> m_lnkFoundHandler; ///< Handler for "found"
- Link<FmFoundRecordInformation&,void> m_lnkCanceledNotFoundHdl; ///< Handler for Positioning the Cursors
+ Link<FmFoundRecordInformation&, void> m_lnkFoundHandler; ///< Handler for "found"
+ Link<FmFoundRecordInformation&, void>
+ m_lnkCanceledNotFoundHdl; ///< Handler for Positioning the Cursors
- Link<FmSearchContext&,sal_uInt32> m_lnkContextSupplier; ///< for search in contexts
+ Link<FmSearchContext&, sal_uInt32> m_lnkContextSupplier; ///< for search in contexts
/// memorize the currently selected field for every context
std::vector<OUString> m_arrContextFields;
@@ -54,7 +55,7 @@ class FmSearchDialog final : public weld::GenericDialogController
std::unique_ptr<FmSearchEngine> m_pSearchEngine;
// see EnableSearchUI
- std::unique_ptr<::svxform::FmSearchConfigItem> m_pConfig;
+ std::unique_ptr<::svxform::FmSearchConfigItem> m_pConfig;
// my all Controls
std::unique_ptr<weld::RadioButton> m_prbSearchForText;
@@ -99,8 +100,9 @@ public:
(of course needed : the string number i in strUsedFields of a context must correspond with the interface number i in the
arrFields of the context)
*/
- FmSearchDialog(weld::Window* pParent, const OUString& strInitialText, const std::vector< OUString >& _rContexts, sal_Int16 nInitialContext,
- const Link<FmSearchContext&,sal_uInt32>& lnkContextSupplier);
+ FmSearchDialog(weld::Window* pParent, const OUString& strInitialText,
+ const std::vector<OUString>& _rContexts, sal_Int16 nInitialContext,
+ const Link<FmSearchContext&, sal_uInt32>& lnkContextSupplier);
virtual short run() override;
@@ -112,7 +114,10 @@ public:
This handler MUST be set.
Furthermore, it should be considered, that during the handler the search-dialog is still modal.
*/
- void SetFoundHandler(const Link<FmFoundRecordInformation&,void>& lnk) { m_lnkFoundHandler = lnk; }
+ void SetFoundHandler(const Link<FmFoundRecordInformation&, void>& lnk)
+ {
+ m_lnkFoundHandler = lnk;
+ }
/**
If the search has been cancelled or has been finished without success, the current data set is always displayed in the
search dialog. This handler exists to make this synchronous with the possible display of the caller (it does not
@@ -120,12 +125,15 @@ public:
The pointer that is passed to the handler points to a FmFoundRecordInformation-structure, for which aPosition and
possibly (in a search with contexts) nContext are valid.
*/
- void SetCanceledNotFoundHdl(const Link<FmFoundRecordInformation&,void>& lnk) { m_lnkCanceledNotFoundHdl = lnk; }
+ void SetCanceledNotFoundHdl(const Link<FmFoundRecordInformation&, void>& lnk)
+ {
+ m_lnkCanceledNotFoundHdl = lnk;
+ }
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);
@@ -140,23 +148,24 @@ private:
void SaveParams() const;
// Handler for the Controls
- DECL_LINK( OnClickedFieldRadios, weld::Button&, void );
- DECL_LINK( OnClickedSearchAgain, weld::Button&, void );
- DECL_LINK( OnClickedSpecialSettings, 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);
- DECL_LINK( OnSearchTextModified, weld::ComboBox&, void );
+ DECL_LINK(OnSearchTextModified, weld::ComboBox&, void);
- DECL_LINK( OnPositionSelected, weld::ComboBox&, void );
- DECL_LINK( OnFieldSelected, weld::ComboBox&, void );
+ DECL_LINK(OnPositionSelected, weld::ComboBox&, void);
+ DECL_LINK(OnFieldSelected, weld::ComboBox&, void);
- DECL_LINK( OnFocusGrabbed, weld::Widget&, void );
- DECL_LINK( OnCheckBoxToggled, weld::ToggleButton&, void );
+ DECL_LINK(OnFocusGrabbed, weld::Widget&, void);
+ DECL_LINK(OnCheckBoxToggled, weld::Toggleable&, void);
- DECL_LINK( OnContextSelection, weld::ComboBox&, void );
+ DECL_LINK(OnContextSelection, weld::ComboBox&, void);
- DECL_LINK( OnSearchProgress, const FmSearchProgress*, void );
+ DECL_LINK(OnSearchProgress, const FmSearchProgress*, void);
- void initCommon( const css::uno::Reference< css::sdbc::XResultSet >& _rxCursor );
+ void initCommon(const css::uno::Reference<css::sdbc::XResultSet>& _rxCursor);
};
inline void FmSearchDialog::SetActiveField(const OUString& strField)
@@ -168,6 +177,4 @@ inline void FmSearchDialog::SetActiveField(const OUString& strField)
OnFieldSelected(*m_plbField);
}
-#endif // INCLUDED_CUI_SOURCE_INC_CUIFMSEARCH_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index 0ad85b65401d..cac63d8a6b1e 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
+#pragma once
#include <sal/config.h>
@@ -31,6 +30,8 @@
#include <com/sun/star/media/XPlayer.hpp>
#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <svtools/dialogclosedlistener.hxx>
+
+#include <string_view>
#include <vector>
class GalleryTheme;
@@ -38,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
{
@@ -64,7 +65,7 @@ public:
SearchThread(SearchProgress* pProgress,
TPGalleryThemeProperties* pBrowser,
- const INetURLObject& rStartURL);
+ INetURLObject aStartURL);
};
class SearchProgress : public weld::GenericDialogController
@@ -80,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;
@@ -181,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);
@@ -242,7 +243,7 @@ class TPGalleryThemeProperties : public SfxTabPage
virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
- static OUString addExtension( const OUString&, const OUString& );
+ static OUString addExtension( const OUString&, std::u16string_view );
void FillFilterList();
void SearchFiles();
@@ -250,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);
@@ -267,11 +268,9 @@ 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);
};
-#endif // INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx
index b5280467334d..075c74c29f42 100644
--- a/cui/source/inc/cuigrfflt.hxx
+++ b/cui/source/inc/cuigrfflt.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUIGRFFLT_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUIGRFFLT_HXX
+#pragma once
#include <vcl/timer.hxx>
#include <svx/dlgctrl.hxx>
@@ -80,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;
};
@@ -102,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:
@@ -118,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:
@@ -178,6 +177,4 @@ public:
virtual Graphic GetFilteredGraphic(const Graphic& rGraphic, double fScaleX, double fScaleY) override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index 702cf6396304..8423d8c49759 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -17,12 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX
+#pragma once
#include <sal/config.h>
#include <memory>
+#include <string_view>
#include <svx/hlnkitem.hxx>
#include <sfx2/childwin.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,23 +89,24 @@ 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 ( const OString& 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( const OString& rPageId )
+ IconChoicePage* GetTabPage( std::u16string_view rPageId )
{ return GetPageData(rPageId)->xPage.get(); }
void ActivatePageImpl ();
void DeActivatePageImpl ();
void ResetPageImpl ();
+ void Activate() override;
virtual void Close() override;
void Apply();
@@ -112,20 +115,20 @@ 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 ); }
- 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();
bool QueryClose();
- void PageCreated(const OString& rId, IconChoicePage& rPage);
+ void PageCreated(IconChoicePage& rPage);
void SetPage( SvxHyperlinkItem const * pItem );
void SetReadOnlyMode( bool bReadOnly );
@@ -135,6 +138,4 @@ public:
};
-#endif // INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuiimapwnd.hxx b/cui/source/inc/cuiimapwnd.hxx
index b8fcf1053f2c..ccb65bd487eb 100644
--- a/cui/source/inc/cuiimapwnd.hxx
+++ b/cui/source/inc/cuiimapwnd.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUIIMAPWND_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUIIMAPWND_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <sfx2/frame.hxx>
@@ -45,6 +44,4 @@ public:
OUString GetName() const { return m_xEdtName->get_text(); }
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx
index fa2310d1729d..0ee8cacb6c50 100644
--- a/cui/source/inc/cuioptgenrl.hxx
+++ b/cui/source/inc/cuioptgenrl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUIOPTGENRL_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUIOPTGENRL_HXX
+#pragma once
// include ---------------------------------------------------------------
@@ -33,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;
@@ -65,11 +70,11 @@ 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;
};
-#endif // INCLUDED_CUI_SOURCE_INC_CUIOPTGENRL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuisrchdlg.hxx b/cui/source/inc/cuisrchdlg.hxx
index fc16a4a10d51..b22b3410296b 100644
--- a/cui/source/inc/cuisrchdlg.hxx
+++ b/cui/source/inc/cuisrchdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUISRCHDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUISRCHDLG_HXX
+#pragma once
#include <i18nutil/transliteration.hxx>
#include <sfx2/basedlgs.hxx>
@@ -39,6 +38,4 @@ public:
TransliterationFlags GetTransliterationFlags() const;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 849b009c35df..3e810c5b0dbe 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
+#pragma once
#include <svtools/valueset.hxx>
#include <svx/dlgctrl.hxx>
@@ -40,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)
@@ -56,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)
@@ -109,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; }
@@ -127,7 +127,7 @@ public:
class SvxTransparenceTabPage : public SfxTabPage
{
- static const sal_uInt16 pTransparenceRanges[];
+ static const WhichRangesContainer pTransparenceRanges;
const SfxItemSet& rOutAttrs;
@@ -169,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);
@@ -184,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;
@@ -206,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;
@@ -236,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* );
@@ -261,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;
@@ -280,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; }
@@ -291,7 +303,7 @@ public:
class SvxShadowTabPage : public SvxTabPage
{
- static const sal_uInt16 pShadowRanges[];
+ static const WhichRangesContainer pShadowRanges;
private:
const SfxItemSet& m_rOutAttrs;
@@ -312,10 +324,11 @@ private:
std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
std::unique_ptr<ColorListBox> m_xLbShadowColor;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
+ std::unique_ptr<weld::MetricSpinButton> m_xLbShadowBlurMetric;
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,12 +403,15 @@ 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(const OUString& rGradientName);
+ 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);
@@ -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 *);
@@ -460,7 +479,7 @@ private:
DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
- sal_Int32 SearchHatchList(const OUString& rHatchName);
+ sal_Int32 SearchHatchList(std::u16string_view rHatchName);
public:
SvxHatchTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
@@ -487,7 +506,6 @@ public:
class SvxBitmapTabPage : public SfxTabPage
{
- static const sal_uInt16 pBitmapRanges[];
private:
const SfxItemSet& m_rOutAttrs;
@@ -528,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 );
@@ -539,7 +557,7 @@ private:
DECL_LINK( ClickImportHdl, weld::Button&, void );
void ClickBitmapHdl_Impl();
void CalculateBitmapPresetSize();
- sal_Int32 SearchBitmapList(const OUString& rBitmapName);
+ sal_Int32 SearchBitmapList(std::u16string_view rBitmapName);
sal_Int32 SearchBitmapList(const GraphicObject& rGraphicObject);
public:
@@ -594,7 +612,7 @@ private:
DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
- sal_Int32 SearchPatternList(const OUString& rPatternName);
+ sal_Int32 SearchPatternList(std::u16string_view rPatternName);
public:
SvxPatternTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
@@ -640,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;
@@ -676,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;
@@ -693,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 );
@@ -707,7 +725,7 @@ private:
void UpdateModified();
- static sal_Int32 FindInCustomColors( OUString const & aColorName );
+ static sal_Int32 FindInCustomColors( std::u16string_view aColorName );
sal_Int32 FindInPalette( const Color& rColor );
public:
@@ -729,11 +747,7 @@ public:
void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
- void SetCtlPreviewOld( const SfxItemSet& rAttrs ) { m_aCtlPreviewOld.SetAttributes( rAttrs ); }
-
virtual void FillUserData() override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 87ae008da36e..1122a2017f00 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -17,9 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
+#pragma once
+#include <memory>
#include <vector>
#include <editeng/brushitem.hxx>
#include <sfx2/tabdlg.hxx>
@@ -54,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);
@@ -87,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.
@@ -96,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;
- 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> >
@@ -170,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*);
@@ -206,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;
@@ -283,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();
@@ -373,6 +373,4 @@ public:
void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
};
-#endif // INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/cuitbxform.hxx b/cui/source/inc/cuitbxform.hxx
index f6e52b094633..f5546f1cdb44 100644
--- a/cui/source/inc/cuitbxform.hxx
+++ b/cui/source/inc/cuitbxform.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_CUITBXFORM_HXX
-#define INCLUDED_CUI_SOURCE_INC_CUITBXFORM_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -33,6 +32,4 @@ public:
int GetValue() const { return m_xRecordNo->get_value(); }
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index e1bc2f6b1a28..3b26e5190cb0 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/dbregister.hxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_DBREGISTER_HXX
-#define INCLUDED_CUI_SOURCE_INC_DBREGISTER_HXX
+#pragma once
#include <rtl/ustring.hxx>
+#include <tools/solar.h>
#include <sfx2/basedlgs.hxx>
#include <sfx2/tabdlg.hxx>
@@ -30,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;
@@ -73,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;
@@ -89,7 +91,7 @@ namespace svx
SfxItemSet m_aRegistrationItems;
protected:
- RegistrationItemSetHolder( const SfxItemSet& _rMasterSet );
+ RegistrationItemSetHolder( SfxItemSet _aMasterSet );
~RegistrationItemSetHolder();
protected:
@@ -106,7 +108,5 @@ namespace svx
};
}
-#endif // INCLUDED_CUI_SOURCE_INC_DBREGISTER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/defdlgname.hxx b/cui/source/inc/defdlgname.hxx
index 08aa4249754b..1927e0a7f319 100644
--- a/cui/source/inc/defdlgname.hxx
+++ b/cui/source/inc/defdlgname.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_DEFDLGNAME_HXX
-#define INCLUDED_CUI_SOURCE_INC_DEFDLGNAME_HXX
+#pragma once
// const -----------------------------------------------------------------
@@ -25,6 +24,4 @@
const short RET_BTN_1 = 100;
const short RET_BTN_2 = 101;
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 8fd754990885..000000000000
--- a/cui/source/inc/dlgname.hxx
+++ /dev/null
@@ -1,125 +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 .
- */
-#ifndef INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
-#define INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
-
-#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(); }
-};
-
-#endif // INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/dstribut.hxx b/cui/source/inc/dstribut.hxx
deleted file mode 100644
index 3d3c99de1c00..000000000000
--- a/cui/source/inc/dstribut.hxx
+++ /dev/null
@@ -1,72 +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 .
- */
-#ifndef INCLUDED_CUI_SOURCE_INC_DSTRIBUT_HXX
-#define INCLUDED_CUI_SOURCE_INC_DSTRIBUT_HXX
-
-#include <sfx2/tabdlg.hxx>
-#include <svx/dstribut_enum.hxx>
-#include <vcl/weld.hxx>
-
-class SvxDistributePage : public SfxTabPage
-{
- SvxDistributeHorizontal m_eDistributeHor;
- SvxDistributeVertical m_eDistributeVer;
-
- std::unique_ptr<weld::RadioButton> m_xBtnHorNone;
- std::unique_ptr<weld::RadioButton> m_xBtnHorLeft;
- std::unique_ptr<weld::RadioButton> m_xBtnHorCenter;
- std::unique_ptr<weld::RadioButton> m_xBtnHorDistance;
- std::unique_ptr<weld::RadioButton> m_xBtnHorRight;
- std::unique_ptr<weld::RadioButton> m_xBtnVerNone;
- std::unique_ptr<weld::RadioButton> m_xBtnVerTop;
- std::unique_ptr<weld::RadioButton> m_xBtnVerCenter;
- std::unique_ptr<weld::RadioButton> m_xBtnVerDistance;
- std::unique_ptr<weld::RadioButton> m_xBtnVerBottom;
-
-public:
- SvxDistributePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs,
- SvxDistributeHorizontal eHor,
- SvxDistributeVertical eVer);
- virtual ~SvxDistributePage() override;
-
- virtual bool FillItemSet(SfxItemSet*) override;
- virtual void Reset(const SfxItemSet*) override;
-
- SvxDistributeHorizontal GetDistributeHor() const { return m_eDistributeHor; }
- SvxDistributeVertical GetDistributeVer() const { return m_eDistributeVer; }
-};
-
-class SvxDistributeDialog : public SfxSingleTabDialogController
-{
- SvxDistributePage* mpPage;
-
-public:
- SvxDistributeDialog(weld::Window* pParent, const SfxItemSet& rAttr,
- SvxDistributeHorizontal eHor,
- SvxDistributeVertical eVer);
- virtual ~SvxDistributeDialog() override;
-
- SvxDistributeHorizontal GetDistributeHor() const { return mpPage->GetDistributeHor(); }
- SvxDistributeVertical GetDistributeVer() const { return mpPage->GetDistributeVer(); }
-};
-
-
-#endif // INCLUDED_CUI_SOURCE_INC_DSTRIBUT_HXX
-
-/* 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 afdc7cb6ba6f..673062b7593a 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
-#define INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
+#pragma once
#include <vcl/customweld.hxx>
#include <vcl/graph.hxx>
@@ -38,10 +37,10 @@ public:
virtual void Resize() override;
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
- void SetTop( long nVal ) { m_aTopLeft.setX(nVal); }
- void SetBottom( long nVal ) { m_aBottomRight.setX(nVal); }
- void SetLeft( long nVal ) { m_aTopLeft.setY(nVal); }
- void SetRight( long nVal) { m_aBottomRight.setY(nVal); }
+ void SetTop( tools::Long nVal ) { m_aTopLeft.setX(nVal); }
+ void SetBottom( tools::Long nVal ) { m_aBottomRight.setX(nVal); }
+ void SetLeft( tools::Long nVal ) { m_aTopLeft.setY(nVal); }
+ void SetRight( tools::Long nVal) { m_aBottomRight.setY(nVal); }
void SetFrameSize( const Size& rSz );
void SetGraphic( const Graphic& rGrf ) { m_aGrf = rGrf; }
};
@@ -50,13 +49,14 @@ class SvxGrfCropPage : public SfxTabPage
{
friend class VclPtr<SvxGrfCropPage>;
- OUString aGraphicName;
- Size aOrigSize;
- Size aOrigPixelSize;
- Size aPageSize;
- long nOldWidth;
- 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;
@@ -80,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;
@@ -87,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 );
@@ -104,6 +107,4 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet *pSet ) override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx
index 056aee15977d..57c3284d61b3 100644
--- a/cui/source/inc/hangulhanjadlg.hxx
+++ b/cui/source/inc/hangulhanjadlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX
+#pragma once
#include <vcl/customweld.hxx>
#include <vcl/event.hxx>
@@ -97,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;
@@ -119,7 +118,7 @@ namespace svx
std::unique_ptr<weld::CheckButton> m_xHanjaOnly;
std::unique_ptr<weld::CheckButton> m_xReplaceByChar;
public:
- HangulHanjaConversionDialog(weld::Window* pParent);
+ HangulHanjaConversionDialog(weld::Widget* pParent);
virtual ~HangulHanjaConversionDialog() override;
public:
@@ -129,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;
@@ -165,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 );
@@ -241,7 +240,6 @@ namespace svx
void init(weld::ScrolledWindow* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext);
void grab_focus() { m_xEntry->grab_focus(); }
- OUString get_text() const { return m_xEntry->get_text(); }
void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_xEntry->connect_changed(rLink); }
};
@@ -300,6 +298,4 @@ namespace svx
};
}
-#endif // SVX_HANGUL_HANJA_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/headertablistbox.hxx b/cui/source/inc/headertablistbox.hxx
index c4c65feacce0..a87bb1460f76 100644
--- a/cui/source/inc/headertablistbox.hxx
+++ b/cui/source/inc/headertablistbox.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HEADERTABLISTBOX_HXX
-#define INCLUDED_CUI_SOURCE_INC_HEADERTABLISTBOX_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -26,17 +25,13 @@ class MacroEventListBox final
{
private:
std::unique_ptr<weld::TreeView> m_xTreeView;
+
public:
MacroEventListBox(std::unique_ptr<weld::TreeView> xTreeView);
void set_sensitive(bool bSensitive) { m_xTreeView->set_sensitive(bSensitive); }
void show() { m_xTreeView->show(); }
- weld::TreeView& GetListBox()
- {
- return *m_xTreeView;
- }
+ weld::TreeView& GetListBox() { return *m_xTreeView; }
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/helpids.h b/cui/source/inc/helpids.h
index 3ae4404c138f..8f9af7fd9570 100644
--- a/cui/source/inc/helpids.h
+++ b/cui/source/inc/helpids.h
@@ -16,31 +16,37 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HELPID_HRC
-#define INCLUDED_CUI_SOURCE_INC_HELPID_HRC
+#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"
-#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"
+#include <rtl/ustring.hxx>
-#endif
+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"
+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 719968853643..68bce1650a00 100644
--- a/cui/source/inc/hldocntp.hxx
+++ b/cui/source/inc/hldocntp.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLDOCNTP_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLDOCNTP_HXX
+#pragma once
#include "hltpbase.hxx"
@@ -35,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 );
@@ -43,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;
@@ -53,12 +52,9 @@ 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;
};
-#endif // INCLUDED_CUI_SOURCE_INC_HLDOCNTP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx
index 9f5f8395f3c1..61005a42d635 100644
--- a/cui/source/inc/hldoctp.hxx
+++ b/cui/source/inc/hldoctp.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLDOCTP_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLDOCTP_HXX
+#pragma once
#include "hltpbase.hxx"
@@ -50,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;}
@@ -71,6 +70,4 @@ public:
virtual void SetInitFocus() override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_HLDOCTP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index 115e1e428a47..366d8243a8b6 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -16,8 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLINETTP_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLINETTP_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
#include "cuihyperdlg.hxx"
#include "hltpbase.hxx"
@@ -31,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 RemoveImproperProtocol(const OUString& rProperScheme);
- OUString GetSchemeFromButtons() const;
- INetProtocol GetSmartProtocolFromButtons() const;
+ void SetScheme(std::u16string_view rScheme);
+ void RemoveImproperProtocol(std::u16string_view rProperScheme);
+ 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:
@@ -86,6 +73,4 @@ public:
};
-#endif // INCLUDED_CUI_SOURCE_INC_HLINETTP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx
index c137a3cf1cfa..b7c76c52cb18 100644
--- a/cui/source/inc/hlmailtp.hxx
+++ b/cui/source/inc/hlmailtp.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLMAILTP_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLMAILTP_HXX
+#pragma once
#include "hltpbase.hxx"
@@ -32,21 +31,20 @@ 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);
///< Button : Address book
DECL_LINK (ModifiedReceiverHdl_Impl, weld::ComboBox&, void ); ///< Combobox "receiver" modified
- void SetScheme(const OUString& rScheme);
- void RemoveImproperProtocol(const OUString& aProperScheme);
+ void SetScheme(std::u16string_view rScheme);
+ void RemoveImproperProtocol(std::u16string_view aProperScheme);
OUString CreateAbsoluteURL() const;
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;
@@ -60,6 +58,4 @@ public:
};
-#endif // INCLUDED_CUI_SOURCE_INC_HLMAILTP_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx
index 9dd566a74a6c..d88dddab208d 100644
--- a/cui/source/inc/hlmarkwn.hxx
+++ b/cui/source/inc/hlmarkwn.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLMARKWN_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLMARKWN_HXX
+#pragma once
#include <com/sun/star/container/XNameAccess.hpp>
#include <vcl/weld.hxx>
@@ -31,8 +30,6 @@ class SvxHyperlinkTabPageBase;
class SvxHlinkDlgMarkWnd : public weld::GenericDialogController
{
private:
- friend class SvxHlmarkTreeLBox;
-
SvxHyperlinkTabPageBase* mpParent;
sal_uInt16 mnError;
@@ -48,7 +45,7 @@ protected:
bool RefreshFromDoc( const OUString& aURL );
void RestoreLastSelection();
- std::unique_ptr<weld::TreeIter> FindEntry(const OUString& aStrName);
+ std::unique_ptr<weld::TreeIter> FindEntry(std::u16string_view aStrName);
void ClearTree();
int FillTree( const css::uno::Reference< css::container::XNameAccess >& xLinks, const weld::TreeIter* pParentEntry =nullptr );
@@ -62,11 +59,9 @@ public:
void MoveTo(const Point& rNewPos);
void RefreshTree(const OUString& aStrURL);
- bool SelectEntry(const OUString& aStrMark);
+ bool SelectEntry(std::u16string_view aStrMark);
sal_uInt16 SetError( sal_uInt16 nError);
};
-#endif // INCLUDED_CUI_SOURCE_INC_HLMARKWN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hlmarkwn_def.hxx b/cui/source/inc/hlmarkwn_def.hxx
index 6caa0c510dd8..34cd741fec77 100644
--- a/cui/source/inc/hlmarkwn_def.hxx
+++ b/cui/source/inc/hlmarkwn_def.hxx
@@ -17,13 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLMARKWN_DEF_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLMARKWN_DEF_HXX
+#pragma once
-#define LERR_NOERROR 0
-#define LERR_NOENTRIES 1
-#define LERR_DOCNOTOPEN 2
-
-#endif
+#define LERR_NOERROR 0
+#define LERR_NOENTRIES 1
+#define LERR_DOCNOTOPEN 2
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index 0860fff0e2fc..acb84198ad25 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -16,15 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HLTPBASE_HXX
-#define INCLUDED_CUI_SOURCE_INC_HLTPBASE_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <vcl/transfer.hxx>
#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>
@@ -76,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;
@@ -95,7 +94,7 @@ public:
weld::Container* pParent,
SvxHpLinkDlg* pDlg,
const OUString& rUIXMLDescription,
- const OString& rID,
+ const OUString& rID,
const SfxItemSet* pItemSet
);
virtual ~SvxHyperlinkTabPageBase () override;
@@ -106,7 +105,6 @@ public:
mxDocumentFrame = rxDocumentFrame;
}
- virtual bool AskApply ();
virtual void DoApply ();
virtual void SetInitFocus();
virtual void SetMarkStr ( const OUString& aStrMark );
@@ -133,6 +131,4 @@ protected:
SvxMacroTableDtor* GetMacroTable();
};
-#endif // INCLUDED_CUI_SOURCE_INC_HLTPBASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx
index fdf65cd4b201..0b304e9439f9 100644
--- a/cui/source/inc/hyphen.hxx
+++ b/cui/source/inc/hyphen.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_HYPHEN_HXX
-#define INCLUDED_CUI_SOURCE_INC_HYPHEN_HXX
+#pragma once
#include <memory>
@@ -72,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;
@@ -83,6 +82,4 @@ public:
bool SelRight();
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index 230c22be74c2..e31aaa74e0db 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -16,11 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_ICONCDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_ICONCDLG_HXX
+#pragma once
#include <rtl/ustring.hxx>
#include <sfx2/tabdlg.hxx>
+#include <utility>
// forward-declarations
struct IconChoicePageData;
@@ -32,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:
@@ -59,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; }
@@ -79,6 +64,19 @@ public:
virtual bool QueryClose();
};
-#endif // INCLUDED_CUI_SOURCE_INC_ICONCDLG_HXX
+/// 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 7c17022edcde..61c707507087 100644
--- a/cui/source/inc/insdlg.hxx
+++ b/cui/source/inc/insdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_INSDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_INSDLG_HXX
+#pragma once
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
@@ -37,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;
};
@@ -65,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:
@@ -100,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();
@@ -112,6 +111,4 @@ public:
virtual short run() override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_INSDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx
index ea6428eb3a67..9ab7f0fed466 100644
--- a/cui/source/inc/insrc.hxx
+++ b/cui/source/inc/insrc.hxx
@@ -16,14 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_INSRC_HXX
-#define INCLUDED_CUI_SOURCE_INC_INSRC_HXX
+#pragma once
#include <rtl/string.hxx>
#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;
@@ -31,14 +30,25 @@ 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;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx
index d759df2e6e06..5d7f778d5c38 100644
--- a/cui/source/inc/labdlg.hxx
+++ b/cui/source/inc/labdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_LABDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_LABDLG_HXX
+#pragma once
#include <svtools/valueset.hxx>
#include <sfx2/tabdlg.hxx>
@@ -35,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];
@@ -74,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:
@@ -82,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;
@@ -103,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,
@@ -114,6 +113,4 @@ public:
};
-#endif // INCLUDED_CUI_SOURCE_INC_LABDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx
index 90d51aba828e..1e54954ec555 100644
--- a/cui/source/inc/linkdlg.hxx
+++ b/cui/source/inc/linkdlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_LINKDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_LINKDLG_HXX
+#pragma once
#include <vcl/idle.hxx>
#include <vcl/virdev.hxx>
@@ -28,8 +27,8 @@
*************************************************************************/
namespace sfx2
{
- class LinkManager;
- class SvBaseLink;
+class LinkManager;
+class SvBaseLink;
}
enum class SfxLinkUpdateMode;
@@ -42,7 +41,7 @@ class SvBaseLinksDlg : public weld::GenericDialogController
OUString aStrCloselinkmsg;
OUString aStrCloselinkmsgMulti;
OUString aStrWaitinglink;
- sfx2::LinkManager* pLinkMgr;
+ sfx2::LinkManager* pLinkMgr;
Idle aUpdateIdle;
std::unique_ptr<weld::TreeView> m_xTbLinks;
@@ -57,29 +56,26 @@ class SvBaseLinksDlg : public weld::GenericDialogController
ScopedVclPtr<VirtualDevice> m_xVirDev;
- 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( UpdateNowClickHdl, weld::Button&, void);
- DECL_LINK( ChangeSourceClickHdl, weld::Button&, void );
- DECL_LINK( BreakLinkClickHdl, weld::Button&, void );
- DECL_LINK( UpdateWaitingHdl, Timer *, void );
- DECL_LINK( EndEditHdl, sfx2::SvBaseLink&, void );
+ DECL_LINK(LinksSelectHdl, weld::TreeView&, void);
+ DECL_LINK(LinksDoubleClickHdl, weld::TreeView&, bool);
+ DECL_LINK(ToggleHdl, weld::Toggleable&, void);
+ DECL_LINK(UpdateNowClickHdl, weld::Button&, void);
+ DECL_LINK(ChangeSourceClickHdl, weld::Button&, void);
+ DECL_LINK(BreakLinkClickHdl, weld::Button&, void);
+ DECL_LINK(UpdateWaitingHdl, Timer*, void);
+ DECL_LINK(EndEditHdl, sfx2::SvBaseLink&, void);
void LinksSelectHdl(weld::TreeView* pTreeView);
sfx2::SvBaseLink* GetSelEntry(int* pPos);
- OUString ImplGetStateStr( const sfx2::SvBaseLink& );
+ OUString ImplGetStateStr(const sfx2::SvBaseLink&);
void SetType(sfx2::SvBaseLink& rLink, int nPos, SfxLinkUpdateMode nType);
void InsertEntry(const sfx2::SvBaseLink& rLink, int nPos = -1, bool bSelect = false);
- void SetManager( sfx2::LinkManager* );
+ void SetManager(sfx2::LinkManager*);
public:
- SvBaseLinksDlg(weld::Window * pParent, sfx2::LinkManager*, bool bHtml);
+ SvBaseLinksDlg(weld::Window* pParent, sfx2::LinkManager*, bool bHtml);
virtual ~SvBaseLinksDlg() override;
- void SetActLink( sfx2::SvBaseLink const * pLink );
+ void SetActLink(sfx2::SvBaseLink const* pLink);
};
-#endif // INCLUDED_CUI_SOURCE_INC_LINKDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx
index d4403686c237..ba3c1de11717 100644
--- a/cui/source/inc/macroass.hxx
+++ b/cui/source/inc/macroass.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_MACROASS_HXX
-#define INCLUDED_CUI_SOURCE_INC_MACROASS_HXX
+#pragma once
#include <sal/config.h>
@@ -30,6 +29,7 @@
class SfxMacroTabPage_;
class SfxMacroTabPage_Impl;
+class Timer;
class SfxMacroTabPage final : public SfxTabPage
{
@@ -87,6 +87,4 @@ public:
}
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index 5017aeeabfe8..2f2471bb09eb 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_MACROPG_HXX
-#define INCLUDED_CUI_SOURCE_INC_MACROPG_HXX
+#pragma once
#include <sfx2/basedlgs.hxx>
#include <sfx2/tabdlg.hxx>
@@ -26,23 +25,24 @@
#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)
{
}
};
-typedef std::vector< EventDisplayName > EventDisplayNames;
class SvxMacroTabPage_;
class SvTabListBox;
@@ -55,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:
@@ -65,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;
- EventDisplayNames aDisplayNames;
+ 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:
@@ -103,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
{
@@ -126,6 +129,4 @@ public:
);
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
index 7915fcc381ea..7e18c6485556 100644
--- a/cui/source/inc/measure.hxx
+++ b/cui/source/inc/measure.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_MEASURE_HXX
-#define INCLUDED_CUI_SOURCE_INC_MEASURE_HXX
+#pragma once
#include <sfx2/basedlgs.hxx>
#include <svx/dlgctrl.hxx>
@@ -29,7 +28,7 @@ class SdrView;
class SvxMeasurePage : public SvxTabPage
{
private:
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
@@ -58,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:
@@ -71,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;
@@ -93,6 +92,4 @@ public:
const SdrView* pView);
};
-#endif // INCLUDED_CUI_SOURCE_INC_MEASURE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
index fcc60bb08693..258e446e80f8 100644
--- a/cui/source/inc/multipat.hxx
+++ b/cui/source/inc/multipat.hxx
@@ -16,21 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_MULTIPAT_HXX
-#define INCLUDED_CUI_SOURCE_INC_MULTIPAT_HXX
+#pragma once
#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:
@@ -51,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); }
};
@@ -70,10 +59,8 @@ 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); }
};
-#endif // INCLUDED_CUI_SOURCE_INC_MULTIPAT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx
index d0e21293ca52..4a34cb37712c 100644
--- a/cui/source/inc/newtabledlg.hxx
+++ b/cui/source/inc/newtabledlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_NEWTABLEDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_NEWTABLEDLG_HXX
+#pragma once
#include <svx/svxdlg.hxx>
#include <vcl/weld.hxx>
@@ -38,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)
@@ -53,23 +52,19 @@ 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;
}
};
-#endif // INCLUDED_CUI_SOURCE_INC_NEWTABLEDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index 54796c63b736..13f1a88e9eab 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_NUMFMT_HXX
-#define INCLUDED_CUI_SOURCE_INC_NUMFMT_HXX
+#pragma once
#include <rtl/ustring.hxx>
@@ -57,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);
@@ -65,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;
@@ -77,12 +76,13 @@ public:
private:
std::unique_ptr<SvxNumberInfoItem> pNumItem;
std::unique_ptr<SvxNumberFormatShell> pNumFmtShell;
- sal_uLong nInitFormat;
+ sal_uInt32 nInitFormat;
+ short m_nLbFormatSelPosEdComment;
bool bNumItemFlag; ///< for handling with DocShell
bool bOneAreaFlag;
bool bLegacyAutomaticCurrency;
- short nFixedCategory;
+ short nFixedCategory;
OUString sAutomaticLangEntry;
OUString sAutomaticCurrencyEntry;
@@ -125,22 +125,22 @@ private:
void Obstructing();
void EnableBySourceFormat_Impl();
void SetCategory( sal_uInt16 nPos );
- OUString GetExpColorString( Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos );
+ OUString GetExpColorString( const Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos );
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*);
@@ -151,6 +151,4 @@ private:
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 26ec055e249b..7c34d49fcc62 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_NUMPAGES_HXX
-#define INCLUDED_CUI_SOURCE_INC_NUMPAGES_HXX
+#pragma once
#include <vector>
#include <memory>
@@ -26,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
@@ -64,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;
@@ -93,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;
@@ -130,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;
@@ -165,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;
@@ -217,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;
@@ -237,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;
@@ -248,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;
@@ -266,16 +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();
@@ -382,6 +389,4 @@ public:
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
index d8febfb7bb60..31a622f7a50d 100644
--- a/cui/source/inc/optasian.hxx
+++ b/cui/source/inc/optasian.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_OPTASIAN_HXX
-#define INCLUDED_CUI_SOURCE_INC_OPTASIAN_HXX
+#pragma once
#include <memory>
#include <sfx2/tabdlg.hxx>
@@ -43,19 +42,22 @@ 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:
- SvxAsianLayoutPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet );
+ SvxAsianLayoutPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet);
virtual ~SvxAsianLayoutPage() override;
- static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
- static const sal_uInt16* GetRanges();
- virtual bool FillItemSet( SfxItemSet* rSet ) override;
- virtual void Reset( const SfxItemSet* rSet ) override;
-};
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
+ static WhichRangesContainer GetRanges();
+
+ virtual OUString GetAllStrings() override;
-#endif
+ virtual bool FillItemSet(SfxItemSet* rSet) override;
+ virtual void Reset(const SfxItemSet* rSet) override;
+};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx
index 7d8ffd522c82..8e382cc32e8f 100644
--- a/cui/source/inc/optdict.hxx
+++ b/cui/source/inc/optdict.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_OPTDICT_HXX
-#define INCLUDED_CUI_SOURCE_INC_OPTDICT_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <com/sun/star/uno/Reference.hxx>
@@ -90,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 );
@@ -100,13 +98,11 @@ 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, const OUString& rName);
+ SvxEditDictionaryDialog(weld::Window* pParent, std::u16string_view rName);
virtual ~SvxEditDictionaryDialog() override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 5f64e47c2017..6c5657acf7bd 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_OPTLINGU_HXX
-#define INCLUDED_CUI_SOURCE_INC_OPTLINGU_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#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{
@@ -35,7 +35,6 @@ namespace com::sun::star{
}
}
-class SvTreeListEntry;
class SvxLinguData_Impl;
// define ----------------------------------------------------------------
@@ -62,12 +61,15 @@ 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 );
DECL_LINK( BackHdl_Impl, weld::Button&, void );
DECL_LINK( LangSelectListBoxHdl_Impl, weld::ComboBox&, void );
DECL_LINK( BoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
+ DECL_STATIC_LINK( SvxEditModulesDlg, OnLinkClick, weld::LinkButton&, bool);
void LangSelectHdl_Impl(const SvxLanguageBox* pBox);
public:
@@ -85,6 +87,8 @@ private:
OUString sWordsWithDigits;
OUString sSpellSpecial;
OUString sSpellAuto;
+ OUString sSpellClosedCompound;
+ OUString sSpellHyphenatedCompound;
OUString sGrammarAuto;
OUString sNumMinWordlen;
OUString sNumPreBreak;
@@ -119,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 );
@@ -130,6 +135,7 @@ private:
DECL_LINK( ModulesBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
DECL_LINK( DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
DECL_LINK( PostDblClickHdl_Impl, void *, void);
+ DECL_STATIC_LINK( SvxLinguTabPage, OnLinkClick, weld::LinkButton&, bool);
void UpdateModulesBox_Impl();
void UpdateDicBox_Impl();
@@ -139,12 +145,12 @@ 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;
void HideGroups( sal_uInt16 nGrp );
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index cc3d67b42a05..ccfeb70e0072 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -16,14 +16,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_OPTPATH_HXX
-#define INCLUDED_CUI_SOURCE_INC_OPTPATH_HXX
+#pragma once
#include <memory>
#include <sfx2/tabdlg.hxx>
#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <svtools/dialogclosedlistener.hxx>
+#include <unotools/pathoptions.hxx>
// forward ---------------------------------------------------------------
struct OptPath_Impl;
@@ -49,23 +49,24 @@ private:
DECL_LINK(StandardHdl_Impl, weld::Button&, void);
DECL_LINK(PathSelect_Impl, weld::TreeView&, void);
+ DECL_LINK(HeaderBarClick, int, void);
DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
- void GetPathList( sal_uInt16 _nPathHandle, OUString& _rInternalPath,
+ void GetPathList( SvtPathOptions::Paths _nPathHandle, OUString& _rInternalPath,
OUString& _rUserPath, OUString& _rWritablePath, bool& _rReadOnly );
- void SetPathList( sal_uInt16 _nPathHandle,
- const OUString& _rUserPath, const OUString& _rWritablePath );
+ void SetPathList( SvtPathOptions::Paths _nPathHandle,
+ 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;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 1019a9fbc214..151569ac4634 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_PAGE_HXX
-#define INCLUDED_CUI_SOURCE_INC_PAGE_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/pagectrl.hxx>
@@ -26,6 +25,7 @@
#include <svx/frmdirlbox.hxx>
#include <i18nutil/paper.hxx>
#include <svx/flagsdef.hxx>
+#include <vcl/print.hxx>
// class SvxPageDescPage -------------------------------------------------
/*
@@ -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,17 +63,17 @@ typedef sal_uInt16 MarginPosition;
class SvxPageDescPage : public SfxTabPage
{
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
private:
OUString sStandardRegister;
- long nFirstLeftMargin;
- long nFirstRightMargin;
- long nFirstTopMargin;
- long nFirstBottomMargin;
- long nLastLeftMargin;
- long nLastRightMargin;
- long nLastTopMargin;
- long nLastBottomMargin;
+ tools::Long nFirstLeftMargin;
+ tools::Long nFirstRightMargin;
+ tools::Long nFirstTopMargin;
+ tools::Long nFirstBottomMargin;
+ tools::Long nLastLeftMargin;
+ tools::Long nLastRightMargin;
+ tools::Long nLastTopMargin;
+ tools::Long nLastBottomMargin;
bool bLandscape;
bool bBorderModified;
@@ -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;
@@ -106,6 +104,8 @@ private:
std::unique_ptr<weld::MetricSpinButton> m_xRightMarginEdit;
std::unique_ptr<weld::MetricSpinButton> m_xTopMarginEdit;
std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginEdit;
+ std::unique_ptr<weld::Label> m_xGutterMarginLbl;
+ std::unique_ptr<weld::MetricSpinButton> m_xGutterMarginEdit;
// layout settings
std::unique_ptr<weld::Label> m_xPageText;
std::unique_ptr<weld::ComboBox> m_xLayoutBox;
@@ -121,6 +121,10 @@ private:
std::unique_ptr<weld::CheckButton> m_xRegisterCB;
std::unique_ptr<weld::Label> m_xRegisterFT;
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;
@@ -128,12 +132,13 @@ private:
void Init_Impl();
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 );
@@ -146,14 +151,14 @@ 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. */
void DisableVerticalPageDir();
- bool IsPrinterRangeOverflow(weld::MetricSpinButton& rField, long nFirstMargin,
- long nLastMargin, MarginPosition nPos);
+ bool IsPrinterRangeOverflow(weld::MetricSpinButton& rField, tools::Long nFirstMargin,
+ tools::Long nLastMargin, MarginPosition nPos);
void CheckMarginEdits( bool _bClear );
bool IsMarginOutOfRange() const;
@@ -167,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;
@@ -180,6 +185,4 @@ public:
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_PAGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index b57199d91551..b35111f43b33 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_PARAGRPH_HXX
-#define INCLUDED_CUI_SOURCE_INC_PARAGRPH_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/relfld.hxx>
@@ -41,40 +40,39 @@ class SvxLineSpacingItem;
class SvxStdParagraphTabPage: public SfxTabPage
{
- static const sal_uInt16 pStdRanges[];
+ static const WhichRangesContainer pStdRanges;
private:
- long nWidth;
- long nMinFixDist;
+ 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;
// only writer
- std::unique_ptr<weld::Widget> m_xRegisterFL;
std::unique_ptr<weld::CheckButton> m_xRegisterCB;
// preview
@@ -88,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;
@@ -104,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;
@@ -114,7 +112,6 @@ public:
void EnableRegisterMode();
void EnableContextualMode();
void EnableAutoFirstLine();
- void EnableAbsLineDist(long nMinTwip);
void EnableNegativeMode();
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
@@ -123,7 +120,9 @@ public:
class SvxParaAlignTabPage : public SfxTabPage
{
- static const sal_uInt16 pAlignRanges[];
+ static const WhichRangesContainer pAlignRanges, pSdrAlignRanges;
+
+ bool m_bSdrVertAlign;
SvxParaPrevWindow m_aExampleWin;
@@ -146,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);
@@ -165,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;
};
@@ -191,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);
@@ -199,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;
@@ -215,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;
@@ -227,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;
@@ -246,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
@@ -258,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;
};
@@ -291,14 +312,12 @@ 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;
virtual void ChangesApplied() override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_PARAGRPH_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx
index 0f25fa27df18..1077195f7a85 100644
--- a/cui/source/inc/passwdomdlg.hxx
+++ b/cui/source/inc/passwdomdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_PASSWDOMDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_PASSWDOMDLG_HXX
+#pragma once
#include <sfx2/basedlgs.hxx>
#include <memory>
@@ -26,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;
@@ -34,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;
@@ -58,13 +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();
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx
index a9a691b4f8f8..72f7911f2c77 100644
--- a/cui/source/inc/pastedlg.hxx
+++ b/cui/source/inc/pastedlg.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_PASTEDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_PASTEDLG_HXX
+#pragma once
#include <map>
#include <sot/formats.hxx>
@@ -71,6 +70,4 @@ public:
SotClipboardFormatId GetFormat( const TransferableDataHelper& aHelper);
};
-#endif // INCLUDED_CUI_SOURCE_INC_PASTEDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index 62a3379b9289..66fd07af6255 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -16,8 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_POSTDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_POSTDLG_HXX
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
#include <sfx2/basedlgs.hxx>
@@ -41,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 )
@@ -58,7 +61,7 @@ public:
{
m_xEditED->set_text(rTxt);
}
- void ShowLastAuthor(const OUString& rAuthor, const OUString& rDate);
+ void ShowLastAuthor(std::u16string_view rAuthor, std::u16string_view rDate);
void DontChangeAuthor()
{
m_xAuthorBtn->set_sensitive(false);
@@ -98,6 +101,4 @@ private:
DECL_LINK(NextHdl, weld::Button&, void);
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/screenshotannotationdlg.hxx b/cui/source/inc/screenshotannotationdlg.hxx
index 94972219dc9f..1e41810a09aa 100644
--- a/cui/source/inc/screenshotannotationdlg.hxx
+++ b/cui/source/inc/screenshotannotationdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX
+#pragma once
#include <vcl/weld.hxx>
#include <memory>
@@ -27,16 +26,14 @@ class ScreenshotAnnotationDlg_Impl;
class ScreenshotAnnotationDlg : public weld::GenericDialogController
{
private:
- std::unique_ptr< ScreenshotAnnotationDlg_Impl > m_pImpl;
+ std::unique_ptr<ScreenshotAnnotationDlg_Impl> m_pImpl;
- ScreenshotAnnotationDlg(const ScreenshotAnnotationDlg &) = delete;
- ScreenshotAnnotationDlg& operator=(const ScreenshotAnnotationDlg &) = delete;
+ ScreenshotAnnotationDlg(const ScreenshotAnnotationDlg&) = delete;
+ ScreenshotAnnotationDlg& operator=(const ScreenshotAnnotationDlg&) = delete;
public:
ScreenshotAnnotationDlg(weld::Dialog& rParentDialog);
virtual ~ScreenshotAnnotationDlg() override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 8e66fed69a04..b1b014771dae 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -17,12 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SCRIPTDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_SCRIPTDLG_HXX
+#pragma once
#include <memory>
#include <sfx2/basedlgs.hxx>
-#include <vcl/abstdlg.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -78,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;
@@ -108,24 +106,24 @@ 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 );
void StoreCurrentSelection();
void RestorePreviousSelection();
- void Init(const OUString& language);
+ 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,
@@ -137,14 +135,14 @@ protected:
css::uno::Reference< css::frame::XModel>& model);
static css::uno::Reference< css::script::browse::XBrowseNode >
- getLangNodeFromRootNode( css::uno::Reference< css::script::browse::XBrowseNode > const & root, OUString const & language );
+ getLangNodeFromRootNode( css::uno::Reference< css::script::browse::XBrowseNode > const & root, std::u16string_view language );
- static css::uno::Reference< css::uno::XInterface > getDocumentModel( css::uno::Reference< css::uno::XComponentContext > const & xCtx, OUString const & docName );
+ static css::uno::Reference< css::uno::XInterface > getDocumentModel( css::uno::Reference< css::uno::XComponentContext > const & xCtx, std::u16string_view docName );
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;
@@ -165,6 +163,4 @@ public:
static void ShowAsyncErrorDialog( weld::Window* pParent, css::uno::Any const & aException );
};
-#endif // INCLUDED_CUI_SOURCE_INC_SCRIPTDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx
index 50ab4b39ac70..46f34c0dae28 100644
--- a/cui/source/inc/sdrcelldlg.hxx
+++ b/cui/source/inc/sdrcelldlg.hxx
@@ -17,12 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SDRCELLDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_SDRCELLDLG_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/xtable.hxx>
+#include <svx/tabarea.hxx>
class SdrModel;
class SvxFormatCellsDialog : public SfxTabDialogController
@@ -31,19 +31,18 @@ private:
const SfxItemSet& mrOutAttrs;
XColorListRef mpColorTab;
+ ChangeType mnColorTabState;
XGradientListRef mpGradientList;
XHatchListRef mpHatchingList;
XBitmapListRef mpBitmapList;
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;
};
-#endif // INCLUDED_CUI_SOURCE_INC_SDRCELLDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/showcols.hxx b/cui/source/inc/showcols.hxx
index 3b15abfd33bb..e378c5e197ec 100644
--- a/cui/source/inc/showcols.hxx
+++ b/cui/source/inc/showcols.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SHOWCOLS_HXX
-#define INCLUDED_CUI_SOURCE_INC_SHOWCOLS_HXX
+#pragma once
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/container/XIndexContainer.hpp>
@@ -43,6 +42,4 @@ private:
DECL_LINK(OnClickedOk, weld::Button&, void);
};
-#endif // INCLUDED_CUI_SOURCE_INC_SHOWCOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index b0c2fddae3c7..ce14e0714a3e 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -16,13 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SPLITCELLDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_SPLITCELLDLG_HXX
+#pragma once
#include <svx/svxdlg.hxx>
#include <vcl/weld.hxx>
-class SvxSplitTableDlg : public SvxAbstractSplitTableDialog, public weld::GenericDialogController
+class SvxSplitTableDlg : public weld::GenericDialogController
{
private:
std::unique_ptr<weld::SpinButton> m_xCountEdit;
@@ -30,22 +29,36 @@ private:
std::unique_ptr<weld::RadioButton> m_xVertBox;
std::unique_ptr<weld::CheckButton> m_xPropCB;
- long mnMaxVertical;
- long mnMaxHorizontal;
+ tools::Long mnMaxVertical;
+ tools::Long mnMaxHorizontal;
public:
- SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal);
+ 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;
+ tools::Long GetCount() const;
+
+ void SetSplitVerticalByDefault();
+};
+
+class SvxAbstractSplitTableDialog_Impl : public SvxAbstractSplitTableDialog
+{
+ std::shared_ptr<SvxSplitTableDlg> m_xDlg;
+
+public:
+ SvxAbstractSplitTableDialog_Impl(std::shared_ptr<SvxSplitTableDlg> pDlg) : m_xDlg(std::move(pDlg)) {}
virtual bool IsHorizontal() const override;
virtual bool IsProportional() const override;
- virtual long GetCount() const override;
+ virtual tools::Long GetCount() const override;
- virtual short Execute() override;
virtual void SetSplitVerticalByDefault() override;
-};
-#endif
+ virtual short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext& rContext) override;
+};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx
index 5513ae236a46..712abc8b55bc 100644
--- a/cui/source/inc/srchxtra.hxx
+++ b/cui/source/inc/srchxtra.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SRCHXTRA_HXX
-#define INCLUDED_CUI_SOURCE_INC_SRCHXTRA_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svtools/ctrltool.hxx>
@@ -31,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;
@@ -43,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:
@@ -79,6 +78,4 @@ public:
bool IsRelaxed() const { return m_xRelaxBox->get_active(); }
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx
index 1fe926566073..2e5a15fbebbb 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
-#define INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
+#pragma once
#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;
@@ -56,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;
@@ -85,17 +90,18 @@ 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,
- long nX, long nY);
+ tools::Long nX, tools::Long nY);
static sal_uInt16 GetMapPos(FrmMap const *pMap, const weld::ComboBox& rAlignLB);
static short GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, const weld::ComboBox& rRelationLB);
static short GetRelation(const weld::ComboBox& rRelationLB);
@@ -113,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;
@@ -128,6 +134,4 @@ public:
void SetView( const SdrView* pSdrView );
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index 6c9e63b109b8..207b8b70503d 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_TABSTPGE_HXX
-#define INCLUDED_CUI_SOURCE_INC_TABSTPGE_HXX
+#pragma once
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
@@ -59,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;
@@ -80,7 +79,7 @@ private:
// local variables, internal functions
SvxTabStop aCurrentTab;
std::unique_ptr<SvxTabStopItem> aNewTabs;
- long nDefDist;
+ tools::Long nDefDist;
TabWin_Impl m_aLeftWin;
TabWin_Impl m_aRightWin;
@@ -130,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);
@@ -144,6 +143,4 @@ private:
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_TABSTPGE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx
index 3ae2452b0c0f..010d3954716c 100644
--- a/cui/source/inc/textanim.hxx
+++ b/cui/source/inc/textanim.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_TEXTANIM_HXX
-#define INCLUDED_CUI_SOURCE_INC_TEXTANIM_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/sdtakitm.hxx>
@@ -35,7 +34,7 @@ class SdrView;
class SvxTextAnimationPage : public SfxTabPage
{
private:
- static const sal_uInt16 pRanges[];
+ static const WhichRangesContainer pRanges;
SdrTextAniKind eAniKind;
FieldUnit eFUnit;
@@ -68,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 );
@@ -81,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;
@@ -97,12 +96,10 @@ 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);
};
-#endif // INCLUDED_CUI_SOURCE_INC_TEXTANIM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
index 392794de9543..a6a7f2bd6f46 100644
--- a/cui/source/inc/textattr.hxx
+++ b/cui/source/inc/textattr.hxx
@@ -16,11 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_TEXTATTR_HXX
-#define INCLUDED_CUI_SOURCE_INC_TEXTATTR_HXX
+#pragma once
#include <svx/dlgctrl.hxx>
-#include <svx/svdobj.hxx>
+#include <svx/svdobjkind.hxx>
class SdrView;
@@ -33,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;
@@ -64,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>).
@@ -78,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;
@@ -90,6 +89,4 @@ public:
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
-#endif // INCLUDED_CUI_SOURCE_INC_TEXTATTR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx
index 65c4050cc4d3..05865d68d92f 100644
--- a/cui/source/inc/thesdlg.hxx
+++ b/cui/source/inc/thesdlg.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_THESDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_THESDLG_HXX
+#pragma once
#include <com/sun/star/linguistic2/XThesaurus.hpp>
@@ -27,6 +26,8 @@
#include <memory>
#include <stack>
+struct ImplSVEvent;
+
class SvxThesaurusDialog : public SfxDialogController
{
Idle m_aModifyIdle;
@@ -44,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;
@@ -70,13 +72,11 @@ public:
void LookUp_Impl();
public:
- SvxThesaurusDialog(weld::Window* pParent,
+ SvxThesaurusDialog(weld::Widget* pParent,
css::uno::Reference< css::linguistic2::XThesaurus > const & xThesaurus,
const OUString &rWord, LanguageType nLanguage);
void SetWindowTitle( LanguageType nLanguage );
OUString GetWord() const;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/tipofthedaydlg.hxx b/cui/source/inc/tipofthedaydlg.hxx
index 425805af6fad..1f86d1bf238c 100644
--- a/cui/source/inc/tipofthedaydlg.hxx
+++ b/cui/source/inc/tipofthedaydlg.hxx
@@ -16,24 +16,26 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_TIPOFTHEDAYDLG_HXX
-#define INCLUDED_CUI_SOURCE_INC_TIPOFTHEDAYDLG_HXX
+#pragma once
#include <vcl/weld.hxx>
+#include "cuigrfflt.hxx"
+
+class VclWindowEvent;
class TipOfTheDayDialog : public weld::GenericDialogController
{
private:
- std::unique_ptr<weld::Image> m_pImage;
+ 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;
std::unique_ptr<weld::Button> m_pNext;
std::unique_ptr<weld::LinkButton> m_pLink;
+ std::unique_ptr<weld::CustomWeld> m_pPreview;
- sal_Int32 nCurrentTip;
- sal_Int32 nNumberOfTips;
- sal_Int32 nDay;
- OUString aLink;
+ sal_Int32 m_nCurrentTip;
void UpdateTip();
DECL_LINK(OnNextClick, weld::Button&, void);
DECL_LINK(OnLinkClick, weld::LinkButton&, bool);
@@ -41,8 +43,8 @@ private:
public:
TipOfTheDayDialog(weld::Window* pWindow);
virtual ~TipOfTheDayDialog() override;
-};
-#endif // INCLUDED_CUI_SOURCE_INC_TIPOFTHEDAYDLG_HXX
+ 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
new file mode 100644
index 000000000000..5965aa7598d6
--- /dev/null
+++ b/cui/source/inc/toolbarmodedlg.hxx
@@ -0,0 +1,37 @@
+/* -*- 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 <string_view>
+
+#include <vcl/weld.hxx>
+
+class ToolbarmodeDialog : public weld::GenericDialogController
+{
+public:
+ ToolbarmodeDialog(weld::Window* pWindow);
+ virtual ~ToolbarmodeDialog() override;
+
+private:
+ std::unique_ptr<weld::Image> m_pImage;
+ std::unique_ptr<weld::Button> m_pApply;
+ std::unique_ptr<weld::Button> m_pApplyAll;
+ std::unique_ptr<weld::RadioButton> m_pRadioButtons[9];
+ std::unique_ptr<weld::Label> m_pInfoLabel;
+
+ void UpdateImage(std::u16string_view sFileName);
+ int GetActiveRadioButton();
+ DECL_LINK(SelectToolbarmode, weld::Toggleable&, void);
+ DECL_LINK(OnApplyClick, weld::Button&, void);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index 2c27a19fb69b..78ffd84e2794 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
-#define INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
+#pragma once
#include <svx/dlgctrl.hxx>
+#include <svx/dlgutil.hxx>
#include <svx/dialcontrol.hxx>
#include <svx/anchorid.hxx>
#include <basegfx/range/b2drange.hxx>
@@ -42,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,
@@ -61,7 +61,7 @@ public:
class SvxPositionSizeTabPage : public SvxTabPage
{
- static const sal_uInt16 pPosSizeRanges[];
+ static const WhichRangesContainer pPosSizeRanges;
private:
const SfxItemSet& mrOutAttrs;
@@ -92,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;
@@ -105,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
@@ -117,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;
@@ -161,7 +167,7 @@ public:
\************************************************************************/
class SvxAngleTabPage : public SvxTabPage
{
- static const sal_uInt16 pAngleRanges[];
+ static const WhichRangesContainer pAngleRanges;
private:
const SdrView* pView;
@@ -189,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;
@@ -210,7 +216,7 @@ public:
\************************************************************************/
class SvxSlantTabPage : public SfxTabPage
{
- static const sal_uInt16 pSlantRanges[];
+ static const WhichRangesContainer pSlantRanges;
private:
const SdrView* pView;
@@ -233,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;
@@ -246,6 +252,4 @@ public:
};
-#endif // INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index c2aac20ee6f6..6d07d0981d5a 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX
-#define INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX
+#pragma once
#include <sal/config.h>
@@ -26,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;
@@ -37,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 )) {}
};
@@ -62,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 ) {}
};
@@ -85,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 +115,8 @@ struct OptionsPageInfo;
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,41 +172,54 @@ 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( const OUString& rExtensionId );
+ void LoadExtensionOptions( std::u16string_view rExtensionId );
static OUString GetModuleIdentifier( const css::uno::Reference<
css::frame::XFrame >& xFrame );
- static std::unique_ptr<Module> LoadModule( const OUString& rModuleIdentifier );
- static VectorOfNodes LoadNodes( Module* pModule, const OUString& rExtensionId );
+ static std::unique_ptr<Module> LoadModule( std::u16string_view rModuleIdentifier );
+ static VectorOfNodes LoadNodes( Module* pModule, std::u16string_view rExtensionId );
void InsertNodes( const VectorOfNodes& rNodeList );
- void ApplyOptions( bool deactivate );
+ void ApplyOptions();
DECL_LINK(ShowPageHdl_Impl, weld::TreeView&, void);
DECL_LINK(BackHdl_Impl, weld::Button&, void);
DECL_LINK(ApplyHdl_Impl, weld::Button&, void);
- DECL_LINK(OKHdl_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);
virtual short run() override;
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,
bool bActivateLastSelection);
- OfaTreeOptionsDialog(weld::Window* pParent, const OUString& rExtensionId);
+ OfaTreeOptionsDialog(weld::Window* pParent, std::u16string_view rExtensionId);
virtual ~OfaTreeOptionsDialog() override;
OptionsPageInfo* AddTabPage( sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup );
@@ -187,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 );
};
@@ -217,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 );
@@ -233,6 +281,13 @@ public:
void SavePage();
};
-#endif
+// 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 f35a7bfba16a..f44998378d73 100644
--- a/cui/source/inc/zoom.hxx
+++ b/cui/source/inc/zoom.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_INC_ZOOM_HXX
-#define INCLUDED_CUI_SOURCE_INC_ZOOM_HXX
+#pragma once
#include <memory>
#include <sfx2/basedlgs.hxx>
@@ -46,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:
@@ -65,6 +64,4 @@ public:
void SetLimits(sal_uInt16 nMin, sal_uInt16 nMax);
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index ae7a75859c79..5cccccf1995c 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -10,14 +10,13 @@
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
#include <osl/security.hxx>
-#include <osl/thread.h>
-#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/mozilla/MozillaBootstrap.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;
@@ -61,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)
{
@@ -210,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 660241519110..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(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 45ca5d9f3e07..f6321f2252b1 100644
--- a/cui/source/options/connpooloptions.cxx
+++ b/cui/source/options/connpooloptions.cxx
@@ -17,16 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include "connpooloptions.hxx"
-#include <svtools/editbrowsebox.hxx>
#include "connpoolsettings.hxx"
#include <svl/eitem.hxx>
#include <svx/databaseregistrationui.hxx>
#include <strings.hrc>
#include <dialmgr.hxx>
-
-using ::svt::EditBrowseBox;
+#include <officecfg/Office/DataAccess.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
namespace offapp
{
@@ -48,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));
@@ -136,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();
@@ -145,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();
@@ -159,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();
@@ -211,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);
}
}
@@ -224,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;
@@ -237,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 d3b1ccc90013..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("1") : OUStringLiteral("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 d0bb9ffac941..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();
@@ -227,7 +250,7 @@ void SvxFontSubstTabPage::Reset( const SfxItemSet* )
m_xCheckLB->set_sort_column(2);
m_xCheckLB->set_sort_indicator(TRISTATE_TRUE, 2);
- CheckEnable();
+ SelectHdl(m_xFont1CB.get());
//fill font name box first
m_xNonPropFontsOnlyCB->set_active(
@@ -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);
@@ -267,22 +308,22 @@ IMPL_LINK(SvxFontSubstTabPage, SelectComboBoxHdl, weld::ComboBox&, rBox, void)
namespace
{
// search in the "font" column
- int findText(const weld::TreeView& rTreeView, const OUString& rCol)
+ int findText(const weld::TreeView& rTreeView, std::u16string_view rCol)
{
for (int i = 0, nEntryCount = rTreeView.n_children(); i < nEntryCount; ++i)
{
- if (rTreeView.get_text(i, 3) == rCol)
+ if (rTreeView.get_text(i, 2) == rCol)
return i;
}
return -1;
}
- bool findRow(const weld::TreeView& rTreeView, const OUString& rCol1, const OUString& rCol2)
+ bool findRow(const weld::TreeView& rTreeView, std::u16string_view rCol1, std::u16string_view rCol2)
{
int nRow = findText(rTreeView, rCol1);
if (nRow == -1)
return false;
- return rTreeView.get_text(nRow, 4) == rCol2;
+ return rTreeView.get_text(nRow, 3) == rCol2;
}
}
@@ -323,11 +364,17 @@ void SvxFontSubstTabPage::SelectHdl(const weld::Widget* pWin)
if (pWin == m_xCheckLB.get())
{
- if (m_xCheckLB->count_selected_rows() == 1)
+ const int nSelectedRowCount = m_xCheckLB->count_selected_rows();
+ if (nSelectedRowCount == 1)
{
int nRow = m_xCheckLB->get_selected_index();
- m_xFont1CB->set_entry_text(m_xCheckLB->get_text(nRow, 3));
- m_xFont2CB->set_entry_text(m_xCheckLB->get_text(nRow, 4));
+ m_xFont1CB->set_entry_text(m_xCheckLB->get_text(nRow, 2));
+ m_xFont2CB->set_entry_text(m_xCheckLB->get_text(nRow, 3));
+ }
+ else if (nSelectedRowCount > 1)
+ {
+ m_xFont1CB->set_entry_text(OUString());
+ m_xFont2CB->set_entry_text(OUString());
}
}
@@ -344,12 +391,14 @@ void SvxFontSubstTabPage::SelectHdl(const weld::Widget* pWin)
m_xCheckLB->select(nPos);
}
}
+ else
+ m_xCheckLB->unselect_all();
}
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();
@@ -368,15 +417,17 @@ 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);
+
+ bool bApply = bEnableAll, bDelete = bEnableAll;
+
if (bEnableAll)
{
- bool bApply, bDelete;
-
int nEntry = m_xCheckLB->get_selected_index();
- // because of OS/2 optimization error (Bug #56267) a bit more intricate:
if (m_xFont1CB->get_active_text().isEmpty() || m_xFont2CB->get_active_text().isEmpty())
bApply = false;
else if (m_xFont1CB->get_active_text() == m_xFont2CB->get_active_text())
@@ -389,27 +440,10 @@ void SvxFontSubstTabPage::CheckEnable()
bApply = true;
bDelete = nEntry != -1;
-
- m_xApply->set_sensitive(bApply);
- m_xDelete->set_sensitive(bDelete);
}
- if (bEnableAll)
- {
- if (!m_xCheckLB->get_sensitive())
- {
- m_xCheckLB->set_sensitive(true);
- SelectHdl(m_xFont1CB.get());
- }
- }
- else
- {
- if (m_xCheckLB->get_sensitive())
- {
- m_xCheckLB->set_sensitive(false);
- m_xCheckLB->unselect_all();
- }
- }
+ m_xApply->set_sensitive(bApply);
+ m_xDelete->set_sensitive(bDelete);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 cd91c4735048..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(28));
+ 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)
@@ -181,7 +168,9 @@ IMPL_LINK(CuiAboutConfigTabPage, HeaderBarClick, int, nColumn, void)
}
else
{
- m_xPrefBox->set_sort_indicator(TRISTATE_INDET, m_xPrefBox->get_sort_column());
+ int nOldSortColumn = m_xPrefBox->get_sort_column();
+ if (nOldSortColumn != -1)
+ m_xPrefBox->set_sort_indicator(TRISTATE_INDET, nOldSortColumn);
m_xPrefBox->set_sort_column(nColumn);
}
@@ -192,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());
@@ -231,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)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ 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)
{
- 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(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);
@@ -274,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
@@ -299,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.
@@ -517,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)
{
@@ -565,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
@@ -579,17 +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;
- OUString sNewValue;
- if( sPropertyType == "boolean" )
+ if (sPropertyType == "boolean")
{
bool bValue;
- if( sPropertyValue == "true" )
+ if (sPropertyValue == "true")
{
sDialogValue = "false";
bValue = false;
@@ -604,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;
@@ -616,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")
{
- 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 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)
{
- 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")
- {
- 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" )
+ }
+ 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 > 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;
+ 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 == "[]hyper" )
+ }
+ 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 > 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_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 == "[]double" )
+ }
+ 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 > 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<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 == "[]float" )
- {
- 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;
- }
- 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
{
@@ -781,72 +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());
-
- 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;
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, SearchHdl_Impl, weld::Button&, void) { InputChanged(); }
- 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;
- });
+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);
@@ -857,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;
@@ -895,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 6907eca46716..390621a0cdd9 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -20,8 +20,8 @@
#include <memory>
#include <map>
#include <optasian.hxx>
-#include <osl/diagnose.h>
#include <tools/debug.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <o3tl/any.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <svl/asiancfg.hxx>
@@ -42,15 +42,15 @@ using namespace com::sun::star::i18n;
using namespace com::sun::star::frame;
using namespace com::sun::star::beans;
-const char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation";
-const char cCharacterCompressionType[] = "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;
};
}
@@ -63,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)
@@ -81,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);
}
}
@@ -141,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())
@@ -175,15 +201,15 @@ 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&)
{
- OSL_FAIL("exception in XForbiddenCharacters");
+ TOOLS_WARN_EXCEPTION( "cui.options", "in XForbiddenCharacters");
}
}
eLastUsedLanguageTypeForForbiddenCharacters = m_xLanguageLB->get_active_id();
@@ -205,11 +231,11 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
}
if( pImpl->xPrSet.is() )
pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
- OUString sForbidden("ForbiddenCharacters");
- 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");
if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden))
{
Any aForbidden = pImpl->xPrSet->getPropertyValue(sForbidden);
@@ -286,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
@@ -310,17 +336,17 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void)
}
catch (const Exception&)
{
- OSL_FAIL("exception in XForbiddenCharacters");
+ TOOLS_WARN_EXCEPTION( "cui.options", "in XForbiddenCharacters");
}
}
}
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;
@@ -334,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);
@@ -358,27 +384,26 @@ 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&)
{
- OSL_FAIL("exception in XForbiddenCharacters");
+ TOOLS_WARN_EXCEPTION( "cui.options", "in XForbiddenCharacters");
}
}
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 5510fc12994c..bc4274eaca1e 100644
--- a/cui/source/options/optbasic.hxx
+++ b/cui/source/options/optbasic.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTBASIC_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTBASIC_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -39,12 +38,13 @@ 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;
};
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTBASIC_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 1df577ee13cd..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)
{
@@ -82,8 +83,8 @@ void SvxDefaultColorOptPage::FillBoxChartColorLB()
m_xLbChartColors->freeze();
ClearColorEntries();
- const long nCount(m_SvxChartColorTableUniquePtr->size());
- for (long i = 0; i < nCount; ++i)
+ const tools::Long nCount(m_SvxChartColorTableUniquePtr->size());
+ for (tools::Long i = 0; i < nCount; ++i)
InsertColorEntry((*m_SvxChartColorTableUniquePtr)[i]);
m_xLbChartColors->thaw();
}
@@ -95,11 +96,19 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(weld::Container* pPage, weld::Dia
, m_xPBDefault(m_xBuilder->weld_button("default"))
, m_xPBAdd(m_xBuilder->weld_button("add"))
, m_xPBRemove(m_xBuilder->weld_button("delete"))
- , m_xValSetColorBox(new SvxColorValueSet(m_xBuilder->weld_scrolled_window("tablewin")))
+ , m_xValSetColorBox(new SvxColorValueSet(m_xBuilder->weld_scrolled_window("tablewin", true)))
, m_xValSetColorBoxWin(new weld::CustomWeld(*m_xBuilder, "table", *m_xValSetColorBox))
{
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 eb9b1983b8c3..22a01495b276 100644
--- a/cui/source/options/optchart.hxx
+++ b/cui/source/options/optchart.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTCHART_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTCHART_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svtools/valueset.hxx>
@@ -33,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;
@@ -71,12 +69,13 @@ 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;
void SaveChartOptions();
};
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTCHART_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index f7807adc57e9..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, 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,
- 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)
@@ -295,7 +345,7 @@ ColorConfigWindow_Impl::Entry::Entry(weld::Window* pTopLevel, weld::Builder& rBu
if (!bCheckBox)
{
- m_xText->set_margin_left(m_xText->get_margin_left() +
+ m_xText->set_margin_start(m_xText->get_margin_start() +
nCheckBoxLabelOffset);
}
@@ -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
- 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,22 +686,22 @@ 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();
- long GetScrollPosition() const
+ void UpdateEntries();
+ tools::Long GetScrollPosition() const
{
return m_xVScroll->vadjustment_get_value();
}
- void SetScrollPosition(long nSet)
+ void SetScrollPosition(tools::Long nSet)
{
m_xVScroll->vadjustment_set_value(nSet);
}
@@ -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 5f8e807b1cec..35c07d3a81df 100644
--- a/cui/source/options/optctl.hxx
+++ b/cui/source/options/optctl.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTCTL_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTCTL_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
@@ -33,16 +32,17 @@ 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;
};
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTCTL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 58ccf42e3965..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);
}
@@ -198,7 +216,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, ModifyHdl_Impl, weld::Entry&, void)
// class SvxEditDictionaryDialog -------------------------------------------
-SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName)
+SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16string_view rName)
: GenericDialogController(pParent, "cui/ui/editdictionarydialog.ui", "EditDictionaryDialog")
, sModify(CuiResId(STR_MODIFY))
, bFirstSelect(false)
@@ -235,8 +253,10 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, const OU
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, const OU
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)
@@ -585,10 +601,8 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn)
{
if (pBtn == m_xDeletePB.get())
{
- OUString aStr;
-
- m_xWordED->set_text(aStr);
- m_xReplaceED->set_text(aStr);
+ m_xWordED->set_text("");
+ m_xReplaceED->set_text("");
m_xDeletePB->set_sensitive(false);
int nEntry = m_pWordsLB->get_selected_index();
@@ -597,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();
@@ -625,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);
@@ -672,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;
@@ -753,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;
}
@@ -764,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 5708f14a3575..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 efc95684328a..51a51ec04456 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -16,24 +16,31 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTFLTR_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTFLTR_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
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;
@@ -41,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;
};
@@ -58,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,
@@ -72,12 +84,12 @@ 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;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 64a85add8440..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,14 +31,14 @@
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <unotools/compatibility.hxx>
-#include <unotools/fontoptions.hxx>
-#include <svtools/menuoptions.hxx>
#include <svl/languageoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
#include <svtools/miscopt.hxx>
-#include <unotools/printwarningoptions.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>
@@ -48,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
@@ -73,27 +74,27 @@
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/office/Quickstart.hpp>
#include <com/sun/star/linguistic2/XLinguProperties.hpp>
+#include <comphelper/dispatchcommand.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/window.hxx>
#include <vcl/IconThemeInfo.hxx>
-#if HAVE_FEATURE_OPENGL
-#include <vcl/opengl/OpenGLWrapper.hxx>
-#endif
#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;
@@ -102,110 +103,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::utl;
-namespace svt {
-
-class SkiaCfg
-{
-private:
- bool mbUseSkia;
- bool mbForceSkia;
- bool mbForceSkiaRaster;
- bool mbModified;
-
-public:
- SkiaCfg();
- ~SkiaCfg();
-
- bool useSkia() const;
- bool forceSkia() const;
- bool forceSkiaRaster() const;
-
- void setUseSkia(bool bSkia);
- void setForceSkia(bool bSkia);
- void setForceSkiaRaster(bool bSkia);
-
- void reset();
-};
-
-SkiaCfg::SkiaCfg():
- mbModified(false)
-{
- reset();
-}
-
-void SkiaCfg::reset()
-{
- mbUseSkia = officecfg::Office::Common::VCL::UseSkia::get();
- mbForceSkia = officecfg::Office::Common::VCL::ForceSkia::get();
- mbForceSkiaRaster = officecfg::Office::Common::VCL::ForceSkiaRaster::get();
- mbModified = false;
-}
-
-SkiaCfg::~SkiaCfg()
-{
- if (!mbModified)
- return;
-
- try
- {
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- if (!officecfg::Office::Common::VCL::UseSkia::isReadOnly())
- officecfg::Office::Common::VCL::UseSkia::set(mbUseSkia, batch);
- if (!officecfg::Office::Common::VCL::ForceSkia::isReadOnly())
- officecfg::Office::Common::VCL::ForceSkia::set(mbForceSkia, batch);
- if (!officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly())
- officecfg::Office::Common::VCL::ForceSkiaRaster::set(mbForceSkiaRaster, batch);
- batch->commit();
- }
- catch (...)
- {
- }
-}
-
-bool SkiaCfg::useSkia() const
-{
- return mbUseSkia;
-}
-
-bool SkiaCfg::forceSkia() const
-{
- return mbForceSkia;
-}
-
-bool SkiaCfg::forceSkiaRaster() const
-{
- return mbForceSkiaRaster;
-}
-
-void SkiaCfg::setUseSkia(bool bSkia)
-{
- if (bSkia != mbUseSkia)
- {
- mbUseSkia = bSkia;
- mbModified = true;
- }
-}
-
-void SkiaCfg::setForceSkia(bool bSkia)
-{
- if (mbForceSkia != bSkia)
- {
- mbForceSkia = bSkia;
- mbModified = true;
- }
-}
-
-void SkiaCfg::setForceSkiaRaster(bool bSkia)
-{
- if (mbForceSkiaRaster != bSkia)
- {
- mbForceSkiaRaster = bSkia;
- mbModified = true;
- }
-}
-
-}
-
// class OfaMiscTabPage --------------------------------------------------
DeactivateRC OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
@@ -263,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 (SvtMiscOptions().IsUseSystemFileDialogReadOnly())
- {
- m_xFileDlgROImage->show();
- m_xFileDlgCB->set_sensitive(false);
- }
-
-#if !ENABLE_GTK3
- m_xPrintDlgFrame->hide();
-#else
- if (!SvtMiscOptions().IsExperimentalMode())
- {
- 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
@@ -331,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() )
{
@@ -351,26 +266,17 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
if ( m_xFileDlgCB->get_state_changed_from_saved() )
{
- SvtMiscOptions aMiscOpt;
- aMiscOpt.SetUseSystemFileDialog( !m_xFileDlgCB->get_active() );
+ officecfg::Office::Common::Misc::UseSystemFileDialog::set( !m_xFileDlgCB->get_active(), batch );
bModified = true;
}
- if ( m_xPrintDlgCB->get_state_changed_from_saved() )
+ if (m_xDocStatusCB->get_state_changed_from_saved())
{
- SvtMiscOptions aMiscOpt;
- aMiscOpt.SetUseSystemPrintDialog( !m_xPrintDlgCB->get_active() );
+ officecfg::Office::Common::Print::PrintingModifiesDocument::set(m_xDocStatusCB->get_active(), batch);
bModified = true;
}
- if ( m_xDocStatusCB->get_state_changed_from_saved() )
- {
- SvtPrintWarningOptions aPrintOptions;
- aPrintOptions.SetModifyDocumentOnPrintingAllowed( m_xDocStatusCB->get_active() );
- 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 )
{
@@ -378,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())
{
@@ -392,57 +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();
- SvtMiscOptions aMiscOpt;
- m_xFileDlgCB->set_active( !aMiscOpt.UseSystemFileDialog() );
+
+ 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( !aMiscOpt.UseSystemPrintDialog() );
- m_xPrintDlgCB->save_state();
- SvtPrintWarningOptions aPrintOptions;
- m_xDocStatusCB->set_active(aPrintOptions.IsModifyDocumentOnPrintingAllowed());
+ 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() );
@@ -453,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 )
@@ -473,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
@@ -514,7 +434,6 @@ private:
};
CanvasSettings::CanvasSettings() :
- mxForceFlagNameAccess(),
mbHWAccelAvailable(false),
mbHWAccelChecked(false)
{
@@ -571,18 +490,6 @@ CanvasSettings::CanvasSettings() :
bool CanvasSettings::IsHardwareAccelerationAvailable() const
{
- if (SkiaHelper::isVCLSkiaEnabled() && Application::GetToolkitName() != "gtk3")
- {
- mbHWAccelAvailable = false;
- return false;
- }
-#if HAVE_FEATURE_OPENGL
- if (OpenGLWrapper::isVCLOpenGLEnabled() && Application::GetToolkitName() != "gtk3")
- {
- mbHWAccelAvailable = false;
- return false;
- }
-#endif
if( !mbHWAccelChecked )
{
mbHWAccelChecked = true;
@@ -678,59 +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)
- , mpSkiaConfig(new svt::SkiaCfg)
+ , 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_xForceSkia(m_xBuilder->weld_check_button("forceskia"))
+ , 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_xUseSkia->hide();
- m_xForceSkia->hide();
- m_xForceSkiaRaster->hide();
- m_xSkiaStatusEnabled->hide();
- m_xSkiaStatusDisabled->hide();
- m_xMenuIconBox->hide();
- }
-
-#if !HAVE_FEATURE_SKIA || !defined(_WIN32)
- // Duplicated also in UpdateSkiaStatus().
- // For now Skia is used mainly on Windows, hide the controls everywhere else.
- // It can also be used on Linux, but only with the rarely used 'gen' backend.
- m_xUseSkia->hide();
- m_xForceSkia->hide();
- m_xForceSkiaRaster->hide();
- m_xSkiaStatusEnabled->hide();
- m_xSkiaStatusDisabled->hide();
-#endif
+ 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_xForceSkia->connect_toggled(LINK(this, OfaViewTabPage, OnForceSkiaToggled));
- m_xForceSkiaRaster->connect_toggled(LINK(this, OfaViewTabPage, OnForceSkiaRasterToggled));
+ 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();
@@ -740,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
@@ -750,48 +665,97 @@ 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);
-
- // FIXME: should really add code to show a 'lock' icon here.
- if (officecfg::Office::Common::VCL::UseSkia::isReadOnly())
- m_xUseSkia->set_sensitive(false);
- if (officecfg::Office::Common::VCL::ForceSkia::isReadOnly())
- m_xForceSkia->set_sensitive(false);
- if (officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly())
- m_xForceSkiaRaster->set_sensitive(false);
+OfaViewTabPage::~OfaViewTabPage()
+{
+}
- UpdateSkiaStatus();
+IMPL_LINK_NOARG(OfaViewTabPage, OnRunGPTestClick, weld::Button&, void)
+{
+ GraphicsTestsDialog m_xGraphicsTestDialog(m_xContainer.get());
+ m_xGraphicsTestDialog.run();
}
-OfaViewTabPage::~OfaViewTabPage()
+IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void)
{
+ 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, OnForceSkiaToggled, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(OfaViewTabPage, OnUseSkiaToggled, weld::Toggleable&, void)
{
- if (m_xForceSkia->get_active())
- {
- // Ignoring the Skia denylist implies that Skia is on.
- m_xUseSkia->set_active(true);
- }
+ UpdateSkiaStatus();
}
-IMPL_LINK_NOARG(OfaViewTabPage, OnForceSkiaRasterToggled, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(OfaViewTabPage, OnCopySkiaLog, weld::Button&, void)
{
- if (m_xForceSkiaRaster->get_active())
+#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()
+{
+#if HAVE_FEATURE_SKIA
+ bool skiaHidden = true;
+
+ // For now Skia is used mainly on Windows, enable the controls there.
+ if (Application::GetToolkitName() == "win")
+ skiaHidden = false;
+ // 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)
{
- // Forcing Skia raster implies that Skia is on.
- m_xUseSkia->set_active(true);
+ HideSkiaWidgets();
+ return;
}
+
+ // Easier than a custom translation string.
+ bool bEnabled = SkiaHelper::isVCLSkiaEnabled();
+ m_xSkiaStatusEnabled->set_visible(bEnabled);
+ m_xSkiaStatusDisabled->set_visible(!bEnabled);
+
+ 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.
+ UpdateHardwareAccelStatus();
+#else
+ HideSkiaWidgets();
+#endif
}
std::unique_ptr<SfxTabPage> OfaViewTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
@@ -799,14 +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()
{
- SvtFontOptions aFontOpt;
- 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();
@@ -821,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 );
}
@@ -837,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();
@@ -853,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();
@@ -866,67 +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())
{
- aFontOpt.EnableFontWYSIWYG(m_xFontShowCB->get_active());
+ officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::set(m_xFontShowCB->get_active(), xChanges);
bModified = true;
}
- if (m_xMenuIconsLB->get_value_changed_from_saved())
+ if (m_xAppearanceStyleLB->get_value_changed_from_saved())
{
- aMenuOpt.SetMenuIconsState(m_xMenuIconsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xMenuIconsLB->get_active() - 1));
+ bDarkModeOptModified = true;
bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
- }
-
- if (m_xContextMenuShortcutsLB->get_value_changed_from_saved())
- {
- aMenuOpt.SetContextMenuShortcuts(m_xContextMenuShortcutsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xContextMenuShortcutsLB->get_active() - 1));
- bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
}
// #i95644# if disabled, do not use value, see in ::Reset()
@@ -942,38 +908,31 @@ 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;
}
}
if (m_xUseSkia->get_state_changed_from_saved() ||
- m_xForceSkia->get_state_changed_from_saved() ||
m_xForceSkiaRaster->get_state_changed_from_saved())
{
- mpSkiaConfig->setUseSkia(m_xUseSkia->get_active());
- mpSkiaConfig->setForceSkia(m_xForceSkia->get_active());
- mpSkiaConfig->setForceSkiaRaster(m_xForceSkiaRaster->get_active());
+ 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)
@@ -988,7 +947,6 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
}
if (m_xUseSkia->get_state_changed_from_saved() ||
- m_xForceSkia->get_state_changed_from_saved() ||
m_xForceSkiaRaster->get_state_changed_from_saved())
{
SolarMutexGuard aGuard;
@@ -1004,131 +962,166 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
void OfaViewTabPage::Reset( const SfxItemSet* )
{
SvtMiscOptions aMiscOptions;
- mpSkiaConfig->reset();
+ 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
- SvtFontOptions aFontOpt;
- m_xFontShowCB->set_active( aFontOpt.IsFontWYSIWYGEnabled() );
- 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();
-
- { // #i95644# HW accel (unified to disable mechanism)
- if(pCanvasSettings->IsHardwareAccelerationAvailable())
- {
- m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
- m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
- }
- else
- {
- m_xUseHardwareAccell->set_active(false);
- m_xUseHardwareAccell->set_sensitive(false);
- }
+ bEnable = !officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::isReadOnly();
+ m_xFontShowCB->set_active(officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get());
+ m_xFontShowCB->set_sensitive(bEnable);
+ m_xFontShowImg->set_visible(!bEnable);
- m_xUseHardwareAccell->save_state();
- }
+ 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();
}
- m_xUseSkia->set_active(mpSkiaConfig->useSkia());
- m_xForceSkia->set_active(mpSkiaConfig->forceSkia());
- m_xForceSkiaRaster->set_active(mpSkiaConfig->forceSkiaRaster());
+
+ m_xUseSkia->set_active(officecfg::Office::Common::VCL::UseSkia::get());
+ m_xForceSkiaRaster->set_active(officecfg::Office::Common::VCL::ForceSkiaRaster::get());
+ m_xUseSkia->save_state();
+ m_xForceSkiaRaster->save_state();
m_xFontAntiAliasing->save_state();
m_xAAPointLimit->save_value();
m_xFontShowCB->save_state();
- m_xUseSkia->save_state();
- m_xForceSkia->save_state();
- m_xForceSkiaRaster->save_state();
-
OnAntialiasingToggled(*m_xFontAntiAliasing);
+ UpdateSkiaStatus();
}
-void OfaViewTabPage::UpdateSkiaStatus()
+void OfaViewTabPage::UpdateHardwareAccelStatus()
{
- if (Application::GetToolkitName() == "gtk3")
- return;
-#if HAVE_FEATURE_SKIA && defined(_WIN32)
- // Easier than a custom translation string.
- bool bEnabled = SkiaHelper::isVCLSkiaEnabled();
- m_xSkiaStatusEnabled->set_visible(bEnabled);
- m_xSkiaStatusDisabled->set_visible(!bEnabled);
+ // #i95644# HW accel (unified to disable mechanism)
+ if(pCanvasSettings->IsHardwareAccelerationAvailable())
+ {
+ 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());
#endif
}
struct LanguageConfig_Impl
{
- SvtLanguageOptions aLanguageOptions;
+ SvtCTLOptions aCTLLanguageOptions;
SvtSysLocaleOptions aSysLocaleOptions;
SvtLinguConfig aLinguConfig;
};
@@ -1136,11 +1129,11 @@ struct LanguageConfig_Impl
static bool bLanguageCurrentDoc_Impl = false;
// some things we'll need...
-const char sAccessSrvc[] = "com.sun.star.configuration.ConfigurationAccess";
-const char sAccessUpdSrvc[] = "com.sun.star.configuration.ConfigurationUpdateAccess";
-const char sInstalledLocalesPath[] = "org.openoffice.Setup/Office/InstalledLocales";
-const char sUserLocalePath[] = "org.openoffice.Office.Linguistic/General";
-const char sUserLocaleKey[] = "UILocale";
+constexpr OUString sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess"_ustr;
+constexpr OUStringLiteral sAccessUpdSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess";
+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 )
@@ -1154,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();
}
@@ -1176,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();
@@ -1207,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;
@@ -1230,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;
});
@@ -1243,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))
@@ -1314,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);
@@ -1322,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() );
@@ -1370,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 );
/*
@@ -1393,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
{
@@ -1413,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)
@@ -1470,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())
@@ -1483,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(
@@ -1512,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 );
}
@@ -1531,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 );
}
@@ -1550,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 );
}
@@ -1564,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;
@@ -1586,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];
@@ -1603,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;
@@ -1619,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
@@ -1633,21 +1667,22 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
LocaleSettingHdl(*m_xLocaleSettingLB->get_widget());
// configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default
- OUString aAbbrev;
- LanguageType eLang;
const NfCurrencyEntry* pCurr = nullptr;
OUString sCurrency = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
if ( !sCurrency.isEmpty() )
{
+ LanguageType eLang;
+ OUString aAbbrev;
SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sCurrency );
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();
@@ -1655,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
@@ -1677,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);
@@ -1701,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;
}
@@ -1744,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);
@@ -1759,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())
@@ -1772,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())
@@ -1802,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);
@@ -1810,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);
@@ -1818,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();
@@ -1828,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);
@@ -1840,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
@@ -1868,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;
@@ -1882,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;
@@ -1894,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;
@@ -1906,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;
@@ -1924,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 8ddec9631087..2c62e569ea75 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -16,52 +16,57 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTGDLG_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTGDLG_HXX
+#pragma once
#include <memory>
+#include <config_features.h>
#include <sfx2/tabdlg.hxx>
#include <svx/langbox.hxx>
class CanvasSettings;
-class SvtOptionsDrawinglayer;
namespace vcl {
class IconThemeInfo;
}
-namespace svt {
- class SkiaCfg;
-}
-
class OfaMiscTabPage : public SfxTabPage
{
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;
@@ -72,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:
@@ -86,45 +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::unique_ptr<svt::SkiaCfg> mpSkiaConfig;
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::CheckButton> m_xForceSkia;
+ 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;
- DECL_LINK(OnAntialiasingToggled, weld::ToggleButton&, void);
- DECL_LINK(OnForceSkiaToggled, weld::ToggleButton&, void);
- DECL_LINK(OnForceSkiaRasterToggled, weld::ToggleButton&, void);
+ OUString m_sAutoStr;
+
+ 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);
@@ -132,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;
};
@@ -153,35 +181,46 @@ 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;
};
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTGDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 0468518f1638..2f389a7af571 100644
--- a/cui/source/options/opthtml.hxx
+++ b/cui/source/options/opthtml.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTHTML_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTHTML_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <svx/txencbox.hxx>
@@ -26,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);
@@ -51,13 +63,13 @@ 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;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 35d9b1a2299d..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"
@@ -39,11 +38,9 @@
#include <com/sun/star/task/InteractionHandler.hpp>
#include <sal/types.h>
-#include <sal/log.hxx>
#include <rtl/ustring.hxx>
#include <osl/file.hxx>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
@@ -54,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"
@@ -90,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();
}
}
-const char g_aProxyModePN[] = "ooInetProxyType";
-const char g_aHttpProxyPN[] = "ooInetHTTPProxyName";
-const char g_aHttpPortPN[] = "ooInetHTTPProxyPort";
-const char g_aHttpsProxyPN[] = "ooInetHTTPSProxyName";
-const char g_aHttpsPortPN[] = "ooInetHTTPSProxyPort";
-const char g_aFtpProxyPN[] = "ooInetFTPProxyName";
-const char g_aFtpPortPN[] = "ooInetFTPProxyPort";
-const char g_aNoProxyDescPN[] = "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)
{
@@ -129,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));
@@ -152,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 ));
@@ -172,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",
@@ -207,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();
@@ -215,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() );
}
@@ -256,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 );
@@ -273,14 +252,15 @@ void SvxProxyTabPage::ReadConfigDefaults_Impl()
}
catch (const beans::UnknownPropertyException &)
{
- SAL_WARN("cui.options", "SvxProxyTabPage::ReadConfigDefaults_Impl: UnknownPropertyException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
- catch (const css::lang::WrappedTargetException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::ReadConfigDefaults_Impl: WrappedTargetException caught" );
+ catch (const css::lang::WrappedTargetException &)
+ {
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
catch (const RuntimeException &)
{
- SAL_WARN("cui.options", "SvxProxyTabPage::ReadConfigDefaults_Impl: RuntimeException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
}
@@ -295,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);
@@ -304,14 +282,15 @@ void SvxProxyTabPage::RestoreConfigDefaults_Impl()
}
catch (const beans::UnknownPropertyException &)
{
- SAL_WARN("cui.options", "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
- catch (const css::lang::WrappedTargetException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" );
+ catch (const css::lang::WrappedTargetException &)
+ {
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
catch (const RuntimeException &)
{
- SAL_WARN("cui.options", "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
}
@@ -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()));
@@ -397,19 +377,19 @@ bool SvxProxyTabPage::FillItemSet(SfxItemSet* )
xChangesBatch->commitChanges();
}
catch (const css::lang::IllegalArgumentException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::FillItemSet: IllegalArgumentException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
catch (const beans::UnknownPropertyException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::FillItemSet: UnknownPropertyException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
catch (const beans::PropertyVetoException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::FillItemSet: PropertyVetoException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
catch (const css::lang::WrappedTargetException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::FillItemSet: WrappedTargetException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
catch (const RuntimeException &) {
- SAL_WARN("cui.options", "SvxProxyTabPage::FillItemSet: RuntimeException caught" );
+ TOOLS_WARN_EXCEPTION("cui.options", "" );
}
return bModified;
@@ -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& _rModfied )
+ 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 );
- _rModfied = true;
- }
- }
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "savepassword", "usemasterpassword" };
- return bModified;
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
}
+
+ // 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 4d434ce8d03d..e05a79be029b 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTINET2_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTINET2_HXX
+#pragma once
#include <memory>
#include <sfx2/tabdlg.hxx>
@@ -31,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;
@@ -69,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;
@@ -90,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;
@@ -101,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();
@@ -126,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;
};
@@ -154,10 +171,10 @@ 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;
};
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTINET2_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 16d30cf5bdce..cc89865bdd28 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -17,11 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/safeint.hxx>
#include <sal/config.h>
#include <sal/log.hxx>
+#include <cassert>
#include <memory>
-#include <vector>
#include <config_java.h>
@@ -32,7 +33,7 @@
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
-#include <svtools/miscopt.hxx>
+#include <rtl/bootstrap.hxx>
#include <strings.hrc>
#include <vcl/svapp.hxx>
@@ -44,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
@@ -60,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;
@@ -78,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"))
{
@@ -92,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 ) );
@@ -108,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 ) );
@@ -133,9 +140,9 @@ SvxJavaOptionsPage::~SvxJavaOptionsPage()
#endif
}
-IMPL_LINK_NOARG(SvxJavaOptionsPage, EnableHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxJavaOptionsPage, EnableHdl_Impl, weld::Toggleable&, void)
{
- bool bEnable = m_xJavaEnableCB->get_active();
+ bool bEnable = m_xJavaFrame->get_sensitive() && m_xJavaEnableCB->get_active();
m_xJavaList->set_sensitive(bEnable);
}
@@ -146,11 +153,7 @@ IMPL_LINK(SvxJavaOptionsPage, CheckHdl_Impl, const weld::TreeView::iter_col&, rR
IMPL_LINK_NOARG(SvxJavaOptionsPage, SelectHdl_Impl, weld::TreeView&, void)
{
- // set installation directory info
- OUString sLocation = m_xJavaList->get_selected_id();
- // tdf#80646 insert LTR mark after label
- OUString sInfo = m_sInstallText + u"\u200E" + sLocation;
- m_xJavaPathText->set_label(sInfo);
+ UpdateJavaPathText();
}
IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, weld::Button&, void)
@@ -158,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 );
@@ -166,7 +169,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, weld::Button&, void)
Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
if ( xAsyncDlg.is() )
- xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ xAsyncDlg->startExecuteModal( xDialogListener );
else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
AddFolder( xFolderPicker->getDirectory() );
}
@@ -266,7 +269,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, StartFolderPickerHdl, void*, void)
{
Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
if ( xAsyncDlg.is() )
- xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ xAsyncDlg->startExecuteModal( xDialogListener );
else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
AddFolder( xFolderPicker->getDirectory() );
}
@@ -338,6 +341,7 @@ void SvxJavaOptionsPage::LoadJREs()
if ( jfw_areEqualJavaInfo( pCmpInfo.get(), pSelectedJava.get() ) )
{
HandleCheckEntry(i);
+ UpdateJavaPathText();
break;
}
++i;
@@ -353,7 +357,7 @@ void SvxJavaOptionsPage::AddJRE( JavaInfo const * _pInfo )
#if HAVE_FEATURE_JAVA
int nPos = m_xJavaList->n_children();
m_xJavaList->append();
- m_xJavaList->set_toggle(nPos, TRISTATE_FALSE, 0);
+ m_xJavaList->set_toggle(nPos, TRISTATE_FALSE);
m_xJavaList->set_text(nPos, _pInfo->sVendor, 1);
m_xJavaList->set_text(nPos, _pInfo->sVersion, 2);
@@ -372,10 +376,20 @@ void SvxJavaOptionsPage::HandleCheckEntry(int nCheckedRow)
for (int i = 0, nCount = m_xJavaList->n_children(); i < nCount; ++i)
{
// we have radio button behavior -> so uncheck the other entries
- m_xJavaList->set_toggle(i, i == nCheckedRow ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ m_xJavaList->set_toggle(i, i == nCheckedRow ? TRISTATE_TRUE : TRISTATE_FALSE);
}
}
+void SvxJavaOptionsPage::UpdateJavaPathText()
+{
+ assert(m_xJavaList->get_selected_index() != -1);
+ // set installation directory info
+ OUString sLocation = m_xJavaList->get_selected_id();
+ // tdf#80646 insert LTR mark after label
+ OUString sInfo = m_sInstallText + u"\u200E" + sLocation;
+ m_xJavaPathText->set_label(sInfo);
+}
+
void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
{
#if HAVE_FEATURE_JAVA
@@ -418,20 +432,21 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
}
HandleCheckEntry(nPos);
+ UpdateJavaPathText();
bStartAgain = false;
}
else if ( JFW_E_NOT_RECOGNIZED == eErr )
{
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();
}
@@ -458,22 +473,56 @@ 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;
if ( m_xExperimentalCB->get_state_changed_from_saved() )
{
- SvtMiscOptions aMiscOpt;
- aMiscOpt.SetExperimentalMode( m_xExperimentalCB->get_active() );
+ std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::ExperimentalMode::set( m_xExperimentalCB->get_active(), xChanges );
+ xChanges->commit();
bModified = true;
RequestRestart( svtools::RESTART_REASON_EXP_FEATURES );
}
if ( m_xMacroCB->get_state_changed_from_saved() )
{
- SvtMiscOptions aMiscOpt;
- aMiscOpt.SetMacroRecorderMode(m_xMacroCB->get_active());
+ std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::MacroRecorderMode::set( m_xMacroCB->get_active(), xChanges );
+ xChanges->commit();
bModified = true;
}
@@ -500,7 +549,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
sal_uInt32 nCount = m_xJavaList->n_children();
for (sal_uInt32 i = 0; i < nCount; ++i)
{
- if (m_xJavaList->get_toggle(i, 0) == TRISTATE_TRUE)
+ if (m_xJavaList->get_toggle(i) == TRISTATE_TRUE)
{
JavaInfo const * pInfo;
if ( i < m_parJavaInfo.size() )
@@ -551,12 +600,19 @@ void SvxJavaOptionsPage::Reset( const SfxItemSet* /*rSet*/ )
ClearJavaInfo();
m_xJavaList->clear();
- SvtMiscOptions aMiscOpt;
-
#if HAVE_FEATURE_JAVA
bool bEnabled = false;
javaFrameworkError eErr = jfw_getEnabled( &bEnabled );
- if ( eErr != JFW_E_NONE )
+ if (eErr == JFW_E_DIRECT_MODE)
+ {
+ // direct mode disregards Java settings made here, so gray them out
+ m_xJavaFrame->set_sensitive(false);
+ // check whether a usable JRE was set
+ std::unique_ptr<JavaInfo> pSelectedJava;
+ eErr = jfw_getSelectedJRE( &pSelectedJava );
+ bEnabled = (eErr == JFW_E_NONE);
+ }
+ else if ( eErr != JFW_E_NONE )
bEnabled = false;
m_xJavaEnableCB->set_active(bEnabled);
EnableHdl_Impl(*m_xJavaEnableCB);
@@ -565,9 +621,9 @@ void SvxJavaOptionsPage::Reset( const SfxItemSet* /*rSet*/ )
m_xJavaEnableCB->set_sensitive(false);
#endif
- m_xExperimentalCB->set_active( aMiscOpt.IsExperimentalMode() );
+ m_xExperimentalCB->set_active( officecfg::Office::Common::Misc::ExperimentalMode::get() );
m_xExperimentalCB->save_state();
- m_xMacroCB->set_active(aMiscOpt.IsMacroRecorderMode());
+ m_xMacroCB->set_active( officecfg::Office::Common::Misc::MacroRecorderMode::get() );
m_xMacroCB->save_state();
m_aResetIdle.Start();
@@ -593,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 ) );
@@ -634,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();
@@ -680,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();
@@ -760,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();
@@ -785,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));
@@ -794,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));
@@ -807,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)
@@ -833,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));
@@ -842,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));
@@ -875,7 +942,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, SelectHdl_Impl, weld::TreeView&, void)
EnableRemoveButton();
}
-bool SvxJavaClassPathDlg::IsPathDuplicate( const OUString& _rPath )
+bool SvxJavaClassPathDlg::IsPathDuplicate( std::u16string_view _rPath )
{
bool bRet = false;
int nCount = m_xPathList->n_children();
@@ -904,6 +971,7 @@ OUString SvxJavaClassPathDlg::GetClassPath() const
return sPath.makeStringAndClear();
}
+#if HAVE_FEATURE_JAVA
void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
{
if ( m_sOldPath.isEmpty() )
@@ -911,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 0bfae107948f..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);
@@ -98,6 +100,7 @@ private:
void LoadJREs();
void AddJRE( JavaInfo const * _pInfo );
void HandleCheckEntry(int nCheckedRow);
+ void UpdateJavaPathText();
void AddFolder( const OUString& _rFolder );
void RequestRestart( svtools::RestartReason eReason );
@@ -107,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;
@@ -124,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);
@@ -184,7 +190,7 @@ private:
DECL_LINK(RemoveHdl_Impl, weld::Button&, void);
DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
- bool IsPathDuplicate(const OUString& _rPath);
+ bool IsPathDuplicate(std::u16string_view _rPath);
void EnableRemoveButton()
{
m_xRemoveBtn->set_sensitive(m_xPathList->get_selected_index() != -1);
@@ -198,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 ada93128e6e1..4ec9bd987462 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -17,10 +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>
@@ -28,7 +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>
@@ -41,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>
@@ -55,6 +63,7 @@
#include <ucbhelper/content.hxx>
+#include <set>
#include <vector>
#include <map>
@@ -65,15 +74,15 @@ using namespace css::uno;
using namespace css::linguistic2;
using namespace css::beans;
-const char cSpell[] = SN_SPELLCHECKER;
-const char cGrammar[] = SN_GRAMMARCHECKER;
-const char cHyph[] = SN_HYPHENATOR;
-const char cThes[] = SN_THESAURUS;
+constexpr OUString cSpell(SN_SPELLCHECKER);
+constexpr OUString cGrammar(SN_GRAMMARCHECKER);
+constexpr OUString cHyph(SN_HYPHENATOR);
+constexpr OUString cThes(SN_THESAURUS);
// static ----------------------------------------------------------------
static sal_Int32 lcl_SeqGetEntryPos(
- const Sequence< OUString > &rSeq, const OUString &rEntry )
+ const Sequence< OUString > &rSeq, std::u16string_view rEntry )
{
sal_Int32 i;
sal_Int32 nLen = rSeq.getLength();
@@ -125,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;}
@@ -189,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 {
@@ -324,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;
@@ -338,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;
@@ -355,9 +380,9 @@ public:
uno::Reference<XLinguServiceManager2> & GetManager() { return xLinguSrvcMgr; }
void SetChecked( const Sequence< OUString > &rConfiguredServices );
- void Reconfigure( const OUString &rDisplayName, bool bEnable );
+ 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; }
@@ -378,11 +403,11 @@ public:
// language.
Sequence< OUString > GetSortedImplNames( LanguageType nLang, sal_uInt8 nType );
- ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName );
+ ServiceInfo_Impl * GetInfoByImplName( std::u16string_view rSvcImplName );
};
-static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUString &rTxt )
+static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, std::u16string_view rTxt )
{
sal_Int32 nRes = -1;
sal_Int32 nLen = rSeq.getLength();
@@ -415,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;
@@ -447,7 +472,7 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang,
}
-ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImplName )
+ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( std::u16string_view rSvcImplName )
{
for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
{
@@ -463,37 +488,6 @@ ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImp
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 )
@@ -554,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(
@@ -577,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 );
}
}
@@ -600,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 );
}
}
@@ -622,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 );
}
}
@@ -644,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 );
@@ -728,9 +725,9 @@ bool SvxLinguData_Impl::AddRemove(
}
-void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable )
+void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEnable )
{
- DBG_ASSERT( !rDisplayName.isEmpty(), "empty DisplayName" );
+ DBG_ASSERT( !rDisplayName.empty(), "empty DisplayName" );
ServiceInfo_Impl *pInfo = nullptr;
for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
@@ -823,16 +820,18 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
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)
@@ -847,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);
@@ -870,8 +870,17 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
m_xLinguOptionsCLB->connect_changed( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
m_xLinguOptionsCLB->connect_row_activated(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
- if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
- m_xMoreDictsLink->hide();
+ m_xMoreDictsLink->connect_activate_link(LINK(this, SvxLinguTabPage, OnLinkClick));
+ if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
+ 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() );
@@ -915,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; // !!!!
@@ -998,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();
}
}
}
@@ -1042,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 );
@@ -1053,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;
}
@@ -1135,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);
}
@@ -1179,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;
@@ -1188,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;
@@ -1197,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;
@@ -1206,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;
@@ -1215,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;
@@ -1223,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;
@@ -1239,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();
@@ -1250,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();
@@ -1260,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;
@@ -1269,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();
@@ -1281,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)
@@ -1327,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 ))
@@ -1483,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");
}
}
@@ -1515,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");
}
}
@@ -1527,20 +1583,26 @@ void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
m_xLinguModulesCLB->hide();
m_xLinguModulesEditPB->hide();
- if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
- != SvtExtendedSecurityOptions::OPEN_NEVER )
+ if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER &&
+ !comphelper::LibreOfficeKit::isActive())
{
- m_xMoreDictsLink->show();
+ m_xMoreDictsBox->show();
}
}
}
+IMPL_STATIC_LINK_NOARG(SvxLinguTabPage, OnLinkClick, weld::LinkButton&, bool)
+{
+ comphelper::dispatchCommand(".uno:MoreDictionaries", {});
+ return true;
+}
+
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"))
@@ -1568,24 +1630,28 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
m_xPrioUpPB->set_sensitive( false );
m_xPrioDownPB->set_sensitive( false );
- if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
+ m_xMoreDictsLink->connect_activate_link(LINK(this, SvxEditModulesDlg, OnLinkClick));
+ if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
m_xMoreDictsLink->hide();
// set that we want the checkbox shown if spellchecking is available
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());
}
@@ -1593,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 )
@@ -1604,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);
@@ -1622,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;
@@ -1631,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);
@@ -1662,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)
@@ -1705,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
@@ -1714,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();
@@ -1756,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;
}
}
@@ -1770,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();
@@ -1807,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;
}
}
@@ -1821,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();
@@ -1857,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;
}
}
@@ -1871,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();
@@ -1907,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;
}
}
@@ -1961,4 +2061,10 @@ IMPL_LINK_NOARG(SvxEditModulesDlg, BackHdl_Impl, weld::Button&, void)
LangSelectHdl_Impl(nullptr);
}
+IMPL_STATIC_LINK_NOARG(SvxEditModulesDlg, OnLinkClick, weld::LinkButton&, bool)
+{
+ comphelper::dispatchCommand(".uno:MoreDictionaries", {});
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 d3f3b419a835..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))
{
}
};
@@ -76,15 +75,15 @@ namespace {
struct PathUserData_Impl
{
- sal_uInt16 nRealId;
- SfxItemState eState;
+ SvtPathOptions::Paths nRealId;
+ bool bItemStateSet;
OUString sUserPath;
OUString sWritablePath;
bool bReadOnly;
- explicit PathUserData_Impl(sal_uInt16 nId)
+ explicit PathUserData_Impl(SvtPathOptions::Paths nId)
: nRealId(nId)
- , eState(SfxItemState::UNKNOWN)
+ , bItemStateSet(false)
, bReadOnly(false)
{
}
@@ -92,7 +91,7 @@ struct PathUserData_Impl
struct Handle2CfgNameMapping_Impl
{
- sal_uInt16 m_nHandle;
+ SvtPathOptions::Paths m_nHandle;
const char* m_pCfgName;
};
@@ -100,27 +99,27 @@ struct Handle2CfgNameMapping_Impl
Handle2CfgNameMapping_Impl const Hdl2CfgMap_Impl[] =
{
- { SvtPathOptions::PATH_AUTOCORRECT, "AutoCorrect" },
- { SvtPathOptions::PATH_AUTOTEXT, "AutoText" },
- { SvtPathOptions::PATH_BACKUP, "Backup" },
- { SvtPathOptions::PATH_GALLERY, "Gallery" },
- { SvtPathOptions::PATH_GRAPHIC, "Graphic" },
- { SvtPathOptions::PATH_TEMP, "Temp" },
- { SvtPathOptions::PATH_TEMPLATE, "Template" },
- { SvtPathOptions::PATH_WORK, "Work" },
- { SvtPathOptions::PATH_DICTIONARY, "Dictionary" },
- { SvtPathOptions::PATH_CLASSIFICATION, "Classification" },
+ { SvtPathOptions::Paths::AutoCorrect, "AutoCorrect" },
+ { SvtPathOptions::Paths::AutoText, "AutoText" },
+ { SvtPathOptions::Paths::Backup, "Backup" },
+ { SvtPathOptions::Paths::Gallery, "Gallery" },
+ { SvtPathOptions::Paths::Graphic, "Graphic" },
+ { SvtPathOptions::Paths::Temp, "Temp" },
+ { SvtPathOptions::Paths::Template, "Template" },
+ { SvtPathOptions::Paths::Work, "Work" },
+ { SvtPathOptions::Paths::Dictionary, "Dictionary" },
+ { SvtPathOptions::Paths::Classification, "Classification" },
#if OSL_DEBUG_LEVEL > 1
- { SvtPathOptions::PATH_LINGUISTIC, "Linguistic" },
+ { SvtPathOptions::Paths::Linguistic, "Linguistic" },
#endif
- { USHRT_MAX, nullptr }
+ { SvtPathOptions::Paths::LAST, nullptr }
};
-static OUString getCfgName_Impl( sal_uInt16 _nHandle )
+static OUString getCfgName_Impl( SvtPathOptions::Paths _nHandle )
{
OUString sCfgName;
sal_uInt16 nIndex = 0;
- while ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle != USHRT_MAX )
+ while ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle != SvtPathOptions::Paths::LAST )
{
if ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle == _nHandle )
{
@@ -136,16 +135,16 @@ static OUString getCfgName_Impl( sal_uInt16 _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());
@@ -159,22 +158,22 @@ static OUString Convert_Impl( const OUString& rValue )
// functions -------------------------------------------------------------
-static bool IsMultiPath_Impl( const sal_uInt16 nIndex )
+static bool IsMultiPath_Impl( const SvtPathOptions::Paths nIndex )
{
#if OSL_DEBUG_LEVEL > 1
- return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex ||
- SvtPathOptions::PATH_AUTOTEXT == nIndex ||
- SvtPathOptions::PATH_BASIC == nIndex ||
- SvtPathOptions::PATH_GALLERY == nIndex ||
- SvtPathOptions::PATH_TEMPLATE == nIndex );
+ return ( SvtPathOptions::Paths::AutoCorrect == nIndex ||
+ SvtPathOptions::Paths::AutoText == nIndex ||
+ SvtPathOptions::Paths::Basic == nIndex ||
+ SvtPathOptions::Paths::Gallery == nIndex ||
+ SvtPathOptions::Paths::Template == nIndex );
#else
- return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex ||
- SvtPathOptions::PATH_AUTOTEXT == nIndex ||
- SvtPathOptions::PATH_BASIC == nIndex ||
- SvtPathOptions::PATH_GALLERY == nIndex ||
- SvtPathOptions::PATH_TEMPLATE == nIndex ||
- SvtPathOptions::PATH_LINGUISTIC == nIndex ||
- SvtPathOptions::PATH_DICTIONARY == nIndex );
+ return ( SvtPathOptions::Paths::AutoCorrect == nIndex ||
+ SvtPathOptions::Paths::AutoText == nIndex ||
+ SvtPathOptions::Paths::Basic == nIndex ||
+ SvtPathOptions::Paths::Gallery == nIndex ||
+ SvtPathOptions::Paths::Template == nIndex ||
+ SvtPathOptions::Paths::Linguistic == nIndex ||
+ SvtPathOptions::Paths::Dictionary == nIndex );
#endif
}
@@ -195,16 +194,24 @@ SvxPathTabPage::SvxPathTabPage(weld::Container* pPage, weld::DialogController* p
m_xPathBox->get_height_rows(20));
m_xPathBox->connect_row_activated( LINK( this, SvxPathTabPage, DoubleClickPathHdl_Impl ) );
+ m_xPathBox->connect_column_clicked(LINK(this, SvxPathTabPage, HeaderBarClick));
m_xPathBox->connect_changed( LINK( this, SvxPathTabPage, PathSelect_Impl ) );
m_xPathBox->set_selection_mode(SelectionMode::Multiple);
xDialogListener->SetDialogClosedLink( LINK( this, SvxPathTabPage, DialogClosedHdl ) );
}
+IMPL_LINK(SvxPathTabPage, HeaderBarClick, int, nColumn, void)
+{
+ bool bSortAtoZ = !m_xPathBox->get_sort_order();
+ m_xPathBox->set_sort_order(bSortAtoZ);
+ m_xPathBox->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
+}
+
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,
@@ -213,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());
- sal_uInt16 nRealId = pPathImpl->nRealId;
- if (pPathImpl->eState == SfxItemState::SET)
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
+ SvtPathOptions::Paths nRealId = pPathImpl->nRealId;
+ if (pPathImpl->bItemStateSet )
SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath );
}
return true;
@@ -228,54 +243,56 @@ bool SvxPathTabPage::FillItemSet( SfxItemSet* )
void SvxPathTabPage::Reset( const SfxItemSet* )
{
m_xPathBox->clear();
+ m_xPathBox->make_unsorted();
std::unique_ptr<weld::TreeIter> xIter = m_xPathBox->make_iterator();
- for( sal_uInt16 i = 0; i <= sal_uInt16(SvtPathOptions::PATH_CLASSIFICATION); ++i )
+ for( sal_uInt16 i = 0; i <= sal_uInt16(SvtPathOptions::Paths::Classification); ++i )
{
// only writer uses autotext
- if ( i == SvtPathOptions::PATH_AUTOTEXT
+ if ( static_cast<SvtPathOptions::Paths>(i) == SvtPathOptions::Paths::AutoText
&& !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
continue;
- const char* pId = nullptr;
+ TranslateId pId;
- switch (i)
+ switch (static_cast<SvtPathOptions::Paths>(i))
{
- case SvtPathOptions::PATH_AUTOCORRECT:
- pId = RID_SVXSTR_KEY_AUTOCORRECT_DIR;
+ case SvtPathOptions::Paths::AutoCorrect:
+ pId = RID_CUISTR_KEY_AUTOCORRECT_DIR;
break;
- case SvtPathOptions::PATH_AUTOTEXT:
- pId = RID_SVXSTR_KEY_GLOSSARY_PATH;
+ case SvtPathOptions::Paths::AutoText:
+ pId = RID_CUISTR_KEY_GLOSSARY_PATH;
break;
- case SvtPathOptions::PATH_BACKUP:
- pId = RID_SVXSTR_KEY_BACKUP_PATH;
+ case SvtPathOptions::Paths::Backup:
+ pId = RID_CUISTR_KEY_BACKUP_PATH;
break;
- case SvtPathOptions::PATH_GALLERY:
- pId = RID_SVXSTR_KEY_GALLERY_DIR;
+ case SvtPathOptions::Paths::Gallery:
+ pId = RID_CUISTR_KEY_GALLERY_DIR;
break;
- case SvtPathOptions::PATH_GRAPHIC:
- pId = RID_SVXSTR_KEY_GRAPHICS_PATH;
+ case SvtPathOptions::Paths::Graphic:
+ pId = RID_CUISTR_KEY_GRAPHICS_PATH;
break;
- case SvtPathOptions::PATH_TEMP:
- pId = RID_SVXSTR_KEY_TEMP_PATH;
+ case SvtPathOptions::Paths::Temp:
+ pId = RID_CUISTR_KEY_TEMP_PATH;
break;
- case SvtPathOptions::PATH_TEMPLATE:
- pId = RID_SVXSTR_KEY_TEMPLATE_PATH;
+ case SvtPathOptions::Paths::Template:
+ pId = RID_CUISTR_KEY_TEMPLATE_PATH;
break;
- case SvtPathOptions::PATH_DICTIONARY:
- pId = RID_SVXSTR_KEY_DICTIONARY_PATH;
+ case SvtPathOptions::Paths::Dictionary:
+ pId = RID_CUISTR_KEY_DICTIONARY_PATH;
break;
- case SvtPathOptions::PATH_CLASSIFICATION:
- pId = RID_SVXSTR_KEY_CLASSIFICATION_PATH;
+ case SvtPathOptions::Paths::Classification:
+ pId = RID_CUISTR_KEY_CLASSIFICATION_PATH;
break;
#if OSL_DEBUG_LEVEL > 1
- case SvtPathOptions::PATH_LINGUISTIC:
- pId = RID_SVXSTR_KEY_LINGUISTIC_DIR;
+ case SvtPathOptions::Paths::Linguistic:
+ pId = RID_CUISTR_KEY_LINGUISTIC_DIR;
break;
#endif
- case SvtPathOptions::PATH_WORK:
- pId = RID_SVXSTR_KEY_WORK_PATH;
+ case SvtPathOptions::Paths::Work:
+ pId = RID_CUISTR_KEY_WORK_PATH;
break;
+ default: break;
}
if (pId)
@@ -287,7 +304,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
OUString sInternal, sUser, sWritable;
bool bReadOnly = false;
- GetPathList( i, sInternal, sUser, sWritable, bReadOnly );
+ GetPathList( static_cast<SvtPathOptions::Paths>(i), sInternal, sUser, sWritable, bReadOnly );
if (bReadOnly)
m_xPathBox->set_image(*xIter, RID_SVXBMP_LOCK);
@@ -308,17 +325,18 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
m_xPathBox->set_sensitive(*xIter, !bReadOnly, 1);
m_xPathBox->set_sensitive(*xIter, !bReadOnly, 2);
- PathUserData_Impl* pPathImpl = new PathUserData_Impl(i);
+ PathUserData_Impl* pPathImpl = new PathUserData_Impl(static_cast<SvtPathOptions::Paths>(i));
pPathImpl->sUserPath = sUser;
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);
}
}
m_xPathBox->columns_autosize();
+ m_xPathBox->make_sorted();
PathSelect_Impl(*m_xPathBox);
}
@@ -328,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();
@@ -339,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() )
{
@@ -352,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 );
@@ -392,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;
}
@@ -410,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;
@@ -437,9 +455,9 @@ 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::PATH_WORK == pPathImpl->nRealId )
+ if ( SvtPathOptions::Paths::Work == pPathImpl->nRealId )
{
// Remove view options entry so the new work path
// will be used for the next open dialog.
@@ -460,18 +478,18 @@ 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;
- sal_uInt16 nPos = pPathImpl->nRealId;
+ SvtPathOptions::Paths nPos = pPathImpl->nRealId;
OUString sInternal, sUser, sWritable;
bool bPickFile = false;
bool bReadOnly = false;
GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
sUser = pPathImpl->sUserPath;
sWritable = pPathImpl->sWritablePath;
- bPickFile = pPathImpl->nRealId == SvtPathOptions::PATH_CLASSIFICATION;
+ bPickFile = pPathImpl->nRealId == SvtPathOptions::Paths::Classification;
if (IsMultiPath_Impl(nPos))
{
@@ -519,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;
}
@@ -529,14 +547,14 @@ 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 ) );
Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
if ( xAsyncDlg.is() )
- xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ xAsyncDlg->startExecuteModal( xDialogListener );
else
{
short nRet = xFolderPicker->execute();
@@ -556,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)
{
@@ -583,7 +601,7 @@ IMPL_LINK( SvxPathTabPage, DialogClosedHdl, DialogClosedEvent*, pEvt, void )
}
void SvxPathTabPage::GetPathList(
- sal_uInt16 _nPathHandle, OUString& _rInternalPath,
+ SvtPathOptions::Paths _nPathHandle, OUString& _rInternalPath,
OUString& _rUserPath, OUString& _rWritablePath, bool& _rReadOnly )
{
OUString sCfgName = getCfgName_Impl( _nPathHandle );
@@ -603,7 +621,7 @@ void SvxPathTabPage::GetPathList(
Sequence< OUString > aPathSeq;
if ( aAny >>= aPathSeq )
{
- long i, nCount = aPathSeq.getLength();
+ tools::Long i, nCount = aPathSeq.getLength();
const OUString* pPaths = aPathSeq.getConstArray();
for ( i = 0; i < nCount; ++i )
@@ -618,7 +636,7 @@ void SvxPathTabPage::GetPathList(
sCfgName + POSTFIX_USER);
if ( aAny >>= aPathSeq )
{
- long i, nCount = aPathSeq.getLength();
+ tools::Long i, nCount = aPathSeq.getLength();
const OUString* pPaths = aPathSeq.getConstArray();
for ( i = 0; i < nCount; ++i )
@@ -648,7 +666,7 @@ void SvxPathTabPage::GetPathList(
void SvxPathTabPage::SetPathList(
- sal_uInt16 _nPathHandle, const OUString& _rUserPath, const OUString& _rWritablePath )
+ SvtPathOptions::Paths _nPathHandle, std::u16string_view _rUserPath, const OUString& _rWritablePath )
{
OUString sCfgName = getCfgName_Impl( _nPathHandle );
@@ -667,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 564fabb730f6..ecf23f377ec3 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -17,9 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#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>
@@ -31,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 "General", "LoadSave"
-
struct SvxSaveTabPage_Impl
{
@@ -69,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)
@@ -94,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 ) )
@@ -173,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()
@@ -187,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( "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( "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( "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;
}
@@ -315,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[] =
{
@@ -342,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;
@@ -354,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 )
{
@@ -375,7 +423,7 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
{
for (sal_Int32 n = 0, nEntryCount = m_xDocTypeLB->get_count(); n < nEntryCount; ++n)
{
- int nData = m_xDocTypeLB->get_id(n).toInt32();
+ unsigned int nData = m_xDocTypeLB->get_id(n).toUInt32();
OUString sCommand = "getSortedFilterList():module=%1:iflags=" +
OUString::number(static_cast<int>(SfxFilterFlags::IMPORT|SfxFilterFlags::EXPORT)) +
":eflags=" +
@@ -390,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);
@@ -410,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 &)
@@ -421,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(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_xBackupCB->set_active(aSaveOpt.IsBackup());
- m_xBackupCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::Backup));
+ 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_xAutoSaveCB->set_active(aSaveOpt.IsAutoSave());
- m_xAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSave));
+ 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_xUserAutoSaveCB->set_active(aSaveOpt.IsUserAutoSave());
- m_xUserAutoSaveCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::UserAutoSave));
+ 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_xWarnAlienFormatCB->set_active(aSaveOpt.IsWarnAlienFormat());
- m_xWarnAlienFormatCB->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::WarnAlienFormat));
+ 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(aSaveOpt.GetAutoSaveTime());
- m_xAutoSaveEdit->set_sensitive(!aSaveOpt.IsReadOnly(SvtSaveOptions::EOption::AutoSaveTime));
+ 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();
@@ -466,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
{
@@ -485,7 +567,13 @@ IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Button&, rBox, void)
}
}
-static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, const OUString& rExtension)
+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;
const PropertyValue* pPropVal = rProperties.getConstArray();
@@ -498,7 +586,7 @@ static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, con
OUString sUIName;
if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
{
- if (!rExtension.isEmpty())
+ if (!rExtension.empty())
{
return sUIName + " (" + rExtension + ")";
}
@@ -559,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 2f39687cc87d..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()
@@ -91,8 +136,6 @@ SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
{
- OUString aDateStr;
- OUString aTimeStr;
OUString aText;
sal_Int64 lastChecked = 0;
@@ -120,14 +163,16 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
}
LanguageType eUILang = Application::GetSettings().GetUILanguageTag().getLanguageType();
- std::unique_ptr<SvNumberFormatter> pNumberFormatter(new SvNumberFormatter( ::comphelper::getProcessComponentContext(), eUILang ));
- Color* pColor = nullptr;
+ 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 );
+ OUString aDateStr;
pNumberFormatter->GetOutputString( aDate - rNullDate, nFormat, aDateStr, &pColor );
nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eUILang );
+ OUString aTimeStr;
pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTimeStr, &pColor );
pNumberFormatter.reset();
@@ -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 bd418991ce5e..48113c8079d6 100644
--- a/cui/source/options/optupdt.hxx
+++ b/cui/source/options/optupdt.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTUPDT_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_OPTUPDT_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <com/sun/star/container/XNameReplace.hpp>
@@ -29,6 +28,9 @@
class SvxOnlineUpdateTabPage : public SfxTabPage
{
private:
+ bool m_showTraditionalOnlineUpdate;
+ bool m_showMarOnlineUpdate;
+
OUString m_aNeverChecked;
OUString m_aLastCheckedTemplate;
@@ -37,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();
@@ -62,11 +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;
-};
-#endif
+ 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 a732053bab7f..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,11 +23,9 @@
#include <vcl/settings.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/virdev.hxx>
-
-#include <vector>
+#include <personas.hrc>
using namespace com::sun::star;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
// persona
@@ -35,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));
@@ -57,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
@@ -65,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;
}
@@ -96,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()
@@ -125,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());
@@ -150,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 072a89b8135f..786b22c7d7b3 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
+#pragma once
#include <sfx2/tabdlg.hxx>
#include <vector>
@@ -19,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.
@@ -34,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;
@@ -60,6 +63,4 @@ private:
DECL_LINK(DefaultPersona, weld::Button&, void);
};
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx
index 1370c93c254f..0ddd7f8f9f08 100644
--- a/cui/source/options/sdbcdriverenum.cxx
+++ b/cui/source/options/sdbcdriverenum.cxx
@@ -20,6 +20,7 @@
#include "sdbcdriverenum.hxx"
#include <comphelper/processfactory.hxx>
#include <osl/diagnose.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/DriverManager.hpp>
@@ -66,28 +67,28 @@ namespace offapp
}
catch(const Exception&)
{
- OSL_FAIL("ODriverEnumerationImpl::ODriverEnumerationImpl: caught an exception while enumerating the drivers!");
+ TOOLS_WARN_EXCEPTION( "cui.options", "ODriverEnumerationImpl::ODriverEnumerationImpl: caught an exception while enumerating the drivers!");
}
}
- 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 4632a8d5c60d..6ab767bb8044 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -18,11 +18,16 @@
*/
#include <memory>
+#include <string_view>
+
#include <config_features.h>
#include <config_feature_opencl.h>
#include <config_feature_desktop.h>
#include <config_gpgme.h>
+#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Writer.hxx>
+
#include <svx/dialogs.hrc>
#include <svx/svxids.hrc>
@@ -58,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>
@@ -68,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>
@@ -85,25 +97,24 @@
#include <sfx2/viewfrm.hxx>
#include <svl/flagitem.hxx>
#include <svl/intitem.hxx>
-#include <svl/languageoptions.hxx>
-#include <svtools/helpopt.hxx>
-#include <svtools/miscopt.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/misccfg.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>
#include <vcl/window.hxx>
#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;
@@ -114,7 +125,7 @@ using namespace ::com::sun::star::util;
LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = nullptr;
// some stuff for easier changes for SvtViewOptions
-const OUString VIEWOPT_DATANAME = "page data";
+constexpr OUString VIEWOPT_DATANAME = u"page data"_ustr;
static void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
{
@@ -134,7 +145,7 @@ namespace {
struct ModuleToGroupNameMap_Impl
{
- OUStringLiteral m_pModule;
+ std::u16string_view m_pModule;
OUString m_sGroupName;
sal_uInt16 m_nNodeId;
};
@@ -142,21 +153,21 @@ struct ModuleToGroupNameMap_Impl
static ModuleToGroupNameMap_Impl ModuleMap[] =
{
- { "ProductName", OUString(), SID_GENERAL_OPTIONS },
- { "LanguageSettings", OUString(), SID_LANGUAGE_OPTIONS },
- { "Internet", OUString(), SID_INET_DLG },
- { "LoadSave", OUString(), SID_FILTER_DLG },
- { "Writer", OUString(), SID_SW_EDITOPTIONS },
- { "WriterWeb", OUString(), SID_SW_ONLINEOPTIONS },
- { "Math", OUString(), SID_SM_EDITOPTIONS },
- { "Calc", OUString(), SID_SC_EDITOPTIONS },
- { "Impress", OUString(), SID_SD_EDITOPTIONS },
- { "Draw", OUString(), SID_SD_GRAPHIC_OPTIONS },
- { "Charts", OUString(), SID_SCH_EDITOPTIONS },
- { "Base", OUString(), SID_SB_STARBASEOPTIONS },
+ { u"ProductName", OUString(), SID_GENERAL_OPTIONS },
+ { u"LanguageSettings", OUString(), SID_LANGUAGE_OPTIONS },
+ { u"Internet", OUString(), SID_INET_DLG },
+ { u"LoadSave", OUString(), SID_FILTER_DLG },
+ { u"Writer", OUString(), SID_SW_EDITOPTIONS },
+ { u"WriterWeb", OUString(), SID_SW_ONLINEOPTIONS },
+ { u"Math", OUString(), SID_SM_EDITOPTIONS },
+ { u"Calc", OUString(), SID_SC_EDITOPTIONS },
+ { u"Impress", OUString(), SID_SD_EDITOPTIONS },
+ { u"Draw", OUString(), SID_SD_GRAPHIC_OPTIONS },
+ { u"Charts", OUString(), SID_SCH_EDITOPTIONS },
+ { u"Base", OUString(), SID_SB_STARBASEOPTIONS },
};
-static void setGroupName( const OUString& rModule, const OUString& rGroupName )
+static void setGroupName( std::u16string_view rModule, const OUString& rGroupName )
{
for (ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
{
@@ -168,7 +179,7 @@ static void setGroupName( const OUString& rModule, const OUString& rGroupName )
}
}
-static OUString getGroupName( const OUString& rModule, bool bForced )
+static OUString getGroupName( std::u16string_view rModule, bool bForced )
{
OUString sGroupName;
for (const ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
@@ -182,19 +193,19 @@ static OUString getGroupName( const OUString& rModule, bool bForced )
if ( sGroupName.isEmpty() && bForced )
{
- if ( rModule == "Writer" )
+ if ( rModule == u"Writer" )
sGroupName = CuiResId(SID_SW_EDITOPTIONS_RES[0].first);
- else if ( rModule == "WriterWeb" )
+ else if ( rModule == u"WriterWeb" )
sGroupName = CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first);
- else if ( rModule == "Calc" )
+ else if ( rModule == u"Calc" )
sGroupName = CuiResId(SID_SC_EDITOPTIONS_RES[0].first);
- else if ( rModule == "Impress" )
+ else if ( rModule == u"Impress" )
sGroupName = CuiResId(SID_SD_EDITOPTIONS_RES[0].first);
- else if ( rModule == "Draw" )
+ else if ( rModule == u"Draw" )
sGroupName = CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first);
- else if ( rModule == "Math" )
+ else if ( rModule == u"Math" )
sGroupName = CuiResId(SID_SM_EDITOPTIONS_RES[0].first);
- else if ( rModule == "Base" )
+ else if ( rModule == u"Base" )
sGroupName = CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first);
}
return sGroupName;
@@ -206,7 +217,7 @@ static void deleteGroupNames()
rEntry.m_sGroupName.clear();
}
-static sal_uInt16 getGroupNodeId( const OUString& rModule )
+static sal_uInt16 getGroupNodeId( std::u16string_view rModule )
{
sal_uInt16 nNodeId = 0xFFFF;
for (const ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
@@ -223,42 +234,12 @@ static sal_uInt16 getGroupNodeId( const OUString& rModule )
namespace {
-class MailMergeCfg_Impl : public utl::ConfigItem
-{
-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;
-}
-
-void MailMergeCfg_Impl::ImplCommit()
+bool MailMergeCfgIsEmailSupported()
{
+ std::optional<bool> b = officecfg::Office::Writer::MailMergeWizard::EMailSupported::get();
+ return b.has_value() && *b;
}
-void MailMergeCfg_Impl::Notify( const css::uno::Sequence< OUString >& )
-{
}
//typedef SfxTabPage* (*FNCreateTabPage)(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet);
@@ -292,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;
@@ -446,11 +429,9 @@ struct OptionsPageInfo
explicit OptionsPageInfo( sal_uInt16 nId ) : m_nPageId( nId ) {}
};
-namespace {
-
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
@@ -461,69 +442,91 @@ 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 )
+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)
+ {
+ }
+};
-void OfaTreeOptionsDialog::InitWidgets()
+// 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)
{
- 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");
Size aSize(xTreeLB->get_approximate_digit_width() * 82, xTreeLB->get_height_rows(30));
#if HAVE_FEATURE_GPGME
- {
- // load this little .ui just to measure the height of an Entry
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), "cui/ui/namedialog.ui"));
- std::unique_ptr<weld::Entry> xEntry(xBuilder->weld_entry("name_entry"));
- // tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
- aSize.setHeight((xEntry->get_preferred_size().Height() + 6) * 14);
- }
+ // tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
+ aSize.setHeight((weld::GetMinimumEditHeight() + 6) * 14);
#endif
xTabBox->set_size_request(aSize.Width(), aSize.Height());
- xTreeLB->set_size_request(xTreeLB->get_approximate_digit_width() * 30, 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( OUString() );
+ LoadExtensionOptions( u"" );
if (bActivateLastSelection)
ActivateLastSelection();
-
- xTreeLB->set_accessible_name(m_xDialog->get_title());
}
// Ctor() with ExtensionId -----------------------------------------------
-OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, const OUString& rExtensionId)
- : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
- INI_LIST()
+OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, std::u16string_view rExtensionId)
+ : OfaTreeOptionsDialog(pParent, !rExtensionId.empty())
{
- InitWidgets();
-
- bIsFromExtensionManager = ( !rExtensionId.isEmpty() );
- InitTreeAndHandler();
LoadExtensionOptions( rExtensionId );
ActivateLastSelection();
}
-OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+void OfaTreeOptionsDialog::ImplDestroy()
{
xCurrentPageEntry.reset();
@@ -535,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();
@@ -571,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);
@@ -579,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 )
{
@@ -588,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;
}
@@ -601,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;
@@ -621,25 +629,30 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, ShowPageHdl_Impl, weld::TreeView&, void)
SelectHdl_Impl();
}
-IMPL_LINK_NOARG(OfaTreeOptionsDialog, BackHdl_Impl, weld::Button&, void)
+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();
}
-void OfaTreeOptionsDialog::ApplyOptions(bool deactivate)
+IMPL_LINK_NOARG(OfaTreeOptionsDialog, BackHdl_Impl, weld::Button&, void)
+{
+ ResetCurrentPageFromConfig();
+}
+
+void OfaTreeOptionsDialog::ApplyOptions()
{
std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
bool bEntry = xTreeLB->get_iter_first(*xEntry);
@@ -647,22 +660,19 @@ void OfaTreeOptionsDialog::ApplyOptions(bool deactivate)
{
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());
}
if ( pPageInfo->m_xExtPage )
{
- if ( deactivate )
- {
- pPageInfo->m_xExtPage->DeactivatePage();
- }
+ pPageInfo->m_xExtPage->DeactivatePage();
pPageInfo->m_xExtPage->SavePage();
}
if ( pPageInfo->m_xPage && RID_OPTPAGE_CHART_DEFCOLORS == pPageInfo->m_nPageId )
@@ -675,69 +685,397 @@ void OfaTreeOptionsDialog::ApplyOptions(bool deactivate)
}
}
-IMPL_LINK_NOARG(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, void)
-{
- ApplyOptions(/*deactivate =*/false);
-
- if ( bNeedsRestart )
- {
- SolarMutexGuard aGuard;
- if (svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
- m_xDialog.get(), eRestartReason))
- m_xDialog->response(RET_OK);
- }
-}
-
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;
}
}
return true;
}
-IMPL_LINK_NOARG(OfaTreeOptionsDialog, OKHdl_Impl, weld::Button&, void)
+IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
{
+ bool bOkPressed = &rButton == xOkPB.get();
+
+ OptionsGroupInfo* pGroupInfo = nullptr;
+
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);
- OptionsGroupInfo* 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() )
{
DeactivateRC nLeave = pPageInfo->m_xPage->DeactivatePage(pGroupInfo->m_pOutItemSet.get());
if ( nLeave == DeactivateRC::KeepPage )
{
- // the page mustn't be left
- xTreeLB->select(*xCurrentPageEntry);
- return;
+ // the page mustn't be left, so return early
+ assert(xTreeLB->is_selected(*xCurrentPageEntry)); // presumably this must be true here
+ if (bOkPressed)
+ return;
}
}
- pPageInfo->m_xPage->set_visible(false);
}
}
- ApplyOptions(/*deactivate =*/ true);
- m_xDialog->response(RET_OK);
+ ApplyOptions();
+ ApplyItemSets();
+ utl::ConfigManager::storeConfigItems();
- if ( bNeedsRestart )
+ if (bOkPressed)
+ m_xDialog->response(RET_OK);
+ else
{
- SolarMutexGuard aGuard;
- ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
- m_pParent, eRestartReason);
+ // tdf#137930 rebuild the in and out itemsets to reflect the current
+ // post-apply state
+ if (pGroupInfo && pGroupInfo->m_pInItemSet)
+ {
+ // tdf#138596 seeing as the SfxTabPages keep pointers to the m_pInItemSet
+ // we update the contents of the existing SfxItemSets to match
+ // the current settings, rather than create new ones
+ auto xInItemSet = pGroupInfo->m_pShell
+ ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
+ : CreateItemSet( pGroupInfo->m_nDialogId );
+ pGroupInfo->m_pInItemSet->Set(*xInItemSet, false);
+ pGroupInfo->m_pOutItemSet->ClearItem();
+ }
+
+ // for the Apply case, now that the settings are saved to config,
+ // reload the current page so it knows what the config now states
+ ResetCurrentPageFromConfig();
+ // reselect it to undo possible DeactivatePage above
+ xCurrentPageEntry.reset();
+ SelectHdl_Impl();
+ }
+
+ 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)
+ {
+ 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
+ {
+ // 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;
+ }
}
}
@@ -749,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)
@@ -762,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, OKHdl_Impl ) );
- m_xDialog->connect_help( LINK( this, OfaTreeOptionsDialog, HelpHdl_Impl ) );
-}
-
void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
{
bIsForSetDocumentLanguage = false;
@@ -825,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 )
{
@@ -862,10 +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.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());
@@ -886,21 +1299,22 @@ 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() );
if ( nLeave == DeactivateRC::KeepPage )
{
- // we cannot leave this page
+ // we cannot leave this page, this is may be from a user clicking a different entry
+ // in the tree so reselect the current page
xTreeLB->select(*xCurrentPageEntry);
return;
}
@@ -913,18 +1327,11 @@ 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)
{
- if(!pGroupInfo->m_pInItemSet)
- pGroupInfo->m_pInItemSet = pGroupInfo->m_pShell
- ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
- : CreateItemSet( pGroupInfo->m_nDialogId );
- if(!pGroupInfo->m_pOutItemSet)
- pGroupInfo->m_pOutItemSet = std::make_unique<SfxItemSet>(
- *pGroupInfo->m_pInItemSet->GetPool(),
- pGroupInfo->m_pInItemSet->GetRanges());
+ InitItemSets(*pGroupInfo);
pPageInfo->m_xPage = ::CreateGeneralTabPage(pPageInfo->m_nPageId, xTabBox.get(), this, *pGroupInfo->m_pInItemSet);
@@ -936,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 )
@@ -991,62 +1399,62 @@ 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);
- utl::MiscCfg aMisc;
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, static_cast<sal_uInt16>(aMisc.GetYear2000()) ) );
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
}
else
- pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<sal_uInt16>(aMisc.GetYear2000()) ) );
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
// miscellaneous - Tabulator
- pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning()));
+ pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, officecfg::Office::Common::Print::Warning::NotFound::get()));
- SfxPrinterChangeFlags nFlag = aMisc.IsPaperSizeWarning() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE;
- nFlag |= aMisc.IsPaperOrientationWarning() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE;
+ SfxPrinterChangeFlags nFlag = officecfg::Office::Common::Print::Warning::PaperSize::get() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE;
+ nFlag |= officecfg::Office::Common::Print::Warning::PaperOrientation::get() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE;
pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlag) ));
}
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,
@@ -1054,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 );
@@ -1072,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
{
@@ -1113,37 +1518,36 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
}
break;
case SID_INET_DLG :
- pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
- svl::Items<SID_BASIC_ENABLED, SID_BASIC_ENABLED,
+ 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;
}
}
@@ -1156,50 +1560,52 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
{
case SID_GENERAL_OPTIONS:
{
- utl::MiscCfg aMisc;
- const SfxPoolItem* pItem = nullptr;
- SfxItemSet aOptSet(SfxGetpApp()->GetPool(), svl::Items<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER>{} );
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+
+ 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 });
}
- aMisc.SetYear2000(nY2K);
+ officecfg::Office::Common::DateFormat::TwoDigitYear::set(nY2K, batch);
}
-
// evaluate print
+ 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_NOTFOUND_WARN, false, &pItem))
- aMisc.SetNotFoundWarning(static_cast<const SfxBoolItem*>(pItem)->GetValue());
-
- 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);
- aMisc.SetPaperSizeWarning(bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_SIZE ));
- aMisc.SetPaperOrientationWarning(bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION ));
+ 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);
+ officecfg::Office::Common::Print::Warning::PaperOrientation::set(bPaperOrientationWarning, batch);
}
// 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();
}
break;
case SID_LANGUAGE_OPTIONS :
@@ -1209,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:
@@ -1223,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;
}
@@ -1236,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;
@@ -1252,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;
}
@@ -1295,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 );
@@ -1325,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("ProductName", CuiResId(SID_GENERAL_OPTIONS_RES[0].first));
+ 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)
{
@@ -1346,68 +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())
{
- SvtMiscOptions aMiscOpt;
- if( ! aMiscOpt.IsExperimentalMode() )
- 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( "LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) );
+ 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("LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first));
+ 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);
+ }
}
}
+}
- OUString aFactory = getCurrentFactory_Impl( _xFrame );
- DBG_ASSERT( GetModuleIdentifier( _xFrame ) == aFactory, "S H I T!!!" );
+void OfaTreeOptionsDialog::writerOptions(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" );
- // Writer and Writer/Web options
SvtModuleOptions aModuleOpt;
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
{
@@ -1420,42 +1855,109 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) )
{
if ( aFactory == "com.sun.star.text.WebDocument" )
- setGroupName( "WriterWeb", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
+ setGroupName( u"WriterWeb", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
else
- setGroupName( "Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
+ 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 ) )
{
@@ -1464,20 +1966,37 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) )
{
SfxModule* pScMod = SfxApplication::GetModule( SfxToolsModule::Calc );
- setGroupName( "Calc", CuiResId(SID_SC_EDITOPTIONS_RES[0].first) );
+ 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 );
@@ -1487,42 +2006,78 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) )
{
- setGroupName( "Impress", CuiResId(SID_SD_EDITOPTIONS_RES[0].first) );
+ 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" )
{
if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) )
{
- setGroupName( "Draw", CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first) );
+ 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 ) )
@@ -1532,17 +2087,35 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) )
{
SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math);
- setGroupName( "Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) );
+ 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 ) &&
@@ -1551,37 +2124,65 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
|| aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC )
) )
{
- setGroupName( "Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) );
+ 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( "Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) );
+ 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("Internet", CuiResId(SID_INET_DLG_RES[0].first));
+ 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 ) )
@@ -1591,43 +2192,92 @@ 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;
}
-void OfaTreeOptionsDialog::LoadExtensionOptions( const OUString& rExtensionId )
+void OfaTreeOptionsDialog::LoadExtensionOptions( std::u16string_view rExtensionId )
{
std::unique_ptr<Module> pModule;
// when called by Tools - Options then load nodes of active module
- if ( rExtensionId.isEmpty() )
+ if ( rExtensionId.empty() )
{
pModule = LoadModule( GetModuleIdentifier( Reference< XFrame >() ) );
}
@@ -1668,7 +2318,7 @@ OUString OfaTreeOptionsDialog::GetModuleIdentifier( const Reference< XFrame >& r
}
std::unique_ptr<Module> OfaTreeOptionsDialog::LoadModule(
- const OUString& rModuleIdentifier )
+ std::u16string_view rModuleIdentifier )
{
std::unique_ptr<Module> pModule;
Reference< XNameAccess > xSet(
@@ -1731,7 +2381,7 @@ std::unique_ptr<Module> OfaTreeOptionsDialog::LoadModule(
}
VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
- Module* pModule, const OUString& rExtensionId)
+ Module* pModule, std::u16string_view rExtensionId)
{
VectorOfNodes aOutNodeList;
@@ -1757,12 +2407,12 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
if ( sLabel.isEmpty() )
sLabel = sGroupName;
- OUString sTemp = getGroupName( sLabel, !rExtensionId.isEmpty() );
+ OUString sTemp = getGroupName( sLabel, !rExtensionId.empty() );
if ( !sTemp.isEmpty() )
sLabel = sTemp;
std::unique_ptr<OptionsNode> pNode(new OptionsNode(sNodeId, sLabel, bAllModules));
- if ( rExtensionId.isEmpty() && !isNodeActive( pNode.get(), pModule ) )
+ if ( rExtensionId.empty() && !isNodeActive( pNode.get(), pModule ) )
{
continue;
}
@@ -1789,7 +2439,7 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
xLeaveAccess->getByName( "GroupId" ) >>= sLeafGrpId;
xLeaveAccess->getByName( "GroupIndex" ) >>= nLeafGrpIdx;
- if ( rExtensionId.isEmpty() || sId == rExtensionId )
+ if ( rExtensionId.empty() || sId == rExtensionId )
{
std::unique_ptr<OptionsLeaf> pLeaf(new OptionsLeaf(
sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx ));
@@ -1860,7 +2510,7 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
return aOutNodeList;
}
-static sal_uInt16 lcl_getGroupId( const OUString& rGroupName, const weld::TreeView& rTreeLB )
+static sal_uInt16 lcl_getGroupId( std::u16string_view rGroupName, const weld::TreeView& rTreeLB )
{
sal_uInt16 nRet = 0;
@@ -1929,28 +2579,19 @@ 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 ) );
- }
-
- short nRet = SfxOkDialogController::run();
-
- if( RET_OK == nRet )
- {
- ApplyItemSets();
- utl::ConfigManager::storeConfigItems();
+ pClamp.reset(new SvxDicListChgClamp(LinguMgr::GetDictionaryList()));
}
- return nRet;
+ return SfxOkDialogController::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 62f08298db8e..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"
@@ -28,14 +28,15 @@ TSAURLsDialog::TSAURLsDialog(weld::Window* pParent)
m_xURLListBox->get_height_rows(8));
m_xOKBtn->set_sensitive(false);
- m_xAddBtn->connect_clicked( LINK( this, TSAURLsDialog, AddHdl_Impl ) );
- m_xDeleteBtn->connect_clicked( LINK( this, TSAURLsDialog, DeleteHdl_Impl ) );
- m_xOKBtn->connect_clicked( LINK( this, TSAURLsDialog, OKHdl_Impl ) );
- m_xURLListBox->connect_changed( LINK( this, TSAURLsDialog, SelectHdl ) );
+ m_xAddBtn->connect_clicked(LINK(this, TSAURLsDialog, AddHdl_Impl));
+ m_xDeleteBtn->connect_clicked(LINK(this, TSAURLsDialog, DeleteHdl_Impl));
+ m_xOKBtn->connect_clicked(LINK(this, TSAURLsDialog, OKHdl_Impl));
+ m_xURLListBox->connect_changed(LINK(this, TSAURLsDialog, SelectHdl));
try
{
- std::optional<css::uno::Sequence<OUString>> aUserSetTSAURLs(officecfg::Office::Common::Security::Scripting::TSAURLs::get());
+ std::optional<css::uno::Sequence<OUString>> aUserSetTSAURLs(
+ officecfg::Office::Common::Security::Scripting::TSAURLs::get());
if (aUserSetTSAURLs)
{
const css::uno::Sequence<OUString>& rUserSetTSAURLs = *aUserSetTSAURLs;
@@ -45,7 +46,7 @@ TSAURLsDialog::TSAURLsDialog(weld::Window* pParent)
}
}
}
- catch (const uno::Exception &)
+ catch (const uno::Exception&)
{
TOOLS_WARN_EXCEPTION("cui.options", "TSAURLsDialog::TSAURLsDialog()");
}
@@ -58,17 +59,17 @@ TSAURLsDialog::TSAURLsDialog(weld::Window* pParent)
IMPL_LINK_NOARG(TSAURLsDialog, OKHdl_Impl, weld::Button&, void)
{
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Security::Scripting::TSAURLs::set(comphelper::containerToSequence(m_aURLs), batch);
+ officecfg::Office::Common::Security::Scripting::TSAURLs::set(
+ comphelper::containerToSequence(m_aURLs), batch);
batch->commit();
m_xDialog->response(RET_OK);
}
-TSAURLsDialog::~TSAURLsDialog()
-{
-}
+TSAURLsDialog::~TSAURLsDialog() {}
void TSAURLsDialog::AddTSAURL(const OUString& rURL)
{
@@ -87,16 +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));
+ ScopedVclPtr<AbstractSvxNameDialog> pDlg(
+ 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/tsaurls.hxx b/cui/source/options/tsaurls.hxx
index ddec756bdda4..8fb1d049072b 100644
--- a/cui/source/options/tsaurls.hxx
+++ b/cui/source/options/tsaurls.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_TSAURLS_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_TSAURLS_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -39,6 +38,4 @@ public:
virtual ~TSAURLsDialog() override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 1d3abe82f860..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));
@@ -178,18 +181,16 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl, weld::Button&, void)
OUString aURL = m_xPasswordsLB->get_text(nEntry, 0);
OUString aUserName = m_xPasswordsLB->get_text(nEntry, 1);
- ::comphelper::SimplePasswordRequest* pPasswordRequest
+ rtl::Reference<::comphelper::SimplePasswordRequest> pPasswordRequest
= new ::comphelper::SimplePasswordRequest;
- uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest );
uno::Reference< task::XInteractionHandler > xInteractionHandler =
task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), m_xDialog->GetXWindow());
- xInteractionHandler->handle( rRequest );
+ xInteractionHandler->handle( pPasswordRequest );
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/options/webconninfo.hxx b/cui/source/options/webconninfo.hxx
index 95d524c8a3bc..6c52d2163100 100644
--- a/cui/source/options/webconninfo.hxx
+++ b/cui/source/options/webconninfo.hxx
@@ -15,8 +15,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_OPTIONS_WEBCONNINFO_HXX
-#define INCLUDED_CUI_SOURCE_OPTIONS_WEBCONNINFO_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -49,6 +48,4 @@ namespace svx
}
-#endif // INCLUDED_CUI_SOURCE_OPTIONS_WEBCONNINFO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 ef413c52d54d..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,28 +32,28 @@
#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>
+#include <o3tl/temporary.hxx>
#include <osl/diagnose.h>
#include <tools/debug.hxx>
#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 )
@@ -102,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 );
@@ -162,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));
@@ -179,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);
@@ -218,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);
@@ -258,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);
@@ -268,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 );
@@ -328,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,
@@ -348,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));
@@ -395,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,
@@ -449,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;
@@ -462,13 +481,13 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* )
pOpt->bChgEnumNum = bCheck;
bModified |= aBulletFont != pOpt->aBulletFont;
pOpt->aBulletFont = aBulletFont;
- bModified |= !comphelper::string::equals(sBulletChar, pOpt->cBullet);
- pOpt->cBullet = sBulletChar[0];
+ bModified |= sBulletChar != OUString(&pOpt->cBullet, 1);
+ pOpt->cBullet = sBulletChar.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
bModified |= aByInputBulletFont != pOpt->aByInputBulletFont;
- bModified |= !comphelper::string::equals(sByInputBulletChar, pOpt->cByInputBullet);
+ bModified |= sByInputBulletChar != OUString(&pOpt->cByInputBullet, 1);
pOpt->aByInputBulletFont = aByInputBulletFont;
- pOpt->cByInputBullet = sByInputBulletChar[0];
+ pOpt->cByInputBullet = sByInputBulletChar.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
bCheck = m_xCheckLB->get_toggle(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST) == TRISTATE_TRUE;
bModified |= pOpt->bRightMargin != bCheck;
@@ -480,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;
@@ -534,10 +557,10 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
const ACFlags nFlags = pAutoCorrect->GetFlags();
aBulletFont = pOpt->aBulletFont;
- sBulletChar = OUString(pOpt->cBullet);
+ sBulletChar = OUString(&pOpt->cBullet, 1);
aByInputBulletFont = pOpt->aByInputBulletFont;
- sByInputBulletChar = OUString( pOpt->cByInputBullet );
+ sByInputBulletChar = OUString(&pOpt->cByInputBullet, 1);
nPercent = pOpt->nRightMargin;
sMargin = unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag());
@@ -552,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 );
@@ -559,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);
@@ -577,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);
@@ -586,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);
@@ -595,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();
@@ -626,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())
@@ -661,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)
@@ -692,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);
@@ -716,7 +744,6 @@ OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
aDoubleStringTable.clear();
aChangesTable.clear();
- pCompareClass.reset();
pCharClass.reset();
}
@@ -764,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;
}
@@ -801,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;
});
}
@@ -826,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);
@@ -836,7 +863,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
{
aFormatText.insert(rDouble.sShort);
}
- }, &m_aReplaceFixedWidths);
+ }, nullptr, &m_aReplaceFixedWidths);
}
else
{
@@ -852,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);
@@ -862,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);
}
@@ -898,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);
}
}
@@ -913,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)
@@ -960,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;
@@ -990,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);
}
@@ -1029,7 +1052,7 @@ bool OfaAutocorrReplacePage::NewDelHdl(const weld::Widget* pBtn)
DeleteEntry(m_xReplaceTLB->get_text(nEntry, 0), m_xReplaceTLB->get_text(nEntry, 1));
m_xReplaceTLB->remove(nEntry);
ModifyHdl(*m_xShortED);
- return false;
+ return true;
}
}
@@ -1055,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;
@@ -1064,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);
@@ -1108,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;
@@ -1175,7 +1198,7 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, weld::Entry&, rEdt, void)
m_xNewReplacePB->set_sensitive(bEnableNew);
}
-static bool lcl_FindInArray(std::vector<OUString>& rStrings, const OUString& rString)
+static bool lcl_FindInArray(std::vector<OUString>& rStrings, std::u16string_view rString)
{
for (auto const& elem : rStrings)
{
@@ -1189,6 +1212,7 @@ static bool lcl_FindInArray(std::vector<OUString>& rStrings, const OUString& rSt
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"))
@@ -1208,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));
@@ -1228,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,
@@ -1258,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)
{
@@ -1270,7 +1292,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
if( !lcl_FindInArray(rArrays.aDoubleCapsStrings, aString))
{
- pWrdList->erase(i);
+ pWrdList->erase_at(i);
}
}
@@ -1278,7 +1300,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
{
pWrdList->insert(elem);
}
- pAutoCorrect->SaveWrdSttExceptList(eCurLang);
+ pAutoCorrect->SaveWordStartExceptList(eCurLang);
}
SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang);
@@ -1292,7 +1314,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
OUString aString = (*pCplList)[ --i ];
if( !lcl_FindInArray(rArrays.aAbbrevStrings, aString))
{
- pCplList->erase(i);
+ pCplList->erase_at(i);
}
}
@@ -1307,7 +1329,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
}
aStringsTable.clear();
- SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang);
+ SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWordStartExceptList(eLang);
if(pWrdList)
{
@@ -1318,7 +1340,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
OUString aString = (*pWrdList)[ --i ];
if (m_xDoubleCapsLB->find_text(aString) == -1)
{
- pWrdList->erase(i);
+ pWrdList->erase_at(i);
}
}
nCount = m_xDoubleCapsLB->n_children();
@@ -1326,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);
@@ -1339,7 +1361,7 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* )
OUString aString = (*pCplList)[ --i ];
if (m_xAbbrevLB->find_text(aString) == -1)
{
- pCplList->erase(i);
+ pCplList->erase_at(i);
}
}
sal_Int32 nAbbrevCount = m_xAbbrevLB->n_children();
@@ -1352,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;
}
@@ -1363,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);
}
@@ -1404,9 +1426,8 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(bool bFromReset,
}
m_xDoubleCapsLB->clear();
m_xAbbrevLB->clear();
- OUString sTemp;
- m_xAbbrevED->set_text(sTemp);
- m_xDoubleCapsED->set_text(sTemp);
+ m_xAbbrevED->set_text("");
+ m_xDoubleCapsED->set_text("");
if(aStringsTable.find(eLang) != aStringsTable.end())
{
@@ -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();
}
@@ -1451,14 +1472,13 @@ IMPL_LINK(OfaAutocorrExceptPage, NewDelButtonHdl, weld::Button&, rBtn, void)
IMPL_LINK(OfaAutocorrExceptPage, NewDelActionHdl, weld::Entry&, rEdit, bool)
{
- NewDelHdl(&rEdit);
- return false;
+ return NewDelHdl(&rEdit);
}
-void OfaAutocorrExceptPage::NewDelHdl(const weld::Widget* pBtn)
+bool OfaAutocorrExceptPage::NewDelHdl(const weld::Widget* pBtn)
{
if ((pBtn == m_xNewAbbrevPB.get() || pBtn == m_xAbbrevED.get())
- && !m_xAbbrevED->get_text().isEmpty())
+ && !m_xAbbrevED->get_text().isEmpty() && m_xNewAbbrevPB->get_sensitive())
{
m_xAbbrevLB->append_text(m_xAbbrevED->get_text());
ModifyHdl(*m_xAbbrevED);
@@ -1469,7 +1489,7 @@ void OfaAutocorrExceptPage::NewDelHdl(const weld::Widget* pBtn)
ModifyHdl(*m_xAbbrevED);
}
else if((pBtn == m_xNewDoublePB.get() || pBtn == m_xDoubleCapsED.get() )
- && !m_xDoubleCapsED->get_text().isEmpty())
+ && !m_xDoubleCapsED->get_text().isEmpty() && m_xNewDoublePB->get_sensitive())
{
m_xDoubleCapsLB->append_text(m_xDoubleCapsED->get_text());
ModifyHdl(*m_xDoubleCapsED);
@@ -1479,6 +1499,14 @@ void OfaAutocorrExceptPage::NewDelHdl(const weld::Widget* pBtn)
m_xDoubleCapsLB->remove_text(m_xDoubleCapsED->get_text());
ModifyHdl(*m_xDoubleCapsED);
}
+ else
+ {
+ // we didn't do anything, if this was because of 'activate' in an
+ // entry then let it continue to close the dialog like the replace
+ // page does
+ return false;
+ }
+ return true;
}
IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, weld::TreeView&, rBox, void)
@@ -1503,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);
@@ -1511,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);
@@ -1544,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)
@@ -1579,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();
}
@@ -1786,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();
@@ -1912,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[] = {
@@ -1958,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;
@@ -1970,19 +1999,19 @@ bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
bModified |= pOpt->bAutoCmpltKeepList != bCheck;
pOpt->bAutoCmpltKeepList = bCheck;
bCheck = m_xCBAppendSpace->get_active();
- bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck;
- pOpt->bAutoCmpltAppendBlanc = bCheck;
+ bModified |= pOpt->bAutoCmpltAppendBlank != bCheck;
+ pOpt->bAutoCmpltAppendBlank = bCheck;
bCheck = m_xCBAsTip->get_active();
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)
@@ -2014,7 +2043,7 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet* )
m_xCBActiv->set_active( pOpt->bAutoCompleteWords );
m_xCBCollect->set_active( pOpt->bAutoCmpltCollectWords );
m_xCBRemoveList->set_active( !pOpt->bAutoCmpltKeepList ); //inverted value!
- m_xCBAppendSpace->set_active( pOpt->bAutoCmpltAppendBlanc );
+ m_xCBAppendSpace->set_active( pOpt->bAutoCmpltAppendBlank );
m_xCBAsTip->set_active( pOpt->bAutoCmpltShowAsTip );
m_xNFMinWordlen->set_value( pOpt->nAutoCmpltWordLen );
@@ -2043,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);
}
}
@@ -2069,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);
@@ -2077,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())
@@ -2094,7 +2123,7 @@ IMPL_LINK(OfaAutoCompleteTabPage, CheckHdl, weld::ToggleButton&, rBox, void)
void OfaAutoCompleteTabPage::CopyToClipboard() const
{
auto rows = m_xLBEntries->get_selected_rows();
- if (!(m_pAutoCompleteList && !rows.empty()))
+ if (!m_pAutoCompleteList || rows.empty())
return;
rtl::Reference<TransferDataContainer> pCntnr = new TransferDataContainer;
@@ -2105,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)
@@ -2176,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 ) {}
};
@@ -2193,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;
}
@@ -2233,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)));
}
}
}
@@ -2243,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;
@@ -2254,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);
@@ -2275,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;
@@ -2305,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 eb72e3417a42..ccb94fe46854 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -17,7 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
#include <sfx2/objsh.hxx>
+#include <svx/strings.hrc>
#include <svx/svxids.hrc>
#include <strings.hrc>
@@ -32,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>
@@ -64,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)
{
@@ -81,11 +98,48 @@ static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton& rField)
rField.set_min(rField.normalize(nMin), FieldUnit::TWIP);
}
+// returns in pt
+static sal_Int64 lcl_GetMinLineWidth(SvxBorderLineStyle aStyle)
+{
+ switch (aStyle)
+ {
+ case SvxBorderLineStyle::NONE:
+ return 0;
+
+ case SvxBorderLineStyle::SOLID:
+ case SvxBorderLineStyle::DOTTED:
+ case SvxBorderLineStyle::DASHED:
+ case SvxBorderLineStyle::FINE_DASHED:
+ case SvxBorderLineStyle::DASH_DOT:
+ case SvxBorderLineStyle::DASH_DOT_DOT:
+ return 15;
+
+ // Double lines
+ 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;
+ case SvxBorderLineStyle::THICKTHIN_SMALLGAP: return 20;
+ case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP: return 15;
+ case SvxBorderLineStyle::THICKTHIN_LARGEGAP: return 15;
+
+ case SvxBorderLineStyle::EMBOSSED: return 15;
+ case SvxBorderLineStyle::ENGRAVED: return 15;
+
+ case SvxBorderLineStyle::OUTSET: return 10;
+ case SvxBorderLineStyle::INSET: return 10;
+
+ default:
+ return 15;
+ }
+}
+
// 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)
@@ -250,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"))
@@ -268,14 +324,15 @@ 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_xRemoveAdjcentCellBordersCB(m_xBuilder->weld_check_button("rmadjcellborders"))
- , m_xRemoveAdjcentCellBordersFT(m_xBuilder->weld_label("rmadjcellbordersft"))
+ , m_xRemoveAdjacentCellBordersCB(m_xBuilder->weld_check_button("rmadjcellborders"))
+ , m_xRemoveAdjacentCellBordersFT(m_xBuilder->weld_label("rmadjcellbordersft"))
{
- static std::vector<OUStringLiteral> aBorderImageIds;
+ static std::vector<OUString> aBorderImageIds;
if (aBorderImageIds.empty())
{
@@ -323,7 +380,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
for (auto const & rImageId : aBorderImageIds)
m_aBorderImgVec.emplace_back(StockImage::Yes, rImageId);
- static std::vector<OUStringLiteral> aShadowImageIds;
+ static std::vector<OUString> aShadowImageIds;
if (aShadowImageIds.empty())
{
if (comphelper::LibreOfficeKit::isActive())
@@ -351,7 +408,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
for (auto const & rImageId : aShadowImageIds)
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();
@@ -361,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
@@ -474,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);
@@ -512,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() )
@@ -521,14 +579,14 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
}
if( bIsCalcDoc )
{
- m_xRemoveAdjcentCellBordersCB->connect_toggled(LINK(this, SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl));
- m_xRemoveAdjcentCellBordersCB->show();
- m_xRemoveAdjcentCellBordersCB->set_sensitive(false);
+ m_xRemoveAdjacentCellBordersCB->connect_toggled(LINK(this, SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl));
+ m_xRemoveAdjacentCellBordersCB->show();
+ m_xRemoveAdjacentCellBordersCB->set_sensitive(false);
}
else
{
- m_xRemoveAdjcentCellBordersCB->hide();
- m_xRemoveAdjcentCellBordersFT->hide();
+ m_xRemoveAdjacentCellBordersCB->hide();
+ m_xRemoveAdjacentCellBordersFT->hide();
}
}
@@ -576,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
@@ -585,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
@@ -594,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));
@@ -604,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));
@@ -612,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);
@@ -620,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);
@@ -674,19 +732,19 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
m_xTopMF->set_min(0, FieldUnit::NONE);
m_xBottomMF->set_min(0, FieldUnit::NONE);
}
- long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT);
+ tools::Long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT);
SetMetricValue(*m_xLeftMF, nLeftDist, eCoreUnit);
- long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT);
+ tools::Long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT);
SetMetricValue(*m_xRightMF, nRightDist, eCoreUnit);
- long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP);
+ tools::Long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP);
SetMetricValue( *m_xTopMF, nTopDist, eCoreUnit );
- long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM);
+ tools::Long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM);
SetMetricValue( *m_xBottomMF, nBottomDist, eCoreUnit );
// if the distance is set with no active border line
// or it is null with an active border line
// no automatic changes should be made
- const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
+ const tools::Long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
bool bDiffDist = (nDefDist != nLeftDist ||
nDefDist != nRightDist ||
nDefDist != nTopDist ||
@@ -728,7 +786,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
{
// Do all visible lines show the same line widths?
- long nWidth;
+ tools::Long nWidth;
SvxBorderLineStyle nStyle;
bool bWidthEq = m_aFrameSel.GetVisibleWidth( nWidth, nStyle );
if( bWidthEq )
@@ -737,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
@@ -781,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)
+ {
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem(SID_HTML_MODE);
+ }
+ if(pHtmlModeItem)
{
- sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
if(nHtmlMode & HTMLMODE_ON)
{
// there are no shadows in Html-mode and only complete borders
@@ -816,8 +876,8 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
m_xSynchronizeCB->set_active(mbSync);
mbRemoveAdjacentCellBorders = false;
- m_xRemoveAdjcentCellBordersCB->set_active(false);
- m_xRemoveAdjcentCellBordersCB->set_sensitive(false);
+ m_xRemoveAdjacentCellBordersCB->set_active(false);
+ m_xRemoveAdjacentCellBordersCB->set_sensitive(false);
}
void SvxBorderTabPage::ChangesApplied()
@@ -844,24 +904,24 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
SfxItemPool* pPool = rCoreAttrs->GetPool();
- if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR))
+ if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR) &&
+ m_aFrameSel.GetFrameBorderState(svx::FrameBorderType::TLBR) != svx::FrameBorderState::DontCare)
{
- sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nBorderDiagId))
+ if (const SfxPoolItem* pOldItem = GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR))
{
- SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pItem));
+ SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pOldItem));
aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR));
rCoreAttrs->Put(aLineItem);
bAttrsChanged = true;
}
}
- if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR))
+ if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR) &&
+ m_aFrameSel.GetFrameBorderState(svx::FrameBorderType::BLTR) != svx::FrameBorderState::DontCare)
{
- sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nBorderDiagId))
+ if (const SfxPoolItem* pOldItem = GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR))
{
- SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pItem));
+ SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(pOldItem));
aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR));
rCoreAttrs->Put(aLineItem);
bAttrsChanged = true;
@@ -870,10 +930,9 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if (m_xShadowControls && m_xShadowControls->get_value_changed_from_saved())
{
- sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nShadowId))
+ if (const SfxPoolItem* pOldItem = GetOldItem(*rCoreAttrs, mnShadowSlot))
{
- const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(pItem);
+ const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(pOldItem);
rCoreAttrs->Put(m_xShadowControls->GetControlValue(rOldShadowItem));
bAttrsChanged = true;
}
@@ -881,10 +940,9 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if (m_xMarginControls && m_xMarginControls->get_value_changed_from_saved())
{
- sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
- if (const SfxPoolItem* pItem = rCoreAttrs->GetItem(nAlignMarginId))
+ if (const SfxPoolItem* pOldItem = GetOldItem(*rCoreAttrs, SID_ATTR_ALIGN_MARGIN))
{
- const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(pItem);
+ const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(pOldItem);
rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem));
bAttrsChanged = true;
}
@@ -892,37 +950,47 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if (m_xMergeAdjacentBordersCB->get_state_changed_from_saved())
{
- sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
auto nState = m_xMergeAdjacentBordersCB->get_state();
if (nState == TRISTATE_INDET)
+ {
+ sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhichIDFromSlotID(SID_SW_COLLAPSING_BORDERS);
rCoreAttrs->ClearItem(nMergeAdjacentBordersId);
+ }
else
{
- std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(rCoreAttrs->Get(nMergeAdjacentBordersId).Clone()));
- xNewItem->SetValue(static_cast<bool>(nState));
- rCoreAttrs->Put(std::move(xNewItem));
+ if (const SfxPoolItem* pOldItem = GetOldItem(*rCoreAttrs, SID_SW_COLLAPSING_BORDERS))
+ {
+ std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(pOldItem->Clone()));
+ xNewItem->SetValue(static_cast<bool>(nState));
+ rCoreAttrs->Put(std::move(xNewItem));
+ }
}
bAttrsChanged = true;
}
if (m_xMergeWithNextCB->get_state_changed_from_saved())
{
- sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
auto nState = m_xMergeWithNextCB->get_state();
if (nState == TRISTATE_INDET)
+ {
+ sal_uInt16 nMergeWithNextId = pPool->GetWhichIDFromSlotID(SID_ATTR_BORDER_CONNECT);
rCoreAttrs->ClearItem(nMergeWithNextId);
+ }
else
{
- std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(rCoreAttrs->Get(nMergeWithNextId).Clone()));
- xNewItem->SetValue(static_cast<bool>(nState));
- rCoreAttrs->Put(std::move(xNewItem));
+ if (const SfxPoolItem* pOldItem = GetOldItem(*rCoreAttrs, SID_ATTR_BORDER_CONNECT))
+ {
+ std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(pOldItem->Clone()));
+ xNewItem->SetValue(static_cast<bool>(nState));
+ rCoreAttrs->Put(std::move(xNewItem));
+ }
}
bAttrsChanged = true;
}
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 );
@@ -1163,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, 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, ModifyWidthHdl_Impl, weld::MetricSpinButton&, void)
+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(),
@@ -1182,20 +1271,76 @@ IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, weld::MetricSpinButton&,
IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
{
- sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
- nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
- nVal,
- m_xLineWidthMF->get_digits(),
- FieldUnit::POINT, MapUnit::MapTwip ));
- m_aFrameSel.SetStyleToSelection ( nVal,
+ 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(),
+ FieldUnit::POINT,
+ MapUnit::MapTwip));
+
+ const sal_Int64 nOldMinWidth = lcl_GetMinLineWidth(m_aFrameSel.getCurrentStyleLineStyle());
+ const sal_Int64 nNewMinWidth = lcl_GetMinLineWidth(m_xLbLineStyle->GetSelectEntryStyle());
+
+ // 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
+ 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)
+ {
+ const sal_Int64 nNewWidthPt = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
+ nNewWidth,
+ m_xLineWidthMF->get_digits(),
+ MapUnit::MapTwip,
+ 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
+ m_aFrameSel.SetStyleToSelection( nNewWidth,
m_xLbLineStyle->GetSelectEntryStyle() );
}
+
// ValueSet handling
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 },
@@ -1220,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,
@@ -1262,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
@@ -1282,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]);
@@ -1309,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*/ )
{
@@ -1321,46 +1486,49 @@ void SvxBorderTabPage::FillLineListBox_Impl()
static struct {
SvxBorderLineStyle mnStyle;
- long mnMinWidth;
SvtLineListBox::ColorFunc mpColor1Fn;
SvtLineListBox::ColorFunc mpColor2Fn;
SvtLineListBox::ColorDistFunc mpColorDistFn;
} const aLines[] = {
// Simple lines
- { SvxBorderLineStyle::SOLID, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::DOTTED, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::DASHED, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::FINE_DASHED, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::DASH_DOT, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::DASH_DOT_DOT, 0, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::SOLID, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::DOTTED, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::DASHED, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::FINE_DASHED, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::DASH_DOT, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::DASH_DOT_DOT, &sameColor, &sameColor, &sameDistColor },
// Double lines
- { SvxBorderLineStyle::DOUBLE, 10, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::DOUBLE_THIN, 10, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::THINTHICK_SMALLGAP, 20, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::THINTHICK_MEDIUMGAP, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::THINTHICK_LARGEGAP, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::THICKTHIN_SMALLGAP, 20, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::THICKTHIN_MEDIUMGAP, 0, &sameColor, &sameColor, &sameDistColor },
- { SvxBorderLineStyle::THICKTHIN_LARGEGAP, 0, &sameColor, &sameColor, &sameDistColor },
-
- { SvxBorderLineStyle::EMBOSSED, 15, &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor, &lcl_mediumColor },
- { SvxBorderLineStyle::ENGRAVED, 15, &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor, &lcl_mediumColor },
-
- { SvxBorderLineStyle::OUTSET, 10, &SvxBorderLine::lightColor, &SvxBorderLine::darkColor, &sameDistColor },
- { SvxBorderLineStyle::INSET, 10, &SvxBorderLine::darkColor, &SvxBorderLine::lightColor, &sameDistColor }
+ { SvxBorderLineStyle::DOUBLE, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::DOUBLE_THIN, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::THINTHICK_SMALLGAP, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::THINTHICK_MEDIUMGAP, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::THINTHICK_LARGEGAP, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::THICKTHIN_SMALLGAP, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::THICKTHIN_MEDIUMGAP, &sameColor, &sameColor, &sameDistColor },
+ { SvxBorderLineStyle::THICKTHIN_LARGEGAP, &sameColor, &sameColor, &sameDistColor },
+
+ { SvxBorderLineStyle::EMBOSSED, &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor, &lcl_mediumColor },
+ { SvxBorderLineStyle::ENGRAVED, &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor, &lcl_mediumColor },
+
+ { SvxBorderLineStyle::OUTSET, &SvxBorderLine::lightColor, &SvxBorderLine::darkColor, &sameDistColor },
+ { SvxBorderLineStyle::INSET, &SvxBorderLine::darkColor, &SvxBorderLine::lightColor, &sameDistColor }
};
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;
m_xLbLineStyle->InsertEntry(
- SvxBorderLine::getWidthImpl(aLines[i].mnStyle), aLines[i].mnStyle,
- aLines[i].mnMinWidth, aLines[i].mpColor1Fn, aLines[i].mpColor2Fn, aLines[i].mpColorDistFn);
+ SvxBorderLine::getWidthImpl(aLines[i].mnStyle),
+ aLines[i].mnStyle,
+ lcl_GetMinLineWidth(aLines[i].mnStyle),
+ aLines[i].mpColor1Fn,
+ aLines[i].mpColor2Fn,
+ aLines[i].mpColorDistFn);
}
sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
@@ -1440,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();
}
@@ -1474,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 ) ) )
{
@@ -1489,12 +1657,12 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset )
if( !bBorderDeletionReq && ( nPreset == IID_PRE_CELL_NONE || nPreset == IID_PRE_TABLE_NONE ) )
bBorderDeletionReq = true;
- m_xRemoveAdjcentCellBordersCB->set_sensitive(bBorderDeletionReq);
+ m_xRemoveAdjacentCellBordersCB->set_sensitive(bBorderDeletionReq);
if( !bBorderDeletionReq )
{
mbRemoveAdjacentCellBorders = false;
- m_xRemoveAdjcentCellBordersCB->set_active(false);
+ m_xRemoveAdjacentCellBordersCB->set_active(false);
}
}
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 8c7cef3cb816..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>
@@ -38,13 +39,13 @@
#include <editeng/wrlmitem.hxx>
#include <editeng/cmapitem.hxx>
#include <editeng/kernitem.hxx>
-#include <editeng/blinkitem.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>
@@ -57,73 +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 );
+ m_pImpl->m_aNoStyleText = CuiResId( RID_CUISTR_CHARNAME_NOSTYLE );
- SvtLanguageOptions aLanguageOptions;
- bool bShowCJK = aLanguageOptions.IsCJKFontEnabled();
- bool bShowCTL = aLanguageOptions.IsCTLFontEnabled();
- bool bShowNonWestern = bShowCJK || bShowCTL;
-
- 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 )
@@ -440,18 +404,21 @@ namespace
const SvxFontHeightItem& rOldItem = static_cast<const SvxFontHeightItem&>(_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich ));
// old value, scaled
- long nHeight;
+ tools::Long nHeight;
if ( _pFontSizeLB->IsPtRelative() )
- nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB->get_value() / 10) );
+ nHeight = rOldItem.GetHeight()
+ + o3tl::convert(_pFontSizeLB->get_value(), o3tl::Length::pt,
+ o3tl::Length::twip) / 10;
else
- nHeight = static_cast<long>(rOldItem.GetHeight() * _pFontSizeLB->get_value() / 100);
+ nHeight = static_cast<tools::Long>(rOldItem.GetHeight() * _pFontSizeLB->get_value() / 100);
// conversion twips for the example-window
aSize.setHeight(
ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), FieldUnit::TWIP ) );
}
else if ( !_pFontSizeLB->get_active_text().isEmpty() )
- aSize.setHeight( PointToTwips( static_cast<long>(_pFontSizeLB->get_value() / 10) ) );
+ aSize.setHeight(o3tl::convert(_pFontSizeLB->get_value(), o3tl::Length::pt,
+ o3tl::Length::twip) / 10);
else
aSize.setHeight( 200 ); // default 10pt
aFontMetrics.SetFontSize( aSize );
@@ -503,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)
{
@@ -555,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
{
@@ -583,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
@@ -692,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 )
{
@@ -709,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 )
@@ -767,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);
@@ -791,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;
@@ -806,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;
}
@@ -826,6 +812,8 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
break;
}
+ EnableFeatureButton(*pNameBox);
+
// save these settings
pNameBox->save_value();
pStyleBox->save_value();
@@ -1012,11 +1000,11 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
rSet.InvalidateItem(nWhich);
// FontSize
- long nSize = pSizeBox->get_value();
+ tools::Long nSize = pSizeBox->get_value();
if ( pSizeBox->get_active_text().isEmpty() ) // GetValue() returns the min-value
nSize = 0;
- long nSavedSize = pSizeBox->get_saved_value();
+ tools::Long nSavedSize = pSizeBox->get_saved_value();
const bool bRel = pSizeBox->IsRelative();
switch ( eLangGrp )
@@ -1033,7 +1021,7 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET )
{
float fSize = static_cast<float>(nSize) / 10;
- long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) );
+ tools::Long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) );
if ( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() != static_cast<sal_uInt32>(nVal) )
bChanged = true;
}
@@ -1072,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();
@@ -1171,6 +1168,7 @@ void SvxCharNamePage::FontModifyHdl_Impl(const weld::Widget& rNameBox)
{
FillStyleBox_Impl(rNameBox);
FillSizeBox_Impl(rNameBox);
+ EnableFeatureButton(rNameBox);
}
}
@@ -1281,7 +1279,7 @@ void SvxCharNamePage::PageCreated(const SfxAllItemSet& aSet)
{
const SvxFontListItem* pFontListItem = aSet.GetItem<SvxFontListItem>(SID_ATTR_CHAR_FONTLIST, false);
const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false);
- const SfxUInt16Item* pDisalbeItem = aSet.GetItem<SfxUInt16Item>(SID_DISABLE_CTL, false);
+ const SfxUInt16Item* pDisableItem = aSet.GetItem<SfxUInt16Item>(SID_DISABLE_CTL, false);
if (pFontListItem)
SetFontList(*pFontListItem);
@@ -1294,8 +1292,8 @@ void SvxCharNamePage::PageCreated(const SfxAllItemSet& aSet)
// the writer uses SID_ATTR_BRUSH as font background
m_bPreviewBackgroundToCharacter = true;
}
- if (pDisalbeItem)
- DisableControls(pDisalbeItem->GetValue());
+ if (pDisableItem)
+ DisableControls(pDisableItem->GetValue());
}
// class SvxCharEffectsPage ----------------------------------------------
@@ -1305,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))
@@ -1318,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"))
@@ -1346,15 +1347,6 @@ void SvxCharEffectsPage::EnableNoneFontColor()
m_bEnableNoneFontColor = true;
}
-Color SvxCharEffectsPage::GetPreviewFontColor(const Color& rColor) const
-{
- if (rColor == COL_AUTO)
- return COL_BLACK;
- if (m_bEnableNoneFontColor && rColor == COL_NONE_COLOR)
- return COL_BLACK;
- return rColor;
-}
-
SvxCharEffectsPage::~SvxCharEffectsPage()
{
m_xUnderlineColorLB.reset();
@@ -1369,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
}
@@ -1408,12 +1402,12 @@ void SvxCharEffectsPage::Initialize()
m_xEffectsLB->set_active( 0 );
+ m_xHiddenBtn->connect_toggled(LINK(this, SvxCharEffectsPage, HiddenBtnClickHdl));
m_xIndividualWordsBtn->connect_toggled(LINK(this, SvxCharEffectsPage, CbClickHdl_Impl));
- Link<weld::ToggleButton&,void> aLink2 = LINK(this, SvxCharEffectsPage, TristClickHdl_Impl);
- m_xOutlineBtn->connect_toggled(aLink2);
- m_xShadowBtn->connect_toggled(aLink2);
+ 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();
@@ -1431,9 +1425,10 @@ void SvxCharEffectsPage::UpdatePreview_Impl()
SvxFont& rCTLFont = GetPreviewCTLFont();
const Color& rSelectedColor = m_xFontColorLB->GetSelectEntryColor();
- rFont.SetColor(GetPreviewFontColor(rSelectedColor));
- rCJKFont.SetColor(GetPreviewFontColor(rSelectedColor));
- rCTLFont.SetColor(GetPreviewFontColor(rSelectedColor));
+ rFont.SetColor(rSelectedColor);
+ rCJKFont.SetColor(rSelectedColor);
+ rCTLFont.SetColor(rSelectedColor);
+ m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO
FontLineStyle eUnderline = static_cast<FontLineStyle>(m_xUnderlineLB->get_active_id().toInt32());
FontLineStyle eOverline = static_cast<FontLineStyle>(m_xOverlineLB->get_active_id().toInt32());
@@ -1487,7 +1482,7 @@ void SvxCharEffectsPage::UpdatePreview_Impl()
rCTLFont.SetCaseMap( eCaps == SvxCaseMap::SmallCaps ? SvxCaseMap::NotMapped : eCaps );
}
- bool bWordLine = m_xIndividualWordsBtn->get_active();
+ bool bWordLine = StateToAttr( m_xIndividualWordsBtn->get_state() );
rFont.SetWordLineMode( bWordLine );
rCJKFont.SetWordLineMode( bWordLine );
rCTLFont.SetWordLineMode( bWordLine );
@@ -1523,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();
@@ -1544,22 +1538,23 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
const SvxColorItem& rItem = static_cast<const SvxColorItem&>(rSet.Get( nWhich ));
Color aColor = rItem.GetValue();
- rFont.SetColor(GetPreviewFontColor(aColor));
- rCJKFont.SetColor(GetPreviewFontColor(aColor));
- rCTLFont.SetColor(GetPreviewFontColor(aColor));
+ rFont.SetColor(aColor);
+ rCJKFont.SetColor(aColor);
+ rCTLFont.SetColor(aColor);
+ m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO
m_aPreviewWin.Invalidate();
Color aRGBColor = aColor;
- if (aRGBColor.GetTransparency() && aColor != COL_AUTO)
+ if (aRGBColor.IsTransparent() && aColor != COL_AUTO)
{
- aRGBColor.SetTransparency(0);
+ aRGBColor.SetAlpha(255);
}
m_xFontColorLB->SelectEntry(aRGBColor);
if (m_xFontTransparencyMtr->get_visible() && aColor != COL_AUTO)
{
- double fTransparency = aColor.GetTransparency() * 100.0 / 255;
+ double fTransparency = (255 - aColor.GetAlpha()) * 100.0 / 255;
m_xFontTransparencyMtr->set_value(basegfx::fround(fTransparency),
FieldUnit::PERCENT);
}
@@ -1577,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.SetTransparency(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);
@@ -1643,13 +1641,10 @@ void SvxCharEffectsPage::SelectHdl_Impl(const weld::ComboBox* pBox)
UpdatePreview_Impl();
}
-IMPL_LINK_NOARG(SvxCharEffectsPage, CbClickHdl_Impl, weld::ToggleButton&, void)
+IMPL_LINK(SvxCharEffectsPage, CbClickHdl_Impl, weld::Toggleable&, rToggle, void)
{
+ m_aIndividualWordsState.ButtonToggled(rToggle);
UpdatePreview_Impl();
-}
-
-IMPL_LINK_NOARG(SvxCharEffectsPage, TristClickHdl_Impl, weld::ToggleButton&, void)
-{
UpdatePreview_Impl();
}
@@ -1694,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
{
@@ -1734,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
{
@@ -1774,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
{
@@ -1805,15 +1800,17 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aIndividualWordsState.bTriStateEnabled = false;
m_xIndividualWordsBtn->hide();
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;
@@ -1825,6 +1822,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
rCJKFont.SetWordLineMode( rItem.GetValue() );
rCTLFont.SetWordLineMode( rItem.GetValue() );
+ m_aIndividualWordsState.bTriStateEnabled = false;
m_xIndividualWordsBtn->set_active(rItem.GetValue());
m_xIndividualWordsBtn->set_sensitive(bEnable);
break;
@@ -1853,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);
@@ -1884,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;
@@ -1914,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;
@@ -1939,15 +1935,17 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aOutlineState.bTriStateEnabled = false;
m_xOutlineBtn->hide();
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;
@@ -1955,6 +1953,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxContourItem& rItem = static_cast<const SvxContourItem&>(rSet->Get( nWhich ));
+ m_aOutlineState.bTriStateEnabled = false;
m_xOutlineBtn->set_state(static_cast<TriState>(rItem.GetValue()));
break;
}
@@ -1967,15 +1966,17 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aShadowState.bTriStateEnabled = false;
m_xShadowBtn->hide();
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;
@@ -1983,6 +1984,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxShadowedItem& rItem = static_cast<const SvxShadowedItem&>(rSet->Get( nWhich ));
+ m_aShadowState.bTriStateEnabled = false;
m_xShadowBtn->set_state( static_cast<TriState>(rItem.GetValue()) );
break;
}
@@ -1995,15 +1997,17 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
switch ( eState )
{
case SfxItemState::UNKNOWN:
+ m_aHiddenState.bTriStateEnabled = false;
m_xHiddenBtn->hide();
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;
@@ -2011,6 +2015,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
case SfxItemState::SET:
{
const SvxCharHiddenItem& rItem = static_cast<const SvxCharHiddenItem&>(rSet->Get( nWhich ));
+ m_aHiddenState.bTriStateEnabled = false;
m_xHiddenBtn->set_state(static_cast<TriState>(rItem.GetValue()));
break;
}
@@ -2026,6 +2031,23 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
ChangesApplied();
}
+IMPL_LINK(SvxCharEffectsPage, HiddenBtnClickHdl, weld::Toggleable&, rToggle, void)
+{
+ m_aHiddenState.ButtonToggled(rToggle);
+}
+
+IMPL_LINK(SvxCharEffectsPage, OutlineBtnClickHdl, weld::Toggleable&, rToggle, void)
+{
+ m_aOutlineState.ButtonToggled(rToggle);
+ UpdatePreview_Impl();
+}
+
+IMPL_LINK(SvxCharEffectsPage, ShadowBtnClickHdl, weld::Toggleable&, rToggle, void)
+{
+ m_aShadowState.ButtonToggled(rToggle);
+ UpdatePreview_Impl();
+}
+
void SvxCharEffectsPage::ChangesApplied()
{
m_xUnderlineLB->save_value();
@@ -2061,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 ) )
@@ -2095,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 ) )
@@ -2149,23 +2181,26 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
bChanged = true;
// Individual words
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
pOld = GetOldItem( *rSet, SID_ATTR_CHAR_WORDLINEMODE );
+ TriState eState = m_xIndividualWordsBtn->get_state();
+ const SfxPoolItem* pItem;
if ( pOld )
{
const SvxWordLineModeItem& rItem = *static_cast<const SvxWordLineModeItem*>(pOld);
- if ( rItem.GetValue() == m_xIndividualWordsBtn->get_active() )
+ if ( rItem.GetValue() == StateToAttr( eState ) && m_xIndividualWordsBtn->get_saved_state() == eState )
bChanged = false;
}
- if ( rOldSet.GetItemState( nWhich ) == SfxItemState::DONTCARE &&
- ! m_xIndividualWordsBtn->get_state_changed_from_saved() )
- bChanged = false;
+ if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
+ !StateToAttr( eState ) && static_cast<const SvxWordLineModeItem*>(pItem)->GetValue() )
+ bChanged = true;
- if ( bChanged )
+ if ( bChanged && eState != TRISTATE_INDET )
{
- rSet->Put( SvxWordLineModeItem( m_xIndividualWordsBtn->get_active(), nWhich ) );
+ rSet->Put( SvxWordLineModeItem( StateToAttr( eState ), nWhich ) );
bModified = true;
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -2188,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 )
@@ -2196,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;
@@ -2204,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 ) )
@@ -2258,11 +2293,9 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
}
// Outline
- const SfxItemSet* pExampleSet = GetDialogExampleSet();
nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
pOld = GetOldItem( *rSet, SID_ATTR_CHAR_CONTOUR );
- TriState eState = m_xOutlineBtn->get_state();
- const SfxPoolItem* pItem;
+ eState = m_xOutlineBtn->get_state();
if ( pOld )
{
@@ -2357,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;
@@ -2400,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
@@ -2425,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);
@@ -2498,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
@@ -2510,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())
@@ -2528,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())
{
@@ -2541,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())
@@ -2552,9 +2583,10 @@ IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::ToggleButton&, voi
IMPL_LINK_NOARG(SvxCharPositionPage, KerningModifyHdl_Impl, weld::MetricSpinButton&, void)
{
- long nVal = static_cast<long>(m_xKerningMF->get_value(FieldUnit::POINT));
- nVal = OutputDevice::LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip );
- long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
+ tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
+ nVal = o3tl::convert(nVal, o3tl::Length::pt, o3tl::Length::twip);
+
+ tools::Long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
SvxFont& rFont = GetPreviewFont();
SvxFont& rCJKFont = GetPreviewCJKFont();
@@ -2614,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);
@@ -2677,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;
}
}
@@ -2687,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;
}
}
@@ -2718,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
@@ -2730,19 +2764,22 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
{
const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>(rSet->Get( nWhich ));
MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
- long nBig = static_cast<long>(m_xKerningMF->normalize( static_cast<long>(rItem.GetValue()) ));
- long nKerning = OutputDevice::LogicToLogic(nBig, eUnit, MapUnit::MapPoint);
+ tools::Long nBig = static_cast<tools::Long>(m_xKerningMF->normalize( static_cast<tools::Long>(rItem.GetValue()) ));
+ tools::Long nKerning = OutputDevice::LogicToLogic(nBig, eUnit, MapUnit::MapPoint);
// set Kerning at the Font, convert into Twips before
- long nKern = OutputDevice::LogicToLogic(rItem.GetValue(), eUnit, MapUnit::MapTwip);
+ tools::Long nKern = OutputDevice::LogicToLogic(rItem.GetValue(), eUnit, MapUnit::MapTwip);
rFont.SetFixKerning( static_cast<short>(nKern) );
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
- long nVal = static_cast<long>(m_xKerningMF->get_max(FieldUnit::POINT));
+ //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
@@ -2759,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 )
@@ -2770,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 );
@@ -2799,14 +2845,14 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
m_x270degRB->set_active(true);
else
{
- DBG_ASSERT( 0 == rItem.GetValue(), "incorrect value" );
+ DBG_ASSERT( 0_deg10 == rItem.GetValue(), "incorrect value" );
m_x0degRB->set_active(true);
}
m_xFitToLineCB->set_active(rItem.IsFitToLine());
}
else
{
- if( eState == SfxItemState::DONTCARE )
+ if( eState == SfxItemState::INVALID )
{
m_x0degRB->set_active(false);
m_x90degRB->set_active(false);
@@ -2820,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();
@@ -2840,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 )
@@ -2898,8 +2945,8 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
short nKerning = 0;
MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
- long nTmp = static_cast<long>(m_xKerningMF->get_value(FieldUnit::POINT));
- long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, eUnit);
+ tools::Long nTmp = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
+ tools::Long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, eUnit);
nKerning = static_cast<short>(m_xKerningMF->denormalize( nVal ));
SfxItemState eOldKernState = rOldSet.GetItemState( nWhich, false );
@@ -2929,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 ) )
@@ -2946,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, 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())
@@ -2963,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 +
@@ -2995,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));
@@ -3085,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);
@@ -3131,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/chardlg.h b/cui/source/tabpages/chardlg.h
index b72beae2e8fc..4a52cb24b4b7 100644
--- a/cui/source/tabpages/chardlg.h
+++ b/cui/source/tabpages/chardlg.h
@@ -16,14 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CUI_SOURCE_TABPAGES_CHARDLG_H
-#define INCLUDED_CUI_SOURCE_TABPAGES_CHARDLG_H
+#pragma once
// define ----------------------------------------------------------------
#define CHRDLG_POSITION_OVER 0
#define CHRDLG_POSITION_UNDER 1
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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/dstribut.cxx b/cui/source/tabpages/dstribut.cxx
deleted file mode 100644
index e1653ca4d65e..000000000000
--- a/cui/source/tabpages/dstribut.cxx
+++ /dev/null
@@ -1,152 +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 <sfx2/basedlgs.hxx>
-#include <dstribut.hxx>
-
-/*************************************************************************
-|*
-|* Dialog
-|*
-\************************************************************************/
-
-SvxDistributeDialog::SvxDistributeDialog(weld::Window* pParent,
- const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
- SvxDistributeVertical eVer)
- : SfxSingleTabDialogController(pParent, &rInAttrs, "cui/ui/distributiondialog.ui",
- "DistributionDialog")
-{
- SetTabPage(std::make_unique<SvxDistributePage>(get_content_area(), this, rInAttrs, eHor, eVer));
- mpPage = static_cast<SvxDistributePage*>(GetTabPage());
-}
-
-SvxDistributeDialog::~SvxDistributeDialog()
-{
-}
-
-/*************************************************************************
-|*
-|* Tabpage
-|*
-\************************************************************************/
-
-SvxDistributePage::SvxDistributePage(weld::Container* pPage, weld::DialogController* pController,
- const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
- SvxDistributeVertical eVer)
- : SfxTabPage(pPage, pController, "cui/ui/distributionpage.ui", "DistributionPage",
- &rInAttrs)
- , m_eDistributeHor(eHor)
- , m_eDistributeVer(eVer)
- , m_xBtnHorNone(m_xBuilder->weld_radio_button("hornone"))
- , m_xBtnHorLeft(m_xBuilder->weld_radio_button("horleft"))
- , m_xBtnHorCenter(m_xBuilder->weld_radio_button("horcenter"))
- , m_xBtnHorDistance(m_xBuilder->weld_radio_button("hordistance"))
- , m_xBtnHorRight(m_xBuilder->weld_radio_button("horright"))
- , m_xBtnVerNone(m_xBuilder->weld_radio_button("vernone"))
- , m_xBtnVerTop(m_xBuilder->weld_radio_button("vertop"))
- , m_xBtnVerCenter(m_xBuilder->weld_radio_button("vercenter"))
- , m_xBtnVerDistance(m_xBuilder->weld_radio_button("verdistance"))
- , m_xBtnVerBottom(m_xBuilder->weld_radio_button("verbottom"))
-{
-}
-
-SvxDistributePage::~SvxDistributePage()
-{
-}
-
-/*************************************************************************
-|*
-|* read the delivered Item-Set
-|*
-\************************************************************************/
-
-void SvxDistributePage::Reset(const SfxItemSet* )
-{
- m_xBtnHorNone->set_active(false);
- m_xBtnHorLeft->set_active(false);
- m_xBtnHorCenter->set_active(false);
- m_xBtnHorDistance->set_active(false);
- m_xBtnHorRight->set_active(false);
-
- switch(m_eDistributeHor)
- {
- case SvxDistributeHorizontal::NONE : m_xBtnHorNone->set_active(true); break;
- case SvxDistributeHorizontal::Left : m_xBtnHorLeft->set_active(true); break;
- case SvxDistributeHorizontal::Center : m_xBtnHorCenter->set_active(true); break;
- case SvxDistributeHorizontal::Distance : m_xBtnHorDistance->set_active(true); break;
- case SvxDistributeHorizontal::Right : m_xBtnHorRight->set_active(true); break;
- }
-
- m_xBtnVerNone->set_active(false);
- m_xBtnVerTop->set_active(false);
- m_xBtnVerCenter->set_active(false);
- m_xBtnVerDistance->set_active(false);
- m_xBtnVerBottom->set_active(false);
-
- switch(m_eDistributeVer)
- {
- case SvxDistributeVertical::NONE : m_xBtnVerNone->set_active(true); break;
- case SvxDistributeVertical::Top : m_xBtnVerTop->set_active(true); break;
- case SvxDistributeVertical::Center : m_xBtnVerCenter->set_active(true); break;
- case SvxDistributeVertical::Distance : m_xBtnVerDistance->set_active(true); break;
- case SvxDistributeVertical::Bottom : m_xBtnVerBottom->set_active(true); break;
- }
-}
-
-/*************************************************************************
-|*
-|* Fill the delivered Item-Set with dialogbox-attributes
-|*
-\************************************************************************/
-
-bool SvxDistributePage::FillItemSet( SfxItemSet* )
-{
- SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontal::NONE);
- SvxDistributeVertical eDistributeVer(SvxDistributeVertical::NONE);
-
- if(m_xBtnHorLeft->get_active())
- eDistributeHor = SvxDistributeHorizontal::Left;
- else if(m_xBtnHorCenter->get_active())
- eDistributeHor = SvxDistributeHorizontal::Center;
- else if(m_xBtnHorDistance->get_active())
- eDistributeHor = SvxDistributeHorizontal::Distance;
- else if(m_xBtnHorRight->get_active())
- eDistributeHor = SvxDistributeHorizontal::Right;
-
- if(m_xBtnVerTop->get_active())
- eDistributeVer = SvxDistributeVertical::Top;
- else if(m_xBtnVerCenter->get_active())
- eDistributeVer = SvxDistributeVertical::Center;
- else if(m_xBtnVerDistance->get_active())
- eDistributeVer = SvxDistributeVertical::Distance;
- else if(m_xBtnVerBottom->get_active())
- eDistributeVer = SvxDistributeVertical::Bottom;
-
- if(eDistributeHor != m_eDistributeHor || eDistributeVer != m_eDistributeVer)
- {
- m_eDistributeHor = eDistributeHor;
- m_eDistributeVer = eDistributeVer;
- return true;
- }
-
- return false;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 7f334e2f11fc..9e96fdbb603c 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -32,15 +32,17 @@
#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>
#include <svtools/optionsdrawinglayer.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <o3tl/unit_conversion.hxx>
+#include <officecfg/Office/Common.hxx>
-#define CM_1_TO_TWIP 567
-#define TWIP_TO_INCH 1440
+constexpr auto CM_1_TO_TWIP = o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip); // 567
static int lcl_GetValue(const weld::MetricSpinButton& rMetric, FieldUnit eUnit)
@@ -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,23 +362,23 @@ 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())
{
- long nLRBorders = lcl_GetValue(*m_xLeftMF, eUnit)
+ 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
{
- long nULBorders = lcl_GetValue(*m_xTopMF, eUnit)
+ 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())
{
- 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
{
- long nHeight = aOrigSize.Height() -
+ tools::Long nHeight = m_aOrigSize.Height() -
( lcl_GetValue(*m_xTopMF, eUnit) +
lcl_GetValue(*m_xBottomMF, eUnit));
if(!nHeight)
@@ -421,28 +427,28 @@ 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();
if (&rField == m_xLeftMF.get() || &rField == m_xRightMF.get())
{
- long nLeft = lcl_GetValue( *m_xLeftMF, eUnit );
- long nRight = lcl_GetValue( *m_xRightMF, eUnit );
- long nWidthZoom = static_cast<long>(m_xWidthZoomMF->get_value(FieldUnit::NONE));
- if (bZoom && nWidthZoom != 0 && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom )
- / 100 >= aPageSize.Width() ) )
+ 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 && ( ( ( 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 );
}
}
@@ -464,23 +470,23 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
}
else
{
- long nTop = lcl_GetValue( *m_xTopMF, eUnit );
- long nBottom = lcl_GetValue( *m_xBottomMF, eUnit );
- long nHeightZoom = static_cast<long>(m_xHeightZoomMF->get_value(FieldUnit::NONE));
- if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom)
- / 100 >= aPageSize.Height()))
+ 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 && ( ( ( 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 ) ) );
- 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 );
- 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,21 +561,21 @@ 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 ) ) );
- long nWidth = lcl_GetValue( *m_xWidthMF, eUnit );
- long nHeight = lcl_GetValue( *m_xHeightMF, eUnit );
- long nLRBorders = lcl_GetValue( *m_xLeftMF, eUnit ) +
+ tools::Long nWidth = lcl_GetValue( *m_xWidthMF, eUnit );
+ tools::Long nHeight = lcl_GetValue( *m_xHeightMF, eUnit );
+ tools::Long nLRBorders = lcl_GetValue( *m_xLeftMF, eUnit ) +
lcl_GetValue( *m_xRightMF, eUnit );
- long nULBorders = lcl_GetValue( *m_xTopMF, eUnit ) +
+ tools::Long nULBorders = lcl_GetValue( *m_xTopMF, eUnit ) +
lcl_GetValue( *m_xBottomMF, eUnit );
sal_uInt16 nZoom = 0;
- long nDen;
- if( (nDen = aOrigSize.Width() - nLRBorders) > 0)
+ tools::Long nDen;
+ 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,23 +590,23 @@ 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 ) ) );
- long nR = lcl_GetValue(*m_xRightMF, eUnit );
- long nMinWidth = (aOrigSize.Width() * 10) /11;
- long nMin = nMinWidth - (nR >= 0 ? nR : 0);
+ tools::Long nR = lcl_GetValue(*m_xRightMF, eUnit );
+ 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 );
- long nL = lcl_GetValue(*m_xLeftMF, eUnit );
+ tools::Long nL = lcl_GetValue(*m_xLeftMF, eUnit );
nMin = nMinWidth - (nL >= 0 ? nL : 0);
m_xRightMF->set_max( m_xRightMF->normalize(nMin), eUnit );
- long nUp = lcl_GetValue( *m_xTopMF, eUnit );
- long nMinHeight = (aOrigSize.Height() * 10) /11;
+ tools::Long nUp = lcl_GetValue( *m_xTopMF, eUnit );
+ tools::Long nMinHeight = (m_aOrigSize.Height() * 10) /11;
nMin = nMinHeight - (nUp >= 0 ? nUp : 0);
m_xBottomMF->set_max( m_xBottomMF->normalize(nMin), eUnit );
- long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
+ tools::Long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
nMin = nMinHeight - (nLow >= 0 ? nLow : 0);
m_xTopMF->set_max( m_xTopMF->normalize(nMin), eUnit );
}
@@ -589,29 +621,29 @@ 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
- long nR = lcl_GetValue( *m_xRightMF, eUnit );
- long nL = lcl_GetValue( *m_xLeftMF, eUnit );
- if((nL + nR) < - aOrigSize.Width())
+ tools::Long nR = lcl_GetValue( *m_xRightMF, eUnit );
+ tools::Long nL = lcl_GetValue( *m_xLeftMF, eUnit );
+ if((nL + nR) < - m_aOrigSize.Width())
{
- 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);
m_aExampleWN.SetRight(nVal);
}
- long nUp = lcl_GetValue(*m_xTopMF, eUnit );
- long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
- if((nUp + nLow) < - aOrigSize.Height())
+ tools::Long nUp = lcl_GetValue(*m_xTopMF, eUnit );
+ tools::Long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
+ if((nUp + nLow) < - m_aOrigSize.Height())
{
- 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);
@@ -632,30 +664,33 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
OUString sTemp;
{
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/spinbox.ui"));
+ std::unique_ptr<weld::Dialog> xTopLevel(xBuilder->weld_dialog("SpinDialog"));
std::unique_ptr<weld::MetricSpinButton> xFld(xBuilder->weld_metric_spin_button("spin", FieldUnit::CM));
SetFieldUnit( *xFld, eMetric );
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 = sal_Int32(floor(static_cast<float>(aOrigPixelSize.Width()) /
- (static_cast<float>(aOrigSize.Width())/TWIP_TO_INCH)+0.5));
- sal_Int32 ay = sal_Int32(floor(static_cast<float>(aOrigPixelSize.Height()) /
- (static_cast<float>(aOrigSize.Height())/TWIP_TO_INCH)+0.5));
- sTemp += " " + CuiResId( RID_SVXSTR_PPI );
+ 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 + 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 = sTemp.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);
}
@@ -668,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;
}
@@ -701,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
@@ -711,23 +760,22 @@ void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re
rRenderContext.DrawRect(::tools::Rectangle(Point(), aWinSize));
// use AA, the Graphic may be a metafile/svg and would then look ugly
- rRenderContext.SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
+ rRenderContext.SetAntialiasing(AntialiasingFlags::Enable);
// draw Graphic
::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 39098871bd0b..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)
@@ -88,7 +81,7 @@ SvxCaptionTabPage::SvxCaptionTabPage(weld::Container* pPage, weld::DialogControl
, m_xFT_LENGTHFT(m_xBuilder->weld_label("lengthft"))
, m_xMF_LENGTH(m_xBuilder->weld_metric_spin_button("length", FieldUnit::MM))
, m_xCB_OPTIMAL(m_xBuilder->weld_check_button("optimal"))
- , m_xCT_CAPTTYPE(new ValueSet(m_xBuilder->weld_scrolled_window("valuesetwin")))
+ , m_xCT_CAPTTYPE(new ValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
, m_xCT_CAPTTYPEWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xCT_CAPTTYPE))
{
Size aSize(m_xCT_CAPTTYPE->GetDrawingArea()->get_ref_device().LogicToPixel(Size(187, 38), MapMode(MapUnit::MapAppFont)));
@@ -177,7 +170,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs)
if( bEscRel )
{
- long nVal = 0;
+ tools::Long nVal = 0;
switch (m_xLB_POSITION->get_active())
{
@@ -246,7 +239,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
nEscAbs = m_xMF_BY->get_value(FieldUnit::NONE);
nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
- nEscRel = static_cast<long>(static_cast<const SdrCaptionEscRelItem&>( rOutAttrs.Get( nWhich ) ).GetValue());
+ nEscRel = static_cast<tools::Long>(static_cast<const SdrCaptionEscRelItem&>( rOutAttrs.Get( nWhich ) ).GetValue());
//------- line length ----------
nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
@@ -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 e7a7fbe12fdf..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,9 +231,9 @@ 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 )
{
- long nFieldUnit = static_cast<long>(rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue());
+ tools::Long nFieldUnit = static_cast<tools::Long>(rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue());
for (sal_Int32 i = 0; i < m_xLbUnit->get_count(); ++i)
{
@@ -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();
@@ -432,8 +433,8 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs)
if( bPositionModified )
{
// Position
- css::drawing::MeasureTextVertPos eVPos, eOldVPos;
- css::drawing::MeasureTextHorzPos eHPos, eOldHPos;
+ css::drawing::MeasureTextVertPos eVPos;
+ css::drawing::MeasureTextHorzPos eHPos;
RectPoint eRP = m_aCtlPosition.GetActualRP();
switch( eRP )
@@ -464,9 +465,9 @@ 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 )
{
- eOldVPos = rOutAttrs.Get(SDRATTR_MEASURETEXTVPOS).GetValue();
+ css::drawing::MeasureTextVertPos eOldVPos = rOutAttrs.Get(SDRATTR_MEASURETEXTVPOS).GetValue();
if( eOldVPos != eVPos )
{
rAttrs->Put( SdrMeasureTextVPosItem( eVPos ) );
@@ -479,9 +480,9 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs)
bModified = true;
}
- if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::DONTCARE )
+ if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::INVALID )
{
- eOldHPos = rOutAttrs.Get( SDRATTR_MEASURETEXTHPOS ).GetValue();
+ css::drawing::MeasureTextHorzPos eOldHPos = rOutAttrs.Get( SDRATTR_MEASURETEXTHPOS ).GetValue();
if( eOldHPos != eHPos )
{
rAttrs->Put( SdrMeasureTextHPosItem( 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 4297cd52241e..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>
@@ -43,6 +41,7 @@
#include <vector>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <limits>
#include <memory>
using ::com::sun::star::uno::Reference;
@@ -53,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
@@ -108,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();
}
@@ -137,17 +140,21 @@ 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);
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
+ 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());
- OUString aTmpStr( aPrevStr );
- long nLeadSpace = (aSzWnd.Width() - rRenderContext.GetTextWidth(aTmpStr)) / 2;
+ OUString aTmpStr(aPrevStr);
+ tools::Long nLeadSpace = (aSzWnd.Width() - rRenderContext.GetTextWidth(aTmpStr)) / 2;
aDrawFont.SetTransparent(true);
aDrawFont.SetColor(aPrevCol);
@@ -155,7 +162,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
if (mnPos != -1)
{
- long nCharWidth = rRenderContext.GetTextWidth(OUString(mnChar));
+ tools::Long nCharWidth = rRenderContext.GetTextWidth(OUString(mnChar));
int nNumCharsToInsert = 0;
if (nCharWidth > 0)
@@ -164,11 +171,11 @@ 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));
}
}
- long nX = 0;
+ tools::Long nX = 0;
if (mnPos == -1 && nLeadSpace > 0) //tdf#122120 if it won't fit anyway, then left align it
{
nX = nLeadSpace;
@@ -189,14 +196,13 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
m_xLbLanguage->set_active_id(pNumFmtShell->GetCurLanguage()); \
}
-#define HDL(hdl) LINK( this, SvxNumberFormatTabPage, hdl )
-
SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rCoreAttrs)
: SfxTabPage(pPage, pController, "cui/ui/numberingformatpage.ui", "NumberingFormatPage", &rCoreAttrs)
- , nInitFormat(ULONG_MAX)
+ , 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"))
@@ -224,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;
@@ -277,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 );
@@ -289,20 +295,20 @@ 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(HDL(DoubleClickHdl_Impl));
- m_xEdFormat->connect_changed(HDL(EditModifyHdl_Impl));
+ m_xLbFormat->connect_row_activated(LINK(this, SvxNumberFormatTabPage, DoubleClickHdl_Impl));
+ m_xEdFormat->connect_changed(LINK(this, SvxNumberFormatTabPage, EditModifyHdl_Impl));
m_xEdFormat->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xIbAdd->connect_clicked(HDL(ClickHdl_Impl));
+ m_xIbAdd->connect_clicked(LINK(this, SvxNumberFormatTabPage, ClickHdl_Impl));
m_xIbAdd->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xIbRemove->connect_clicked(HDL(ClickHdl_Impl));
+ m_xIbRemove->connect_clicked(LINK(this, SvxNumberFormatTabPage, ClickHdl_Impl));
m_xIbRemove->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
- m_xIbInfo->connect_clicked(HDL(ClickHdl_Impl));
+ m_xIbInfo->connect_clicked(LINK(this, SvxNumberFormatTabPage, ClickHdl_Impl));
UpdateThousandEngineeringCheckBox();
UpdateDecimalsDenominatorEditBox();
@@ -369,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();
}
@@ -387,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)
{
@@ -411,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)
{
@@ -420,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
@@ -446,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();
@@ -470,7 +470,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
nInitFormat = pValFmtAttr // memorize init key
? pValFmtAttr->GetValue() // (for FillItemSet())
- : ULONG_MAX; // == DONT_KNOW
+ : std::numeric_limits<sal_uInt32>::max(); // == DONT_KNOW
if ( eValType == SvxNumberValueType::String )
@@ -489,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 );
@@ -502,7 +501,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
FillCurrencyBox();
OUString aPrevString;
- Color* pDummy = nullptr;
+ const Color* pDummy = nullptr;
pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos,
aFmtEntryList, aPrevString, pDummy );
@@ -521,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.
@@ -643,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: ---
#*
@@ -674,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?
@@ -720,7 +718,7 @@ bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if ( !aDelFormats.empty() )
{
- pNumItem->SetDelFormats( aDelFormats );
+ pNumItem->SetDelFormats( std::vector(aDelFormats) );
if(bNumItemFlag)
{
@@ -729,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 );
}
}
@@ -743,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);
@@ -820,7 +814,7 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<OUString>& rEnt
short aPrivCat = pNumFmtShell->GetCategory4Entry( static_cast<short>(i) );
if(aPrivCat!=CAT_TEXT)
{
- Color* pPreviewColor = nullptr;
+ const Color* pPreviewColor = nullptr;
OUString aPreviewString( GetExpColorString( pPreviewColor, aEntry, aPrivCat ) );
m_xLbFormat->append_text(aPreviewString);
if (pPreviewColor)
@@ -947,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;
@@ -1149,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);
}
@@ -1166,6 +1161,18 @@ IMPL_LINK(SvxNumberFormatTabPage, SelFormatListBoxHdl_Impl, weld::ComboBox&, rLb
void SvxNumberFormatTabPage::SelFormatHdl_Impl(weld::Widget* pLb)
{
+ if (m_nLbFormatSelPosEdComment != SELPOS_NONE)
+ {
+ // Click handler is called before focus change handler, so finish
+ // comment editing of previous format, otherwise a new format will have
+ // the old comment displayed after LostFocusHdl_Impl() is called
+ // later. Also, clicking into another category invalidates the format
+ // list and SvxNumberFormatShell::SetComment4Entry() could either
+ // access a wrong format from aCurEntryList[nEntry] or crash there if
+ // the new vector has less elements.
+ LostFocusHdl_Impl(*pLb);
+ }
+
if (pLb == m_xCbSourceFormat.get())
{
EnableBySourceFormat_Impl(); // enable/disable everything else
@@ -1198,7 +1205,7 @@ void SvxNumberFormatTabPage::SelFormatHdl_Impl(weld::Widget* pLb)
// Format-ListBox ----------------------------------------------------
if (pLb == m_xLbFormat.get())
{
- sal_uLong nSelPos = m_xLbFormat->get_selected_index();
+ int nSelPos = m_xLbFormat->get_selected_index();
short nFmtLbSelPos = static_cast<short>(nSelPos);
OUString aFormat = pNumFmtShell->GetFormat4Entry(nFmtLbSelPos);
@@ -1283,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;
- const sal_uLong nReturnChanged = 0x1; // THE boolean return value
- const sal_uLong nReturnAdded = 0x2; // temp: format added
- const 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
@@ -1424,6 +1431,10 @@ bool SvxNumberFormatTabPage::Click_Impl(weld::Button& rIB)
{
if (!m_xEdComment->get_visible())
{
+ if (!m_xIbAdd->get_sensitive())
+ // Editing for existing format.
+ m_nLbFormatSelPosEdComment = m_xLbFormat->get_selected_index();
+
m_xEdComment->set_text(m_xFtComment->get_label());
m_xEdComment->show();
m_xFtComment->hide();
@@ -1432,6 +1443,7 @@ bool SvxNumberFormatTabPage::Click_Impl(weld::Button& rIB)
else
{
m_xEdFormat->grab_focus();
+ m_xFtComment->set_label( m_xEdComment->get_text());
m_xEdComment->hide();
m_xFtComment->show();
}
@@ -1524,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);
}
@@ -1600,13 +1612,22 @@ IMPL_LINK_NOARG(SvxNumberFormatTabPage, LostFocusHdl_Impl, weld::Widget&, void)
{
if (!pNumFmtShell)
return;
- m_xFtComment->set_label(m_xEdComment->get_text());
+
+ const bool bAddSensitive = m_xIbAdd->get_sensitive();
+ if (bAddSensitive || m_nLbFormatSelPosEdComment != SELPOS_NONE)
+ // Comment editing was possible.
+ m_xFtComment->set_label(m_xEdComment->get_text());
+
m_xEdComment->hide();
m_xFtComment->show();
- if(!m_xIbAdd->get_sensitive())
+ if (m_nLbFormatSelPosEdComment != SELPOS_NONE)
+ {
+ // Save edited comment of existing format.
+ pNumFmtShell->SetComment4Entry( m_nLbFormatSelPosEdComment, m_xEdComment->get_text());
+ m_nLbFormatSelPosEdComment = SELPOS_NONE;
+ }
+ if (!bAddSensitive)
{
- sal_uInt16 nSelPos = m_xLbFormat->get_selected_index();
- pNumFmtShell->SetComment4Entry(nSelPos, m_xEdComment->get_text());
// String for user defined, if present
OUString sEntry = m_xLbCategory->n_children() > 1 ? m_xLbCategory->get_text(1) : OUString();
m_xEdComment->set_text(sEntry);
@@ -1625,7 +1646,7 @@ IMPL_LINK_NOARG(SvxNumberFormatTabPage, LostFocusHdl_Impl, weld::Widget&, void)
#************************************************************************/
OUString SvxNumberFormatTabPage::GetExpColorString(
- Color*& rpPreviewColor, const OUString& rFormatStr, short nTmpCatPos)
+ const Color*& rpPreviewColor, const OUString& rFormatStr, short nTmpCatPos)
{
SvxNumValCategory i;
switch (nTmpCatPos)
@@ -1655,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;
@@ -1663,7 +1694,7 @@ OUString SvxNumberFormatTabPage::GetExpColorString(
void SvxNumberFormatTabPage::MakePreviewText( const OUString& rFormat )
{
OUString aPreviewString;
- Color* pPreviewColor = nullptr;
+ const Color* pPreviewColor = nullptr;
pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor );
m_aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
}
@@ -1671,7 +1702,7 @@ void SvxNumberFormatTabPage::MakePreviewText( const OUString& rFormat )
void SvxNumberFormatTabPage::ChangePreviewText( sal_uInt16 nPos )
{
OUString aPreviewString;
- Color* pPreviewColor = nullptr;
+ const Color* pPreviewColor = nullptr;
pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor );
m_aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
}
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index a1d383d7cb18..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>
@@ -68,15 +73,17 @@
#include <vcl/graphicfilter.hxx>
#include <svx/SvxNumOptionsTabPageHelper.hxx>
#include <tools/urlobj.hxx>
+#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
@@ -115,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)
{
@@ -142,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 );
@@ -163,7 +157,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(weld::Container* pPage, weld::D
, bModified(false)
, bPreset(false)
, nNumItemId(SID_ATTR_NUMBERING_RULE)
- , m_xExamplesVS(new SvxNumValueSet(nullptr))
+ , m_xExamplesVS(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
, m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
{
SetExchangeSupport();
@@ -225,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)
{
@@ -272,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) );
@@ -313,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);
@@ -342,7 +329,7 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(weld::Container* pPage, weld::DialogC
, bModified(false)
, bPreset(false)
, nNumItemId(SID_ATTR_NUMBERING_RULE)
- , m_xExamplesVS(new SvxNumValueSet(nullptr))
+ , m_xExamplesVS(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
, m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
{
SetExchangeSupport();
@@ -376,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)
{
@@ -416,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) );
@@ -447,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++)
@@ -458,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);
@@ -491,7 +476,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* pPage, weld::DialogControl
, nNumItemId(SID_ATTR_NUMBERING_RULE)
, bModified(false)
, bPreset(false)
- , m_xExamplesVS(new SvxNumValueSet(nullptr))
+ , m_xExamplesVS(new SvxNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
, m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
{
SetExchangeSupport();
@@ -517,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) );
}
@@ -559,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)
{
@@ -599,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) );
@@ -651,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
@@ -689,19 +672,24 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
aFmt.SetBulletFont( &rActBulletFont );
aFmt.SetBulletChar( !pLevelSettings->sBulletChar.isEmpty()
- ? pLevelSettings->sBulletChar[0]
+ ? pLevelSettings->sBulletChar.iterateCodePoints(
+ &o3tl::temporary(sal_Int32(0)))
: 0 );
aFmt.SetCharFormatName( sBulletCharFormatName );
aFmt.SetBulletRelSize(45);
}
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);
}
@@ -732,7 +720,7 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(weld::Container* pPage, weld::DialogC
, bPreset(false)
, m_xErrorText(m_xBuilder->weld_label("errorft"))
, m_xBtBrowseFile(m_xBuilder->weld_button("browseBtn"))
- , m_xExamplesVS(new SvxBmpNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin")))
+ , m_xExamplesVS(new SvxBmpNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
, m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
{
SetExchangeSupport();
@@ -742,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);
@@ -753,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;
@@ -786,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)
{
@@ -843,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) );
@@ -883,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;
@@ -914,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();
@@ -930,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" );
@@ -955,29 +947,28 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
GraphicConverter::Import( *pIn, aGraphic );
BitmapEx aBitmap = aGraphic.GetBitmapEx();
- long nPixelX = aBitmap.GetSizePixel().Width();
- long nPixelY = aBitmap.GetSizePixel().Height();
+ tools::Long nPixelX = aBitmap.GetSizePixel().Width();
+ tools::Long nPixelY = aBitmap.GetSizePixel().Height();
double ratio = nPixelY/static_cast<double>(nPixelX);
if(nPixelX > 30)
{
nPixelX = 30;
- nPixelY = static_cast<long>(nPixelX*ratio);
+ nPixelY = static_cast<tools::Long>(nPixelX*ratio);
}
if(nPixelY > 30)
{
nPixelY = 30;
- nPixelX = static_cast<long>(nPixelY/ratio);
+ nPixelX = static_cast<tools::Long>(nPixelY/ratio);
}
aBitmap.Scale( Size( nPixelX, nPixelY ), BmpScaleFlag::Fast );
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 );
@@ -989,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;
}
@@ -1010,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)
@@ -1019,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"))
@@ -1030,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"))
@@ -1046,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"))
@@ -1057,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));
@@ -1068,10 +1083,11 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xWidthMF->connect_value_changed(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
m_xHeightMF->connect_value_changed(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
m_xRatioCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl));
- m_xStartED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
+ m_xStartED->connect_value_changed(LINK(this, SvxNumOptionsTabPage, SpinModifyHdl_Impl));
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));
@@ -1079,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.
@@ -1133,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);
@@ -1192,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())
@@ -1250,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)
+ {
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem( SID_HTML_MODE );
+ }
+ if ( pHtmlModeItem )
{
- sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
}
@@ -1268,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);
@@ -1331,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;
@@ -1355,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)
{
@@ -1364,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)
@@ -1436,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)
@@ -1450,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:
@@ -1479,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
@@ -1515,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));
@@ -1536,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);
@@ -1614,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;
@@ -1622,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;
@@ -1640,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);
@@ -1651,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() )
@@ -1668,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);
@@ -1739,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);
@@ -1793,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();
@@ -1871,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;
@@ -1893,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());
@@ -1926,9 +1978,9 @@ 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_Unicode cBullet = 0;
+ sal_UCS4 cBullet = 0;
bool bFirst = true;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
{
@@ -1971,7 +2023,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
{
SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
aNumFmt.SetBulletFont(&aActBulletFont);
- aNumFmt.SetBulletChar( static_cast<sal_Unicode>(aMap.GetChar()) );
+ aNumFmt.SetBulletChar(aMap.GetChar());
pActNum->SetLevel(i, aNumFmt);
}
_nMask <<= 1;
@@ -1985,8 +2037,8 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
bool bWidth = &rField == m_xWidthMF.get();
bLastWidthModified = bWidth;
bool bRatio = m_xRatioCB->get_active();
- long nWidthVal = static_cast<long>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
- long nHeightVal = static_cast<long>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
+ tools::Long nWidthVal = static_cast<tools::Long>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
+ tools::Long nHeightVal = static_cast<tools::Long>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
MapUnit::Map100thMM, eCoreUnit );
nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
@@ -2012,11 +2064,11 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
if(bWidth)
{
- long nDelta = nWidthVal - aInitSize[i].Width();
+ tools::Long nDelta = nWidthVal - aInitSize[i].Width();
aSize.setWidth( nWidthVal );
if (bRatio)
{
- aSize.setHeight( aInitSize[i].Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) );
+ aSize.setHeight( aInitSize[i].Height() + static_cast<tools::Long>(static_cast<double>(nDelta) / fSizeRatio) );
m_xHeightMF->set_value(m_xHeightMF->normalize(
OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )),
FieldUnit::MM_100TH);
@@ -2024,11 +2076,11 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
}
else
{
- long nDelta = nHeightVal - aInitSize[i].Height();
+ tools::Long nDelta = nHeightVal - aInitSize[i].Height();
aSize.setHeight( nHeightVal );
if (bRatio)
{
- aSize.setWidth( aInitSize[i].Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) );
+ aSize.setWidth( aInitSize[i].Width() + static_cast<tools::Long>(static_cast<double>(nDelta) * fSizeRatio) );
m_xWidthMF->set_value(m_xWidthMF->normalize(
OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )),
FieldUnit::MM_100TH);
@@ -2047,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)
@@ -2088,10 +2141,14 @@ IMPL_LINK(SvxNumOptionsTabPage, EditModifyHdl_Impl, weld::Entry&, rEdit, void)
EditModifyHdl_Impl(&rEdit);
}
+IMPL_LINK(SvxNumOptionsTabPage, SpinModifyHdl_Impl, weld::SpinButton&, rSpinButton, void)
+{
+ EditModifyHdl_Impl(&rSpinButton);
+}
+
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++)
@@ -2099,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);
@@ -2112,352 +2167,6 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit)
SetModified();
}
-static long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, long nXStart,
- long nYMiddle, long nDivision)
-{
- const SvxBrushItem* pBrushItem = rFmt.GetBrush();
- 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 long lcl_DrawBullet(VirtualDevice* pVDev,
- const SvxNumberFormat& rFmt, long nXStart,
- 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 );
- OUString aText(rFmt.GetBulletChar());
- long nY = nYStart;
- nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
- pVDev->DrawText( Point(nXStart, nY), aText );
- 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)
- {
- long nWidthRelation = 30; // chapter dialog
-
- // height per level
- long nXStep = aSize.Width() / (3 * pActNum->GetLevelCount());
- if (pActNum->GetLevelCount() < 10)
- nXStep /= 2;
- long nYStart = 4;
- // the whole height mustn't be used for a single level
- 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);
-
- 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)
- {
- 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();
-
- long nXStart( 0 );
- short nTextOffset( 0 );
- long nNumberXPos( 0 );
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
- nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
- nNumberXPos = nXStart;
- 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 long nTmpNumberXPos((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
- if (nTmpNumberXPos < 0)
- {
- nNumberXPos = 0;
- }
- else
- {
- nNumberXPos = nTmpNumberXPos;
- }
- }
-
- long nBulletWidth = 0;
- if (SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
- {
- 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);
- }
-
- 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
- long nWidth = pVDev->GetTextWidth("Preview");
- long nTextHeight = pVDev->GetTextHeight();
- long nRectHeight = nTextHeight * 2 / 3;
- 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();
- 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 long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
- if (nTmpXStart < 0)
- {
- nXStart = 0;
- }
- else
- {
- nXStart = nTmpXStart;
- }
- }
- nXStart /= 2;
- nXStart += 2;
- long nTextOffset = 2 * nXStep;
- if (SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)))
- {
- if (rFmt.IsShowSymbol())
- {
- 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));
- 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
@@ -2496,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);
@@ -2526,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()
@@ -2568,7 +2284,7 @@ void SvxNumPositionTabPage::InitControls()
const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
sal_uInt16 nMask = 1;
sal_uInt16 nLvl = SAL_MAX_UINT16;
- long nFirstBorderTextRelative = -1;
+ tools::Long nFirstBorderTextRelative = -1;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
{
aNumFmtArr[i] = &pActNum->GetLevel(i);
@@ -2626,16 +2342,16 @@ void SvxNumPositionTabPage::InitControls()
if(bSameDistBorderNum)
{
- long nDistBorderNum;
+ tools::Long nDistBorderNum;
if(bRelative)
{
- nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
+ nDistBorderNum = static_cast<tools::Long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
if(nLvl)
- nDistBorderNum -= static_cast<long>(aNumFmtArr[nLvl - 1]->GetAbsLSpace())+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
+ nDistBorderNum -= static_cast<tools::Long>(aNumFmtArr[nLvl - 1]->GetAbsLSpace())+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
}
else
{
- nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
+ nDistBorderNum = static_cast<tools::Long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
}
SetMetricValue(*m_xDistBorderMF, nDistBorderNum, eCoreUnit);
}
@@ -2737,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 ||
@@ -2806,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())
@@ -3035,7 +2748,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
{
if(bInInintControl)
return;
- long nValue = GetCoreValue(rFld, eCoreUnit);
+ tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
{
@@ -3054,7 +2767,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
}
else
{
- long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
+ tools::Long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
pActNum->GetLevel( i ).GetFirstLineOffset();
@@ -3073,7 +2786,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
else if (&rFld == m_xIndentMF.get())
{
// together with the FirstLineOffset the AbsLSpace must be changed, too
- long nDiff = nValue + aNumFmt.GetFirstLineOffset();
+ tools::Long nDiff = nValue + aNumFmt.GetFirstLineOffset();
auto const nAbsLSpace = aNumFmt.GetAbsLSpace();
aNumFmt.SetAbsLSpace(nAbsLSpace + nDiff);
aNumFmt.SetFirstLineOffset( -nValue );
@@ -3091,12 +2804,12 @@ 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;
bool bSetValue = false;
- long nValue = 0;
+ tools::Long nValue = 0;
if(bOn || bSingleSelection)
{
sal_uInt16 nMask = 1;
@@ -3196,7 +2909,7 @@ IMPL_LINK_NOARG(SvxNumPositionTabPage, LabelFollowedByHdl_Impl, weld::ComboBox&,
IMPL_LINK(SvxNumPositionTabPage, ListtabPosHdl_Impl, weld::MetricSpinButton&, rFld, void)
{
// determine value to be set at the chosen list levels
- const long nValue = GetCoreValue(rFld, eCoreUnit);
+ const tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
// set value at the chosen list levels
sal_uInt16 nMask = 1;
@@ -3217,7 +2930,7 @@ IMPL_LINK(SvxNumPositionTabPage, ListtabPosHdl_Impl, weld::MetricSpinButton&, rF
IMPL_LINK(SvxNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rFld, void)
{
// determine value to be set at the chosen list levels
- const long nValue = GetCoreValue(rFld, eCoreUnit);
+ const tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
// set value at the chosen list levels
sal_uInt16 nMask = 1;
@@ -3226,7 +2939,7 @@ IMPL_LINK(SvxNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rFld,
if ( nActNumLvl & nMask )
{
SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
- const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
+ const tools::Long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
aNumFmt.SetFirstLineIndent( nFirstLineIndent );
pActNum->SetLevel( i, aNumFmt );
}
@@ -3239,7 +2952,7 @@ IMPL_LINK(SvxNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rFld,
IMPL_LINK(SvxNumPositionTabPage, IndentAtHdl_Impl, weld::MetricSpinButton&, rFld, void)
{
// determine value to be set at the chosen list levels
- const long nValue = GetCoreValue(rFld, eCoreUnit);
+ const tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
// set value at the chosen list levels
sal_uInt16 nMask = 1;
@@ -3248,10 +2961,10 @@ IMPL_LINK(SvxNumPositionTabPage, IndentAtHdl_Impl, weld::MetricSpinButton&, rFld
if ( nActNumLvl & nMask )
{
SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
- const long nAlignedAt = aNumFmt.GetIndentAt() +
+ const tools::Long nAlignedAt = aNumFmt.GetIndentAt() +
aNumFmt.GetFirstLineIndent();
aNumFmt.SetIndentAt( nValue );
- const long nNewFirstLineIndent = nAlignedAt - nValue;
+ const tools::Long nNewFirstLineIndent = nAlignedAt - nValue;
aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
pActNum->SetLevel( i, aNumFmt );
}
@@ -3330,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 9abd756f9d74..0fec60690e9a 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -18,15 +18,18 @@
*/
#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>
#include <sfx2/htmlmode.hxx>
#include <sal/macros.h>
+#include <osl/diagnose.h>
#include <svx/strings.hrc>
#include <svx/dialmgr.hxx>
@@ -46,27 +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 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[] =
@@ -80,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;
@@ -89,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];
}
@@ -106,7 +106,7 @@ static Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxIt
}
-static long ConvertLong_Impl( const long nIn, MapUnit eUnit )
+static tools::Long ConvertLong_Impl( const tools::Long nIn, MapUnit eUnit )
{
return OutputDevice::LogicToLogic( nIn, eUnit, MapUnit::MapTwip );
}
@@ -116,8 +116,8 @@ static bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
if ( pSize )
{
Size aSize = pSize->GetSize();
- long nDiffW = std::abs( rSize.Width () - aSize.Width () );
- long nDiffH = std::abs( rSize.Height() - aSize.Height() );
+ tools::Long nDiffW = std::abs( rSize.Width () - aSize.Width () );
+ tools::Long nDiffH = std::abs( rSize.Height() - aSize.Height() );
return ( nDiffW < 10 && nDiffH < 10 );
}
else
@@ -149,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"))
@@ -161,6 +160,8 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
, m_xRightMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargRight", FieldUnit::CM))
, m_xTopMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargTop", FieldUnit::CM))
, m_xBottomMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargBot", FieldUnit::CM))
+ , m_xGutterMarginLbl(m_xBuilder->weld_label("labelGutterMargin"))
+ , m_xGutterMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargGut", FieldUnit::CM))
, m_xPageText(m_xBuilder->weld_label("labelPageLayout"))
, m_xLayoutBox(m_xBuilder->weld_combo_box("comboPageLayout"))
, m_xNumberFormatText(m_xBuilder->weld_label("labelPageNumbers"))
@@ -172,6 +173,10 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
, m_xRegisterCB(m_xBuilder->weld_check_button("checkRegisterTrue"))
, m_xRegisterFT(m_xBuilder->weld_label("labelRegisterStyle"))
, 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"))
@@ -186,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
@@ -230,6 +236,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController*
SetFieldUnit( *m_xRightMarginEdit, eFUnit );
SetFieldUnit( *m_xTopMarginEdit, eFUnit );
SetFieldUnit( *m_xBottomMarginEdit, eFUnit );
+ SetFieldUnit(*m_xGutterMarginEdit, eFUnit);
SetFieldUnit( *m_xPaperWidthEdit, eFUnit );
SetFieldUnit( *m_xPaperHeightEdit, eFUnit );
@@ -267,19 +274,19 @@ 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(officecfg::Office::Common::Drawinglayer::MaximumPaperLeftMargin::get()),
+ FieldUnit::MM);
// Get the i18n framework numberings and add them to the listbox.
SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xNumberFormatBox->get_widget(), std::numeric_limits<sal_uInt16>::max());
@@ -298,18 +305,20 @@ void SvxPageDescPage::Init_Impl()
{
// adjust the handler
m_xLayoutBox->connect_changed(LINK(this, SvxPageDescPage, LayoutHdl_Impl));
+ m_xGutterPositionLB->connect_changed(LINK(this, SvxPageDescPage, GutterPositionHdl_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);
m_xRightMarginEdit->connect_value_changed(aLink);
m_xTopMarginEdit->connect_value_changed(aLink);
m_xBottomMarginEdit->connect_value_changed(aLink);
+ m_xGutterMarginEdit->connect_value_changed(aLink);
m_xHorzBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
m_xVertBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
@@ -318,7 +327,7 @@ void SvxPageDescPage::Init_Impl()
void SvxPageDescPage::Reset( const SfxItemSet* rSet )
{
SfxItemPool* pPool = rSet->GetPool();
- DBG_ASSERT( pPool, "Where is the pool?" );
+ SAL_WARN_IF(!pPool, "cui.tabpages", "Where is the pool?");
MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) );
// adjust margins (right/left)
@@ -328,6 +337,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
{
const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
SetMetricValue( *m_xLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
+ SetMetricValue(*m_xGutterMarginEdit, rLRSpace.GetGutterMargin(), eUnit);
m_aBspWin.SetLeft(
static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetLeft(), eUnit )) );
SetMetricValue( *m_xRightMarginEdit, rLRSpace.GetRight(), eUnit );
@@ -343,10 +353,46 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
SetMetricValue( *m_xTopMarginEdit, rULSpace.GetUpper(), eUnit );
m_aBspWin.SetTop(
- static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetUpper()), eUnit )) );
+ static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetUpper()), eUnit )) );
SetMetricValue( *m_xBottomMarginEdit, rULSpace.GetLower(), eUnit );
m_aBspWin.SetBottom(
- static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetLower()), eUnit )) );
+ static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetLower()), eUnit )) );
+ }
+
+ if (const SfxGrabBagItem* pGragbagItem = rSet->GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
+ {
+ bool bGutterAtTop{};
+ auto it = pGragbagItem->GetGrabBag().find("GutterAtTop");
+ if (it != pGragbagItem->GetGrabBag().end())
+ {
+ it->second >>= bGutterAtTop;
+ }
+
+ if (bGutterAtTop)
+ {
+ m_xGutterPositionLB->set_active(1);
+ }
+ else
+ {
+ // 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
@@ -412,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 ) ) );
@@ -469,6 +515,11 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_aBspWin.SetHorz(m_xHorzBox->get_active());
m_aBspWin.SetVert(m_xVertBox->get_active());
+ m_xGutterMarginLbl->hide();
+ m_xGutterMarginEdit->hide();
+ m_xGutterPositionFT->hide();
+ m_xGutterPositionLB->hide();
+
break;
}
@@ -484,6 +535,11 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_xLayoutBox->hide();
m_xPageText->hide();
+ m_xGutterMarginLbl->hide();
+ m_xGutterMarginEdit->hide();
+ m_xGutterPositionFT->hide();
+ m_xGutterPositionLB->hide();
+
break;
}
default: ;//prevent warning
@@ -505,6 +561,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_xRightMarginEdit->save_value();
m_xTopMarginEdit->save_value();
m_xBottomMarginEdit->save_value();
+ m_xGutterMarginEdit->save_value();
m_xLayoutBox->save_value();
m_xNumberFormatBox->save_value();
m_xPaperSizeBox->save_value();
@@ -516,21 +573,23 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_xVertBox->save_state();
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();
}
@@ -584,6 +643,12 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
bModified = true;
}
+ if (m_xGutterMarginEdit->get_value_changed_from_saved())
+ {
+ aMargin.SetGutterMargin(static_cast<sal_uInt16>(GetCoreValue(*m_xGutterMarginEdit, eUnit)));
+ bModified = true;
+ }
+
// set left and right margins
if (bModified)
{
@@ -595,6 +660,40 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
bModified = false;
}
+ if (rOldSet.HasItem(SID_ATTR_CHAR_GRABBAG))
+ {
+ // Set gutter position.
+ 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)
+ {
+ pOld = rOldSet.GetItem(SID_ATTR_CHAR_GRABBAG);
+
+ if (!pOld || static_cast<const SfxGrabBagItem&>(*pOld) != aGrabBagItem)
+ rSet->Put(aGrabBagItem);
+ else
+ bModified = false;
+ }
+ }
+
bool bMod = false;
if (m_xTopMarginEdit->get_value_changed_from_saved())
@@ -623,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;
}
@@ -749,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);
@@ -795,6 +894,11 @@ IMPL_LINK_NOARG(SvxPageDescPage, LayoutHdl_Impl, weld::ComboBox&, void)
UpdateExample_Impl( true );
}
+IMPL_LINK_NOARG(SvxPageDescPage, GutterPositionHdl_Impl, weld::ComboBox&, void)
+{
+ UpdateExample_Impl(true);
+}
+
IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
{
// tdf#124226 disconnect so not called again, unless Reset occurs
@@ -816,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
@@ -854,8 +958,8 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
return;
// Draw: if paper format the margin shall be 1 cm
- long nTmp = 0;
- bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper));
+ tools::Long nTmp = 0;
+ 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
@@ -897,18 +1001,15 @@ 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();
- const long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
- const long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
+ const tools::Long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
+ const tools::Long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
// swap width and height
SetMetricValue(*m_xPaperWidthEdit, lHeight, MapUnit::Map100thMM);
@@ -955,10 +1056,10 @@ void SvxPageDescPage::SwapFirstValues_Impl( bool bSet )
sal_Int64 nSetB = m_xBottomMarginEdit->denormalize(
m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
- long nNewL = aPrintOffset.X();
- long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
- long nNewT = aPrintOffset.Y();
- long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
+ tools::Long nNewL = aPrintOffset.X();
+ tools::Long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
+ tools::Long nNewT = aPrintOffset.Y();
+ tools::Long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(nNewL), FieldUnit::TWIP);
nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(nNewR), FieldUnit::TWIP);
@@ -1000,9 +1101,20 @@ void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
m_aBspWin.SetSize( aSize );
// Margins
- m_aBspWin.SetTop( GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip ) );
+ bool bGutterAtTop = m_xGutterPositionLB->get_active() == 1;
+ tools::Long nTop = GetCoreValue(*m_xTopMarginEdit, MapUnit::MapTwip);
+ if (bGutterAtTop)
+ {
+ nTop += GetCoreValue(*m_xGutterMarginEdit, MapUnit::MapTwip);
+ }
+ m_aBspWin.SetTop(nTop);
m_aBspWin.SetBottom( GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip ) );
- m_aBspWin.SetLeft( GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip ) );
+ tools::Long nLeft = GetCoreValue(*m_xLeftMarginEdit, MapUnit::MapTwip);
+ if (!bGutterAtTop)
+ {
+ nLeft += GetCoreValue(*m_xGutterMarginEdit, MapUnit::MapTwip);
+ }
+ m_aBspWin.SetLeft(nLeft);
m_aBspWin.SetRight( GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip ) );
// Layout
@@ -1021,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())
{
@@ -1040,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);
@@ -1057,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())
{
@@ -1076,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);
@@ -1088,7 +1200,6 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
}
drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;
- const SfxPoolItem* pItem = nullptr;
if(mbEnableDrawingLayerFillStyles)
{
@@ -1097,13 +1208,13 @@ void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
}
else
{
- pItem = GetItem(rSet, SID_ATTR_BRUSH);
+ const SfxPoolItem* pItem = GetItem(rSet, SID_ATTR_BRUSH);
if(pItem)
{
// 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);
@@ -1131,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 ) ));
- long nDist = rUL.GetLower();
+ 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 );
@@ -1167,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);
@@ -1186,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 ) ));
- long nDist = rUL.GetUpper();
+ 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 );
@@ -1222,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);
@@ -1247,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,
@@ -1298,20 +1409,20 @@ DeactivateRC SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
void SvxPageDescPage::RangeHdl_Impl()
{
// example window
- long nHHeight = m_aBspWin.GetHdHeight();
- long nHDist = m_aBspWin.GetHdDist();
+ tools::Long nHHeight = m_aBspWin.GetHdHeight();
+ tools::Long nHDist = m_aBspWin.GetHdDist();
- long nFHeight = m_aBspWin.GetFtHeight();
- long nFDist = m_aBspWin.GetFtDist();
+ tools::Long nFHeight = m_aBspWin.GetFtHeight();
+ tools::Long nFDist = m_aBspWin.GetFtDist();
- long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
- long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
+ tools::Long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
+ tools::Long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
// current values for page margins
- long nBT = static_cast<long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
- long nBB = static_cast<long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
- long nBL = static_cast<long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
- long nBR = static_cast<long>(m_xRightMarginEdit->denormalize(m_xRightMarginEdit->get_value(FieldUnit::TWIP)));
+ tools::Long nBT = static_cast<tools::Long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
+ tools::Long nBB = static_cast<tools::Long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
+ tools::Long nBL = static_cast<tools::Long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
+ tools::Long nBR = static_cast<tools::Long>(m_xRightMarginEdit->denormalize(m_xRightMarginEdit->get_value(FieldUnit::TWIP)));
// calculate width of page border
const SfxItemSet* _pSet = &GetItemSet();
@@ -1323,25 +1434,25 @@ 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
// maximum is 54 cm
- long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
+ tools::Long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
MINBODY + aBorder.Height();
m_xPaperHeightEdit->set_min(m_xPaperHeightEdit->normalize(nMin), FieldUnit::TWIP);
nMin = MINBODY + nBL + nBR + aBorder.Width();
m_xPaperWidthEdit->set_min(m_xPaperWidthEdit->normalize(nMin), FieldUnit::TWIP);
- long nH = static_cast<long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
- long nW = static_cast<long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
+ tools::Long nH = static_cast<tools::Long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
+ tools::Long nW = static_cast<tools::Long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
// Top
- long nMax = nH - nBB - aBorder.Height() - MINBODY -
+ tools::Long nMax = nH - nBB - aBorder.Height() - MINBODY -
nFDist - nFHeight - nHDist - nHHeight;
m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(nMax), FieldUnit::TWIP);
@@ -1364,24 +1475,24 @@ void SvxPageDescPage::RangeHdl_Impl()
void SvxPageDescPage::CalcMargin_Impl()
{
// current values for page margins
- long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
- long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
+ tools::Long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
+ tools::Long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
- long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
- long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
+ tools::Long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
+ tools::Long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
- long nH = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
- long nW = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
+ tools::Long nH = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
+ tools::Long nW = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
- long nWidth = nBL + nBR + MINBODY;
- long nHeight = nBT + nBB + MINBODY;
+ tools::Long nWidth = nBL + nBR + MINBODY;
+ tools::Long nHeight = nBT + nBB + MINBODY;
if ( nWidth <= nW && nHeight <= nH )
return;
if ( nWidth > nW )
{
- long nTmp = nBL <= nBR ? nBR : nBL;
+ tools::Long nTmp = nBL <= nBR ? nBR : nBL;
nTmp -= nWidth - nW;
if ( nBL <= nBR )
@@ -1392,7 +1503,7 @@ void SvxPageDescPage::CalcMargin_Impl()
if ( nHeight > nH )
{
- long nTmp = nBT <= nBB ? nBB : nBT;
+ tools::Long nTmp = nBT <= nBB ? nBB : nBT;
nTmp -= nHeight - nH;
if ( nBT <= nBB )
@@ -1402,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());
@@ -1425,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())
@@ -1457,11 +1568,11 @@ IMPL_LINK_NOARG(SvxPageDescPage, FrameDirectionModify_Impl, weld::ComboBox&, voi
}
bool SvxPageDescPage::IsPrinterRangeOverflow(
- weld::MetricSpinButton& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
+ weld::MetricSpinButton& rField, tools::Long nFirstMargin, tools::Long nLastMargin, MarginPosition nPos )
{
bool bRet = false;
bool bCheck = ( ( m_nPos & nPos ) == 0 );
- long nValue = rField.get_value(FieldUnit::NONE);
+ tools::Long nValue = rField.get_value(FieldUnit::NONE);
if ( bCheck &&
( nValue < nFirstMargin || nValue > nLastMargin ) &&
rField.get_value_changed_from_saved() )
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 5f6ae38d3ad9..98ee3558f0dd 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,43 +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>
-
-#include <sfx2/viewfrm.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 {
@@ -100,10 +104,10 @@ enum LineSpaceList
}
-static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
+static void SetLineSpace_Impl( SvxLineSpacingItem&, int, tools::Long lValue = 0 );
void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
- int eSpace, long lValue )
+ int eSpace, tools::Long lValue )
{
switch ( eSpace )
{
@@ -153,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;
@@ -172,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();
}
@@ -216,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?" );
@@ -232,7 +237,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
m_xLineDistAtMetricBox->get_value_changed_from_saved() ) )
{
nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
- MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( nWhich );
+ MapUnit eUnit = pPool->GetMetric( nWhich );
SvxLineSpacingItem aSpacing(
static_cast<const SvxLineSpacingItem&>(GetItemSet().Get( nWhich )) );
@@ -247,7 +252,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
case LLINESPACE_PROP:
SetLineSpace_Impl( aSpacing, nPos,
- static_cast<long>(m_xLineDistAtPercentBox->denormalize(
+ static_cast<tools::Long>(m_xLineDistAtPercentBox->denormalize(
m_xLineDistAtPercentBox->get_value(FieldUnit::NONE) )) );
break;
@@ -262,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 );
@@ -289,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;
@@ -319,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 );
@@ -336,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;
@@ -400,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 ) )
@@ -417,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();
@@ -424,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 );
@@ -461,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());
}
@@ -502,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 );
@@ -530,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 );
@@ -588,7 +820,6 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
sal_uInt16 nHtmlMode = GetHtmlMode_Impl(*rSet);
if(nHtmlMode & HTMLMODE_ON)
{
- m_xRegisterFL->hide();
m_xRegisterCB->hide();
m_xAutoCB->hide();
}
@@ -602,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();
}
@@ -619,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;
}
@@ -678,33 +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_xRegisterFL(m_xBuilder->weld_widget("frameFL_REGISTER"))
, 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()
@@ -713,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
@@ -724,7 +954,7 @@ void SvxStdParagraphTabPage::SetLineSpacing_Impl
const SvxLineSpacingItem &rAttr
)
{
- MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( rAttr.Which() );
+ MapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() );
switch( rAttr.GetLineSpaceRule() )
{
@@ -805,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:
@@ -816,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:
@@ -853,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;
@@ -874,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<long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
- m_aExampleWin.SetRightMargin( static_cast<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();
@@ -921,7 +1150,6 @@ void SvxStdParagraphTabPage::UpdateExample_Impl()
void SvxStdParagraphTabPage::EnableRegisterMode()
{
m_xRegisterCB->show();
- m_xRegisterFL->show();
}
void SvxStdParagraphTabPage::EnableContextualMode()
@@ -929,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()
@@ -941,12 +1169,6 @@ void SvxStdParagraphTabPage::EnableAutoFirstLine()
m_xAutoCB->show();
}
-void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip)
-{
- m_xLineDist->append_text(sAbsDist);
- nMinFixDist = nMinTwip;
-}
-
void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
{
@@ -959,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();
@@ -976,9 +1197,6 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
EnableAutoFirstLine();
}
- if(pLineDistItem)
- EnableAbsLineDist(pLineDistItem->GetValue());
-
if (pFlagSetItem)
{
if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
@@ -997,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"))
@@ -1010,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());
@@ -1039,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);
@@ -1127,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;
}
@@ -1213,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 );
@@ -1259,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);
@@ -1347,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);
@@ -1374,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())
@@ -1427,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 &&
@@ -1442,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
@@ -1451,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 );
@@ -1513,18 +1795,12 @@ 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 );
-
- if ( !pOld || static_cast<const SvxFormatSplitItem*>(pOld)->GetValue() !=
- ( eState == TRISTATE_FALSE ) )
- {
- rOutSet->Put( SvxFormatSplitItem( eState == TRISTATE_FALSE, _nWhich ) );
- bModified = true;
- }
+ rOutSet->Put( SvxFormatSplitItem( eState == TRISTATE_TRUE, _nWhich ) );
+ bModified = true;
}
// keep paragraphs
@@ -1539,14 +1815,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 ) )
@@ -1556,14 +1832,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() ||
@@ -1579,6 +1855,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 );
@@ -1592,40 +1876,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);
@@ -1647,16 +1952,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)
@@ -1685,7 +1988,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);
@@ -1757,7 +2060,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
{
@@ -1787,7 +2090,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);
@@ -1799,70 +2102,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();
@@ -1871,9 +2173,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();
@@ -1881,7 +2190,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();
@@ -1917,12 +2226,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"))
@@ -1934,7 +2250,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"))
@@ -1942,13 +2258,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));
@@ -1956,14 +2277,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() )
@@ -1982,14 +2307,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);
}
@@ -2038,23 +2374,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()
@@ -2064,11 +2400,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);
@@ -2077,13 +2413,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();
@@ -2096,12 +2432,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);
@@ -2114,16 +2450,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();
@@ -2149,7 +2496,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();
@@ -2201,13 +2548,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);
}
@@ -2221,6 +2568,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"))
@@ -2238,14 +2614,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 )
@@ -2255,7 +2626,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;
@@ -2263,7 +2634,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;
@@ -2271,7 +2642,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;
@@ -2281,7 +2652,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 54bb58f2c999..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;
@@ -98,8 +102,9 @@ enum class LB {
VertLine = 0x080000, // vertical text line
RelPagePrintAreaBottom = 0x100000, // bottom of text area of page
+ RelPagePrintAreaTop = 0x200000,
- LAST = 0x200000
+ LAST = 0x400000
};
}
@@ -118,6 +123,7 @@ RelationMap const aRelationMap[] =
{SvxSwFramePosString::REL_FRM_RIGHT, SvxSwFramePosString::MIR_REL_FRM_RIGHT, LB::RelFrameRight, RelOrientation::FRAME_RIGHT},
{SvxSwFramePosString::REL_PG_FRAME, SvxSwFramePosString::REL_PG_FRAME, LB::RelPageFrame, RelOrientation::PAGE_FRAME},
{SvxSwFramePosString::REL_PG_PRTAREA,SvxSwFramePosString::REL_PG_PRTAREA, LB::RelPagePrintArea, RelOrientation::PAGE_PRINT_AREA},
+ {SvxSwFramePosString::REL_PG_PRTAREA_TOP,SvxSwFramePosString::REL_PG_PRTAREA_TOP, LB::RelPagePrintAreaTop, RelOrientation::PAGE_PRINT_AREA_TOP},
{SvxSwFramePosString::REL_PG_PRTAREA_BOTTOM,SvxSwFramePosString::REL_PG_PRTAREA_BOTTOM, LB::RelPagePrintAreaBottom, RelOrientation::PAGE_PRINT_AREA_BOTTOM},
{SvxSwFramePosString::REL_CHAR, SvxSwFramePosString::REL_CHAR, LB::RelChar, RelOrientation::CHAR},
@@ -202,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[] =
{
@@ -259,14 +265,14 @@ FrmMap const aHParaHtmlAbsMap[] =
constexpr auto VERT_PARA_REL = LB::VertFrame|LB::VertPrintArea|
- LB::RelPageFrame|LB::RelPagePrintArea;
+ LB::RelPageFrame|LB::RelPagePrintArea| LB::RelPagePrintAreaTop |LB::RelPagePrintAreaBottom;
FrmMap const aVParaMap[] =
{
{SvxSwFramePosString::TOP, SvxSwFramePosString::TOP, VertOrientation::TOP, VERT_PARA_REL},
{SvxSwFramePosString::BOTTOM, SvxSwFramePosString::BOTTOM, VertOrientation::BOTTOM, VERT_PARA_REL},
{SvxSwFramePosString::CENTER_VERT, SvxSwFramePosString::CENTER_VERT, VertOrientation::CENTER, VERT_PARA_REL},
- {SvxSwFramePosString::FROMTOP, SvxSwFramePosString::FROMTOP, VertOrientation::NONE, VERT_PARA_REL|LB::RelPagePrintAreaBottom}
+ {SvxSwFramePosString::FROMTOP, SvxSwFramePosString::FROMTOP, VertOrientation::NONE, VERT_PARA_REL}
};
FrmMap const aVParaHtmlMap[] =
@@ -308,7 +314,7 @@ static FrmMap aHCharHtmlAbsMap[] =
// #i18732# - allow vertical alignment at page areas
// #i22341# - handle <LB::RelChar> on its own
constexpr auto VERT_CHAR_REL = LB::VertFrame|LB::VertPrintArea|
- LB::RelPageFrame|LB::RelPagePrintArea;
+ LB::RelPageFrame|LB::RelPagePrintArea|LB::RelPagePrintAreaBottom;
static FrmMap aVCharMap[] =
{
@@ -323,7 +329,7 @@ static FrmMap aVCharMap[] =
{SvxSwFramePosString::BOTTOM, SvxSwFramePosString::BOTTOM, VertOrientation::BOTTOM, VERT_CHAR_REL|LB::RelChar},
{SvxSwFramePosString::BELOW, SvxSwFramePosString::BELOW, VertOrientation::CHAR_BOTTOM, LB::RelChar},
{SvxSwFramePosString::CENTER_VERT, SvxSwFramePosString::CENTER_VERT, VertOrientation::CENTER, VERT_CHAR_REL|LB::RelChar},
- {SvxSwFramePosString::FROMTOP, SvxSwFramePosString::FROMTOP, VertOrientation::NONE, VERT_CHAR_REL|LB::RelPagePrintAreaBottom},
+ {SvxSwFramePosString::FROMTOP, SvxSwFramePosString::FROMTOP, VertOrientation::NONE, VERT_CHAR_REL},
{SvxSwFramePosString::FROMBOTTOM, SvxSwFramePosString::FROMBOTTOM, VertOrientation::NONE, LB::RelChar|LB::VertLine},
{SvxSwFramePosString::TOP, SvxSwFramePosString::TOP, VertOrientation::LINE_TOP, LB::VertLine},
{SvxSwFramePosString::BOTTOM, SvxSwFramePosString::BOTTOM, VertOrientation::LINE_BOTTOM, LB::VertLine},
@@ -376,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(
@@ -463,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;
}
}
@@ -536,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"))
@@ -572,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);
@@ -587,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 );
@@ -624,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;
@@ -683,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;
@@ -716,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)
@@ -761,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;
}
@@ -772,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;
}
@@ -796,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;
}
@@ -807,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);
@@ -836,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);
@@ -874,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));
}
}
}
@@ -883,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;
}
@@ -1062,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 );
}
@@ -1121,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());
}
@@ -1201,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);
@@ -1221,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);
@@ -1281,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);
}
@@ -1367,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())
{
@@ -1384,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;
}
@@ -1402,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;
@@ -1463,8 +1477,8 @@ void SvxSwPosSizeTabPage::InitPos(RndStdIds nAnchor,
sal_uInt16 nHRel,
sal_uInt16 nV,
sal_uInt16 nVRel,
- long nX,
- long nY)
+ tools::Long nX,
+ tools::Long nY)
{
int nPos = m_xVertLB->get_active();
if (nPos != -1 && m_pVMap)
@@ -1472,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();
@@ -1482,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;
@@ -1657,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)
{
@@ -1665,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;
@@ -1682,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);
@@ -1709,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;
}
@@ -1746,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;
@@ -1754,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);
@@ -1879,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 939a51e41256..b3a1745c26f9 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -32,14 +32,10 @@
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( long nDefDist, SvxTabStopItem& rTabs )
+static void FillUpWithDefTabs_Impl( tools::Long nDefDist, SvxTabStopItem& rTabs )
{
if( rTabs.Count() )
return;
@@ -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;
}
}
@@ -250,7 +249,7 @@ void SvxTabulatorTabPage::Reset(const SfxItemSet* rSet)
pItem = GetItem(*rSet, SID_ATTR_TABSTOP_DEFAULTS);
if (pItem)
- nDefDist = OutputDevice::LogicToLogic(long(static_cast<const SfxUInt16Item*>(pItem)->GetValue()), eUnit, MapUnit::Map100thMM);
+ nDefDist = OutputDevice::LogicToLogic(tools::Long(static_cast<const SfxUInt16Item*>(pItem)->GetValue()), eUnit, MapUnit::Map100thMM);
// Tab pos currently selected
sal_uInt16 nTabPos = 0;
@@ -316,11 +315,10 @@ void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
{
m_xTabBox->clear();
- long nOffset = 0;
- const SfxPoolItem* pItem = nullptr;
- if (GetItemSet().GetItemState(SID_ATTR_TABSTOP_OFFSET, true, &pItem) == SfxItemState::SET)
+ tools::Long nOffset = 0;
+ 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);
}
@@ -430,17 +428,15 @@ void SvxTabulatorTabPage::NewHdl_Impl(const weld::Button* pBtn)
if (nVal == 0 && pBtn == nullptr)
return;
- long nOffset = 0;
- const SfxPoolItem* pItem = nullptr;
+ tools::Long nOffset = 0;
- 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 );
}
- const long nReal = nVal - nOffset;
+ const tools::Long nReal = nVal - nOffset;
sal_Int32 nSize = m_xTabBox->get_count();
sal_Int32 i;
@@ -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 ab5dc095bfff..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();
@@ -70,7 +68,7 @@ void SvxTextTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage)
if (rMarkList.GetMarkCount() == 1)
{
const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- eKind = static_cast<SdrObjKind>(pObj->GetObjIdentifier());
+ eKind = pObj->GetObjIdentifier();
}
}
}
@@ -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,9 +182,9 @@ 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 );
- long nValue = static_cast<long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
+ tools::Long nValue = static_cast<tools::Long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
m_xNumFldCount->set_value(nValue);
if (nValue == 0)
{
@@ -209,9 +207,9 @@ 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<long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
+ nValue = static_cast<tools::Long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
m_xMtrFldDelay->set_value(nValue, FieldUnit::NONE);
if (nValue == 0)
{
@@ -226,9 +224,9 @@ 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<long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
+ nValue = static_cast<tools::Long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
if (nValue <= 0)
{
m_xTsbPixel->set_state(TRISTATE_TRUE);
@@ -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 c9eaf461c94d..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 );
@@ -368,8 +365,8 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
// centered
RectPoint eRP = m_aCtlPosition.GetActualRP();
- SdrTextVertAdjust eTVA, eOldTVA;
- SdrTextHorzAdjust eTHA, eOldTHA;
+ SdrTextVertAdjust eTVA;
+ SdrTextHorzAdjust eTHA;
switch( eRP )
{
@@ -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 )
- {
- 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 )
- {
- 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 87f22835adc3..2990f4473e91 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -66,15 +66,8 @@ enum TileOffset
}
-const sal_uInt16 SvxBitmapTabPage::pBitmapRanges[] =
-{
- SID_ATTR_TRANSFORM_WIDTH,
- SID_ATTR_TRANSFORM_HEIGHT,
- 0
-};
-
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)
@@ -83,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")))
- , 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))
@@ -98,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) );
@@ -113,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);
@@ -134,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();
@@ -265,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())
@@ -303,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)
@@ -315,45 +310,41 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
else
m_xBitmapStyleLB->set_active(static_cast<sal_Int32>(CUSTOM));
- long nWidth = 0;
- long nHeight = 0;
+ 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);
}
@@ -376,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);
@@ -390,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);
@@ -398,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)
@@ -408,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)
@@ -439,8 +430,8 @@ void SvxBitmapTabPage::CalculateBitmapPresetSize()
if(rBitmapSize.IsEmpty())
return;
- long nObjectWidth = static_cast<long>(m_fObjectWidth);
- long nObjectHeight = static_cast<long>(m_fObjectHeight);
+ tools::Long nObjectWidth = static_cast<tools::Long>(m_fObjectWidth);
+ tools::Long nObjectHeight = static_cast<tools::Long>(m_fObjectHeight);
if(std::abs(rBitmapSize.Width() - nObjectWidth) < std::abs(rBitmapSize.Height() - nObjectHeight))
{
@@ -469,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()));
}
}
@@ -497,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 );
@@ -527,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();
@@ -536,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);
@@ -570,17 +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)
- {
- m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) );
- m_xBitmapLB->RemoveItem( nId );
- nId = m_xBitmapLB->GetItemId(0);
- m_xBitmapLB->SelectItem( nId );
+ if (xQueryBox->run() != RET_YES)
+ return;
- m_aCtlBitmapPreview.Invalidate();
- ModifyBitmapHdl(m_xBitmapLB.get());
- *m_pnBitmapListState |= ChangeType::MODIFIED;
- }
+ sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1);
+ if (!nNextId)
+ nNextId = m_xBitmapLB->GetItemId(nPos - 1);
+
+ m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) );
+ m_xBitmapLB->RemoveItem( nId );
+
+ m_xBitmapLB->SelectItem(nNextId);
+
+ m_aCtlBitmapPreview.Invalidate();
+ ModifyBitmapHdl(m_xBitmapLB.get());
+ *m_pnBitmapListState |= ChangeType::MODIFIED;
}
IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&, void )
@@ -599,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)
{
@@ -718,9 +713,9 @@ 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);
- long nCount = m_pBitmapList->Count();
+ tools::Long nCount = m_pBitmapList->Count();
if( aDlg.Execute() )
return;
@@ -733,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;
@@ -745,11 +740,11 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void)
while( pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bool bDifferent = true;
- for( long i = 0; i < nCount && bDifferent; i++ )
+ for( tools::Long i = 0; i < nCount && bDifferent; i++ )
if( aName == m_pBitmapList->GetBitmap( i )->GetName() )
bDifferent = false;
@@ -791,10 +786,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void)
sal_Int32 SvxBitmapTabPage::SearchBitmapList(const GraphicObject& rGraphicObject)
{
- long nCount = m_pBitmapList->Count();
+ tools::Long nCount = m_pBitmapList->Count();
sal_Int32 nPos = -1;
- for(long i = 0;i < nCount;i++)
+ for(tools::Long i = 0;i < nCount;i++)
{
if(rGraphicObject.GetUniqueID() == m_pBitmapList->GetBitmap( i )->GetGraphicObject().GetUniqueID())
{
@@ -805,13 +800,13 @@ sal_Int32 SvxBitmapTabPage::SearchBitmapList(const GraphicObject& rGraphicObject
return nPos;
}
-sal_Int32 SvxBitmapTabPage::SearchBitmapList(const OUString& rBitmapName)
+sal_Int32 SvxBitmapTabPage::SearchBitmapList(std::u16string_view rBitmapName)
{
- long nCount = m_pBitmapList->Count();
+ tools::Long nCount = m_pBitmapList->Count();
bool bValidBitmapName = true;
sal_Int32 nPos = -1;
- for(long i = 0;i < nCount && bValidBitmapName;i++)
+ for(tools::Long i = 0;i < nCount && bValidBitmapName;i++)
{
if(rBitmapName == m_pBitmapList->GetBitmap( i )->GetName())
{
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 8a79dcd44c9e..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,8 +49,7 @@ 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")))
+ , m_xValSetColorList(new SvxColorValueSet(m_xBuilder->weld_scrolled_window("colorsetwin", true)))
, m_xValSetRecentList(new SvxColorValueSet(nullptr))
, m_xSelectPalette(m_xBuilder->weld_combo_box("paletteselector"))
, m_xRbRGB(m_xBuilder->weld_radio_button("RGB"))
@@ -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(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,10 +332,10 @@ 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;
- long j = 1;
+ tools::Long j = 1;
bool bValidColorName = false;
// check if name is already existing
while (!bValidColorName)
@@ -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) );
}
}
@@ -508,8 +545,8 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell)
{
case ColorModel::RGB:
{
- CmykToRgb_Impl (rColor, static_cast<sal_uInt16>(rColor.GetTransparency()) );
- rColor.SetTransparency (sal_uInt8(0));
+ CmykToRgb_Impl (rColor, static_cast<sal_uInt16>(255 - rColor.GetAlpha()) );
+ rColor.SetAlpha (255);
}
break;
@@ -517,13 +554,13 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell)
{
sal_uInt16 nK;
RgbToCmyk_Impl (rColor, nK );
- rColor.SetTransparency (static_cast<sal_uInt8>(nK));
+ rColor.SetAlpha (255 - static_cast<sal_uInt8>(nK));
}
break;
}
}
-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,54 +628,54 @@ 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( aCurrentColor.GetTransparency() ), 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(aPreviousColor.GetTransparency()),
+ 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 );
}
}
}
-sal_Int32 SvxColorTabPage::FindInCustomColors(OUString const & aColorName)
+sal_Int32 SvxColorTabPage::FindInCustomColors(std::u16string_view aColorName)
{
css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get());
- long nCount = aCustomColorNameList.getLength();
+ tools::Long nCount = aCustomColorNameList.getLength();
bool bValidColorName = true;
sal_Int32 nPos = -1;
- for(long i = 0;i < nCount && bValidColorName;i++)
+ for(tools::Long i = 0;i < nCount && bValidColorName;i++)
{
if(aColorName == aCustomColorNameList[i])
{
@@ -666,7 +714,7 @@ void SvxColorTabPage::RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK )
void SvxColorTabPage::CmykToRgb_Impl( Color& rColor, const sal_uInt16 nK )
{
- long lTemp;
+ tools::Long lTemp;
lTemp = 255 - ( rColor.GetRed() + nK );
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 628c042ee709..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,11 +55,13 @@ 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")))
+ , m_xGradientLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("gradientpresetlistwin", true)))
, m_xMtrIncrement(m_xBuilder->weld_spin_button("incrementmtr"))
, m_xCbIncrement(m_xBuilder->weld_check_button("autoincrement"))
, m_xBtnAdd(m_xBuilder->weld_button("add"))
@@ -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() );
@@ -153,7 +156,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet )
if ( aURL.getBase().getLength() > 18 )
{
- aString += aURL.getBase().copy( 0, 15 ) + "...";
+ aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
}
else
aString += aURL.getBase();
@@ -179,36 +182,38 @@ DeactivateRC SvxGradientTabPage::DeactivatePage( SfxItemSet* _pSet )
bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
{
- std::unique_ptr<XGradient> pXGradient;
- OUString aString;
+ 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() ));
- aString = m_xGradientLB->GetItemText( m_xGradientLB->GetSelectedItemId() );
- rSet->Put( XFillGradientItem( aString, *pXGradient ) );
+ pBGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() ));
+ OUString aString = m_xGradientLB->GetItemText( m_xGradientLB->GetSelectedItemId() );
+ // 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()),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource
+ 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)),
static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)),
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;
@@ -216,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() )
@@ -263,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())
{
@@ -289,28 +293,29 @@ 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,
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource
+ 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)),
static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)),
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();
}
@@ -318,11 +323,11 @@ 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;
- long nCount = m_pGradientList->Count();
- long j = 1;
+ tools::Long nCount = m_pGradientList->Count();
+ tools::Long j = 1;
bool bValidGradientName = false;
while( !bValidGradientName )
@@ -337,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);
@@ -356,18 +361,21 @@ 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()),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource
+ 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)),
static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)),
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() );
@@ -396,18 +404,22 @@ 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()),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource
+ 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)),
static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)),
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 );
@@ -454,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();
@@ -463,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);
@@ -493,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 )
@@ -514,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() ));
}
}
@@ -523,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);
@@ -539,13 +555,20 @@ 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()));
- m_xMtrAngle->set_value(pGradient->GetAngle() / 10, FieldUnit::NONE); // should be changed in resource
- m_xSliderAngle->set_value(pGradient->GetAngle() / 10);
+ // 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);
m_xMtrBorder->set_value(pGradient->GetBorder(), FieldUnit::NONE);
m_xSliderBorder->set_value(pGradient->GetBorder());
m_xMtrCenterX->set_value(pGradient->GetXOffset(), FieldUnit::NONE);
@@ -610,13 +633,13 @@ void SvxGradientTabPage::SetControlState_Impl( css::awt::GradientStyle eXGS )
}
}
-sal_Int32 SvxGradientTabPage::SearchGradientList(const OUString& rGradientName)
+sal_Int32 SvxGradientTabPage::SearchGradientList(std::u16string_view rGradientName)
{
- long nCount = m_pGradientList->Count();
+ tools::Long nCount = m_pGradientList->Count();
bool bValidGradientName = true;
sal_Int32 nPos = -1;
- for(long i = 0;i < nCount && bValidGradientName;i++)
+ for(tools::Long i = 0;i < nCount && bValidGradientName;i++)
{
if(rGradientName == m_pGradientList->GetGradient( i )->GetName())
{
@@ -627,4 +650,25 @@ sal_Int32 SvxGradientTabPage::SearchGradientList(const OUString& rGradientName)
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 d1dbbc79aa30..ccfc12a7b445 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -54,10 +54,12 @@ 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_xHatchLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("hatchpresetlistwin")))
+ , 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"))
, m_xHatchLBWin(new weld::CustomWeld(*m_xBuilder, "hatchpresetlist", *m_xHatchLB))
@@ -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() );
@@ -153,7 +157,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet )
if ( aURL.getBase().getLength() > 18 )
{
- aString += aURL.getBase().copy( 0, 15 ) + "...";
+ aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
}
else
aString += aURL.getBase();
@@ -199,13 +203,13 @@ DeactivateRC SvxHatchTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-sal_Int32 SvxHatchTabPage::SearchHatchList(const OUString& rHatchName)
+sal_Int32 SvxHatchTabPage::SearchHatchList(std::u16string_view rHatchName)
{
- long nCount = m_pHatchingList->Count();
+ tools::Long nCount = m_pHatchingList->Count();
bool bValidHatchName = true;
sal_Int32 nPos = -1;
- for(long i = 0;i < nCount && bValidHatchName;i++)
+ for(tools::Long i = 0;i < nCount && bValidHatchName;i++)
{
if(rHatchName == m_pHatchingList->GetHatch( i )->GetName())
{
@@ -232,7 +236,7 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet )
pXHatch.reset(new XHatch( m_xLbLineColor->GetSelectEntryColor(),
static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()),
GetCoreValue( *m_xMtrDistance, m_ePoolUnit ),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) ));
+ Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) ));
}
assert( pXHatch && "XHatch couldn't be created" );
rSet->Put( XFillStyleItem( drawing::FillStyle_HATCH ) );
@@ -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);
@@ -332,7 +336,7 @@ void SvxHatchTabPage::ModifiedHdl_Impl( void const * p )
XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(),
static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()),
GetCoreValue( *m_xMtrDistance, m_ePoolUnit ),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) );
+ Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) );
m_rXFSet.Put( XFillHatchItem( OUString(), aXHatch ) );
@@ -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 )
@@ -378,7 +382,7 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl()
m_xLbLineColor->SetNoSelection();
m_xLbLineColor->SelectEntry( pHatch->GetColor() );
SetMetricValue( *m_xMtrDistance, pHatch->GetDistance(), m_ePoolUnit );
- long nHatchAngle = pHatch->GetAngle() / 10;
+ tools::Long nHatchAngle = pHatch->GetAngle().get() / 10;
m_xMtrAngle->set_value(nHatchAngle, FieldUnit::NONE);
m_xSliderAngle->set_value(nHatchAngle);
@@ -399,11 +403,11 @@ 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;
- long nCount = m_pHatchingList->Count();
- long j = 1;
+ tools::Long nCount = m_pHatchingList->Count();
+ tools::Long j = 1;
bool bValidHatchName = false;
while( !bValidHatchName )
@@ -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 )
@@ -440,7 +444,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void)
XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(),
static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()),
GetCoreValue( *m_xMtrDistance, m_ePoolUnit ),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) );
+ Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) );
m_pHatchingList->Insert(std::make_unique<XHatchEntry>(aXHatch, aName), nCount);
@@ -469,7 +473,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void)
XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(),
static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()),
GetCoreValue( *m_xMtrDistance, m_ePoolUnit ),
- static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) );
+ Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) );
m_pHatchingList->Replace(std::make_unique<XHatchEntry>(aXHatch, aName), nPos);
@@ -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 6079adcd5790..1c1635293823 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -45,7 +45,7 @@
#include <cuitabline.hxx>
#include <dialmgr.hxx>
#include <svx/dlgutil.hxx>
-#include <svx/svxgrahicitem.hxx>
+#include <svx/svxgraphicitem.hxx>
#include <svx/ofaitem.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdpage.hxx>
@@ -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() )
@@ -402,7 +398,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
pStyleItem.reset(new XLineStyleItem( drawing::LineStyle_DASH ));
// For added security
- if( m_pDashList->Count() > static_cast<long>( nPos - 2 ) )
+ if( m_pDashList->Count() > static_cast<tools::Long>( nPos - 2 ) )
{
XLineDashItem aDashItem( m_xLbLineStyle->get_active_text(),
m_pDashList->GetDash( nPos - 2 )->GetDash() );
@@ -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 ) )
{
@@ -479,12 +477,12 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
std::unique_ptr<XLineStartItem> pItem;
if( nPos == 0 )
pItem.reset(new XLineStartItem());
- else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) )
+ else if( m_pLineEndList->Count() > static_cast<tools::Long>( nPos - 1 ) )
pItem.reset(new XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
pOld = GetOldItem( *rAttrs, XATTR_LINESTART );
if( pItem && ( !pOld || *pOld != *pItem ) )
{
- rAttrs->Put( *pItem );
+ rAttrs->Put( std::move(pItem) );
bModified = true;
}
}
@@ -495,13 +493,13 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
std::unique_ptr<XLineEndItem> pItem;
if( nPos == 0 )
pItem.reset(new XLineEndItem());
- else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) )
+ else if( m_pLineEndList->Count() > static_cast<tools::Long>( nPos - 1 ) )
pItem.reset(new XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
pOld = GetOldItem( *rAttrs, XATTR_LINEEND );
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;
- long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
+ 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,51 +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);
- SdrObject *pObj=nullptr;
+ 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!
- 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();
@@ -873,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)
@@ -902,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);
@@ -917,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();
@@ -945,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 );
}
@@ -955,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 );
@@ -966,13 +963,13 @@ 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);
const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINESTART).GetLineStartValue();
- for(long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
+ for(tools::Long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
{
const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
@@ -998,13 +995,13 @@ 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);
const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINEEND).GetLineEndValue();
- for(long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
+ for(tools::Long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
{
const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
@@ -1030,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(),
@@ -1044,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(),
@@ -1058,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);
@@ -1075,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);
@@ -1088,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);
@@ -1118,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();
@@ -1142,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());
@@ -1255,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());
@@ -1312,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);
@@ -1324,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());
@@ -1369,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;
@@ -1428,7 +1437,7 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::ToggleButton&, void)
m_xSymbolMB->set_item_sensitive("gallery", false);
}
- if (!(!m_xSymbolsMenu && m_pSymbolList))
+ if (m_xSymbolsMenu || !m_pSymbolList)
return;
m_xSymbolsMenu = m_xBuilder->weld_menu("symbolssubmenu");
@@ -1436,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));
@@ -1501,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);
@@ -1511,15 +1519,15 @@ 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;
bool bResetSize = false;
bool bEnable = true;
- long nPreviousSymbolType = m_nSymbolType;
+ tools::Long nPreviousSymbolType = m_nSymbolType;
- OString sNumber;
+ OUString sNumber;
if (rIdent.startsWith("gallery", &sNumber))
{
SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get();
@@ -1546,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() )
@@ -1576,8 +1584,8 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
{ //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg)
if( m_aSymbolSize.Width() != m_aSymbolSize.Height() )
{
- aSize.setWidth( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
- aSize.setHeight( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
+ aSize.setWidth( static_cast<tools::Long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
+ aSize.setHeight( static_cast<tools::Long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
m_aSymbolSize = aSize;
}
}
@@ -1603,8 +1611,8 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
bool bWidth = &rField == m_xSymbolWidthMF.get();
m_bLastWidthModified = bWidth;
bool bRatio = m_xSymbolRatioCB->get_active();
- long nWidthVal = static_cast<long>(m_xSymbolWidthMF->denormalize(m_xSymbolWidthMF->get_value(FieldUnit::MM_100TH)));
- long nHeightVal= static_cast<long>(m_xSymbolHeightMF->denormalize(m_xSymbolHeightMF->get_value(FieldUnit::MM_100TH)));
+ tools::Long nWidthVal = static_cast<tools::Long>(m_xSymbolWidthMF->denormalize(m_xSymbolWidthMF->get_value(FieldUnit::MM_100TH)));
+ tools::Long nHeightVal= static_cast<tools::Long>(m_xSymbolHeightMF->denormalize(m_xSymbolHeightMF->get_value(FieldUnit::MM_100TH)));
nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit );
nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit);
m_aSymbolSize = Size(nWidthVal,nHeightVal);
@@ -1618,11 +1626,11 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
if (bWidth)
{
- long nDelta = nWidthVal - m_aSymbolLastSize.Width();
+ tools::Long nDelta = nWidthVal - m_aSymbolLastSize.Width();
m_aSymbolSize.setWidth( nWidthVal );
if (bRatio)
{
- m_aSymbolSize.setHeight( m_aSymbolLastSize.Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) );
+ m_aSymbolSize.setHeight( m_aSymbolLastSize.Height() + static_cast<tools::Long>(static_cast<double>(nDelta) / fSizeRatio) );
m_aSymbolSize.setHeight( OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM ) );
//TODO m_xSymbolHeightMF->SetUserValue(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FieldUnit::MM_100TH);
m_xSymbolHeightMF->set_value(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FieldUnit::MM_100TH);
@@ -1630,11 +1638,11 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
}
else
{
- long nDelta = nHeightVal - m_aSymbolLastSize.Height();
+ tools::Long nDelta = nHeightVal - m_aSymbolLastSize.Height();
m_aSymbolSize.setHeight( nHeightVal );
if (bRatio)
{
- m_aSymbolSize.setWidth( m_aSymbolLastSize.Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) );
+ m_aSymbolSize.setWidth( m_aSymbolLastSize.Width() + static_cast<tools::Long>(static_cast<double>(nDelta) * fSizeRatio) );
m_aSymbolSize.setWidth( OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM ) );
//TODO m_xSymbolWidthMF->SetUserValue(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FieldUnit::MM_100TH);
m_xSymbolWidthMF->set_value(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FieldUnit::MM_100TH);
@@ -1644,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())
{
@@ -1680,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 2cef64e0e22e..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,16 +369,16 @@ 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 )
{
- long nTmp1, nTmp2, nTmp3;
+ tools::Long nTmp1, nTmp2, nTmp3;
// was changed with Control
if( p )
@@ -412,7 +413,7 @@ void SvxLineDefTabPage::ChangeMetricHdl_Impl(const weld::ToggleButton* p)
}
else if( m_xCbxSynchronize->get_active() && m_xMtrLength1->get_unit() != FieldUnit::PERCENT )
{
- long nTmp1, nTmp2, nTmp3;
+ tools::Long nTmp1, nTmp2, nTmp3;
// was changed with Control
if( p )
@@ -488,11 +489,11 @@ 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;
- long nCount = pDashList->Count();
- long j = 1;
+ tools::Long nCount = pDashList->Count();
+ tools::Long j = 1;
bool bDifferent = false;
while ( !bDifferent )
@@ -500,7 +501,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
aName = aNewName + " " + OUString::number( j++ );
bDifferent = true;
- for ( long i = 0; i < nCount && bDifferent; i++ )
+ for ( tools::Long i = 0; i < nCount && bDifferent; i++ )
if ( aName == pDashList->GetDash( i )->GetName() )
bDifferent = false;
}
@@ -511,10 +512,10 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
while ( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bDifferent = true;
- for( long i = 0; i < nCount && bDifferent; i++ )
+ for( tools::Long i = 0; i < nCount && bDifferent; i++ )
{
if( aName == pDashList->GetDash( i )->GetName() )
bDifferent = false;
@@ -525,7 +526,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
bLoop = false;
FillDash_Impl();
- long nDashCount = pDashList->Count();
+ tools::Long nDashCount = pDashList->Count();
pDashList->Insert( std::make_unique<XDashEntry>(aDash, aName), nDashCount );
m_xLbLineStyles->Append( *pDashList->GetDash(nDashCount), pDashList->GetUiBitmap(nDashCount) );
@@ -568,22 +569,22 @@ 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;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc));
- long nCount = pDashList->Count();
+ tools::Long nCount = pDashList->Count();
bool bLoop = true;
while ( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bool bDifferent = true;
- for( long i = 0; i < nCount && bDifferent; i++ )
+ for( tools::Long i = 0; i < nCount && bDifferent; i++ )
{
if( aName == pDashList->GetDash( i )->GetName() &&
aName != aOldName )
@@ -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 a9db979bcda5..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,13 +270,13 @@ 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());
- long nCount = pLineEndList->Count();
+ tools::Long nCount = pLineEndList->Count();
bool bDifferent = true;
// check whether the name is existing already
- for ( long i = 0; i < nCount && bDifferent; i++ )
+ for ( tools::Long i = 0; i < nCount && bDifferent; i++ )
if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
bDifferent = false;
@@ -292,10 +293,10 @@ 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( long i = 0; i < nCount && bDifferent; i++ )
+ for( tools::Long i = 0; i < nCount && bDifferent; i++ )
{
if( aName == pLineEndList->GetLineEnd( i )->GetName() )
bDifferent = false;
@@ -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,14 +370,14 @@ 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;
- long nCount = pLineEndList->Count();
- long j = 1;
+ tools::Long nCount = pLineEndList->Count();
+ tools::Long j = 1;
bool bDifferent = false;
while ( !bDifferent )
@@ -384,7 +385,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
aName = aNewName + " " + OUString::number( j++ );
bDifferent = true;
- for( long i = 0; i < nCount && bDifferent; i++ )
+ for( tools::Long i = 0; i < nCount && bDifferent; i++ )
if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
bDifferent = false;
}
@@ -395,10 +396,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void)
while ( bLoop && pDlg->Execute() == RET_OK )
{
- pDlg->GetName( aName );
+ aName = pDlg->GetName();
bDifferent = true;
- for( long i = 0; i < nCount && bDifferent; i++ )
+ for( tools::Long i = 0; i < nCount && bDifferent; i++ )
{
if( aName == pLineEndList->GetLineEnd( i )->GetName() )
bDifferent = false;
@@ -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 a22197d773f8..9a37685951dd 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -77,9 +77,11 @@ 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_xPatternLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("patternpresetlistwin")))
+ , 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"))
, m_xCtlPixelWin(new weld::CustomWeld(*m_xBuilder, "CTL_PIXEL", *m_xCtlPixel))
@@ -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() );
@@ -151,7 +155,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet )
if( aURL.getBase().getLength() > 18 )
{
- aString += aURL.getBase().copy( 0, 15 ) + "...";
+ aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
}
else
aString += aURL.getBase();
@@ -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,11 +322,11 @@ 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;
- long nCount = m_pPatternList->Count();
- long j = 1;
+ tools::Long nCount = m_pPatternList->Count();
+ tools::Long j = 1;
bool bValidPatternName = false;
while( !bValidPatternName )
@@ -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);
@@ -534,13 +533,13 @@ void SvxPatternTabPage::PointChanged(weld::DrawingArea* pDrawingArea, RectPoint)
m_xPatternLB->SetNoSelection();
}
-sal_Int32 SvxPatternTabPage::SearchPatternList(const OUString& rPatternName)
+sal_Int32 SvxPatternTabPage::SearchPatternList(std::u16string_view rPatternName)
{
- long nCount = m_pPatternList->Count();
+ tools::Long nCount = m_pPatternList->Count();
bool bValidPatternName = true;
sal_Int32 nPos = -1;
- for(long i = 0;i < nCount && bValidPatternName;i++)
+ for(tools::Long i = 0;i < nCount && bValidPatternName;i++)
{
if(rPatternName == m_pPatternList->GetBitmap( i )->GetName())
{
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index de448b197fd4..ca2bc3b8a574 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -41,16 +41,13 @@
using namespace com::sun::star;
-const sal_uInt16 SvxShadowTabPage::pShadowRanges[] =
-{
- SDRATTR_SHADOWCOLOR,
- SDRATTR_SHADOWTRANSPARENCE,
- SID_ATTR_FILL_SHADOW,
- SID_ATTR_FILL_SHADOW,
- SID_ATTR_SHADOW_TRANSPARENCE,
- 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)
@@ -64,8 +61,10 @@ 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))
, m_xCtlXRectPreview(new weld::CustomWeld(*m_xBuilder, "CTL_COLOR_PREVIEW", m_aCtlXRectPreview))
{
@@ -92,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 ) );
}
@@ -121,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 ) );
}
@@ -151,6 +149,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle
m_xTsbShowShadow->connect_toggled(LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl));
m_xLbShadowColor->SetSelectHdl( LINK( this, SvxShadowTabPage, SelectShadowHdl_Impl ) );
Link<weld::MetricSpinButton&,void> aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl );
+ m_xLbShadowBlurMetric->connect_value_changed(aLink);
m_xMtrTransparent->connect_value_changed(aLink);
m_xMtrDistance->connect_value_changed(aLink);
}
@@ -160,6 +159,7 @@ SvxShadowTabPage::~SvxShadowTabPage()
m_xCtlXRectPreview.reset();
m_xLbShadowColor.reset();
m_xCtlPosition.reset();
+ m_xLbShadowBlurMetric.reset();
}
void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
@@ -257,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();
@@ -315,6 +315,17 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
}
}
+ if (m_xLbShadowBlurMetric->get_value_changed_from_saved())
+ {
+ SdrMetricItem aItem(SDRATTR_SHADOWBLUR, m_xLbShadowBlurMetric->get_value(FieldUnit::MM_100TH));
+ pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWBLUR );
+ if ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aItem ) )
+ {
+ rAttrs->Put( aItem );
+ bModified = true;
+ }
+ }
+
rAttrs->Put (CntUInt16Item(SID_PAGE_TYPE, static_cast<sal_uInt16>(m_nPageType)));
return bModified;
@@ -327,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);
@@ -342,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();
@@ -370,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);
}
@@ -383,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);
@@ -398,10 +409,19 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
else
m_xMtrTransparent->set_text("");
+ if( rAttrs->GetItemState( SDRATTR_SHADOWBLUR ) != SfxItemState::INVALID )
+ {
+ sal_uInt16 nBlur = rAttrs->Get( SDRATTR_SHADOWBLUR ).GetValue();
+ m_xLbShadowBlurMetric->set_value(nBlur, FieldUnit::MM_100TH);
+ }
+ else
+ m_xLbShadowBlurMetric->set_text("");
+
//aCtlPosition
m_xMtrDistance->save_value();
m_xLbShadowColor->SaveValue();
m_xTsbShowShadow->save_state();
+ m_xLbShadowBlurMetric->save_value();
// #66832# This field was not saved, but used to determine changes.
// Why? Seems to be the error.
@@ -418,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 ac950ceb3a2e..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,13 +119,10 @@ 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()),
- static_cast<sal_uInt16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10,
+ Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10),
static_cast<sal_uInt16>(m_xMtrTrgrCenterX->get_value(FieldUnit::PERCENT)),
static_cast<sal_uInt16>(m_xMtrTrgrCenterY->get_value(FieldUnit::PERCENT)),
static_cast<sal_uInt16>(m_xMtrTrgrBorder->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,13 +287,10 @@ 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()),
- static_cast<sal_uInt16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10,
+ Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10),
static_cast<sal_uInt16>(m_xMtrTrgrCenterX->get_value(FieldUnit::PERCENT)),
static_cast<sal_uInt16>(m_xMtrTrgrCenterY->get_value(FieldUnit::PERCENT)),
static_cast<sal_uInt16>(m_xMtrTrgrBorder->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() / 10, FieldUnit::DEGREE);
+ 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 77c3b7e7e8d2..78294eb5d584 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -22,6 +22,7 @@
#include <algorithm>
#include <svx/EnhancedCustomShape2d.hxx>
+#include <svx/sdangitm.hxx>
#include <svx/svdundo.hxx>
#include <svx/svdview.hxx>
#include <svx/svdobj.hxx>
@@ -33,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
+>);
/*************************************************************************
|*
@@ -112,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")
{
@@ -226,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
@@ -246,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(SfxInt32Item(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;
}
@@ -263,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)
@@ -290,11 +272,11 @@ void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs)
pItem = GetItem( *rAttrs, SID_ATTR_TRANSFORM_ANGLE );
if(pItem)
{
- m_xCtlAngle->SetRotation(static_cast<const SfxInt32Item*>(pItem)->GetValue());
+ m_xCtlAngle->SetRotation(static_cast<const SdrAngleItem*>(pItem)->GetValue());
}
else
{
- m_xCtlAngle->SetRotation(0);
+ m_xCtlAngle->SetRotation(0_deg100);
}
m_xCtlAngle->SaveValue();
m_xMtrPosX->save_value();
@@ -308,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());
@@ -406,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
@@ -450,8 +431,8 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
if (m_xMtrRadius->get_value_changed_from_saved())
{
- Fraction aUIScale = pView->GetModel()->GetUIScale();
- long nTmp = long(GetCoreValue(*m_xMtrRadius, ePoolUnit) * aUIScale);
+ Fraction aUIScale = pView->GetModel().GetUIScale();
+ tools::Long nTmp = tools::Long(GetCoreValue(*m_xMtrRadius, ePoolUnit) * aUIScale);
rAttrs->Put( makeSdrEckenradiusItem( nTmp ) );
bModified = true;
@@ -460,7 +441,7 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
if (m_xMtrAngle->get_value_changed_from_saved())
{
sal_Int32 nValue = static_cast<sal_Int32>(m_xMtrAngle->get_value(FieldUnit::NONE));
- rAttrs->Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) );
+ rAttrs->Put( SdrAngleItem( SID_ATTR_TRANSFORM_SHEAR, Degree100(nValue) ) );
bModified = true;
}
@@ -577,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);
}
@@ -605,7 +586,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
if( pItem )
{
- m_xMtrAngle->set_value(static_cast<const SfxInt32Item*>(pItem)->GetValue(), FieldUnit::NONE);
+ m_xMtrAngle->set_value(static_cast<const SdrAngleItem*>(pItem)->GetValue().get(), FieldUnit::NONE);
}
else
{
@@ -647,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);
@@ -690,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)
@@ -706,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());
}
@@ -751,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))
@@ -761,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"))
@@ -781,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);
@@ -860,10 +856,10 @@ void SvxPositionSizeTabPage::Construct()
if(1 == rMarkList.GetMarkCount())
{
const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const SdrObjKind eKind(static_cast<SdrObjKind>(pObj->GetObjIdentifier()));
+ 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;
@@ -873,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 );
@@ -911,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);
@@ -924,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;
}
@@ -939,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() ) );
}
@@ -949,24 +945,24 @@ 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));
- long lWidth = long(nWidth * static_cast<double>(aUIScale));
+ tools::Long lWidth = tools::Long(nWidth * static_cast<double>(aUIScale));
lWidth = OutputDevice::LogicToLogic( lWidth, MapUnit::Map100thMM, mePoolUnit );
- lWidth = static_cast<long>(m_xMtrWidth->denormalize( lWidth ));
+ lWidth = static_cast<tools::Long>(m_xMtrWidth->denormalize( lWidth ));
// get Height
double nHeight = static_cast<double>(m_xMtrHeight->get_value(FieldUnit::MM_100TH));
- long lHeight = long(nHeight * static_cast<double>(aUIScale));
+ tools::Long lHeight = tools::Long(nHeight * static_cast<double>(aUIScale));
lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
- lHeight = static_cast<long>(m_xMtrHeight->denormalize( lHeight ));
+ 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;
}
@@ -976,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;
}
@@ -989,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;
@@ -1006,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() ) );
}
}
@@ -1019,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 )
{
@@ -1061,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
@@ -1070,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 );
@@ -1100,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();
@@ -1122,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());
@@ -1145,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);
}
@@ -1159,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);
@@ -1198,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())
{
@@ -1288,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);
@@ -1520,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)
@@ -1543,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)
@@ -1560,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