summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-06-07 21:52:06 +0300
committerTor Lillqvist <tlillqvist@suse.com>2012-06-07 21:54:20 +0300
commit40c00297deadb5f19020a82520f53d02129f4852 (patch)
tree8e991ee10670865aeca0bd3a8e82555bd14cf00b
parente243a5b462408891c401f88bb3af3a661697f8f4 (diff)
Clarify ideas a bit, DocumentRenderCallback service not needed
Change-Id: I0a91a45dace5d2a35daadf1c9233ab68bee8701e
-rw-r--r--touch/InternalUnoApi_touch.mk1
-rw-r--r--touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl25
-rw-r--r--touch/idl/org/libreoffice/touch/XDocument.idl8
-rw-r--r--touch/source/uno/Document.cxx23
4 files changed, 22 insertions, 35 deletions
diff --git a/touch/InternalUnoApi_touch.mk b/touch/InternalUnoApi_touch.mk
index bb03402b28e4..b74af1a4cb91 100644
--- a/touch/InternalUnoApi_touch.mk
+++ b/touch/InternalUnoApi_touch.mk
@@ -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 \
))
diff --git a/touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl b/touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl
deleted file mode 100644
index 95e7e7730ed8..000000000000
--- a/touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- 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:
diff --git a/touch/idl/org/libreoffice/touch/XDocument.idl b/touch/idl/org/libreoffice/touch/XDocument.idl
index bc3d563d8708..254970e7ee78 100644
--- a/touch/idl/org/libreoffice/touch/XDocument.idl
+++ b/touch/idl/org/libreoffice/touch/XDocument.idl
@@ -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.
diff --git a/touch/source/uno/Document.cxx b/touch/source/uno/Document.cxx
index 975e9ccca051..7d41698158c3 100644
--- a/touch/source/uno/Document.cxx
+++ b/touch/source/uno/Document.cxx
@@ -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 ) );
}
};