toolkit/source/helper/formpdfexport.cxx   |   15 +++++----------
 unotools/source/config/eventcfg.cxx       |    9 ++++-----
 unotools/source/config/historyoptions.cxx |   18 ++++++------------
 unotools/source/config/lingucfg.cxx       |   15 +++++----------
 unotools/source/misc/mediadescriptor.cxx  |    6 ++----
 unoxml/source/rdf/librdf_repository.cxx   |   16 +++++-----------
 6 files changed, 27 insertions(+), 52 deletions(-)

New commits:
commit aeeabc36fd0a4a71238c8c3df2e80ea324f9bac0
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Oct 31 10:29:25 2016 +0200

    loplugin:oncevar in unoxml..toolkit
    
    Change-Id: I3b97665908be0a44d24192433bdc9c2bd9008736
    Reviewed-on: https://gerrit.libreoffice.org/30431
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/toolkit/source/helper/formpdfexport.cxx 
b/toolkit/source/helper/formpdfexport.cxx
index 00ea42d..e02ba19 100644
--- a/toolkit/source/helper/formpdfexport.cxx
+++ b/toolkit/source/helper/formpdfexport.cxx
@@ -244,9 +244,8 @@ namespace toolkitform
         */
         void getStringItemVector( const Reference< XPropertySet >& _rxModel, 
::std::vector< OUString >& _rVector )
         {
-            static const char FM_PROP_STRINGITEMLIST[] = "StringItemList";
             Sequence< OUString > aListEntries;
-            OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) 
>>= aListEntries );
+            OSL_VERIFY( _rxModel->getPropertyValue( "StringItemList" ) >>= 
aListEntries );
             ::std::copy( aListEntries.begin(), aListEntries.end(),
                          ::std::back_insert_iterator< ::std::vector< OUString 
> >( _rVector ) );
         }
@@ -284,8 +283,7 @@ namespace toolkitform
 
             // Name, Description, Text
             OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_NAME ) >>= 
Descriptor->Name );
-            static const char FM_PROP_HELPTEXT[] = "HelpText";
-            OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_HELPTEXT ) >>= 
Descriptor->Description );
+            OSL_VERIFY( xModelProps->getPropertyValue( "HelpText" ) >>= 
Descriptor->Description );
             Any aText;
             static const char FM_PROP_TEXT[] = "Text";
             static const char FM_PROP_LABEL[] = "Label";
@@ -436,8 +434,7 @@ namespace toolkitform
                 }
 
                 // file select
-                static const char FM_SUN_COMPONENT_FILECONTROL[] = 
"com.sun.star.form.component.FileControl";
-                if ( xSI->supportsService( FM_SUN_COMPONENT_FILECONTROL ) )
+                if ( xSI->supportsService( 
"com.sun.star.form.component.FileControl" ) )
                     pEditWidget->FileSelect = true;
 
                 // maximum text length
@@ -539,8 +536,7 @@ namespace toolkitform
                 pRadioWidget->RadioGroup = determineRadioGroupId( xModelProps 
);
                 try
                 {
-                    static const char FM_PROP_REFVALUE[] = "RefValue";
-                    xModelProps->getPropertyValue( FM_PROP_REFVALUE ) >>= 
pRadioWidget->OnValue;
+                    xModelProps->getPropertyValue( "RefValue" ) >>= 
pRadioWidget->OnValue;
                 }
                 catch(...)
                 {
@@ -555,8 +551,7 @@ namespace toolkitform
                 vcl::PDFWriter::ListBoxWidget* pListWidget = static_cast< 
vcl::PDFWriter::ListBoxWidget* >( Descriptor.get() );
 
                 // drop down
-                static const char FM_PROP_DROPDOWN[] = "Dropdown";
-                OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_DROPDOWN ) 
>>= pListWidget->DropDown );
+                OSL_VERIFY( xModelProps->getPropertyValue( "Dropdown" ) >>= 
pListWidget->DropDown );
 
                 // multi selection
                 OSL_VERIFY( xModelProps->getPropertyValue("MultiSelection") 
>>= pListWidget->MultiSelect );
diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index 6b70a39..f9e846e 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -40,7 +40,6 @@ using namespace ::osl;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star;
 
-static const char ROOTNODE_EVENTS[] = "Office.Events/ApplicationEvents";
 #define PATHDELIMITER "/"
 #define SETNODE_BINDINGS "Bindings"
 #define PROPERTYNAME_BINDINGURL "BindingURL"
@@ -107,7 +106,7 @@ public:
 
 
 GlobalEventConfig_Impl::GlobalEventConfig_Impl()
