summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2018-11-10 18:57:26 +0100
committerJan Holesovsky <kendy@collabora.com>2018-12-10 12:12:52 +0100
commit1a5b2d2b6f28ec33c5e100fbc5b0c3438df6b006 (patch)
tree7d140891da23f8d46915e08febf229f52d501385 /desktop
parent89161e4d5835b93f0942e960a116a0d3863cc55c (diff)
Introduce client-server message for requesting the selected shape as SVG
It works for Impress only now. Change-Id: I95e3e37ae7df49b567108f6d6467038b715e886d
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx38
2 files changed, 40 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 057a228d2e6b..b62986ec8d81 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2522,9 +2522,10 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(43), offsetof(struct _LibreOfficeKitDocumentClass, insertCertificate));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(44), offsetof(struct _LibreOfficeKitDocumentClass, addCertificate));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(45), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 178562574a30..311ff63e7eab 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -120,6 +120,7 @@
#include <unotools/mediadescriptor.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/tempfile.hxx>
+#include <unotools/streamwrap.hxx>
#include <osl/module.hxx>
#include <comphelper/sequence.hxx>
#include <sfx2/sfxbasemodel.hxx>
@@ -750,6 +751,8 @@ static bool doc_addCertificate(LibreOfficeKitDocument* pThis,
static int doc_getSignatureState(LibreOfficeKitDocument* pThis);
+static void doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char*& pOutput, size_t& nOutputSize);
+
LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
: mxComponent(xComponent)
{
@@ -812,6 +815,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->addCertificate = doc_addCertificate;
m_pDocumentClass->getSignatureState = doc_getSignatureState;
+ m_pDocumentClass->renderShapeSelection = doc_renderShapeSelection;
+
gDocumentClass = m_pDocumentClass;
}
pClass = m_pDocumentClass.get();
@@ -2600,6 +2605,39 @@ static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned n
}
}
+static void doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char*& pOutput, size_t& nOutputSize)
+{
+ SolarMutexGuard aGuard;
+ if (gImpl)
+ gImpl->maLastExceptionMsg.clear();
+
+ std::cout << "doc_renderShapeSelection" << std::endl;
+
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+ uno::Reference<frame::XStorable> xStorable(pDocument->mxComponent, uno::UNO_QUERY_THROW);
+
+ SvMemoryStream aOutStream;
+ uno::Reference < io::XOutputStream > xOut = new utl::OOutputStreamWrapper( aOutStream );
+
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
+ aMediaDescriptor["SelectionOnly"] <<= true;
+ aMediaDescriptor["OutputStream"] <<= xOut;
+
+ xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
+
+
+ size_t nStreamSize = aOutStream.GetEndOfData();
+ char* pTmp = pOutput;
+ pOutput = new char[nOutputSize + nStreamSize];
+ std::memcpy(pOutput, pTmp, nOutputSize);
+ std::memcpy(pOutput+nOutputSize, aOutStream.GetData(), nStreamSize);
+
+ nOutputSize += nStreamSize;
+ delete [] pTmp;
+}
+
/** Class to react on finishing of a dispatched command.
This will call a LOK_COMMAND_FINISHED callback when postUnoCommand was