summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.com>2016-02-22 20:56:12 +0530
committerAndras Timar <andras.timar@collabora.com>2016-03-04 13:20:15 +0000
commite04284587a5db51d96430137baa76bbef3937a5d (patch)
tree1156a94ee55707cf42f7c56b4401ff3bd6e857b9 /desktop
parent63af0c148109268626112848f3a2ad7a1fcbfd4c (diff)
lok: Export only programmatic style names
First, it reverts b0111f494c1ee2d75ac4f1544c06c24d464cc416. It was a bad idea to export UI names via LOK because the client would need the programmatic ones anyways for UNO commands. We cannot expect UNO commands to accept UI style names and work, though that's another thing that they will work in most cases because mostly UI names are equal to programmatic ones. Clients are now supposed to have their own UI name <-> programmatic name mapping, if they want style names to use for translations. Secondly, it fixes a bug that was already there mixing programmatic names with UI ones in an effort to put default writer styles on the top of the list. Change-Id: I307f987fe740b3c43b0e14ec4773edcb672a11df Reviewed-on: https://gerrit.libreoffice.org/22810 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx43
1 files changed, 9 insertions, 34 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 829254c8e7fc..8935027bbace 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1364,49 +1364,24 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
{
for (const OUString& rStyle: aWriterStyles)
{
- uno::Reference< beans::XPropertySet > xStyle;
- xStyleFamily->getByName(rStyle) >>= xStyle;
- OUString sName;
- xStyle->getPropertyValue("DisplayName") >>= sName;
- if( !sName.isEmpty() )
- {
- aDefaultStyleNames.insert( sName );
+ aDefaultStyleNames.insert( rStyle );
- boost::property_tree::ptree aChild;
- aChild.put("", sName.toUtf8());
- aChildren.push_back(std::make_pair("", aChild));
- }
+ boost::property_tree::ptree aChild;
+ aChild.put("", rStyle.toUtf8());
+ aChildren.push_back(std::make_pair("", aChild));
}
}
uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
for (const OUString& rStyle: aStyles )
{
- 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)
+ // Filter out the default styles - they are already at the top
+ // of the list
+ if (aDefaultStyleNames.find(rStyle) == aDefaultStyleNames.end() ||
+ (sStyleFam != "ParagraphStyles" || doc_getDocumentType(pThis) != LOK_DOCTYPE_TEXT) )
{
boost::property_tree::ptree aChild;
- aChild.put("", rStyle);
+ aChild.put("", rStyle.toUtf8());
aChildren.push_back(std::make_pair("", aChild));
}
}