Kaydet (Commit) 16e1f719 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Bin dead code

Change-Id: Ie4546ef2518b0255008299845042a8ffb50eb17a
üst 45885587
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# 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_UnoApiTarget_get_target,udkapi) \
$(call gb_Executable_get_runtime_dependencies,javamaker) | $(touch_javamaker_DIR)/.dir
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),JVM,1)
$(call gb_Helper_abbreviate_dirs, \
rm -r $(touch_javamaker_DIR) && \
$(call gb_Helper_execute,javamaker -nD -O$(touch_javamaker_DIR)/class -X$(call gb_UnoApiTarget_get_target,udkapi) $<) && touch $@)
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# 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,touch/idl))
$(eval $(call gb_InternalUnoApi_use_api,touch,\
udkapi \
))
$(eval $(call gb_InternalUnoApi_define_api_dependencies,touch, \
offapi,\
udkapi \
))
$(eval $(call gb_InternalUnoApi_add_idlfiles,touch,org/libreoffice/touch,\
Document \
XDocument \
XDocumentRenderCallback \
))
# vim: set noet sw=4 ts=4:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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 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: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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 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.
// 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.
// width and height must be powers of two
// 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 width,
[in] long height,
[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: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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 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: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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/XBitmap.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XToolkitExperimental.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/Desktop.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 ::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< awt::XToolkitExperimental > m_xToolkit;
uno::Reference< frame::XController > m_xController;
// 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:
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()
{
}
public:
// 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::XDesktop2 > desktop = frame::Desktop::create( m_rContext );
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 = desktop->loadComponentFromURL( m_sURI, "_blank", 0, loadProps );
m_xToolkit = uno::Reference< awt::XToolkitExperimental >( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.awt.ToolkitExperimental", m_rContext ), uno::UNO_QUERY_THROW );
m_xController = new MyXController();
}
}
// XDocument
virtual sal_Int32 SAL_CALL
getNumberOfPages()
throw ( uno::RuntimeException )
{
uno::Any selection;
selection <<= m_xComponent;
uno::Reference< awt::XDevice > device;
uno::Reference< view::XRenderable > renderable;
beans::PropertyValues renderProps;
device = m_xToolkit->createScreenCompatibleDevice( 128, 128 );
renderable = uno::Reference< view::XRenderable >( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.view.Renderable", m_rContext ), uno::UNO_QUERY_THROW );
renderProps.realloc( 3 );
renderProps[0].Name = "IsPrinter";
renderProps[0].Value <<= sal_Bool(true);
renderProps[1].Name = "RenderDevice";
renderProps[1].Value <<= device;
renderProps[2].Name = "View";
renderProps[2].Value <<= m_xController;
return renderable->getRendererCount( selection, renderProps );
}
virtual void SAL_CALL
render( sal_Int64 buffer,
sal_Int32 width,
sal_Int32 height,
const uno::Reference< XDocumentRenderCallback >& listener,
sal_Int32 pageNo,
sal_Int32 zoomLevel,
sal_Int32 x,
sal_Int32 y )
throw ( lang::IllegalArgumentException, uno::RuntimeException)
{
(void) listener;
(void) zoomLevel;
(void) x;
(void) y;
uno::Any selection;
selection <<= m_xComponent;
uno::Reference< awt::XDevice > device( m_xToolkit->createScreenCompatibleDeviceUsingBuffer( width, height, 1, 1, 0, 0, buffer ) );
beans::PropertyValues renderProps;
renderProps.realloc( 3 );
renderProps[0].Name = "IsPrinter";
renderProps[0].Value <<= sal_Bool(true);
renderProps[1].Name = "RenderDevice";
renderProps[1].Value <<= device;
renderProps[2].Name = "View";
renderProps[2].Value <<= m_xController;
uno::Reference< view::XRenderable > renderable( m_rContext->getServiceManager()->createInstanceWithContext( "com.sun.star.view.Renderable", m_rContext ), uno::UNO_QUERY_THROW );
renderable->render( pageNo, selection, renderProps );
}
};
} } } // namespace org::libreoffice::touch
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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