Kaydet (Commit) b4a58119 authored tarafından Tamás Zolnai's avatar Tamás Zolnai Kaydeden (comit) Jan Holesovsky

Introduce client-server message for requesting the selected shape as SVG

It works for Impress only now.

Change-Id: I95e3e37ae7df49b567108f6d6467038b715e886d
üst af4fab26
......@@ -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);
......
......@@ -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
......
......@@ -341,6 +341,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
{
// #i124608# extract single selection wanted from dialog return values
rDescriptor[nInd].Value >>= bSelectionOnly;
bPageProvided = false;
}
else if (rDescriptor[nInd].Name == "PagePos")
{
......
......@@ -347,6 +347,11 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::getSignatureState().
int (*getSignatureState) (LibreOfficeKitDocument* pThis);
/// @see lok::Document::renderShapeSelection
void (*renderShapeSelection) (LibreOfficeKitDocument* pThis,
char*& pOutput,
size_t& nOutputSize);
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
......
......@@ -619,6 +619,15 @@ public:
return mpDoc->pClass->getSignatureState(mpDoc);
}
/**
* Gets an image of the selected shapes.
*
*/
void renderShapeSelection(char*& pOutput, size_t& nOutputSize)
{
mpDoc->pClass->renderShapeSelection(mpDoc, pOutput, nOutputSize);
}
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment