Kaydet (Commit) b0111f49 authored tarafından Pranav Kant's avatar Pranav Kant Kaydeden (comit) Andras Timar

lok: Expose DisplayName of styles, not internal ones

Change-Id: I2119713600703e3aa18f673979c7cd84c38177d7
Reviewed-on: https://gerrit.libreoffice.org/22349Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 53bf3ea5
...@@ -1375,9 +1375,28 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) ...@@ -1375,9 +1375,28 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames(); uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
for (const OUString& rStyle: aStyles ) for (const OUString& rStyle: aStyles )
{ {
// Filter out the default styles - they are already at the top uno::Reference< beans::XPropertySet > xStyle (xStyleFamily->getByName(rStyle), uno::UNO_QUERY);
// of the list bool bStyleInserted = false;
if (aDefaultStyleNames.find(rStyle) == aDefaultStyleNames.end()) // Its possible that the style does not implement XPropertySet.
// For example, TableDesignFamily doesn't yet.
if (xStyle.is())
{
// Filter out the default styles - they are already at the top
// of the list
OUString sName;
xStyle->getPropertyValue("DisplayName") >>= sName;
if (!sName.isEmpty() && aDefaultStyleNames.find(sName) == aDefaultStyleNames.end())
{
boost::property_tree::ptree aChild;
aChild.put("", sName.toUtf8());
aChildren.push_back(std::make_pair("", aChild));
bStyleInserted = true;
}
}
// If XPropertySet is not implemented or DisplayName is empty string,
// fallback to LO internal names
if (!bStyleInserted)
{ {
boost::property_tree::ptree aChild; boost::property_tree::ptree aChild;
aChild.put("", rStyle); aChild.put("", rStyle);
......
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