-    :   ConfigItem( ROOTNODE_EVENTS, ConfigItemMode::ImmediateUpdate )
+    :   ConfigItem( "Office.Events/ApplicationEvents", 
ConfigItemMode::ImmediateUpdate )
 {
     // the supported event names
     for (const GlobalEventId id : o3tl::enumrange<GlobalEventId>())
@@ -169,15 +168,15 @@ void GlobalEventConfig_Impl::ImplCommit()
     ClearNodeSet( SETNODE_BINDINGS );
     Sequence< beans::PropertyValue > seqValues( 1 );
     OUString sNode;
-    static const char sPrefix[] = SETNODE_BINDINGS PATHDELIMITER 
"BindingType['";
-    static const char sPostfix[] = "']" PATHDELIMITER PROPERTYNAME_BINDINGURL;
     //step through the list of events
     for(int i=0;it!=it_end;++it,++i)
     {
         //no point in writing out empty bindings!
         if(it->second.isEmpty() )
             continue;
-        sNode = sPrefix + it->first + sPostfix;
+        sNode = SETNODE_BINDINGS PATHDELIMITER "BindingType['" +
+                it->first +
+                "']" PATHDELIMITER PROPERTYNAME_BINDINGURL;
         OSL_TRACE("writing binding for: %s",OUStringToOString(sNode , 
RTL_TEXTENCODING_ASCII_US ).pData->buffer);
         seqValues[ 0 ].Name = sNode;
         seqValues[ 0 ].Value <<= it->second;
diff --git a/unotools/source/config/historyoptions.cxx 
b/unotools/source/config/historyoptions.cxx
index 28de4cc..13810fb 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -51,12 +51,6 @@ namespace {
     static const ::sal_Int32 s_nOffsetPassword          = 3;
     static const ::sal_Int32 s_nOffsetThumbnail         = 4;
 
-    const char s_sCommonHistory[] = "org.openoffice.Office.Common/History";
-    const char s_sHistories[] = "org.openoffice.Office.Histories/Histories";
-    const char s_sPickListSize[] = "PickListSize";
-    const char s_sHelpBookmarksSize[] = "HelpBookmarkSize";
-    const char s_sPickList[] = "PickList";
-    const char s_sHelpBookmarks[] = "HelpBookmarks";
     const char s_sItemList[] = "ItemList";
     const char s_sOrderList[] = "OrderList";
     const char s_sHistoryItemRef[] = "HistoryItemRef";
@@ -108,14 +102,14 @@ SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()
         m_xCfg.set(
             ::comphelper::ConfigurationHelper::openConfig(
                 ::comphelper::getProcessComponentContext(),
-                s_sHistories,
+                "org.openoffice.Office.Histories/Histories",
                 ::comphelper::EConfigurationModes::Standard),
             uno::UNO_QUERY);
 
         m_xCommonXCU.set(
             ::comphelper::ConfigurationHelper::openConfig(
                 ::comphelper::getProcessComponentContext(),
-                s_sCommonHistory,
+                "org.openoffice.Office.Common/History",
                 ::comphelper::EConfigurationModes::Standard),
             uno::UNO_QUERY);
     }
@@ -146,11 +140,11 @@ sal_uInt32 
SvtHistoryOptions_Impl::GetCapacity(EHistoryType eHistory)
         switch (eHistory)
         {
         case ePICKLIST:
-            xListAccess->getPropertyValue(s_sPickListSize) >>= nSize;
+            xListAccess->getPropertyValue("PickListSize") >>= nSize;
             break;
 
         case eHELPBOOKMARKS:
-            xListAccess->getPropertyValue(s_sHelpBookmarksSize) >>= nSize;
+            xListAccess->getPropertyValue("HelpBookmarkSize") >>= nSize;
             break;
 
         default:
@@ -174,11 +168,11 @@ uno::Reference<container::XNameAccess> 
SvtHistoryOptions_Impl::GetListAccess(EHi
         switch (eHistory)
         {
         case ePICKLIST:
-            m_xCfg->getByName(s_sPickList) >>= xListAccess;
+            m_xCfg->getByName("PickList") >>= xListAccess;
             break;
 
         case eHELPBOOKMARKS:
-            m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+            m_xCfg->getByName("HelpBookmarks") >>= xListAccess;
             break;
 
         default:
diff --git a/unotools/source/config/lingucfg.cxx 
b/unotools/source/config/lingucfg.cxx
index 451518e..c9d9c63 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -785,12 +785,7 @@ bool SvtLinguConfigItem::IsReadOnly( sal_Int32 
nPropertyHandle ) const
 static SvtLinguConfigItem *pCfgItem = nullptr;
 static sal_Int32           nCfgItemRefCount = 0;
 
-static const char aG_SupportedDictionaryFormats[] = 
"SupportedDictionaryFormats";
 static const char aG_Dictionaries[] = "Dictionaries";
-static const char aG_Locations[] = "Locations";
-static const char aG_Format[] = "Format";
-static const char aG_Locales[] = "Locales";
-static const char aG_DisabledDictionaries[] = "DisabledDictionaries";
 
 SvtLinguConfig::SvtLinguConfig()
 {
@@ -905,7 +900,7 @@ bool SvtLinguConfig::GetSupportedDictionaryFormatsFor(
         xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
         xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
         xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW );
-        if (xNA->getByName( aG_SupportedDictionaryFormats ) >>= rFormatList)
+        if (xNA->getByName( "SupportedDictionaryFormats" ) >>= rFormatList)
             bSuccess = true;
         DBG_ASSERT( rFormatList.getLength(), "supported dictionary format list 
is empty" );
     }
@@ -953,9 +948,9 @@ bool SvtLinguConfig::GetDictionaryEntry(
         uno::Sequence< OUString >  aLocations;
         OUString                   aFormatName;
         uno::Sequence< OUString >  aLocaleNames;
-        bSuccess =  (xNA->getByName( aG_Locations ) >>= aLocations)  &&
-                    (xNA->getByName( aG_Format )    >>= aFormatName) &&
-                    (xNA->getByName( aG_Locales )   >>= aLocaleNames);
+        bSuccess =  (xNA->getByName( "Locations" ) >>= aLocations)  &&
+                    (xNA->getByName( "Format" )    >>= aFormatName) &&
+                    (xNA->getByName( "Locales" )   >>= aLocaleNames);
         DBG_ASSERT( aLocations.getLength(), "Dictionary locations not set" );
         DBG_ASSERT( !aFormatName.isEmpty(), "Dictionary format name not set" );
         DBG_ASSERT( aLocaleNames.getLength(), "No locales set for the 
dictionary" );
@@ -993,7 +988,7 @@ uno::Sequence< OUString > 
SvtLinguConfig::GetDisabledDictionaries() const
     {
         uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), 
uno::UNO_QUERY_THROW );
         xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
-        xNA->getByName( aG_DisabledDictionaries ) >>= aResult;
+        xNA->getByName( "DisabledDictionaries" ) >>= aResult;
     }
     catch (uno::Exception &)
     {
diff --git a/unotools/source/misc/mediadescriptor.cxx 
b/unotools/source/misc/mediadescriptor.cxx
index 2813a8d..5010164 100644
--- a/unotools/source/misc/mediadescriptor.cxx
+++ b/unotools/source/misc/mediadescriptor.cxx
@@ -335,8 +335,6 @@ MediaDescriptor::MediaDescriptor(const css::uno::Sequence< 
css::beans::PropertyV
 
 bool MediaDescriptor::isStreamReadOnly() const
 {
-    static const char CONTENTSCHEME_FILE[] = "file";
-    static const char CONTENTPROP_ISREADONLY[] = "IsReadOnly";
     static bool READONLY_FALLBACK = false;
 
     bool bReadOnly = READONLY_FALLBACK;
@@ -373,14 +371,14 @@ bool MediaDescriptor::isStreamReadOnly() const
             if (xId.is())
                 aScheme = xId->getContentProviderScheme();
 
-            if (aScheme.equalsIgnoreAsciiCase(CONTENTSCHEME_FILE))
+            if (aScheme.equalsIgnoreAsciiCase("file"))
                 bReadOnly = true;
             else
             {
                 ::ucbhelper::Content aContent(xContent,
                                               
utl::UCBContentHelper::getDefaultCommandEnvironment(),
                                               
comphelper::getProcessComponentContext());
-                aContent.getPropertyValue(CONTENTPROP_ISREADONLY) >>= 
bReadOnly;
+                aContent.getPropertyValue("IsReadOnly") >>= bReadOnly;
             }
         }
     }
diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 8dedfd3..1cb8230 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -1491,12 +1491,6 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
 throw (uno::RuntimeException, lang::IllegalArgumentException,
     rdf::RepositoryException, std::exception)
 {
-    static const char s_cell[] = "com.sun.star.table.Cell";
-    static const char s_cellprops[] = "com.sun.star.text.CellProperties"; // 
for writer
-    static const char s_paragraph[] = "com.sun.star.text.Paragraph";
-    static const char s_bookmark[] = "com.sun.star.text.Bookmark";
-    static const char s_meta[] = "com.sun.star.text.InContentMetadata";
-
     if (!i_xSubject.is()) {
         throw lang::IllegalArgumentException(
             "librdf_Repository::setStatementRDFa: Subject is null", *this, 0);
@@ -1520,14 +1514,14 @@ throw (uno::RuntimeException, 
lang::IllegalArgumentException,
     const uno::Reference<lang::XServiceInfo> xService(i_xObject,
         uno::UNO_QUERY_THROW);
     uno::Reference<text::XTextRange> xTextRange;
-    if (xService->supportsService(s_cell) ||
-        xService->supportsService(s_cellprops) ||
-        xService->supportsService(s_paragraph))
+    if (xService->supportsService("com.sun.star.table.Cell") ||
+        xService->supportsService("com.sun.star.text.CellProperties") || // 
for writer
+        xService->supportsService("com.sun.star.text.Paragraph"))
     {
         xTextRange.set(i_xObject, uno::UNO_QUERY_THROW);
     }
-    else if (xService->supportsService(s_bookmark) ||
-             xService->supportsService(s_meta))
+    else if (xService->supportsService("com.sun.star.text.Bookmark") ||
+             xService->supportsService("com.sun.star.text.InContentMetadata"))
     {
         const uno::Reference<text::XTextContent> xTextContent(i_xObject,
             uno::UNO_QUERY_THROW);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to