[Libreoffice-commits] .: 3 commits - canvas/source svtools/Module_svtools.mk vcl/inc vcl/ios vcl/Library_vcl.mk vcl/source vcl/StaticLibrary_vclmain.mk

Tor Lillqvist tml at kemper.freedesktop.org
Thu Jul 14 13:58:36 PDT 2011


 canvas/source/cairo/cairo_quartz_cairo.cxx |   17 
 canvas/source/cairo/cairo_quartz_cairo.hxx |    6 
 canvas/source/cairo/cairo_textlayout.cxx   |    7 
 canvas/source/cairo/makefile.mk            |   12 
 svtools/Module_svtools.mk                  |   11 
 vcl/Library_vcl.mk                         |   33 +
 vcl/StaticLibrary_vclmain.mk               |    8 
 vcl/inc/ios/iosvcltypes.h                  |   37 +
 vcl/inc/ios/salbmp.h                       |  117 ++++
 vcl/inc/ios/salcolorutils.hxx              |   46 +
 vcl/inc/ios/saldata.hxx                    |  126 ++++
 vcl/inc/ios/salframe.h                     |  208 +++++++
 vcl/inc/ios/salframeview.h                 |  144 +++++
 vcl/inc/ios/salgdi.h                       |  401 ++++++++++++++
 vcl/inc/ios/salinst.h                      |  199 ++++++
 vcl/inc/ios/salmathutils.hxx               |   90 +++
 vcl/inc/ios/salmenu.h                      |  122 ++++
 vcl/inc/ios/salnstimer.h                   |   43 +
 vcl/inc/ios/salobj.h                       |   86 +++
 vcl/inc/ios/salprn.h                       |  173 ++++++
 vcl/inc/ios/salsys.h                       |   56 +
 vcl/inc/ios/saltimer.h                     |   54 +
 vcl/inc/ios/saluimenu.h                    |   62 ++
 vcl/inc/ios/salvd.h                        |   79 ++
 vcl/inc/ios/vcluiapp.h                     |   53 +
 vcl/inc/vcl/bitmap.hxx                     |    2 
 vcl/inc/vcl/sysdata.hxx                    |   23 
 vcl/ios/source/app/saldata.cxx             |  128 ++++
 vcl/ios/source/app/salinst.cxx             |  828 +++++++++++++++++++++++++++++
 vcl/ios/source/app/salnstimer.mm           |   59 ++
 vcl/ios/source/app/salsys.cxx              |  253 ++++++++
 vcl/ios/source/app/saltimer.cxx            |  104 +++
 vcl/ios/source/app/vcluiapp.mm             |  101 +++
 vcl/source/salmain/salmain.cxx             |    2 
 vcl/source/window/syschild.cxx             |    3 
 vcl/source/window/window.cxx               |   10 
 36 files changed, 3684 insertions(+), 19 deletions(-)

New commits:
commit ad770f21418e06d756cc6bb425f48203a2f7c48a
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Jul 14 22:45:11 2011 +0300

    Fix compilation for iOS

diff --git a/canvas/source/cairo/cairo_quartz_cairo.cxx b/canvas/source/cairo/cairo_quartz_cairo.cxx
index 7beaf0b..f2f29bf 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.cxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.cxx
@@ -29,9 +29,9 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_canvas.hxx"
 
-#ifdef QUARTZ
+#if defined QUARTZ || defined IOS
 /************************************************************************
- * Mac OS X/Quartz surface backend for OpenOffice.org Cairo Canvas      *
+ * Mac OS X/Quartz and iOS surface backend for OpenOffice.org Cairo Canvas      *
  ************************************************************************/
 
 #include <osl/diagnose.h>
@@ -205,13 +205,19 @@ namespace cairo
         CGContextRef mrContext = getCGContext();
         
         if (!mrContext) return;
-        
+#ifndef IOS        
         [mpView lockFocus];
-        
+#endif
+
+#ifndef IOS
         /**
          * This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() ) 
          */
         CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+#else
