summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-12 14:48:55 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-11-12 15:09:31 +0100
commit0b3fbf8299c51767689b4e7656bbf4c331450b98 (patch)
tree12a9807398f7201c45cb498b480199ec7c56cfa4
parent6e6ae9803796b120e95f6e89575e03c5fd0ed3c2 (diff)
sw lok: filter out defalt styles to avoid duplicates
Change-Id: Iff84c2f16844a507d30f30c1fd4b23d807ded466
-rw-r--r--desktop/source/lib/init.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b4992cc4961e..bc25f3e15cde 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1263,7 +1263,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
"Heading 3"
};
- // static const std::vector<OUString> aList = { "aaaa", "bbb" };
+ // We need to keep a list of the default style names
+ // in order to filter these out later when processing
+ // the full list of styles.
+ std::set<OUString> aDefaultStyleNames;
boost::property_tree::ptree aValues;
for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); ++nStyleFam)
@@ -1286,6 +1289,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
xStyle->getPropertyValue("DisplayName") >>= sName;
if( !sName.isEmpty() )
{
+ aDefaultStyleNames.insert( sName );
+
boost::property_tree::ptree aChild;
aChild.put("", sName.toUtf8());
aChildren.push_back(std::make_pair("", aChild));
@@ -1296,9 +1301,14 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
for ( OUString aStyle: aStyles )
{
- boost::property_tree::ptree aChild;
- aChild.put("", aStyles[nInd]);
- aChildren.push_back(std::make_pair("", aChild));
+ // Filter out the default styles - they are already at the top
+ // of the list
+ if (aDefaultStyleNames.find(aStyle) == aDefaultStyleNames.end())
+ {
+ boost::property_tree::ptree aChild;
+ aChild.put("", aStyle);
+ aChildren.push_back(std::make_pair("", aChild));
+ }
}
aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren);
}