Kaydet (Commit) 40c00297 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Clarify ideas a bit, DocumentRenderCallback service not needed

Change-Id: I0a91a45dace5d2a35daadf1c9233ab68bee8701e
üst e243a5b4
......@@ -25,7 +25,6 @@ $(eval $(call gb_InternalUnoApi_set_include,touch,\
$(eval $(call gb_InternalUnoApi_add_idlfiles,touch,touch/idl/org/libreoffice/touch,\
Document \
DocumentRenderCallback \
XDocument \
XDocumentRenderCallback \
))
......
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// Copyright 2012 LibreOffice contributors.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef org_libreoffice_touch_DocumentRenderCallback_idl
#define org_libreoffice_touch_DocumentRenderCallback_idl
#include <org/libreoffice/touch/XDocumentRenderCallback.idl>
module org { module libreoffice { module touch {
service DocumentRenderCallback: XDocumentRenderCallback
{
create();
};
}; }; };
#endif
// vim:set shiftwidth=4 softtabstop=4 expandtab:
......@@ -37,10 +37,10 @@ interface XDocument: com::sun::star::uno::XInterface
// on Android version and/or hardware? TBD. Will the same format be useful
// also for iOS? TBD.
// buffer must have an exact number of bytes for a square number of
// pixels, At the UNO level buffer is represented as the address of its
// bytes, i.e. on Android it must be a "direct" ByteBuffer for that to be
// meaningful.
// buffer must have an exact number of bytes for a square with each side a
// power-of-two number of pixels, At this API level buffer is represented
// as the address of its bytes as a 64-bit integer, i.e. on Android it
// must be a "direct" ByteBuffer for that to be meaningful.
// listener gets a "reasonable" number of callbacks during the rendering
// if it takes "significantly" long, and can inerrupt the rendering.
......
......@@ -9,6 +9,7 @@
// NOTE: Work in progress, most likely makes little sense
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XToolkit.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
......@@ -40,10 +41,15 @@ private:
uno::Reference< uno::XComponentContext > m_rContext;
uno::Reference< lang::XComponent > m_xComponent;
uno::Reference< frame::XController > m_xController;
uno::Reference< awt::XDevice > m_xDevice;
uno::Reference< view::XRenderable > m_xRenderable;
beans::PropertyValues m_aRenderProps;
// XRenderable.getRendererCount() and .render() need an XController in the
// properties, at least in the test Java code it seemed that a totally
// dummy one works, so try that here, too.
typedef ::cppu::WeakImplHelper1< frame::XController > MyXController_Base;
class MyXController:
......@@ -160,9 +166,9 @@ protected:
uno::Reference< awt::XToolkit > toolkit( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.awt.Toolkit", m_rContext ), uno::UNO_QUERY_THROW );
uno::Reference< awt::XDevice > device( toolkit->createScreenCompatibleDevice( 1024, 1024 ) );
m_xDevice = toolkit->createScreenCompatibleDevice( 1024, 1024 );
m_xRenderable = uno::Reference< view::XRenderable >(m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.view.Renderable", m_rContext ), uno::UNO_QUERY_THROW );
m_xRenderable = uno::Reference< view::XRenderable >( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.view.Renderable", m_rContext ), uno::UNO_QUERY_THROW );
m_xController = new MyXController();
......@@ -170,7 +176,7 @@ protected:
m_aRenderProps[0].Name = "IsPrinter";
m_aRenderProps[0].Value <<= sal_Bool(true);
m_aRenderProps[1].Name = "RenderDevice";
m_aRenderProps[1].Value <<= device;
m_aRenderProps[1].Value <<= m_xDevice;
m_aRenderProps[2].Name = "View";
m_aRenderProps[2].Value <<= m_xController;
}
......@@ -197,13 +203,20 @@ protected:
sal_Int32 y )
throw ( lang::IllegalArgumentException, uno::RuntimeException)
{
uno::Any selection;
(void) buffer;
(void) bufferSize;
(void) listener;
(void) pageNo;
(void) zoomLevel;
(void) x;
(void) y ;
(void) y;
selection <<= m_xComponent;
m_xRenderable->render( pageNo, selection, m_aRenderProps );
uno::Reference< awt::XBitmap> bitmap( m_xDevice->createBitmap( 0, 0, 1024, 1024 ) );
}
};
......
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