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