summaryrefslogtreecommitdiff
path: root/touch
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-06-05 16:35:49 +0300
committerTor Lillqvist <tlillqvist@suse.com>2012-06-05 17:17:41 +0300
commit92f23297c93dc105e2ffd9ff09c0dafff1ee0fd3 (patch)
treec3ba983227366359d40d6a41ead18d625303005e /touch
parent71dbf5bfd0b9622ad485a5b7620e11d8405ed474 (diff)
Work in progress: Add "touch" module for Android and iOS stuff
Change-Id: I10652743194d44d8465ddf8079f6b4458e6710f9
Diffstat (limited to 'touch')
-rw-r--r--touch/CustomTarget_touch_javamaker.mk21
-rw-r--r--touch/InternalUnoApi_touch.mk33
-rw-r--r--touch/Library_libotouch.mk39
-rw-r--r--touch/Makefile7
-rw-r--r--touch/Module_touch.mk22
-rw-r--r--touch/Package_inc.mk13
-rw-r--r--touch/README20
-rw-r--r--touch/idl/org/libreoffice/touch/Document.idl25
-rw-r--r--touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl25
-rw-r--r--touch/idl/org/libreoffice/touch/XDocument.idl73
-rw-r--r--touch/idl/org/libreoffice/touch/XDocumentRenderCallback.idl55
-rw-r--r--touch/inc/touch/libotouch.hxx15
-rw-r--r--touch/prj/build.lst1
-rw-r--r--touch/prj/d.lst0
-rw-r--r--touch/source/generic/libotouch.cxx11
-rw-r--r--touch/source/ios/ios.cxx10
-rw-r--r--touch/source/uno/Document.cxx213
17 files changed, 583 insertions, 0 deletions
diff --git a/touch/CustomTarget_touch_javamaker.mk b/touch/CustomTarget_touch_javamaker.mk
new file mode 100644
index 000000000000..a375c74110c2
--- /dev/null
+++ b/touch/CustomTarget_touch_javamaker.mk
@@ -0,0 +1,21 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Copyright 2012 LibreOffice contributors.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 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/.
+
+$(eval $(call gb_CustomTarget_CustomTarget,touch/touch_javamaker))
+
+touch_javamaker_DIR := $(call gb_CustomTarget_get_workdir,touch)
+
+$(call gb_CustomTarget_get_target,touch/touch_javamaker) : $(touch_javamaker_DIR)/done
+
+$(touch_javamaker_DIR)/done : $(call gb_UnoApiTarget_get_target,touch) \
+ $(call gb_Executable_get_target_for_build,javamaker) | $(touch_javamaker_DIR)/.dir
+ $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),JVM,1)
+ $(call gb_Helper_abbreviate_dirs, \
+ $(call gb_Helper_execute,javamaker -BUCR -nD -O$(touch_javamaker_DIR)/class -X$(OUTDIR)/bin/types.rdb $<) && touch $@)
+
+# vim: set noet sw=4 ts=4:
diff --git a/touch/InternalUnoApi_touch.mk b/touch/InternalUnoApi_touch.mk
new file mode 100644
index 000000000000..bb03402b28e4
--- /dev/null
+++ b/touch/InternalUnoApi_touch.mk
@@ -0,0 +1,33 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Copyright 2012 LibreOffice contributors.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 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/.
+
+$(eval $(call gb_InternalUnoApi_InternalUnoApi,touch))
+
+$(eval $(call gb_InternalUnoApi_use_api,touch,\
+ udkapi \
+))
+
+$(eval $(call gb_InternalUnoApi_define_api_dependencies,touch, \
+ offapi,\
+ udkapi \
+))
+
+$(eval $(call gb_InternalUnoApi_set_include,touch,\
+ -I$(SRCDIR)/touch/idl \
+ -I$(OUTDIR)/idl \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_InternalUnoApi_add_idlfiles,touch,touch/idl/org/libreoffice/touch,\
+ Document \
+ DocumentRenderCallback \
+ XDocument \
+ XDocumentRenderCallback \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/touch/Library_libotouch.mk b/touch/Library_libotouch.mk
new file mode 100644
index 000000000000..be355e3868ad
--- /dev/null
+++ b/touch/Library_libotouch.mk
@@ -0,0 +1,39 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Copyright 2012 LibreOffice contributors.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 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/.
+
+$(eval $(call gb_Library_Library,libotouch))
+
+$(eval $(call gb_Library_set_include,libotouch,\
+ -I$(SRCDIR)/libotouch/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_Library_use_internal_comprehensive_api,libotouch,\
+ udkapi \
+ offapi \
+ touch \
+))
+
+$(eval $(call gb_Library_use_libraries,libotouch,\
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,libotouch,\
+ touch/source/uno/Document \
+ touch/source/generic/libotouch \
+))
+
+ifeq ($(OS),IOS)
+
+$(eval $(call gb_Library_add_objcxx_objects,libotouch,\
+ touch/source/ios/ios \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/touch/Makefile b/touch/Makefile
new file mode 100644
index 000000000000..ccb1c85a04da
--- /dev/null
+++ b/touch/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/touch/Module_touch.mk b/touch/Module_touch.mk
new file mode 100644
index 000000000000..fde090d3be23
--- /dev/null
+++ b/touch/Module_touch.mk
@@ -0,0 +1,22 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Copyright 2012 LibreOffice contributors.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 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/.
+
+$(eval $(call gb_Module_Module,touch))
+
+ifneq (,$(filter IOS ANDROID,$(OS)))
+
+$(eval $(call gb_Module_add_targets,touch,\
+ CustomTarget_touch_javamaker \
+ InternalUnoApi_touch \
+ Library_libotouch \
+ Package_inc \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/touch/Package_inc.mk b/touch/Package_inc.mk
new file mode 100644
index 000000000000..c7c393d4819a
--- /dev/null
+++ b/touch/Package_inc.mk
@@ -0,0 +1,13 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Copyright 2012 LibreOffice contributors.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 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/.
+
+$(eval $(call gb_Package_Package,touch_inc,$(SRCDIR)/touch/inc))
+
+$(eval $(call gb_Package_add_file,touch_inc,inc/touch/libotouch.hxx,touch/libotouch.hxx))
+
+# vim: set noet sw=4 ts=4:
diff --git a/touch/README b/touch/README
new file mode 100644
index 000000000000..f1be5dfc5b2a
--- /dev/null
+++ b/touch/README
@@ -0,0 +1,20 @@
+Library that provides API used by LO-based apps on touch devices
+
+This is all very much a work in progress and the design can change radically
+at any moment. The name "touch" for this module and the library name
+"libotouch" are not fixed and might change if somebody comes up with niftier
+names.
+
+This module will contain an UNO API to be called either from Java (for
+Android), or directly (iOS). (Or, on iOS, possibly through some thin
+Objective-C layer to hide the UNO.)
+
+The API will provide a mechanism to render "tiles" of a document at some
+requested zoom level. Initially for viewer style apps, but the work should
+ideally be open-ended to potentially be a base for editing apps, too.
+
+For starters, concentrating on text ("Writer") documents as they are
+easiest. With spreadsheets come the added complexity of the cell grid being
+potentially unbounded and no clear "page" area. With presentations come the
+animation complications, and possibly LO-based viewer apps for presentations
+will be done in a totally different fashion.
diff --git a/touch/idl/org/libreoffice/touch/Document.idl b/touch/idl/org/libreoffice/touch/Document.idl
new file mode 100644
index 000000000000..c05437ce3473
--- /dev/null
+++ b/touch/idl/org/libreoffice/touch/Document.idl
@@ -0,0 +1,25 @@
+// -*- 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_Document_idl
+#define org_libreoffice_touch_Document_idl
+
+#include <org/libreoffice/touch/XDocument.idl>
+
+module org { module libreoffice { module touch {
+
+service Document:
+ XDocument {
+ create( [in] string uri );
+ };
+
+}; }; };
+
+#endif
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl b/touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl
new file mode 100644
index 000000000000..95e7e7730ed8
--- /dev/null
+++ b/touch/idl/org/libreoffice/touch/DocumentRenderCallback.idl
@@ -0,0 +1,25 @@
+// -*- 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
new file mode 100644
index 000000000000..bc3d563d8708
--- /dev/null
+++ b/touch/idl/org/libreoffice/touch/XDocument.idl
@@ -0,0 +1,73 @@
+// -*- 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_XDocument_idl
+#define org_libreoffice_touch_XDocument_idl
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+
+module org { module libreoffice { module touch {
+
+// Note that this is work in progress
+
+// Error handling? Presumably for true errors expected to be uncommon, or
+// invalid usage, the methods should throw exceptions.
+
+// Multithreaded use of this is undefined (the intent obviously is that this
+// API is called in another thread than the "main" UI thread, but calling this
+// stuff on the same object simultaneously in multiple threads is undefined).
+
+// Represents one (Writer, for now) document
+
+interface XDocumentRenderCallback;
+
+interface XDocument: com::sun::star::uno::XInterface
+{
+ [attribute, readonly] long numberOfPages;
+
+ // Renders a (part of a) page into a square bitmap, for Android in the
+ // android.graphics.Bitmap.Config.ARGB_8888 format. Despite the name, the
+ // order of bytes is R,G,B,A. Is this reliable, or coincidental depending
+ // 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.
+
+ // listener gets a "reasonable" number of callbacks during the rendering
+ // if it takes "significantly" long, and can inerrupt the rendering.
+
+ // zoomLevel is 0 for whole page, 1 for tiled into four, etc.
+
+ // x and y are in [0..2^zoomLevel]
+
+ // Should we have this method copy the rendered buffer into a Bitmap
+ // instead and return that? A Bitmap is presumably what the caller wants
+ // anyway?
+
+ // Or should we just go OpenGL ES and render into a texture?
+
+ void render( [in] hyper buffer,
+ [in] long bufferSize,
+ [in] XDocumentRenderCallback listener,
+ [in] long pageNo,
+ [in] long zoomLevel,
+ [in] long x,
+ [in] long y)
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+};
+
+}; }; };
+
+#endif
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/touch/idl/org/libreoffice/touch/XDocumentRenderCallback.idl b/touch/idl/org/libreoffice/touch/XDocumentRenderCallback.idl
new file mode 100644
index 000000000000..62da11c2eedb
--- /dev/null
+++ b/touch/idl/org/libreoffice/touch/XDocumentRenderCallback.idl
@@ -0,0 +1,55 @@
+// -*- 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_XDocumentRenderCallback_idl
+#define org_libreoffice_touch_XDocumentRenderCallback_idl
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module org { module libreoffice { module touch {
+
+interface XDocument;
+
+interface XDocumentRenderCallback: com::sun::star::uno::XInterface
+{
+
+ // Return false from any of the callbacks if the render result isn't
+ // wanted after all and the rendering should stop
+
+ // pageWidth and pageHeight are in [1..squareSide] where squareSide is
+ // the side of the render target square implied by the size of the
+ // buffer passed to render().
+
+ // This always called at the start of rendering one page
+
+ boolean start( [in] long pageWidth,
+ [in] long pageHeight );
+
+ // Called with unspecified frequency during the rendering, possibly
+ // even not at all, but the intent is to call this with "reasonable"
+ // frquency if the rendering takes a "long" time. Maybe around ten
+ // times a second?
+
+ // There is no guarantee in which order the bitmap is being rendered
+
+ // fraction is in [0..1] and is an approximation of unknown exactness
+ // If the rendering code doesn't even bother guessing, it can pass
+ // zero all the time. The fraction in subsequent calls never
+ // decreases.
+
+ boolean progress( [in] float fraction );
+
+ // There is no callback when the rendering finishes; render() just
+ // returns.
+};
+
+}; }; };
+
+#endif
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/touch/inc/touch/libotouch.hxx b/touch/inc/touch/libotouch.hxx
new file mode 100644
index 000000000000..acfa0c1b18c5
--- /dev/null
+++ b/touch/inc/touch/libotouch.hxx
@@ -0,0 +1,15 @@
+/* -*- 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, v. 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 _TOUCH_LIBOTOUCH_HXX
+#define _TOUCH_LIBOTOUCH_HXX
+
+#endif // _TOUCH_LIBOTOUCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/touch/prj/build.lst b/touch/prj/build.lst
new file mode 100644
index 000000000000..4709170e900f
--- /dev/null
+++ b/touch/prj/build.lst
@@ -0,0 +1 @@
+th touch : sw sc
diff --git a/touch/prj/d.lst b/touch/prj/d.lst
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/touch/prj/d.lst
diff --git a/touch/source/generic/libotouch.cxx b/touch/source/generic/libotouch.cxx
new file mode 100644
index 000000000000..ce572e14d9d9
--- /dev/null
+++ b/touch/source/generic/libotouch.cxx
@@ -0,0 +1,11 @@
+/* -*- 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, v. 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/.
+ */
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/touch/source/ios/ios.cxx b/touch/source/ios/ios.cxx
new file mode 100644
index 000000000000..be06b704a2ee
--- /dev/null
+++ b/touch/source/ios/ios.cxx
@@ -0,0 +1,10 @@
+/* -*- 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, v. 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/.
+ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/touch/source/uno/Document.cxx b/touch/source/uno/Document.cxx
new file mode 100644
index 000000000000..975e9ccca051
--- /dev/null
+++ b/touch/source/uno/Document.cxx
@@ -0,0 +1,213 @@
+/* -*- 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, v. 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/.
+ */
+
+// NOTE: Work in progress, most likely makes little sense
+
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/view/XRenderable.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <org/libreoffice/touch/Document.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+namespace org { namespace libreoffice { namespace touch
+{
+
+class DocumentImpl:
+ public XDocument
+{
+
+private:
+ OUString m_sURI;
+ uno::Reference< uno::XComponentContext > m_rContext;
+ uno::Reference< lang::XComponent > m_xComponent;
+ uno::Reference< frame::XController > m_xController;
+ uno::Reference< view::XRenderable > m_xRenderable;
+
+ beans::PropertyValues m_aRenderProps;
+
+ typedef ::cppu::WeakImplHelper1< frame::XController > MyXController_Base;
+
+ class MyXController:
+ public MyXController_Base,
+ public ::cppu::BaseMutex
+ {
+ private:
+ uno::Reference< frame::XFrame > m_xFrame;
+ uno::Reference< frame::XModel > m_xModel;
+
+ public:
+ virtual void SAL_CALL
+ attachFrame( const uno::Reference< frame::XFrame >& xFrame )
+ throw( uno::RuntimeException )
+ {
+ m_xFrame = xFrame;
+ }
+
+ virtual sal_Bool SAL_CALL
+ attachModel( const uno::Reference< frame::XModel >& xModel )
+ throw( uno::RuntimeException )
+ {
+ m_xModel = xModel;
+ return sal_True;
+ }
+
+ virtual sal_Bool SAL_CALL
+ suspend( sal_Bool /* bSuspend */ )
+ throw( uno::RuntimeException )
+ {
+ return sal_False;
+ }
+
+ virtual uno::Any SAL_CALL getViewData()
+ throw( uno::RuntimeException )
+ {
+ return uno::Any();
+ }
+
+ virtual void SAL_CALL restoreViewData( const uno::Any& /* data */ )
+ throw ( uno::RuntimeException )
+ {
+ }
+
+ virtual uno::Reference< frame::XModel > SAL_CALL
+ getModel()
+ throw ( uno::RuntimeException )
+ {
+ return m_xModel;
+ }
+
+ virtual uno::Reference< frame::XFrame > SAL_CALL
+ getFrame()
+ throw ( uno::RuntimeException )
+ {
+ return m_xFrame;
+ }
+
+ virtual void SAL_CALL
+ dispose()
+ throw ( uno::RuntimeException )
+ {
+ }
+
+ virtual void SAL_CALL
+ addEventListener( const uno::Reference< lang::XEventListener >& /* xListener */ )
+ throw ( uno::RuntimeException )
+ {
+ }
+
+ virtual void SAL_CALL
+ removeEventListener( const uno::Reference< lang::XEventListener >& /* xListener */ )
+ throw ( uno::RuntimeException )
+ {
+ }
+ };
+
+protected:
+ DocumentImpl( const uno::Reference< uno::XComponentContext > context ):
+ m_rContext( context )
+ {
+ }
+
+ virtual ~DocumentImpl()
+ {
+ }
+
+ // XInitialization
+ virtual void SAL_CALL
+ initialize( const uno::Sequence< uno::Any >& arguments )
+ throw ( uno::Exception, uno::RuntimeException )
+ {
+ if ( arguments.getLength() != 1 )
+ throw lang::IllegalArgumentException( OUString(), static_cast<uno::Reference< uno::XInterface> >(this), 1 );
+
+ uno::Sequence< beans::NamedValue > settings;
+ if ( arguments[0] >>= m_sURI )
+ {
+ // create( [in] string uri );
+ uno::Reference< frame::XDesktop > desktop( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.frame.Desktop", m_rContext ), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XComponentLoader > componentLoader( desktop, uno::UNO_QUERY_THROW );
+
+ (void) componentLoader;
+
+ beans::PropertyValues loadProps(3);
+ loadProps[0].Name = "Hidden";
+ loadProps[0].Value <<= sal_Bool(true);
+ loadProps[1].Name = "ReadOnly";
+ loadProps[1].Value <<= sal_Bool(true);
+ loadProps[2].Name = "Preview";
+ loadProps[2].Value <<= sal_Bool(true);
+
+ m_xComponent = componentLoader->loadComponentFromURL( m_sURI, "_blank", 0, loadProps );
+
+ 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_xRenderable = uno::Reference< view::XRenderable >(m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.view.Renderable", m_rContext ), uno::UNO_QUERY_THROW );
+
+ m_xController = new MyXController();
+
+ m_aRenderProps.realloc( 3 );
+ m_aRenderProps[0].Name = "IsPrinter";
+ m_aRenderProps[0].Value <<= sal_Bool(true);
+ m_aRenderProps[1].Name = "RenderDevice";
+ m_aRenderProps[1].Value <<= device;
+ m_aRenderProps[2].Name = "View";
+ m_aRenderProps[2].Value <<= m_xController;
+ }
+ }
+
+ // XDocument
+ virtual sal_Int32 SAL_CALL
+ getNumberOfPages()
+ throw ( uno::RuntimeException )
+ {
+ uno::Any selection;
+ selection <<= m_xComponent;
+
+ return m_xRenderable->getRendererCount( selection, m_aRenderProps );
+ }
+
+ virtual void SAL_CALL
+ render( sal_Int64 buffer,
+ sal_Int32 bufferSize,
+ const uno::Reference< XDocumentRenderCallback >& listener,
+ sal_Int32 pageNo,
+ sal_Int32 zoomLevel,
+ sal_Int32 x,
+ sal_Int32 y )
+ throw ( lang::IllegalArgumentException, uno::RuntimeException)
+ {
+ (void) buffer;
+ (void) bufferSize;
+ (void) listener;
+ (void) pageNo;
+ (void) zoomLevel;
+ (void) x;
+ (void) y ;
+ }
+
+};
+
+} } } // namespace org::libreoffice::touch
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */