diff options
author | Noel Grandin <noel@peralex.com> | 2016-07-21 14:23:23 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-08-16 06:30:09 +0000 |
commit | 127f70d66ac32b7a4ec818adaf1bdccb71865ee5 (patch) | |
tree | a020d2002c2eea81484297421f0fbe3ee84c2db0 /cui | |
parent | ce95e39f8e952159844e9dc04a1df402bb103634 (diff) |
new loplugin to check for static OUStrings
that are better declared as OUStringLiteral
Change-Id: Ifb5d9a12bb31a68641940bec16971a8181a46567
Reviewed-on: https://gerrit.libreoffice.org/27377
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/cfg.cxx | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index a97db75d6f94..d55343983933 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -581,28 +581,19 @@ ConvertSvxConfigEntry( const uno::Reference< container::XNameAccess >& xCommandToLabelMap, const SvxConfigEntry* pEntry ) { - static const OUString aDescriptorCommandURL ( - ITEM_DESCRIPTOR_COMMANDURL ); - - static const OUString aDescriptorType( - ITEM_DESCRIPTOR_TYPE ); - - static const OUString aDescriptorLabel( - ITEM_DESCRIPTOR_LABEL ); - uno::Sequence< beans::PropertyValue > aPropSeq( 3 ); - aPropSeq[0].Name = aDescriptorCommandURL; + aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL; aPropSeq[0].Value <<= OUString( pEntry->GetCommand() ); - aPropSeq[1].Name = aDescriptorType; + aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE; aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; // If the name has not been changed and the name is the same as // in the default command to label map then the label can be stored // as an empty string. // It will be initialised again later using the command to label map. - aPropSeq[2].Name = aDescriptorLabel; + aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL; if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() ) { bool isDefaultName = false; @@ -614,7 +605,7 @@ ConvertSvxConfigEntry( { for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) { - if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) + if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL ) { OUString tmpLabel; tmpPropSeq[i].Value >>= tmpLabel; @@ -656,31 +647,19 @@ ConvertToolbarEntry( const uno::Reference< container::XNameAccess >& xCommandToLabelMap, const SvxConfigEntry* pEntry ) { - static const OUString aDescriptorCommandURL ( - ITEM_DESCRIPTOR_COMMANDURL ); - - static const OUString aDescriptorType( - ITEM_DESCRIPTOR_TYPE ); - - static const OUString aDescriptorLabel( - ITEM_DESCRIPTOR_LABEL ); - - static const OUString aIsVisible( - ITEM_DESCRIPTOR_ISVISIBLE ); - uno::Sequence< beans::PropertyValue > aPropSeq( 4 ); - aPropSeq[0].Name = aDescriptorCommandURL; + aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL; aPropSeq[0].Value <<= OUString( pEntry->GetCommand() ); - aPropSeq[1].Name = aDescriptorType; + aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE; aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; // If the name has not been changed and the name is the same as // in the default command to label map then the label can be stored // as an empty string. // It will be initialised again later using the command to label map. - aPropSeq[2].Name = aDescriptorLabel; + aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL; if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() ) { bool isDefaultName = false; @@ -692,7 +671,7 @@ ConvertToolbarEntry( { for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) { - if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) + if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL ) { OUString tmpLabel; tmpPropSeq[i].Value >>= tmpLabel; @@ -726,7 +705,7 @@ ConvertToolbarEntry( aPropSeq[2].Value <<= OUString( pEntry->GetName() ); } - aPropSeq[3].Name = aIsVisible; + aPropSeq[3].Name = ITEM_DESCRIPTOR_ISVISIBLE; aPropSeq[3].Value <<= pEntry->IsVisible(); return aPropSeq; |