Kaydet (Commit) 6a44e4a4 authored tarafından Andrzej Hunt's avatar Andrzej Hunt

Use std::vector instead of an array of strings

This makes the code much more readable / sane.

Change-Id: I1d60f4102b6c619fa2fefac4a3644b7f04c0b9c0
(cherry picked from commit d5545979)
üst a747fbc7
......@@ -1261,7 +1261,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",
......@@ -1272,6 +1272,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)
{
......@@ -1285,10 +1287,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() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment