21#include <libxml/xmlwriter.h>
27 int writeCallback(
void* pContext,
const char* sBuffer,
int nLen )
34 uno::XInterface* pObj =
static_cast<uno::XInterface*
>(pContext);
35 uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY_THROW );
38 uno::Sequence< sal_Int8 > seq( nLen );
39 strncpy(
reinterpret_cast<char *
>(seq.getArray()), sBuffer, nLen );
40 xOut->writeBytes( seq );
42 catch (
const uno::Exception&)
50 int closeCallback(
void* pContext )
55 uno::XInterface* pObj =
static_cast<uno::XInterface*
>(pContext);
56 uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY_THROW );
59 catch (
const uno::Exception&)
86 uno::Reference< io::XOutputStream > xOut = aMediaDesc.getUnpackedValueOrDefault(
88 uno::Reference< io::XOutputStream >() );
91 auto pXDoc = comphelper::getFromUnoTunnel<SwXTextDocument>(
m_xSrcDoc);
94 SwRootFrame* pLayout = pXDoc->GetDocShell()->GetWrtShell()->GetLayout();
98 pXDoc->GetDocShell()->GetWrtShell()->StartAction();
100 pXDoc->GetDocShell()->SetVisArea( aRect );
102 pXDoc->GetDocShell()->GetWrtShell()->EndAction();
105 xmlOutputBufferPtr outBuffer = xmlOutputBufferCreateIO(
106 writeCallback, closeCallback,
static_cast<void*
>(xOut.get()),
nullptr );
109 xmlTextWriterSetIndent(writer, 1);
110 (void)xmlTextWriterStartDocument( writer,
nullptr,
nullptr,
nullptr );
115 (void)xmlTextWriterEndDocument( writer );
116 xmlFreeTextWriter( writer );
142 return "com.sun.star.comp.Writer.LayoutDump";
152 return {
"com.sun.star.document.ExportFilter" };
158extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
160 css::uno::Sequence<css::uno::Any>
const &)
The root element of a Writer document layout.
void InvalidateAllContent(SwInvalidateFlags nInvalidate)
Invalidate all Content, Size or PrtArea.
void dumpAsXml(xmlTextWriterPtr writer=nullptr) const override
Implementation of UNO export service to dump the layout of the document as XML.
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::lang::XComponent > m_xSrcDoc
virtual sal_Bool SAL_CALL filter(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL cancel() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~LayoutDumpFilter() override
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
struct _xmlTextWriter * xmlTextWriterPtr
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_LayoutDump_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Dialog to specify the properties of date form field.