Blame SOURCES/0311-Use-std-vector-instead-of-an-array-of-strings.patch

135360
From e254c72be43380472dd662d2ec69dfb7eab231b6 Mon Sep 17 00:00:00 2001
135360
From: Andrzej Hunt <andrzej@ahunt.org>
135360
Date: Thu, 12 Nov 2015 14:30:40 +0100
135360
Subject: [PATCH 311/398] Use std::vector instead of an array of strings
135360
135360
This makes the code much more readable / sane.
135360
135360
Change-Id: I1d60f4102b6c619fa2fefac4a3644b7f04c0b9c0
135360
(cherry picked from commit d5545979fb27e317cce4d374a5a913790d8a2adf)
135360
---
135360
 desktop/source/lib/init.cxx | 8 +++++---
135360
 1 file changed, 5 insertions(+), 3 deletions(-)
135360
135360
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
135360
index dbe30a640ecb..d724b81f9ac6 100644
135360
--- a/desktop/source/lib/init.cxx
135360
+++ b/desktop/source/lib/init.cxx
135360
@@ -1252,7 +1252,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
135360
     uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
135360
     uno::Sequence<OUString> aStyleFamilies = xStyleFamilies->getElementNames();
135360
 
135360
-    static const sal_Char* aWriterStyles[] =
135360
+    static const std::vector<OUString> aWriterStyles =
135360
     {
135360
         "Text body",
135360
         "Quotations",
135360
@@ -1263,6 +1263,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
135360
         "Heading 3"
135360
     };
135360
 
135360
+    // static const std::vector<OUString> aList = { "aaaa", "bbb" };
135360
+
135360
     boost::property_tree::ptree aValues;
135360
     for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam)
135360
     {
135360
@@ -1276,10 +1278,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
135360
         if (sStyleFam == "ParagraphStyles"
135360
             && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
135360
         {
135360
-            for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / sizeof( sal_Char*); ++nStyle )
135360
+            for( OUString aStyle: aWriterStyles )
135360
             {
135360
                 uno::Reference< beans::XPropertySet > xStyle;
135360
-                xStyleFamily->getByName( OUString::createFromAscii( aWriterStyles[nStyle] )) >>= xStyle;
135360
+                xStyleFamily->getByName( aStyle ) >>= xStyle;
135360
                 OUString sName;
135360
                 xStyle->getPropertyValue("DisplayName") >>= sName;
135360
                 if( !sName.isEmpty() )
135360
-- 
135360
2.12.0
135360