diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-14 15:43:17 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-21 07:30:13 +0200 |
commit | 2e523afe61f76d9b065a771e558683afb701b93b (patch) | |
tree | 7ebd1374d66e522f807298047c974092b0a3671f /desktop | |
parent | 179a0d0ea0ec4251152fe4c5e0fb3fd53f6f7967 (diff) |
lok::Office: add getViews()
Change-Id: Iabfb0f2a19106dc4a6bdae45f9e85d76c68a973e
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 13 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a08961403aac..d5616d566f6a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -14,6 +14,7 @@ #include <boost/property_tree/json_parser.hpp> #include <comphelper/processfactory.hxx> #include <sfx2/objsh.hxx> +#include <sfx2/lokhelper.hxx> #include <test/unoapi_test.hxx> #include "../../inc/lib/init.hxx" @@ -50,6 +51,7 @@ public: void runAllTests(); void testGetStyles(); void testGetFonts(); + void testCreateView(); CPPUNIT_TEST_SUITE(DesktopLOKTest); CPPUNIT_TEST(runAllTests); @@ -83,6 +85,7 @@ void DesktopLOKTest::runAllTests() { testGetStyles(); testGetFonts(); + testCreateView(); } void DesktopLOKTest::testGetStyles() @@ -134,6 +137,16 @@ void DesktopLOKTest::testGetFonts() closeDoc(); } +void DesktopLOKTest::testCreateView() +{ + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); + + pDocument->m_pDocumentClass->createView(pDocument); + CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); + closeDoc(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 0973974fd0d3..95213017726f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -307,6 +307,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThi static void lo_registerCallback (LibreOfficeKit* pThis, LibreOfficeKitCallback pCallback, void* pData); +static int lo_getViews(LibreOfficeKit* pThis); struct LibLibreOffice_Impl : public _LibreOfficeKit { @@ -330,6 +331,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit m_pOfficeClass->getError = lo_getError; m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; m_pOfficeClass->registerCallback = lo_registerCallback; + m_pOfficeClass->getViews = lo_getViews; gOfficeClass = m_pOfficeClass; } @@ -447,6 +449,11 @@ static void lo_registerCallback (LibreOfficeKit* pThis, pLib->mpCallbackData = pData; } +static int lo_getViews(LibreOfficeKit* /*pThis*/) +{ + return SfxLokHelper::getViews(); +} + static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) { LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); |