Kill dead <touch/touch.h> API

Has all been obsoleted by LibreOfficeKit.

Only some MOBILE_* constant #defines are now left in touch.h, but probably
those are used only by dead code.

Change-Id: I646945c4408b4e6cd5510da535cfc12088dd391c
This commit is contained in:
Tor Lillqvist
2015-03-24 15:30:27 +02:00
parent 38c22ed2b8
commit 4cc1bcbaed
14 changed files with 2 additions and 830 deletions
+2 -2
View File
@@ -98,9 +98,9 @@ WHOLELIBS = \
-Wl,--no-whole-archive
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx dummies.cxx $(ALL_STATIC_LIBS)
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
mkdir -p $(OBJLOCAL)
$(CXX) -Wl,--gc-sections -Wl,--version-script=../../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx dummies.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lgnustl_static -lGLESv2 -landroid -ljnigraphics -llog -lz
$(CXX) -Wl,--gc-sections -Wl,--version-script=../../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lgnustl_static -lGLESv2 -landroid -ljnigraphics -llog -lz
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
mkdir -p $(SODEST)
@@ -1,75 +0,0 @@
/* -*- 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/.
*/
// Dummy implementations of the callback functions in the UI layer
// that the LO layer calls. As this experimental Android app doesn't
// handle any of that, these do nothing.
#include <android/log.h>
#include <touch/touch.h>
extern "C"
__attribute__ ((visibility("default")))
void
touch_ui_selection_start(MLOSelectionKind kind,
const void *documentHandle,
MLORect *rectangles,
int rectangleCount,
void *preview)
{
}
extern "C"
__attribute__ ((visibility("default")))
void
touch_ui_selection_resize_done(bool success,
const void *documentHandle,
MLORect *rectangles,
int rectangleCount)
{
}
extern "C"
__attribute__ ((visibility("default")))
void
touch_ui_selection_none()
{
}
static const char *
dialog_kind_to_string(MLODialogKind kind)
{
switch (kind) {
case MLODialogMessage:
return "MSG";
case MLODialogInformation:
return "INF";
case MLODialogWarning:
return "WRN";
case MLODialogError:
return "ERR";
case MLODialogQuery:
return "QRY";
default:
return "WTF";
}
}
extern "C"
__attribute__ ((visibility("default")))
MLODialogResult
touch_ui_dialog_modal(MLODialogKind kind, const char *message)
{
__android_log_print(ANDROID_LOG_INFO, "===> %s: %s", dialog_kind_to_string(kind), message);
return MLODialogOK;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-74
View File
@@ -1,74 +0,0 @@
/* -*- 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/.
*/
// Dummy implementations of the callback functions in the UI layer
// that the LO layer calls. As this experimental Android app doesn't
// handle any of that, these do nothing.
#include <android/log.h>
#include <touch/touch.h>
extern "C"
__attribute__ ((visibility("default")))
void
touch_ui_selection_start(MLOSelectionKind kind,
const void *documentHandle,
MLORect *rectangles,
int rectangleCount,
void *preview)
{
}
extern "C"
__attribute__ ((visibility("default")))
void
touch_ui_selection_resize_done(bool success,
const void *documentHandle,
MLORect *rectangles,
int rectangleCount)
{
}
extern "C"
__attribute__ ((visibility("default")))
void
touch_ui_selection_none()
{
}
static const char *
dialog_kind_to_string(MLODialogKind kind)
{
switch (kind) {
case MLODialogMessage:
return "MSG";
case MLODialogInformation:
return "INF";
case MLODialogWarning:
return "WRN";
case MLODialogError:
return "ERR";
case MLODialogQuery:
return "QRY";
default:
return "WTF";
}
}
extern "C"
__attribute__ ((visibility("default")))
MLODialogResult
touch_ui_dialog_modal(MLODialogKind kind, const char *message)
{
__android_log_print(ANDROID_LOG_INFO, "===> %s: %s", dialog_kind_to_string(kind), message);
return MLODialogOK;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-37
View File
@@ -1,37 +0,0 @@
/* -*- 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 INCLUDED_TOUCH_TOUCH_IMPL_H
#define INCLUDED_TOUCH_TOUCH_IMPL_H
#ifdef __cplusplus
extern "C" {
#if 0
} // To avoid an editor indenting all inside the extern "C"
#endif
#endif
// "Implementation" of touch_lo_* functions, called on the LO thread through
// the PostUserEvent mechanism. Not called by UI thread code.
void touch_lo_selection_start_move_impl(const void *documentHandle,
int x,
int y);
void touch_lo_selection_end_move_impl(const void *documentHandle,
int x,
int y);
#ifdef __cplusplus
}
#endif
#endif // INCLUDED_TOUCH_TOUCH_IMPL_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-245
View File
@@ -10,255 +10,10 @@
#ifndef INCLUDED_TOUCH_TOUCH_H
#define INCLUDED_TOUCH_TOUCH_H
#include <config_features.h>
#define MOBILE_MAX_ZOOM_IN 600
#define MOBILE_MAX_ZOOM_OUT 80
#define MOBILE_ZOOM_SCALE_MULTIPLIER 10000
#if !HAVE_FEATURE_DESKTOP
// Let's try this way: Use Quartz 2D types for iOS, and LO's basegfx
// types for others, when/if this API is used for others. But of
// course, it is quite likely that some degree of redesign is needed
// at such a stage anyway...
#ifdef IOS
#include <premac.h>
#include <CoreGraphics/CoreGraphics.h>
#include <postmac.h>
#else
#include <basegfx/range/b1drange.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/tuple/b2dtuple.hxx>
#endif
#ifdef __cplusplus
extern "C" {
#if 0
} // To avoid an editor indenting all inside the extern "C"
#endif
#endif
// These functions are the interface between the upper GUI layers of a
// LibreOffice-based app on a touch platform app and the lower "core"
// layers, used in cases where the core parts need to call
// functionality in the upper parts or vice versa.
//
// Thus there are two classes of functions here:
//
// 1) Those to be implemented in the upper layer and called by the
// lower layer. Prefixed by touch_ui_. The same API is used on each
// such platform. There are called from low level LibreOffice
// code. Note that these are just declared here in a header for a
// "touch" module, the per-platform implementations are elsewhere.
void touch_ui_damaged(int minX, int minY, int width, int height);
void touch_ui_show_keyboard();
void touch_ui_hide_keyboard();
bool touch_ui_keyboard_visible();
// Dialogs, work in progress, no clear plan yet what to do
typedef enum {
MLODialogMessage,
MLODialogInformation,
MLODialogWarning,
MLODialogError,
MLODialogQuery
} MLODialogKind;
typedef enum {
MLODialogOK,
MLODialogCancel,
MLODialogNo,
MLODialogYes,
MLODialogRetry,
MLODialogIgnore,
} MLODialogResult;
MLODialogResult touch_ui_dialog_modal(MLODialogKind kind, const char *message);
typedef enum {
MLOSelectionNone,
MLOSelectionText,
MLOSelectionGraphic
} MLOSelectionKind;
#ifdef IOS
typedef CGRect MLORect;
typedef CGFloat MLODpx;
typedef CGPoint MLODpxPoint;
typedef CGSize MLODpxSize;
#else
// Very much work in progress, just something to make this compile
typedef basegfx::B2DRange MLORect;
typedef float MLODpx;
typedef basegfx::B2DTuple MLODpxPoint;
typedef basegfx::B1DRange MLODpxSize;
#endif
// MLORip - tens of TWIPs, of questionable usefuless
typedef long long MLORip;
static const MLORip LO_TWIPS_TO_MLO_RIP_RATIO = 1L;
struct MLORipSize
{
MLORip width;
MLORip height;
};
typedef struct MLORipSize MLORipSize;
struct MLORipPoint
{
MLORip x;
MLORip y;
};
typedef struct MLORipPoint MLORipPoint;
static inline MLODpx
MLODpxByRip(MLORip rip)
{
return (MLODpx) (rip / LO_TWIPS_TO_MLO_RIP_RATIO);
}
static inline MLORip
MLORipByDpx(MLODpx dpx)
{
return (MLORip) (dpx * LO_TWIPS_TO_MLO_RIP_RATIO);
}
static inline MLODpxPoint
MLODpxPointByDpxes(MLODpx x, MLODpx y)
{
#ifdef IOS
return CGPointMake(x, y);
#else
return basegfx::B2DTuple(x, y);
#endif
}
#ifdef IOS
static inline MLODpxSize
MLODpxSizeByDpxes(MLODpx width, MLODpx height)
{
return CGSizeMake(width, height);
}
static inline MLORipSize
MLORipSizeByRips(MLORip width, MLORip height)
{
MLORipSize ripSize; ripSize.width = width; ripSize.height = height; return ripSize;
}
static inline MLORipPoint
MLORipPointByRips(MLORip x, MLORip y)
{
MLORipPoint point; point.x = x; point.y = y; return point;
}
static inline MLORipSize
MLORipSizeByDpxSize(MLODpxSize dpxSize)
{
MLORipSize ripSize;
ripSize.width = MLORipByDpx(dpxSize.width);
ripSize.height = MLORipByDpx(dpxSize.height);
return ripSize;
}
static inline MLODpxSize
MLODpxSizeByRips(MLORip width, MLORip height)
{
CGFloat fWidth = MLODpxByRip(width);
CGFloat fHeight = MLODpxByRip(height);
return CGSizeMake(fWidth, fHeight);
}
static inline MLODpxSize
MLODpxSizeByRipSize(MLORipSize ripSize)
{
return MLODpxSizeByRips(ripSize.width, ripSize.height);
}
MLORipPoint MLORipPointByDpxPoint(MLODpxPoint mloDpxPoint);
MLODpxPoint MLODpxPointByMLORipPoint(MLORipPoint mloRipPoint);
#endif
// selection
void touch_ui_selection_start(MLOSelectionKind kind,
const void *documentHandle,
MLORect *rectangles,
int rectangleCount,
void *preview);
void touch_ui_selection_resize_done(bool success,
const void *documentHandle,
MLORect *rectangles,
int rectangleCount);
void touch_ui_selection_none();
// 2) Those implemented in the lower layers to be called by the upper
// layer, in cases where we don't want to include a bunch of the
// "normal" LibreOffice C++ headers in an otherwise purely Objective-C
// CocoaTouch-based source file. Of course it depends on the case
// where that is wanted, and this all is work in progress. Prefixed by
// touch_lo_. All these are called on the UI thread and except for
// those so marked schedule work to be done asynchronously on the LO
// thread.
typedef enum { DOWN, MOVE, UP} MLOMouseButtonState;
typedef enum { NONE, SHIFT, META } MLOModifiers;
typedef int MLOModifierMask;
void touch_lo_keyboard_did_hide();
void touch_lo_set_view_size(int width, int height);
void touch_lo_tap(int x, int y);
void touch_lo_mouse(int x, int y, MLOMouseButtonState state, MLOModifierMask modifiers);
void touch_lo_pan(int deltaX, int deltaY);
void touch_lo_zoom(int x, int y, float scale);
void touch_lo_keyboard_input(int c);
void touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight);
MLODpxSize touch_lo_get_content_size();
void touch_lo_mouse_drag(int x, int y, MLOMouseButtonState state);
// Move the start of the selection to (x,y)
void touch_lo_selection_start_move(const void *documentHandle,
int x,
int y);
// Move the end of the selection to (x,y)
void touch_lo_selection_end_move(const void *documentHandle,
int x,
int y);
void touch_lo_selection_attempt_resize(const void *documentHandle,
MLORect *selectedRectangles,
int numberOfRectangles);
// Special case: This is the function that is called in the newly
// created LO thread to run the LO code.
void touch_lo_runMain();
#ifdef __cplusplus
}
#endif
#endif // HAVE_FEATURE_DESKTOP
#endif // INCLUDED_TOUCH_TOUCH_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-1
View File
@@ -1038,7 +1038,6 @@
#include <tools/stream.hxx>
#include <tools/time.hxx>
#include <tools/urlobj.hxx>
#include <touch/touch-impl.h>
#include <touch/touch.h>
#include <ucbhelper/content.hxx>
#include <ucbhelper/contentidentifier.hxx>
-4
View File
@@ -64,10 +64,6 @@
#include <IDocumentLayoutAccess.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#if defined(IOS)
#include <touch/touch.h>
#endif
using namespace com::sun::star;
using namespace util;
-11
View File
@@ -53,7 +53,6 @@
#include <boost/scoped_ptr.hpp>
#include <touch/touch.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <paintfrm.hxx>
@@ -385,16 +384,6 @@ void SwSelPaintRects::Show()
}
}
#if !HAVE_FEATURE_DESKTOP
extern "C" void touch_lo_selection_attempt_resize(const void * /* documentHandle */,
MLORect * /* selectedRectangles */,
int /* numberOfRectangles */)
{
}
#endif
void SwSelPaintRects::HighlightInputFld()
{
std::vector< basegfx::B2DRange > aInputFldRanges;
-52
View File
@@ -19,8 +19,6 @@
#include <config_features.h>
#include <touch/touch.h>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <sfx2/viewfrm.hxx>
#include <sfx2/progress.hxx>
@@ -1833,56 +1831,6 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
setTiledRendering(bTiledRendering);
}
#if !HAVE_FEATURE_DESKTOP
extern "C"
MLODpxSize touch_lo_get_content_size()
{
#ifdef IOS
SwWrtShell *pViewShell;
// FIXME: make sure this is not called before we have a document...
while (!(pViewShell = GetActiveWrtShell()))
{
sleep(1);
}
if (pViewShell)
{
static const MLORip WIDTH_ADDITION = 6L * DOCUMENTBORDER;
static const MLORip HEIGHT_ADDITION = 2L * DOCUMENTBORDER;
Size documentSize =pViewShell->GetView().GetDocSz();
return MLODpxSizeByRips(((MLORip)documentSize.Width()) + WIDTH_ADDITION,
((MLORip)documentSize.Height()) + HEIGHT_ADDITION);
}
return MLODpxSizeByDpxes(0,0);
#else
return MLODpxSize();
#endif
}
extern "C"
MLORipPoint MLORipPointByDpxPoint(MLODpxPoint mloDpxPoint)
{
#ifdef IOS
//MLODpxSize contentSize = touch_lo_get_content_size();
MLORip x = MLORipByDpx(mloDpxPoint.x /*- (contentSize.width/2.0f)*/);
MLORip y = MLORipByDpx(mloDpxPoint.y);
return MLORipPointByRips(x,y);
#else
(void) mloDpxPoint;
return MLORipPoint();
#endif
}
extern "C"
MLODpxPoint MLODpxPointByRipPoint(MLORipPoint mloRipPoint)
{
//MLODpxSize contentSize = touch_lo_get_content_size();
MLODpx x = MLODpxByRip(mloRipPoint.x)/* + (contentSize.width/2.0f)*/;
MLODpx y = MLODpxByRip(mloRipPoint.y);
return MLODpxPointByDpxes(x,y);
}
#endif
void SwViewShell::SetBrowseBorder( const Size& rNew )
{
if( rNew != maBrowseBorder )
-82
View File
@@ -68,7 +68,6 @@
#include <basegfx/color/bcolortools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <touch/touch-impl.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <editeng/acorrcfg.hxx>
@@ -2703,87 +2702,6 @@ static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos)
return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId();
}
#if !HAVE_FEATURE_DESKTOP
// As such these two functions could be more or less anywhere, I have
// them now in this source file because the act of moving a selection
// end point is somewhat the same as what happens when one
// shift-clicks on either side of an existing selection.
void touch_lo_selection_start_move_impl(const void *documentHandle,
int x,
int y)
{
SwWrtShell *pWrtShell = reinterpret_cast<SwWrtShell*>(const_cast<void*>(documentHandle));
if (!pWrtShell)
return;
const OutputDevice *pOut = pWrtShell->GetWin();
if (!pOut)
pOut = pWrtShell->GetOut();
const Point aDocPos( pOut->PixelToLogic( Point(x, y) ) );
// Don't allow moving the start of the selection beyond the end
// (point) of the selection.
SwRect startCharRect;
pWrtShell->GetCharRectAt(startCharRect, pWrtShell->GetCrsr()->GetPoint());
const Point startCharPos = startCharRect.Center();
if (startCharPos.Y() < aDocPos.Y() ||
(startCharPos.Y() == aDocPos.Y() && startCharPos.X() - startCharRect.Width() <= aDocPos.X()))
return;
pWrtShell->ChgCurrPam( aDocPos );
// Keep mark normally at the start and point at the end,
// just exchange for the duration of moving the start.
pWrtShell->GetCrsr()->Exchange();
{
SwMvContext aMvContext( pWrtShell );
pWrtShell->SwCrsrShell::SetCrsr( aDocPos );
}
pWrtShell->GetCrsr()->Exchange();
}
void touch_lo_selection_end_move_impl(const void *documentHandle,
int x,
int y)
{
SwWrtShell *pWrtShell = reinterpret_cast<SwWrtShell*>(const_cast<void*>(documentHandle));
if (!pWrtShell)
return;
const OutputDevice *pOut = pWrtShell->GetWin();
if (!pOut)
pOut = pWrtShell->GetOut();
const Point aDocPos( pOut->PixelToLogic( Point(x, y) ) );
// Don't allow moving the end of the selection beyond the start
// (mark) of the selection.
SwRect endCharRect;
pWrtShell->GetCharRectAt(endCharRect, pWrtShell->GetCrsr()->GetMark());
const Point endCharPos = endCharRect.Center();
if (endCharPos.Y() > aDocPos.Y() ||
(endCharPos.Y() == aDocPos.Y() && endCharPos.X() + endCharRect.Width() >= aDocPos.X()))
return;
pWrtShell->ChgCurrPam( aDocPos );
{
SwMvContext aMvContext( pWrtShell );
pWrtShell->SwCrsrShell::SetCrsr( aDocPos );
}
}
#endif
void SwEditWin::MoveCursor( SwWrtShell &rSh, const Point& rDocPos,
const bool bOnlyText, bool bLockView )
{
-17
View File
@@ -19,7 +19,6 @@
#include <osl/detail/android-bootstrap.h>
#include <rtl/strbuf.hxx>
#include <basebmp/scanlineformats.hxx>
#include <touch/touch.h>
#include <vcl/settings.hxx>
#define LOGTAG "LibreOffice/androidinst"
@@ -543,20 +542,4 @@ Java_org_libreoffice_android_AppSupport_scroll(JNIEnv * /* env */,
LOGW("No focused frame to emit event on");
}
extern "C" void
touch_ui_show_keyboard()
{
}
extern "C" void
touch_ui_hide_keyboard()
{
}
extern "C" bool
touch_ui_keyboard_visible()
{
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-15
View File
@@ -44,21 +44,6 @@ public:
SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
SalFrame *getFocusFrame() const;
// Functions scheduled to be run as "user events" in the LO thread
DECL_LINK( DisplayConfigurationChanged, void* );
typedef struct {
const void *documentHandle;
int x, y;
} SelectionStartMoveArg;
DECL_LINK( SelectionStartMove, SelectionStartMoveArg* );
typedef struct {
const void *documentHandle;
int x, y;
} SelectionEndMoveArg;
DECL_LINK( SelectionEndMove, SelectionEndMoveArg* );
};
#endif // INCLUDED_VCL_INC_IOS_IOSINST_HXX
-211
View File
@@ -22,8 +22,6 @@
#include <postmac.h>
#include <basebmp/scanlineformats.hxx>
#include <touch/touch.h>
#include <touch/touch-impl.h>
#include "ios/iosinst.hxx"
#include "headless/svpdummies.hxx"
@@ -236,213 +234,4 @@ int IosSalSystem::ShowNativeDialog( const OUString& rTitle,
return 0;
}
IMPL_LINK( IosSalInstance, DisplayConfigurationChanged, void*, )
{
for( std::list< SalFrame* >::const_iterator it = getFrames().begin();
it != getFrames().end();
++it ) {
(*it)->Show( false, false );
(*it)->CallCallback( SALEVENT_SETTINGSCHANGED, 0 );
(*it)->SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT);
(*it)->Show( true, false );
}
return 0;
}
extern "C"
void touch_lo_set_view_size(int width, int height)
{
int oldWidth = viewWidth;
viewWidth = width;
viewHeight = height;
if (oldWidth > 1) {
// Inform about change in display size (well, just orientation
// presumably).
IosSalInstance *pInstance = IosSalInstance::getInstance();
if ( pInstance == NULL )
return;
Application::PostUserEvent( LINK( pInstance, IosSalInstance, DisplayConfigurationChanged ), NULL );
}
}
extern "C"
void
touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight){
CGDataProviderRef provider =CGDataProviderCreateWithData(NULL,
source,
sourceHeight * sourceBytesPerRow,
NULL );
CGImage *sourceImage = CGImageCreate(sourceWidth,
sourceHeight,
8,
32,
sourceBytesPerRow,
CGColorSpaceCreateDeviceRGB(),
kCGImageAlphaNoneSkipLast,
provider,
NULL,
false,
kCGRenderingIntentDefault );
CGContextRef context =(CGContextRef) target;
CGRect targetRect = CGRectMake( 0, 0, targetWidth, targetHeight );
CGContextDrawImage( context, targetRect, sourceImage );
CGImageRelease(sourceImage);
CGDataProviderRelease(provider);
}
extern "C"
void touch_lo_tap(int x, int y)
{
touch_lo_mouse(x, y, DOWN, NONE);
touch_lo_mouse(x, y, UP, NONE);
}
extern "C"
void touch_lo_mouse(int x, int y, MLOMouseButtonState state, MLOModifierMask modifiers)
{
SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame();
if (pFocus) {
MouseEvent aEvent;
sal_uLong nEvent;
sal_uInt16 nModifiers = 0;
if (modifiers & SHIFT)
nModifiers |= KEY_SHIFT;
if (modifiers & META)
nModifiers |= KEY_MOD1;
switch (state) {
case DOWN:
aEvent = MouseEvent(Point(x, y), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT, nModifiers);
nEvent = VCLEVENT_WINDOW_MOUSEBUTTONDOWN;
break;
case MOVE:
aEvent = MouseEvent(Point(x, y), 1, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT, nModifiers);
nEvent = VCLEVENT_WINDOW_MOUSEMOVE;
break;
case UP:
aEvent = MouseEvent(Point(x, y), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT, nModifiers);
nEvent = VCLEVENT_WINDOW_MOUSEBUTTONUP;
break;
default:
assert(false);
}
Application::PostMouseEvent(nEvent, pFocus->GetWindow(), &aEvent);
}
}
extern "C"
void touch_lo_mouse_drag(int x, int y, MLOMouseButtonState state)
{
touch_lo_mouse(x, y, state, NONE);
}
extern "C"
void touch_lo_pan(int deltaX, int deltaY)
{
SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame();
if (pFocus) {
SAL_INFO( "vcl.ios", "pan delta: " << "(" << deltaX << "," << deltaY << ") ");
ScrollEvent aEvent( deltaX, deltaY );
Application::PostScrollEvent(VCLEVENT_WINDOW_SCROLL, pFocus->GetWindow(), &aEvent);
}
}
extern "C"
void touch_lo_zoom(int x, int y, float scale)
{
SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame();
if (pFocus) {
SAL_INFO( "vcl.ios", "pinch: " << "(" << scale << ") ");
ZoomEvent aEvent( Point(x,y), scale);
Application::PostZoomEvent(VCLEVENT_WINDOW_ZOOM, pFocus->GetWindow(), &aEvent);
}
}
extern "C"
void touch_lo_keyboard_input(int c)
{
SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame();
if (pFocus) {
KeyEvent aEvent(c, c, 0);
Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
}
}
extern "C"
void touch_lo_keyboard_did_hide()
{
// Tell LO it has lost "focus", which will cause it to stop
// displaying any text insertion cursor etc
SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame();
if (pFocus) {
MouseEvent aEvent;
aEvent = MouseEvent(Point(0, 0), 0, MouseEventModifiers::LEAVEWINDOW, MOUSE_LEFT);
Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEMOVE, pFocus->GetWindow(), &aEvent);
}
}
IMPL_LINK( IosSalInstance, SelectionStartMove, SelectionStartMoveArg*, pArg )
{
touch_lo_selection_start_move_impl(pArg->documentHandle, pArg->x, pArg->y);
delete pArg;
return 0;
}
extern "C"
void touch_lo_selection_start_move(const void *documentHandle,
int x,
int y)
{
IosSalInstance *pInstance = IosSalInstance::getInstance();
if ( pInstance == NULL )
return;
IosSalInstance::SelectionStartMoveArg *pArg = new IosSalInstance::SelectionStartMoveArg;
pArg->documentHandle = documentHandle;
pArg->x = x;
pArg->y = y;
Application::PostUserEvent( LINK( pInstance, IosSalInstance, SelectionStartMove), pArg );
}
IMPL_LINK( IosSalInstance, SelectionEndMove, SelectionEndMoveArg*, pArg )
{
touch_lo_selection_end_move_impl(pArg->documentHandle, pArg->x, pArg->y);
delete pArg;
return 0;
}
extern "C"
void touch_lo_selection_end_move(const void *documentHandle,
int x,
int y)
{
IosSalInstance *pInstance = IosSalInstance::getInstance();
if ( pInstance == NULL )
return;
IosSalInstance::SelectionEndMoveArg *pArg = new IosSalInstance::SelectionEndMoveArg;
pArg->documentHandle = documentHandle;
pArg->x = x;
pArg->y = y;
Application::PostUserEvent( LINK( pInstance, IosSalInstance, SelectionEndMove), pArg );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-4
View File
@@ -49,10 +49,6 @@
#include <iostream>
#if !HAVE_FEATURE_DESKTOP
#include <touch/touch.h>
#endif
static OString ImplGetDialogText( Dialog* pDialog )
{
OStringBuffer aErrorStr(OUStringToOString(