[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - desktop/source
Pranav Kant
pranavk at collabora.com
Mon Feb 15 07:48:52 UTC 2016
desktop/source/lib/init.cxx | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
New commits:
commit 3c84b0b032453a389a2606d67d1995d554468cad
Author: Pranav Kant <pranavk at collabora.com>
Date: Sun Feb 14 02:08:20 2016 +0530
lok: Expose DisplayName of styles, not internal ones
Change-Id: I2119713600703e3aa18f673979c7cd84c38177d7
Reviewed-on: https://gerrit.libreoffice.org/22349
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit b0111f494c1ee2d75ac4f1544c06c24d464cc416)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 27bf2a2..16d0c13 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1422,9 +1422,28 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
for (const OUString& rStyle: aStyles )
{
- // Filter out the default styles - they are already at the top
- // of the list
- if (aDefaultStyleNames.find(rStyle) == aDefaultStyleNames.end())
+ uno::Reference< beans::XPropertySet > xStyle (xStyleFamily->getByName(rStyle), uno::UNO_QUERY);
+ bool bStyleInserted = false;
+ // 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;
aChild.put("", rStyle);
More information about the Libreoffice-commits
mailing list