From 252ce90e39648c47bcfdb39547d0ac82bacdbae6 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Tue, 9 Jan 2018 22:17:23 -0400 Subject: sw lokit: add page syles to header & footer Change-Id: I3c0b0603d1e03f1cc19af4324dd2b909320d9d4a Reviewed-on: https://gerrit.libreoffice.org/47687 Tested-by: Jenkins Reviewed-by: Henry Castro --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 1 + desktop/source/lib/init.cxx | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'desktop') diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index d5d7cb26f18b..4488aa8c155c 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -309,6 +309,7 @@ void DesktopLOKTest::testGetStyles() rPair.first != "CellStyles" && rPair.first != "ShapeStyles" && rPair.first != "TableStyles" && + rPair.first != "HeaderFooter" && rPair.first != "Commands") { CPPUNIT_FAIL("Unknown style family: " + rPair.first); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4c0b96b85951..126861d7877a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2769,6 +2769,35 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); } + // Header & Footer Styles + { + OUString sName; + bool bIsPhysical; + boost::property_tree::ptree aChild; + uno::Reference xProperty; + boost::property_tree::ptree aChildren; + uno::Reference xContainer; + + if (xStyleFamilies->getByName("PageStyles") >>= xContainer) + { + uno::Sequence aSeqNames = xContainer->getElementNames(); + for (sal_Int32 itName = 0; itName < aSeqNames.getLength(); itName++) + { + sName = aSeqNames[itName]; + xProperty.set(xContainer->getByName(sName), uno::UNO_QUERY); + if (xProperty.is() && (xProperty->getPropertyValue("IsPhysical") >>= bIsPhysical) && bIsPhysical) + { + xProperty->getPropertyValue("DisplayName") >>= sName; + aChild.put("", sName.toUtf8()); + aChildren.push_back(std::make_pair("", aChild)); + } + else + bIsPhysical = false; + } + aValues.add_child("HeaderFooter", aChildren); + } + } + { boost::property_tree::ptree aCommandList; -- cgit