summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2011-07-14 11:02:21 +0300
committerTor Lillqvist <tml@iki.fi>2011-07-14 23:58:01 +0300
commit5a7834cd3e6e73ec9c19f3ff057aacba59e3f9a3 (patch)
treec31868e985a0d17fbcc616575cb278cc8e4a88c6
parentd08bf1ca63e51c950ed0bc84b6f1d5232ae97f38 (diff)
iOS hacking
Add some trivialish first attempts at iOS-specific headers and some source files that surely are quite bogus and does nothing sane, but must start with something. Mostly based on the MacOSX ("aqua") code.
-rw-r--r--vcl/Library_vcl.mk33
-rw-r--r--vcl/StaticLibrary_vclmain.mk8
-rw-r--r--vcl/inc/ios/iosvcltypes.h37
-rw-r--r--vcl/inc/ios/salbmp.h117
-rw-r--r--vcl/inc/ios/salcolorutils.hxx46
-rw-r--r--vcl/inc/ios/saldata.hxx126
-rw-r--r--vcl/inc/ios/salframe.h208
-rw-r--r--vcl/inc/ios/salframeview.h144
-rw-r--r--vcl/inc/ios/salgdi.h401
-rw-r--r--vcl/inc/ios/salinst.h199
-rw-r--r--vcl/inc/ios/salmathutils.hxx90
-rw-r--r--vcl/inc/ios/salmenu.h122
-rw-r--r--vcl/inc/ios/salnstimer.h43
-rw-r--r--vcl/inc/ios/salobj.h86
-rw-r--r--vcl/inc/ios/salprn.h173
-rw-r--r--vcl/inc/ios/salsys.h56
-rw-r--r--vcl/inc/ios/saltimer.h54
-rw-r--r--vcl/inc/ios/saluimenu.h62
-rw-r--r--vcl/inc/ios/salvd.h79
-rw-r--r--vcl/inc/ios/vcluiapp.h53
-rw-r--r--vcl/inc/vcl/bitmap.hxx2
-rw-r--r--vcl/inc/vcl/sysdata.hxx23
-rw-r--r--vcl/ios/source/app/saldata.cxx128
-rw-r--r--vcl/ios/source/app/salinst.cxx828
-rw-r--r--vcl/ios/source/app/salnstimer.mm59
-rw-r--r--vcl/ios/source/app/salsys.cxx253
-rw-r--r--vcl/ios/source/app/saltimer.cxx104
-rw-r--r--vcl/ios/source/app/vcluiapp.mm101
-rw-r--r--vcl/source/salmain/salmain.cxx2
-rw-r--r--vcl/source/window/syschild.cxx3
-rw-r--r--vcl/source/window/window.cxx10
31 files changed, 3644 insertions, 6 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 977facc72a1f..42e57144d5f4 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -236,7 +236,23 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
))
$(eval $(call gb_Library_add_nativeres,vcl,src))
+endif
+ifeq ($(GUIBASE),cocoatouch)
+$(eval $(call gb_Library_set_cxxflags,vcl,\
+ $$(CXXFLAGS) \
+ $$(OBJCXXFLAGS) \
+))
+$(eval $(call gb_Library_add_objcxxobjects,vcl,\
+ vcl/ios/source/app/salnstimer \
+ vcl/ios/source/app/vcluiapp \
+))
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+ vcl/ios/source/app/saldata \
+ vcl/ios/source/app/salinst \
+ vcl/ios/source/app/salsys \
+ vcl/ios/source/app/saltimer \
+))
endif
$(eval $(call gb_Library_add_cobjects,vcl,\
@@ -372,7 +388,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/helper/strhelper \
vcl/source/helper/threadex \
vcl/source/helper/xconnection \
- vcl/source/salmain/salmain \
vcl/source/window/abstdlg \
vcl/source/window/accel \
vcl/source/window/accmgr \
@@ -421,7 +436,11 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/window/wpropset \
vcl/source/window/wrkwin \
))
-
+ifneq ($(OS),IOS)
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+ vcl/source/salmain/salmain \
+))
+endif
## handle Graphite
ifneq ($(ENABLE_GRAPHITE),)
$(eval $(call gb_Library_set_defs,vcl,\
@@ -554,4 +573,14 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\
winspool \
))
endif
+
+ifeq ($(GUIBASE),cocoatouch)
+$(eval $(call gb_Library_set_ldflags,vcl,\
+ $$(LDFLAGS) \
+ -framework UIKit \
+ -framework CoreFoundation \
+))
+endif
+
+
# vim: set noet sw=4 ts=4:
diff --git a/vcl/StaticLibrary_vclmain.mk b/vcl/StaticLibrary_vclmain.mk
index 79b3ddd3ad5f..4c313f88b082 100644
--- a/vcl/StaticLibrary_vclmain.mk
+++ b/vcl/StaticLibrary_vclmain.mk
@@ -27,6 +27,13 @@
$(eval $(call gb_StaticLibrary_StaticLibrary,vclmain))
+ifeq ($(OS),IOS)
+$(eval $(call gb_StaticLibrary_set_cxxflags,vclmain,\
+ $$(CXXFLAGS) \
+ -x objective-c++ -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 \
+))
+endif
+
$(eval $(call gb_StaticLibrary_set_include,vclmain,\
$$(INCLUDE) \
-I$(realpath $(SRCDIR)/vcl/inc) \
@@ -36,6 +43,7 @@ $(eval $(call gb_StaticLibrary_set_include,vclmain,\
))
$(eval $(call gb_StaticLibrary_add_api,vclmain,\
+ offapi \
udkapi \
))
diff --git a/vcl/inc/ios/iosvcltypes.h b/vcl/inc/ios/iosvcltypes.h
new file mode 100644
index 000000000000..820547b6a013
--- /dev/null
+++ b/vcl/inc/ios/iosvcltypes.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is Tor Lillqvist <tml@iki.fi>
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _IOSVCLTYPES_H
+#define _IOSVCLTYPES_H
+
+#include "premac.h"
+#import <UIKit/UIKit.h>
+#include "postmac.h"
+
+#endif _IOSVCLTYPES_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salbmp.h b/vcl/inc/ios/salbmp.h
new file mode 100644
index 000000000000..0c3e1468b154
--- /dev/null
+++ b/vcl/inc/ios/salbmp.h
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef _SV_SALBMP_H
+#define _SV_SALBMP_H
+
+#include "tools/gen.hxx"
+
+#include "basebmp/bitmapdevice.hxx"
+
+#include "vcl/salbtype.hxx"
+
+#include "ios/salgdi.h"
+
+#include "saldata.hxx"
+#include "salinst.hxx"
+#include "salvd.hxx"
+#include "salbmp.hxx"
+
+#include "salcolorutils.hxx"
+
+
+// --------------
+// - SalBitmap -
+// --------------
+
+struct BitmapBuffer;
+class BitmapColor;
+class BitmapPalette;
+class IosSalVirtualDevice;
+class IosSalGraphics;
+
+class IosSalBitmap : public SalBitmap
+{
+public:
+ CGContextRef mxGraphicContext;
+ mutable CGImageRef mxCachedImage;
+ BitmapPalette maPalette;
+ basebmp::RawMemorySharedArray maUserBuffer;
+ basebmp::RawMemorySharedArray maContextBuffer;
+ sal_uInt16 mnBits;
+ int mnWidth;
+ int mnHeight;
+ sal_uInt32 mnBytesPerRow;
+
+public:
+ IosSalBitmap();
+ virtual ~IosSalBitmap();
+
+public:
+
+ // SalBitmap methods
+ bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
+ bool Create( const SalBitmap& rSalBmp );
+ bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics );
+ bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount );
+ virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
+ Size& rSize,
+ bool bMask = false );
+
+ void Destroy();
+
+ Size GetSize() const;
+ sal_uInt16 GetBitCount() const;
+
+ BitmapBuffer *AcquireBuffer( bool bReadOnly );
+ void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
+
+ bool GetSystemData( BitmapSystemData& rData );
+
+private:
+ // quartz helper
+ bool CreateContext();
+ void DestroyContext();
+ bool AllocateUserData();
+
+ void ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
+ sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
+ sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData );
+
+public:
+ bool Create( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bMirrorVert = true );
+
+public:
+ CGImageRef CreateWithMask( const IosSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const;
+ CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const;
+ CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const;
+};
+
+#endif // _SV_SALBMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salcolorutils.hxx b/vcl/inc/ios/salcolorutils.hxx
new file mode 100644
index 000000000000..d6db5f839e04
--- /dev/null
+++ b/vcl/inc/ios/salcolorutils.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALCOLORUTILS_HXX
+#define _SV_SALCOLORUTILS_HXX
+
+#include "vcl/salbtype.hxx"
+#include "vcl/salgtype.hxx"
+#include "salmathutils.hxx"
+
+// ------------------------------------------------------------------
+
+SalColor GetSalColor( const float* pQuartzColor );
+
+void SetSalColor( const SalColor& rColor, float* pQuartzColor );
+
+// ------------------------------------------------------------------
+
+#endif // _SV_SALCOLORUTILS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/saldata.hxx b/vcl/inc/ios/saldata.hxx
new file mode 100644
index 000000000000..764264e42462
--- /dev/null
+++ b/vcl/inc/ios/saldata.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALDATA_HXX
+#define _SV_SALDATA_HXX
+
+#include "premac.h"
+#include <UIKit/UIKit.h>
+#include "postmac.h"
+
+#include "com/sun/star/uno/Reference.hxx"
+
+#include "vcl/ptrstyle.hxx"
+
+#include "svdata.hxx"
+#include "salwtype.hxx"
+
+#include <list>
+#include <vector>
+#include <map>
+#include <boost/unordered_set.hpp>
+
+#include <cstdio>
+#include <cstdarg>
+
+class IosSalInstance;
+class SalObject;
+class SalFrame;
+class SalVirtualDevice;
+class SalPrinter;
+class SystemFontList;
+
+// ------------------
+// - Some constants -
+// ------------------
+
+#define SAL_CLIPRECT_COUNT 16
+
+#define VER_TIGER 0x1040
+#define VER_LEOPARD 0x1050
+
+// -----------
+// - SalData -
+// -----------
+
+class IosSalFrame;
+struct FrameHash : public boost::hash<sal_IntPtr>
+{
+ size_t operator()(const IosSalFrame* frame) const
+ { return boost::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); }
+};
+
+struct SalData
+{
+
+ SALTIMERPROC mpTimerProc; // timer callback proc
+ IosSalInstance *mpFirstInstance; // pointer of first instance
+ std::list<IosSalFrame*> maFrames; // pointer of first frame
+ boost::unordered_set<const IosSalFrame*,FrameHash> maFrameCheck; // for fast check of frame existance
+ SalObject *mpFirstObject; // pointer of first object window
+ SalVirtualDevice *mpFirstVD; // first VirDev
+ SalPrinter *mpFirstPrinter; // first printing printer
+ SystemFontList *mpFontList;
+
+ CGColorSpaceRef mxRGBSpace;
+ CGColorSpaceRef mxGraySpace;
+ CGColorSpaceRef mxP50Space;
+ CGPatternRef mxP50Pattern;
+
+ std::vector< UIMenuItem* > maFallbackMenu;
+
+ static oslThreadKey s_aAutoReleaseKey;
+
+ SInt32 mnSystemVersion; // Store System Version
+
+ long mnDPIX; // #i100617# read DPI only once per office life
+ long mnDPIY; // #i100617# read DPI only once per office life
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ mxClipboard;
+
+ SalData();
+ ~SalData();
+
+ static void ensureThreadAutoreleasePool();
+ static void drainThreadAutoreleasePool();
+};
+
+inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
+inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
+inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
+
+// --- Prototypes ---
+
+sal_Bool ImplSalYieldMutexTryToAcquire();
+void ImplSalYieldMutexAcquire();
+void ImplSalYieldMutexRelease();
+
+#endif // _SV_SALDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salframe.h b/vcl/inc/ios/salframe.h
new file mode 100644
index 000000000000..14761fe36ebd
--- /dev/null
+++ b/vcl/inc/ios/salframe.h
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALFRAME_H
+#define _SV_SALFRAME_H
+
+#include "vcl/sysdata.hxx"
+
+#include "ios/salmenu.h"
+#include "ios/saldata.hxx"
+#include "ios/iosvcltypes.h"
+
+#include "salframe.hxx"
+
+#include <vector>
+#include <utility>
+#include <stdexcept>
+
+#include <boost/shared_ptr.hpp>
+
+class IosSalGraphics;
+class IosSalFrame;
+class IosSalTimer;
+class IosSalInstance;
+class IosSalMenu;
+class IosBlinker;
+
+typedef struct SalFrame::SalPointerState SalPointerState;
+
+// ----------------
+// - IosSalFrame -
+// ----------------
+
+class IosSalFrame : public SalFrame
+{
+public:
+ UIWindow* mpWindow;
+ UIView* mpView;
+ CGRect maScreenRect; // for mirroring purposes
+ IosSalGraphics* mpGraphics;
+ IosSalFrame* mpParent;
+ SystemEnvData maSysData;
+ int mnMinWidth; // min. client width in pixels
+ int mnMinHeight; // min. client height in pixels
+ int mnMaxWidth; // max. client width in pixels
+ int mnMaxHeight; // max. client height in pixels
+ CGRect maFullScreenRect; // old window size when in FullScreen
+ bool mbGraphics:1; // is Graphics used?
+ bool mbShown:1;
+ bool mbInitShow:1;
+ bool mbPresentation:1;
+
+ sal_uLong mnStyle;
+ unsigned int mnStyleMask; // our style mask from UIWindow creation
+
+ sal_uLong mnLastEventTime;
+ unsigned int mnLastModifierFlags;
+ IosSalMenu* mpMenu;
+
+ SalExtStyle mnExtStyle; // currently document frames are marked this way
+
+ PointerStyle mePointerStyle; // currently active pointer style
+
+ CGMutablePathRef mrClippingPath; // used for "shaping"
+ std::vector< CGRect > maClippingRects;
+
+ std::list<IosBlinker*> maBlinkers;
+
+ Rectangle maInvalidRect;
+
+ sal_uLong mnICOptions;
+
+ boost::shared_ptr< Timer > mpActivityTimer; // Timer to prevent system sleep during presentation
+public:
+ /** Constructor
+
+ Creates a system window and connects this frame with it.
+
+ @throws std::runtime_error in case window creation fails
+ */
+ IosSalFrame( SalFrame* pParent, sal_uLong salFrameStyle );
+
+ virtual ~IosSalFrame();
+
+ virtual SalGraphics* GetGraphics();
+ virtual void ReleaseGraphics( SalGraphics* pGraphics );
+ virtual sal_Bool PostEvent( void* pData );
+ virtual void SetTitle( const XubString& rTitle );
+ virtual void SetIcon( sal_uInt16 nIcon );
+ virtual void SetRepresentedURL( const rtl::OUString& );
+ virtual void SetMenu( SalMenu* pSalMenu );
+ virtual void DrawMenuBar();
+ virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False );
+ virtual void Enable( sal_Bool bEnable );
+ virtual void SetMinClientSize( long nWidth, long nHeight );
+ virtual void SetMaxClientSize( long nWidth, long nHeight );
+ virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags );
+ virtual void GetClientSize( long& rWidth, long& rHeight );
+ virtual void GetWorkArea( Rectangle& rRect );
+ virtual SalFrame* GetParent() const;
+ virtual void SetWindowState( const SalFrameState* pState );
+ virtual sal_Bool GetWindowState( SalFrameState* pState );
+ virtual void ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay );
+ virtual void StartPresentation( sal_Bool bStart );
+ virtual void SetAlwaysOnTop( sal_Bool bOnTop );
+ virtual void ToTop( sal_uInt16 nFlags );
+ virtual void SetPointer( PointerStyle ePointerStyle );
+ virtual void CaptureMouse( sal_Bool bMouse );
+ virtual void SetPointerPos( long nX, long nY );
+ virtual void Flush( void );
+ virtual void Flush( const Rectangle& );
+ virtual void Sync();
+ virtual void SetInputContext( SalInputContext* pContext );
+ virtual void EndExtTextInput( sal_uInt16 nFlags );
+ virtual String GetKeyName( sal_uInt16 nKeyCode );
+ virtual String GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode );
+ virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
+ virtual LanguageType GetInputLanguage();
+ virtual SalBitmap* SnapShot();
+ virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Beep( SoundType eSoundType );
+ virtual const SystemEnvData* GetSystemData() const;
+ virtual SalPointerState GetPointerState();
+ virtual SalIndicatorState GetIndicatorState();
+ virtual void SimulateKeyPress( sal_uInt16 nKeyCode );
+ virtual void SetParent( SalFrame* pNewParent );
+ virtual bool SetPluginParent( SystemParentData* pNewParent );
+ virtual void SetExtendedFrameStyle( SalExtStyle );
+ virtual void SetBackgroundBitmap( SalBitmap* );
+ virtual void SetScreenNumber(unsigned int);
+ virtual void SetApplicationID( const rtl::OUString &rApplicationID );
+
+ // shaped system windows
+ // set clip region to none (-> rectangular windows, normal state)
+ virtual void ResetClipRegion();
+ // start setting the clipregion consisting of nRects rectangles
+ virtual void BeginSetClipRegion( sal_uLong nRects );
+ // add a rectangle to the clip region
+ virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight );
+ // done setting up the clipregion
+ virtual void EndSetClipRegion();
+
+ virtual void SetClientSize( long nWidth, long nHeight );
+
+ void UpdateFrameGeometry();
+
+ // trigger painting of the window
+ void SendPaintEvent( const Rectangle* pRect = NULL );
+
+ static bool isAlive( const IosSalFrame* pFrame )
+ { return GetSalData()->maFrameCheck.find( pFrame ) != GetSalData()->maFrameCheck.end(); }
+
+ static IosSalFrame* GetCaptureFrame() { return s_pCaptureFrame; }
+
+ UIWindow* getWindow() const { return mpWindow; }
+ UIView* getView() const { return mpView; }
+ unsigned int getStyleMask() const { return mnStyleMask; }
+
+ void getResolution( long& o_rDPIX, long& o_rDPIY );
+
+ CGMutablePathRef getClipPath() const { return mrClippingPath; }
+
+ // called by VCL_UIApplication to indicate screen settings have changed
+ void screenParametersChanged();
+
+ private: // methods
+ /** do things on initial show (like centering on parent or on screen)
+ */
+ void initShow();
+
+ void initWindowAndView();
+
+ private: // data
+ static IosSalFrame* s_pCaptureFrame;
+
+ // make IosSalFrame non copyable
+ IosSalFrame( const IosSalFrame& );
+ IosSalFrame& operator=(const IosSalFrame&);
+};
+
+#endif // _SV_SALFRAME_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salframeview.h b/vcl/inc/ios/salframeview.h
new file mode 100644
index 000000000000..e631209c7b7f
--- /dev/null
+++ b/vcl/inc/ios/salframeview.h
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VCL_SALFRAMEVIEW_H
+#define _VCL_SALFRAMEVIEW_H
+
+@interface SalFrameWindow : UIWindow
+{
+ IosSalFrame* mpFrame;
+ id mDraggingDestinationHandler;
+}
+-(id)initWithSalFrame: (IosSalFrame*)pFrame;
+-(BOOL)canBecomeKeyWindow;
+-(void)displayIfNeeded;
+-(void)becomeKeyWindow;
+-(void)resignKeyWindow;
+-(IosSalFrame*)getSalFrame;
+@end
+
+@interface SalFrameView : UIView <UITextInput>
+{
+ IosSalFrame* mpFrame;
+
+ // for UITextInput
+ UIEvent* mpLastEvent;
+ BOOL mbNeedSpecialKeyHandle;
+ BOOL mbInKeyInput;
+ BOOL mbKeyHandled;
+ NSRange mMarkedRange;
+ NSRange mSelectedRange;
+ id mDraggingDestinationHandler;
+ UIEvent* mpLastSuperEvent;
+
+ NSTimeInterval mfLastMagnifyTime;
+ float mfMagnifyDeltaSum;
+}
+-(id)initWithSalFrame: (IosSalFrame*)pFrame;
+-(IosSalFrame*)getSalFrame;
+-(BOOL)acceptsFirstResponder;
+-(BOOL)isOpaque;
+-(void)drawRect: (CGRect)aRect;
+-(void)magnifyWithEvent: (UIEvent*)pEvent;
+-(void)rotateWithEvent: (UIEvent*)pEvent;
+-(void)swipeWithEvent: (UIEvent*)pEvent;
+-(void)keyDown: (UIEvent*)pEvent;
+-(void)flagsChanged: (UIEvent*)pEvent;
+-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar;
+-(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod;
+-(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod;
+-(BOOL)sendSingleCharacter:(UIEvent*)pEvent;
+-(BOOL)handleKeyDownException:(UIEvent*)pEvent;
+-(void)clearLastEvent;
+/*
+ text action methods
+*/
+-(void)insertText:(id)aString;
+-(void)insertTab: (id)aSender;
+-(void)insertBacktab: (id)aSender;
+-(void)moveLeft: (id)aSender;
+-(void)moveLeftAndModifySelection: (id)aSender;
+-(void)moveBackwardAndModifySelection: (id)aSender;
+-(void)moveRight: (id)aSender;
+-(void)moveRightAndModifySelection: (id)aSender;
+-(void)moveForwardAndModifySelection: (id)aSender;
+-(void)moveUp: (id)aSender;
+-(void)moveDown: (id)aSender;
+-(void)moveWordBackward: (id)aSender;
+-(void)moveWordBackwardAndModifySelection: (id)aSender;
+-(void)moveWordLeftAndModifySelection: (id)aSender;
+-(void)moveWordForward: (id)aSender;
+-(void)moveWordForwardAndModifySelection: (id)aSender;
+-(void)moveWordRightAndModifySelection: (id)aSender;
+-(void)moveToEndOfLine: (id)aSender;
+-(void)moveToRightEndOfLine: (id)aSender;
+-(void)moveToLeftEndOfLine: (id)aSender;
+-(void)moveToEndOfLineAndModifySelection: (id)aSender;
+-(void)moveToRightEndOfLineAndModifySelection: (id)aSender;
+-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender;
+-(void)moveToBeginningOfLine: (id)aSender;
+-(void)moveToBeginningOfLineAndModifySelection: (id)aSender;
+-(void)moveToEndOfParagraph: (id)aSender;
+-(void)moveToEndOfParagraphAndModifySelection: (id)aSender;
+-(void)moveToBeginningOfParagraph: (id)aSender;
+-(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender;
+-(void)moveParagraphForward: (id)aSender;
+-(void)moveParagraphForwardAndModifySelection: (id)aSender;
+-(void)moveParagraphBackward: (id)aSender;
+-(void)moveParagraphBackwardAndModifySelection: (id)aSender;
+-(void)moveToEndOfDocument: (id)aSender;
+-(void)scrollToEndOfDocument: (id)aSender;
+-(void)moveToEndOfDocumentAndModifySelection: (id)aSender;
+-(void)moveToBeginningOfDocument: (id)aSender;
+-(void)scrollToBeginningOfDocument: (id)aSender;
+-(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender;
+-(void)insertNewline: (id)aSender;
+-(void)deleteBackward: (id)aSender;
+-(void)deleteForward: (id)aSender;
+-(void)cancelOperation: (id)aSender;
+-(void)deleteBackwardByDecomposingPreviousCharacter: (id)aSender;
+-(void)deleteWordBackward: (id)aSender;
+-(void)deleteWordForward: (id)aSender;
+-(void)deleteToBeginningOfLine: (id)aSender;
+-(void)deleteToEndOfLine: (id)aSender;
+-(void)deleteToBeginningOfParagraph: (id)aSender;
+-(void)deleteToEndOfParagraph: (id)aSender;
+-(void)insertLineBreak: (id)aSender;
+-(void)insertParagraphSeparator: (id)aSender;
+-(void)selectWord: (id)aSender;
+-(void)selectLine: (id)aSender;
+-(void)selectParagraph: (id)aSender;
+-(void)selectAll: (id)aSender;
+-(void)noop: (id)aSender;
+-(id)parentAttribute;
+-(UIView *)viewElementForParent;
+@end
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salgdi.h b/vcl/inc/ios/salgdi.h
new file mode 100644
index 000000000000..51ef49219e9a
--- /dev/null
+++ b/vcl/inc/ios/salgdi.h
@@ -0,0 +1,401 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALGDI_H
+#define _SV_SALGDI_H
+
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+
+#include "ios/iosvcltypes.h"
+#include <vcl/fontcapabilities.hxx>
+
+#include "outfont.hxx"
+#include "salgdi.hxx"
+
+#include <vector>
+
+class IosSalFrame;
+class IosSalBitmap;
+class ImplDevFontAttributes;
+
+class CGRect;
+
+// mac specific physically available font face
+class ImplIosFontData : public ImplFontData
+{
+public:
+ ImplIosFontData( const ImplDevFontAttributes&, NSString * );
+
+ virtual ~ImplIosFontData();
+
+ virtual ImplFontData* Clone() const;
+ virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const;
+ virtual sal_IntPtr GetFontId() const;
+
+ const ImplFontCharMap* GetImplFontCharMap() const;
+ bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
+ bool HasChar( sal_uInt32 cChar ) const;
+
+ void ReadOs2Table() const;
+ void ReadIosCmapEncoding() const;
+ bool HasCJKSupport() const;
+
+private:
+ mutable const ImplFontCharMap* mpCharMap;
+ mutable vcl::FontCapabilities maFontCapabilities;
+ mutable bool mbOs2Read; // true if OS2-table related info is valid
+ mutable bool mbHasOs2Table;
+ mutable bool mbCmapEncodingRead; // true if cmap encoding of Ios font is read
+ mutable bool mbHasCJKSupport; // #i78970# CJK fonts need extra leading
+ mutable bool mbFontCapabilitiesRead;
+};
+
+// abstracting quartz color instead of having to use an CGFloat[] array
+class RGBAColor
+{
+public:
+ RGBAColor( SalColor );
+ RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET
+ const float* AsArray() const { return &mfRed; }
+ bool IsVisible() const { return (mfAlpha > 0); }
+ void SetAlpha( float fAlpha ) { mfAlpha = fAlpha; }
+private:
+ float mfRed, mfGreen, mfBlue, mfAlpha;
+};
+
+// -------------------
+// - IosSalGraphics -
+// -------------------
+class IosSalGraphics : public SalGraphics
+{
+protected:
+ IosSalFrame* mpFrame;
+ CGLayerRef mxLayer; // Quartz graphics layer
+ CGContextRef mrContext; // Quartz drawing context
+ class XorEmulation* mpXorEmulation;
+ int mnXorMode; // 0: off 1: on 2: invert only
+ int mnWidth;
+ int mnHeight;
+ int mnBitmapDepth; // zero unless bitmap
+ /// device resolution of this graphics
+ long mnRealDPIX;
+ long mnRealDPIY;
+ /// some graphics implementations (e.g. IosSalInfoPrinter) scale
+ /// everything down by a factor (see SetupPrinterGraphics for details)
+ /// so we have to compensate for it with the inverse factor
+ double mfFakeDPIScale;
+
+ /// path representing current clip region
+ CGMutablePathRef mxClipPath;
+
+ /// Drawing colors
+ /// pen color RGBA
+ RGBAColor maLineColor;
+ /// brush color RGBA
+ RGBAColor maFillColor;
+
+ // Device Font settings
+ const ImplIosFontData* mpIosFontData;
+ /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0
+ float mfFontStretch;
+ /// allows text to be rendered without antialiasing
+ bool mbNonAntialiasedText;
+
+ // Graphics types
+
+ /// is this a printer graphics
+ bool mbPrinter;
+ /// is this a virtual device graphics
+ bool mbVirDev;
+ /// is this a window graphics
+ bool mbWindow;
+
+public:
+ IosSalGraphics();
+ virtual ~IosSalGraphics();
+
+ bool IsPenVisible() const { return maLineColor.IsVisible(); }
+ bool IsBrushVisible() const { return maFillColor.IsVisible(); }
+
+ void SetWindowGraphics( IosSalFrame* pFrame );
+ void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale );
+ void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
+
+ void initResolution( UIWindow* );
+ void copyResolution( IosSalGraphics& );
+ void updateResolution();
+
+ bool IsWindowGraphics() const { return mbWindow; }
+ bool IsPrinterGraphics() const { return mbPrinter; }
+ bool IsVirDevGraphics() const { return mbVirDev; }
+ IosSalFrame* getGraphicsFrame() const { return mpFrame; }
+ void setGraphicsFrame( IosSalFrame* pFrame ) { mpFrame = pFrame; }
+
+ void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
+
+ bool CheckContext();
+ void UpdateWindow( CGRect& ); // delivered in NSView coordinates
+ void RefreshRect( const CGRect& );
+ void RefreshRect(float lX, float lY, float lWidth, float lHeight);
+
+ void SetState();
+ void UnsetState();
+ // InvalidateContext does an UnsetState and sets mrContext to 0
+ void InvalidateContext();
+
+ virtual bool setClipRegion( const Region& );
+
+ // draw --> LineColor and FillColor and RasterOp and ClipRegion
+ virtual void drawPixel( long nX, long nY );
+ virtual void drawPixel( long nX, long nY, SalColor nSalColor );
+ virtual void drawLine( long nX1, long nY1, long nX2, long nY2 );
+ virtual void drawRect( long nX, long nY, long nWidth, long nHeight );
+ virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
+ virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
+ virtual void drawPolyPolygon( sal_uLong nPoly, const sal_uLong* pPoints, PCONSTSALPOINT* pPtAry );
+ virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
+ virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
+ virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
+ virtual sal_Bool drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry );
+ virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
+
+ // CopyArea --> No RasterOp, but ClipRegion
+ virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
+ long nSrcHeight, sal_uInt16 nFlags );
+
+ // CopyBits and DrawBitmap --> RasterOp and ClipRegion
+ // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
+ virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics );
+ virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap );
+ virtual void drawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nTransparentColor );
+ virtual void drawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ const SalBitmap& rTransparentBitmap );
+ virtual void drawMask( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nMaskColor );
+
+ virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight );
+ virtual SalColor getPixel( long nX, long nY );
+
+ // invert --> ClipRegion (only Windows or VirDevs)
+ virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags);
+ virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags );
+
+ virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
+
+ virtual bool drawAlphaBitmap( const SalTwoRect&,
+ const SalBitmap& rSourceBitmap,
+ const SalBitmap& rAlphaBitmap );
+
+ virtual bool drawAlphaRect( long nX, long nY, long nWidth,
+ long nHeight, sal_uInt8 nTransparency );
+
+ CGPoint* makeCGptArray(sal_uLong nPoints, const SalPoint* pPtAry);
+ // native widget rendering methods that require mirroring
+ virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
+ const Point& aPos, sal_Bool& rIsInside );
+ virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
+ ControlState nState, const ImplControlValue& aValue,
+ const rtl::OUString& aCaption );
+ virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
+ ControlState nState, const ImplControlValue& aValue,
+ const rtl::OUString& aCaption );
+ virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
+ const ImplControlValue& aValue, const rtl::OUString& aCaption,
+ Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
+
+ // get device resolution
+ virtual void GetResolution( long& rDPIX, long& rDPIY );
+ // get the depth of the device
+ virtual sal_uInt16 GetBitCount() const;
+ // get the width of the device
+ virtual long GetGraphicsWidth() const;
+
+ // set the clip region to empty
+ virtual void ResetClipRegion();
+
+ // set the line color to transparent (= don't draw lines)
+ virtual void SetLineColor();
+ // set the line color to a specific color
+ virtual void SetLineColor( SalColor nSalColor );
+ // set the fill color to transparent (= don't fill)
+ virtual void SetFillColor();
+ // set the fill color to a specific color, shapes will be
+ // filled accordingly
+ virtual void SetFillColor( SalColor nSalColor );
+ // enable/disable XOR drawing
+ virtual void SetXORMode( bool bSet, bool bInvertOnly );
+ // set line color for raster operations
+ virtual void SetROPLineColor( SalROPColor nROPColor );
+ // set fill color for raster operations
+ virtual void SetROPFillColor( SalROPColor nROPColor );
+ // set the text color to a specific color
+ virtual void SetTextColor( SalColor nSalColor );
+ // set the font
+ virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel );
+ // get the current font's etrics
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
+ // get kernign pairs of the current font
+ // return only PairCount if (pKernPairs == NULL)
+ virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
+ // get the repertoire of the current font
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
+ virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
+ // graphics must fill supplied font list
+ virtual void GetDevFontList( ImplDevFontList* );
+ // graphics should call ImplAddDevFontSubstitute on supplied
+ // OutputDevice for all its device specific preferred font substitutions
+ virtual void GetDevFontSubstList( OutputDevice* );
+ virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
+ // CreateFontSubset: a method to get a subset of glyhps of a font
+ // inside a new valid font file
+ // returns TRUE if creation of subset was successfull
+ // parameters: rToFile: contains a osl file URL to write the subset to
+ // pFont: describes from which font to create a subset
+ // pGlyphIDs: the glyph ids to be extracted
+ // pEncoding: the character code corresponding to each glyph
+ // pWidths: the advance widths of the correspoding glyphs (in PS font units)
+ // nGlyphs: the number of glyphs
+ // rInfo: additional outgoing information
+ // implementation note: encoding 0 with glyph id 0 should be added implicitly
+ // as "undefined character"
+ virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile,
+ const ImplFontData* pFont,
+ long* pGlyphIDs,
+ sal_uInt8* pEncoding,
+ sal_Int32* pWidths,
+ int nGlyphs,
+ FontSubsetInfo& rInfo // out parameter
+ );
+
+ // GetFontEncodingVector: a method to get the encoding map Unicode
+ // to font encoded character; this is only used for type1 fonts and
+ // may return NULL in case of unknown encoding vector
+ // if ppNonEncoded is set and non encoded characters (that is type1
+ // glyphs with only a name) exist it is set to the corresponding
+ // map for non encoded glyphs; the encoding vector contains -1
+ // as encoding for these cases
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
+
+ // GetEmbedFontData: gets the font data for a font marked
+ // embeddable by GetDevFontList or NULL in case of error
+ // parameters: pFont: describes the font in question
+ // pWidths: the widths of all glyphs from char code 0 to 255
+ // pWidths MUST support at least 256 members;
+ // rInfo: additional outgoing information
+ // pDataLen: out parameter, contains the byte length of the returned buffer
+ virtual const void* GetEmbedFontData( const ImplFontData*,
+ const sal_Ucs* pUnicodes,
+ sal_Int32* pWidths,
+ FontSubsetInfo& rInfo,
+ long* pDataLen );
+ // frees the font data again
+ virtual void FreeEmbedFontData( const void* pData, long nDataLen );
+
+ virtual void GetGlyphWidths( const ImplFontData*,
+ bool bVertical,
+ Int32Vector& rWidths,
+ Ucs2UIntMap& rUnicodeEnc );
+
+ virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& );
+ virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& );
+
+ virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
+ virtual void DrawServerFontLayout( const ServerFontLayout& );
+ virtual bool supportsOperation( OutDevSupportType ) const;
+
+ // Query the platform layer for control support
+ virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
+
+ virtual SystemGraphicsData GetGraphicsData() const;
+ virtual SystemFontData GetSysFontData( int /* nFallbacklevel */ ) const;
+
+private:
+ // differences between VCL, Quartz and kHiThemeOrientation coordinate systems
+ // make some graphics seem to be vertically-mirrored from a VCL perspective
+ bool IsFlipped() const { return mbWindow; }
+
+ void ApplyXorContext();
+ void Pattern50Fill();
+ UInt32 getState( ControlState nState );
+ UInt32 getTrackState( ControlState nState );
+};
+
+class XorEmulation
+{
+public:
+ XorEmulation();
+ /*final*/ ~XorEmulation();
+
+ void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
+ bool UpdateTarget();
+ void Enable() { mbIsEnabled = true; }
+ void Disable() { mbIsEnabled = false; }
+ bool IsEnabled() const { return mbIsEnabled; }
+ CGContextRef GetTargetContext() const { return mxTargetContext; }
+ CGContextRef GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); }
+
+private:
+ CGLayerRef mxTargetLayer;
+ CGContextRef mxTargetContext;
+ CGContextRef mxMaskContext;
+ CGContextRef mxTempContext;
+ sal_uLong* mpMaskBuffer;
+ sal_uLong* mpTempBuffer;
+ int mnBufferLongs;
+ bool mbIsEnabled;
+};
+
+
+// --- some trivial inlines
+
+inline void IosSalGraphics::RefreshRect( const CGRect& rRect )
+{
+ RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
+}
+
+inline RGBAColor::RGBAColor( SalColor nSalColor )
+: mfRed( SALCOLOR_RED(nSalColor) * (1.0/255))
+, mfGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255))
+, mfBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255))
+, mfAlpha( 1.0 ) // opaque
+{}
+
+inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
+: mfRed( fRed )
+, mfGreen( fGreen )
+, mfBlue( fBlue )
+, mfAlpha( fAlpha )
+{}
+
+#endif // _SV_SALGDI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salinst.h b/vcl/inc/ios/salinst.h
new file mode 100644
index 000000000000..9983804bf665
--- /dev/null
+++ b/vcl/inc/ios/salinst.h
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALINST_H
+#define _SV_SALINST_H
+
+#include "osl/mutex.hxx"
+#include "osl/thread.hxx"
+#include "osl/conditn.h"
+#include <vcl/solarmutex.hxx>
+
+#include "ios/iosvcltypes.h"
+
+#include "salinst.hxx"
+
+#include <list>
+
+class IosSalFrame;
+class ApplicationEvent;
+class Image;
+
+// -----------------
+// - SalYieldMutex -
+// -----------------
+
+class SalYieldMutex : public vcl::SolarMutexObject
+{
+ sal_uLong mnCount;
+ oslThreadIdentifier mnThreadId;
+
+public:
+ SalYieldMutex();
+ virtual void acquire();
+ virtual void release();
+ virtual sal_Bool tryToAcquire();
+ sal_uLong GetAcquireCount() const { return mnCount; }
+ oslThreadIdentifier GetThreadId() const { return mnThreadId; }
+};
+
+#define YIELD_GUARD osl::SolarGuard aGuard( GetSalData()->mpFirstInstance->GetYieldMutex() )
+
+
+// -------------------
+// - SalInstanceData -
+// -------------------
+
+//struct SalInstanceData
+//{
+//public:
+//};
+
+// ------------------
+// - IosSalInstance -
+// ------------------
+
+class IosSalInstance : public SalInstance
+{
+ struct SalUserEvent
+ {
+ IosSalFrame* mpFrame;
+ void* mpData;
+ sal_uInt16 mnType;
+
+ SalUserEvent( IosSalFrame* pFrame, void* pData, sal_uInt16 nType ) :
+ mpFrame( pFrame ), mpData( pData ), mnType( nType )
+ {}
+ };
+
+public:
+ SalYieldMutex* mpSalYieldMutex;
+ rtl::OUString maDefaultPrinter;
+ oslThreadIdentifier maMainThread;
+ bool mbWaitingYield;
+ int mnActivePrintJobs;
+ std::list< SalUserEvent > maUserEvents;
+ oslMutex maUserEventListMutex;
+ oslCondition maWaitingYieldCond;
+
+ typedef std::list<const ApplicationEvent*> AppEventList;
+ static AppEventList aAppEventList;
+
+public:
+ IosSalInstance();
+ virtual ~IosSalInstance();
+
+ virtual SalSystem* CreateSystem();
+ virtual void DestroySystem(SalSystem*);
+ virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
+ virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
+ virtual void DestroyFrame( SalFrame* pFrame );
+ virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True );
+ virtual void DestroyObject( SalObject* pObject );
+ virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
+ long nDX, long nDY,
+ sal_uInt16 nBitCount, const SystemGraphicsData *pData );
+ virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice );
+
+ virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
+ ImplJobSetup* pSetupData );
+ virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter );
+ virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter );
+ virtual void DestroyPrinter( SalPrinter* pPrinter );
+ virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList );
+ virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo );
+ virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo );
+ virtual String GetDefaultPrinter();
+ virtual SalTimer* CreateSalTimer();
+ virtual SalI18NImeStatus* CreateI18NImeStatus();
+ virtual SalSystem* CreateSalSystem();
+ virtual SalBitmap* CreateSalBitmap();
+ virtual osl::SolarMutex* GetYieldMutex();
+ virtual sal_uLong ReleaseYieldMutex();
+ virtual void AcquireYieldMutex( sal_uLong nCount );
+ virtual bool CheckYieldMutex();
+ virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
+ virtual bool AnyInput( sal_uInt16 nType );
+ virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu );
+ virtual void DestroyMenu( SalMenu* );
+ virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
+ virtual void DestroyMenuItem( SalMenuItem* );
+ virtual SalSession* CreateSalSession();
+ virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
+ virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
+ virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) );
+ virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) );
+
+ // dtrans implementation
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments );
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource();
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
+
+ void wakeupYield();
+
+ public:
+ friend class IosSalFrame;
+
+ void PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData );
+ void delayedSettingsChanged( bool bInvalidate );
+
+ bool isUIAppThread() const;
+
+ void startedPrintJob() { mnActivePrintJobs++; }
+ void endedPrintJob() { mnActivePrintJobs--; }
+
+ // event subtypes for NSApplicationDefined events
+ static const short AppExecuteSVMain = 0x7fff;
+ static const short AppEndLoopEvent = 1;
+ static const short AppStartTimerEvent = 10;
+ static const short AppleRemoteEvent = 15;
+ static const short YieldWakeupEvent = 20;
+};
+
+// helper class: inverted solar guard
+class YieldMutexReleaser
+{
+ sal_uLong mnCount;
+ public:
+ YieldMutexReleaser();
+ ~YieldMutexReleaser();
+};
+
+// helper class
+rtl::OUString GetOUString( CFStringRef );
+rtl::OUString GetOUString( NSString* );
+CFStringRef CreateCFString( const rtl::OUString& );
+NSString* CreateNSString( const rtl::OUString& );
+
+CGImageRef CreateCGImage( const Image& );
+UIImage* CreateUIImage( const Image& );
+
+#endif // _SV_SALINST_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salmathutils.hxx b/vcl/inc/ios/salmathutils.hxx
new file mode 100644
index 000000000000..e81f68e46b0b
--- /dev/null
+++ b/vcl/inc/ios/salmathutils.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALMATHUTILS_HXX
+#define _SV_SALMATHUTILS_HXX
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// ------------------------------------------------------------------
+//
+// Structures
+//
+// ------------------------------------------------------------------
+
+// LRectCoor is an abreviation for rectangular coordinates
+// represented as long integers
+
+struct LRectCoor
+{
+ long x;
+ long y;
+ long z;
+};
+
+// ------------------------------------------------------------------
+//
+// Type Definitions
+//
+// ------------------------------------------------------------------
+
+// LRectCoorVec is an abreviation for vectors in rectangular
+// coordinates represented as long integers
+
+typedef struct LRectCoor LRectCoor;
+typedef LRectCoor *LRectCoorVector;
+typedef LRectCoorVector *LRectCoorTensor;
+
+// ------------------------------------------------------------------
+//
+// Function Headers
+//
+// ------------------------------------------------------------------
+
+void CSwap ( char &rX, char &rY );
+void UCSwap ( unsigned char &rX, unsigned char &rY );
+void SSwap ( short &rX, short &rY );
+void USSwap ( unsigned short &rX, unsigned short &rY );
+void LSwap ( long &rX, long &rY );
+void ULSwap ( unsigned long &rX, unsigned long &rY );
+
+// ------------------------------------------------------------------
+
+unsigned long Euclidian2Norm ( const LRectCoorVector pVec );
+
+// ------------------------------------------------------------------
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _SV_SALMATHUTILS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salmenu.h b/vcl/inc/ios/salmenu.h
new file mode 100644
index 000000000000..3f143ac1d976
--- /dev/null
+++ b/vcl/inc/ios/salmenu.h
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALMENU_H
+#define _SV_SALMENU_H
+
+#include "premac.h"
+#include <UIKit/UIKit.h>
+#include "postmac.h"
+
+#include "salmenu.hxx"
+
+#include <vector>
+
+class IosSalFrame;
+class IosSalMenuItem;
+
+class IosSalMenu : public SalMenu
+{
+ std::vector< IosSalMenuItem* > maItems;
+
+public: // for OOStatusView
+ struct MenuBarButtonEntry
+ {
+ SalMenuButtonItem maButton;
+ UIImage* mpUIImage; // cached image
+ NSString* mpToolTipString;
+
+ MenuBarButtonEntry() : mpUIImage( nil ), mpToolTipString( nil ) {}
+ MenuBarButtonEntry( const SalMenuButtonItem& i_rItem )
+ : maButton( i_rItem), mpUIImage( nil ), mpToolTipString( nil ) {}
+ };
+private:
+ std::vector< MenuBarButtonEntry > maButtons;
+
+ MenuBarButtonEntry* findButtonItem( sal_uInt16 i_nItemId );
+ void releaseButtonEntry( MenuBarButtonEntry& i_rEntry );
+ static void statusLayout();
+public:
+ IosSalMenu( bool bMenuBar );
+ virtual ~IosSalMenu();
+
+ virtual sal_Bool VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars
+ // otherwise only menu messages are processed (eg, OLE on Windows)
+
+ virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos );
+ virtual void RemoveItem( unsigned nPos );
+ virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos );
+ virtual void SetFrame( const SalFrame* pFrame );
+ virtual void CheckItem( unsigned nPos, sal_Bool bCheck );
+ virtual void EnableItem( unsigned nPos, sal_Bool bEnable );
+ virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText );
+ virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage);
+ virtual void GetSystemMenuData( SystemMenuData* pData );
+ virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags);
+ virtual bool AddMenuBarButton( const SalMenuButtonItem& );
+ virtual void RemoveMenuBarButton( sal_uInt16 nId );
+ virtual Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame );
+
+ int getItemIndexByPos( sal_uInt16 nPos ) const;
+ const IosSalFrame* getFrame() const;
+
+ void setMainMenu();
+ static void unsetMainMenu();
+ static void setDefaultMenu();
+ static void enableMainMenu( bool bEnable );
+ static void addFallbackMenuItem( UIMenuItem* NewItem );
+ static void removeFallbackMenuItem( UIMenuItem* pOldItem );
+
+ const std::vector< MenuBarButtonEntry >& getButtons() const { return maButtons; }
+
+ bool mbMenuBar; // true - Menubar, false - Menu
+ UIMenuController* mpMenu;
+ Menu* mpVCLMenu; // the corresponding vcl Menu object
+ const IosSalFrame* mpFrame; // the frame to dispatch the menu events to
+ IosSalMenu* mpParentSalMenu; // the parent menu that contains us (and perhaps has a frame)
+
+ static const IosSalMenu* pCurrentMenuBar;
+
+};
+
+class IosSalMenuItem : public SalMenuItem
+{
+public:
+ IosSalMenuItem( const SalItemParams* );
+ virtual ~IosSalMenuItem();
+
+ sal_uInt16 mnId; // Item ID
+ Menu* mpVCLMenu; // VCL Menu into which this MenuItem is inserted
+ IosSalMenu* mpParentMenu; // The menu in which this menu item is inserted
+ IosSalMenu* mpSubMenu; // Sub menu of this item (if defined)
+ UIMenuItem* mpMenuItem; // The UIMenuItem
+};
+
+#endif // _SV_SALMENU_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salnstimer.h b/vcl/inc/ios/salnstimer.h
new file mode 100644
index 000000000000..cf98276747ee
--- /dev/null
+++ b/vcl/inc/ios/salnstimer.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VCL_SALNSTIMER_H
+#define _VCL_SALNSTIMER_H
+
+#include "premac.h"
+#include <Foundation/Foundation.h>
+#include "postmac.h"
+
+@interface TimerCallbackCaller : NSObject
+{
+}
+-(void)timerElapsed:(NSTimer*)pTimer;
+@end
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salobj.h b/vcl/inc/ios/salobj.h
new file mode 100644
index 000000000000..3203a0d46e93
--- /dev/null
+++ b/vcl/inc/ios/salobj.h
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALOBJ_H
+#define _SV_SALOBJ_H
+
+#include "vcl/sysdata.hxx"
+#include "salobj.hxx"
+
+class IosSalFrame;
+class IosSalObject;
+
+
+// -----------------
+// - SalObjectData -
+// -----------------
+
+struct SalObjectData
+{
+};
+
+class IosSalObject : public SalObject
+{
+public:
+ IosSalFrame* mpFrame; // parent frame
+ SystemEnvData maSysData;
+
+ long mnClipX;
+ long mnClipY;
+ long mnClipWidth;
+ long mnClipHeight;
+ bool mbClip;
+
+ long mnX;
+ long mnY;
+ long mnWidth;
+ long mnHeight;
+
+ void setClippedPosSize();
+
+ IosSalObject( IosSalFrame* pFrame );
+ virtual ~IosSalObject();
+
+ virtual void ResetClipRegion();
+ virtual sal_uInt16 GetClipRegionType();
+ virtual void BeginSetClipRegion( sal_uLong nRects );
+ virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight );
+ virtual void EndSetClipRegion();
+ virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight );
+ virtual void Show( sal_Bool bVisible );
+ virtual void Enable( sal_Bool nEnable );
+ virtual void GrabFocus();
+ virtual void SetBackground();
+ virtual void SetBackground( SalColor nSalColor );
+ virtual const SystemEnvData* GetSystemData() const;
+ virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept );
+};
+
+#endif // _SV_SALOBJ_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salprn.h b/vcl/inc/ios/salprn.h
new file mode 100644
index 000000000000..cd90a0f881df
--- /dev/null
+++ b/vcl/inc/ios/salprn.h
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALPRN_H
+#define _SV_SALPRN_H
+
+#include "ios/iosvcltypes.h"
+
+#include "salprn.hxx"
+
+#include <boost/shared_array.hpp>
+
+
+// ---------------------
+// - IosSalInfoPrinter -
+// ---------------------
+
+class IosSalGraphics;
+
+class IosSalInfoPrinter : public SalInfoPrinter
+{
+ /// Printer graphics
+ IosSalGraphics* mpGraphics;
+ /// is Graphics used
+ bool mbGraphics;
+ /// job active ?
+ bool mbJob;
+
+ UIPrintFormatter* mpPrinter;
+ /// cocoa print info object
+ UIPrintInfo* mpPrintInfo;
+
+ /// FIXME: get real printer context for infoprinter if possible
+ /// fake context for info printer
+ /// graphics context for Quartz 2D
+ CGContextRef mrContext;
+ /// memory for graphics bitmap context for querying metrics
+ boost::shared_array< sal_uInt8 > maContextMemory;
+
+ // since changes to UIPrintInfo during a job are ignored
+ // we have to care for some settings ourselves
+ // currently we do this for orientation;
+ // really needed however is a solution for paper formats
+ Orientation mePageOrientation;
+
+ int mnStartPageOffsetX;
+ int mnStartPageOffsetY;
+ sal_Int32 mnCurPageRangeStart;
+ sal_Int32 mnCurPageRangeCount;
+
+ public:
+ IosSalInfoPrinter( const SalPrinterQueueInfo& pInfo );
+ virtual ~IosSalInfoPrinter();
+
+ void SetupPrinterGraphics( CGContextRef i_xContext ) const;
+
+ virtual SalGraphics* GetGraphics();
+ virtual void ReleaseGraphics( SalGraphics* i_pGraphics );
+ virtual sal_Bool Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData );
+ virtual sal_Bool SetPrinterData( ImplJobSetup* pSetupData );
+ virtual sal_Bool SetData( sal_uLong i_nFlags, ImplJobSetup* i_pSetupData );
+ virtual void GetPageInfo( const ImplJobSetup* i_pSetupData,
+ long& o_rOutWidth, long& o_rOutHeight,
+ long& o_rPageOffX, long& o_rPageOffY,
+ long& o_rPageWidth, long& o_rPageHeight );
+ virtual sal_uLong GetCapabilities( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nType );
+ virtual sal_uLong GetPaperBinCount( const ImplJobSetup* i_pSetupData );
+ virtual String GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin );
+ virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData );
+ virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData );
+
+ // the artificial separation between InfoPrinter and Printer
+ // is not really useful for us
+ // so let's make IosSalPrinter just a forwarder to IosSalInfoPrinter
+ // and concentrate the real work in one class
+ // implement pull model print system
+ sal_Bool StartJob( const String* i_pFileName,
+ const String& rJobName,
+ const String& i_rAppName,
+ ImplJobSetup* i_pSetupData,
+ vcl::PrinterController& i_rController );
+ sal_Bool EndJob();
+ sal_Bool AbortJob();
+ SalGraphics* StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData );
+ sal_Bool EndPage();
+ sal_uLong GetErrorCode() const;
+
+ UIPrintInfo* getPrintInfo() const { return mpPrintInfo; }
+ void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; }
+ sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; }
+ sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; }
+
+ // match width/height against known paper formats, possibly switching orientation
+ const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const;
+ void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation );
+
+ private:
+ IosSalInfoPrinter( const IosSalInfoPrinter& );
+ IosSalInfoPrinter& operator=(const IosSalInfoPrinter&);
+};
+
+// -----------------
+// - IosSalPrinter -
+// -----------------
+
+class IosSalPrinter : public SalPrinter
+{
+ IosSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
+ public:
+ IosSalPrinter( IosSalInfoPrinter* i_pInfoPrinter );
+ virtual ~IosSalPrinter();
+
+ virtual sal_Bool StartJob( const XubString* i_pFileName,
+ const XubString& i_rJobName,
+ const XubString& i_rAppName,
+ sal_uLong i_nCopies,
+ bool i_bCollate,
+ bool i_bDirect,
+ ImplJobSetup* i_pSetupData );
+ // implement pull model print system
+ virtual sal_Bool StartJob( const String* i_pFileName,
+ const String& rJobName,
+ const String& i_rAppName,
+ ImplJobSetup* i_pSetupData,
+ vcl::PrinterController& i_rListener );
+
+ virtual sal_Bool EndJob();
+ virtual sal_Bool AbortJob();
+ virtual SalGraphics* StartPage( ImplJobSetup* i_pSetupData, sal_Bool i_bNewJobData );
+ virtual sal_Bool EndPage();
+ virtual sal_uLong GetErrorCode();
+
+ private:
+ IosSalPrinter( const IosSalPrinter& );
+ IosSalPrinter& operator=(const IosSalPrinter&);
+};
+
+const double fPtTo100thMM = 35.27777778;
+
+inline int PtTo10Mu( double nPoints ) { return (int)(((nPoints)*fPtTo100thMM)+0.5); }
+
+inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+0.5); }
+
+
+
+#endif // _SV_SALPRN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salsys.h b/vcl/inc/ios/salsys.h
new file mode 100644
index 000000000000..e586c8dfb356
--- /dev/null
+++ b/vcl/inc/ios/salsys.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALSYS_H
+#define _SV_SALSYS_H
+
+#include "salsys.hxx"
+
+class VCL_DLLPUBLIC IosSalSystem : public SalSystem
+{
+public:
+ IosSalSystem() {}
+ virtual ~IosSalSystem();
+
+ // get info about the display
+ virtual unsigned int GetDisplayScreenCount();
+ virtual bool IsMultiDisplay();
+ virtual unsigned int GetDefaultDisplayNumber();
+ virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen );
+ virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen );
+
+ virtual rtl::OUString GetScreenName( unsigned int nScreen );
+ virtual int ShowNativeMessageBox( const String& rTitle,
+ const String& rMessage,
+ int nButtonCombination,
+ int nDefaultButton);
+};
+
+#endif // _SV_SALSYS_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/saltimer.h b/vcl/inc/ios/saltimer.h
new file mode 100644
index 000000000000..b5974219437d
--- /dev/null
+++ b/vcl/inc/ios/saltimer.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef _SV_SALTIMER_H
+#define _SV_SALTIMER_H
+
+#include "premac.h"
+#include <Foundation/Foundation.h>
+#include "postmac.h"
+
+#include "saltimer.hxx"
+
+class IosSalTimer : public SalTimer
+{
+ public:
+
+ IosSalTimer();
+ virtual ~IosSalTimer();
+
+ void Start( sal_uLong nMS );
+ void Stop();
+
+ static NSTimer* pRunningTimer;
+ static bool bDispatchTimer;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/saluimenu.h b/vcl/inc/ios/saluimenu.h
new file mode 100644
index 000000000000..ef54daa2d631
--- /dev/null
+++ b/vcl/inc/ios/saluimenu.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VCL_SALUIMENU_H
+#define _VCL_SALUIMENU_H
+
+class IosSalMenu;
+class IosSalMenuItem;
+
+@interface SalUIMenu : UIMenuController
+{
+ /* Caution: SalNSMenu instances occasionally are binary copied
+ in IosSalMenu::ShowNativePopupMenu. If any members are added,
+ please take this into account !
+ */
+ IosSalMenu* mpMenu;
+}
+-(id)initWithMenu: (IosSalMenu*)pMenu;
+-(void)menuNeedsUpdate: (UIMenuController*)pMenu;
+-(void)setSalMenu: (IosSalMenu*)pMenu;
+@end
+
+@interface SalUIMenuItem : UIMenuItem
+{
+ /* Caution: SalUIMenuItem instances occasionally are binary copied
+ in IosSalMenu::ShowNativePopupMenu. If any members are added,
+ please take this into account !
+ */
+ IosSalMenuItem* mpMenuItem;
+}
+-(id)initWithMenuItem: (IosSalMenuItem*)pMenuItem;
+-(void)menuItemTriggered: (id)aSender;
+@end
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salvd.h b/vcl/inc/ios/salvd.h
new file mode 100644
index 000000000000..e116c5c45bab
--- /dev/null
+++ b/vcl/inc/ios/salvd.h
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALVD_H
+#define _SV_SALVD_H
+
+#include "ios/salcolorutils.hxx"
+#include "ios/salgdi.h"
+
+#include "salvd.hxx"
+
+#if PRAGMA_ONCE
+ #pragma once
+#endif
+
+struct SalVirDevData
+{
+};
+
+typedef struct SalVirDevData SalVirDevData;
+typedef SalVirDevData *SalVirDevDataPtr;
+typedef SalVirDevDataPtr *SalVirDevDataHandle;
+
+// =======================================================================
+
+class IosSalGraphics;
+
+class IosSalVirtualDevice : public SalVirtualDevice
+{
+private:
+ bool mbGraphicsUsed; // is Graphics used
+ bool mbForeignContext; // is mxContext from outside VCL
+ CGContextRef mxBitmapContext;
+ int mnBitmapDepth;
+ CGLayerRef mxLayer; // Quartz layer
+ IosSalGraphics* mpGraphics; // current VirDev graphics
+
+ void Destroy();
+
+public:
+ IosSalVirtualDevice( IosSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData );
+ virtual ~IosSalVirtualDevice();
+
+ virtual SalGraphics* GetGraphics();
+ virtual void ReleaseGraphics( SalGraphics* pGraphics );
+ virtual sal_Bool SetSize( long nNewDX, long nNewDY );
+ virtual void GetSize( long& rWidth, long& rHeight );
+};
+
+// =======================================================================
+
+#endif // _SV_SALVD_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/vcluiapp.h b/vcl/inc/ios/vcluiapp.h
new file mode 100644
index 000000000000..df4a01ead0de
--- /dev/null
+++ b/vcl/inc/ios/vcluiapp.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VCL_VCLUIAPP_H
+#define _VCL_VCLUIAPP_H
+
+#include "premac.h"
+#include "UIKit/UIKit.h"
+#include "postmac.h"
+
+class IosSalFrame;
+
+// our very own application
+@interface VCL_UIApplication : UIApplication
+{
+}
+-(void)sendEvent:(UIEvent*)pEvent;
+-(void)sendSuperEvent:(UIEvent*)pEvent;
+-(BOOL)application: (UIApplication*) app openFile: (NSString*)file;
+-(void)application: (UIApplication*) app openFiles: (NSArray*)files;
+-(void)applicationWillTerminate: (UIApplication *) app;
+-(void)addFallbackMenuItem: (UIMenuItem*)pNewItem;
+-(void)removeFallbackMenuItem: (UIMenuItem*)pOldItem;
+@end
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index e25bb482f53c..a6ff3129fada 100644
--- a/vcl/inc/vcl/bitmap.hxx
+++ b/vcl/inc/vcl/bitmap.hxx
@@ -234,7 +234,7 @@ struct BitmapSystemData
#if defined( WNT )
void* pDIB; // device independent byte buffer
void* pDDB; // if not NULL then this is actually an HBITMAP
- #elif defined( QUARTZ )
+ #elif defined( QUARTZ ) || defined( IOS )
void* rImageContext; //Image context (CGContextRef)
#else
void* aPixmap;
diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx
index cab614841e1d..b5daf28e579d 100644
--- a/vcl/inc/vcl/sysdata.hxx
+++ b/vcl/inc/vcl/sysdata.hxx
@@ -41,6 +41,18 @@ typedef struct CGLayer *CGLayerRef;
class NSView;
#endif
#endif
+
+#ifdef IOS
+typedef struct CGFont *CGFontRef;
+typedef struct CGContext *CGContextRef;
+typedef struct CGLayer *CGLayerRef;
+#ifdef __OBJC__
+@class UIView;
+#else
+class UIView;
+#endif
+#endif
+
#if defined( WNT )
#include <windef.h>
#endif
@@ -56,6 +68,8 @@ struct SystemEnvData
HWND hWnd; // the window hwnd
#elif defined( QUARTZ )
NSView* pView; // the cocoa (NSView *) implementing this object
+#elif defined( IOS )
+ UIView* pView; // the CocoaTouch (UIView *) implementing this object
#elif defined( UNX )
void* pDisplay; // the relevant display connection
long aWindow; // the window of the object
@@ -84,6 +98,8 @@ struct SystemParentData
HWND hWnd; // the window hwnd
#elif defined( QUARTZ )
NSView* pView; // the cocoa (NSView *) implementing this object
+#elif defined( IOS )
+ UIView* pView; // the CocoaTouch (UIView *) implementing this object
#elif defined( UNX )
long aWindow; // the window of the object
bool bXEmbedSupport:1; // decides whether the object in question
@@ -116,8 +132,8 @@ struct SystemGraphicsData
unsigned long nSize; // size in bytes of this structure
#if defined( WNT )
HDC hDC; // handle to a device context
-#elif defined( QUARTZ )
- CGContextRef rCGContext; // QUARTZ graphic context
+#elif defined( QUARTZ ) || defined( IOS )
+ CGContextRef rCGContext; // CoreGraphics graphic context
#elif defined( UNX )
void* pDisplay; // the relevant display connection
long hDrawable; // a drawable
@@ -139,6 +155,7 @@ struct SystemWindowData
unsigned long nSize; // size in bytes of this structure
#if defined( WNT ) // meaningless on Windows
#elif defined( QUARTZ ) // meaningless on Mac OS X / Quartz
+#elif defined( IOS ) // and maybe on iOS, too, then
#elif defined( UNX )
void* pVisual; // the visual to be used
#endif
@@ -169,6 +186,8 @@ struct SystemFontData
HFONT hFont; // native font object
#elif defined( QUARTZ )
void* aATSUFontID; // native font object
+#elif defined( IOS )
+ CGFontRef rFont; // native font object
#elif defined( UNX )
void* nFontId; // native font id
int nFontFlags; // native font flags
diff --git a/vcl/ios/source/app/saldata.cxx b/vcl/ios/source/app/saldata.cxx
new file mode 100644
index 000000000000..f292b6fae585
--- /dev/null
+++ b/vcl/ios/source/app/saldata.cxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "ios/saldata.hxx"
+#include "ios/saluimenu.h"
+#include "ios/salinst.h"
+
+oslThreadKey SalData::s_aAutoReleaseKey = 0;
+
+static void SAL_CALL releasePool( void* pPool )
+{
+ if( pPool )
+ [(NSAutoreleasePool*)pPool release];
+}
+
+SalData::SalData()
+:
+ mpTimerProc( NULL ),
+ mpFirstInstance( NULL ),
+ mpFirstObject( NULL ),
+ mpFirstVD( NULL ),
+ mpFirstPrinter( NULL ),
+ mpFontList( NULL ),
+ mxRGBSpace( CGColorSpaceCreateDeviceRGB( ) ),
+ mxGraySpace( CGColorSpaceCreateDeviceGray( ) ),
+ mxP50Space( NULL ),
+ mxP50Pattern( NULL ),
+ mnSystemVersion( VER_TIGER ),
+ mnDPIX( 0 ),
+ mnDPIY( 0 )
+{
+ if( s_aAutoReleaseKey == 0 )
+ s_aAutoReleaseKey = osl_createThreadKey( releasePool );
+}
+
+SalData::~SalData()
+{
+ CGPatternRelease( mxP50Pattern );
+ CGColorSpaceRelease( mxP50Space );
+ CGColorSpaceRelease( mxRGBSpace );
+ CGColorSpaceRelease( mxGraySpace );
+ if( s_aAutoReleaseKey )
+ {
+ // release the last pool
+ NSAutoreleasePool* pPool = nil;
+ pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) );
+ if( pPool )
+ {
+ osl_setThreadKeyData( s_aAutoReleaseKey, NULL );
+ [pPool release];
+ }
+
+ osl_destroyThreadKey( s_aAutoReleaseKey );
+ s_aAutoReleaseKey = 0;
+ }
+}
+
+void SalData::ensureThreadAutoreleasePool()
+{
+ NSAutoreleasePool* pPool = nil;
+ if( s_aAutoReleaseKey )
+ {
+ pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) );
+ if( ! pPool )
+ {
+ pPool = [[NSAutoreleasePool alloc] init];
+ osl_setThreadKeyData( s_aAutoReleaseKey, pPool );
+ }
+ }
+ else
+ {
+ OSL_FAIL( "no autorelease key" );
+ }
+}
+
+void SalData::drainThreadAutoreleasePool()
+{
+ NSAutoreleasePool* pPool = nil;
+ if( s_aAutoReleaseKey )
+ {
+ pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) );
+ if( pPool )
+ {
+ // osl_setThreadKeyData( s_aAutoReleaseKey, NULL );
+ // [pPool release];
+ [pPool drain];
+ }
+ else
+ {
+ pPool = [[NSAutoreleasePool alloc] init];
+ osl_setThreadKeyData( s_aAutoReleaseKey, pPool );
+ }
+ }
+ else
+ {
+ OSL_FAIL( "no autorelease key" );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/salinst.cxx b/vcl/ios/source/app/salinst.cxx
new file mode 100644
index 000000000000..b4c944cd31a4
--- /dev/null
+++ b/vcl/ios/source/app/salinst.cxx
@@ -0,0 +1,828 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include <stdio.h>
+
+#include "tools/fsys.hxx"
+#include "tools/getprocessworkingdir.hxx"
+#include <tools/solarmutex.hxx>
+
+#include "osl/process.h"
+
+#include "rtl/ustrbuf.hxx"
+
+#include "vcl/svapp.hxx"
+#include "vcl/window.hxx"
+#include "vcl/timer.hxx"
+#include "vcl/solarmutex.hxx"
+
+#include "ios/saldata.hxx"
+#include "ios/salinst.h"
+#include "ios/salframe.h"
+#include "ios/salobj.h"
+#include "ios/salsys.h"
+#include "ios/salvd.h"
+#include "ios/salbmp.h"
+#include "ios/salprn.h"
+#include "ios/saltimer.h"
+#include "ios/vcluiapp.h"
+
+#include "print.h"
+#include "impbmp.hxx"
+#include "salimestatus.hxx"
+
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
+#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+using namespace std;
+using namespace ::com::sun::star;
+
+extern sal_Bool ImplSVMain();
+
+static int* gpnInit = 0;
+static bool bNoSVMain = true;
+static bool bLeftMain = false;
+// -----------------------------------------------------------------------
+
+class IosDelayedSettingsChanged : public Timer
+{
+ bool mbInvalidate;
+ public:
+ IosDelayedSettingsChanged( bool bInvalidate ) :
+ mbInvalidate( bInvalidate )
+ {
+ }
+
+ virtual void Timeout()
+ {
+ SalData* pSalData = GetSalData();
+ if( ! pSalData->maFrames.empty() )
+ pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL );
+
+ if( mbInvalidate )
+ {
+ for( std::list< IosSalFrame* >::iterator it = pSalData->maFrames.begin();
+ it != pSalData->maFrames.end(); ++it )
+ {
+ if( (*it)->mbShown )
+ (*it)->SendPaintEvent( NULL );
+ }
+ }
+ Stop();
+ delete this;
+ }
+};
+
+void IosSalInstance::delayedSettingsChanged( bool bInvalidate )
+{
+ osl::SolarGuard aGuard( *mpSalYieldMutex );
+ IosDelayedSettingsChanged* pTimer = new IosDelayedSettingsChanged( bInvalidate );
+ pTimer->SetTimeout( 50 );
+ pTimer->Start();
+}
+
+
+// the AppEventList must be available before any SalData/SalInst/etc. objects are ready
+typedef std::list<const ApplicationEvent*> AppEventList;
+AppEventList IosSalInstance::aAppEventList;
+
+// initialize the VCL_UIApplication object
+static void initUIApp()
+{
+ [VCL_UIApplication sharedApplication];
+
+ SalData::ensureThreadAutoreleasePool();
+}
+
+sal_Bool ImplSVMainHook( int * pnInit )
+{
+ gpnInit = pnInit;
+
+ bNoSVMain = false;
+ initUIApp();
+
+ char* pArgv[] = { "main", NULL };
+ UIApplicationMain( 1, pArgv, NULL, NULL );
+
+ return TRUE; // indicate that ImplSVMainHook is implemented
+}
+
+// =======================================================================
+
+void SalAbort( const XubString& rErrorText )
+{
+ if( !rErrorText.Len() )
+ fprintf( stderr, "Application Error " );
+ else
+ fprintf( stderr, "%s ",
+ ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
+ abort();
+}
+
+// -----------------------------------------------------------------------
+
+void InitSalData()
+{
+ SalData *pSalData = new SalData;
+ SetSalData( pSalData );
+}
+
+// -----------------------------------------------------------------------
+
+const ::rtl::OUString& SalGetDesktopEnvironment()
+{
+ static OUString aDesktopEnvironment(RTL_CONSTASCII_USTRINGPARAM( "CocoaTouch" ));
+ return aDesktopEnvironment;
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitSalData()
+{
+ SalData *pSalData = GetSalData();
+ delete pSalData;
+ SetSalData( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void InitSalMain()
+{
+ rtl::OUString urlWorkDir;
+ rtl_uString *sysWorkDir = NULL;
+ if (tools::getProcessWorkingDir(urlWorkDir))
+ {
+ oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir.pData, &sysWorkDir);
+ if (err2 == osl_File_E_None)
+ {
+ ByteString aPath( getenv( "PATH" ) );
+ ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) );
+ ByteString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() );
+ ByteString aTmpPath;
+ // Get absolute path of command's directory
+ if ( aCmdPath.Len() ) {
+ DirEntry aCmdDirEntry( aCmdPath );
+ aCmdDirEntry.ToAbs();
+ aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US );
+ }
+ // Assign to PATH environment variable
+ if ( aCmdPath.Len() )
+ {
+ aTmpPath = ByteString( "PATH=" );
+ aTmpPath += aCmdPath;
+ if ( aPath.Len() )
+ aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
+ aTmpPath += aPath;
+ putenv( (char*)aTmpPath.GetBuffer() );
+ }
+ // Assign to STAR_RESOURCEPATH environment variable
+ if ( aCmdPath.Len() )
+ {
+ aTmpPath = ByteString( "STAR_RESOURCEPATH=" );
+ aTmpPath += aCmdPath;
+ if ( aResPath.Len() )
+ aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
+ aTmpPath += aResPath;
+ putenv( (char*)aTmpPath.GetBuffer() );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitSalMain()
+{
+}
+
+// =======================================================================
+
+SalYieldMutex::SalYieldMutex()
+{
+ mnCount = 0;
+ mnThreadId = 0;
+}
+
+void SalYieldMutex::acquire()
+{
+ SolarMutexObject::acquire();
+ mnThreadId = osl::Thread::getCurrentIdentifier();
+ mnCount++;
+}
+
+void SalYieldMutex::release()
+{
+ if ( mnThreadId == osl::Thread::getCurrentIdentifier() )
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ }
+ SolarMutexObject::release();
+}
+
+sal_Bool SalYieldMutex::tryToAcquire()
+{
+ if ( SolarMutexObject::tryToAcquire() )
+ {
+ mnThreadId = osl::Thread::getCurrentIdentifier();
+ mnCount++;
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+// some convenience functions regarding the yield mutex, aka solar mutex
+
+sal_Bool ImplSalYieldMutexTryToAcquire()
+{
+ IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance;
+ if ( pInst )
+ return pInst->mpSalYieldMutex->tryToAcquire();
+ else
+ return FALSE;
+}
+
+void ImplSalYieldMutexAcquire()
+{
+ IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance;
+ if ( pInst )
+ pInst->mpSalYieldMutex->acquire();
+}
+
+void ImplSalYieldMutexRelease()
+{
+ IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance;
+ if ( pInst )
+ pInst->mpSalYieldMutex->release();
+}
+
+// =======================================================================
+
+SalInstance* CreateSalInstance()
+{
+ // this is the case for not using SVMain
+ // not so good
+ if( bNoSVMain )
+ initUIApp();
+
+ SalData* pSalData = GetSalData();
+ DBG_ASSERT( pSalData->mpFirstInstance == NULL, "more than one instance created" );
+ IosSalInstance* pInst = new IosSalInstance;
+
+ // init instance (only one instance in this version !!!)
+ pSalData->mpFirstInstance = pInst;
+ // this one is for outside IosSalInstance::Yield
+ SalData::ensureThreadAutoreleasePool();
+ // no focus rects on NWF ios
+ ImplGetSVData()->maNWFData.mbNoFocusRects = true;
+ ImplGetSVData()->maNWFData.mbNoBoldTabFocus = true;
+ ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise = true;
+ ImplGetSVData()->maNWFData.mbCenteredTabs = true;
+ ImplGetSVData()->maNWFData.mbProgressNeedsErase = true;
+ ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true;
+ ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10;
+ ImplGetSVData()->maGDIData.mbNoXORClipping = true;
+ ImplGetSVData()->maWinData.mbNoSaveBackground = true;
+
+ return pInst;
+}
+
+// -----------------------------------------------------------------------
+
+void DestroySalInstance( SalInstance* pInst )
+{
+ delete pInst;
+}
+
+// -----------------------------------------------------------------------
+
+IosSalInstance::IosSalInstance()
+{
+ mpSalYieldMutex = new SalYieldMutex;
+ mpSalYieldMutex->acquire();
+ ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex );
+ maMainThread = osl::Thread::getCurrentIdentifier();
+ mbWaitingYield = false;
+ maUserEventListMutex = osl_createMutex();
+ mnActivePrintJobs = 0;
+ maWaitingYieldCond = osl_createCondition();
+}
+
+// -----------------------------------------------------------------------
+
+IosSalInstance::~IosSalInstance()
+{
+ ::tools::SolarMutex::SetSolarMutex( 0 );
+ mpSalYieldMutex->release();
+ delete mpSalYieldMutex;
+ osl_destroyMutex( maUserEventListMutex );
+ osl_destroyCondition( maWaitingYieldCond );
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::wakeupYield()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData )
+{
+ osl_acquireMutex( maUserEventListMutex );
+ maUserEvents.push_back( SalUserEvent( pFrame, pData, nType ) );
+ osl_releaseMutex( maUserEventListMutex );
+
+ // notify main loop that an event has arrived
+ wakeupYield();
+}
+
+// -----------------------------------------------------------------------
+
+osl::SolarMutex* IosSalInstance::GetYieldMutex()
+{
+ return mpSalYieldMutex;
+}
+
+// -----------------------------------------------------------------------
+
+sal_uLong IosSalInstance::ReleaseYieldMutex()
+{
+ SalYieldMutex* pYieldMutex = mpSalYieldMutex;
+ if ( pYieldMutex->GetThreadId() ==
+ osl::Thread::getCurrentIdentifier() )
+ {
+ sal_uLong nCount = pYieldMutex->GetAcquireCount();
+ sal_uLong n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+
+ return nCount;
+ }
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::AcquireYieldMutex( sal_uLong nCount )
+{
+ SalYieldMutex* pYieldMutex = mpSalYieldMutex;
+ while ( nCount )
+ {
+ pYieldMutex->acquire();
+ nCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+bool IosSalInstance::CheckYieldMutex()
+{
+ bool bRet = true;
+
+ SalYieldMutex* pYieldMutex = mpSalYieldMutex;
+ if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier())
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+bool IosSalInstance::isUIAppThread() const
+{
+ return osl::Thread::getCurrentIdentifier() == maMainThread;
+}
+
+// -----------------------------------------------------------------------
+
+class ReleasePoolHolder
+{
+ NSAutoreleasePool* mpPool;
+ public:
+ ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {}
+ ~ReleasePoolHolder() { [mpPool release]; }
+};
+
+void IosSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
+{
+ // ensure that the per thread autorelease pool is top level and
+ // will therefore not be destroyed by cocoa implicitly
+ SalData::ensureThreadAutoreleasePool();
+
+ // NSAutoreleasePool documentation suggests we should have
+ // an own pool for each yield level
+ ReleasePoolHolder aReleasePool;
+
+ // Release all locks so that we don't deadlock when we pull pending
+ // events from the event queue
+ bool bDispatchUser = true;
+ while( bDispatchUser )
+ {
+ sal_uLong nCount = ReleaseYieldMutex();
+
+ // get one user event
+ osl_acquireMutex( maUserEventListMutex );
+ SalUserEvent aEvent( NULL, NULL, 0 );
+ if( ! maUserEvents.empty() )
+ {
+ aEvent = maUserEvents.front();
+ maUserEvents.pop_front();
+ }
+ else
+ bDispatchUser = false;
+ osl_releaseMutex( maUserEventListMutex );
+
+ AcquireYieldMutex( nCount );
+
+ // dispatch it
+ if( aEvent.mpFrame && IosSalFrame::isAlive( aEvent.mpFrame ) )
+ {
+ aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData );
+ osl_setCondition( maWaitingYieldCond );
+ // return if only one event is asked for
+ if( ! bHandleAllCurrentEvents )
+ return;
+ }
+ }
+
+ // handle event queue
+ // events mye be only handled in the thread the app was created
+ if( mnActivePrintJobs == 0 )
+ {
+ // we need to be woken up by a cocoa-event
+ // if a user event should be posted by the event handling below
+ bool bOldWaitingYield = mbWaitingYield;
+ mbWaitingYield = bWait;
+
+ mbWaitingYield = bOldWaitingYield;
+
+ // collect update rectangles
+ const std::list< IosSalFrame* > rFrames( GetSalData()->maFrames );
+ for( std::list< IosSalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
+ {
+ if( (*it)->mbShown && ! (*it)->maInvalidRect.IsEmpty() )
+ {
+ (*it)->Flush( (*it)->maInvalidRect );
+ (*it)->maInvalidRect.SetEmpty();
+ }
+ }
+ osl_setCondition( maWaitingYieldCond );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+bool IosSalInstance::AnyInput( sal_uInt16 nType )
+{
+ if( nType & INPUT_APPEVENT )
+ {
+ if( ! aAppEventList.empty() )
+ return true;
+ if( nType == INPUT_APPEVENT )
+ return false;
+ }
+
+ if( nType & INPUT_TIMER )
+ {
+ if( IosSalTimer::pRunningTimer )
+ {
+ NSDate* pDt = [IosSalTimer::pRunningTimer fireDate];
+ if( pDt && [pDt timeIntervalSinceNow] < 0 )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* IosSalInstance::CreateChildFrame( SystemParentData*, sal_uLong /*nSalFrameStyle*/ )
+{
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* IosSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameStyle )
+{
+ SalData::ensureThreadAutoreleasePool();
+
+ SalFrame* pFrame = new IosSalFrame( pParent, nSalFrameStyle );
+ return pFrame;
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::DestroyFrame( SalFrame* pFrame )
+{
+ delete pFrame;
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* IosSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /* pWindowData */, sal_Bool /* bShow */ )
+{
+ // SystemWindowData is meaningless on Mac OS X
+ IosSalObject *pObject = NULL;
+
+ if ( pParent )
+ pObject = new IosSalObject( static_cast<IosSalFrame*>(pParent) );
+
+ return pObject;
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::DestroyObject( SalObject* pObject )
+{
+ delete ( pObject );
+}
+
+SalSystem* IosSalInstance::CreateSystem()
+{
+ return new IosSalSystem();
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::DestroySystem( SalSystem* pSystem )
+{
+ delete pSystem;
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::SetEventCallback( void*, bool(*)(void*,void*,int) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void IosSalInstance::SetErrorEventCallback( void*, bool(*)(void*,void*,int) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void* IosSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes )
+{
+ rReturnedBytes = 1;
+ rReturnedType = AsciiCString;
+ return (void*)"";
+}
+
+// We need to re-encode file urls because osl_getFileURLFromSystemPath converts
+// to UTF-8 before encoding non ascii characters, which is not what other apps expect.
+static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl)
+{
+ rtl::OUString extUrl;
+
+ uno::Reference< lang::XMultiServiceFactory > sm = comphelper::getProcessServiceFactory();
+ if (sm.is())
+ {
+ uno::Reference< beans::XPropertySet > pset;
+ sm->queryInterface( getCppuType( &pset )) >>= pset;
+ if (pset.is())
+ {
+ uno::Reference< uno::XComponentContext > context;
+ static const rtl::OUString DEFAULT_CONTEXT( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) );
+ pset->getPropertyValue(DEFAULT_CONTEXT) >>= context;
+ if (context.is())
+ extUrl = uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl);
+ }
+ }
+ return extUrl;
+}
+
+// #i104525# many versions of OSX have problems with some URLs:
+// when an app requests OSX to add one of these URLs to the "Recent Items" list
+// then this app gets killed (TextEdit, Preview, etc. and also OOo)
+static bool isDangerousUrl( const rtl::OUString& rUrl )
+{
+ // use a heuristic that detects all known cases since there is no official comment
+ // on the exact impact and root cause of the OSX bug
+ const int nLen = rUrl.getLength();
+ const sal_Unicode* p = rUrl.getStr();
+ for( int i = 0; i < nLen-3; ++i, ++p ) {
+ if( p[0] != '%' )
+ continue;
+ // escaped percent?
+ if( (p[1] == '2') && (p[2] == '5') )
+ return true;
+ // escapes are considered to be UTF-8 encoded
+ // => check for invalid UTF-8 leading byte
+ if( (p[1] != 'f') && (p[1] != 'F') )
+ continue;
+ int cLowNibble = p[2];
+ if( (cLowNibble >= '0' ) && (cLowNibble <= '9'))
+ return false;
+ if( cLowNibble >= 'a' )
+ cLowNibble -= 'a' - 'A';
+ if( (cLowNibble < 'A') || (cLowNibble >= 'C'))
+ return true;
+ }
+
+ return false;
+}
+
+void IosSalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& /*rMimeType*/)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalTimer* IosSalInstance::CreateSalTimer()
+{
+ return new IosSalTimer();
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem* IosSalInstance::CreateSalSystem()
+{
+ return new IosSalSystem();
+}
+
+// -----------------------------------------------------------------------
+
+SalBitmap* IosSalInstance::CreateSalBitmap()
+{
+ return new IosSalBitmap();
+}
+
+// -----------------------------------------------------------------------
+
+SalSession* IosSalInstance::CreateSalSession()
+{
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+// YieldMutexReleaser
+YieldMutexReleaser::YieldMutexReleaser() : mnCount( 0 )
+{
+ SalData* pSalData = GetSalData();
+ if( ! pSalData->mpFirstInstance->isUIAppThread() )
+ {
+ SalData::ensureThreadAutoreleasePool();
+ mnCount = pSalData->mpFirstInstance->ReleaseYieldMutex();
+ }
+}
+
+YieldMutexReleaser::~YieldMutexReleaser()
+{
+ if( mnCount != 0 )
+ GetSalData()->mpFirstInstance->AcquireYieldMutex( mnCount );
+}
+
+//////////////////////////////////////////////////////////////
+rtl::OUString GetOUString( CFStringRef rStr )
+{
+ if( rStr == 0 )
+ return rtl::OUString();
+ CFIndex nLength = CFStringGetLength( rStr );
+ if( nLength == 0 )
+ return rtl::OUString();
+ const UniChar* pConstStr = CFStringGetCharactersPtr( rStr );
+ if( pConstStr )
+ return rtl::OUString( pConstStr, nLength );
+ UniChar* pStr = reinterpret_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) );
+ CFRange aRange = { 0, nLength };
+ CFStringGetCharacters( rStr, aRange, pStr );
+ rtl::OUString aRet( pStr, nLength );
+ rtl_freeMemory( pStr );
+ return aRet;
+}
+
+rtl::OUString GetOUString( NSString* pStr )
+{
+ if( ! pStr )
+ return rtl::OUString();
+ int nLen = [pStr length];
+ if( nLen == 0 )
+ return rtl::OUString();
+
+ rtl::OUStringBuffer aBuf( nLen+1 );
+ aBuf.setLength( nLen );
+ [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
+ return aBuf.makeStringAndClear();
+}
+
+CFStringRef CreateCFString( const rtl::OUString& rStr )
+{
+ return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() );
+}
+
+NSString* CreateNSString( const rtl::OUString& rStr )
+{
+ return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()];
+}
+
+CGImageRef CreateCGImage( const Image& rImage )
+{
+ BitmapEx aBmpEx( rImage.GetBitmapEx() );
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+
+ if( ! aBmp || ! aBmp.ImplGetImpBitmap() )
+ return NULL;
+
+ // simple case, no transparency
+ IosSalBitmap* pSalBmp = static_cast<IosSalBitmap*>(aBmp.ImplGetImpBitmap()->ImplGetSalBitmap());
+
+ if( ! pSalBmp )
+ return NULL;
+
+ CGImageRef xImage = NULL;
+ if( ! (aBmpEx.IsAlpha() || aBmpEx.IsTransparent() ) )
+ xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
+ else if( aBmpEx.IsAlpha() )
+ {
+ AlphaMask aAlphaMask( aBmpEx.GetAlpha() );
+ Bitmap aMask( aAlphaMask.GetBitmap() );
+ IosSalBitmap* pMaskBmp = static_cast<IosSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap());
+ if( pMaskBmp )
+ xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
+ else
+ xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
+ }
+ else if( aBmpEx.GetTransparentType() == TRANSPARENT_BITMAP )
+ {
+ Bitmap aMask( aBmpEx.GetMask() );
+ IosSalBitmap* pMaskBmp = static_cast<IosSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap());
+ if( pMaskBmp )
+ xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
+ else
+ xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
+ }
+ else if( aBmpEx.GetTransparentType() == TRANSPARENT_COLOR )
+ {
+ Color aTransColor( aBmpEx.GetTransparentColor() );
+ SalColor nTransColor = MAKE_SALCOLOR( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() );
+ xImage = pSalBmp->CreateColorMask( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight, nTransColor );
+ }
+
+ return xImage;
+}
+
+UIImage* CreateNSImage( const Image& rImage )
+{
+ CGImageRef xImage = CreateCGImage( rImage );
+
+ if( ! xImage )
+ return nil;
+
+ Size aSize( rImage.GetSizePixel() );
+ UIImage* pImage = [[UIImage alloc] initWithCGImage: xImage];
+ CGImageRelease( xImage );
+
+ return pImage;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/salnstimer.mm b/vcl/ios/source/app/salnstimer.mm
new file mode 100644
index 000000000000..05445110d8ba
--- /dev/null
+++ b/vcl/ios/source/app/salnstimer.mm
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "ios/saltimer.h"
+#include "ios/salnstimer.h"
+#include "ios/salinst.h"
+#include "ios/saldata.hxx"
+
+#include "svdata.hxx"
+
+@implementation TimerCallbackCaller
+-(void)timerElapsed:(NSTimer*)pTimer
+{
+ (void)pTimer;
+ ImplSVData* pSVData = ImplGetSVData();
+ if( IosSalTimer::bDispatchTimer )
+ {
+ if( pSVData->mpSalTimer )
+ {
+ YIELD_GUARD;
+ pSVData->mpSalTimer->CallCallback();
+
+ // NSTimer does not end nextEventMatchingMask of NSApplication
+ // so we need to wakeup a waiting Yield to inform it something happened
+ GetSalData()->mpFirstInstance->wakeupYield();
+ }
+ }
+}
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/salsys.cxx b/vcl/ios/source/app/salsys.cxx
new file mode 100644
index 000000000000..1baf357d85a9
--- /dev/null
+++ b/vcl/ios/source/app/salsys.cxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "tools/rc.hxx"
+
+#include "rtl/ustrbuf.hxx"
+
+#include "vcl/button.hxx"
+
+#include "ios/salsys.h"
+#include "ios/saldata.hxx"
+#include "ios/salinst.h"
+
+#include "svids.hrc"
+
+using ::rtl::OUString;
+
+// =======================================================================
+
+IosSalSystem::~IosSalSystem()
+{
+}
+
+unsigned int IosSalSystem::GetDisplayScreenCount()
+{
+ NSArray* pScreens = [UIScreen screens];
+ return pScreens ? [pScreens count] : 1;
+}
+
+bool IosSalSystem::IsMultiDisplay()
+{
+ return false;
+}
+
+unsigned int IosSalSystem::GetDefaultDisplayNumber()
+{
+ return 0;
+}
+
+Rectangle IosSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen )
+{
+ NSArray* pScreens = [UIScreen screens];
+ Rectangle aRet;
+ UIScreen* pScreen = nil;
+ if( pScreens && nScreen < [pScreens count] )
+ pScreen = [pScreens objectAtIndex: nScreen];
+ else
+ pScreen = [UIScreen mainScreen];
+
+ if( pScreen )
+ {
+ CGRect aFrame = pScreen.bounds;
+ aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ),
+ Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) );
+ }
+ return aRet;
+}
+
+Rectangle IosSalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen )
+{
+ NSArray* pScreens = [UIScreen screens];
+ Rectangle aRet;
+ UIScreen* pScreen = nil;
+ if( pScreens && nScreen < [pScreens count] )
+ pScreen = [pScreens objectAtIndex: nScreen];
+ else
+ pScreen = [UIScreen mainScreen];
+
+ if( pScreen )
+ {
+ CGRect aFrame = pScreen.applicationFrame;
+ aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ),
+ Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) );
+ }
+ return aRet;
+}
+
+rtl::OUString IosSalSystem::GetScreenName( unsigned int nScreen )
+{
+ NSArray* pScreens = [UIScreen screens];
+ OUString aRet;
+ if( nScreen < [pScreens count] )
+ {
+ ResMgr* pMgr = ImplGetResMgr();
+ if( pMgr )
+ {
+ String aScreenName( ResId( SV_MAC_SCREENNNAME, *pMgr ) );
+ aScreenName.SearchAndReplaceAllAscii( "%d", String::CreateFromInt32( nScreen ) );
+ aRet = aScreenName;
+ }
+ }
+ return aRet;
+}
+
+static NSString* getStandardString( int nButtonId )
+{
+ rtl::OUString aText( Button::GetStandardText( nButtonId ) );
+ if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource
+ {
+ switch( nButtonId )
+ {
+ case BUTTON_OK: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OK" ) );break;
+ case BUTTON_ABORT: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) );break;
+ case BUTTON_CANCEL: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cancel" ) );break;
+ case BUTTON_RETRY: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Retry" ) );break;
+ case BUTTON_YES: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yes" ) );break;
+ case BUTTON_NO : aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break;
+ }
+ }
+ return aText.getLength() ? CreateNSString( aText) : nil;
+}
+
+@interface MessageboxDelegate : NSObject <UIAlertViewDelegate>
+{
+ int *_resultPtr;
+}
+- (id)initWithResultPtr:(int *)resultPtr;
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
+@end
+
+@implementation MessageboxDelegate
+- (id)initWithResultPtr:(int *)resultPtr
+{
+ _resultPtr = resultPtr;
+ return [super init];
+}
+
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+ *_resultPtr = buttonIndex;
+}
+@end
+
+int IosSalSystem::ShowNativeMessageBox( const String& rTitle,
+ const String& rMessage,
+ int nButtonCombination,
+ int nDefaultButton)
+{
+ NSString* pTitle = CreateNSString( rTitle );
+ NSString* pMessage = CreateNSString( rMessage );
+
+ struct id_entry
+ {
+ int nCombination;
+ int nDefaultButton;
+ int nTextIds[3];
+ } aButtonIds[] =
+ {
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } }
+ };
+
+ NSString* pDefText = nil;
+ NSString* pAltText = nil;
+ NSString* pOthText = nil;
+
+ unsigned int nC;
+ for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ )
+ {
+ if( aButtonIds[nC].nCombination == nButtonCombination )
+ {
+ if( aButtonIds[nC].nDefaultButton == nDefaultButton )
+ {
+ if( aButtonIds[nC].nTextIds[0] != -1 )
+ pDefText = getStandardString( aButtonIds[nC].nTextIds[0] );
+ if( aButtonIds[nC].nTextIds[1] != -1 )
+ pAltText = getStandardString( aButtonIds[nC].nTextIds[1] );
+ if( aButtonIds[nC].nTextIds[2] != -1 )
+ pOthText = getStandardString( aButtonIds[nC].nTextIds[2] );
+ break;
+ }
+ }
+ }
+
+ int nResult = 1; // ???
+ // How to do the delegate when this is C++?
+ MessageboxDelegate *delegate = [[MessageboxDelegate alloc] initWithResultPtr: &nResult];
+ UIAlertView *view = [[UIAlertView alloc] initWithTitle: pTitle message: pMessage delegate: delegate
+ cancelButtonTitle: @"Cancel" otherButtonTitles: nil];
+ [view show];
+ [view dealloc];
+ [delegate dealloc];
+
+ if( pTitle )
+ [pTitle release];
+ if( pMessage )
+ [pMessage release];
+ if( pDefText )
+ [pDefText release];
+ if( pAltText )
+ [pAltText release];
+ if( pOthText )
+ [pOthText release];
+
+ int nRet = 0;
+ if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 )
+ {
+ int nPressed = aButtonIds[nC].nTextIds[nResult-1];
+ switch( nPressed )
+ {
+ case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break;
+ case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break;
+ case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break;
+ case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break;
+ case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break;
+ case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break;
+ case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break;
+ }
+ }
+
+ return nRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/saltimer.cxx b/vcl/ios/source/app/saltimer.cxx
new file mode 100644
index 000000000000..69401ea502d7
--- /dev/null
+++ b/vcl/ios/source/app/saltimer.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "ios/saltimer.h"
+#include "ios/salnstimer.h"
+#include "ios/saldata.hxx"
+#include "ios/salframe.h"
+#include "ios/salinst.h"
+
+// =======================================================================
+
+NSTimer* IosSalTimer::pRunningTimer = nil;
+bool IosSalTimer::bDispatchTimer = false;
+
+
+void ImplSalStartTimer( sal_uLong nMS )
+{
+ SalData* pSalData = GetSalData();
+ if( pSalData->mpFirstInstance->isUIAppThread() )
+ {
+ IosSalTimer::bDispatchTimer = true;
+ NSTimeInterval aTI = double(nMS)/1000.0;
+ if( IosSalTimer::pRunningTimer != nil )
+ {
+ if( [IosSalTimer::pRunningTimer timeInterval] == aTI )
+ // set new fire date
+ [IosSalTimer::pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]];
+ else
+ {
+ [IosSalTimer::pRunningTimer invalidate];
+ IosSalTimer::pRunningTimer = nil;
+ }
+ }
+ if( IosSalTimer::pRunningTimer == nil )
+ {
+ IosSalTimer::pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI
+ target: [[[TimerCallbackCaller alloc] init] autorelease]
+ selector: @selector(timerElapsed:)
+ userInfo: nil
+ repeats: YES];
+ }
+ }
+ else
+ {
+ SalData::ensureThreadAutoreleasePool();
+ // post an event so we can get into the main thread
+ // ???
+ }
+}
+
+void ImplSalStopTimer()
+{
+ IosSalTimer::bDispatchTimer = false;
+}
+
+IosSalTimer::IosSalTimer( )
+{
+}
+
+IosSalTimer::~IosSalTimer()
+{
+ ImplSalStopTimer();
+}
+
+void IosSalTimer::Start( sal_uLong nMS )
+{
+ ImplSalStartTimer( nMS );
+}
+
+void IosSalTimer::Stop()
+{
+ ImplSalStopTimer();
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/vcluiapp.mm b/vcl/ios/source/app/vcluiapp.mm
new file mode 100644
index 000000000000..e40d8a7eb792
--- /dev/null
+++ b/vcl/ios/source/app/vcluiapp.mm
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "rtl/ustrbuf.hxx"
+
+#include "vcl/window.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/cmdevt.hxx"
+
+#include "ios/vcluiapp.h"
+#include "ios/salinst.h"
+#include "ios/saldata.hxx"
+#include "ios/salframe.h"
+#include "ios/salframeview.h"
+
+#include "impimagetree.hxx"
+
+@implementation VCL_UIApplication
+-(void)sendEvent:(UIEvent*)pEvent
+{
+ UIEventType eType = [pEvent type];
+ [super sendEvent: pEvent];
+}
+
+-(void)sendSuperEvent:(UIEvent*)pEvent
+{
+ [super sendEvent: pEvent];
+}
+
+-(BOOL)application: (UIApplication*)app openFile: (NSString*)pFile
+{
+ (void)app;
+ const rtl::OUString aFile( GetOUString( pFile ) );
+ return YES;
+}
+
+-(void)application: (UIApplication*) app openFiles: (NSArray*)files
+{
+ (void)app;
+ rtl::OUStringBuffer aFileList( 256 );
+
+ NSEnumerator* it = [files objectEnumerator];
+ NSString* pFile = nil;
+
+ while( (pFile = [it nextObject]) != nil )
+ {
+ const rtl::OUString aFile( GetOUString( pFile ) );
+ }
+
+ if( aFileList.getLength() )
+ {
+ // we have no back channel here, we have to assume success, in which case
+ // replyToOpenOrPrint does not need to be called according to documentation
+ // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
+ const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
+ APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() );
+ IosSalInstance::aAppEventList.push_back( pAppEvent );
+ }
+}
+
+-(void)addFallbackMenuItem: (UIMenuItem*)pNewItem
+{
+ IosSalMenu::addFallbackMenuItem( pNewItem );
+}
+
+-(void)removeFallbackMenuItem: (UIMenuItem*)pItem
+{
+ IosSalMenu::removeFallbackMenuItem( pItem );
+}
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx
index 80e853b3b654..0c3adf887023 100644
--- a/vcl/source/salmain/salmain.cxx
+++ b/vcl/source/salmain/salmain.cxx
@@ -36,7 +36,7 @@
#include "salinst.hxx"
-SAL_IMPLEMENT_MAIN() {
+SAL_IMPLEMENT_MAIN_WITH_GUI() {
tools::extendApplicationEnvironment();
return SVMain();
}
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index f72decce183e..1de33b56b15b 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -250,6 +250,9 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava )
// FIXME: this is wrong
nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView );
(void)bUseJava;
+#elif defined IOS
+ // FIXME: this is wrong
+ nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView );
#elif defined UNX
if( !bUseJava )
{
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 1ab898011672..1e4157f5fcd3 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8428,6 +8428,16 @@ uno::Reference< XDragSource > Window::GetDragSource()
aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget"));
aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
+#elif defined IOS
+ /* What does LibreOffice's use of DND concepts mean on
+ * iOS, huh, is this both inter-app DND (which clearly is
+ * meaningless), or intra-app? Anyway, use the same code
+ * as for MacOSX for now, even if meaningless...
+ */
+ aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource"));
+ aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget"));
+ aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
+ aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
#elif defined UNX
aDropTargetAL.realloc( 3 );
aDragSourceAL.realloc( 3 );