+        // Just guessing for now...
+        CGContextRef rViewContext = UIGraphicsGetCurrentContext();
+#endif
         CGImageRef xImage = CGBitmapContextCreateImage(mrContext);
         CGContextDrawImage(rViewContext, 
                            CGRectMake( 0, 0, 
@@ -220,8 +226,9 @@ namespace cairo
                            xImage);
         CGImageRelease( xImage );
         CGContextFlush( rViewContext );
-        
+#ifndef IOS
         [mpView unlockFocus];
+#endif
     }
 
     /**
diff --git a/canvas/source/cairo/cairo_quartz_cairo.hxx b/canvas/source/cairo/cairo_quartz_cairo.hxx
index a09ed91..58b6e1f 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.hxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.hxx
@@ -32,7 +32,13 @@
 #include "cairo_cairo.hxx"
 
 #include "premac.h"
+#include <TargetConditionals.h>
+#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
 #include <Cocoa/Cocoa.h>
+#else
+#include <UIKit/UIKit.h>
+#define NSView UIView
+#endif
 #include <cairo-quartz.h>
 #include "postmac.h"
 
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 8d5e735..1b2d15c 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -352,7 +352,7 @@ namespace cairocanvas
    **/
     bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
     {
-#if defined UNX && !defined QUARTZ
+#if defined UNX && !defined QUARTZ && !defined IOS
         // is font usable?
         if (!aSysFontData.nFontId) return false;
 #endif
@@ -502,9 +502,14 @@ namespace cairocanvas
             cairo_font_face_t* font_face = NULL;
 
     #ifdef CAIRO_HAS_QUARTZ_SURFACE
+
+      #ifdef QUARTZ
             // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
             //       when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
             font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID);
+      #else // iOS
+            font_face = cairo_quartz_font_face_create_for_cgfont( rSysFontData.rFont);
+      #endif
 
     #elif defined CAIRO_HAS_WIN32_SURFACE
       #if (OSL_DEBUG_LEVEL > 1)
diff --git a/canvas/source/cairo/makefile.mk b/canvas/source/cairo/makefile.mk
index 076deb2..59d1512 100644
--- a/canvas/source/cairo/makefile.mk
+++ b/canvas/source/cairo/makefile.mk
@@ -56,6 +56,10 @@ CFLAGS+=$(CAIRO_CFLAGS)
 CFLAGS+=-I$(SOLARINCDIR)/cairo
 .ENDIF
 
+.IF "$(OS)" == "IOS"
+CFLAGS+= -x objective-c++ -fobjc-exceptions -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300
+.ENDIF
+
 .IF "$(verbose)"!="" || "$(VERBOSE)"!=""
 CDEFS+= -DVERBOSE
 .ENDIF
@@ -88,18 +92,18 @@ SHL1STDLIBS+= $(CAIRO_LIBS)
 SHL1STDLIBS+= -lcairo -lpixman-1
 .ENDIF
 
-.IF "$(GUIBASE)"=="aqua"
-# native Mac OS X (Quartz)
+.IF "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
+# native Mac OS X (Quartz) or iOS
 SLOFILES+= $(SLO)$/cairo_quartz_cairo.obj
 CFLAGSCXX+=$(OBJCXXFLAGS)
-.ELSE    # "$(GUIBASE)"=="aqua"
+.ELSE    # "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
 
 # Xlib
 SLOFILES+= $(SLO)$/cairo_xlib_cairo.obj
 SHL1STDLIBS+= $(FONTCONFIG_LIBS) -lX11 -lXrender $(FREETYPE_LIBS)
 CFLAGS+= $(FREETYPE_CFLAGS)
 
-.ENDIF   # "$(GUIBASE)"=="aqua"
+.ENDIF   # "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
 
 .ELSE    # "$(GUI)"=="UNX" 
 
commit 0ba4bd4a37a114a1605edcd7b3c64b806d67fbd6
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Jul 14 11:02:21 2011 +0300

    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.

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 977facc..42e5714 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 79b3ddd..4c313f8 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 0000000..820547b
--- /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 at 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 0000000..2e6684c
--- /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 0000000..1a71c25
--- /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 0000000..22c0e44
--- /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 0000000..04aef84
--- /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 0000000..f9f3686
--- /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
+
+ at interface SalFrameWindow : UIWindow
+{
+    IosSalFrame*       mpFrame;
+    id mDraggingDestinationHandler;
+}
+-(id)initWithSalFrame: (IosSalFrame*)pFrame;
+-(BOOL)canBecomeKeyWindow;
+-(void)displayIfNeeded;
+-(void)becomeKeyWindow;
+-(void)resignKeyWindow;
+-(IosSalFrame*)getSalFrame;
+ at end
+
+ at 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;
+ at 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 0000000..bdafbbc
--- /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 0000000..665d216
--- /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 0000000..426924c
--- /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 0000000..3f143ac
--- /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 0000000..cf98276
--- /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"
+
+ at interface TimerCallbackCaller : NSObject
+{
+}
+-(void)timerElapsed:(NSTimer*)pTimer;
+ at 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 0000000..4ba7ea5
--- /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 0000000..a63791c
--- /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 0000000..e586c8d
--- /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 0000000..b597421
--- /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 0000000..ef54daa
--- /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;
+
+ at 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;
+ at end
+
+ at 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;
+ at 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 0000000..1cc9b76
--- /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 0000000..df4a01e
--- /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
+ at 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;
+ at end
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index f29d1b2..1cd97d1 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 0aab70e..02ee3db 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__
+ at 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 0000000..f292b6f
--- /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 );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list