summaryrefslogtreecommitdiffstats
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-07 11:52:29 +0100
commitb4a58119a60910514f3ef5a163d32bfa8734eec1 (patch)
tree3d8c1199cda23e67575a039b911a8b455250c70f /desktop
parenttdf#39593 vcl: reduce copy-paste in ImplCalcOutSideRgn (diff)
downloadcore-b4a58119a60910514f3ef5a163d32bfa8734eec1.tar.gz
core-b4a58119a60910514f3ef5a163d32bfa8734eec1.zip
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 65632e333b39..81a51de8cde9 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 f235728e65bb..77037e47fee1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -121,6 +121,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)
{
@@ -815,6 +818,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();
@@ -2597,6 +2602,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