summaryrefslogtreecommitdiffstats
path: root/cui/source/options
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/options')
-rw-r--r--cui/source/options/certpath.cxx4
-rw-r--r--cui/source/options/cfgchart.cxx103
-rw-r--r--cui/source/options/cfgchart.hxx29
-rw-r--r--cui/source/options/connpoolconfig.cxx72
-rw-r--r--cui/source/options/connpooloptions.cxx54
-rw-r--r--cui/source/options/connpooloptions.hxx7
-rw-r--r--cui/source/options/connpoolsettings.cxx10
-rw-r--r--cui/source/options/connpoolsettings.hxx4
-rw-r--r--cui/source/options/dbregister.cxx39
-rw-r--r--cui/source/options/dbregisterednamesconfig.cxx23
-rw-r--r--cui/source/options/dbregistersettings.hxx5
-rw-r--r--cui/source/options/doclinkdialog.cxx47
-rw-r--r--cui/source/options/doclinkdialog.hxx3
-rw-r--r--cui/source/options/fontsubs.cxx57
-rw-r--r--cui/source/options/fontsubs.hxx9
-rw-r--r--cui/source/options/optaboutconfig.cxx1111
-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.cxx84
-rw-r--r--cui/source/options/optbasic.cxx23
-rw-r--r--cui/source/options/optbasic.hxx3
-rw-r--r--cui/source/options/optchart.cxx47
-rw-r--r--cui/source/options/optchart.hxx4
-rw-r--r--cui/source/options/optcolor.cxx340
-rw-r--r--cui/source/options/optcolor.hxx8
-rw-r--r--cui/source/options/optctl.cxx42
-rw-r--r--cui/source/options/optctl.hxx3
-rw-r--r--cui/source/options/optdeepl.cxx78
-rw-r--r--cui/source/options/optdeepl.hxx39
-rw-r--r--cui/source/options/optdict.cxx91
-rw-r--r--cui/source/options/optfltr.cxx303
-rw-r--r--cui/source/options/optfltr.hxx15
-rw-r--r--cui/source/options/optgdlg.cxx599
-rw-r--r--cui/source/options/optgdlg.hxx69
-rw-r--r--cui/source/options/optgenrl.cxx93
-rw-r--r--cui/source/options/opthtml.cxx133
-rw-r--r--cui/source/options/opthtml.hxx17
-rw-r--r--cui/source/options/optinet2.cxx280
-rw-r--r--cui/source/options/optinet2.hxx32
-rw-r--r--cui/source/options/optjava.cxx63
-rw-r--r--cui/source/options/optjava.hxx6
-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.cxx391
-rw-r--r--cui/source/options/optopencl.cxx19
-rw-r--r--cui/source/options/optopencl.hxx2
-rw-r--r--cui/source/options/optpath.cxx58
-rw-r--r--cui/source/options/optsave.cxx201
-rw-r--r--cui/source/options/optsave.hxx20
-rw-r--r--cui/source/options/optupdt.cxx355
-rw-r--r--cui/source/options/optupdt.hxx17
-rw-r--r--cui/source/options/personalization.cxx62
-rw-r--r--cui/source/options/personalization.hxx4
-rw-r--r--cui/source/options/sdbcdriverenum.cxx2
-rw-r--r--cui/source/options/securityoptions.cxx80
-rw-r--r--cui/source/options/securityoptions.hxx61
-rw-r--r--cui/source/options/treeopt.cxx1035
-rw-r--r--cui/source/options/treeopthelper.cxx184
-rw-r--r--cui/source/options/tsaurls.cxx8
-rw-r--r--cui/source/options/webconninfo.cxx3
63 files changed, 4808 insertions, 2051 deletions
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 3aff94b3217e..5cccccf1995c 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -11,7 +11,7 @@
#include <osl/file.hxx>
#include <osl/security.hxx>
#include <sfx2/filedlghelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "certpath.hxx"
#include <com/sun/star/xml/crypto/NSSInitializer.hpp>
@@ -60,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)
{
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx
index 063ecc0fb184..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;
+ 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,108 +160,63 @@ bool SvxChartColorTable::operator==( const SvxChartColorTable & _rOther ) const
-SvxChartOptions::SvxChartOptions() :
- ::utl::ConfigItem( "Office.Chart" ),
- mbIsInitialized( false ),
- maPropertyNames{ "DefaultColor/Series" }
+SvxChartColorTable SvxChartOptions::GetDefaultColors()
{
-}
-
-SvxChartOptions::~SvxChartOptions()
-{
-}
-
-const SvxChartColorTable& SvxChartOptions::GetDefaultColors()
-{
- if ( !mbIsInitialized )
- mbIsInitialized = RetrieveOptions();
- return maDefColors;
-}
-
-void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& aCol )
-{
- maDefColors = aCol;
- SetModified();
-}
-
-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())
- return false;
-
// 1. default colors for series
- maDefColors.clear();
- uno::Sequence< sal_Int64 > aColorSeq;
- aProperties[ 0 ] >>= aColorSeq;
+ uno::Sequence< sal_Int64 > aColorSeq = officecfg::Office::Chart::DefaultColor::Series::get();
sal_Int32 nCount = aColorSeq.getLength();
Color aCol;
// create strings for entry names
OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) );
- OUString aPrefix, aPostfix, aName;
+ std::u16string_view aPrefix, aPostfix;
+ OUString aName;
sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
if( nPos != -1 )
{
- aPrefix = aResName.copy( 0, nPos );
+ aPrefix = aResName.subView( 0, nPos );
sal_Int32 idx = nPos + sizeof( "$(ROW)" ) - 1;
- aPostfix = aResName.copy( idx );
+ aPostfix = aResName.subView( idx );
}
else
aPrefix = aResName;
// set color values
+ SvxChartColorTable aDefColors;
for( sal_Int32 i=0; i < nCount; i++ )
{
aCol = Color(ColorTransparency, aColorSeq[ i ]);
aName = aPrefix + OUString::number(i + 1) + aPostfix;
- maDefColors.append( XColorEntry( aCol, aName ));
+ aDefColors.append( XColorEntry( aCol, aName ));
}
- return true;
+
+ return aDefColors;
}
-void SvxChartOptions::ImplCommit()
+void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& rDefColors )
{
- uno::Sequence< OUString > aNames = GetPropertyNames();
- uno::Sequence< uno::Any > aValues( aNames.getLength());
-
- if( aValues.hasElements() )
+ // 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++ )
{
- // 1. default colors for series
- // convert list to sequence
- const size_t nCount = maDefColors.size();
- uno::Sequence< sal_Int64 > aColors( nCount );
- auto aColorsRange = asNonConstRange(aColors);
- for( size_t i=0; i < nCount; i++ )
- {
- Color aData = maDefColors.getColor( i );
- aColorsRange[ i ] = sal_uInt32(aData);
- }
-
- aValues.getArray()[0] <<= aColors;
+ Color aData = rDefColors.getColor( i );
+ aColorsRange[ i ] = sal_uInt32(aData);
}
-
- PutProperties( aNames, aValues );
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Chart::DefaultColor::Series::set(aColors, batch);
+ batch->commit();
}
-void SvxChartOptions::Notify( const css::uno::Sequence< OUString >& )
-{
-}
-
-
-
-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..12aee9933f4e 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,17 +65,14 @@ 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();
- const OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
- for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ for (auto& driverKey : aDriverSettings.getNodeNames())
{
// the name of the driver in this round
- OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys);
+ OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(driverKey);
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 +94,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 +106,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 +119,7 @@ namespace offapp
if (pEnabled)
{
bool bEnabled = pEnabled->GetValue();
- aConnectionPoolRoot.setNodeValue(getEnablePoolingNodeName(), Any(bEnabled));
+ aConnectionPoolRoot.setNodeValue(ENABLE_POOLING, Any(bEnabled));
bNeedCommit = true;
}
@@ -159,7 +127,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 +147,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 c067af0c3e47..f6321f2252b1 100644
--- a/cui/source/options/connpooloptions.cxx
+++ b/cui/source/options/connpooloptions.cxx
@@ -25,6 +25,8 @@
#include <svx/databaseregistrationui.hxx>
#include <strings.hrc>
#include <dialmgr.hxx>
+#include <officecfg/Office/DataAccess.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
namespace offapp
{
@@ -49,13 +51,16 @@ namespace offapp
, 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));
@@ -68,6 +73,9 @@ namespace offapp
};
m_xDriverList->set_column_fixed_widths(aWidths);
+ 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) );
@@ -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);
}
}
@@ -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 549448e21ff6..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;
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 80f26c2bd893..6aa9213efd92 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -29,6 +29,7 @@
#include <tools/debug.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <svl/itemset.hxx>
@@ -36,6 +37,7 @@
#include <dialmgr.hxx>
#include "dbregisterednamesconfig.hxx"
#include <svx/databaseregistrationui.hxx>
+#include <o3tl/string_view.hxx>
#define COL_TYPE 0
@@ -43,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 );
}
@@ -120,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,
@@ -129,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
@@ -137,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));
@@ -179,11 +189,11 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet* rSet )
// restore column width
std::vector<int> aWidths
{
- aUserData.getToken(0, ';', nIdx).toInt32()
+ o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx))
};
m_xPathBox->set_column_fixed_widths(aWidths);
// restore sort direction
- bool bUp = aUserData.getToken(0, ';', nIdx).toInt32() != 0;
+ 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);
}
@@ -225,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;
@@ -250,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)
@@ -264,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)
@@ -278,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;
@@ -289,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 b33e9ded61c5..9c087d2823d0 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 )
{
@@ -44,14 +43,11 @@ namespace svx
Reference< XDatabaseContext > xRegistrations(
DatabaseContext::create(xContext) );
- Sequence< OUString > aRegistrationNames( xRegistrations->getRegistrationNames() );
- const OUString* pRegistrationName = aRegistrationNames.getConstArray();
- const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
- for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
+ for (auto& registrationName : xRegistrations->getRegistrationNames())
{
- OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) );
- aSettings[ *pRegistrationName ] =
- DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) );
+ aSettings[registrationName] = DatabaseRegistration(
+ xRegistrations->getDatabaseLocation(registrationName),
+ xRegistrations->isDatabaseRegistrationReadOnly(registrationName));
}
}
catch( const Exception& )
@@ -100,13 +96,10 @@ namespace svx
}
// delete unused entries
- Sequence< OUString > aRegistrationNames = xRegistrations->getRegistrationNames();
- const OUString* pRegistrationName = aRegistrationNames.getConstArray();
- const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
- for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
+ for (auto& registrationName : xRegistrations->getRegistrationNames())
{
- if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() )
- xRegistrations->revokeDatabaseLocation( *pRegistrationName );
+ if (rNewRegistrations.find(registrationName) == rNewRegistrations.end())
+ xRegistrations->revokeDatabaseLocation(registrationName);
}
}
catch( const Exception& )
diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx
index 2f86392bc9cf..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 )
{
}
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 67a34dec489e..4d61a873e264 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -35,14 +35,20 @@
SvxFontSubstTabPage::SvxFontSubstTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optfontspage.ui", "OptFontsPage", &rSet)
, 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);
@@ -140,6 +146,28 @@ std::unique_ptr<SfxTabPage> SvxFontSubstTabPage::Create( weld::Container* pPage,
return std::make_unique<SvxFontSubstTabPage>(pPage, pController, *rAttrSet);
}
+OUString SvxFontSubstTabPage::GetAllStrings()
+{
+ 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() + " ";
+ }
+
+ OUString checkButton[] = { "usetable", "nonpropfontonly" };
+
+ 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;
@@ -200,18 +228,20 @@ void SvxFontSubstTabPage::Reset( const SfxItemSet* )
m_xFont2CB->thaw();
m_xFont1CB->thaw();
+ 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 < static_cast<sal_Int32>(aFontSubs.size()); ++i)
+ for (auto const & sub: aFontSubs)
{
m_xCheckLB->append(xIter.get());
- const SubstitutionStruct* pSubs = &aFontSubs[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();
@@ -238,6 +268,19 @@ 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();
}
@@ -374,7 +417,7 @@ IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, weld::Toggleable&, rBox, void)
void SvxFontSubstTabPage::CheckEnable()
{
- bool bEnableAll = m_xUseTableCB->get_active();
+ bool bEnableAll = m_xUseTableCB->get_active() && !officecfg::Office::Common::Font::SourceViewFont::FontName::isReadOnly();
m_xCheckLB->set_sensitive(bEnableAll);
m_xFont1CB->set_sensitive(bEnableAll);
m_xFont2CB->set_sensitive(bEnableAll);
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
index dc55d9434ba9..e91a9818e56c 100644
--- a/cui/source/options/fontsubs.hxx
+++ b/cui/source/options/fontsubs.hxx
@@ -28,14 +28,20 @@ class SvxFontSubstTabPage : public SfxTabPage
OUString m_sAutomatic;
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);
@@ -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 55941f765dd9..de64f45b4260 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -7,25 +7,40 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <o3tl/safeint.hxx>
#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>
@@ -35,106 +50,59 @@ 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())
@@ -144,25 +112,42 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage(weld::Window* pParent)
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
- {
- o3tl::narrowing<int>(fWidth * 65),
- o3tl::narrowing<int>(fWidth * 20),
- o3tl::narrowing<int>(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)
@@ -196,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());
@@ -235,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 sPath = Reference< XHierarchicalName >(
- xNameAccess, uno::UNO_QUERY_THROW )->getHierarchicalName();
- const uno::Sequence< OUString > seqItems = xNameAccess->getElementNames();
- for( const OUString& item : seqItems )
+OUString lcl_StringListToString(const uno::Sequence<OUString>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
{
- Any aNode = xNameAccess->getByName( item );
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(seq[i]);
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_IntListToString(const uno::Sequence<sal_Int16>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_IntListToString(const uno::Sequence<sal_Int32>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_IntListToString(const uno::Sequence<sal_Int64>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+
+OUString lcl_DoubleListToString(const uno::Sequence<double>& seq)
+{
+ OUStringBuffer sBuffer;
+ for (sal_Int32 i = 0; i != seq.getLength(); ++i)
+ {
+ if (i != 0)
+ sBuffer.append(",");
+ sBuffer.append(OUString::number(seq[i]));
+ }
+ return sBuffer.makeStringAndClear();
+}
+}
+
+void CuiAboutConfigTabPage::FillItems(const Reference<XNameAccess>& xNameAccess,
+ const weld::TreeIter* pParentEntry, int lineage,
+ bool bLoadAll)
+{
+ OUString sPath
+ = Reference<XHierarchicalName>(xNameAccess, uno::UNO_QUERY_THROW)->getHierarchicalName();
+ const uno::Sequence<OUString> seqItems = xNameAccess->getElementNames();
+ for (const OUString& item : seqItems)
+ {
+ Any aNode = xNameAccess->getByName(item);
bool bNotLeaf = false;
- Reference< XNameAccess > xNextNameAccess;
+ Reference<XNameAccess> xNextNameAccess;
try
{
xNextNameAccess.set(aNode, uno::UNO_QUERY);
@@ -278,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());
+ 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
@@ -303,214 +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)
{
- const 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)
{
- 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 )
+ 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( static_cast<sal_Int32>(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( 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( 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( 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{ uno::Any(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.
@@ -520,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)
{
@@ -568,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
@@ -582,16 +786,17 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
OUString sPropertyType = m_xPrefBox->get_text(*m_xScratchIter, 2);
OUString sPropertyValue = m_xPrefBox->get_text(*m_xScratchIter, 3);
- auto pProperty = std::make_shared<Prop_Impl>( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) );
+ auto pProperty
+ = std::make_shared<Prop_Impl>(pUserData->sPropertyPath, sPropertyName, Any(sPropertyValue));
bool bSaveChanges = false;
bool bOpenDialog = true;
OUString sDialogValue;
- if( sPropertyType == "boolean" )
+ if (sPropertyType == "boolean")
{
bool bValue;
- if( sPropertyValue == "true" )
+ if (sPropertyValue == "true")
{
sDialogValue = "false";
bValue = false;
@@ -606,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;
@@ -618,154 +819,180 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
try
{
- if( bOpenDialog )
+ if (bOpenDialog)
{
- //Cosmetic length limit for integer values.
- int limit=0;
- if( sPropertyType == "short" )
- limit = SHORT_LEN_LIMIT;
- else if( sPropertyType == "long" )
- limit = LONG_LEN_LIMIT;
- else if( sPropertyType == "hyper" )
- limit = HYPER_LEN_LIMIT;
-
- CuiAboutConfigValueDialog aValueDialog(m_xDialog.get(), sDialogValue, limit);
-
- if (aValueDialog.run() == RET_OK )
+ if (sPropertyType == "short" || sPropertyType == "int" || sPropertyType == "long")
{
- OUString sNewValue = aValueDialog.getValue();
- bSaveChanges = true;
- if ( sPropertyType == "short")
- {
- sal_Int16 nShort;
- sal_Int32 nNumb = sNewValue.toInt32();
-
- //if the value is 0 and length is not 1, there is something wrong
- if( ( nNumb==0 && sNewValue.getLength()!=1 ) || nNumb > SAL_MAX_INT16 || nNumb < SAL_MIN_INT16)
- throw uno::Exception("out of range short", nullptr);
- nShort = static_cast<sal_Int16>(nNumb);
- pProperty->Value <<= nShort;
- }
- else if( sPropertyType == "long" )
+ sal_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_Int32 nLong = sNewValue.toInt32();
- if( nLong==0 && sNewValue.getLength()!=1)
- throw uno::Exception("out of range long", nullptr);
- pProperty->Value <<= nLong;
- }
- else if( sPropertyType == "hyper")
- {
- sal_Int64 nHyper = sNewValue.toInt64();
- if( nHyper==0 && sNewValue.getLength()!=1)
- throw uno::Exception("out of range hyper", nullptr);
- pProperty->Value <<= nHyper;
- }
- else if( sPropertyType == "double")
- {
- 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
- std::transform(seqStr.begin(), seqStr.end(), seqShort.getArray(),
- [](const auto& str)
- { return static_cast<sal_Int16>(str.toInt32()); });
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<sal_Int16> seqShort(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seqShort.getArray(),
+ [](const auto& str) { return static_cast<sal_Int16>(str.toInt32()); });
pProperty->Value <<= seqShort;
+ sDialogValue = lcl_IntListToString(seqShort);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]long" )
- {
- std::vector< OUString > seqStrLong = commaStringToSequence( sNewValue );
-
- uno::Sequence< sal_Int32 > seqLong( seqStrLong.size() );
- std::transform(seqStrLong.begin(), seqStrLong.end(), seqLong.getArray(),
- [](const auto& str) { return str.toInt32(); });
- pProperty->Value <<= seqLong;
- }
- else if( sPropertyType == "[]hyper" )
+ }
+ else if (sPropertyType == "int-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Int32);
+ if (aListDialog.run() == RET_OK)
{
- std::vector< OUString > seqStrHyper = commaStringToSequence( sNewValue );
- uno::Sequence< sal_Int64 > seqHyper( seqStrHyper.size() );
- std::transform(seqStrHyper.begin(), seqStrHyper.end(), seqHyper.getArray(),
- [](const auto& str) { return str.toInt64(); });
- pProperty->Value <<= seqHyper;
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<sal_Int32> seq(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seq.getArray(),
+ [](const auto& str) { return static_cast<sal_Int32>(str.toInt32()); });
+ pProperty->Value <<= seq;
+ sDialogValue = lcl_IntListToString(seq);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]double" )
+ }
+ else if (sPropertyType == "long-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Int64);
+ if (aListDialog.run() == RET_OK)
{
- std::vector< OUString > seqStrDoub = commaStringToSequence( sNewValue );
- uno::Sequence< double > seqDoub( seqStrDoub.size() );
- std::transform(seqStrDoub.begin(), seqStrDoub.end(), seqDoub.getArray(),
- [](const auto& str) { return str.toDouble(); });
- pProperty->Value <<= seqDoub;
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<sal_Int64> seq(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seq.getArray(),
+ [](const auto& str) { return static_cast<sal_Int64>(str.toInt32()); });
+ pProperty->Value <<= seq;
+ sDialogValue = lcl_IntListToString(seq);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]float" )
+ }
+ else if (sPropertyType == "double-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ aListDialog.SetEntries(commaStringToSequence(sDialogValue));
+ aListDialog.SetMode(ListMode::Double);
+ if (aListDialog.run() == RET_OK)
{
- std::vector< OUString > seqStrFloat = commaStringToSequence( sNewValue );
- uno::Sequence< sal_Int16 > seqFloat( seqStrFloat.size() );
- std::transform(seqStrFloat.begin(), seqStrFloat.end(), seqFloat.getArray(),
- [](const auto& str) { return str.toFloat(); });
- pProperty->Value <<= seqFloat;
+ std::vector<OUString> seqStr = aListDialog.GetEntries();
+ uno::Sequence<double> seq(seqStr.size());
+ std::transform(
+ seqStr.begin(), seqStr.end(), seq.getArray(),
+ [](const auto& str) { return static_cast<double>(str.toDouble()); });
+ pProperty->Value <<= seq;
+ sDialogValue = lcl_DoubleListToString(seq);
+ bSaveChanges = true;
}
- else if( sPropertyType == "[]string" )
+ }
+ else if (sPropertyType == "string-list")
+ {
+ SvxListDialog aListDialog(m_xDialog.get());
+ uno::Sequence<OUString> aList
+ = pUserData->aPropertyValue.get<uno::Sequence<OUString>>();
+ aListDialog.SetEntries(
+ comphelper::sequenceToContainer<std::vector<OUString>>(aList));
+ aListDialog.SetMode(ListMode::String);
+ if (aListDialog.run() == RET_OK)
{
- pProperty->Value <<= comphelper::containerToSequence( commaStringToSequence( sNewValue ));
+ auto seq = comphelper::containerToSequence(aListDialog.GetEntries());
+ sDialogValue = lcl_StringListToString(seq);
+ pProperty->Value <<= seq;
+ bSaveChanges = true;
}
- else //unknown
- throw uno::Exception("unknown property type " + sPropertyType, nullptr);
-
- sDialogValue = sNewValue;
}
+ else //unknown
+ throw uno::Exception("unknown property type " + sPropertyType, nullptr);
}
- if(bSaveChanges)
+ if (bSaveChanges)
{
- AddToModifiedVector( pProperty );
+ AddToModifiedVector(pProperty);
+ pUserData->aPropertyValue = pProperty->Value;
//update listbox value.
+ m_xPrefBox->set_text(*m_xScratchIter, sPropertyType, 2);
m_xPrefBox->set_text(*m_xScratchIter, sDialogValue, 3);
+ m_xPrefBox->set_text_emphasis(*m_xScratchIter, true, -1);
//update m_prefBoxEntries
- auto it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(),
- [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool
- {
- return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
- && rEntry.sStatus == sPropertyName;
- }
- );
+ auto it = std::find_if(
+ m_prefBoxEntries.begin(), m_prefBoxEntries.end(),
+ [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool {
+ return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
+ && rEntry.sStatus == sPropertyName;
+ });
if (it != m_prefBoxEntries.end())
{
it->sValue = sDialogValue;
+ it->pUserData->bWasModified = true;
auto modifiedIt = std::find_if(
- m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
- [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool
- {
- return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
- && rEntry.sStatus == sPropertyName;
- }
- );
+ m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
+ [&pUserData, &sPropertyName](const prefBoxEntry& rEntry) -> bool {
+ return rEntry.pUserData->sPropertyPath == pUserData->sPropertyPath
+ && rEntry.sStatus == sPropertyName;
+ });
if (modifiedIt != m_modifiedPrefBoxEntries.end())
{
modifiedIt->sValue = sDialogValue;
+ modifiedIt->pUserData->bWasModified = true;
}
else
{
@@ -774,74 +1001,24 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
}
}
}
- catch( uno::Exception& )
+ catch (uno::Exception&)
{
}
}
-IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl, weld::Button&, void)
-{
- weld::WaitObject aWait(m_xDialog.get());
-
- m_xPrefBox->hide();
- m_xPrefBox->clear();
- m_xPrefBox->freeze();
-
- if (m_bSorted)
- m_xPrefBox->make_unsorted();
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, SearchHdl_Impl, weld::Button&, void) { InputChanged(); }
- if (m_xSearchEdit->get_text().isEmpty())
- {
- m_xPrefBox->clear();
- Reference< XNameAccess > xConfigAccess = getConfigAccess( "/", false );
- FillItems( xConfigAccess );
- }
- else
- {
- m_options.searchString = m_xSearchEdit->get_text();
- utl::TextSearch textSearch( m_options );
- for (auto const& it : m_prefBoxEntries)
- {
- sal_Int32 endPos, startPos = 0;
-
- for(size_t i = 0; i < 5; ++i)
- {
- OUString scrTxt;
-
- if (i == 0)
- scrTxt = it.pUserData->sPropertyPath;
- else if (i == 1)
- scrTxt = it.sProp;
- else if (i == 2)
- scrTxt = it.sStatus;
- else if (i == 3)
- scrTxt = it.sType;
- else if (i == 4)
- scrTxt = it.sValue;
-
- endPos = scrTxt.getLength();
- if (textSearch.SearchForward(scrTxt, &startPos, &endPos))
- {
- InsertEntry(it);
- break;
- }
- }
- }
- }
-
- m_xPrefBox->thaw();
- if (m_bSorted)
- m_xPrefBox->make_sorted();
-
- m_xPrefBox->all_foreach([this](weld::TreeIter& rEntry) {
- m_xPrefBox->expand_row(rEntry);
- return false;
- });
- m_xPrefBox->show();
+IMPL_LINK_NOARG(CuiAboutConfigTabPage, ModifiedHdl_Impl, weld::Toggleable&, void)
+{
+ InputChanged();
}
void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& rEntry)
{
+ bool bOnlyModified = m_xModifiedCheckBtn->get_active();
+ if (bOnlyModified && !rEntry.pUserData->bWasModified)
+ return;
+
OUString sPathWithProperty = rEntry.pUserData->sPropertyPath;
sal_Int32 index = sPathWithProperty.lastIndexOf(rEntry.sProp);
OUString sPath = sPathWithProperty.copy(0, index);
@@ -852,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;
@@ -890,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 50dce2c1cb8e..390621a0cdd9 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -21,7 +21,7 @@
#include <map>
#include <optasian.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <o3tl/any.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <svl/asiancfg.hxx>
@@ -42,15 +42,15 @@ using namespace com::sun::star::i18n;
using namespace com::sun::star::frame;
using namespace com::sun::star::beans;
-constexpr OUStringLiteral cIsKernAsianPunctuation = u"IsKernAsianPunctuation";
-constexpr OUStringLiteral cCharacterCompressionType = u"CharacterCompressionType";
+constexpr OUString cIsKernAsianPunctuation = u"IsKernAsianPunctuation"_ustr;
+constexpr OUString cCharacterCompressionType = u"CharacterCompressionType"_ustr;
namespace {
struct SvxForbiddenChars_Impl
{
bool bRemoved;
- std::unique_ptr<ForbiddenCharacters> pCharacters;
+ std::optional<ForbiddenCharacters> oCharacters;
};
}
@@ -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,10 +201,10 @@ bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
for (auto const& changedLanguage : pImpl->aChangedLanguagesMap)
{
Locale aLocale( LanguageTag::convertToLocale(changedLanguage.first));
- if(changedLanguage.second->bRemoved)
+ if(changedLanguage.second.bRemoved)
pImpl->xForbidden->removeForbiddenCharacters( aLocale );
- else if(changedLanguage.second->pCharacters)
- pImpl->xForbidden->setForbiddenCharacters( aLocale, *( changedLanguage.second->pCharacters ) );
+ else if(changedLanguage.second.oCharacters)
+ pImpl->xForbidden->setForbiddenCharacters( aLocale, *( changedLanguage.second.oCharacters ) );
}
}
catch (const Exception&)
@@ -205,8 +231,8 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
}
if( pImpl->xPrSet.is() )
pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
- bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly();
- CharCompressType nCompress = pImpl->aConfig.GetCharDistanceCompression();
+ bool bKernWesternText = SvxAsianConfig::IsKerningWesternTextOnly();
+ CharCompressType nCompress = SvxAsianConfig::GetCharDistanceCompression();
if(pImpl->xPrSetInfo.is())
{
OUString sForbidden("ForbiddenCharacters");
@@ -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
@@ -316,11 +342,11 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void)
}
else
{
- bAvail = pImpl->aConfig.GetStartEndChars( aLocale, sStart, sEnd );
+ bAvail = SvxAsianConfig::GetStartEndChars( aLocale, sStart, sEnd );
}
if(!bAvail)
{
- LocaleDataWrapper aWrap( aLanguageTag );
+ LocaleDataWrapper aWrap( std::move(aLanguageTag) );
ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters();
sStart = aForbidden.beginLine;
sEnd = aForbidden.endLine;
@@ -358,13 +384,13 @@ IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, weld::Entry&, rEdit, void)
{
if(bEnable)
{
- std::unique_ptr<ForbiddenCharacters> pFCSet(new ForbiddenCharacters);
- pFCSet->beginLine = sStart;
- pFCSet->endLine = sEnd;
- pImpl->addForbiddenCharacters(eSelectLanguage, std::move(pFCSet));
+ ForbiddenCharacters aFCSet;
+ aFCSet.beginLine = sStart;
+ aFCSet.endLine = sEnd;
+ pImpl->addForbiddenCharacters(eSelectLanguage, std::move(aFCSet));
}
else
- pImpl->addForbiddenCharacters(eSelectLanguage, nullptr);
+ pImpl->addForbiddenCharacters(eSelectLanguage, std::nullopt);
}
catch (const Exception&)
{
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
index c550d9440edd..bbe20fd01eee 100644
--- a/cui/source/options/optbasic.cxx
+++ b/cui/source/options/optbasic.cxx
@@ -53,6 +53,29 @@ void SvxBasicIDEOptionsPage::LoadConfig()
m_xUseExtendedTypesChk->set_sensitive( !officecfg::Office::BasicIDE::Autocomplete::UseExtended::isReadOnly() );
}
+OUString SvxBasicIDEOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "codecomplete_enable", "autocorrect", "autoclose_quotes",
+ "autoclose_paren", "autoclose_proc", "extendedtypes_enable" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
{
bool bModified = false;
diff --git a/cui/source/options/optbasic.hxx b/cui/source/options/optbasic.hxx
index 990b54d4e3bb..bc4274eaca1e 100644
--- a/cui/source/options/optbasic.hxx
+++ b/cui/source/options/optbasic.hxx
@@ -38,6 +38,9 @@ public:
virtual ~SvxBasicIDEOptionsPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index b8499c5ee886..eef87d2cd324 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -26,6 +26,7 @@
#include <svx/svxids.hrc>
#include <osl/diagnose.h>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Chart.hxx>
void SvxDefaultColorOptPage::InsertColorEntry(const XColorEntry& rEntry, sal_Int32 nPos)
{
@@ -100,6 +101,14 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(weld::Container* pPage, weld::Dia
{
m_xLbChartColors->set_size_request(-1, m_xLbChartColors->get_height_rows(16));
+ if (officecfg::Office::Chart::DefaultColor::Series::isReadOnly())
+ {
+ m_xPBDefault->set_sensitive(false);
+ m_xPBAdd->set_sensitive(false);
+ m_xPBRemove->set_sensitive(false);
+ m_xValSetColorBoxWin->set_sensitive(false);
+ }
+
m_xPBDefault->connect_clicked( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) );
m_xPBAdd->connect_clicked( LINK( this, SvxDefaultColorOptPage, AddChartColor ) );
m_xPBRemove->connect_clicked( LINK( this, SvxDefaultColorOptPage, RemoveChartColor ) );
@@ -109,19 +118,16 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(weld::Container* pPage, weld::Dia
m_xValSetColorBox->SetStyle( m_xValSetColorBox->GetStyle()
| WB_ITEMBORDER | WB_NAMEFIELD | WB_VSCROLL );
- m_SvxChartOptionsUniquePtr.reset(new SvxChartOptions);
-
- const SfxPoolItem* pItem = nullptr;
- if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, false, &pItem ) == SfxItemState::SET )
+ if ( const SvxChartColorTableItem* pEditOptionsItem = rInAttrs.GetItemIfSet( SID_SCH_EDITOPTIONS, false ) )
{
m_SvxChartColorTableUniquePtr = std::make_unique<SvxChartColorTable>(
- static_cast<const SvxChartColorTableItem*>(pItem)->GetColorList());
+ pEditOptionsItem->GetColorList());
}
else
{
m_SvxChartColorTableUniquePtr = std::make_unique<SvxChartColorTable>();
m_SvxChartColorTableUniquePtr->useDefault();
- m_SvxChartOptionsUniquePtr->SetDefaultColors(*m_SvxChartColorTableUniquePtr);
+ SvxChartOptions::SetDefaultColors(*m_SvxChartColorTableUniquePtr);
}
Construct();
@@ -146,6 +152,28 @@ std::unique_ptr<SfxTabPage> SvxDefaultColorOptPage::Create( weld::Container* pPa
return std::make_unique<SvxDefaultColorOptPage>( pPage, pController, *rAttrs );
}
+OUString SvxDefaultColorOptPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label20", "label1" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString buttons[] = { "add", "delete", "default" };
+
+ for (const auto& btn : buttons)
+ {
+ if (const auto& pString = m_xBuilder->weld_button(btn))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet* rOutAttrs )
{
if( m_SvxChartColorTableUniquePtr )
@@ -176,11 +204,8 @@ void SvxDefaultColorOptPage::FillPaletteLB()
void SvxDefaultColorOptPage::SaveChartOptions()
{
- if (m_SvxChartOptionsUniquePtr && m_SvxChartColorTableUniquePtr)
- {
- m_SvxChartOptionsUniquePtr->SetDefaultColors(*m_SvxChartColorTableUniquePtr);
- m_SvxChartOptionsUniquePtr->Commit();
- }
+ if (m_SvxChartColorTableUniquePtr)
+ SvxChartOptions::SetDefaultColors(*m_SvxChartColorTableUniquePtr);
}
// event handlers
diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx
index 11221617a9d1..22a01495b276 100644
--- a/cui/source/options/optchart.hxx
+++ b/cui/source/options/optchart.hxx
@@ -32,7 +32,6 @@ typedef std::vector<Color> ImpColorList;
class SvxDefaultColorOptPage : public SfxTabPage
{
private:
- std::unique_ptr<SvxChartOptions> m_SvxChartOptionsUniquePtr;
// no reason to use a cloned SfxItem here (SvxChartColorTableItem)
// that just leads to non-const SfxItem and potential trouble
std::unique_ptr<SvxChartColorTable> m_SvxChartColorTableUniquePtr;
@@ -70,6 +69,9 @@ public:
void Construct();
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) override;
virtual void Reset( const SfxItemSet* rInAttrs ) override;
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 81030a79e9c8..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
@@ -170,6 +213,7 @@ public:
Link<weld::Widget&,void> const&,
weld::ScrolledWindow& rScroll);
void Update(EditableColorConfig const*, EditableExtendedColorConfig const*);
+ void UpdateEntries();
void ClickHdl(EditableColorConfig*, const weld::Toggleable&);
void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const ColorListBox*);
@@ -200,37 +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, int 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); }
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 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::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
@@ -239,6 +283,8 @@ private:
Color m_aDefaultColor;
};
+ css::uno::Reference<css::configuration::XReadWriteAccess> m_xReadWriteAccess;
+
private:
weld::Window* m_pTopLevel;
int m_nCheckBoxLabelOffset;
@@ -272,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)
@@ -281,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,
- int nCheckBoxLabelOffset, bool bCheckBox, bool bShow)
- : m_xColorList(new ColorListBox(rBuilder.weld_menu_button(pColorWidget), [pTopLevel]{ return 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)
@@ -327,22 +374,54 @@ void ColorConfigWindow_Impl::Entry::SetLinks(Link<weld::Toggleable&,void> const&
}
// 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);
+
+ 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
@@ -371,6 +450,9 @@ ColorConfigWindow_Impl::ColorConfigWindow_Impl(weld::Window* pTopLevel, weld::Co
, 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();
}
@@ -402,16 +484,20 @@ void ColorConfigWindow_Impl::CreateEntries()
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)),
- m_nCheckBoxLabelOffset,
+ m_nCheckBoxLabelOffset, pCache,
vEntryInfo[i].bCheckBox,
aModulesInstalled[vEntryInfo[i].eGroup]));
+ if (!pCache)
+ pCache = vEntries.back()->m_xColorList.get();
}
// extended entries
@@ -443,7 +529,7 @@ void ColorConfigWindow_Impl::CreateEntries()
aExtConfig.GetComponentColorConfigValue(sComponentName, i);
vEntries.push_back(std::make_shared<Entry>(m_pTopLevel, *vExtBuilders.back(),
"label", "button", aColorEntry.getDefaultColor(),
- m_nCheckBoxLabelOffset, false, true));
+ m_nCheckBoxLabelOffset, pCache, false, true));
vEntries.back()->SetText(aColorEntry.getDisplayName());
}
}
@@ -469,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
);
}
@@ -483,14 +575,28 @@ 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, const weld::Toggleable& rBox)
{
@@ -590,6 +696,7 @@ public:
void SetConfig (EditableColorConfig& rConfig) { pColorConfig = &rConfig; }
void SetExtendedConfig (EditableExtendedColorConfig& rConfig) { pExtColorConfig = &rConfig; }
void Update();
+ void UpdateEntries();
tools::Long GetScrollPosition() const
{
return m_xVScroll->vadjustment_get_value();
@@ -633,6 +740,11 @@ void ColorConfigCtrl_Impl::Update ()
m_xScrollWindow->Update(pColorConfig, pExtColorConfig);
}
+void ColorConfigCtrl_Impl::UpdateEntries()
+{
+ m_xScrollWindow->UpdateEntries();
+}
+
IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, weld::Toggleable&, rBox, void)
{
DBG_ASSERT(pColorConfig, "Configuration not set");
@@ -689,19 +801,22 @@ SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::Dia
: 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);
@@ -743,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;
@@ -776,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();
}
@@ -802,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();
}
@@ -824,7 +979,7 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, weld::Button&, rButton, vo
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);
@@ -855,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;
}
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
index ede03dc6b059..7b5cdbca7451 100644
--- a/cui/source/options/optcolor.hxx
+++ b/cui/source/options/optcolor.hxx
@@ -31,14 +31,17 @@ class SvxColorOptionsTabPage : public SfxTabPage
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;
@@ -46,6 +49,7 @@ 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);
@@ -58,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 52bd18fc8788..10140c2eab50 100644
--- a/cui/source/options/optctl.cxx
+++ b/cui/source/options/optctl.cxx
@@ -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 0cc24951b54b..35c07d3a81df 100644
--- a/cui/source/options/optctl.hxx
+++ b/cui/source/options/optctl.hxx
@@ -38,6 +38,9 @@ public:
SvxCTLOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~SvxCTLOptionsPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index 000000000000..ba068fe28af7
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include <officecfg/Office/Linguistic.hxx>
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet)
+ : SfxTabPage(pPage, pController, "cui/ui/optdeeplpage.ui", "OptDeeplPage", &rSet)
+ , m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+ , m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+ std::optional<OUString> oDeeplAPIUrl
+ = officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get();
+ if (oDeeplAPIUrl && !oDeeplAPIUrl->isEmpty())
+ m_xAPIUrl->set_text(*officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get());
+
+ std::optional<OUString> oDeeplAuthKey
+ = officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get();
+ if (oDeeplAuthKey && !oDeeplAuthKey->isEmpty())
+ m_xAuthKey->set_text(*officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get());
+}
+
+OUString OptDeeplTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_link_button("privacy"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Linguistic::Translation::Deepl::ApiURL::set(m_xAPIUrl->get_text(), batch);
+ officecfg::Office::Linguistic::Translation::Deepl::AuthKey::set(m_xAuthKey->get_text(), batch);
+ batch->commit();
+ return false;
+}
+
+std::unique_ptr<SfxTabPage> OptDeeplTabPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrSet)
+{
+ return std::make_unique<OptDeeplTabPage>(pPage, pController, *rAttrSet);
+}
diff --git a/cui/source/options/optdeepl.hxx b/cui/source/options/optdeepl.hxx
new file mode 100644
index 000000000000..51714c685084
--- /dev/null
+++ b/cui/source/options/optdeepl.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+#include <sfx2/tabdlg.hxx>
+
+class OptDeeplTabPage : public SfxTabPage
+{
+public:
+ OptDeeplTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet);
+ virtual ~OptDeeplTabPage() override;
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
+
+ virtual OUString GetAllStrings() override;
+
+ virtual bool FillItemSet(SfxItemSet* rSet) override;
+ virtual void Reset(const SfxItemSet* rSet) override;
+
+private:
+ std::unique_ptr<weld::Entry> m_xAPIUrl;
+ std::unique_ptr<weld::Entry> m_xAuthKey;
+};
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index f0efb39ca18f..a9f4720419a7 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -67,6 +67,23 @@ static OUString getNormDicEntry_Impl(std::u16string_view 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
@@ -119,18 +136,6 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
- Sequence< Reference< XDictionary > > aDics;
- if (xDicList.is())
- aDics = xDicList->getDictionaries();
- const Reference< XDictionary > *pDic = aDics.getConstArray();
- sal_Int32 nCount = aDics.getLength();
-
- bool bFound = false;
- sal_Int32 i;
- for (i = 0; !bFound && i < nCount; ++i )
- if ( sDict.equalsIgnoreAsciiCase( pDic[i]->getName()) )
- bFound = true;
-
if ( sDict.indexOf("/") != -1 || sDict.indexOf("\\") != -1 )
{
// Detected an invalid character.
@@ -142,7 +147,12 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
return;
}
- if ( bFound )
+ Sequence< Reference< XDictionary > > aDics;
+ if (xDicList.is())
+ aDics = xDicList->getDictionaries();
+
+ if (std::any_of(aDics.begin(), aDics.end(),
+ [&sDict](auto& d) { return sDict.equalsIgnoreAsciiCase(d->getName()); }))
{
// duplicate names?
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
@@ -175,7 +185,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);
}
@@ -259,13 +269,9 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16
m_xReplaceED->connect_activate(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl));
// fill listbox with all available WB's
- const Reference< XDictionary > *pDic = aDics.getConstArray();
- sal_Int32 nCount = aDics.getLength();
-
OUString aLookUpEntry;
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ for (auto& xDic : aDics)
{
- Reference< XDictionary > xDic = pDic[i];
if (xDic.is())
{
bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
@@ -281,11 +287,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16
m_xLangLB->SetLanguageList( SvxLanguageListFlags::ALL, true, true );
- Link<OUString&,bool> aLink = LINK(this, SvxEditDictionaryDialog, InsertTextHdl);
- m_xReplaceED->connect_insert_text(aLink);
- m_xWordED->connect_insert_text(aLink);
-
- if ( nCount > 0 )
+ if (aDics.hasElements())
{
m_xAllDictsLB->set_active_text(aLookUpEntry);
int nPos = m_xAllDictsLB->get_active();
@@ -383,7 +385,7 @@ void SvxEditDictionaryDialog::RemoveDictEntry(int nEntry)
{
OUString sTmpShort(m_pWordsLB->get_text(nEntry, 0));
- Reference<XDictionary> xDic = aDics.getConstArray()[nLBPos];
+ Reference<XDictionary> xDic = aDics[nLBPos];
if (xDic->remove(sTmpShort)) // sal_True on success
{
m_pWordsLB->remove(nEntry);
@@ -449,7 +451,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, weld::ComboBox&, vo
void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
{
- Reference< XDictionary > xDic = aDics.getConstArray()[ nId ];
+ Reference<XDictionary> xDic = aDics[nId];
weld::WaitObject aWait(m_xDialog.get());
@@ -499,16 +501,14 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
m_pWordsLB->clear();
Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() );
- const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
- sal_Int32 nCount = aEntries.getLength();
std::vector<OUString> aSortedDicEntries;
- aSortedDicEntries.reserve(nCount);
- for (sal_Int32 i = 0; i < nCount; i++)
+ aSortedDicEntries.reserve(aEntries.getLength());
+ for (auto& xDictionaryEntry : aEntries)
{
- OUString aStr = pEntry[i]->getDictionaryWord();
- if(!pEntry[i]->getReplacementText().isEmpty())
+ OUString aStr = xDictionaryEntry->getDictionaryWord();
+ if (!xDictionaryEntry->getReplacementText().isEmpty())
{
- aStr += "\t" + pEntry[i]->getReplacementText();
+ aStr += "\t" + xDictionaryEntry->getReplacementText();
}
aSortedDicEntries.push_back(aStr);
}
@@ -527,10 +527,11 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
int nRow = 0;
for (OUString const & rStr : aSortedDicEntries)
{
- m_pWordsLB->append_text(rStr.getToken(0, '\t'));
- if (m_pWordsLB == m_xDoubleColumnLB.get())
+ sal_Int32 index = 0;
+ m_pWordsLB->append_text(rStr.getToken(0, '\t', index));
+ if (index != -1 && m_pWordsLB == m_xDoubleColumnLB.get())
{
- OUString sReplace = rStr.getToken(1, '\t');
+ OUString sReplace = rStr.getToken(0, '\t', index);
m_pWordsLB->set_text(nRow, sReplace, 1);
++nRow;
}
@@ -598,9 +599,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();
@@ -673,7 +674,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;
@@ -754,9 +755,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;
}
@@ -765,10 +766,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 48840b17ea33..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,13 +41,21 @@ 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_toggled( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
m_xEBasicCodeCB->connect_toggled( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
@@ -57,12 +67,14 @@ OfaMSFilterTabPage::~OfaMSFilterTabPage()
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::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,55 +83,94 @@ 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();
}
@@ -133,9 +184,12 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2(weld::Container* pPage, weld::DialogCon
, 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
{
@@ -155,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();
@@ -257,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 f38a89366286..51a51ec04456 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -23,13 +23,21 @@
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::Toggleable&, void);
DECL_LINK(LoadExcelBasicCheckHdl_Impl, weld::Toggleable&, void);
@@ -40,6 +48,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
@@ -57,9 +67,12 @@ class OfaMSFilterTabPage2 : public SfxTabPage
sChgToFromPDF;
std::unique_ptr<weld::TreeView> m_xCheckLB;
+ std::unique_ptr<weld::Label> m_xHighlightingFT;
std::unique_ptr<weld::RadioButton> m_xHighlightingRB;
std::unique_ptr<weld::RadioButton> m_xShadingRB;
+ std::unique_ptr<weld::Widget> m_xShadingImg;
std::unique_ptr<weld::CheckButton> m_xMSOLockFileCB;
+ std::unique_ptr<weld::Widget> m_xMSOLockFileImg;
void InsertEntry( const OUString& _rTxt, MSFltrPg2_CheckBoxEntries _nType );
void InsertEntry( const OUString& _rTxt, MSFltrPg2_CheckBoxEntries _nType,
@@ -71,6 +84,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
virtual ~OfaMSFilterTabPage2() override;
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index e0b0bfdf8c5d..c449bc4a652e 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -48,13 +48,14 @@
#include <editeng/editids.hrc>
#include <svx/svxids.hrc>
#include <svl/intitem.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
@@ -81,13 +82,18 @@
#include <vcl/window.hxx>
#include <vcl/IconThemeInfo.hxx>
#include <vcl/skia/SkiaHelper.hxx>
+#include <bitmaps.hlst>
+
#include "optgdlg.hxx"
#include <svtools/apearcfg.hxx>
#include <svtools/optionsdrawinglayer.hxx>
#include <svtools/restartdialog.hxx>
#include <svtools/imgdef.hxx>
+#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
+#include <vcl/unohelp2.hxx>
#if defined(_WIN32)
+#include <systools/win32/winstoreutil.hxx>
#include <vcl/fileregistration.hxx>
#endif
using namespace ::com::sun::star::uno;
@@ -154,48 +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_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_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"))
- , m_xHelpImproveLabel(m_xBuilder->weld_label("label7")) //"Help Improve"
-#if defined(UNX)
- , m_xQuickLaunchCB(m_xBuilder->weld_check_button("systray"))
-#else
- , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
+ , m_xCrashReportImg(m_xBuilder->weld_widget("lockcrashreport"))
#endif
#if defined(_WIN32)
+ , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
+ , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
+ , m_xQuickLaunchImg(m_xBuilder->weld_widget("lockquicklaunch"))
, m_xFileAssocFrame(m_xBuilder->weld_widget("fileassoc"))
, m_xFileAssocBtn(m_xBuilder->weld_button("assocfiles"))
, m_xPerformFileExtCheck(m_xBuilder->weld_check_button("cbPerformFileExtCheck"))
+ , m_xPerformFileExtImg(m_xBuilder->weld_widget("lockcbPerformFileExtCheck"))
#endif
{
- if (!lcl_HasSystemFilePicker())
- m_xFileDlgFrame->hide();
- else if (officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly())
- {
- m_xFileDlgROImage->show();
- m_xFileDlgCB->set_sensitive(false);
- }
-
- m_xQuickLaunchCB->show();
-
- //Only available in Win or if building the gtk systray
-#if !defined(_WIN32)
- m_xQuickStarterFrame->hide();
- //Hide frame label in case of no content
- m_xHelpImproveLabel->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
@@ -215,6 +219,34 @@ 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;
@@ -244,7 +276,7 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
bModified = true;
}
- const SfxUInt16Item* pUInt16Item = dynamic_cast< const SfxUInt16Item* >( GetOldItem( *rSet, SID_ATTR_YEAR2000 ) );
+ const SfxUInt16Item* pUInt16Item = GetOldItem( *rSet, SID_ATTR_YEAR2000 );
sal_uInt16 nNum = static_cast<sal_uInt16>(m_xYearValueField->get_text().toInt32());
if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
{
@@ -267,38 +299,66 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
m_xPerformFileExtCheck->get_active(), batch);
bModified = true;
}
-#endif
-
- batch->commit();
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 )
{
+ 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();
+
+ bEnable = !officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::isReadOnly();
m_xPopUpNoHelpCB->set_active( officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get() );
+ m_xPopUpNoHelpCB->set_sensitive(bEnable);
+ m_xPopUpNoHelpImg->set_visible(!bEnable);
m_xPopUpNoHelpCB->save_state();
+
+ bEnable = !officecfg::Office::Common::Misc::ShowTipOfTheDay::isReadOnly();
m_xShowTipOfTheDay->set_active( officecfg::Office::Common::Misc::ShowTipOfTheDay::get() );
+ m_xShowTipOfTheDay->set_sensitive(bEnable);
+ m_xShowTipOfTheDayImg->set_visible(!bEnable);
m_xShowTipOfTheDay->save_state();
- m_xFileDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemFileDialog::get() );
+
+ if (!lcl_HasSystemFilePicker())
+ m_xFileDlgFrame->hide();
+ else
+ {
+ bEnable = !officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly();
+ m_xFileDlgCB->set_sensitive(bEnable);
+ m_xFileDlgROImage->set_visible(!bEnable);
+ }
+ m_xFileDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemFileDialog::get());
m_xFileDlgCB->save_state();
+ 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
@@ -307,11 +367,12 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
#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() );
@@ -323,11 +384,11 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
m_xQuickLaunchCB->save_state();
-#if defined(_WIN32)
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
}
@@ -403,23 +464,18 @@ CanvasSettings::CanvasSettings() :
Reference<XHierarchicalNameAccess> xHierarchicalNameAccess(
xNameAccess, UNO_QUERY_THROW);
- Sequence<OUString> serviceNames = xNameAccess->getElementNames();
- const OUString* pCurr = serviceNames.getConstArray();
- const OUString* const pEnd = pCurr + serviceNames.getLength();
- while( pCurr != pEnd )
+ for (auto& serviceName : xNameAccess->getElementNames())
{
Reference<XNameAccess> xEntryNameAccess(
- xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
+ xHierarchicalNameAccess->getByHierarchicalName(serviceName),
UNO_QUERY );
if( xEntryNameAccess.is() )
{
Sequence<OUString> preferredImplementations;
if( xEntryNameAccess->getByName("PreferredImplementations") >>= preferredImplementations )
- maAvailableImplementations.emplace_back(*pCurr,preferredImplementations );
+ maAvailableImplementations.emplace_back(serviceName, preferredImplementations);
}
-
- ++pCurr;
}
}
catch (const Exception&)
@@ -439,15 +495,12 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const
// implementation that presents the "HardwareAcceleration" property
for (auto const& availableImpl : maAvailableImplementations)
{
- const OUString* pCurrImpl = availableImpl.second.getConstArray();
- const OUString* const pEndImpl = pCurrImpl + availableImpl.second.getLength();
-
- while( pCurrImpl != pEndImpl )
+ for (auto& currImpl : availableImpl.second)
{
try
{
Reference<XPropertySet> xPropSet( xFactory->createInstance(
- pCurrImpl->trim() ),
+ currImpl.trim() ),
UNO_QUERY_THROW );
bool bHasAccel(false);
if( xPropSet->getPropertyValue("HardwareAcceleration") >>= bHasAccel )
@@ -460,8 +513,6 @@ bool CanvasSettings::IsHardwareAccelerationAvailable() const
catch (const Exception&)
{
}
-
- ++pCurrImpl;
}
}
}
@@ -524,39 +575,69 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, nSidebarSizeLB_InitialSelection(0)
, nNotebookbarSizeLB_InitialSelection(0)
, nStyleLB_InitialSelection(0)
- , pAppearanceCfg(new SvtTabAppearanceCfg)
, pCanvasSettings(new CanvasSettings)
+ , m_xIconSizeLabel(m_xBuilder->weld_label("label14"))
, m_xIconSizeLB(m_xBuilder->weld_combo_box("iconsize"))
+ , m_xIconSizeImg(m_xBuilder->weld_widget("lockiconsize"))
+ , m_xSidebarIconSizeLabel(m_xBuilder->weld_label("label9"))
, m_xSidebarIconSizeLB(m_xBuilder->weld_combo_box("sidebariconsize"))
+ , m_xSidebarIconSizeImg(m_xBuilder->weld_widget("locksidebariconsize"))
+ , m_xNotebookbarIconSizeLabel(m_xBuilder->weld_label("label8"))
, m_xNotebookbarIconSizeLB(m_xBuilder->weld_combo_box("notebookbariconsize"))
+ , m_xNotebookbarIconSizeImg(m_xBuilder->weld_widget("locknotebookbariconsize"))
+ , m_xDarkModeFrame(m_xBuilder->weld_widget("darkmode"))
+ , m_xAppearanceStyleLabel(m_xBuilder->weld_label("label7"))
+ , m_xAppearanceStyleLB(m_xBuilder->weld_combo_box("appearance"))
+ , m_xAppearanceStyleImg(m_xBuilder->weld_widget("lockappearance"))
+ , m_xIconStyleLabel(m_xBuilder->weld_label("label6"))
, m_xIconStyleLB(m_xBuilder->weld_combo_box("iconstyle"))
+ , m_xIconStyleImg(m_xBuilder->weld_widget("lockiconstyle"))
, m_xFontAntiAliasing(m_xBuilder->weld_check_button("aafont"))
+ , m_xFontAntiAliasingImg(m_xBuilder->weld_widget("lockaafont"))
, m_xAAPointLimitLabel(m_xBuilder->weld_label("aafrom"))
+ , m_xAAPointLimitLabelImg(m_xBuilder->weld_widget("lockaafrom"))
, m_xAAPointLimit(m_xBuilder->weld_metric_spin_button("aanf", FieldUnit::PIXEL))
- , m_xMenuIconBox(m_xBuilder->weld_widget("menuiconsbox"))
- , m_xMenuIconsLB(m_xBuilder->weld_combo_box("menuicons"))
- , m_xContextMenuShortcutsLB(m_xBuilder->weld_combo_box("contextmenushortcuts"))
, m_xFontShowCB(m_xBuilder->weld_check_button("showfontpreview"))
+ , m_xFontShowImg(m_xBuilder->weld_widget("lockshowfontpreview"))
, m_xUseHardwareAccell(m_xBuilder->weld_check_button("useaccel"))
+ , m_xUseHardwareAccellImg(m_xBuilder->weld_widget("lockuseaccel"))
, m_xUseAntiAliase(m_xBuilder->weld_check_button("useaa"))
+ , m_xUseAntiAliaseImg(m_xBuilder->weld_widget("lockuseaa"))
, m_xUseSkia(m_xBuilder->weld_check_button("useskia"))
+ , m_xUseSkiaImg(m_xBuilder->weld_widget("lockuseskia"))
, m_xForceSkiaRaster(m_xBuilder->weld_check_button("forceskiaraster"))
+ , m_xForceSkiaRasterImg(m_xBuilder->weld_widget("lockforceskiaraster"))
, m_xSkiaStatusEnabled(m_xBuilder->weld_label("skiaenabled"))
, m_xSkiaStatusDisabled(m_xBuilder->weld_label("skiadisabled"))
- , m_xMousePosLB(m_xBuilder->weld_combo_box("mousepos"))
+ , m_xSkiaLog(m_xBuilder->weld_button("btnSkialog"))
+ , m_xMouseMiddleLabel(m_xBuilder->weld_label("label12"))
, m_xMouseMiddleLB(m_xBuilder->weld_combo_box("mousemiddle"))
+ , m_xMouseMiddleImg(m_xBuilder->weld_widget("lockmousemiddle"))
, m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
, m_xRunGPTests(m_xBuilder->weld_button("btn_rungptest"))
+ , m_sAutoStr(m_xIconStyleLB->get_text(0))
{
- if (Application::GetToolkitName().startsWith("gtk"))
- m_xMenuIconBox->hide();
+ OUString sToolKitName(Application::GetToolkitName());
+ const bool bHasDarkMode = sToolKitName.startsWith("gtk") || sToolKitName == "osx" || sToolKitName == "win";
+ if (!bHasDarkMode)
+ m_xDarkModeFrame->hide();
m_xFontAntiAliasing->connect_toggled( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
m_xUseSkia->connect_toggled(LINK(this, OfaViewTabPage, OnUseSkiaToggled));
+ m_xSkiaLog->connect_clicked(LINK(this, OfaViewTabPage, OnCopySkiaLog));
+
+ UpdateIconThemes();
+
+ m_xIconStyleLB->set_active(0);
+
+ m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
+ m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
+}
+void OfaViewTabPage::UpdateIconThemes()
+{
// Set known icon themes
- OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) );
m_xIconStyleLB->clear();
StyleSettings aStyleSettings = Application::GetSettings().GetStyleSettings();
mInstalledIconThemes = aStyleSettings.GetInstalledIconThemes();
@@ -566,9 +647,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
@@ -576,12 +655,6 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
for (auto const& installIconTheme : mInstalledIconThemes)
m_xIconStyleLB->append(installIconTheme.GetThemeId(), installIconTheme.GetDisplayName());
-
- m_xIconStyleLB->set_active(0);
-
- m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
- m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
- m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
}
OfaViewTabPage::~OfaViewTabPage()
@@ -603,7 +676,7 @@ IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button&, 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);
@@ -614,12 +687,25 @@ IMPL_LINK_NOARG(OfaViewTabPage, OnUseSkiaToggled, weld::Toggleable&, void)
UpdateSkiaStatus();
}
+IMPL_LINK_NOARG(OfaViewTabPage, OnCopySkiaLog, weld::Button&, void)
+{
+#if HAVE_FEATURE_SKIA
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
+ css::datatransfer::clipboard::SystemClipboard::create(
+ comphelper::getProcessComponentContext());
+ OUString sInfo = SkiaHelper::readLog();
+ vcl::unohelper::TextDataObject::CopyStringTo(sInfo, xClipboard);
+ m_xSkiaLog->set_from_icon_name(RID_SVXBMP_COPY);
+#endif
+}
+
void OfaViewTabPage::HideSkiaWidgets()
{
m_xUseSkia->hide();
m_xForceSkiaRaster->hide();
m_xSkiaStatusEnabled->hide();
m_xSkiaStatusDisabled->hide();
+ m_xSkiaLog->hide();
}
void OfaViewTabPage::UpdateSkiaStatus()
@@ -648,9 +734,11 @@ void OfaViewTabPage::UpdateSkiaStatus()
m_xSkiaStatusEnabled->set_visible(bEnabled);
m_xSkiaStatusDisabled->set_visible(!bEnabled);
- // FIXME: should really add code to show a 'lock' icon here.
m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
+ m_xUseSkiaImg->set_visible(officecfg::Office::Common::VCL::UseSkia::isReadOnly());
m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+ m_xForceSkiaRasterImg->set_visible(officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+ m_xSkiaLog->set_sensitive(bEnabled);
// Technically the 'use hardware acceleration' option could be used to mean !forceSkiaRaster, but the implementation
// of the option is so tied to the implementation of the canvas module that it's simpler to ignore it.
@@ -665,10 +753,37 @@ std::unique_ptr<SfxTabPage> OfaViewTabPage::Create( weld::Container* pPage, weld
return std::make_unique<OfaViewTabPage>(pPage, pController, *rAttrSet);
}
+OUString OfaViewTabPage::GetAllStrings()
+{
+ 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());
@@ -685,7 +800,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 );
}
@@ -701,7 +816,7 @@ 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!");
}
officecfg::Office::Common::Misc::SidebarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
}
@@ -717,7 +832,7 @@ 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!");
}
officecfg::Office::Common::Misc::NotebookbarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
}
@@ -730,40 +845,31 @@ 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;
}
@@ -773,25 +879,10 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
bModified = true;
}
- if (m_xMenuIconsLB->get_value_changed_from_saved())
+ if (m_xAppearanceStyleLB->get_value_changed_from_saved())
{
- officecfg::Office::Common::View::Menu::IsSystemIconsInMenus::set(m_xMenuIconsLB->get_active() == 0, xChanges);
- officecfg::Office::Common::View::Menu::ShowIconsInMenues::set(m_xMenuIconsLB->get_active() == 2, xChanges);
+ bDarkModeOptModified = true;
bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
- }
-
- if (m_xContextMenuShortcutsLB->get_value_changed_from_saved())
- {
- officecfg::Office::Common::View::Menu::ShortcutsInContextMenus::set(
- m_xContextMenuShortcutsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xContextMenuShortcutsLB->get_active() - 1),
- xChanges);
- bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
}
// #i95644# if disabled, do not use value, see in ::Reset()
@@ -825,20 +916,13 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
xChanges->commit();
- 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);
- }
+ if (bDarkModeOptModified)
+ MiscSettings::SetDarkMode(m_xAppearanceStyleLB->get_active());
if ( bAppearanceChanged )
{
- pAppearanceCfg->Commit();
- pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
+ batch->commit();
+ SvtTabAppearanceCfg::SetApplicationDefaults ( GetpApp() );
}
if(bRepaintWindows)
@@ -868,17 +952,23 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
void OfaViewTabPage::Reset( const SfxItemSet* )
{
SvtMiscOptions aMiscOptions;
+ bool bEnable = true;
- if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
+ if (SvtMiscOptions::GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
{
nSizeLB_InitialSelection = 1;
- if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
+ if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
nSizeLB_InitialSelection = 2;
- else if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
+ else if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
nSizeLB_InitialSelection = 3;
}
+ bEnable = !officecfg::Office::Common::Misc::SymbolSet::isReadOnly();
m_xIconSizeLB->set_active( nSizeLB_InitialSelection );
+ m_xIconSizeLabel->set_sensitive(bEnable);
+ m_xIconSizeLB->set_sensitive(bEnable);
+ m_xMoreIcons->set_sensitive(bEnable);
+ m_xIconSizeImg->set_visible(!bEnable);
m_xIconSizeLB->save_value();
ToolBoxButtonSize eSidebarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
@@ -888,8 +978,14 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
nSidebarSizeLB_InitialSelection = 1;
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();
+
ToolBoxButtonSize eNotebookbarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::NotebookbarIconSize::get());
if( eNotebookbarIconSize == ToolBoxButtonSize::DontCare )
; // do nothing
@@ -897,44 +993,67 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
nNotebookbarSizeLB_InitialSelection = 1;
else if( eNotebookbarIconSize == ToolBoxButtonSize::Large )
nNotebookbarSizeLB_InitialSelection = 2;
+
+ bEnable = !officecfg::Office::Common::Misc::NotebookbarIconSize::isReadOnly();
m_xNotebookbarIconSizeLB->set_active(nNotebookbarSizeLB_InitialSelection);
+ m_xNotebookbarIconSizeLabel->set_sensitive(bEnable);
+ m_xNotebookbarIconSizeLB->set_sensitive(bEnable);
+ m_xNotebookbarIconSizeImg->set_visible(!bEnable);
m_xNotebookbarIconSizeLB->save_value();
+ // tdf#153497 set name of automatic icon theme, it may have changed due to "Apply" while this page is visible
+ UpdateIconThemes();
+
if (aMiscOptions.IconThemeWasSetAutomatically()) {
nStyleLB_InitialSelection = 0;
}
else {
- const OUString& selected = aMiscOptions.GetIconTheme();
+ const OUString& selected = SvtMiscOptions::GetIconTheme();
const vcl::IconThemeInfo& selectedInfo =
vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, selected);
nStyleLB_InitialSelection = m_xIconStyleLB->find_text(selectedInfo.GetDisplayName());
}
+ bEnable = !officecfg::Office::Common::Misc::SymbolStyle::isReadOnly();
m_xIconStyleLB->set_active(nStyleLB_InitialSelection);
+ m_xIconStyleLabel->set_sensitive(bEnable);
+ m_xIconStyleLB->set_sensitive(bEnable);
+ m_xIconStyleImg->set_visible(!bEnable);
m_xIconStyleLB->save_value();
- // Mouse Snap
- m_xMousePosLB->set_active(static_cast<sal_Int32>(pAppearanceCfg->GetSnapMode()));
- m_xMousePosLB->save_value();
+ bEnable = !officecfg::Office::Common::Misc::Appearance::isReadOnly();
+ m_xAppearanceStyleLB->set_active(officecfg::Office::Common::Misc::Appearance::get());
+ m_xAppearanceStyleLabel->set_sensitive(bEnable);
+ m_xAppearanceStyleLB->set_sensitive(bEnable);
+ m_xAppearanceStyleImg->set_visible(!bEnable);
+ m_xAppearanceStyleLB->save_value();
- // Mouse Snap
- m_xMouseMiddleLB->set_active(static_cast<short>(pAppearanceCfg->GetMiddleMouseButton()));
+ // Middle Mouse Button
+ bEnable = !officecfg::Office::Common::View::Dialog::MiddleMouseButton::isReadOnly();
+ sal_Int16 nMiddleMouseButton = officecfg::Office::Common::View::Dialog::MiddleMouseButton::get();
+ m_xMouseMiddleLB->set_active(static_cast<short>(nMiddleMouseButton));
+ m_xMouseMiddleLabel->set_sensitive(bEnable);
+ m_xMouseMiddleLB->set_sensitive(bEnable);
+ m_xMouseMiddleImg->set_visible(!bEnable);
m_xMouseMiddleLB->save_value();
- m_xFontAntiAliasing->set_active( pAppearanceCfg->IsFontAntiAliasing() );
- m_xAAPointLimit->set_value(pAppearanceCfg->GetFontAntialiasingMinPixelHeight(), FieldUnit::PIXEL);
+ bEnable = !officecfg::Office::Common::View::FontAntiAliasing::Enabled::isReadOnly();
+ bool bFontAntiAliasing = officecfg::Office::Common::View::FontAntiAliasing::Enabled::get();
+ m_xFontAntiAliasing->set_active( bFontAntiAliasing );
+ m_xFontAntiAliasing->set_sensitive(bEnable);
+ m_xFontAntiAliasingImg->set_visible(!bEnable);
+
+ bEnable = !officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::isReadOnly();
+ sal_Int16 nFontAntiAliasingMinPixelHeight = officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::get();
+ m_xAAPointLimit->set_value(nFontAntiAliasingMinPixelHeight, FieldUnit::PIXEL);
+ m_xAAPointLimit->set_sensitive(bEnable);
+ m_xAAPointLimitLabelImg->set_visible(!bEnable);
// WorkingSet
+ bEnable = !officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::isReadOnly();
m_xFontShowCB->set_active(officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get());
- bool bSystemMenuIcons = officecfg::Office::Common::View::Menu::IsSystemIconsInMenus::get();
- bool bMenuIcons = officecfg::Office::Common::View::Menu::ShowIconsInMenues::get();
- m_xMenuIconsLB->set_active(bSystemMenuIcons ? 0 : (bMenuIcons ? 2 : 1));
- m_xMenuIconsLB->save_value();
-
- TriState eContextMenuShortcuts = static_cast<TriState>(officecfg::Office::Common::View::Menu::ShortcutsInContextMenus::get());
- bool bContextMenuShortcutsNonDefault = eContextMenuShortcuts == TRISTATE_FALSE || eContextMenuShortcuts == TRISTATE_TRUE;
- m_xContextMenuShortcutsLB->set_active(bContextMenuShortcutsNonDefault ? eContextMenuShortcuts + 1 : 0);
- m_xContextMenuShortcutsLB->save_value();
+ m_xFontShowCB->set_sensitive(bEnable);
+ m_xFontShowImg->set_visible(!bEnable);
UpdateHardwareAccelStatus();
m_xUseHardwareAccell->save_state();
@@ -948,8 +1067,12 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
{
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();
}
@@ -973,11 +1096,13 @@ void OfaViewTabPage::UpdateHardwareAccelStatus()
{
m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
+ m_xUseHardwareAccellImg->set_visible(pCanvasSettings->IsHardwareAccelerationRO());
}
else
{
m_xUseHardwareAccell->set_active(false);
m_xUseHardwareAccell->set_sensitive(false);
+ m_xUseHardwareAccellImg->set_visible(true);
}
#if HAVE_FEATURE_SKIA
m_xUseHardwareAccell->set_sensitive(!m_xUseSkia->get_active());
@@ -994,11 +1119,11 @@ struct LanguageConfig_Impl
static bool bLanguageCurrentDoc_Impl = false;
// some things we'll need...
-constexpr OUStringLiteral sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess";
+constexpr OUString sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess"_ustr;
constexpr OUStringLiteral sAccessUpdSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess";
-constexpr OUStringLiteral sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales";
-constexpr OUStringLiteral sUserLocalePath = u"org.openoffice.Office.Linguistic/General";
-constexpr OUStringLiteral sUserLocaleKey = u"UILocale";
+constexpr OUString sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales"_ustr;
+constexpr OUString sUserLocalePath = u"org.openoffice.Office.Linguistic/General"_ustr;
+constexpr OUString sUserLocaleKey = u"UILocale"_ustr;
static Sequence< OUString > seqInstalledLanguages;
static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper )
@@ -1009,10 +1134,9 @@ static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocal
SAL_WARN_IF( !nPatterns, "cui.options", "No date acceptance pattern");
if (nPatterns)
{
- const OUString* pPatterns = aDateAcceptancePatterns.getConstArray();
- aBuf.append( pPatterns[0]);
+ aBuf.append(aDateAcceptancePatterns[0]);
for (sal_Int32 i=1; i < nPatterns; ++i)
- aBuf.append(';').append( pPatterns[i]);
+ aBuf.append(";" + aDateAcceptancePatterns[i]);
}
return aBuf.makeStringAndClear();
}
@@ -1034,19 +1158,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();
@@ -1066,7 +1199,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
css::configuration::theDefaultProvider::get(
comphelper::getProcessComponentContext()));
// find out which locales are currently installed and add them to the listbox
- Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(OUString(sInstalledLocalesPath)))) };
+ Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(sInstalledLocalesPath))) };
Reference< XNameAccess > theNameAccess(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
seqInstalledLanguages = theNameAccess->getElementNames();
@@ -1085,7 +1218,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;
});
@@ -1098,7 +1231,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{ Any(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))
@@ -1168,7 +1301,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);
@@ -1183,15 +1316,17 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
m_bOldAsian = SvtCJKOptions::IsAnyEnabled();
m_xAsianSupportCB->set_active(m_bOldAsian);
m_xAsianSupportCB->save_state();
- bool bReadonly = SvtCJKOptions::IsReadOnly(SvtCJKOptions::E_ALL);
+ bool bReadonly = SvtCJKOptions::IsAnyReadOnly();
m_xAsianSupportCB->set_sensitive(!bReadonly);
+ m_xAsianSupportImg->set_visible(bReadonly);
SupportHdl(*m_xAsianSupportCB);
- m_bOldCtl = pLangConfig->aCTLLanguageOptions.IsCTLFontEnabled();
+ m_bOldCtl = SvtCTLOptions::IsCTLFontEnabled();
m_xCTLSupportCB->set_active(m_bOldCtl);
m_xCTLSupportCB->save_state();
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() );
@@ -1224,6 +1359,31 @@ 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
@@ -1267,7 +1427,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Reference< XMultiServiceFactory > theConfigProvider(
css::configuration::theDefaultProvider::get(
comphelper::getProcessComponentContext()));
- Sequence< Any > theArgs{ Any(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)
@@ -1323,8 +1483,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())
@@ -1336,7 +1498,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(
@@ -1365,7 +1527,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 );
}
@@ -1384,7 +1546,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 );
}
@@ -1403,7 +1565,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 );
}
@@ -1472,12 +1634,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
@@ -1496,11 +1666,12 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
}
// if pCurr==nullptr the SYSTEM entry is selected
- OUString sId = !pCurr ? OUString("default") : OUString::number(reinterpret_cast<sal_Int64>(pCurr));
+ OUString sId = !pCurr ? OUString("default") : weld::toId(pCurr);
m_xCurrencyLB->set_active_id(sId);
bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Currency);
m_xCurrencyLB->set_sensitive(!bReadonly);
m_xCurrencyFT->set_sensitive(!bReadonly);
+ m_xCurrencyImg->set_visible(bReadonly);
// date acceptance patterns
OUString aDatePatternsString = pLangConfig->aSysLocaleOptions.GetDatePatternsConfigString();
@@ -1508,13 +1679,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
@@ -1530,18 +1709,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);
@@ -1554,24 +1733,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;
}
@@ -1597,14 +1775,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);
@@ -1617,7 +1796,7 @@ 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())
@@ -1625,7 +1804,7 @@ IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::Toggleable&, 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())
@@ -1663,7 +1842,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
}
// second check if CJK must be enabled
// #103299# - if CJK support is not readonly
- if(!SvtCJKOptions::IsReadOnly(SvtCJKOptions::E_ALL))
+ if(!SvtCJKOptions::IsAnyReadOnly())
{
bool bIsCJKFixed = bool(nType & SvtScriptType::ASIAN);
lcl_checkLanguageCheckBox(*m_xAsianSupportCB, bIsCJKFixed, m_bOldAsian);
@@ -1672,7 +1851,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
(eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getConfiguredSystemLanguage() : eLang);
- const OUString aDefaultID = "default";
+ constexpr OUString aDefaultID = u"default"_ustr;
// Update the "Default ..." currency.
m_xCurrencyLB->remove_id(aDefaultID);
OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
@@ -1681,8 +1860,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);
@@ -1693,20 +1871,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
@@ -1721,6 +1918,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;
@@ -1735,7 +1944,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'y')
{
aBuf[nChar] = 'Y';
- bModified = true;
+ rbModified = true;
}
bY = true;
bSep = false;
@@ -1747,7 +1956,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'm')
{
aBuf[nChar] = 'M';
- bModified = true;
+ rbModified = true;
}
bM = true;
bSep = false;
@@ -1759,7 +1968,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'd')
{
aBuf[nChar] = 'D';
- bModified = true;
+ rbModified = true;
}
bD = true;
bSep = false;
@@ -1777,20 +1986,10 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
bValid &= (bY || bM || bD);
}
}
+ if (rbModified)
+ rPatterns = aBuf.makeStringAndClear();
}
- 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(aBuf.makeStringAndClear());
- rEd.set_position(nCursorPos);
- }
- 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 75f29c6c5a34..2c62e569ea75 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -18,6 +18,7 @@
*/
#pragma once
#include <memory>
+#include <config_features.h>
#include <sfx2/tabdlg.hxx>
#include <svx/langbox.hxx>
@@ -33,24 +34,34 @@ 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_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::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::Label> m_xHelpImproveLabel;
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);
@@ -66,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:
@@ -80,47 +91,66 @@ private:
sal_Int32 nNotebookbarSizeLB_InitialSelection;
sal_Int32 nStyleLB_InitialSelection;
- std::unique_ptr<SvtTabAppearanceCfg> pAppearanceCfg;
std::unique_ptr<CanvasSettings> pCanvasSettings;
std::vector<vcl::IconThemeInfo> mInstalledIconThemes;
+ std::unique_ptr<weld::Label> m_xIconSizeLabel;
std::unique_ptr<weld::ComboBox> m_xIconSizeLB;
+ std::unique_ptr<weld::Widget> m_xIconSizeImg;
+ std::unique_ptr<weld::Label> m_xSidebarIconSizeLabel;
std::unique_ptr<weld::ComboBox> m_xSidebarIconSizeLB;
+ std::unique_ptr<weld::Widget> m_xSidebarIconSizeImg;
+ std::unique_ptr<weld::Label> m_xNotebookbarIconSizeLabel;
std::unique_ptr<weld::ComboBox> m_xNotebookbarIconSizeLB;
+ std::unique_ptr<weld::Widget> m_xNotebookbarIconSizeImg;
+ std::unique_ptr<weld::Widget> m_xDarkModeFrame;
+ std::unique_ptr<weld::Label> m_xAppearanceStyleLabel;
+ std::unique_ptr<weld::ComboBox> m_xAppearanceStyleLB;
+ std::unique_ptr<weld::Widget> m_xAppearanceStyleImg;
+ std::unique_ptr<weld::Label> m_xIconStyleLabel;
std::unique_ptr<weld::ComboBox> m_xIconStyleLB;
+ std::unique_ptr<weld::Widget> m_xIconStyleImg;
std::unique_ptr<weld::CheckButton> m_xFontAntiAliasing;
+ std::unique_ptr<weld::Widget> m_xFontAntiAliasingImg;
std::unique_ptr<weld::Label> m_xAAPointLimitLabel;
+ std::unique_ptr<weld::Widget> m_xAAPointLimitLabelImg;
std::unique_ptr<weld::MetricSpinButton> m_xAAPointLimit;
- std::unique_ptr<weld::Widget> m_xMenuIconBox;
- std::unique_ptr<weld::ComboBox> m_xMenuIconsLB;
-
- std::unique_ptr<weld::ComboBox> m_xContextMenuShortcutsLB;
-
std::unique_ptr<weld::CheckButton> m_xFontShowCB;
+ std::unique_ptr<weld::Widget> m_xFontShowImg;
std::unique_ptr<weld::CheckButton> m_xUseHardwareAccell;
+ std::unique_ptr<weld::Widget> m_xUseHardwareAccellImg;
std::unique_ptr<weld::CheckButton> m_xUseAntiAliase;
+ std::unique_ptr<weld::Widget> m_xUseAntiAliaseImg;
std::unique_ptr<weld::CheckButton> m_xUseSkia;
+ std::unique_ptr<weld::Widget> m_xUseSkiaImg;
std::unique_ptr<weld::CheckButton> m_xForceSkiaRaster;
+ std::unique_ptr<weld::Widget> m_xForceSkiaRasterImg;
std::unique_ptr<weld::Label> m_xSkiaStatusEnabled;
std::unique_ptr<weld::Label> m_xSkiaStatusDisabled;
+ std::unique_ptr<weld::Button> m_xSkiaLog;
- std::unique_ptr<weld::ComboBox> m_xMousePosLB;
+ std::unique_ptr<weld::Label> m_xMouseMiddleLabel;
std::unique_ptr<weld::ComboBox> m_xMouseMiddleLB;
+ std::unique_ptr<weld::Widget> m_xMouseMiddleImg;
std::unique_ptr<weld::Button> m_xMoreIcons;
std::unique_ptr<weld::Button> m_xRunGPTests;
+ OUString m_sAutoStr;
+
DECL_LINK(OnAntialiasingToggled, weld::Toggleable&, void);
DECL_LINK(OnUseSkiaToggled, weld::Toggleable&, void);
+ DECL_LINK(OnCopySkiaLog, weld::Button&, void);
DECL_STATIC_LINK(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void);
DECL_LINK(OnRunGPTestClick, weld::Button&, void);
void UpdateSkiaStatus();
void HideSkiaWidgets();
void UpdateHardwareAccelStatus();
+ void UpdateIconThemes();
public:
OfaViewTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -128,6 +158,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
@@ -149,31 +181,44 @@ class OfaLanguagesTabPage : public SfxTabPage
std::unique_ptr<weld::ComboBox> m_xUserInterfaceLB;
std::unique_ptr<weld::Label> m_xLocaleSettingFT;
std::unique_ptr<SvxLanguageBox> m_xLocaleSettingLB;
+ std::unique_ptr<weld::Widget> m_xLocaleSettingImg;
+ std::unique_ptr<weld::Label> m_xDecimalSeparatorFT;
std::unique_ptr<weld::CheckButton> m_xDecimalSeparatorCB;
+ std::unique_ptr<weld::Widget> m_xDecimalSeparatorImg;
std::unique_ptr<weld::Label> m_xCurrencyFT;
std::unique_ptr<weld::ComboBox> m_xCurrencyLB;
+ std::unique_ptr<weld::Widget> m_xCurrencyImg;
std::unique_ptr<weld::Label> m_xDatePatternsFT;
std::unique_ptr<weld::Entry> m_xDatePatternsED;
+ std::unique_ptr<weld::Widget> m_xDatePatternsImg;
std::unique_ptr<SvxLanguageBox> m_xWesternLanguageLB;
std::unique_ptr<weld::Label> m_xWesternLanguageFT;
+ std::unique_ptr<weld::Widget> m_xWesternLanguageImg;
std::unique_ptr<SvxLanguageBox> m_xAsianLanguageLB;
std::unique_ptr<SvxLanguageBox> m_xComplexLanguageLB;
std::unique_ptr<weld::CheckButton> m_xCurrentDocCB;
std::unique_ptr<weld::CheckButton> m_xAsianSupportCB;
+ std::unique_ptr<weld::Widget> m_xAsianSupportImg;
std::unique_ptr<weld::CheckButton> m_xCTLSupportCB;
+ std::unique_ptr<weld::Widget> m_xCTLSupportImg;
std::unique_ptr<weld::CheckButton> m_xIgnoreLanguageChangeCB;
+ std::unique_ptr<weld::Widget> m_xIgnoreLanguageChangeImg;
DECL_LINK(SupportHdl, weld::Toggleable&, void);
DECL_LINK(LocaleSettingHdl, weld::ComboBox&, void);
DECL_LINK(DatePatternsHdl, weld::Entry&, void);
+ bool validateDatePatterns( bool& rbModified, OUString& rPatterns );
+
public:
OfaLanguagesTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~OfaLanguagesTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 91e8cf911e99..d2cf40244d85 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -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;
@@ -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
@@ -363,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)
@@ -479,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 5fb93652b9a9..6880ec4b2e33 100644
--- a/cui/source/options/opthtml.cxx
+++ b/cui/source/options/opthtml.cxx
@@ -18,7 +18,6 @@
*/
#include <svtools/langtab.hxx>
-#include <svtools/htmlcfg.hxx>
#include <comphelper/configuration.hxx>
#include <officecfg/Office/Common.hxx>
#include "opthtml.hxx"
@@ -27,20 +26,33 @@
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());
@@ -57,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()
@@ -72,6 +81,30 @@ 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* )
{
std::shared_ptr<comphelper::ConfigurationChanges> xChanges = comphelper::ConfigurationChanges::create();
@@ -125,10 +158,6 @@ bool OfaHtmlTabPage::FillItemSet( SfxItemSet* )
officecfg::Office::Common::Filter::HTML::Export::PrintLayout::set(
m_xPrintExtensionCB->get_active(), xChanges);
- if( m_xCharSetLB->GetSelectTextEncoding() != SvxHtmlOptions::GetTextEncoding() )
- officecfg::Office::Common::Filter::HTML::Export::Encoding::set(
- m_xCharSetLB->GetSelectTextEncoding(), xChanges );
-
xChanges->commit();
return false;
}
@@ -136,21 +165,99 @@ bool OfaHtmlTabPage::FillItemSet( SfxItemSet* )
void OfaHtmlTabPage::Reset( const SfxItemSet* )
{
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());
+ 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());
- m_xPrintExtensionCB->set_active(SvxHtmlOptions::IsPrintLayoutExtension());
+ 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();
@@ -166,10 +273,6 @@ void OfaHtmlTabPage::Reset( const SfxItemSet* )
m_xNumbersEnglishUSCB->save_state();
m_xUnknownTagCB->save_state();
m_xIgnoreFontNamesCB->save_state();
-
- if( !SvxHtmlOptions::IsDefaultTextEncoding() &&
- m_xCharSetLB->GetSelectTextEncoding() != SvxHtmlOptions::GetTextEncoding() )
- m_xCharSetLB->SelectTextEncoding( SvxHtmlOptions::GetTextEncoding() );
}
IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::Toggleable&, rBox, void)
diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx
index 4fdb9d754451..2f389a7af571 100644
--- a/cui/source/options/opthtml.hxx
+++ b/cui/source/options/opthtml.hxx
@@ -25,22 +25,35 @@ 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::Toggleable&, void);
@@ -50,6 +63,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 3ce4df88cb59..eaf0e8616bfd 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -27,9 +27,8 @@
#include <vcl/weld.hxx>
#include <sfx2/filedlghelper.hxx>
#include <vcl/svapp.hxx>
-#include <unotools/securityoptions.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <dialmgr.hxx>
#include "optinet2.hxx"
@@ -52,7 +51,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/task/PasswordContainer.hpp>
#include <com/sun/star/task/XPasswordContainer2.hpp>
-#include "securityoptions.hxx"
+#include <securityoptions.hxx>
#include "webconninfo.hxx"
#include "certpath.hxx"
#include "tsaurls.hxx"
@@ -93,14 +92,12 @@ IMPL_LINK(SvxProxyTabPage, PortChangedHdl, weld::Entry&, rEdit, void)
}
}
-constexpr OUStringLiteral g_aProxyModePN = u"ooInetProxyType";
-constexpr OUStringLiteral g_aHttpProxyPN = u"ooInetHTTPProxyName";
-constexpr OUStringLiteral g_aHttpPortPN = u"ooInetHTTPProxyPort";
-constexpr OUStringLiteral g_aHttpsProxyPN = u"ooInetHTTPSProxyName";
-constexpr OUStringLiteral g_aHttpsPortPN = u"ooInetHTTPSProxyPort";
-constexpr OUStringLiteral g_aFtpProxyPN = u"ooInetFTPProxyName";
-constexpr OUStringLiteral g_aFtpPortPN = u"ooInetFTPProxyPort";
-constexpr OUStringLiteral g_aNoProxyDescPN = u"ooInetNoProxy";
+constexpr OUString g_aProxyModePN = u"ooInetProxyType"_ustr;
+constexpr OUString g_aHttpProxyPN = u"ooInetHTTPProxyName"_ustr;
+constexpr OUString g_aHttpPortPN = u"ooInetHTTPProxyPort"_ustr;
+constexpr OUString g_aHttpsProxyPN = u"ooInetHTTPSProxyName"_ustr;
+constexpr OUString g_aHttpsPortPN = u"ooInetHTTPSProxyPort"_ustr;
+constexpr OUString g_aNoProxyDescPN = u"ooInetNoProxy"_ustr;
IMPL_STATIC_LINK(SvxProxyTabPage, NumberOnlyTextFilterHdl, OUString&, rTest, bool)
{
@@ -127,21 +124,24 @@ IMPL_STATIC_LINK(SvxProxyTabPage, NoSpaceTextFilterHdl, OUString&, rTest, bool)
/********************************************************************/
SvxProxyTabPage::SvxProxyTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optproxypage.ui", "OptProxyPage", &rSet)
+ , m_xProxyModeFT(m_xBuilder->weld_label("label2"))
, m_xProxyModeLB(m_xBuilder->weld_combo_box("proxymode"))
+ , m_xProxyModeImg(m_xBuilder->weld_widget("lockproxymode"))
, m_xHttpProxyFT(m_xBuilder->weld_label("httpft"))
, m_xHttpProxyED(m_xBuilder->weld_entry("http"))
+ , m_xHttpProxyImg(m_xBuilder->weld_widget("lockhttp"))
, m_xHttpPortFT(m_xBuilder->weld_label("httpportft"))
, m_xHttpPortED(m_xBuilder->weld_entry("httpport"))
+ , m_xHttpPortImg(m_xBuilder->weld_widget("lockhttpport"))
, m_xHttpsProxyFT(m_xBuilder->weld_label("httpsft"))
, m_xHttpsProxyED(m_xBuilder->weld_entry("https"))
+ , m_xHttpsProxyImg(m_xBuilder->weld_widget("lockhttps"))
, m_xHttpsPortFT(m_xBuilder->weld_label("httpsportft"))
, m_xHttpsPortED(m_xBuilder->weld_entry("httpsport"))
- , m_xFtpProxyFT(m_xBuilder->weld_label("ftpft"))
- , m_xFtpProxyED(m_xBuilder->weld_entry("ftp"))
- , m_xFtpPortFT(m_xBuilder->weld_label("ftpportft"))
- , m_xFtpPortED(m_xBuilder->weld_entry("ftpport"))
+ , m_xHttpsPortImg(m_xBuilder->weld_widget("lockhttpsport"))
, m_xNoProxyForFT(m_xBuilder->weld_label("noproxyft"))
, m_xNoProxyForED(m_xBuilder->weld_entry("noproxy"))
+ , m_xNoProxyForImg(m_xBuilder->weld_widget("locknoproxy"))
, m_xNoProxyDescFT(m_xBuilder->weld_label("noproxydesc"))
{
m_xHttpProxyED->connect_insert_text(LINK(this, SvxProxyTabPage, NoSpaceTextFilterHdl));
@@ -150,14 +150,10 @@ SvxProxyTabPage::SvxProxyTabPage(weld::Container* pPage, weld::DialogController*
m_xHttpsProxyED->connect_insert_text(LINK(this, SvxProxyTabPage, NoSpaceTextFilterHdl));
m_xHttpsPortED->connect_insert_text(LINK(this, SvxProxyTabPage, NumberOnlyTextFilterHdl));
m_xHttpsPortED->connect_changed(LINK(this, SvxProxyTabPage, PortChangedHdl));
- m_xFtpProxyED->connect_insert_text(LINK(this, SvxProxyTabPage, NoSpaceTextFilterHdl));
- m_xFtpPortED->connect_insert_text(LINK(this, SvxProxyTabPage, NumberOnlyTextFilterHdl));
- m_xFtpPortED->connect_changed(LINK(this, SvxProxyTabPage, PortChangedHdl));
Link<weld::Widget&,void> aLink = LINK( this, SvxProxyTabPage, LoseFocusHdl_Impl );
m_xHttpPortED->connect_focus_out( aLink );
m_xHttpsPortED->connect_focus_out( aLink );
- m_xFtpPortED->connect_focus_out( aLink );
m_xProxyModeLB->connect_changed(LINK( this, SvxProxyTabPage, ProxyHdl_Impl ));
@@ -204,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();
@@ -212,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() );
}
@@ -253,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 );
@@ -293,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);
@@ -323,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;
@@ -374,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()));
@@ -416,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);
}
@@ -476,17 +461,27 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* pPage, weld::DialogContr
: SfxTabPage(pPage, pController, "cui/ui/optsecuritypage.ui", "OptSecurityPage", &rSet)
, 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
@@ -510,10 +505,46 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* pPage, weld::DialogContr
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()
{
}
@@ -739,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 )
@@ -762,39 +833,56 @@ DeactivateRC SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-namespace
+OUString SvxSecurityTabPage::GetAllStrings()
{
- bool CheckAndSave( SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModified )
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label4", "label2", "masterpasswordtext",
+ "nopasswordsave", "label3", "label5", "label8",
+ "label7", "label10", "label9", "label12",
+ "label11" };
+
+ for (const auto& label : labels)
{
- bool bModified = false;
- if ( !SvtSecurityOptions::IsReadOnly( _eOpt ) )
- {
- bModified = SvtSecurityOptions::IsOptionSet( _eOpt ) != _bIsChecked;
- if ( bModified )
- {
- SvtSecurityOptions::SetOption( _eOpt, _bIsChecked );
- _rModified = true;
- }
- }
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "savepassword", "usemasterpassword" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
- return bModified;
+ // TODO: Should we exclude button strings from the search?
+ // button id: "browse" is excluded
+ OUString buttons[] = { "options", "connections", "masterpassword", "macro", "cert", "tsas" };
+
+ for (const auto& btn : buttons)
+ {
+ if (const auto& pString = m_xBuilder->weld_button(btn))
+ sAllStrings += pString->get_label() + " ";
}
+
+ return sAllStrings.replaceAll("_", "");
}
bool SvxSecurityTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
- if (m_xSecOptDlg)
+ if (m_xSecOptDlg) {
+ bModified = m_xSecOptDlg->SetSecurityOptions();
+ }
+
+ std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+ comphelper::ConfigurationChanges::create());
+ if (m_xParameterEdit->get_value_changed_from_saved())
{
- CheckAndSave( SvtSecurityOptions::EOption::DocWarnSaveOrSend, m_xSecOptDlg->IsSaveOrSendDocsChecked(), bModified );
- CheckAndSave( SvtSecurityOptions::EOption::DocWarnSigning, m_xSecOptDlg->IsSignDocsChecked(), bModified );
- CheckAndSave( SvtSecurityOptions::EOption::DocWarnPrint, m_xSecOptDlg->IsPrintDocsChecked(), bModified );
- CheckAndSave( SvtSecurityOptions::EOption::DocWarnCreatePdf, m_xSecOptDlg->IsCreatePdfChecked(), bModified );
- CheckAndSave( SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, m_xSecOptDlg->IsRemovePersInfoChecked(), bModified );
- CheckAndSave( SvtSecurityOptions::EOption::DocWarnRecommendPassword, m_xSecOptDlg->IsRecommPasswdChecked(), bModified );
- CheckAndSave( SvtSecurityOptions::EOption::CtrlClickHyperlink, m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified );
- CheckAndSave( 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;
@@ -855,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 4d03d2d04337..e05a79be029b 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -30,25 +30,27 @@ class SvxProxyTabPage : public SfxTabPage
{
private:
+ std::unique_ptr<weld::Label> m_xProxyModeFT;
std::unique_ptr<weld::ComboBox> m_xProxyModeLB;
+ std::unique_ptr<weld::Widget> m_xProxyModeImg;
std::unique_ptr<weld::Label> m_xHttpProxyFT;
std::unique_ptr<weld::Entry> m_xHttpProxyED;
+ std::unique_ptr<weld::Widget> m_xHttpProxyImg;
std::unique_ptr<weld::Label> m_xHttpPortFT;
std::unique_ptr<weld::Entry> m_xHttpPortED;
+ std::unique_ptr<weld::Widget> m_xHttpPortImg;
std::unique_ptr<weld::Label> m_xHttpsProxyFT;
std::unique_ptr<weld::Entry> m_xHttpsProxyED;
+ std::unique_ptr<weld::Widget> m_xHttpsProxyImg;
std::unique_ptr<weld::Label> m_xHttpsPortFT;
std::unique_ptr<weld::Entry> m_xHttpsPortED;
-
- std::unique_ptr<weld::Label> m_xFtpProxyFT;
- std::unique_ptr<weld::Entry> m_xFtpProxyED;
- std::unique_ptr<weld::Label> m_xFtpPortFT;
- std::unique_ptr<weld::Entry> m_xFtpPortED;
+ std::unique_ptr<weld::Widget> m_xHttpsPortImg;
std::unique_ptr<weld::Label> m_xNoProxyForFT;
std::unique_ptr<weld::Entry> m_xNoProxyForED;
+ std::unique_ptr<weld::Widget> m_xNoProxyForImg;
std::unique_ptr<weld::Label> m_xNoProxyDescFT;
css::uno::Reference< css::uno::XInterface > m_xConfigurationUpdateAccess;
@@ -68,6 +70,9 @@ 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;
};
@@ -87,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;
@@ -98,12 +105,21 @@ 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::Toggleable&, void);
DECL_LINK(MasterPasswordHdl, weld::Button&, void);
@@ -112,6 +128,7 @@ private:
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();
@@ -123,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;
};
@@ -151,6 +171,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
};
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 69302982214e..cc89865bdd28 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -33,6 +33,7 @@
#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
#include <strings.hrc>
#include <vcl/svapp.hxx>
@@ -44,7 +45,7 @@
#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>
@@ -58,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;
@@ -76,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"))
{
@@ -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 ) );
@@ -466,6 +473,36 @@ std::unique_ptr<SfxTabPage> SvxJavaOptionsPage::Create(weld::Container* pPage, w
return std::make_unique<SvxJavaOptionsPage>(pPage, pController, *rAttrSet);
}
+OUString SvxJavaOptionsPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "javapath", "selectruntime", "label12" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "javaenabled", "experimental", "macrorecording" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString buttons[] = { "add", "parameters", "classpath", "expertconfig" };
+
+ for (const auto& btn : buttons)
+ {
+ if (const auto& pString = m_xBuilder->weld_button(btn))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
{
bool bModified = false;
@@ -934,6 +971,7 @@ OUString SvxJavaClassPathDlg::GetClassPath() const
return sPath.makeStringAndClear();
}
+#if HAVE_FEATURE_JAVA
void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
{
if ( m_sOldPath.isEmpty() )
@@ -941,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 097b7ffb5336..84422c903056 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -75,7 +75,9 @@ 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;
@@ -108,6 +110,8 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
@@ -200,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 46e0d6e90892..960fd62e1ebf 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -17,11 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
#include <vcl/settings.hxx>
#include <vcl/weld.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <o3tl/safeint.hxx>
#include <officecfg/Office/Security.hxx>
+#include <officecfg/Office/Linguistic.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
#include <editeng/unolingu.hxx>
@@ -29,8 +32,9 @@
#include <sfx2/sfxsids.hrc>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
@@ -43,6 +47,8 @@
#include <com/sun/star/linguistic2/XLinguProperties.hpp>
#include <com/sun/star/lang/XServiceDisplayName.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <unotools/extendedsecurityoptions.hxx>
#include <svl/eitem.hxx>
#include <vcl/svapp.hxx>
@@ -57,6 +63,7 @@
#include <ucbhelper/content.hxx>
+#include <set>
#include <vector>
#include <map>
@@ -67,25 +74,18 @@ using namespace css::uno;
using namespace css::linguistic2;
using namespace css::beans;
-constexpr OUStringLiteral cSpell(SN_SPELLCHECKER);
-constexpr OUStringLiteral cGrammar(SN_GRAMMARCHECKER);
-constexpr OUStringLiteral cHyph(SN_HYPHENATOR);
-constexpr OUStringLiteral cThes(SN_THESAURUS);
+constexpr OUString cSpell(SN_SPELLCHECKER);
+constexpr OUString cGrammar(SN_GRAMMARCHECKER);
+constexpr OUString cHyph(SN_HYPHENATOR);
+constexpr OUString cThes(SN_THESAURUS);
// static ----------------------------------------------------------------
static sal_Int32 lcl_SeqGetEntryPos(
const Sequence< OUString > &rSeq, std::u16string_view rEntry )
{
- sal_Int32 i;
- sal_Int32 nLen = rSeq.getLength();
- const OUString *pItem = rSeq.getConstArray();
- for (i = 0; i < nLen; ++i)
- {
- if (rEntry == pItem[i])
- break;
- }
- return i < nLen ? i : -1;
+ auto it = std::find(rSeq.begin(), rSeq.end(), rEntry);
+ return it == rSeq.end() ? -1 : std::distance(rSeq.begin(), it);
}
static bool KillFile_Impl( const OUString& rURL )
@@ -127,12 +127,12 @@ class ModuleUserData_Impl
OUString sImplName;
public:
- ModuleUserData_Impl( const OUString& sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
+ ModuleUserData_Impl( OUString sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
bParent(bIsParent),
bIsChecked(bChecked),
nType(nSetType),
nIndex(nSetIndex),
- sImplName(sImpName)
+ sImplName(std::move(sImpName))
{
}
bool IsParent() const {return bParent;}
@@ -191,7 +191,9 @@ 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
};
}
@@ -203,6 +205,8 @@ static OUString lcl_GetPropertyName( EID_OPTIONS 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;
@@ -322,6 +326,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;
@@ -336,7 +356,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,7 +375,7 @@ public:
void SetChecked( const Sequence< OUString > &rConfiguredServices );
void Reconfigure( std::u16string_view rDisplayName, bool bEnable );
- const Sequence<Locale> & GetAllSupportedLocales() const { return aAllServiceLocales; }
+ const auto& GetAllSupportedLocales() const { return aAllServiceLocales; }
LangImplNameTable & GetSpellTable() { return aCfgSpellTable; }
LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
@@ -380,20 +400,6 @@ public:
};
-static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, std::u16string_view rTxt )
-{
- sal_Int32 nRes = -1;
- sal_Int32 nLen = rSeq.getLength();
- const OUString *pString = rSeq.getConstArray();
- for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i)
- {
- if (pString[i] == rTxt)
- nRes = i;
- }
- return nRes;
-}
-
-
Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang, sal_uInt8 nType )
{
LangImplNameTable *pTable = nullptr;
@@ -413,12 +419,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;
@@ -430,7 +436,7 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang,
case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break;
}
- if (!aImplName.isEmpty() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added
+ if (!aImplName.isEmpty() && (lcl_SeqGetEntryPos( aRes, aImplName) == -1)) // name not yet added
{
DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" );
if (nIdx < aRes.getLength())
@@ -461,37 +467,6 @@ ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( std::u16string_view rSv
return nullptr;
}
-
-static void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd)
-{
- Sequence<Locale> aLocToAdd(rAdd.getLength());
- Locale* pLocToAdd = aLocToAdd.getArray();
- sal_Int32 nFound = 0;
- for(const Locale& i : rAdd)
- {
- bool bFound = false;
- for(const Locale& j : std::as_const(aAllLocales))
- {
- if (i.Language == j.Language &&
- i.Country == j.Country &&
- i.Variant == j.Variant)
- {
- bFound = true;
- break;
- }
- }
- if(!bFound)
- {
- pLocToAdd[nFound++] = i;
- }
- }
- sal_Int32 nLength = aAllLocales.getLength();
- aAllLocales.realloc( nLength + nFound);
- Locale* pAllLocales2 = aAllLocales.getArray();
- for(sal_Int32 i = 0; i < nFound; i++)
- pAllLocales2[nLength++] = pLocToAdd[i];
-}
-
static void lcl_MergeDisplayArray(
SvxLinguData_Impl &rData,
const ServiceInfo_Impl &rToAdd )
@@ -552,9 +527,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(
@@ -575,7 +553,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 );
}
}
@@ -598,7 +576,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 );
}
}
@@ -620,7 +598,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 );
}
}
@@ -642,13 +620,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 );
@@ -746,20 +724,12 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
pInfo->bConfigured = bEnable;
- Sequence< Locale > aLocales;
- const Locale *pLocale = nullptr;
- sal_Int32 nLocales = 0;
- sal_Int32 i;
-
// update configured spellchecker entries
if (pInfo->xSpell.is())
{
- aLocales = pInfo->xSpell->getLocales();
- pLocale = aLocales.getConstArray();
- nLocales = aLocales.getLength();
- for (i = 0; i < nLocales; ++i)
+ for (auto& locale : pInfo->xSpell->getLocales())
{
- LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
+ LanguageType nLang = LanguageTag::convertToLanguageType(locale);
if (!aCfgSpellTable.count( nLang ) && bEnable)
aCfgSpellTable[ nLang ] = Sequence< OUString >();
if (aCfgSpellTable.count( nLang ))
@@ -770,12 +740,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
// update configured grammar checker entries
if (pInfo->xGrammar.is())
{
- aLocales = pInfo->xGrammar->getLocales();
- pLocale = aLocales.getConstArray();
- nLocales = aLocales.getLength();
- for (i = 0; i < nLocales; ++i)
+ for (auto& locale : pInfo->xGrammar->getLocales())
{
- LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
+ LanguageType nLang = LanguageTag::convertToLanguageType(locale);
if (!aCfgGrammarTable.count( nLang ) && bEnable)
aCfgGrammarTable[ nLang ] = Sequence< OUString >();
if (aCfgGrammarTable.count( nLang ))
@@ -786,12 +753,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
// update configured hyphenator entries
if (pInfo->xHyph.is())
{
- aLocales = pInfo->xHyph->getLocales();
- pLocale = aLocales.getConstArray();
- nLocales = aLocales.getLength();
- for (i = 0; i < nLocales; ++i)
+ for (auto& locale : pInfo->xHyph->getLocales())
{
- LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
+ LanguageType nLang = LanguageTag::convertToLanguageType(locale);
if (!aCfgHyphTable.count( nLang ) && bEnable)
aCfgHyphTable[ nLang ] = Sequence< OUString >();
if (aCfgHyphTable.count( nLang ))
@@ -803,12 +767,9 @@ void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEna
if (!pInfo->xThes.is())
return;
- aLocales = pInfo->xThes->getLocales();
- pLocale = aLocales.getConstArray();
- nLocales = aLocales.getLength();
- for (i = 0; i < nLocales; ++i)
+ for (auto& locale : pInfo->xThes->getLocales())
{
- LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
+ LanguageType nLang = LanguageTag::convertToLanguageType(locale);
if (!aCfgThesTable.count( nLang ) && bEnable)
aCfgThesTable[ nLang ] = Sequence< OUString >();
if (aCfgThesTable.count( nLang ))
@@ -825,6 +786,8 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
, 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))
@@ -845,6 +808,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,7 +834,15 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
m_xMoreDictsLink->connect_activate_link(LINK(this, SvxLinguTabPage, OnLinkClick));
if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
- m_xMoreDictsLink->hide();
+ m_xMoreDictsBox->hide();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // hide User-defined Dictionaries part
+ m_xBuilder->weld_frame("dictsframe")->hide();
+ // hide Get more dictionaries URL + icon
+ m_xMoreDictsBox->hide();
+ }
xProp = LinguMgr::GetLinguPropertySet();
xDicList.set( LinguMgr::GetDictionaryList() );
@@ -914,6 +886,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; // !!!!
@@ -991,18 +979,14 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
if (aData.GetEntryId() < nDics)
{
bool bChecked = m_xLinguDicsCLB->get_toggle(i) == TRISTATE_TRUE;
- uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] );
+ uno::Reference<XDictionary> xDic(aDics[i]);
if (xDic.is())
{
if (LinguMgr::GetIgnoreAllList() == xDic)
bChecked = true;
xDic->setActive( bChecked );
-
if (bChecked)
- {
- OUString aDicName( xDic->getName() );
- pActiveDic[ nActiveDics++ ] = aDicName;
- }
+ pActiveDic[nActiveDics++] = xDic->getName();
}
}
}
@@ -1041,7 +1025,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 );
@@ -1052,8 +1036,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;
}
@@ -1103,11 +1086,9 @@ void SvxLinguTabPage::UpdateDicBox_Impl()
m_xLinguDicsCLB->freeze();
m_xLinguDicsCLB->clear();
- sal_Int32 nDics = aDics.getLength();
- const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
- for (sal_Int32 i = 0; i < nDics; ++i)
+ for (sal_Int32 i = 0; i < aDics.getLength(); ++i)
{
- const uno::Reference< XDictionary > &rDic = pDic[i];
+ const uno::Reference<XDictionary>& rDic = aDics[i];
if (rDic.is())
AddDicBoxEntry( rDic, static_cast<sal_uInt16>(i) );
}
@@ -1134,7 +1115,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);
}
@@ -1178,6 +1159,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;
@@ -1187,6 +1169,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;
@@ -1196,6 +1179,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;
@@ -1205,6 +1189,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;
@@ -1214,6 +1219,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;
@@ -1222,12 +1228,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;
@@ -1238,6 +1244,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();
@@ -1249,6 +1256,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();
@@ -1259,6 +1267,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;
@@ -1268,6 +1277,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();
@@ -1280,6 +1290,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)
@@ -1314,7 +1333,7 @@ IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const weld::TreeView::
IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
{
- const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)];
+ const uno::Reference<XDictionary> &rDic = aDics[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)];
if (LinguMgr::GetIgnoreAllList() == rDic)
m_xLinguDicsCLB->set_toggle(rRowCol.first, TRISTATE_TRUE);
}
@@ -1326,20 +1345,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 ))
@@ -1381,7 +1398,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
sal_Int32 nDics = aDics.getLength();
if (nDicPos < nDics)
{
- uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ];
+ uno::Reference<XDictionary> xDic = aDics[nDicPos];
if (xDic.is())
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
@@ -1406,7 +1423,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
sal_Int32 nDics = aDics.getLength();
if (nDicPos < nDics)
{
- uno::Reference< XDictionary > xDic = aDics.getConstArray()[ nDicPos ];
+ uno::Reference<XDictionary> xDic = aDics[nDicPos];
if (xDic.is())
{
if (LinguMgr::GetIgnoreAllList() == xDic)
@@ -1482,7 +1499,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
}
else
{
- OSL_FAIL( "rBtn unexpected value" );
+ SAL_WARN("cui.options", "rBtn unexpected value");
}
}
@@ -1514,7 +1531,7 @@ IMPL_LINK(SvxLinguTabPage, SelectHdl_Impl, weld::TreeView&, rBox, void)
}
else
{
- OSL_FAIL( "rBox unexpected value" );
+ SAL_WARN("cui.options", "rBtn unexpected value");
}
}
@@ -1526,9 +1543,10 @@ void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
m_xLinguModulesCLB->hide();
m_xLinguModulesEditPB->hide();
- if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER)
+ if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER &&
+ !comphelper::LibreOfficeKit::isActive())
{
- m_xMoreDictsLink->show();
+ m_xMoreDictsBox->show();
}
}
}
@@ -1580,17 +1598,20 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
m_xLanguageLB->SetLanguageList(SvxLanguageListFlags::EMPTY, false, false, true);
//fill language box
- const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales();
- for (Locale const & locale : rLoc)
- {
- LanguageType nLang = LanguageTag::convertToLanguageType( locale );
- m_xLanguageLB->InsertLanguage(nLang);
- }
+ 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());
}
@@ -1598,7 +1619,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 )
@@ -1609,16 +1630,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);
@@ -1627,7 +1648,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;
@@ -1636,7 +1657,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);
@@ -1667,7 +1688,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)
@@ -1710,38 +1731,42 @@ 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
if (LANGUAGE_DONTKNOW != eCurLanguage)
{
- 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;
- Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
- const OUString *pName = aNames.getConstArray();
- sal_Int32 nNames = aNames.getLength();
+ 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;
+ }
+
sal_Int32 nLocalIndex = 0; // index relative to parent
- for (n = 0; n < nNames; ++n)
+ for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_SPELL))
{
OUString aImplName;
bool bIsSuppLang = false;
- pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
if (pInfo)
{
bIsSuppLang = pInfo->xSpell.is() &&
@@ -1761,13 +1786,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;
}
}
@@ -1775,23 +1801,27 @@ 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;
- aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
- pName = aNames.getConstArray();
- nNames = aNames.getLength();
+ 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;
+ }
+
nLocalIndex = 0;
- for (n = 0; n < nNames; ++n)
+ for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_GRAMMAR))
{
OUString aImplName;
bool bIsSuppLang = false;
- pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
if (pInfo)
{
bIsSuppLang = pInfo->xGrammar.is() &&
@@ -1812,13 +1842,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;
}
}
@@ -1826,23 +1857,27 @@ 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;
- aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
- pName = aNames.getConstArray();
- nNames = aNames.getLength();
+ 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;
+ }
+
nLocalIndex = 0;
- for (n = 0; n < nNames; ++n)
+ for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_HYPH))
{
OUString aImplName;
bool bIsSuppLang = false;
- pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
if (pInfo)
{
bIsSuppLang = pInfo->xHyph.is() &&
@@ -1862,13 +1897,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;
}
}
@@ -1876,23 +1912,27 @@ 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;
- aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
- pName = aNames.getConstArray();
- nNames = aNames.getLength();
+ 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;
+ }
+
nLocalIndex = 0;
- for (n = 0; n < nNames; ++n)
+ for (auto& name : rLinguData.GetSortedImplNames(eCurLanguage, TYPE_THES))
{
OUString aImplName;
bool bIsSuppLang = false;
- pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ ServiceInfo_Impl* pInfo = rLinguData.GetInfoByImplName(name);
if (pInfo)
{
bIsSuppLang = pInfo->xThes.is() &&
@@ -1912,13 +1952,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_THES, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index e85ef1d7e23a..129cbc1b01b7 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -30,11 +30,13 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(weld::Container* pPage, weld::DialogControlle
: SfxTabPage(pPage, pController, "cui/ui/optopenclpage.ui", "OptOpenCLPage", &rSet)
, maConfig(OpenCLConfig::get())
, mxUseOpenCL(m_xBuilder->weld_check_button("useopencl"))
+ , mxUseOpenImg(m_xBuilder->weld_widget("lockuseopencl"))
, mxOclUsed(m_xBuilder->weld_label("openclused"))
, mxOclNotUsed(m_xBuilder->weld_label("openclnotused"))
{
mxUseOpenCL->set_active(maConfig.mbUseOpenCL);
mxUseOpenCL->set_sensitive(!officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
+ mxUseOpenImg->set_visible(officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
bool bCLUsed = openclwrapper::GPUEnv::isOpenCLEnabled();
mxOclUsed->set_visible(bCLUsed);
@@ -50,6 +52,22 @@ std::unique_ptr<SfxTabPage> SvxOpenCLTabPage::Create(weld::Container* pPage, wel
return std::make_unique<SvxOpenCLTabPage>(pPage, pController, *rAttrSet);
}
+OUString SvxOpenCLTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "openclnotused", "openclused" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += mxUseOpenCL->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
@@ -81,6 +99,7 @@ void SvxOpenCLTabPage::Reset( const SfxItemSet* )
maConfig = OpenCLConfig::get();
mxUseOpenCL->set_active(maConfig.mbUseOpenCL);
+ mxUseOpenImg->set_visible(officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
mxUseOpenCL->save_state();
}
diff --git a/cui/source/options/optopencl.hxx b/cui/source/options/optopencl.hxx
index f7097d3fdba6..e6414245da8f 100644
--- a/cui/source/options/optopencl.hxx
+++ b/cui/source/options/optopencl.hxx
@@ -27,6 +27,7 @@ private:
OpenCLConfig maConfig;
std::unique_ptr<weld::CheckButton> mxUseOpenCL;
+ std::unique_ptr<weld::Widget> mxUseOpenImg;
std::unique_ptr<weld::Label> mxOclUsed;
std::unique_ptr<weld::Label> mxOclNotUsed;
@@ -34,6 +35,7 @@ public:
SvxOpenCLTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxOpenCLTabPage() override;
+ virtual OUString GetAllStrings() override;
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index d6ccbf113e25..f75f354c9c6f 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -40,12 +40,12 @@
#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;
@@ -53,8 +53,8 @@ using namespace svx;
// define ----------------------------------------------------------------
constexpr OUStringLiteral POSTFIX_INTERNAL = u"_internal";
-constexpr OUStringLiteral POSTFIX_USER = u"_user";
-constexpr OUStringLiteral POSTFIX_WRITABLE = u"_writable";
+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";
@@ -135,16 +135,16 @@ static OUString getCfgName_Impl( SvtPathOptions::Paths _nHandle )
#define MULTIPATH_DELIMITER ';'
-static OUString Convert_Impl( const OUString& rValue )
+static OUString Convert_Impl( std::u16string_view rValue )
{
- if (rValue.isEmpty())
+ if (rValue.empty())
return OUString();
sal_Int32 nPos = 0;
OUStringBuffer aReturn;
for (;;)
{
- OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos );
+ OUString aValue( o3tl::getToken(rValue, 0, MULTIPATH_DELIMITER, nPos ) );
INetURLObject aObj( aValue );
if ( aObj.GetProtocol() == INetProtocol::File )
aReturn.append(aObj.PathToFileName());
@@ -211,7 +211,7 @@ IMPL_LINK(SvxPathTabPage, HeaderBarClick, int, nColumn, void)
SvxPathTabPage::~SvxPathTabPage()
{
for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(i).toInt64());
+ delete weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
}
std::unique_ptr<SfxTabPage> SvxPathTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
@@ -220,11 +220,19 @@ std::unique_ptr<SfxTabPage> SvxPathTabPage::Create( weld::Container* pPage, weld
return std::make_unique<SvxPathTabPage>( pPage, pController, *rAttrSet );
}
+OUString SvxPathTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ if (const auto& pString = m_xBuilder->weld_label("label1"))
+ sAllStrings += pString->get_label() + " ";
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxPathTabPage::FillItemSet( SfxItemSet* )
{
for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; ++i)
{
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(i).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
SvtPathOptions::Paths nRealId = pPathImpl->nRealId;
if (pPathImpl->bItemStateSet )
SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath );
@@ -322,7 +330,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
pPathImpl->sWritablePath = sWritable;
pPathImpl->bReadOnly = bReadOnly;
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pPathImpl));
+ OUString sId = weld::toId(pPathImpl);
m_xPathBox->set_id(*xIter, sId);
}
}
@@ -338,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();
@@ -349,7 +357,7 @@ 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());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(rEntry));
OUString aOldPath = SvtDefaultOptions::GetDefaultPath( pPathImpl->nRealId );
if ( !aOldPath.isEmpty() )
@@ -362,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 );
@@ -420,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;
@@ -470,7 +478,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, DoubleClickPathHdl_Impl, weld::TreeView&, bool)
IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void)
{
int nEntry = m_xPathBox->get_cursor_index();
- PathUserData_Impl* pPathImpl = nEntry != -1 ? reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64()) : nullptr;
+ PathUserData_Impl* pPathImpl = nEntry != -1 ? weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry)) : nullptr;
if (!pPathImpl || pPathImpl->bReadOnly)
return;
@@ -613,14 +621,11 @@ void SvxPathTabPage::GetPathList(
Sequence< OUString > aPathSeq;
if ( aAny >>= aPathSeq )
{
- tools::Long i, nCount = aPathSeq.getLength();
- const OUString* pPaths = aPathSeq.getConstArray();
-
- for ( i = 0; i < nCount; ++i )
+ for (auto& path : aPathSeq)
{
if ( !_rInternalPath.isEmpty() )
_rInternalPath += ";";
- _rInternalPath += pPaths[i];
+ _rInternalPath += path;
}
}
// load user paths
@@ -628,14 +633,11 @@ void SvxPathTabPage::GetPathList(
sCfgName + POSTFIX_USER);
if ( aAny >>= aPathSeq )
{
- tools::Long i, nCount = aPathSeq.getLength();
- const OUString* pPaths = aPathSeq.getConstArray();
-
- for ( i = 0; i < nCount; ++i )
+ for (auto& path : aPathSeq)
{
if ( !_rUserPath.isEmpty() )
_rUserPath += ";";
- _rUserPath += pPaths[i];
+ _rUserPath += path;
}
}
// then the writable path
@@ -658,7 +660,7 @@ void SvxPathTabPage::GetPathList(
void SvxPathTabPage::SetPathList(
- SvtPathOptions::Paths _nPathHandle, const OUString& _rUserPath, const OUString& _rWritablePath )
+ SvtPathOptions::Paths _nPathHandle, std::u16string_view _rUserPath, const OUString& _rWritablePath )
{
OUString sCfgName = getCfgName_Impl( _nPathHandle );
@@ -677,7 +679,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 08e4ce219197..368a6d425186 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -21,9 +21,13 @@
#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>
@@ -36,22 +40,19 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <sfx2/sfxsids.hrc>
#include <sfx2/docfilt.hxx>
-#include <unotools/optionsdlg.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <officecfg/Office/Recovery.hxx>
+#include <unotools/confignode.hxx>
#include <sfx2/fcontnr.hxx>
using namespace com::sun::star::uno;
-using namespace com::sun::star::util;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace comphelper;
-#define CFG_PAGE_AND_GROUP u"General", u"LoadSave"
-
struct SvxSaveTabPage_Impl
{
@@ -75,18 +76,33 @@ 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"))
@@ -94,6 +110,7 @@ SvxSaveTabPage::SvxSaveTabPage(weld::Container* pPage, weld::DialogController* p
, 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
@@ -102,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_toggled( LINK( this, SvxSaveTabPage, AutoClickHdl_Impl ) );
+ m_xBackupCB->connect_toggled(LINK(this, SvxSaveTabPage, BackupClickHdl_Impl));
SvtModuleOptions aModuleOpt;
if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
@@ -181,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()
@@ -195,36 +218,40 @@ std::unique_ptr<SfxTabPage> SvxSaveTabPage::Create(weld::Container* pPage, weld:
return std::make_unique<SvxSaveTabPage>(pPage, pController, *rAttrSet);
}
-void SvxSaveTabPage::DetectHiddenControls()
+OUString SvxSaveTabPage::GetAllStrings()
{
- SvtOptionsDialogOptions aOptionsDlgOpt;
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "autosave_mins", "label3",
+ "label5", "label6", "saveas_label", "odfwarning_label" };
- if ( aOptionsDlgOpt.IsOptionHidden( u"Backup", CFG_PAGE_AND_GROUP ) )
+ for (const auto& label : labels)
{
- // hide controls of "Backup"
- m_xBackupCB->hide();
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
}
- if ( aOptionsDlgOpt.IsOptionHidden( u"AutoSave", CFG_PAGE_AND_GROUP ) )
- {
- // hide controls of "AutoSave"
- m_xAutoSaveCB->hide();
- m_xAutoSaveEdit->hide();
- m_xMinuteFT->hide();
- }
+ OUString checkButton[]
+ = { "load_settings", "load_docprinter", "load_anyuser", "autosave",
+ "userautosave", "docinfo", "backup", "backupintodocumentfolder",
+ "relative_fsys", "relative_inet", "warnalienformat" };
- if ( aOptionsDlgOpt.IsOptionHidden( u"UserAutoSave", CFG_PAGE_AND_GROUP ) )
+ for (const auto& check : checkButton)
{
- // hide controls of "UserAutoSave"
- m_xUserAutoSaveCB->hide();
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
}
+ return sAllStrings.replaceAll("_", "");
}
bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
{
auto xChanges = comphelper::ConfigurationChanges::create();
bool bModified = false;
+ if (m_xLoadViewPosAnyUserCB->get_state_changed_from_saved())
+ {
+ 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);
@@ -239,55 +266,62 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
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;
}
@@ -325,7 +359,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
return bModified;
}
-static bool isODFFormat( const OUString& sFilter )
+static bool isODFFormat( std::u16string_view sFilter )
{
static const char* aODFFormats[] =
{
@@ -349,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;
@@ -361,12 +395,20 @@ static bool isODFFormat( const OUString& sFilter )
void SvxSaveTabPage::Reset( const SfxItemSet* )
{
+ 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(!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(!officecfg::Office::Common::Save::Document::LoadPrinter::isReadOnly());
+ m_xLoadDocPrinterImg->set_visible(officecfg::Office::Common::Save::Document::LoadPrinter::isReadOnly());
if ( !pImpl->bInitialized )
{
@@ -396,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);
@@ -416,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 &)
@@ -429,38 +487,56 @@ void SvxSaveTabPage::Reset( const SfxItemSet* )
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_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(officecfg::Office::Common::Save::Document::AutoSave::get());
- m_xAutoSaveCB->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly());
+ 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(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(officecfg::Office::Common::Save::Document::WarnAlienFormat::get());
m_xWarnAlienFormatCB->set_sensitive(!officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly());
+ m_xWarnAlienFormatImg->set_visible(officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly());
- m_xAutoSaveEdit->set_value(officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get());
- m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::isReadOnly());
+ m_xAutoSaveEdit->set_value(officecfg::Office::Recovery::AutoSave::TimeIntervall::get());
+ m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Recovery::AutoSave::TimeIntervall::isReadOnly());
// save relatively
m_xRelativeFsysCB->set_active(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(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 = GetODFDefaultVersion();
m_xODFVersionLB->set_active_id(OUString::number(nDefaultVersion));
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();
@@ -479,9 +555,9 @@ IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Toggleable&, rBox, void)
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
{
@@ -491,32 +567,31 @@ IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Toggleable&, rBox, void)
}
}
+IMPL_LINK_NOARG(SvxSaveTabPage, BackupClickHdl_Impl, weld::Toggleable&, void)
+{
+ m_xBackupIntoDocumentFolderCB->set_sensitive(m_xBackupCB->get_active() &&
+ !officecfg::Office::Common::Save::Document::BackupIntoDocumentFolder::isReadOnly());
+}
+
static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, std::u16string_view rExtension)
{
OUString sName;
- const PropertyValue* pPropVal = rProperties.getConstArray();
- const PropertyValue* const pEnd = pPropVal + rProperties.getLength();
- for( ; pPropVal != pEnd; pPropVal++ )
+ for (auto& propVal : rProperties)
{
- const OUString &rName = pPropVal->Name;
+ const OUString &rName = propVal.Name;
if (rName == "UIName")
{
OUString sUIName;
- if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
+ if ((propVal.Value >>= sUIName) && sUIName.getLength())
{
if (!rExtension.empty())
- {
- return sUIName + " (" + rExtension + ")";
- }
- else
- {
- return sUIName;
- }
+ sUIName += OUString::Concat(" (") + rExtension + ")";
+ return sUIName;
}
}
else if (rName == "Name")
{
- pPropVal->Value >>= sName;
+ propVal.Value >>= sName;
}
}
@@ -565,7 +640,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 4ec3b1ddada5..255719184d63 100644
--- a/cui/source/options/optsave.hxx
+++ b/cui/source/options/optsave.hxx
@@ -41,18 +41,33 @@ 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;
@@ -60,17 +75,18 @@ private:
std::unique_ptr<weld::Label> m_xODFWarningFT;
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 754fb5fdce27..2686f8dfb277 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -17,6 +17,7 @@
* 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>
@@ -34,65 +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_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());
+ 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() );
+ uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
- m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
+ m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
- bool bDownloadSupported = false;
- m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported;
+ bool bDownloadSupported = false;
+ m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported;
- m_xAutoDownloadCheckBox->set_visible(bDownloadSupported);
- m_xDestPathLabel->set_visible(bDownloadSupported);
- m_xDestPath->set_visible(bDownloadSupported);
- m_xChangePathButton->set_visible(bDownloadSupported);
+ m_xAutoDownloadCheckBox->set_visible(bDownloadSupported);
+ m_xDestPathLabel->set_visible(bDownloadSupported);
+ m_xDestPath->set_visible(bDownloadSupported);
+ m_xChangePathButton->set_visible(bDownloadSupported);
- m_aLastCheckedTemplate = m_xLastChecked->get_label();
+ m_aLastCheckedTemplate = m_xLastChecked->get_label();
- UpdateLastCheckedText();
- UpdateUserAgent();
+ 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()
@@ -190,130 +225,184 @@ 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;
-
- bool bValue;
- sal_Int64 nValue;
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "lastchecked", "neverchecked", "labeldest",
+ "destpathlabel", "labelagent", "useragent_label", "useragent_changed" };
- 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()
@@ -328,6 +417,7 @@ IMPL_LINK(SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, weld::Toggleable&, rBox, vo
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::Toggleable&, void)
@@ -402,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 7143bf333f65..48113c8079d6 100644
--- a/cui/source/options/optupdt.hxx
+++ b/cui/source/options/optupdt.hxx
@@ -28,6 +28,9 @@
class SvxOnlineUpdateTabPage : public SfxTabPage
{
private:
+ bool m_showTraditionalOnlineUpdate;
+ bool m_showMarOnlineUpdate;
+
OUString m_aNeverChecked;
OUString m_aLastCheckedTemplate;
@@ -36,18 +39,27 @@ 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);
@@ -62,9 +74,14 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
virtual ~SvxOnlineUpdateTabPage() override;
+ virtual OUString GetAllStrings() override;
+
virtual bool FillItemSet( SfxItemSet* rSet ) override;
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
+
+ static bool isTraditionalOnlineUpdateAvailable();
+ static bool isMarOnlineUpdateAvailable();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 02c064d1b2e7..3328760a9855 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -11,6 +11,8 @@
#include "personalization.hxx"
+#include <dialmgr.hxx>
+
#include <comphelper/processfactory.hxx>
#include <officecfg/Office/Common.hxx>
#include <rtl/bootstrap.hxx>
@@ -21,9 +23,9 @@
#include <vcl/settings.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/virdev.hxx>
+#include <personas.hrc>
using namespace com::sun::star;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
// persona
@@ -33,11 +35,13 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage(weld::Container* pPage,
: SfxTabPage(pPage, pController, "cui/ui/personalization_tab.ui", "PersonalizationTabPage",
&rSet)
, m_xNoPersona(m_xBuilder->weld_radio_button("no_persona"))
+ , m_xPersonaImg(m_xBuilder->weld_widget("lockpersona"))
, m_xDefaultPersona(m_xBuilder->weld_radio_button("default_persona"))
+ , m_xContentGrid(m_xBuilder->weld_container("gridpersonasetting"))
{
for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i)
{
- OString sDefaultId("default" + OString::number(i));
+ OUString sDefaultId("default" + OUString::number(i));
m_vDefaultPersonaImages[i] = m_xBuilder->weld_toggle_button(sDefaultId);
m_vDefaultPersonaImages[i]->connect_clicked(
LINK(this, SvxPersonalizationTabPage, DefaultPersona));
@@ -55,6 +59,23 @@ std::unique_ptr<SfxTabPage> SvxPersonalizationTabPage::Create(weld::Container* p
return std::make_unique<SvxPersonalizationTabPage>(pPage, pController, *rSet);
}
+OUString SvxPersonalizationTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString radioButton[] = { "no_persona", "default_persona" };
+
+ for (const auto& radio : radioButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_label("personas_label"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
{
// persona
@@ -63,11 +84,8 @@ bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
aPersona = "no";
bool bModified = false;
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
- if (xContext.is()
- && (aPersona != officecfg::Office::Common::Misc::Persona::get(xContext)
- || m_aPersonaSettings
- != officecfg::Office::Common::Misc::PersonaSettings::get(xContext)))
+ if (aPersona != officecfg::Office::Common::Misc::Persona::get()
+ || m_aPersonaSettings != officecfg::Office::Common::Misc::PersonaSettings::get())
{
bModified = true;
}
@@ -94,20 +112,24 @@ bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
void SvxPersonalizationTabPage::Reset(const SfxItemSet*)
{
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
-
// persona
- OUString aPersona("default");
- if (xContext.is())
- {
- aPersona = officecfg::Office::Common::Misc::Persona::get(xContext);
- m_aPersonaSettings = officecfg::Office::Common::Misc::PersonaSettings::get(xContext);
- }
+ OUString aPersona = officecfg::Office::Common::Misc::Persona::get();
+ m_aPersonaSettings = officecfg::Office::Common::Misc::PersonaSettings::get();
if (aPersona == "no")
m_xNoPersona->set_active(true);
else
m_xDefaultPersona->set_active(true);
+
+ if (officecfg::Office::Common::Misc::Persona::isReadOnly())
+ {
+ m_xNoPersona->set_sensitive(false);
+ m_xDefaultPersona->set_sensitive(false);
+ m_xPersonaImg->set_visible(true);
+ }
+
+ if (officecfg::Office::Common::Misc::PersonaSettings::isReadOnly())
+ m_xContentGrid->set_sensitive(false);
}
void SvxPersonalizationTabPage::LoadDefaultImages()
@@ -123,23 +145,24 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
sal_Int32 nIndex = 0;
bool foundOne = false;
+ OStringBuffer aLine;
+ int nLineNumberFilePersona = 0;
while (aStream.IsOpen() && !aStream.eof() && nIndex < MAX_DEFAULT_PERSONAS)
{
- OString aLine;
OUString aPersonaSetting, aPreviewFile, aName;
sal_Int32 nParseIndex = 0;
aStream.ReadLine(aLine);
aPersonaSetting = OStringToOUString(aLine, RTL_TEXTENCODING_UTF8);
- aName = aPersonaSetting.getToken(1, ';', nParseIndex);
- aPreviewFile = aPersonaSetting.getToken(0, ';', nParseIndex);
+ aName = CuiResId(RID_PERSONAS_COLOR[nLineNumberFilePersona].first);
+ aPreviewFile = aPersonaSetting.getToken(2, ';', nParseIndex);
if (aPreviewFile.isEmpty())
break;
m_vDefaultPersonaSettings.push_back(aPersonaSetting);
- INetURLObject aURLObj(gallery + aPreviewFile);
+ INetURLObject aURLObj(rtl::Concat2View(gallery + aPreviewFile));
aFilter.ImportGraphic(aGraphic, aURLObj);
Size aSize(aGraphic.GetSizePixel());
@@ -155,6 +178,7 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
m_vDefaultPersonaImages[nIndex]->set_tooltip_text(aName);
m_vDefaultPersonaImages[nIndex++]->show();
foundOne = true;
+ ++nLineNumberFilePersona;
}
m_xDefaultPersona->set_sensitive(foundOne);
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index 671f194c244b..786b22c7d7b3 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -18,7 +18,9 @@ class SvxPersonalizationTabPage : public SfxTabPage
{
private:
std::unique_ptr<weld::RadioButton> m_xNoPersona; ///< Just the default look, without any bitmap
+ std::unique_ptr<weld::Widget> m_xPersonaImg;
std::unique_ptr<weld::RadioButton> m_xDefaultPersona; ///< Use the built-in bitmap
+ std::unique_ptr<weld::Container> m_xContentGrid;
std::unique_ptr<weld::ToggleButton> m_vDefaultPersonaImages
[MAX_DEFAULT_PERSONAS]; ///< Buttons to show the default persona images
OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.
@@ -33,6 +35,8 @@ public:
static std::unique_ptr<SfxTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
+ virtual OUString GetAllStrings() override;
+
/// Apply the settings ([OK] button).
virtual bool FillItemSet(SfxItemSet* rSet) override;
diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx
index 629fb7056c1e..0ddd7f8f9f08 100644
--- a/cui/source/options/sdbcdriverenum.cxx
+++ b/cui/source/options/sdbcdriverenum.cxx
@@ -20,7 +20,7 @@
#include "sdbcdriverenum.hxx"
#include <comphelper/processfactory.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/DriverManager.hpp>
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
index 4b00176ab490..d99ad64e545e 100644
--- a/cui/source/options/securityoptions.cxx
+++ b/cui/source/options/securityoptions.cxx
@@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <securityoptions.hxx>
#include <unotools/securityoptions.hxx>
-#include "securityoptions.hxx"
namespace
{
@@ -31,6 +31,15 @@ namespace
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
@@ -54,6 +63,29 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent)
, 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()
{
enableAndSet(SvtSecurityOptions::EOption::DocWarnSaveOrSend, *m_xSaveOrSendDocsCB,
*m_xSaveOrSendDocsImg);
@@ -65,12 +97,58 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent)
*m_xCreatePdfImg);
enableAndSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, *m_xRemovePersInfoCB,
*m_xRemovePersInfoImg);
+ 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(SvtSecurityOptions::EOption::CtrlClickHyperlink, *m_xCtrlHyperlinkCB,
*m_xCtrlHyperlinkImg);
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/securityoptions.hxx b/cui/source/options/securityoptions.hxx
deleted file mode 100644
index dc05f5bb8150..000000000000
--- a/cui/source/options/securityoptions.hxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#pragma once
-
-#include <vcl/weld.hxx>
-
-namespace svx
-{
-
- class SecurityOptionsDialog : public weld::GenericDialogController
- {
- private:
- std::unique_ptr<weld::CheckButton> m_xSaveOrSendDocsCB;
- std::unique_ptr<weld::Widget> m_xSaveOrSendDocsImg;
- std::unique_ptr<weld::CheckButton> m_xSignDocsCB;
- std::unique_ptr<weld::Widget> m_xSignDocsImg;
- std::unique_ptr<weld::CheckButton> m_xPrintDocsCB;
- std::unique_ptr<weld::Widget> m_xPrintDocsImg;
- std::unique_ptr<weld::CheckButton> m_xCreatePdfCB;
- std::unique_ptr<weld::Widget> m_xCreatePdfImg;
-
- std::unique_ptr<weld::CheckButton> m_xRemovePersInfoCB;
- std::unique_ptr<weld::Widget> m_xRemovePersInfoImg;
- std::unique_ptr<weld::CheckButton> m_xRecommPasswdCB;
- std::unique_ptr<weld::Widget> m_xRecommPasswdImg;
- std::unique_ptr<weld::CheckButton> m_xCtrlHyperlinkCB;
- std::unique_ptr<weld::Widget> m_xCtrlHyperlinkImg;
- std::unique_ptr<weld::CheckButton> m_xBlockUntrustedRefererLinksCB;
- std::unique_ptr<weld::Widget> m_xBlockUntrustedRefererLinksImg;
-
- public:
- SecurityOptionsDialog(weld::Window* pParent);
-
- 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 IsRecommPasswdChecked() const { return m_xRecommPasswdCB->get_active(); }
- bool IsCtrlHyperlinkChecked() const { return m_xCtrlHyperlinkCB->get_active(); }
- bool IsBlockUntrustedRefererLinksChecked() const { return m_xBlockUntrustedRefererLinksCB->get_active(); }
- };
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index ae9f8b8e422f..6ab767bb8044 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -26,6 +26,7 @@
#include <config_gpgme.h>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Writer.hxx>
#include <svx/dialogs.hrc>
#include <svx/svxids.hrc>
@@ -62,6 +63,13 @@
#include "personalization.hxx"
#include <treeopt.hxx>
#include "optbasic.hxx"
+#include "optlanguagetool.hxx"
+#include "optdeepl.hxx"
+
+// include search util
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/util/SearchAlgorithms2.hpp>
+#include <unotools/textsearch.hxx>
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
#include <com/sun/star/awt/ContainerWindowProvider.hpp>
@@ -72,13 +80,13 @@
#include <com/sun/star/frame/UnknownModuleException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/linguistic2/LinguProperties.hpp>
-#include <com/sun/star/setup/UpdateCheck.hpp>
#include <comphelper/getexpandeduri.hxx>
#include <comphelper/processfactory.hxx>
#include <editeng/langitem.hxx>
#include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx>
#include <linguistic/misc.hxx>
+#include <o3tl/deleter.hxx>
#include <officecfg/Office/OptionsDialog.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
@@ -94,11 +102,12 @@
#include <svx/databaseregistrationui.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/moduleoptions.hxx>
#include <unotools/optionsdlg.hxx>
#include <unotools/viewoptions.hxx>
+#include <utility>
#include <vcl/help.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weldutils.hxx>
@@ -106,7 +115,6 @@
#include <sal/log.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
@@ -117,7 +125,7 @@ using namespace ::com::sun::star::util;
LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = nullptr;
// some stuff for easier changes for SvtViewOptions
-constexpr OUStringLiteral VIEWOPT_DATANAME = u"page data";
+constexpr OUString VIEWOPT_DATANAME = u"page data"_ustr;
static void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
{
@@ -226,42 +234,12 @@ static sal_uInt16 getGroupNodeId( std::u16string_view rModule )
namespace {
-class MailMergeCfg_Impl : public utl::ConfigItem
+bool MailMergeCfgIsEmailSupported()
{
-private:
- // variables
- bool bIsEmailSupported;
-
- virtual void ImplCommit() override;
-
-public:
- MailMergeCfg_Impl();
-
- virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
-
- bool IsEmailSupported() const {return bIsEmailSupported;}
-
-};
-
-}
-
-MailMergeCfg_Impl::MailMergeCfg_Impl() :
- utl::ConfigItem("Office.Writer/MailMergeWizard"),
- bIsEmailSupported(false)
-{
- Sequence<OUString> aNames { "EMailSupported" };
- const Sequence< Any > aValues = GetProperties(aNames);
- const Any* pValues = aValues.getConstArray();
- if(aValues.hasElements() && pValues[0].hasValue())
- pValues[0] >>= bIsEmailSupported;
+ std::optional<bool> b = officecfg::Office::Writer::MailMergeWizard::EMailSupported::get();
+ return b.has_value() && *b;
}
-void MailMergeCfg_Impl::ImplCommit()
-{
-}
-
-void MailMergeCfg_Impl::Notify( const css::uno::Sequence< OUString >& )
-{
}
//typedef SfxTabPage* (*FNCreateTabPage)(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet);
@@ -295,6 +273,8 @@ static std::unique_ptr<SfxTabPage> CreateGeneralTabPage(sal_uInt16 nId, weld::Co
case SID_SB_DBREGISTEROPTIONS: fnCreate = &svx::DbRegistrationOptionsPage::Create; break;
case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break;
case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
+ case RID_SVXPAGE_LANGTOOL_OPTIONS: fnCreate = &OptLanguageToolTabPage::Create ; break;
+ case RID_SVXPAGE_DEEPL_OPTIONS: fnCreate = &OptDeeplTabPage::Create ; break;
case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break;
#if HAVE_FEATURE_OPENCL
case RID_SVXPAGE_OPENCL: fnCreate = &SvxOpenCLTabPage::Create ; break;
@@ -462,22 +442,42 @@ struct OptionsGroupInfo
m_pModule( pMod ), m_nDialogId( nId ) {}
};
-#define INI_LIST() \
- , m_pParent ( pParent )\
- , sTitle ( m_xDialog->get_title() )\
- , bForgetSelection ( false )\
- , bIsFromExtensionManager( false ) \
- , bIsForSetDocumentLanguage( false ) \
- , bNeedsRestart ( false ) \
- , eRestartReason( svtools::RESTART_REASON_NONE )
-
-void OfaTreeOptionsDialog::InitWidgets()
-{
- xOkPB = m_xBuilder->weld_button("ok");
- xApplyPB = m_xBuilder->weld_button("apply");
- xBackPB = m_xBuilder->weld_button("revert");
- xTreeLB = m_xBuilder->weld_tree_view("pages");
- xTabBox = m_xBuilder->weld_container("box");
+struct OptionsPageIdInfo
+{
+ OUString m_sParentName;
+ OUString m_sPageName;
+ sal_uInt16 m_nParentId;
+ sal_uInt16 m_nPageId;
+
+ OptionsPageIdInfo(OUString sParentName, OUString sPageName, sal_uInt16 nParentId,
+ sal_uInt16 nPageId)
+ : m_sParentName(std::move(sParentName))
+ , m_sPageName(std::move(sPageName))
+ , m_nParentId(nParentId)
+ , m_nPageId(nPageId)
+ {
+ }
+};
+
+// Basic ctor with common initialization
+OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, bool fromExtensionManager)
+ : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
+ , xOkPB(m_xBuilder->weld_button("ok"))
+ , xApplyPB(m_xBuilder->weld_button("apply"))
+ , xBackPB(m_xBuilder->weld_button("revert"))
+ , xTreeLB(m_xBuilder->weld_tree_view("pages"))
+ , xTabBox(m_xBuilder->weld_container("box"))
+ , m_xSearchEdit(m_xBuilder->weld_entry("searchEntry"))
+ , m_pParent(pParent)
+ , m_aUpdateDataTimer("OfaTreeOptionsDialog UpdateDataTimer")
+ , bIsFirtsInitialize(true)
+ , sTitle(m_xDialog->get_title())
+ , bForgetSelection(false)
+ , bIsFromExtensionManager(fromExtensionManager)
+ , bIsForSetDocumentLanguage(false)
+ , bNeedsRestart(false)
+ , eRestartReason(svtools::RESTART_REASON_NONE)
+{
Size aSize(xTreeLB->get_approximate_digit_width() * 82, xTreeLB->get_height_rows(30));
#if HAVE_FEATURE_GPGME
// tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
@@ -485,38 +485,48 @@ void OfaTreeOptionsDialog::InitWidgets()
#endif
xTabBox->set_size_request(aSize.Width(), aSize.Height());
xTreeLB->set_size_request(xTreeLB->get_approximate_digit_width() * 35, aSize.Height());
+
+ // Init tree and handler
+ xTreeLB->set_help_id(HID_OFADLG_TREELISTBOX);
+ xTreeLB->connect_changed(LINK(this, OfaTreeOptionsDialog, ShowPageHdl_Impl));
+ xBackPB->connect_clicked(LINK(this, OfaTreeOptionsDialog, BackHdl_Impl));
+ xApplyPB->connect_clicked(LINK(this, OfaTreeOptionsDialog, ApplyHdl_Impl));
+ xOkPB->connect_clicked(LINK(this, OfaTreeOptionsDialog, ApplyHdl_Impl));
+ m_xSearchEdit->connect_changed(LINK(this, OfaTreeOptionsDialog, SearchUpdateHdl));
+ m_xSearchEdit->connect_focus_out(LINK(this, OfaTreeOptionsDialog, FocusOut_Impl));
+ m_xDialog->connect_help(LINK(this, OfaTreeOptionsDialog, HelpHdl_Impl));
+
+ m_aUpdateDataTimer.SetInvokeHandler(LINK(this, OfaTreeOptionsDialog, ImplUpdateDataHdl));
+ m_aUpdateDataTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
+
+ // Initialize search util
+ m_options.AlgorithmType2 = util::SearchAlgorithms2::ABSOLUTE;
+ m_options.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
+ m_options.searchFlag
+ |= (util::SearchFlags::REG_NOT_BEGINOFLINE | util::SearchFlags::REG_NOT_ENDOFLINE);
+
+ xTreeLB->set_accessible_name(sTitle);
}
// Ctor() with Frame -----------------------------------------------------
OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, const Reference< XFrame >& _xFrame, bool bActivateLastSelection)
- : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
- INI_LIST()
+ : OfaTreeOptionsDialog(pParent, false)
{
- InitWidgets();
-
- InitTreeAndHandler();
Initialize( _xFrame );
LoadExtensionOptions( u"" );
if (bActivateLastSelection)
ActivateLastSelection();
-
- xTreeLB->set_accessible_name(m_xDialog->get_title());
}
// Ctor() with ExtensionId -----------------------------------------------
OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, std::u16string_view rExtensionId)
- : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
- INI_LIST()
+ : OfaTreeOptionsDialog(pParent, !rExtensionId.empty())
{
- InitWidgets();
-
- bIsFromExtensionManager = ( !rExtensionId.empty() );
- InitTreeAndHandler();
LoadExtensionOptions( rExtensionId );
ActivateLastSelection();
}
-OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+void OfaTreeOptionsDialog::ImplDestroy()
{
xCurrentPageEntry.reset();
@@ -528,7 +538,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
// if Child (has parent), then OptionsPageInfo
if (xTreeLB->get_iter_depth(*xEntry))
{
- OptionsPageInfo *pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
if(pPageInfo->m_xPage)
{
pPageInfo->m_xPage->FillUserData();
@@ -564,7 +574,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
{
if (!xTreeLB->get_iter_depth(*xEntry))
{
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
delete pGroupInfo;
}
bEntry = xTreeLB->iter_next(*xEntry);
@@ -572,6 +582,11 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
deleteGroupNames();
}
+OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+{
+ suppress_fun_call_w_exception(ImplDestroy());
+}
+
OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup )
{
@@ -581,7 +596,7 @@ OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
xTreeLB->iter_nth_sibling(*xParent, nGroup);
OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pPageInfo)));
+ OUString sId(weld::toId(pPageInfo));
xTreeLB->insert(xParent.get(), -1, &rPageName, &sId, nullptr, nullptr, false, nullptr);
return pPageInfo;
}
@@ -594,7 +609,7 @@ sal_uInt16 OfaTreeOptionsDialog::AddGroup(const OUString& rGroupName,
{
OptionsGroupInfo* pInfo =
new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pInfo)));
+ OUString sId(weld::toId(pInfo));
xTreeLB->append(sId, rGroupName);
sal_uInt16 nRet = 0;
@@ -619,13 +634,13 @@ 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());
+ weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
}
else if ( pPageInfo->m_xExtPage )
@@ -645,13 +660,13 @@ void OfaTreeOptionsDialog::ApplyOptions()
{
if (xTreeLB->get_iter_depth(*xEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
if ( pPageInfo->m_xPage && !pPageInfo->m_xPage->HasExchangeSupport() )
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xEntry.get());
xTreeLB->iter_parent(*xParent);
OptionsGroupInfo* pGroupInfo =
- reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
pPageInfo->m_xPage->FillItemSet(pGroupInfo->m_pOutItemSet.get());
}
@@ -675,11 +690,11 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, HelpHdl_Impl, weld::Widget&, bool)
Help* pHelp = Application::GetHelp();
if (pHelp && xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if (pPageInfo->m_xPage)
{
- OString sHelpId(pPageInfo->m_xPage->GetHelpId());
- pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), m_xDialog.get());
+ OUString sHelpId(pPageInfo->m_xPage->GetHelpId());
+ pHelp->Start(sHelpId, m_xDialog.get());
return false;
}
}
@@ -694,13 +709,13 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
if (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if ( pPageInfo->m_xPage )
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
xTreeLB->iter_parent(*xParent);
- pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
&& pPageInfo->m_xPage->HasExchangeSupport() )
{
@@ -764,6 +779,306 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
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;
+ }
+ }
+}
+
void OfaTreeOptionsDialog::ApplyItemSets()
{
std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
@@ -772,7 +1087,7 @@ void OfaTreeOptionsDialog::ApplyItemSets()
{
if (!xTreeLB->get_iter_depth(*xEntry))
{
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
if(pGroupInfo->m_pOutItemSet)
{
if(pGroupInfo->m_pShell)
@@ -785,16 +1100,6 @@ void OfaTreeOptionsDialog::ApplyItemSets()
}
}
-void OfaTreeOptionsDialog::InitTreeAndHandler()
-{
- xTreeLB->set_help_id(HID_OFADLG_TREELISTBOX);
- xTreeLB->connect_changed( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) );
- xBackPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) );
- xApplyPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, ApplyHdl_Impl ) );
- xOkPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, ApplyHdl_Impl ) );
- m_xDialog->connect_help( LINK( this, OfaTreeOptionsDialog, HelpHdl_Impl ) );
-}
-
void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
{
bIsForSetDocumentLanguage = false;
@@ -848,7 +1153,7 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
// restore only selection of a leaf
if (xTreeLB->get_iter_depth(*xTemp) && xTreeLB->get_id(*xTemp).toInt64())
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xTemp).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xTemp));
OUString sPageURL = pPageInfo->m_sPageURL;
if ( bMustExpand )
{
@@ -885,7 +1190,16 @@ 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();
}
@@ -901,6 +1215,70 @@ void OfaTreeOptionsDialog::InitItemSets(OptionsGroupInfo& rGroupInfo)
rGroupInfo.m_pInItemSet->GetRanges());
}
+void OfaTreeOptionsDialog::initializeCurrentDialog(OptionsPageInfo*& pPageInfo,
+ std::unique_ptr<weld::TreeIter>& xEntry)
+{
+ std::unique_ptr<weld::TreeIter> xParent(xTreeLB->make_iterator(xEntry.get()));
+ bool bParent = xTreeLB->iter_parent(*xParent);
+
+ if (!bParent)
+ return;
+
+ if (pPageInfo->m_xPage)
+ {
+ TreeOptHelper::storeStringsOfDialog(pPageInfo->m_nPageId,
+ pPageInfo->m_xPage->GetAllStrings());
+ return;
+ }
+
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
+
+ if (!pPageInfo->m_xPage && pPageInfo->m_nPageId > 0)
+ {
+ InitItemSets(*pGroupInfo);
+
+ pPageInfo->m_xPage = ::CreateGeneralTabPage(pPageInfo->m_nPageId, xTabBox.get(), this,
+ *pGroupInfo->m_pInItemSet);
+
+ if (!pPageInfo->m_xPage && pGroupInfo->m_pModule)
+ pPageInfo->m_xPage = pGroupInfo->m_pModule->CreateTabPage(
+ pPageInfo->m_nPageId, xTabBox.get(), this, *pGroupInfo->m_pInItemSet);
+
+ DBG_ASSERT(pPageInfo->m_xPage, "tabpage could not created");
+ if (pPageInfo->m_xPage)
+ {
+ SvtViewOptions aTabPageOpt(EViewType::TabPage, OUString::number(pPageInfo->m_nPageId));
+ pPageInfo->m_xPage->SetUserData(GetViewOptUserItem(aTabPageOpt));
+ pPageInfo->m_xPage->SetFrame(m_xFrame);
+ pPageInfo->m_xPage->Reset(&*pGroupInfo->m_pInItemSet);
+ }
+
+ TreeOptHelper::storeStringsOfDialog(pPageInfo->m_nPageId,
+ pPageInfo->m_xPage->GetAllStrings());
+
+ pPageInfo->m_xPage->set_visible(false);
+ }
+ else if (0 == pPageInfo->m_nPageId && !pPageInfo->m_xExtPage)
+ {
+ if (!m_xContainerWinProvider.is())
+ m_xContainerWinProvider
+ = awt::ContainerWindowProvider::create(::comphelper::getProcessComponentContext());
+
+ pPageInfo->m_xExtPage = std::make_unique<ExtensionsTabPage>(
+ xTabBox.get(), pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider);
+
+ pPageInfo->m_xExtPage->Hide();
+ }
+
+ BuilderPage* pNewPage = pPageInfo->m_xPage.get();
+
+ // fdo#58170 use current page's layout child HelpId, unless there isn't a current page
+ OUString sHelpId(pNewPage ? pNewPage->GetHelpId() : OUString());
+ if (sHelpId.isEmpty())
+ sHelpId = HID_OFADLG_TREELISTBOX;
+ xTreeLB->set_help_id(sHelpId);
+}
+
void OfaTreeOptionsDialog::SelectHdl_Impl()
{
std::unique_ptr<weld::TreeIter> xEntry(xTreeLB->make_iterator());
@@ -921,14 +1299,14 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
BuilderPage* pNewPage = nullptr;
OptionsPageInfo* pOptPageInfo = (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
- ? reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64()) : nullptr;
+ ? weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry)) : nullptr;
if (pOptPageInfo && pOptPageInfo->m_xPage && pOptPageInfo->m_xPage->IsVisible())
{
std::unique_ptr<weld::TreeIter> xCurParent(xTreeLB->make_iterator(xCurrentPageEntry.get()));
xTreeLB->iter_parent(*xCurParent);
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent));
DeactivateRC nLeave = DeactivateRC::LeavePage;
if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_xPage->HasExchangeSupport() )
nLeave = pOptPageInfo->m_xPage->DeactivatePage( pGroupInfo->m_pOutItemSet.get() );
@@ -949,8 +1327,8 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
pOptPageInfo->m_xExtPage->DeactivatePage();
}
- OptionsPageInfo *pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
if(!pPageInfo->m_xPage && pPageInfo->m_nPageId > 0)
{
InitItemSets(*pGroupInfo);
@@ -965,6 +1343,7 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
{
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 );
}
}
@@ -1020,7 +1399,7 @@ 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);
@@ -1044,18 +1423,19 @@ std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
SID_ATTR_YEAR2000, SID_ATTR_YEAR2000> );
SfxItemSetFixed<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER> aOptSet( SfxGetpApp()->GetPool() );
- SfxGetpApp()->GetOptions(aOptSet);
+ SfxApplication::GetOptions(aOptSet);
pRet->Put(aOptSet);
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
if ( pViewFrame )
{
- const SfxPoolItem* pItem = nullptr;
- SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ SfxPoolItemHolder aResult;
+ const SfxItemState aState(pViewFrame->GetDispatcher()->QueryState(SID_ATTR_YEAR2000, aResult));
+ const SfxUInt16Item* pItem(static_cast<const SfxUInt16Item*>(aResult.getItem()));
// miscellaneous - Year2000
- if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
- pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<const SfxUInt16Item*>(pItem)->GetValue() ) );
+ if(SfxItemState::DEFAULT <= aState && nullptr != pItem)
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, pItem->GetValue() ) );
else
pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
}
@@ -1100,31 +1480,28 @@ std::optional<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
{
@@ -1145,9 +1522,9 @@ std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
svl::Items<
//SID_OPTIONS_START - ..END
SID_SAVEREL_INET, SID_SAVEREL_FSYS,
- SID_INET_NOPROXY, SID_INET_FTP_PROXY_PORT,
+ SID_INET_NOPROXY, SID_INET_HTTP_PROXY_PORT,
SID_SECURE_URL, SID_SECURE_URL> );
- SfxGetpApp()->GetOptions(*pRet);
+ SfxApplication::GetOptions(*pRet);
break;
case SID_FILTER_DLG:
pRet.emplace(
@@ -1157,7 +1534,7 @@ std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE,
SID_SAVEREL_INET, SID_SAVEREL_FSYS,
SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING> );
- SfxGetpApp()->GetOptions(*pRet);
+ SfxApplication::GetOptions(*pRet);
break;
case SID_SB_STARBASEOPTIONS:
@@ -1169,9 +1546,8 @@ std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
case SID_SCH_EDITOPTIONS:
{
- SvxChartOptions aChartOpt;
pRet.emplace( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS> );
- pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
+ pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, SvxChartOptions::GetDefaultColors() ) );
break;
}
}
@@ -1186,36 +1562,35 @@ void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- const SfxPoolItem* pItem = nullptr;
SfxItemSetFixed<SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER> aOptSet(SfxGetpApp()->GetPool());
aOptSet.Put(rSet);
if(aOptSet.Count())
- SfxGetpApp()->SetOptions( aOptSet );
+ SfxApplication::SetOptions( aOptSet );
// get dispatcher anew, because SetOptions() might have destroyed the dispatcher
SfxViewFrame *pViewFrame = SfxViewFrame::Current();
// evaluate Year2000
sal_uInt16 nY2K = USHRT_MAX;
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_YEAR2000, false, &pItem ) )
- nY2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ const SfxUInt16Item* pYearItem = rSet.GetItemIfSet( SID_ATTR_YEAR2000, false );
+ if( pYearItem )
+ nY2K = pYearItem->GetValue();
if( USHRT_MAX != nY2K )
{
if ( pViewFrame )
{
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
pDispatch->ExecuteList(SID_ATTR_YEAR2000,
- SfxCallMode::ASYNCHRON, { pItem });
+ SfxCallMode::ASYNCHRON, { pYearItem });
}
officecfg::Office::Common::DateFormat::TwoDigitYear::set(nY2K, batch);
}
// evaluate print
- if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, false, &pItem))
- officecfg::Office::Common::Print::Warning::NotFound::set(static_cast<const SfxBoolItem*>(pItem)->GetValue(), batch);
+ if(const SfxBoolItem* pWarnItem = rSet.GetItemIfSet(SID_PRINTER_NOTFOUND_WARN, false))
+ officecfg::Office::Common::Print::Warning::NotFound::set(pWarnItem->GetValue(), batch);
- if(SfxItemState::SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, false, &pItem))
+ if(const SfxFlagItem* pFlag = rSet.GetItemIfSet(SID_PRINTER_CHANGESTODOC, false))
{
- const SfxFlagItem* pFlag = static_cast<const SfxFlagItem*>(pItem);
bool bPaperSizeWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_SIZE);
officecfg::Office::Common::Print::Warning::PaperSize::set(bPaperSizeWarning, batch);
bool bPaperOrientationWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION);
@@ -1240,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:
@@ -1254,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;
}
@@ -1267,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;
@@ -1326,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 );
@@ -1356,19 +1729,17 @@ static OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
return sIdentifier;
}
-void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
+void OfaTreeOptionsDialog::generalOptions(const std::vector<sal_uInt16>& vPageId)
{
sal_uInt16 nGroup = 0;
-
SvtOptionsDialogOptions aOptionsDlgOpt;
- sal_uInt16 nPageId;
+ sal_uInt16 nPageId = 0;
- // %PRODUCTNAME options
if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) )
{
setGroupName(u"ProductName", CuiResId(SID_GENERAL_OPTIONS_RES[0].first));
nGroup = AddGroup(CuiResId(SID_GENERAL_OPTIONS_RES[0].first), nullptr, nullptr, SID_GENERAL_OPTIONS );
- const sal_uInt16 nEnd = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_GENERAL_OPTIONS_RES));
+ const sal_uInt16 nEnd = static_cast<sal_uInt16>(std::size(SID_GENERAL_OPTIONS_RES));
for (sal_uInt16 i = 1; i < nEnd; ++i)
{
@@ -1377,67 +1748,101 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- // Disable Online Update page if service not installed
- if( RID_SVXPAGE_ONLINEUPDATE == nPageId )
+ // Disable Online Update page if neither mode is available
+ if( RID_SVXPAGE_ONLINEUPDATE == nPageId
+ && !(SvxOnlineUpdateTabPage::isTraditionalOnlineUpdateAvailable()
+ || SvxOnlineUpdateTabPage::isMarOnlineUpdateAvailable()) )
{
- try
- {
- Reference < XInterface > xService( setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
- if( ! xService.is() )
- continue;
- }
- catch ( css::uno::DeploymentException& )
- {
- continue;
- }
+ continue;
}
- // Disable Basic IDE options, if experimental features are not enabled
- if( RID_SVXPAGE_BASICIDE_OPTIONS == nPageId )
+ if (!vPageId.empty())
{
- if( ! officecfg::Office::Common::Misc::ExperimentalMode::get() )
- continue;
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, sNewTitle, nGroup);
}
-
- AddTabPage( nPageId, sNewTitle, nGroup );
+ else
+ AddTabPage(nPageId, sNewTitle, nGroup);
}
}
+}
+
+void OfaTreeOptionsDialog::loadAndSaveOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Load and Save options
if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) )
{
setGroupName( u"LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_FILTER_DLG_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_FILTER_DLG_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_FILTER_DLG_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::languageOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Language options
SvtCTLOptions aCTLLanguageOptions;
if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) )
{
setGroupName(u"LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first));
nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS );
- for (size_t i = 1; i < SAL_N_ELEMENTS(SID_LANGUAGE_OPTIONS_RES); ++i)
+ for (size_t i = 1; i < std::size(SID_LANGUAGE_OPTIONS_RES); ++i)
{
nPageId = static_cast<sal_uInt16>(SID_LANGUAGE_OPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
+
+ // 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 || aCTLLanguageOptions.IsCTLFontEnabled() ) )
- AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
+ ( RID_SVXPAGE_OPTIONS_CTL != nPageId || SvtCTLOptions::IsCTLFontEnabled() ) )
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::writerOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- OUString aFactory = getCurrentFactory_Impl( _xFrame );
- DBG_ASSERT( GetModuleIdentifier( _xFrame ) == aFactory, "S H I T!!!" );
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
- // Writer and Writer/Web options
SvtModuleOptions aModuleOpt;
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
{
@@ -1454,38 +1859,105 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
else
setGroupName( u"Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SW_EDITOPTIONS_RES); ++i )
+ SvtCTLOptions aCTLLanguageOptions;
+ for ( size_t i = 1; i < std::size(SID_SW_EDITOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SW_EDITOPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || SvtCJKOptions::IsCJKFontEnabled() ) &&
- ( RID_SW_TP_STD_FONT_CTL != nPageId || aCTLLanguageOptions.IsCTLFontEnabled() ) &&
- ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) )
- AddTabPage( nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first), nGroup );
+ ( 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 ) )
{
@@ -1496,18 +1968,35 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
SfxModule* pScMod = SfxApplication::GetModule( SfxToolsModule::Calc );
setGroupName( u"Calc", CuiResId(SID_SC_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SC_EDITOPTIONS_RES[0].first), pScMod, pScMod, SID_SC_EDITOPTIONS );
- const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SC_EDITOPTIONS_RES));
+ const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SC_EDITOPTIONS_RES));
for ( sal_uInt16 i = 1; i < nCount; ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SC_EDITOPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- AddTabPage( nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup);
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::impressOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+ SvtModuleOptions aModuleOpt;
// Impress options
SfxModule* pSdMod = SfxApplication::GetModule( SfxToolsModule::Draw );
@@ -1519,20 +2008,38 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
setGroupName( u"Impress", CuiResId(SID_SD_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SD_EDITOPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_EDITOPTIONS );
- const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SD_EDITOPTIONS_RES));
+ const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SD_EDITOPTIONS_RES));
for ( sal_uInt16 i = 1; i < nCount; ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SD_EDITOPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- AddTabPage( nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup);
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::drawOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+ SvtModuleOptions aModuleOpt;
// Draw options
+ SfxModule* pSdMod = SfxApplication::GetModule(SfxToolsModule::Draw);
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) )
{
if ( aFactory == "com.sun.star.drawing.DrawingDocument" )
@@ -1541,18 +2048,36 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
setGroupName( u"Draw", CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS );
- const sal_uInt16 nCount = static_cast<sal_uInt16>(SAL_N_ELEMENTS(SID_SD_GRAPHIC_OPTIONS_RES));
+ const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SD_GRAPHIC_OPTIONS_RES));
for ( sal_uInt16 i = 1; i < nCount; ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SD_GRAPHIC_OPTIONS_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
continue;
- AddTabPage( nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first), nGroup );
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first),
+ nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first), nGroup);
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::mathOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ OUString aFactory = getCurrentFactory_Impl( m_xFrame );
+ DBG_ASSERT( GetModuleIdentifier( m_xFrame ) == aFactory, "This should not happen" );
+ SvtModuleOptions aModuleOpt;
// Math options
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
@@ -1564,15 +2089,33 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math);
setGroupName( u"Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SM_EDITOPTIONS_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_SM_EDITOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SM_EDITOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first),
+ nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup);
+ }
}
}
}
}
+}
+
+void OfaTreeOptionsDialog::databaseOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
+
+ SvtModuleOptions aModuleOpt;
// Database - needed only if there is an application which integrates with databases
if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) &&
@@ -1583,35 +2126,63 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
{
setGroupName( u"Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SB_STARBASEOPTIONS_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_SB_STARBASEOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SB_STARBASEOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::chartOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Chart options (always installed and active)
if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) )
{
setGroupName( u"Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) );
nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SCH_EDITOPTIONS_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_SCH_EDITOPTIONS_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_SCH_EDITOPTIONS_RES[i].second);
if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
- AddTabPage( nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup );
+ {
+ if (!vPageId.empty())
+ {
+ if (std::find(vPageId.begin(), vPageId.end(), nPageId) != vPageId.end())
+ AddTabPage(nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup);
+ }
+ else
+ AddTabPage(nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup);
+ }
}
}
+}
+
+void OfaTreeOptionsDialog::internetOptions(const std::vector<sal_uInt16>& vPageId)
+{
+ sal_uInt16 nGroup = 0;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 nPageId = 0;
- // Internet options
if ( lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) )
return;
setGroupName(u"Internet", CuiResId(SID_INET_DLG_RES[0].first));
nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG );
- for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_INET_DLG_RES); ++i )
+ for ( size_t i = 1; i < std::size(SID_INET_DLG_RES); ++i )
{
nPageId = static_cast<sal_uInt16>(SID_INET_DLG_RES[i].second);
if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
@@ -1621,10 +2192,59 @@ 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 )
@@ -1959,8 +2579,7 @@ short OfaTreeOptionsDialog::run()
if ( !bIsFromExtensionManager )
{
// collect all DictionaryList Events while the dialog is executed
- Reference<css::linguistic2::XSearchableDictionaryList> xDictionaryList(LinguMgr::GetDictionaryList());
- pClamp.reset( new SvxDicListChgClamp( xDictionaryList ) );
+ pClamp.reset(new SvxDicListChgClamp(LinguMgr::GetDictionaryList()));
}
return SfxOkDialogController::run();
@@ -1968,11 +2587,11 @@ short OfaTreeOptionsDialog::run()
// class ExtensionsTabPage -----------------------------------------------
ExtensionsTabPage::ExtensionsTabPage(
- weld::Container* pParent, const OUString& rPageURL,
- const OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider )
+ weld::Container* pParent, OUString aPageURL,
+ OUString aEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider )
: m_pContainer(pParent)
- , m_sPageURL(rPageURL)
- , m_sEventHdl(rEvtHdl)
+ , m_sPageURL(std::move(aPageURL))
+ , m_sEventHdl(std::move(aEvtHdl))
, m_xWinProvider(rProvider)
{
}
diff --git a/cui/source/options/treeopthelper.cxx b/cui/source/options/treeopthelper.cxx
new file mode 100644
index 000000000000..e486dbb5ea30
--- /dev/null
+++ b/cui/source/options/treeopthelper.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <fstream>
+#include <treeopt.hxx>
+
+#include <treeopt.hrc>
+#include <helpids.h>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+
+namespace
+{
+struct PageIdToFileNameMap_Impl
+{
+ sal_uInt16 m_nPageId;
+ OUString m_sContent;
+};
+}
+
+static PageIdToFileNameMap_Impl FileMap_Impl[] = {
+
+ // { PAGE-ID, CONTENT },
+
+ // ProductName, SID_GENERAL_OPTIONS
+ { RID_SFXPAGE_GENERAL, "" }, // UserData
+
+ { OFA_TP_MISC, "" }, // General
+
+ { OFA_TP_VIEW, "" }, // View
+
+ { RID_SFXPAGE_PRINTOPTIONS, "" }, // Print
+
+ { RID_SFXPAGE_PATH, "" }, // Paths
+
+ { RID_SVX_FONT_SUBSTITUTION, "" }, // Fonts
+
+ { RID_SVXPAGE_INET_SECURITY, "" }, // Security
+
+ { RID_SVXPAGE_PERSONALIZATION, "" }, // Personalization
+ { RID_SVXPAGE_COLORCONFIG, "" }, // ApplicationColors
+ { RID_SVXPAGE_ACCESSIBILITYCONFIG, "" }, // Accessibility
+ { RID_SVXPAGE_OPTIONS_JAVA, "" }, // Java
+ { RID_SVXPAGE_BASICIDE_OPTIONS, "" }, // BasicIDEOptions
+ { RID_SVXPAGE_ONLINEUPDATE, "" }, // OnlineUpdate
+ { RID_SVXPAGE_OPENCL, "" }, // OpenCL
+
+ // LanguageSettings, SID_LANGUAGE_OPTIONS
+ { OFA_TP_LANGUAGES, "" }, // Languages
+ { RID_SFXPAGE_LINGU, "" }, // WritingAids
+ { RID_SVXPAGE_JSEARCH_OPTIONS, "" }, // SearchingInJapanese
+ { RID_SVXPAGE_ASIAN_LAYOUT, "" }, // AsianLayout
+ { RID_SVXPAGE_OPTIONS_CTL, "" }, // ComplexTextLayout
+ { RID_SVXPAGE_LANGTOOL_OPTIONS, "" }, // LanguageTool Server
+ { RID_SVXPAGE_DEEPL_OPTIONS, "" }, // DeepL Server
+
+ // Internet, SID_INET_DLG
+ { RID_SVXPAGE_INET_PROXY, "" }, // Proxy
+ { RID_SVXPAGE_INET_MAIL, "" }, // Email
+
+ // Load/Save, SID_FILTER_DLG
+ { RID_SFXPAGE_SAVE, "" }, // General
+ { SID_OPTFILTER_MSOFFICE, "" }, // VBA Properties
+ { RID_OFAPAGE_MSFILTEROPT2, "" }, // Microsoft Office
+ { RID_OFAPAGE_HTMLOPT, "" }, // HTML Compatibility
+
+ // Writer, SID_SW_EDITOPTIONS
+ { RID_SW_TP_OPTLOAD_PAGE, "" }, // General
+ { RID_SW_TP_CONTENT_OPT, "" }, // View
+ { RID_SW_TP_OPTSHDWCRSR, "" }, // FormattingAids
+ { RID_SVXPAGE_GRID, "" }, // Grid
+ { RID_SW_TP_STD_FONT, "" }, // BasicFontsWestern
+ { RID_SW_TP_STD_FONT_CJK, "" }, // BasicFontsAsian
+ { RID_SW_TP_STD_FONT_CTL, "" }, // BasicFontsCTL
+ { RID_SW_TP_OPTPRINT_PAGE, "" }, // Print
+ { RID_SW_TP_OPTTABLE_PAGE, "" }, // Table
+ { RID_SW_TP_REDLINE_OPT, "" }, // Changes
+ { RID_SW_TP_COMPARISON_OPT, "" }, // Comparison
+ { RID_SW_TP_OPTCOMPATIBILITY_PAGE, "" }, // Compatibility
+ { RID_SW_TP_OPTCAPTION_PAGE, "" }, // AutoCaption
+ { RID_SW_TP_MAILCONFIG, "" }, // MailMerge
+ { RID_SW_TP_OPTTEST_PAGE, "" }, // Internal Test (only in dev build)
+
+ // WriterWeb, SID_SW_ONLINEOPTIONS
+ { RID_SW_TP_HTML_CONTENT_OPT, "" }, // View
+ { RID_SW_TP_HTML_OPTSHDWCRSR, "" }, // FormattingAids
+ { RID_SW_TP_HTML_OPTGRID_PAGE, "" }, // Grid
+ { RID_SW_TP_HTML_OPTPRINT_PAGE, "" }, // Print
+ { RID_SW_TP_HTML_OPTTABLE_PAGE, "" }, // Table
+ { RID_SW_TP_BACKGROUND, "" }, // Background
+ { RID_SW_TP_OPTTEST_PAGE, "" }, // Internal Test (only in dev build)
+
+ // Math, SID_SM_EDITOPTIONS
+ { SID_SM_TP_PRINTOPTIONS, "" }, // Settings
+
+ // Calc, SID_SC_EDITOPTIONS
+ { SID_SC_TP_LAYOUT, "" }, // General
+ { RID_SC_TP_DEFAULTS, "" }, // Defaults
+ { SID_SC_TP_CONTENT, "" }, // View
+ { SID_SC_TP_CALC, "" }, // Calculate
+ { SID_SC_TP_FORMULA, "" }, // Formula
+ { SID_SC_TP_USERLISTS, "" }, // SortLists
+ { SID_SC_TP_CHANGES, "" }, // Changes
+ { SID_SC_TP_COMPATIBILITY, "" }, // Compatibility
+ { SID_SC_TP_GRID, "" }, // Grid
+ { RID_SC_TP_PRINT, "" }, // Print
+
+ // Impress, SID_SD_EDITOPTIONS
+ { SID_SI_TP_MISC, "" }, // General
+ { SID_SI_TP_CONTENTS, "" }, // View
+ { SID_SI_TP_SNAP, "" }, // Grid
+ { SID_SI_TP_PRINT, "" }, // Print
+
+ // Draw, SID_SD_GRAPHIC_OPTIONS
+ { SID_SD_TP_MISC, "" }, // General
+ { SID_SD_TP_CONTENTS, "" }, // View
+ { SID_SD_TP_SNAP, "" }, // Grid
+ { SID_SD_TP_PRINT, "" }, // Print
+
+ // Charts, SID_SCH_EDITOPTIONS
+ { RID_OPTPAGE_CHART_DEFCOLORS, "" }, // DefaultColor
+
+ // Base, SID_SB_STARBASEOPTIONS
+ { SID_SB_CONNECTIONPOOLING, "" }, // Connections
+ { SID_SB_DBREGISTEROPTIONS, "" } // Databases
+};
+
+void TreeOptHelper::storeStringsOfDialog(sal_uInt16 nPageId, const OUString& sPageStrings)
+{
+ for (PageIdToFileNameMap_Impl& rEntry : FileMap_Impl)
+ {
+ if (rEntry.m_nPageId == nPageId)
+ {
+ rEntry.m_sContent = sPageStrings.replaceAll("~", "");
+ break;
+ }
+ }
+}
+
+/*
+return the strings of:
+- labels,
+- check buttons,
+- radio buttons,
+- toggle buttons,
+- link buttons,
+- buttons
+
+TODO:
+- accessible-names
+- accessible-descriptions
+- tooltip-texts
+*/
+OUString TreeOptHelper::getStringsFromDialog(sal_uInt16 nPageId)
+{
+ if (nPageId == 0)
+ return OUString();
+
+ for (PageIdToFileNameMap_Impl& rEntry : FileMap_Impl)
+ {
+ if (rEntry.m_nPageId == nPageId)
+ return rEntry.m_sContent;
+ }
+
+ return OUString();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 5c01e1c5b425..d0d9ef1c1c6c 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -10,7 +10,7 @@
#include <officecfg/Office/Common.hxx>
#include <svx/svxdlg.hxx>
#include <comphelper/sequence.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "tsaurls.hxx"
@@ -88,17 +88,15 @@ void TSAURLsDialog::AddTSAURL(const OUString& rURL)
IMPL_LINK_NOARG(TSAURLsDialog, AddHdl_Impl, weld::Button&, void)
{
- OUString aURL;
OUString aDesc(m_xEnterAUrl->get_label());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSvxNameDialog> pDlg(
- pFact->CreateSvxNameDialog(m_xDialog.get(), aURL, aDesc));
+ pFact->CreateSvxNameDialog(m_xDialog.get(), OUString(), aDesc));
if (pDlg->Execute() == RET_OK)
{
- pDlg->GetName(aURL);
- AddTSAURL(aURL);
+ AddTSAURL(pDlg->GetName());
m_xOKBtn->set_sensitive(true);
}
m_xURLListBox->unselect_all();
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index d9acbd18f537..4ab84e4320ed 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -190,8 +190,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl, weld::Button&, void)
if ( pPasswordRequest->isPassword() )
{
- OUString aNewPass = pPasswordRequest->getPassword();
- uno::Sequence<OUString> aPasswd { aNewPass };
+ uno::Sequence<OUString> aPasswd { pPasswordRequest->getPassword() };
uno::Reference< task::XPasswordContainer2 > xPasswdContainer(
task::PasswordContainer::create(comphelper::getProcessComponentContext()));