summaryrefslogtreecommitdiff
path: root/cui/source/options/personalization.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/options/personalization.cxx')
-rw-r--r--cui/source/options/personalization.cxx62
1 files changed, 43 insertions, 19 deletions
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);