[Libreoffice-commits] core.git: cui/source solenv/clang-format
Muhammet Kara (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 23 16:22:18 UTC 2019
cui/source/options/personalization.cxx | 111 ++++++++++++++-------------------
cui/source/options/personalization.hxx | 24 +++----
solenv/clang-format/blacklist | 2
3 files changed, 61 insertions(+), 76 deletions(-)
New commits:
commit 4c1479d63972aaea0b1bfee1ffb56b530ca05655
Author: Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Thu May 23 00:41:44 2019 +0300
Commit: Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Thu May 23 18:21:06 2019 +0200
clang-format SvxPersonalizationTabPage
Now is the time to get it out of the blacklist
since it is a tiny class again.
And also remove some leftovers.
Change-Id: Ia38dd3054ddefa43a7e0d917d358e7d9d1b750e4
Reviewed-on: https://gerrit.libreoffice.org/72837
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 0ab9a28fecc8..e9d9380065d1 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -43,100 +43,90 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
-struct PersonaInfo
-{
- OUString sSlug;
- OUString sName;
- OUString sPreviewURL;
- OUString sHeaderURL;
- OUString sFooterURL;
- OUString sTextColor;
-};
-
-SvxPersonalizationTabPage::SvxPersonalizationTabPage( vcl::Window *pParent, const SfxItemSet &rSet )
- : SfxTabPage( pParent, "PersonalizationTabPage", "cui/ui/personalization_tab.ui", &rSet )
+SvxPersonalizationTabPage::SvxPersonalizationTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
+ : SfxTabPage(pParent, "PersonalizationTabPage", "cui/ui/personalization_tab.ui", &rSet)
{
// persona
- get( m_pNoPersona, "no_persona" );
- get( m_pDefaultPersona, "default_persona" );
+ get(m_pNoPersona, "no_persona");
+ get(m_pDefaultPersona, "default_persona");
for (sal_uInt32 i = 0; i < MAX_DEFAULT_PERSONAS; ++i)
{
OUString sDefaultId("default" + OUString::number(i));
- get( m_vDefaultPersonaImages[i], OUStringToOString(sDefaultId, RTL_TEXTENCODING_UTF8) );
- m_vDefaultPersonaImages[i]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) );
+ get(m_vDefaultPersonaImages[i], OUStringToOString(sDefaultId, RTL_TEXTENCODING_UTF8));
+ m_vDefaultPersonaImages[i]->SetClickHdl(
+ LINK(this, SvxPersonalizationTabPage, DefaultPersona));
}
LoadDefaultImages();
}
-SvxPersonalizationTabPage::~SvxPersonalizationTabPage()
-{
- disposeOnce();
-}
+SvxPersonalizationTabPage::~SvxPersonalizationTabPage() { disposeOnce(); }
void SvxPersonalizationTabPage::dispose()
{
m_pNoPersona.clear();
m_pDefaultPersona.clear();
- for (VclPtr<PushButton> & i : m_vDefaultPersonaImages)
+ for (VclPtr<PushButton>& i : m_vDefaultPersonaImages)
i.clear();
SfxTabPage::dispose();
}
-
-VclPtr<SfxTabPage> SvxPersonalizationTabPage::Create( TabPageParent pParent, const SfxItemSet *rSet )
+VclPtr<SfxTabPage> SvxPersonalizationTabPage::Create(TabPageParent pParent, const SfxItemSet* rSet)
{
- return VclPtr<SvxPersonalizationTabPage>::Create( pParent.pParent, *rSet );
+ return VclPtr<SvxPersonalizationTabPage>::Create(pParent.pParent, *rSet);
}
-bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet * )
+bool SvxPersonalizationTabPage::FillItemSet(SfxItemSet*)
{
// persona
- OUString aPersona( "default" );
- if ( m_pNoPersona->IsChecked() )
+ OUString aPersona("default");
+ if (m_pNoPersona->IsChecked())
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 ) ) )
+ 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)))
{
bModified = true;
}
// write
- std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
- if( aPersona == "no" )
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create());
+ if (aPersona == "no")
m_aPersonaSettings.clear();
- officecfg::Office::Common::Misc::Persona::set( aPersona, batch );
- officecfg::Office::Common::Misc::PersonaSettings::set( m_aPersonaSettings, batch );
+ officecfg::Office::Common::Misc::Persona::set(aPersona, batch);
+ officecfg::Office::Common::Misc::PersonaSettings::set(m_aPersonaSettings, batch);
batch->commit();
- if ( bModified )
+ if (bModified)
{
// broadcast the change
- DataChangedEvent aDataChanged( DataChangedEventType::SETTINGS, nullptr, AllSettingsFlags::STYLE );
- Application::NotifyAllWindows( aDataChanged );
+ DataChangedEvent aDataChanged(DataChangedEventType::SETTINGS, nullptr,
+ AllSettingsFlags::STYLE);
+ Application::NotifyAllWindows(aDataChanged);
}
return bModified;
}
-void SvxPersonalizationTabPage::Reset( const SfxItemSet * )
+void SvxPersonalizationTabPage::Reset(const SfxItemSet*)
{
- uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
// persona
- OUString aPersona( "default" );
- if ( xContext.is() )
+ OUString aPersona("default");
+ if (xContext.is())
{
- aPersona = officecfg::Office::Common::Misc::Persona::get( xContext );
- m_aPersonaSettings = officecfg::Office::Common::Misc::PersonaSettings::get( xContext );
+ aPersona = officecfg::Office::Common::Misc::Persona::get(xContext);
+ m_aPersonaSettings = officecfg::Office::Common::Misc::PersonaSettings::get(xContext);
}
- if ( aPersona == "no" )
+ if (aPersona == "no")
m_pNoPersona->Check();
else
m_pDefaultPersona->Check();
@@ -146,36 +136,35 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
{
// Load the pre saved personas
- OUString gallery
- = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/gallery/personas/";
- rtl::Bootstrap::expandMacros( gallery );
+ OUString gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/gallery/personas/";
+ rtl::Bootstrap::expandMacros(gallery);
OUString aPersonasList = gallery + "personas_list.txt";
- SvFileStream aStream( aPersonasList, StreamMode::READ );
+ SvFileStream aStream(aPersonasList, StreamMode::READ);
GraphicFilter aFilter;
Graphic aGraphic;
sal_Int32 nIndex = 0;
bool foundOne = false;
- while( aStream.IsOpen() && !aStream.eof() && nIndex < MAX_DEFAULT_PERSONAS )
+ 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 );
+ aStream.ReadLine(aLine);
+ aPersonaSetting = OStringToOUString(aLine, RTL_TEXTENCODING_UTF8);
+ aName = aPersonaSetting.getToken(1, ';', nParseIndex);
+ aPreviewFile = aPersonaSetting.getToken(0, ';', nParseIndex);
if (aPreviewFile.isEmpty())
break;
- m_vDefaultPersonaSettings.push_back( aPersonaSetting );
+ m_vDefaultPersonaSettings.push_back(aPersonaSetting);
- INetURLObject aURLObj( gallery + aPreviewFile );
- aFilter.ImportGraphic( aGraphic, aURLObj );
+ INetURLObject aURLObj(gallery + aPreviewFile);
+ aFilter.ImportGraphic(aGraphic, aURLObj);
BitmapEx aBmp = aGraphic.GetBitmapEx();
- m_vDefaultPersonaImages[nIndex]->SetModeImage( Image( aBmp ) );
+ m_vDefaultPersonaImages[nIndex]->SetModeImage(Image(aBmp));
m_vDefaultPersonaImages[nIndex]->SetQuickHelpText(aName);
m_vDefaultPersonaImages[nIndex++]->Show();
foundOne = true;
@@ -184,12 +173,12 @@ void SvxPersonalizationTabPage::LoadDefaultImages()
m_pDefaultPersona->Enable(foundOne);
}
-IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, Button*, pButton, void )
+IMPL_LINK(SvxPersonalizationTabPage, DefaultPersona, Button*, pButton, void)
{
m_pDefaultPersona->Check();
- for( sal_Int32 nIndex = 0; nIndex < MAX_DEFAULT_PERSONAS; ++nIndex )
+ for (sal_Int32 nIndex = 0; nIndex < MAX_DEFAULT_PERSONAS; ++nIndex)
{
- if( pButton == m_vDefaultPersonaImages[nIndex] )
+ if (pButton == m_vDefaultPersonaImages[nIndex])
m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex];
}
}
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index dc992ccb07ea..dbc4cbf17798 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -16,32 +16,33 @@
#include <array>
#include <atomic>
-#define MAX_DEFAULT_PERSONAS 6 // Maximum number of default personas
+#define MAX_DEFAULT_PERSONAS 6 // Maximum number of default personas
class SvxPersonalizationTabPage : public SfxTabPage
{
using SfxTabPage::DeactivatePage;
private:
- VclPtr<RadioButton> m_pNoPersona; ///< Just the default look, without any bitmap
- VclPtr<RadioButton> m_pDefaultPersona; ///< Use the built-in bitmap
- VclPtr<PushButton> 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.
+ VclPtr<RadioButton> m_pNoPersona; ///< Just the default look, without any bitmap
+ VclPtr<RadioButton> m_pDefaultPersona; ///< Use the built-in bitmap
+ VclPtr<PushButton> 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.
std::vector<OUString> m_vDefaultPersonaSettings;
public:
- SvxPersonalizationTabPage( vcl::Window *pParent, const SfxItemSet &rSet );
+ SvxPersonalizationTabPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SvxPersonalizationTabPage() override;
virtual void dispose() override;
- static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet *rSet );
+ static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet);
/// Apply the settings ([OK] button).
- virtual bool FillItemSet( SfxItemSet *rSet ) override;
+ virtual bool FillItemSet(SfxItemSet* rSet) override;
/// Reset to default settings ([Revert] button).
- virtual void Reset( const SfxItemSet *rSet ) override;
+ virtual void Reset(const SfxItemSet* rSet) override;
/*
* Loads the default personas from the shared personas directory
@@ -59,11 +60,8 @@ public:
void LoadDefaultImages();
private:
- /// Handle the Persona selection
- DECL_LINK( SelectPersona, Button*, void );
-
/// Handle the default Persona selection
- DECL_LINK( DefaultPersona, Button*, void );
+ DECL_LINK(DefaultPersona, Button*, void);
};
#endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 338cf748285a..a48a9b103fea 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -2884,8 +2884,6 @@ cui/source/options/optsave.cxx
cui/source/options/optsave.hxx
cui/source/options/optupdt.cxx
cui/source/options/optupdt.hxx
-cui/source/options/personalization.cxx
-cui/source/options/personalization.hxx
cui/source/options/radiobtnbox.cxx
cui/source/options/sdbcdriverenum.cxx
cui/source/options/sdbcdriverenum.hxx
More information about the Libreoffice-commits
mailing list