summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-03-20 09:07:52 +0200
committerTor Lillqvist <tml@iki.fi>2013-03-21 13:28:32 +0200
commit63dcca42cebd3cb6f020ec75c0d225e1d7232e1c (patch)
treef1b1442af9d7f6f4736ca9621389f6fcc78179e8
parent27388c9483b5e00b593ac126092c5bbb131492b0 (diff)
Re-work the vcl aspects of the iOS port
Don't try to use similar code as for OS X to manage windows, events etc. I.e. don't use UIKit in vcl to do that. Instead, just do as in the Android port, use the "headless" vcl backend. Do keep using CoreText, though, not FreeType & fontconfig. Start changing the iOS "Viewer" app to correspond to the Android "desktop" app (so it should be renamed). Work in progress since a long time, several crucial details still missing, but committing for now. Change-Id: Iac5fbf8def415e4d0d21e5200450a373420ad7ee
-rw-r--r--desktop/source/app/sofficemain.cxx12
-rw-r--r--desktop/source/app/userinstall.cxx12
-rw-r--r--ios/CustomTarget_Viewer_app.mk2
-rw-r--r--ios/Executable_Viewer.mk10
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h19
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm31
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerWindow.h17
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerWindow.m26
-rw-r--r--ios/experimental/Viewer/Viewer/lo-viewer.h1
-rw-r--r--ios/experimental/Viewer/Viewer/lo-viewer.mm69
-rw-r--r--ios/experimental/Viewer/Viewer/main.mm1
-rw-r--r--sal/inc/osl/detail/ios-bootstrap.h54
-rw-r--r--sal/osl/unx/security.c4
-rw-r--r--toolkit/source/awt/vclxsystemdependentwindow.cxx15
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx10
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx11
-rw-r--r--toolkit/source/awt/vclxwindow1.cxx6
-rw-r--r--vcl/Library_vcl.mk50
-rw-r--r--vcl/aqua/source/a11y/aqua11yactionwrapper.mm1
-rw-r--r--vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm2
-rw-r--r--vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm1
-rw-r--r--vcl/aqua/source/a11y/aqua11ytextwrapper.mm2
-rw-r--r--vcl/aqua/source/a11y/aqua11ywrapper.mm2
-rw-r--r--vcl/aqua/source/app/salinst.cxx44
-rw-r--r--vcl/aqua/source/app/salsys.cxx1
-rw-r--r--vcl/aqua/source/app/vclnsapp.mm1
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm1
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx1
-rw-r--r--vcl/aqua/source/window/salframe.cxx1
-rw-r--r--vcl/aqua/source/window/salframeview.mm1
-rw-r--r--vcl/aqua/source/window/salmenu.cxx1
-rw-r--r--vcl/coretext/salcoretextfontutils.cxx6
-rw-r--r--vcl/coretext/salcoretextlayout.cxx5
-rw-r--r--vcl/coretext/salgdi.cxx43
-rw-r--r--vcl/headless/svpgdi.cxx9
-rw-r--r--vcl/inc/aqua/atsui/salgdi.h2
-rw-r--r--vcl/inc/aqua/salinst.h5
-rw-r--r--vcl/inc/coretext/salcoretextfontutils.hxx1
-rw-r--r--vcl/inc/coretext/salcoretextstyle.hxx6
-rw-r--r--vcl/inc/coretext/salgdi.h46
-rw-r--r--vcl/inc/headless/svpgdi.hxx29
-rw-r--r--vcl/inc/ios/iosinst.hxx60
-rw-r--r--vcl/inc/ios/saldata.hxx100
-rw-r--r--vcl/inc/ios/salframe.h206
-rw-r--r--vcl/inc/ios/salframeview.h60
-rw-r--r--vcl/inc/ios/salgdicommon.hxx79
-rw-r--r--vcl/inc/ios/salinst.h172
-rw-r--r--vcl/inc/ios/salmathutils.hxx81
-rw-r--r--vcl/inc/ios/salmenu.h44
-rw-r--r--vcl/inc/ios/salnstimer.h34
-rw-r--r--vcl/inc/ios/salobj.h72
-rw-r--r--vcl/inc/ios/salprn.h164
-rw-r--r--vcl/inc/ios/salsys.h45
-rw-r--r--vcl/inc/ios/saluimenu.h53
-rw-r--r--vcl/inc/ios/salvd.h67
-rw-r--r--vcl/inc/ios/vcluiapp.h43
-rw-r--r--vcl/inc/quartz/salbmp.h2
-rw-r--r--vcl/inc/quartz/salgdicommon.hxx (renamed from vcl/inc/aqua/salgdicommon.hxx)8
-rw-r--r--vcl/inc/quartz/utils.h (renamed from vcl/inc/ios/saltimer.h)32
-rw-r--r--vcl/inc/saldatabasic.hxx9
-rw-r--r--vcl/inc/vcl/sysdata.hxx10
-rw-r--r--vcl/ios/dummies.cxx146
-rw-r--r--vcl/ios/iosinst.cxx312
-rw-r--r--vcl/ios/source/app/saldata.cxx72
-rw-r--r--vcl/ios/source/app/salinst.cxx806
-rw-r--r--vcl/ios/source/app/salnstimer.mm48
-rw-r--r--vcl/ios/source/app/salsys.cxx239
-rw-r--r--vcl/ios/source/app/saltimer.cxx93
-rw-r--r--vcl/ios/source/app/vcluiapp.mm90
-rw-r--r--vcl/ios/source/dtrans/iOSTransferable.cxx179
-rw-r--r--vcl/ios/source/dtrans/iOSTransferable.hxx86
-rw-r--r--vcl/ios/source/dtrans/ios_clipboard.cxx377
-rw-r--r--vcl/ios/source/dtrans/ios_clipboard.hxx173
-rw-r--r--vcl/ios/source/dtrans/service_entry.cxx62
-rw-r--r--vcl/ios/source/gdi/salgdicommon.cxx1599
-rw-r--r--vcl/ios/source/gdi/salgdiutils.cxx304
-rw-r--r--vcl/ios/source/gdi/salnativewidgets.cxx249
-rw-r--r--vcl/ios/source/gdi/salvd.cxx249
-rw-r--r--vcl/ios/source/window/salframe.cxx1106
-rw-r--r--vcl/ios/source/window/salframeview.mm263
-rw-r--r--vcl/ios/source/window/salmenu.cxx62
-rw-r--r--vcl/ios/source/window/salobj.cxx201
-rw-r--r--vcl/quartz/salbmp.cxx9
-rw-r--r--vcl/quartz/utils.cxx67
-rw-r--r--vcl/source/window/syschild.cxx3
-rw-r--r--vcl/source/window/window.cxx14
86 files changed, 908 insertions, 7803 deletions
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index 6bd67fb4c3e5..f1ca8027233a 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -89,16 +89,24 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
#endif
}
-#ifdef ANDROID
+#if defined(ANDROID) || defined(IOS)
+#ifdef ANDROID
extern "C" SAL_JNI_EXPORT void JNICALL
Java_org_libreoffice_experimental_desktop_Desktop_runMain(JNIEnv* /* env */,
jobject /* clazz */)
+#else
+extern "C"
+void
+lo_runMain()
+#endif
{
int nRet;
do {
nRet = soffice_main();
- LOGI("soffice_main returned %d", nRet );
+#ifdef ANDROID
+ LOGI("soffice_main returned %d", nRet);
+#endif
} while (nRet == EXITHELPER_NORMAL_RESTART ||
nRet == EXITHELPER_CRASH_WITH_RESTART); // pretend to re-start.
diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx
index 612a804945d6..1ae05ceaad09 100644
--- a/desktop/source/app/userinstall.cxx
+++ b/desktop/source/app/userinstall.cxx
@@ -116,6 +116,7 @@ namespace desktop {
}
}
+#if !defined(ANDROID) && !defined(IOS)
static osl::FileBase::RC copy_recursive( const rtl::OUString& srcUnqPath, const rtl::OUString& dstUnqPath)
{
FileBase::RC err;
@@ -166,14 +167,9 @@ namespace desktop {
err = File::copy( srcUnqPath,dstUnqPath );
}
-#ifdef ANDROID
- fprintf (stderr, "copy_recursive '%s' to '%s' returns (%d)0x%x\n",
- rtl::OUStringToOString(srcUnqPath, RTL_TEXTENCODING_UTF8).getStr(),
- rtl::OUStringToOString(dstUnqPath, RTL_TEXTENCODING_UTF8).getStr(),
- (int)err, (int)err);
-#endif
return err;
}
+#endif
static UserInstall::UserInstallStatus create_user_install(OUString& aUserPath)
{
@@ -185,12 +181,12 @@ namespace desktop {
FileBase::RC rc = Directory::createPath(aUserPath);
if ((rc != FileBase::E_None) && (rc != FileBase::E_EXIST)) return UserInstall::E_Creation;
-#ifdef UNIX
+#if defined(UNIX) && !defined(ANDROID) && !defined(IOS)
// Set safer permissions for the user directory by default:
File::setAttributes(aUserPath, osl_File_Attribute_OwnWrite| osl_File_Attribute_OwnRead| osl_File_Attribute_OwnExe);
#endif
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(IOS)
// as of now osl_copyFile does not work on Android => don't do this.
// Copy data from shared data directory of base installation:
diff --git a/ios/CustomTarget_Viewer_app.mk b/ios/CustomTarget_Viewer_app.mk
index 03daa6aa9008..cd79db17a2f0 100644
--- a/ios/CustomTarget_Viewer_app.mk
+++ b/ios/CustomTarget_Viewer_app.mk
@@ -114,7 +114,7 @@ $(SCRIPT_OUTPUT_FILE_0) : $(call gb_Executable_get_target,Viewer)
echo '[Bootstrap]' && \
echo 'InstallMode=<installmode>' && \
echo 'ProductKey=LibreOffice Viewer $(PRODUCTVERSION)' && \
- echo 'UserInstallation=file://$$APP_DATA_DIR' && \
+ echo 'UserInstallation=file://$$APP_DATA_DIR/../Library/Application%20Support' && \
: ) > $(appdir)/program/bootstraprc
#
# Is this really needed?
diff --git a/ios/Executable_Viewer.mk b/ios/Executable_Viewer.mk
index d52962127e72..edfc498b1b8e 100644
--- a/ios/Executable_Viewer.mk
+++ b/ios/Executable_Viewer.mk
@@ -27,6 +27,10 @@ $(eval $(call gb_Executable_add_objcxxobjects,Viewer,\
ios/experimental/Viewer/Viewer/main \
))
+$(eval $(call gb_Executable_add_objcobjects,Viewer,\
+ ios/experimental/Viewer/Viewer/LOViewerWindow \
+))
+
# The executables built for iOS link to all LO libs statically. The
# link command just uses the wildcard function to list all of them.
# Instead of tediously here declare dependencies on the transitive
@@ -41,4 +45,10 @@ $(eval $(call gb_Executable_use_libraries,Viewer,\
swui \
))
+# Mark the executable as depending on all libraries so that it gets
+# rebuilt if any library has been rebuilt. Avoids need for "make
+# ios.clean".
+
+$(call gb_LinkTarget_get_target,Executable/Viewer) : $(wildcard $(OUTDIR)/lib/lib*.a)
+
# vim: set ts=4 sw=4 et:
diff --git a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h
index 7f4b724b94f8..c1737a01e342 100644
--- a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h
+++ b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h
@@ -1,16 +1,23 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// LOViewerAppDelegate.h
-// Viewer
-//
-// Created by Tor Lillqvist on 2012-11-27.
-// Copyright (c) 2012 Tor Lillqvist. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import <UIKit/UIKit.h>
+#import "LOViewerWindow.h"
+
@interface LOViewerAppDelegate : UIResponder <UIApplicationDelegate>
+{
+ int nbytes;
+ char *pixelBuffer;
+ CGImageRef image;
+}
-@property (strong, nonatomic) UIWindow *window;
+@property (strong, nonatomic) LOViewerWindow *window;
- (void) threadMainMethod: (id) argument;
diff --git a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm
index cc1e8d2f3c17..f9678c4f7393 100644
--- a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm
+++ b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm
@@ -5,16 +5,20 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-//
#include <stdlib.h>
#import <UIKit/UIKit.h>
+#include <osl/detail/ios-bootstrap.h>
+
#import "LOViewerAppDelegate.h"
+#import "LOViewerWindow.h"
#include "lo-viewer.h"
+static UIWindow *theWindow;
+
@implementation LOViewerAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -22,10 +26,25 @@
(void) application;
(void) launchOptions;
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ CGRect bounds = [[UIScreen mainScreen] bounds];
+ self.window = [[LOViewerWindow alloc] initWithFrame:bounds];
+
+ theWindow = self.window;
self.window.backgroundColor = [UIColor whiteColor];
+ nbytes = bounds.size.width * bounds.size.height * 4;
+
+ pixelBuffer = (char *) malloc(nbytes);
+ memset(pixelBuffer, 0xFF, nbytes);
+
+ CGDataProviderRef provider = CGDataProviderCreateWithData( NULL, pixelBuffer, nbytes, NULL);
+ image = CGImageCreate(bounds.size.width, bounds.size.height, 8, 32, bounds.size.width*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaFirst, provider, NULL, false, kCGRenderingIntentDefault);
+
+ self.window.bounds = bounds;
+ self.window.pixelBuffer = pixelBuffer;
+ self.window.image = image;
+
[self.window makeKeyAndVisible];
NSThread* thread = [[NSThread alloc] initWithTarget:self
@@ -41,9 +60,8 @@
(void) argument;
@autoreleasepool {
-
lo_initialize();
-
+ lo_runMain();
}
}
@@ -86,4 +104,9 @@
@end
+extern "C" void lo_damaged()
+{
+ [theWindow performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:YES];
+}
+
// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/experimental/Viewer/Viewer/LOViewerWindow.h b/ios/experimental/Viewer/Viewer/LOViewerWindow.h
new file mode 100644
index 000000000000..b8f509f98471
--- /dev/null
+++ b/ios/experimental/Viewer/Viewer/LOViewerWindow.h
@@ -0,0 +1,17 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface LOViewerWindow : UIWindow
+@property CGRect bounds;
+@property char *pixelBuffer;
+@property CGImageRef image;
+- (void)drawRect:(CGRect)rect;
+@end
diff --git a/ios/experimental/Viewer/Viewer/LOViewerWindow.m b/ios/experimental/Viewer/Viewer/LOViewerWindow.m
new file mode 100644
index 000000000000..1ce91033f384
--- /dev/null
+++ b/ios/experimental/Viewer/Viewer/LOViewerWindow.m
@@ -0,0 +1,26 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#import "LOViewerWindow.h"
+
+#include <osl/detail/ios-bootstrap.h>
+
+@implementation LOViewerWindow
+
+- (void)drawRect:(CGRect)rect
+{
+ (void) rect;
+
+ lo_render_windows([self pixelBuffer], [self bounds].size.width, [self bounds].size.height);
+
+ CGContextRef context = UIGraphicsGetCurrentContext();
+
+ CGContextDrawImage(context, [self bounds], [self image]);
+}
+
+@end
diff --git a/ios/experimental/Viewer/Viewer/lo-viewer.h b/ios/experimental/Viewer/Viewer/lo-viewer.h
index 1ce2031811a7..9d08e3a8b851 100644
--- a/ios/experimental/Viewer/Viewer/lo-viewer.h
+++ b/ios/experimental/Viewer/Viewer/lo-viewer.h
@@ -5,7 +5,6 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-//
#ifndef LO_VIEWER_H
#define LO_VIEWER_H
diff --git a/ios/experimental/Viewer/Viewer/lo-viewer.mm b/ios/experimental/Viewer/Viewer/lo-viewer.mm
index ff543fc9df6e..97669f14584e 100644
--- a/ios/experimental/Viewer/Viewer/lo-viewer.mm
+++ b/ios/experimental/Viewer/Viewer/lo-viewer.mm
@@ -5,7 +5,6 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-//
#include <stdlib.h>
@@ -72,6 +71,7 @@ extern "C" {
extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * uui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xmlfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xmlsecurity_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xo_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
@@ -108,6 +108,7 @@ lo_get_libmap(void)
{ "libsdlo.a", sd_component_getFactory },
{ "libsmdlo.a", smd_component_getFactory },
{ "libsmlo.a", sm_component_getFactory },
+ { "libspelllo.a", spell_component_getFactory },
{ "libsvgfilterlo.a", svgfilter_component_getFactory },
{ "libswdlo.a", swd_component_getFactory },
{ "libswlo.a", sw_component_getFactory },
@@ -115,6 +116,7 @@ lo_get_libmap(void)
{ "libtextfdlo.a", textfd_component_getFactory },
{ "libunordflo.a", unordf_component_getFactory },
{ "libunoxmllo.a", unoxml_component_getFactory },
+ { "libuuilo.a", uui_component_getFactory },
{ "libxmlfdlo.a", xmlfd_component_getFactory },
{ "libxmlsecurity.a", xmlsecurity_component_getFactory },
{ "libxoflo.a", xof_component_getFactory },
@@ -134,7 +136,8 @@ lo_initialize(void)
"placeholder-exe",
"-env:URE_INTERNAL_LIB_DIR=file:///",
"placeholder-uno-types",
- "placeholder-uno-services"
+ "placeholder-uno-services",
+ "placeholder-document"
};
const int argc = sizeof(argv)/sizeof(*argv);
@@ -154,8 +157,8 @@ lo_initialize(void)
uno_types = [uno_types stringByAppendingString: @" file://"];
uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"offapi.rdb"]];
- assert(strcmp(argv[argc-2], "placeholder-uno-types") == 0);
- argv[argc-2] = [uno_types UTF8String];
+ assert(strcmp(argv[2], "placeholder-uno-types") == 0);
+ argv[2] = [uno_types UTF8String];
NSString *uno_services = @"-env:UNO_SERVICES=";
@@ -165,59 +168,11 @@ lo_initialize(void)
uno_services = [uno_services stringByAppendingString: @" file://"];
uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"services.rdb"]];
- assert(strcmp(argv[argc-1], "placeholder-uno-services") == 0);
- argv[argc-1] = [uno_services UTF8String];
-
- osl_setCommandArgs(argc, (char **) argv);
-
- try {
-
- // Should start a background thread to do all this UNO
- // initialisation crap
-
- uno::Reference< uno::XComponentContext > xContext(::cppu::defaultBootstrap_InitialComponentContext());
-
- uno::Reference< lang::XMultiComponentFactory > xFactory( xContext->getServiceManager() );
-
- uno::Reference< lang::XMultiServiceFactory > xSM( xFactory, uno::UNO_QUERY_THROW );
-
- comphelper::setProcessServiceFactory( xSM );
+ assert(strcmp(argv[3], "placeholder-uno-services") == 0);
+ argv[3] = [uno_services UTF8String];
- InitVCL();
+ assert(strcmp(argv[4], "placeholder-document") == 0);
+ argv[4] = [[app_root_escaped stringByAppendingPathComponent: @"test1.odt"] UTF8String];
- // Yes, this code does of course not belong here. Once this
- // turns into something that actually displays something and
- // has a proper app lifecycle etc that willl be fixed. But for
- // now this is just a test, not supposed to work in any sane
- // way from a "user" POV, and it doesn't matter that we do
- // this here.
-
- uno::Reference< uno::XInterface > xDesktop =
- xFactory->createInstanceWithContext( "com.sun.star.frame.Desktop", xContext );
- uno::Reference< frame::XComponentLoader > xComponentLoader( xDesktop, uno::UNO_QUERY_THROW );
-
- uno::Reference< uno::XInterface > xToolkitService =
- xFactory->createInstanceWithContext( "com.sun.star.awt.Toolkit", xContext );
-
- uno::Reference< awt::XToolkitExperimental > xToolkit( xToolkitService, uno::UNO_QUERY_THROW );
-
- char *smallbb = new char[ SMALLSIZE*SMALLSIZE*4 ];
-
- uno::Reference< awt::XDevice > xDummyDevice = xToolkit->createScreenCompatibleDeviceUsingBuffer( SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, (sal_Int64) (intptr_t) smallbb);
-
- uno::Sequence< beans::PropertyValue > loadProps(3);
-
- loadProps[0].Name = "Hidden";
- loadProps[0].Value <<= sal_True;
- loadProps[1].Name = "ReadOnly";
- loadProps[1].Value <<= sal_True;
- loadProps[2].Name = "Preview";
- loadProps[2].Value <<= sal_True;
-
- OUString test1_odt( OUString( "file://" ) + OUString::createFromAscii( [[app_root_escaped stringByAppendingPathComponent: @"test1.odt"] UTF8String] ));
- uno::Reference< lang::XComponent > xDoc = xComponentLoader->loadComponentFromURL ( test1_odt, "_blank", 0, loadProps );
- }
- catch ( uno::Exception e ) {
- SAL_WARN("Viewer", e.Message);
- }
+ osl_setCommandArgs(argc, (char **) argv);
}
diff --git a/ios/experimental/Viewer/Viewer/main.mm b/ios/experimental/Viewer/Viewer/main.mm
index 247c2dc6afca..401cda5a4c52 100644
--- a/ios/experimental/Viewer/Viewer/main.mm
+++ b/ios/experimental/Viewer/Viewer/main.mm
@@ -5,7 +5,6 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-//
#import <UIKit/UIKit.h>
diff --git a/sal/inc/osl/detail/ios-bootstrap.h b/sal/inc/osl/detail/ios-bootstrap.h
index 5e4ced7934a0..d5fd9471cbf7 100644
--- a/sal/inc/osl/detail/ios-bootstrap.h
+++ b/sal/inc/osl/detail/ios-bootstrap.h
@@ -1,30 +1,10 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
*
- * 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.
- *
- * Major Contributor(s):
- * Copyright (C) 2011 Tor Lillqvist <tml@iki.fi> (initial developer)
- * Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer)
- *
- * 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.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef IOS_BOOSTRAP_H
@@ -38,6 +18,32 @@ extern "C" {
#include <osl/detail/component-mapping.h>
+/* These functions are the interface between the upper GUI layers of a
+ * LibreOffice-based iOS app and the lower "core" layers, used in cases
+ * where the core parts need to call functions in the upper parts or
+ * vice versa.
+ *
+ * Thus there are two classes of functions here:
+ *
+ * 1) Those to be implemented in the upper layer and called by the
+ * lower layer
+ *
+ * 2) Those implmented in the lower layers to be called by the upper
+ * layer, in cases where we don't want to include a bunch of the
+ * "normal" LibreOffice C++ headers in an otherwise purely Objective-C
+ * CocoaTouch-based source file. Of course it depends on the case
+ * where that is wanted, and this all is work in progress.
+ */
+
+/* 1) */
+
+void lo_damaged();
+
+/* 2) */
+
+void lo_runMain();
+void lo_render_windows(char *pixelBuffer, int width, int height);
+
#ifdef __cplusplus
}
#endif
diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c
index 7cb3fc08f864..82f97a95e6fc 100644
--- a/sal/osl/unx/security.c
+++ b/sal/osl/unx/security.c
@@ -389,7 +389,7 @@ sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **pustrDire
return bRet;
}
-#ifndef MACOSX
+#if !defined(MACOSX) && !defined(IOS)
#define DOT_CONFIG "/.config"
@@ -431,7 +431,7 @@ static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* ps
* support for Objective-C in the build environment
*/
-#define MACOSX_CONFIG_DIR "/Library/Application Support"
+#define MACOSX_CONFIG_DIR "/Library/Application Support" /* Used on iOS, too */
static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* pszDirectory, sal_uInt32 nMax)
{
if( osl_psz_getHomeDir(Security, pszDirectory, nMax - sizeof(MACOSX_CONFIG_DIR) + 1) )
diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx
index d05eacfe0954..e156879bae0a 100644
--- a/toolkit/source/awt/vclxsystemdependentwindow.cxx
+++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx
@@ -33,12 +33,6 @@
#include "postmac.h"
#endif
-#ifdef IOS
-#include "premac.h"
-#include <UIKit/UIKit.h>
-#include "postmac.h"
-#endif
-
#include <vcl/svapp.hxx>
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
@@ -90,11 +84,6 @@ IMPL_XTYPEPROVIDER_END
{
aRet <<= (sal_IntPtr)pSysData->pView;
}
-#elif (defined IOS)
- if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS )
- {
- aRet <<= (sal_IntPtr)pSysData->pView;
- }
#elif (defined UNX)
if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
{
@@ -109,8 +98,4 @@ IMPL_XTYPEPROVIDER_END
return aRet;
}
-
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index e0e62b0f8ae9..31fdb3a87743 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -59,12 +59,6 @@
using org::libreoffice::touch::ByteBufferWrapper;
#endif
-#ifdef IOS
-#include "premac.h"
-#include <UIKit/UIKit.h>
-#include "postmac.h"
-#endif
-
#include <vcl/sysdata.hxx>
#include <toolkit/awt/vclxwindows.hxx>
@@ -942,8 +936,6 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
aParentData.nSize = sizeof( aParentData );
#if defined MACOSX
aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle);
- #elif defined IOS
- aParentData.pView = reinterpret_cast<UIView*>(nWindowHandle);
#elif defined UNX
aParentData.aWindow = nWindowHandle;
aParentData.bXEmbedSupport = bXEmbed;
@@ -1189,8 +1181,6 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
aParentData.nSize = sizeof( aParentData );
#if defined MACOSX
aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle);
- #elif defined IOS
- aParentData.pView = reinterpret_cast<UIView*>(nWindowHandle);
#elif defined UNX
aParentData.aWindow = nWindowHandle;
aParentData.bXEmbedSupport = bXEmbed;
diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx
index dc80565b1eaa..a4758ac69844 100644
--- a/toolkit/source/awt/vclxtopwindow.cxx
+++ b/toolkit/source/awt/vclxtopwindow.cxx
@@ -26,12 +26,6 @@
#include "postmac.h"
#endif
-#if defined ( IOS )
-#include "premac.h"
-#include <UIKit/UIKit.h>
-#include "postmac.h"
-#endif
-
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -102,11 +96,6 @@ Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException)
{
aRet <<= (sal_IntPtr)pSysData->pView;
}
-#elif (defined IOS)
- if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS )
- {
- aRet <<= (sal_IntPtr)pSysData->pView;
- }
#elif (defined UNX)
if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
{
diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx
index ffea1f6b0347..029c3bccf25c 100644
--- a/toolkit/source/awt/vclxwindow1.cxx
+++ b/toolkit/source/awt/vclxwindow1.cxx
@@ -32,10 +32,6 @@
#include "premac.h"
#include <Cocoa/Cocoa.h>
#include "postmac.h"
-#elif defined ( IOS )
-#include "premac.h"
-#include <UIKit/UIKit.h>
-#include "postmac.h"
#endif
#include <vcl/sysdata.hxx>
@@ -89,8 +85,6 @@ void VCLXWindow::SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle )
aSysParentData.hWnd = (HWND) nHandle;
#elif defined( MACOSX )
aSysParentData.pView = reinterpret_cast<NSView*>(nHandle);
-#elif defined( IOS )
- aSysParentData.pView = reinterpret_cast<UIView*>(nHandle);
#elif defined( UNX )
aSysParentData.aWindow = (long)nHandle;
aSysParentData.bXEmbedSupport = bXEmbed;
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 71f8da88f837..64456e11bd60 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -346,11 +346,15 @@ $(eval $(call gb_Library_use_packages,vcl,\
basebmp_inc \
))
-vcl_coretext_code=\
+vcl_quartz_code= \
+ vcl/quartz/salbmp \
+ vcl/quartz/utils \
+
+vcl_coretext_code= \
vcl/coretext/salcoretextfontutils \
vcl/coretext/salcoretextlayout \
vcl/coretext/salcoretextstyle \
- vcl/coretext/salgdi
+ vcl/coretext/salgdi \
# GUIBASE specific stuff
@@ -442,7 +446,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/aqua/source/dtrans/PictToBmpFlt \
vcl/aqua/source/dtrans/aqua_clipboard \
vcl/aqua/source/dtrans/service_entry \
- vcl/quartz/salbmp \
+ $(vcl_quartz_code) \
vcl/aqua/source/gdi/salgdicommon \
vcl/aqua/source/gdi/salgdiutils \
vcl/aqua/source/gdi/salmathutils \
@@ -468,9 +472,12 @@ $(eval $(call gb_Library_use_libraries,vcl,\
))
endif
-vcl_generic_code=\
+vcl_really_generic_code= \
vcl/generic/app/gensys \
vcl/generic/app/geninst \
+
+vcl_generic_code= \
+ $(vcl_really_generic_code) \
vcl/generic/app/gendisp \
vcl/generic/print/bitmap_gfx \
vcl/generic/print/common_gfx \
@@ -489,9 +496,9 @@ vcl_generic_code=\
vcl/generic/fontmanager/fontconfig \
vcl/generic/fontmanager/fontmanager \
vcl/generic/fontmanager/helper \
- vcl/generic/fontmanager/parseAFM
+ vcl/generic/fontmanager/parseAFM \
-vcl_headless_code=\
+vcl_headless_code= \
vcl/headless/svpbmp \
vcl/headless/svpdummies \
vcl/headless/svpelement \
@@ -499,9 +506,11 @@ vcl_headless_code=\
vcl/headless/svpgdi \
vcl/headless/svpinst \
vcl/headless/svpdata \
+ vcl/headless/svpvd \
+
+vcl_headless_freetype_code=\
vcl/headless/svpprn \
vcl/headless/svptext \
- vcl/headless/svpvd
ifeq ($(GUIBASE),unx)
$(eval $(call gb_Library_add_defs,vcl,\
@@ -544,6 +553,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/null/printerinfomanager \
vcl/headless/headlessinst \
$(vcl_headless_code) \
+ $(vcl_headless_freetype_code) \
))
$(eval $(call gb_Library_use_libraries,vcl,\
@@ -574,6 +584,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/null/printerinfomanager \
vcl/android/androidinst \
$(vcl_headless_code) \
+ $(vcl_headless_freetype_code) \
))
$(eval $(call gb_Library_use_static_libraries,vcl,\
@@ -591,28 +602,13 @@ ifeq ($(OS),IOS)
$(eval $(call gb_Library_add_cxxflags,vcl,\
$(gb_OBJCXXFLAGS) \
))
-$(eval $(call gb_Library_add_objcxxobjects,vcl,\
- vcl/ios/source/app/salnstimer \
- vcl/ios/source/app/vcluiapp \
- vcl/ios/source/window/salframeview \
-))
$(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 \
- vcl/ios/source/dtrans/iOSTransferable \
- vcl/ios/source/dtrans/ios_clipboard \
- vcl/ios/source/dtrans/service_entry \
+ vcl/ios/iosinst \
+ vcl/ios/dummies \
+ $(vcl_really_generic_code) \
$(vcl_coretext_code) \
- vcl/quartz/salbmp \
- vcl/ios/source/gdi/salgdicommon \
- vcl/ios/source/gdi/salnativewidgets \
- vcl/ios/source/gdi/salgdiutils \
- vcl/ios/source/gdi/salvd \
- vcl/ios/source/window/salframe \
- vcl/ios/source/window/salmenu \
- vcl/ios/source/window/salobj \
+ $(vcl_quartz_code) \
+ $(vcl_headless_code) \
))
$(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
UIKit \
diff --git a/vcl/aqua/source/a11y/aqua11yactionwrapper.mm b/vcl/aqua/source/a11y/aqua11yactionwrapper.mm
index 210ea8e43fea..d9842a81e526 100644
--- a/vcl/aqua/source/a11y/aqua11yactionwrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11yactionwrapper.mm
@@ -19,6 +19,7 @@
#include "aqua/salinst.h"
+#include "quartz/utils.h"
#include "aqua11yactionwrapper.h"
diff --git a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm
index eb48a17c9eb2..41df52bf10e0 100644
--- a/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ycomponentwrapper.mm
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
+#include "quartz/utils.h"
#include "aqua11ycomponentwrapper.h"
#include "aqua11yrolehelper.h"
#include <com/sun/star/accessibility/AccessibleRole.hpp>
diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
index 9ac7876bf98a..f53170fb1976 100644
--- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
@@ -19,6 +19,7 @@
#include "aqua/salinst.h"
+#include "quartz/utils.h"
#include "aqua11ytextattributeswrapper.h"
diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
index 2ae1d5a0b7a9..4d4b75cfe45d 100644
--- a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
@@ -19,7 +19,7 @@
#include "aqua/salinst.h"
-
+#include "quartz/utils.h"
#include "aqua11ytextwrapper.h"
#include "aqua11ytextattributeswrapper.h"
#include "aqua11yutil.h"
diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm
index 0e0ad5081c2e..04c29ad8bdc6 100644
--- a/vcl/aqua/source/a11y/aqua11ywrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm
@@ -26,6 +26,8 @@
#include "aqua/aqua11yfactory.h"
#include "aqua/aqua11yfocustracker.hxx"
+#include "quartz/utils.h"
+
#include "aqua11yfocuslistener.hxx"
#include "aqua11yactionwrapper.h"
#include "aqua11ycomponentwrapper.h"
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 40a0e5579062..0c104009ea75 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -38,6 +38,7 @@
#include "aqua/salsys.h"
#include "aqua/salvd.h"
#include "quartz/salbmp.h"
+#include "quartz/utils.h"
#include "aqua/salprn.h"
#include "aqua/saltimer.h"
#include "aqua/vclnsapp.h"
@@ -1139,49 +1140,6 @@ YieldMutexReleaser::~YieldMutexReleaser()
GetSalData()->mpFirstInstance->AcquireYieldMutex( mnCount );
}
-//////////////////////////////////////////////////////////////
-rtl::OUString GetOUString( CFStringRef rStr )
-{
- if( rStr == 0 )
- return rtl::OUString();
- CFIndex nLength = CFStringGetLength( rStr );
- if( nLength == 0 )
- return rtl::OUString();
- const UniChar* pConstStr = CFStringGetCharactersPtr( rStr );
- if( pConstStr )
- return rtl::OUString( pConstStr, nLength );
- UniChar* pStr = reinterpret_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) );
- CFRange aRange = { 0, nLength };
- CFStringGetCharacters( rStr, aRange, pStr );
- rtl::OUString aRet( pStr, nLength );
- rtl_freeMemory( pStr );
- return aRet;
-}
-
-rtl::OUString GetOUString( NSString* pStr )
-{
- if( ! pStr )
- return rtl::OUString();
- int nLen = [pStr length];
- if( nLen == 0 )
- return rtl::OUString();
-
- rtl::OUStringBuffer aBuf( nLen+1 );
- aBuf.setLength( nLen );
- [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
- return aBuf.makeStringAndClear();
-}
-
-CFStringRef CreateCFString( const rtl::OUString& rStr )
-{
- return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() );
-}
-
-NSString* CreateNSString( const rtl::OUString& rStr )
-{
- return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()];
-}
-
CGImageRef CreateCGImage( const Image& rImage )
{
BitmapEx aBmpEx( rImage.GetBitmapEx() );
diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx
index 7cf724ccf539..e849f013cbee 100644
--- a/vcl/aqua/source/app/salsys.cxx
+++ b/vcl/aqua/source/app/salsys.cxx
@@ -25,6 +25,7 @@
#include "aqua/salsys.h"
#include "aqua/saldata.hxx"
#include "aqua/salinst.h"
+#include "quartz/utils.h"
#include "svids.hrc"
diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm
index db736634a7d8..5a8ed3595b85 100644
--- a/vcl/aqua/source/app/vclnsapp.mm
+++ b/vcl/aqua/source/app/vclnsapp.mm
@@ -28,6 +28,7 @@
#include "aqua/saldata.hxx"
#include "aqua/salframe.h"
#include "aqua/salframeview.h"
+#include "quartz/utils.h"
#include "impimagetree.hxx"
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
index 190e16ecb161..67714ba3eabe 100644
--- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -28,6 +28,7 @@
#include "aqua/aquaprintview.h"
#include "aqua/salinst.h"
+#include "quartz/utils.h"
#include "svdata.hxx"
#include "svids.hrc"
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index d27361a81f7d..d32c6d943b0d 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -29,6 +29,7 @@
#include "aqua/aquaprintview.h"
#include "aqua/salgdi.h"
#include "aqua/saldata.hxx"
+#include "quartz/utils.h"
#include "jobset.h"
#include "salptype.hxx"
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 10eb3c24e067..2d5bb47ba433 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -36,6 +36,7 @@
#include "aqua/salinst.h"
#include "aqua/salframeview.h"
#include "aqua/aqua11yfactory.h"
+#include "quartz/utils.h"
#include "salwtype.hxx"
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index d6861a489277..aea29a43d5de 100644
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -29,6 +29,7 @@
#include "aqua/salframe.h"
#include "aqua/salframeview.h"
#include "aqua/aqua11yfactory.h"
+#include "quartz/utils.h"
#define WHEEL_EVENT_FACTOR 1.5
diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx
index 72cd828c3628..8f37ddc41d24 100644
--- a/vcl/aqua/source/window/salmenu.cxx
+++ b/vcl/aqua/source/window/salmenu.cxx
@@ -32,6 +32,7 @@
#include "aqua/salnsmenu.h"
#include "aqua/salframe.h"
#include "aqua/aqua11ywrapper.h"
+#include "quartz/utils.h"
#include "svids.hrc"
#include "window.h"
diff --git a/vcl/coretext/salcoretextfontutils.cxx b/vcl/coretext/salcoretextfontutils.cxx
index 0bdb2d4484a0..3f64d3b9d5cb 100644
--- a/vcl/coretext/salcoretextfontutils.cxx
+++ b/vcl/coretext/salcoretextfontutils.cxx
@@ -18,16 +18,16 @@
*/
#include "coretext/common.h"
-
#include "coretext/salcoretextfontutils.hxx"
-#include "coretext/salgdi.h"
+#include "quartz/utils.h"
#include "sft.hxx"
#ifdef MACOSX
+#include "coretext/salgdi.h"
#include "aqua/salinst.h"
#else // IOS
-#include "ios/salinst.h"
+#include "headless/svpinst.hxx"
#endif
static bool GetDevFontAttributes( CTFontDescriptorRef font_descriptor, ImplDevFontAttributes& rDFA )
diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx
index 0183c66ecf11..d4356308412c 100644
--- a/vcl/coretext/salcoretextlayout.cxx
+++ b/vcl/coretext/salcoretextlayout.cxx
@@ -22,7 +22,12 @@
#include "coretext/common.h"
#include "coretext/salcoretextstyle.hxx"
+
+#ifdef MACOSX
#include "coretext/salgdi.h"
+#else
+#include "headless/svpgdi.hxx"
+#endif
class CoreTextLayout : public SalLayout
{
diff --git a/vcl/coretext/salgdi.cxx b/vcl/coretext/salgdi.cxx
index 05a93a525aca..71abf4394b99 100644
--- a/vcl/coretext/salgdi.cxx
+++ b/vcl/coretext/salgdi.cxx
@@ -20,14 +20,26 @@
#include "coretext/common.h"
#ifdef MACOSX
+
#include "aqua/salframe.h"
+#include "coretext/salgdi.h"
+
#else
-#include "ios/salframe.h"
+
+#include <premac.h>
+#include <UIKit/UIKit.h>
+#include <postmac.h>
+
+#include "saldatabasic.hxx"
+#include "headless/svpframe.hxx"
+#include "headless/svpgdi.hxx"
+
#endif
-#include "coretext/salgdi.h"
#include "coretext/salcoretextstyle.hxx"
+#ifdef MACOSX
+
QuartzSalGraphics::QuartzSalGraphics()
: mpFrame( NULL )
, mxLayer( NULL )
@@ -64,6 +76,8 @@ QuartzSalGraphics::~QuartzSalGraphics()
}
}
+#endif
+
inline bool QuartzSalGraphics::AddTempDevFont( ImplDevFontList*,
const rtl::OUString& ,
const rtl::OUString& )
@@ -200,6 +214,8 @@ const ImplFontCharMap* QuartzSalGraphics::GetImplFontCharMap() const
return font_face->GetImplFontCharMap();
}
+#ifndef IOS
+
bool QuartzSalGraphics::GetRawFontData( const PhysicalFontFace* pFontFace,
std::vector<unsigned char>& rBuffer, bool* pJustCFF )
{
@@ -208,6 +224,8 @@ bool QuartzSalGraphics::GetRawFontData( const PhysicalFontFace* pFontFace,
return font_face->GetRawFontData(rBuffer, pJustCFF);
}
+#endif
+
SystemFontData QuartzSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
{
SystemFontData aSysFontData;
@@ -257,4 +275,25 @@ void QuartzSalGraphics::SetTextColor( SalColor nSalColor )
m_style->SetColor(nSalColor);
}
+#ifdef IOS
+
+// Note that "QuartzSalGraphics" *is* SvpSalGraphics for iOS
+
+bool SvpSalGraphics::CheckContext()
+{
+ SAL_WARN_IF( mrContext == NULL, "vcl.ios", "CheckContext() failed" );
+
+ return (mrContext != NULL);
+}
+
+CGContextRef SvpSalGraphics::GetContext()
+{
+ if (!mrContext)
+ CheckContext();
+
+ return mrContext;
+}
+
+#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 7aa816715d36..58f496e13ca1 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -87,6 +87,11 @@ SvpSalGraphics::SvpSalGraphics() :
{
for( int i = 0; i < MAX_FALLBACK; ++i )
m_pServerFont[i] = NULL;
+#ifdef IOS
+ mrContext = nil;
+ mfFakeDPIScale = 1.0;
+ m_style = new CoreTextStyleInfo();
+#endif
}
SvpSalGraphics::~SvpSalGraphics()
@@ -690,8 +695,12 @@ SystemFontData SvpSalGraphics::GetSysFontData( int nFallbacklevel ) const
if (nFallbacklevel < 0 ) nFallbacklevel = 0;
aSysFontData.nSize = sizeof( SystemFontData );
+#ifdef IOS
+ aSysFontData.rCTFont = NULL;
+#else
aSysFontData.nFontId = 0;
aSysFontData.nFontFlags = 0;
+#endif
aSysFontData.bFakeBold = false;
aSysFontData.bFakeItalic = false;
aSysFontData.bAntialias = true;
diff --git a/vcl/inc/aqua/atsui/salgdi.h b/vcl/inc/aqua/atsui/salgdi.h
index ddda552cd979..2faf8462fe1a 100644
--- a/vcl/inc/aqua/atsui/salgdi.h
+++ b/vcl/inc/aqua/atsui/salgdi.h
@@ -35,7 +35,7 @@
#include "aqua/salframe.h"
#include "salgdi.hxx"
-#include "aqua/salgdicommon.hxx"
+#include "quartz/salgdicommon.hxx"
class AquaSalFrame;
class ImplDevFontAttributes;
diff --git a/vcl/inc/aqua/salinst.h b/vcl/inc/aqua/salinst.h
index a295e066df2b..7498d57ee7cb 100644
--- a/vcl/inc/aqua/salinst.h
+++ b/vcl/inc/aqua/salinst.h
@@ -167,11 +167,6 @@ class YieldMutexReleaser
~YieldMutexReleaser();
};
-rtl::OUString GetOUString( CFStringRef );
-rtl::OUString GetOUString( NSString* );
-CFStringRef CreateCFString( const rtl::OUString& );
-NSString* CreateNSString( const rtl::OUString& );
-
CGImageRef CreateCGImage( const Image& );
NSImage* CreateNSImage( const Image& );
diff --git a/vcl/inc/coretext/salcoretextfontutils.hxx b/vcl/inc/coretext/salcoretextfontutils.hxx
index 00c61aa14e1d..bfd3d7643112 100644
--- a/vcl/inc/coretext/salcoretextfontutils.hxx
+++ b/vcl/inc/coretext/salcoretextfontutils.hxx
@@ -24,6 +24,7 @@
#include <vcl/fontcapabilities.hxx>
+#include "coretext/common.h"
#include "outfont.hxx"
#include "impfont.hxx"
diff --git a/vcl/inc/coretext/salcoretextstyle.hxx b/vcl/inc/coretext/salcoretextstyle.hxx
index 245e08f42db1..f05d6d5f0eb8 100644
--- a/vcl/inc/coretext/salcoretextstyle.hxx
+++ b/vcl/inc/coretext/salcoretextstyle.hxx
@@ -20,11 +20,7 @@
#ifndef _VCL_CORETEXT_SALCORETEXTSTYLE_HXX
#define _VCL_CORETEXT_SALCORETEXTSTYLE_HXX
-#ifdef MACOSX
-#include "aqua/salgdicommon.hxx"
-#else // IOS
-#include "ios/salgdicommon.hxx"
-#endif
+#include "quartz/salgdicommon.hxx"
#include "coretext/salcoretextfontutils.hxx"
#include "outfont.hxx"
diff --git a/vcl/inc/coretext/salgdi.h b/vcl/inc/coretext/salgdi.h
index c93894aae1ba..4ca5eb638a67 100644
--- a/vcl/inc/coretext/salgdi.h
+++ b/vcl/inc/coretext/salgdi.h
@@ -20,27 +20,20 @@
#ifndef _VCL_CORETEXT_SALGDI_H
#define _VCL_CORETEXT_SALGDI_H
-#ifdef MACOSX
+#ifndef MACOSX
+#error This file should be included only for OS X
+#endif
+
#include "premac.h"
#include <ApplicationServices/ApplicationServices.h>
#include "postmac.h"
-#endif
-#ifdef MACOSX
#include "aqua/aquavcltypes.h"
-#else
-#include "ios/iosvcltypes.h"
-#endif
#include "coretext/salcoretextfontutils.hxx"
-#ifdef MACOSX
#include "aqua/salframe.h"
-#include "aqua/salgdicommon.hxx"
-#else
-#include "ios/salframe.h"
-#include "ios/salgdicommon.hxx"
-#endif
+#include "quartz/salgdicommon.hxx"
#include "salgdi.hxx"
@@ -50,19 +43,13 @@ class CoreTextStyleInfo;
// - QuartzSalGraphics -
// -------------------
-#ifdef MACOSX
#define QuartzSalGraphics AquaSalGraphics
-#endif
class QuartzSalGraphics : public SalGraphics
{
friend class CoreTextLayout;
protected:
-#ifdef MACOSX
AquaSalFrame* mpFrame;
-#else
- IosSalFrame* mpFrame;
-#endif
CGLayerRef mxLayer; //< Quartz graphics layer
CGContextRef mrContext; //< Quartz drawing context
class XorEmulation* mpXorEmulation;
@@ -93,9 +80,7 @@ protected:
bool mbVirDev; //< is this a virtual device graphics
bool mbWindow; //< is this a window graphics
-#ifdef MACOSX
RGBColor m_TextColor;
-#endif
public:
QuartzSalGraphics();
@@ -104,17 +89,10 @@ public:
bool IsPenVisible() const { return maLineColor.IsVisible(); }
bool IsBrushVisible() const { return maFillColor.IsVisible(); }
-#ifdef MACOSX
void SetWindowGraphics( AquaSalFrame* pFrame );
AquaSalFrame* getGraphicsFrame() const { return mpFrame; }
void setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; }
void initResolution( NSWindow* );
-#else
- void SetWindowGraphics( IosSalFrame* pFrame );
- IosSalFrame* getGraphicsFrame() const { return mpFrame; }
- void setGraphicsFrame( IosSalFrame* pFrame ) { mpFrame = pFrame; }
- void initResolution( UIWindow* );
-#endif
void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale );
void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
@@ -129,19 +107,13 @@ public:
bool CheckContext();
CGContextRef GetContext();
-#ifdef MACOSX
void UpdateWindow( NSRect& ); // delivered in NSView coordinates
-#else
- void UpdateWindow( CGRect& ); // delivered in UIView coordinates
-#endif
-#if (defined(MACOSX) && !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)) || defined(IOS)
+#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
void RefreshRect( const CGRect& );
#endif
-#ifdef MACOSX
void RefreshRect( const NSRect& );
-#endif
void RefreshRect(float lX, float lY, float lWidth, float lHeight);
void SetState();
@@ -342,7 +314,7 @@ private:
bool* pJustCFF );
};
-#if (defined(MACOSX) && !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)) || defined(IOS)
+#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
inline void QuartzSalGraphics::RefreshRect( const CGRect& rRect )
{
@@ -351,15 +323,11 @@ inline void QuartzSalGraphics::RefreshRect( const CGRect& rRect )
#endif
-#ifdef MACOSX
-
inline void QuartzSalGraphics::RefreshRect( const NSRect& rRect )
{
RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
}
-#endif
-
#endif /* _VCL_CORETEXT_SALGDI_H */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index fbceb7df141c..ad544df1f12a 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -23,11 +23,19 @@
#include <basebmp/bitmapdevice.hxx>
#include <basebmp/color.hxx>
-#include <salgdi.hxx>
-#include <sallayout.hxx>
+#include "salgdi.hxx"
+#include "sallayout.hxx"
+
+#ifdef IOS
+#include "coretext/salcoretextstyle.hxx"
+#endif
class ServerFont;
+#ifdef IOS
+#define QuartzSalGraphics SvpSalGraphics
+#endif
+
class SvpSalGraphics : public SalGraphics
{
basebmp::BitmapDeviceSharedPtr m_aDevice;
@@ -49,6 +57,7 @@ class SvpSalGraphics : public SalGraphics
protected:
Region m_aClipRegion;
basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); }
+
private:
bool m_bClipSetup;
struct ClipUndoHandle {
@@ -61,6 +70,16 @@ private:
void ensureClip();
protected:
+
+#ifdef IOS
+ friend class CoreTextLayout;
+
+ CGContextRef mrContext;
+ CoreTextStyleInfo* m_style;
+ double mfFakeDPIScale;
+ bool mbNonAntialiasedText;
+#endif
+
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 );
@@ -71,7 +90,6 @@ public:
const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aDevice; }
void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice );
- // overload all pure virtual methods
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
virtual sal_uInt16 GetBitCount() const;
virtual long GetGraphicsWidth() const;
@@ -178,6 +196,11 @@ public:
virtual SystemGraphicsData GetGraphicsData() const;
virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
+
+#ifdef IOS
+ bool CheckContext();
+ CGContextRef GetContext();
+#endif
};
#endif
diff --git a/vcl/inc/ios/iosinst.hxx b/vcl/inc/ios/iosinst.hxx
new file mode 100644
index 000000000000..0884ff1e1976
--- /dev/null
+++ b/vcl/inc/ios/iosinst.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef IOS_SALINST_H
+#define IOS_SALINST_H
+
+#include "headless/svpinst.hxx"
+#include "headless/svpframe.hxx"
+
+class IosSalFrame;
+class IosSalInstance : public SvpSalInstance
+{
+ void BlitFrameToBuffer(char *pPixelBuffer,
+ int nPBWidth, int nPBHeight,
+ int destX, int nDestY,
+ int nDestWidth, int nDestHeight,
+ const basebmp::BitmapDeviceSharedPtr& aDev);
+
+public:
+ IosSalInstance( SalYieldMutex *pMutex );
+ virtual ~IosSalInstance();
+ static IosSalInstance *getInstance();
+
+ virtual SalSystem* CreateSalSystem();
+
+ void GetWorkArea( Rectangle& rRect );
+ SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
+ SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
+
+ virtual bool AnyInput( sal_uInt16 nType );
+
+ SalFrame *getFocusFrame() const;
+
+ void RedrawWindows(char *pPixelBuffer,
+ int nPBWidth, int nPBHeight,
+ int destX, int nDestY,
+ int nDestWidth, int nDestHeight);
+
+ void damaged(IosSalFrame *frame);
+};
+
+#endif // IOS_SALINST_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/saldata.hxx b/vcl/inc/ios/saldata.hxx
deleted file mode 100644
index 8163a6d2f510..000000000000
--- a/vcl/inc/ios/saldata.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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;
-
-#define SAL_CLIPRECT_COUNT 16
-
-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) ); }
-};
-
-class SalData
-{
-public:
- 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;
-
- 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();
-};
-
-inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; }
-inline SalData *GetSalData() { return ImplGetSVData()->mpSalData; }
-
-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
deleted file mode 100644
index 9ca4fe72f4ed..000000000000
--- a/vcl/inc/ios/salframe.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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 QuartzSalGraphics;
-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
- QuartzSalGraphics* 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 mbPositioned:1;
- bool mbSized: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 rtl::OUString& 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 rtl::OUString GetKeyName( sal_uInt16 nKeyCode );
- virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
- virtual LanguageType GetInputLanguage();
- virtual void UpdateSettings( AllSettings& rSettings );
- 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 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 );
-
- // actually the follwing methods do the same thing: flipping y coordinates
- // but having two of them makes clearer what the coordinate system
- // is supposed to be before and after
- void VCLToCocoaTouch( CGRect& io_rRect, bool bRelativeToScreen = true );
- void CocoaTouchToVCL( CGRect& io_rRect, bool bRelativeToScreen = true );
-
- void VCLToCocoaTouch( CGPoint& io_rPoint, bool bRelativeToScreen = true );
- void CocoaTouchToVCL( CGPoint& io_Point, bool bRelativeToScreen = true );
-
- 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
deleted file mode 100644
index 4c8248053da1..000000000000
--- a/vcl/inc/ios/salframeview.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _VCL_SALFRAMEVIEW_H
-#define _VCL_SALFRAMEVIEW_H
-
-@interface SalFrameWindow : UIWindow
-{
- IosSalFrame* mpFrame;
- id mDraggingDestinationHandler;
-}
--(id)initWithSalFrame: (IosSalFrame*)pFrame;
--(BOOL)canBecomeKeyWindow;
--(void)displayIfNeeded;
--(IosSalFrame*)getSalFrame;
-@end
-
-@interface SalFrameView : UIView
-{
- 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;
-@end
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salgdicommon.hxx b/vcl/inc/ios/salgdicommon.hxx
deleted file mode 100644
index 6d8edcfd95db..000000000000
--- a/vcl/inc/ios/salgdicommon.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _VCL_IOS_SALGDICOMMON_H
-#define _VCL_IOS_SALGDICOMMON_H
-
-#include <vcl/salgtype.hxx>
-
-// 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 CGFloat* AsArray() const { return m_fRGBA; }
- bool IsVisible() const { return m_fRGBA[3] > 0; }
- void SetAlpha( float fAlpha ) { m_fRGBA[3] = fAlpha; }
-private:
- CGFloat m_fRGBA[4]; // red, green, blue, alpha
-};
-
-inline RGBAColor::RGBAColor( SalColor nSalColor )
-{
- m_fRGBA[0] = SALCOLOR_RED(nSalColor) * (1.0/255);
- m_fRGBA[1] = SALCOLOR_GREEN(nSalColor) * (1.0/255);
- m_fRGBA[2] = SALCOLOR_BLUE(nSalColor) * (1.0/255);
- m_fRGBA[3] = 1.0; // opaque
-}
-
-inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
-{
- m_fRGBA[0] = fRed;
- m_fRGBA[1] = fGreen;
- m_fRGBA[2] = fBlue;
- m_fRGBA[3] = fAlpha;
-}
-
-class XorEmulation
-{
-public:
- XorEmulation();
- ~XorEmulation();
-
- void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
- bool UpdateTarget();
- void Enable() { m_bIsEnabled = true; }
- void Disable() { m_bIsEnabled = false; }
- bool IsEnabled() const { return m_bIsEnabled; }
- CGContextRef GetTargetContext() const { return m_xTargetContext; }
- CGContextRef GetMaskContext() const { return (m_bIsEnabled ? m_xMaskContext : NULL); }
-
-private:
- CGLayerRef m_xTargetLayer;
- CGContextRef m_xTargetContext;
- CGContextRef m_xMaskContext;
- CGContextRef m_xTempContext;
- sal_uLong* m_pMaskBuffer;
- sal_uLong* m_pTempBuffer;
- int m_nBufferLongs;
- bool m_bIsEnabled;
-};
-
-#endif /* _VCL_IOS_SALGDICOMMON_H */
diff --git a/vcl/inc/ios/salinst.h b/vcl/inc/ios/salinst.h
deleted file mode 100644
index f7ff822ebeb5..000000000000
--- a/vcl/inc/ios/salinst.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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;
-
-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() )
-
-
-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 rtl::OUString 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();
-};
-
-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
deleted file mode 100644
index a4f24277b560..000000000000
--- a/vcl/inc/ios/salmathutils.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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
deleted file mode 100644
index 1e1648db3932..000000000000
--- a/vcl/inc/ios/salmenu.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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
-{
-};
-
-class IosSalMenuItem : public SalMenuItem
-{
-};
-
-#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
deleted file mode 100644
index 7a65d6f9c9ca..000000000000
--- a/vcl/inc/ios/salnstimer.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _VCL_SALNSTIMER_H
-#define _VCL_SALNSTIMER_H
-
-#include "premac.h"
-#include <Foundation/Foundation.h>
-#include "postmac.h"
-
-@interface TimerCallbackCaller : NSObject
-{
-}
--(void)timerElapsed:(NSTimer*)pTimer;
-@end
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salobj.h b/vcl/inc/ios/salobj.h
deleted file mode 100644
index b3966ec43871..000000000000
--- a/vcl/inc/ios/salobj.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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 const SystemEnvData* GetSystemData() const;
-};
-
-#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
deleted file mode 100644
index c383af4341ad..000000000000
--- a/vcl/inc/ios/salprn.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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 rtl::OUString 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 rtl::OUString* pFileName,
- const rtl::OUString& rJobName,
- const rtl::OUString& rAppName,
- sal_uLong i_nCopies,
- bool i_bCollate,
- bool i_bDirect,
- ImplJobSetup* i_pSetupData );
- // implement pull model print system
- virtual sal_Bool StartJob( const rtl::OUString* pFileName,
- const rtl::OUString& rJobName,
- const rtl::OUString& 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
deleted file mode 100644
index b8b48cce4bb3..000000000000
--- a/vcl/inc/ios/salsys.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#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 Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen );
- virtual Rectangle GetDisplayScreenWorkAreaPosSizePixel( unsigned int nScreen );
-
- virtual rtl::OUString GetDisplayScreenName( unsigned int nScreen );
- virtual int ShowNativeMessageBox( const rtl::OUString& rTitle,
- const rtl::OUString& rMessage,
- int nButtonCombination,
- int nDefaultButton, bool bUseResources);
-};
-
-#endif // _SV_SALSYS_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/saluimenu.h b/vcl/inc/ios/saluimenu.h
deleted file mode 100644
index bb9a3415ddd8..000000000000
--- a/vcl/inc/ios/saluimenu.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _VCL_SALUIMENU_H
-#define _VCL_SALUIMENU_H
-
-class IosSalMenu;
-class IosSalMenuItem;
-
-@interface SalUIMenu : UIMenuController
-{
- /* Caution: SalNSMenu instances occasionally are binary copied
- in IosSalMenu::ShowNativePopupMenu. If any members are added,
- please take this into account !
- */
- IosSalMenu* mpMenu;
-}
--(id)initWithMenu: (IosSalMenu*)pMenu;
--(void)menuNeedsUpdate: (UIMenuController*)pMenu;
--(void)setSalMenu: (IosSalMenu*)pMenu;
-@end
-
-@interface SalUIMenuItem : UIMenuItem
-{
- /* Caution: SalUIMenuItem instances occasionally are binary copied
- in IosSalMenu::ShowNativePopupMenu. If any members are added,
- please take this into account !
- */
- IosSalMenuItem* mpMenuItem;
-}
--(id)initWithMenuItem: (IosSalMenuItem*)pMenuItem;
--(void)menuItemTriggered: (id)aSender;
-@end
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ios/salvd.h b/vcl/inc/ios/salvd.h
deleted file mode 100644
index 83c9d4544d94..000000000000
--- a/vcl/inc/ios/salvd.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _SV_SALVD_H
-#define _SV_SALVD_H
-
-#include "coretext/salgdi.h"
-
-#include "salvd.hxx"
-
-#if PRAGMA_ONCE
- #pragma once
-#endif
-
-struct SalVirDevData
-{
-};
-
-typedef struct SalVirDevData SalVirDevData;
-typedef SalVirDevData *SalVirDevDataPtr;
-typedef SalVirDevDataPtr *SalVirDevDataHandle;
-
-// =======================================================================
-
-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
- QuartzSalGraphics* mpGraphics; // current VirDev graphics
-
- void Destroy();
-
-public:
- IosSalVirtualDevice( QuartzSalGraphics* 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
deleted file mode 100644
index 5671fcf68614..000000000000
--- a/vcl/inc/ios/vcluiapp.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _VCL_VCLUIAPP_H
-#define _VCL_VCLUIAPP_H
-
-#include "premac.h"
-#include "UIKit/UIKit.h"
-#include "postmac.h"
-
-class IosSalFrame;
-
-// our very own application
-@interface VCL_UIApplication : UIApplication
-{
-}
--(void)sendEvent:(UIEvent*)pEvent;
--(void)sendSuperEvent:(UIEvent*)pEvent;
--(BOOL)application: (UIApplication*) app openFile: (NSString*)file;
--(void)application: (UIApplication*) app openFiles: (NSArray*)files;
--(void)addFallbackMenuItem: (UIMenuItem*)pNewItem;
--(void)removeFallbackMenuItem: (UIMenuItem*)pOldItem;
-@end
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h
index 16460abf3794..24aebeb87c18 100644
--- a/vcl/inc/quartz/salbmp.h
+++ b/vcl/inc/quartz/salbmp.h
@@ -29,7 +29,7 @@
#ifdef MACOSX
#include "aqua/salgdi.h"
#else
-#include "coretext/salgdi.h"
+#include "headless/svpgdi.hxx"
#endif
#include "salinst.hxx"
diff --git a/vcl/inc/aqua/salgdicommon.hxx b/vcl/inc/quartz/salgdicommon.hxx
index 2d4f611b168d..bbc6f8f9a550 100644
--- a/vcl/inc/aqua/salgdicommon.hxx
+++ b/vcl/inc/quartz/salgdicommon.hxx
@@ -20,6 +20,14 @@
#ifndef _VCL_AQUA_SALGDICOMMON_H
#define _VCL_AQUA_SALGDICOMMON_H
+#include <premac.h>
+#ifdef IOS
+#include <CoreGraphics/CoreGraphics.h>
+#else
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+#include <postmac.h>
+
#include <vcl/salgtype.hxx>
// abstracting quartz color instead of having to use an CGFloat[] array
diff --git a/vcl/inc/ios/saltimer.h b/vcl/inc/quartz/utils.h
index d9bfc377b1cb..01b1f1372fa8 100644
--- a/vcl/inc/ios/saltimer.h
+++ b/vcl/inc/quartz/utils.h
@@ -17,29 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef _SV_SALTIMER_H
-#define _SV_SALTIMER_H
+#ifndef INCLUDED_QUARTZ_UTILS_HXX
+#define INCLUDED_QUARTZ_UTILS_HXX
-#include "premac.h"
-#include <Foundation/Foundation.h>
-#include "postmac.h"
-
-#include "saltimer.hxx"
-
-class IosSalTimer : public SalTimer
-{
- public:
+#include <rtl/ustring.hxx>
- IosSalTimer();
- virtual ~IosSalTimer();
-
- void Start( sal_uLong nMS );
- void Stop();
+#include <premac.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <Foundation/Foundation.h>
+#include <postmac.h>
- static NSTimer* pRunningTimer;
- static bool bDispatchTimer;
-};
+rtl::OUString GetOUString( CFStringRef );
+rtl::OUString GetOUString( NSString* );
+CFStringRef CreateCFString( const rtl::OUString& );
+NSString* CreateNSString( const rtl::OUString& );
-#endif
+#endif // INCLUDED_QUARTZ_UTILS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/saldatabasic.hxx b/vcl/inc/saldatabasic.hxx
index e4ef22c03d35..b12415df4731 100644
--- a/vcl/inc/saldatabasic.hxx
+++ b/vcl/inc/saldatabasic.hxx
@@ -26,6 +26,10 @@
#include "vcl/dllapi.h"
+#ifdef IOS
+#include "coretext/salcoretextfontutils.hxx"
+#endif
+
namespace psp
{
class PrinterInfoManager;
@@ -40,6 +44,11 @@ public:
SalData();
virtual ~SalData();
+#ifdef IOS
+ CGColorSpaceRef mxRGBSpace;
+ CGColorSpaceRef mxGraySpace;
+ SystemFontList* mpFontList;
+#endif
};
inline void SetSalData( SalData* pData )
diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx
index c23e486adf66..6d26bc2ff2f8 100644
--- a/vcl/inc/vcl/sysdata.hxx
+++ b/vcl/inc/vcl/sysdata.hxx
@@ -40,12 +40,6 @@ class NSView;
#ifdef IOS
typedef const struct __CTFont * CTFontRef;
typedef struct CGContext *CGContextRef;
-typedef struct CGLayer *CGLayerRef;
-#ifdef __OBJC__
-@class UIView;
-#else
-class UIView;
-#endif
#endif
#if defined( WNT )
@@ -70,8 +64,6 @@ struct SystemEnvData
HWND hWnd; // the window hwnd
#elif defined( MACOSX )
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
@@ -100,8 +92,6 @@ struct SystemParentData
HWND hWnd; // the window hwnd
#elif defined( MACOSX )
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
diff --git a/vcl/ios/dummies.cxx b/vcl/ios/dummies.cxx
new file mode 100644
index 000000000000..7cf84b5a47ec
--- /dev/null
+++ b/vcl/ios/dummies.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "salprn.hxx"
+#include "headless/svpgdi.hxx"
+#include "headless/svpinst.hxx"
+
+sal_Bool SvpSalGraphics::CreateFontSubset( const OUString& /* rToFile */,
+ const PhysicalFontFace* /* pFontData */,
+ sal_Int32* /* pGlyphIDs */,
+ sal_uInt8* /* pEncoding */,
+ sal_Int32* /* pGlyphWidths */,
+ int /* nGlyphCount */,
+ FontSubsetInfo& /* rInfo */ )
+{
+ return sal_False;
+}
+
+bool SvpSalGraphics::AddTempDevFont( ImplDevFontList* /* pFontList */,
+ const OUString& /* rFileURL */,
+ const OUString& /* rFontName */ )
+{
+ return false;
+}
+
+SalPrinter* SvpSalInstance::CreatePrinter( SalInfoPrinter* /* pInfoPrinter */ )
+{
+ return NULL;
+}
+
+OUString SvpSalInstance::GetDefaultPrinter()
+{
+ return OUString();
+}
+
+GenPspGraphics *SvpSalInstance::CreatePrintGraphics()
+{
+ return NULL;
+}
+
+void SvpSalInstance::DestroyPrinter( SalPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+
+void SvpSalInstance::PostPrintersChanged()
+{
+}
+
+SalInfoPrinter* SvpSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* /* pQueueInfo */,
+ ImplJobSetup* /* pJobSetup */ )
+{
+ return NULL;
+}
+
+void SvpSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+void SvpSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* /* pList */ )
+{
+}
+
+void SvpSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* /* pInfo */ )
+{
+}
+
+void SvpSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
+{
+ delete pInfo;
+}
+
+SalPrinter* SalGenericInstance::CreatePrinter( SalInfoPrinter* /* pInfoPrinter */ )
+{
+ return NULL;
+}
+
+OUString SalGenericInstance::GetDefaultPrinter()
+{
+ return OUString();
+}
+
+void SalGenericInstance::DestroyPrinter( SalPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+void SalGenericInstance::PostPrintersChanged()
+{
+}
+
+SalInfoPrinter* SalGenericInstance::CreateInfoPrinter( SalPrinterQueueInfo* /* pQueueInfo */,
+ ImplJobSetup* /* pJobSetup */ )
+{
+ return NULL;
+}
+
+void SalGenericInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+void SalGenericInstance::GetPrinterQueueInfo( ImplPrnQueueList* /* pList */ )
+{
+}
+
+void SalGenericInstance::GetPrinterQueueState( SalPrinterQueueInfo* /* pInfo */ )
+{
+}
+
+void SalGenericInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
+{
+ delete pInfo;
+}
+
+void SalGenericInstance::updatePrinterUpdate()
+{
+}
+
+void SalGenericInstance::jobStartedPrinterUpdate()
+{
+}
+
+void SalGenericInstance::jobEndedPrinterUpdate()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx
new file mode 100644
index 000000000000..3ce3a6562d0a
--- /dev/null
+++ b/vcl/ios/iosinst.cxx
@@ -0,0 +1,312 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <premac.h>
+#include <CoreGraphics/CoreGraphics.h>
+#include <postmac.h>
+
+#include <osl/detail/ios-bootstrap.h>
+#include "ios/iosinst.hxx"
+#include "headless/svpdummies.hxx"
+#include "generic/gendata.hxx"
+
+#include <basebmp/scanlineformats.hxx>
+#include <vcl/msgbox.hxx>
+
+// Horrible hack
+static int viewWidth = 1, viewHeight = 1;
+
+class IosSalData : public SalGenericData
+{
+public:
+ IosSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_IOS, pInstance ) {}
+ virtual void ErrorTrapPush() {}
+ virtual bool ErrorTrapPop( bool ) { return false; }
+};
+
+void IosSalInstance::BlitFrameToBuffer(char *pPixelBuffer,
+ int nPBWidth, int nPBHeight,
+ int nDestX, int nDestY,
+ int nDestWidth, int nDestHeight,
+ const basebmp::BitmapDeviceSharedPtr& aDev)
+{
+ // TODO: Cropping (taking all the parameters into account)
+ (void) nPBHeight;
+ (void) nDestWidth;
+ (void) nDestHeight;
+
+ basebmp::RawMemorySharedArray aSrcData = aDev->getBuffer();
+ const basegfx::B2IVector aDevSize = aDev->getSize();
+ const sal_Int32 nStride = aDev->getScanlineStride();
+ const unsigned char *pSrc = aSrcData.get();
+
+ for (unsigned int y = 0; y < (unsigned int)aDevSize.getY(); y++)
+ {
+ const unsigned char *sp( pSrc + nStride * y );
+
+ unsigned char *dp( (unsigned char *)pPixelBuffer +
+ nPBWidth * 4 * (y + nDestY) +
+ nDestX * 4 );
+ for (unsigned int x = 0; x < (unsigned int)aDevSize.getX(); x++)
+ {
+ dp[x*4 + 0] = sp[x*4 + 0]; // R
+ dp[x*4 + 1] = sp[x*4 + 1]; // G
+ dp[x*4 + 2] = sp[x*4 + 2]; // B
+ dp[x*4 + 3] = 255; // A
+ }
+ }
+}
+
+void IosSalInstance::RedrawWindows(char *pPixelBuffer,
+ int nPBWidth, int nPBHeight,
+ int nDestX, int nDestY,
+ int nDestWidth, int nDestHeight)
+{
+ int i = 0;
+ std::list< SalFrame* >::const_iterator it;
+ for ( it = getFrames().begin(); it != getFrames().end(); i++, it++ )
+ {
+ SvpSalFrame *pFrame = static_cast<SvpSalFrame *>(*it);
+
+ if (pFrame->IsVisible())
+ BlitFrameToBuffer( pPixelBuffer, nPBWidth, nPBHeight, nDestX, nDestY, nDestWidth, nDestHeight, pFrame->getDevice() );
+ }
+}
+
+void IosSalInstance::damaged(IosSalFrame */* frame */)
+{
+ lo_damaged();
+}
+
+void IosSalInstance::GetWorkArea( Rectangle& rRect )
+{
+ rRect = Rectangle( Point( 0, 0 ),
+ Size( viewWidth, viewHeight ) );
+}
+
+/*
+ * Try too hard to get a frame, in the absence of anything better to do
+ */
+SalFrame *IosSalInstance::getFocusFrame() const
+{
+ SalFrame *pFocus = SvpSalFrame::GetFocusFrame();
+ if (!pFocus) {
+ const std::list< SalFrame* >& rFrames( getFrames() );
+ for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
+ {
+ SvpSalFrame *pFrame = const_cast<SvpSalFrame*>(static_cast<const SvpSalFrame*>(*it));
+ if( pFrame->IsVisible() )
+ {
+ pFrame->GetFocus();
+ pFocus = pFrame;
+ break;
+ }
+ }
+ }
+ return pFocus;
+}
+
+IosSalInstance *IosSalInstance::getInstance()
+{
+ if (!ImplGetSVData())
+ return NULL;
+ IosSalData *pData = static_cast<IosSalData *>(ImplGetSVData()->mpSalData);
+ if (!pData)
+ return NULL;
+ return static_cast<IosSalInstance *>(pData->m_pInstance);
+}
+
+IosSalInstance::IosSalInstance( SalYieldMutex *pMutex )
+ : SvpSalInstance( pMutex )
+{
+
+}
+
+IosSalInstance::~IosSalInstance()
+{
+}
+
+bool IosSalInstance::AnyInput( sal_uInt16 nType )
+{
+ if( (nType & VCL_INPUT_TIMER) != 0 )
+ return CheckTimeout( false );
+
+ // Unfortunately there is no way to check for a specific type of
+ // input being queued. That information is too hidden, sigh.
+ return SvpSalInstance::s_pDefaultInstance->PostedEventsInQueue();
+}
+
+class IosSalSystem : public SvpSalSystem {
+public:
+ IosSalSystem() : SvpSalSystem() {}
+ virtual ~IosSalSystem() {}
+ virtual int ShowNativeDialog( const rtl::OUString& rTitle,
+ const rtl::OUString& rMessage,
+ const std::list< rtl::OUString >& rButtons,
+ int nDefButton );
+};
+
+SalSystem *IosSalInstance::CreateSalSystem()
+{
+ return new IosSalSystem();
+}
+
+class IosSalFrame : public SvpSalFrame
+{
+public:
+ IosSalFrame( IosSalInstance *pInstance,
+ SalFrame *pParent,
+ sal_uLong nSalFrameStyle,
+ SystemParentData *pSysParent )
+ : SvpSalFrame( pInstance, pParent, nSalFrameStyle,
+ true, basebmp::Format::THIRTYTWO_BIT_TC_MASK_RGBA,
+ pSysParent )
+ {
+ enableDamageTracker();
+ if (pParent == NULL && viewWidth > 1 && viewHeight > 1)
+ SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT);
+ }
+
+ virtual void GetWorkArea( Rectangle& rRect )
+ {
+ IosSalInstance::getInstance()->GetWorkArea( rRect );
+ }
+
+ virtual void damaged( const basegfx::B2IBox& rDamageRect)
+ {
+ if (rDamageRect.getWidth() <= 0 ||
+ rDamageRect.getHeight() <= 0)
+ {
+ return;
+ }
+ IosSalInstance::getInstance()->damaged( this );
+ }
+
+ virtual void UpdateSettings( AllSettings &rSettings )
+ {
+ // Clobber the UI fonts
+ Font aFont( rtl::OUString( "Helvetica" ), Size( 0, 14 ) );
+
+ StyleSettings aStyleSet = rSettings.GetStyleSettings();
+ aStyleSet.SetAppFont( aFont );
+ aStyleSet.SetHelpFont( aFont );
+ aStyleSet.SetMenuFont( aFont );
+ aStyleSet.SetToolFont( aFont );
+ aStyleSet.SetLabelFont( aFont );
+ aStyleSet.SetInfoFont( aFont );
+ aStyleSet.SetRadioCheckFont( aFont );
+ aStyleSet.SetPushButtonFont( aFont );
+ aStyleSet.SetFieldFont( aFont );
+ aStyleSet.SetIconFont( aFont );
+ aStyleSet.SetGroupFont( aFont );
+
+ rSettings.SetStyleSettings( aStyleSet );
+ }
+};
+
+SalFrame *IosSalInstance::CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle )
+{
+ return new IosSalFrame( this, NULL, nStyle, pParent );
+}
+
+SalFrame *IosSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nStyle )
+{
+ return new IosSalFrame( this, pParent, nStyle, NULL );
+}
+
+
+// All the interesting stuff is slaved from the IosSalInstance
+void InitSalData() {}
+void DeInitSalData() {}
+void InitSalMain() {}
+
+void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore )
+{
+ rtl::OUString aError( rErrorText );
+ if( aError.isEmpty() )
+ aError = rtl::OUString::createFromAscii("Unknown application error");
+
+ if( bDumpCore )
+ abort();
+ else
+ _exit(1);
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+ static rtl::OUString aEnv( "android" );
+ return aEnv;
+}
+
+SalData::SalData() :
+ m_pInstance( 0 ),
+ m_pPlugin( 0 ),
+ m_pPIManager(0 ),
+ mpFontList( 0 )
+{
+}
+
+SalData::~SalData()
+{
+}
+
+// This is our main entry point:
+SalInstance *CreateSalInstance()
+{
+ IosSalInstance* pInstance = new IosSalInstance( new SalYieldMutex() );
+ new IosSalData( pInstance );
+ pInstance->AcquireYieldMutex(1);
+ return pInstance;
+}
+
+void DestroySalInstance( SalInstance *pInst )
+{
+ pInst->ReleaseYieldMutex();
+ delete pInst;
+}
+
+int IosSalSystem::ShowNativeDialog( const rtl::OUString& rTitle,
+ const rtl::OUString& rMessage,
+ const std::list< rtl::OUString >& rButtons,
+ int nDefButton )
+{
+ (void)rButtons;
+ (void)nDefButton;
+
+ if (IosSalInstance::getInstance() != NULL)
+ {
+ // Temporary...
+
+ ErrorBox aVclErrBox( NULL, WB_OK, rTitle );
+ aVclErrBox.SetText( rMessage );
+ aVclErrBox.Execute();
+ }
+
+ return 0;
+}
+
+extern "C"
+void lo_render_windows(char *pixelBuffer, int width, int height)
+{
+ // Hack: assume so far that we are asked to redraw the whole pixel buffer
+ if (IosSalInstance::getInstance() != NULL)
+ IosSalInstance::getInstance()->RedrawWindows(pixelBuffer, width, height, 0, 0, width, height);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/saldata.cxx b/vcl/ios/source/app/saldata.cxx
deleted file mode 100644
index f06b139364a3..000000000000
--- a/vcl/ios/source/app/saldata.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "ios/saldata.hxx"
-#include "ios/saluimenu.h"
-#include "ios/salinst.h"
-
-oslThreadKey SalData::s_aAutoReleaseKey = 0;
-
-SalData::SalData()
-:
- mpTimerProc( NULL ),
- mpFirstInstance( NULL ),
- mpFirstObject( NULL ),
- mpFirstVD( NULL ),
- mpFirstPrinter( NULL ),
- mpFontList( NULL ),
- mxRGBSpace( CGColorSpaceCreateDeviceRGB( ) ),
- mxGraySpace( CGColorSpaceCreateDeviceGray( ) ),
- mxP50Space( NULL ),
- mxP50Pattern( NULL ),
- mnDPIX( 0 ),
- mnDPIY( 0 )
-{
- if( s_aAutoReleaseKey == 0 )
- s_aAutoReleaseKey = osl_createThreadKey( NULL );
-}
-
-SalData::~SalData()
-{
- CGPatternRelease( mxP50Pattern );
- CGColorSpaceRelease( mxP50Space );
- CGColorSpaceRelease( mxRGBSpace );
- CGColorSpaceRelease( mxGraySpace );
-}
-
-void SalData::ensureThreadAutoreleasePool()
-{
- NSAutoreleasePool* pPool = nil;
- if( s_aAutoReleaseKey )
- {
- pPool = reinterpret_cast<NSAutoreleasePool*>( osl_getThreadKeyData( s_aAutoReleaseKey ) );
- if( ! pPool )
- {
- pPool = [[NSAutoreleasePool alloc] init];
- osl_setThreadKeyData( s_aAutoReleaseKey, pPool );
- }
- }
- else
- {
- OSL_FAIL( "no autorelease key" );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/salinst.cxx b/vcl/ios/source/app/salinst.cxx
deleted file mode 100644
index 91dd16077d18..000000000000
--- a/vcl/ios/source/app/salinst.cxx
+++ /dev/null
@@ -1,806 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <stdio.h>
-
-#include "tools/fsys.hxx"
-#include "tools/getprocessworkingdir.hxx"
-#include <tools/solarmutex.hxx>
-
-#include "osl/process.h"
-
-#include "rtl/ustrbuf.hxx"
-
-#include "vcl/svapp.hxx"
-#include "vcl/window.hxx"
-#include "vcl/timer.hxx"
-#include "vcl/solarmutex.hxx"
-
-#include "ios/saldata.hxx"
-#include "ios/salinst.h"
-#include "ios/salframe.h"
-#include "ios/salobj.h"
-#include "ios/salsys.h"
-#include "ios/salvd.h"
-#include "quartz/salbmp.h"
-#include "ios/salprn.h"
-#include "ios/saltimer.h"
-#include "ios/vcluiapp.h"
-
-#include "print.h"
-#include "impbmp.hxx"
-#include "salimestatus.hxx"
-
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
-#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-using namespace std;
-using namespace ::com::sun::star;
-
-extern sal_Bool ImplSVMain();
-
-static int* gpnInit = 0;
-static bool bNoSVMain = true;
-// -----------------------------------------------------------------------
-
-class IosDelayedSettingsChanged : public Timer
-{
- bool mbInvalidate;
- public:
- IosDelayedSettingsChanged( bool bInvalidate ) :
- mbInvalidate( bInvalidate )
- {
- }
-
- virtual void Timeout()
- {
- SalData* pSalData = GetSalData();
- if( ! pSalData->maFrames.empty() )
- pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL );
-
- if( mbInvalidate )
- {
- for( std::list< IosSalFrame* >::iterator it = pSalData->maFrames.begin();
- it != pSalData->maFrames.end(); ++it )
- {
- if( (*it)->mbShown )
- (*it)->SendPaintEvent( NULL );
- }
- }
- Stop();
- delete this;
- }
-};
-
-void IosSalInstance::delayedSettingsChanged( bool bInvalidate )
-{
- osl::SolarGuard aGuard( *mpSalYieldMutex );
- IosDelayedSettingsChanged* pTimer = new IosDelayedSettingsChanged( bInvalidate );
- pTimer->SetTimeout( 50 );
- pTimer->Start();
-}
-
-
-// the AppEventList must be available before any SalData/SalInst/etc. objects are ready
-typedef std::list<const ApplicationEvent*> AppEventList;
-AppEventList IosSalInstance::aAppEventList;
-
-// initialize the VCL_UIApplication object
-static void initUIApp()
-{
- [VCL_UIApplication sharedApplication];
-
- SalData::ensureThreadAutoreleasePool();
-}
-
-sal_Bool ImplSVMainHook( int * pnInit )
-{
- char sMain[] = "main";
- gpnInit = pnInit;
-
- bNoSVMain = false;
- initUIApp();
-
- char* pArgv[] = { sMain, NULL };
- UIApplicationMain( 1, pArgv, NULL, NULL );
-
- return TRUE; // indicate that ImplSVMainHook is implemented
-}
-
-// =======================================================================
-
-void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore )
-{
- if( rErrorText.isEmpty() )
- fprintf( stderr, "Application Error " );
- else
- fprintf( stderr, "%s ",
- rtl::OUStringToOString( rErrorText, osl_getThreadTextEncoding() ).getStr() );
- if( bDumpCore )
- abort();
- else
- _exit(1);
-}
-
-// -----------------------------------------------------------------------
-
-void InitSalData()
-{
- SalData *pSalData = new SalData;
- SetSalData( pSalData );
-}
-
-// -----------------------------------------------------------------------
-
-const ::rtl::OUString& SalGetDesktopEnvironment()
-{
- static OUString aDesktopEnvironment( "CocoaTouch" );
- return aDesktopEnvironment;
-}
-
-// -----------------------------------------------------------------------
-
-void DeInitSalData()
-{
- SalData *pSalData = GetSalData();
- delete pSalData;
- SetSalData( NULL );
-}
-
-// -----------------------------------------------------------------------
-
-void InitSalMain()
-{
- // I doubt anything is needed on iOS
-}
-
-// =======================================================================
-
-SalYieldMutex::SalYieldMutex()
-{
- mnCount = 0;
- mnThreadId = 0;
-}
-
-void SalYieldMutex::acquire()
-{
- SolarMutexObject::acquire();
- mnThreadId = osl::Thread::getCurrentIdentifier();
- mnCount++;
-}
-
-void SalYieldMutex::release()
-{
- if ( mnThreadId == osl::Thread::getCurrentIdentifier() )
- {
- if ( mnCount == 1 )
- mnThreadId = 0;
- mnCount--;
- }
- SolarMutexObject::release();
-}
-
-sal_Bool SalYieldMutex::tryToAcquire()
-{
- if ( SolarMutexObject::tryToAcquire() )
- {
- mnThreadId = osl::Thread::getCurrentIdentifier();
- mnCount++;
- return sal_True;
- }
- else
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-// some convenience functions regarding the yield mutex, aka solar mutex
-
-sal_Bool ImplSalYieldMutexTryToAcquire()
-{
- IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance;
- if ( pInst )
- return pInst->mpSalYieldMutex->tryToAcquire();
- else
- return FALSE;
-}
-
-void ImplSalYieldMutexAcquire()
-{
- IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance;
- if ( pInst )
- pInst->mpSalYieldMutex->acquire();
-}
-
-void ImplSalYieldMutexRelease()
-{
- IosSalInstance* pInst = (IosSalInstance*) GetSalData()->mpFirstInstance;
- if ( pInst )
- pInst->mpSalYieldMutex->release();
-}
-
-// =======================================================================
-
-SalInstance* CreateSalInstance()
-{
- // this is the case for not using SVMain
- // not so good
- if( bNoSVMain )
- initUIApp();
-
- SalData* pSalData = GetSalData();
- DBG_ASSERT( pSalData->mpFirstInstance == NULL, "more than one instance created" );
- IosSalInstance* pInst = new IosSalInstance;
-
- // init instance (only one instance in this version !!!)
- pSalData->mpFirstInstance = pInst;
- // this one is for outside IosSalInstance::Yield
- SalData::ensureThreadAutoreleasePool();
- // no focus rects on NWF ios
- ImplGetSVData()->maNWFData.mbNoFocusRects = true;
- ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise = true;
- ImplGetSVData()->maNWFData.mbCenteredTabs = true;
- ImplGetSVData()->maNWFData.mbProgressNeedsErase = true;
- ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true;
- ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10;
- ImplGetSVData()->maGDIData.mbNoXORClipping = true;
- ImplGetSVData()->maWinData.mbNoSaveBackground = true;
-
- return pInst;
-}
-
-// -----------------------------------------------------------------------
-
-void DestroySalInstance( SalInstance* pInst )
-{
- delete pInst;
-}
-
-// -----------------------------------------------------------------------
-
-IosSalInstance::IosSalInstance()
-{
- mpSalYieldMutex = new SalYieldMutex;
- mpSalYieldMutex->acquire();
- ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex );
- maMainThread = osl::Thread::getCurrentIdentifier();
- mbWaitingYield = false;
- maUserEventListMutex = osl_createMutex();
- mnActivePrintJobs = 0;
- maWaitingYieldCond = osl_createCondition();
-}
-
-// -----------------------------------------------------------------------
-
-IosSalInstance::~IosSalInstance()
-{
- ::tools::SolarMutex::SetSolarMutex( 0 );
- mpSalYieldMutex->release();
- delete mpSalYieldMutex;
- osl_destroyMutex( maUserEventListMutex );
- osl_destroyCondition( maWaitingYieldCond );
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::wakeupYield()
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::PostUserEvent( IosSalFrame* pFrame, sal_uInt16 nType, void* pData )
-{
- osl_acquireMutex( maUserEventListMutex );
- maUserEvents.push_back( SalUserEvent( pFrame, pData, nType ) );
- osl_releaseMutex( maUserEventListMutex );
-
- // notify main loop that an event has arrived
- wakeupYield();
-}
-
-// -----------------------------------------------------------------------
-
-osl::SolarMutex* IosSalInstance::GetYieldMutex()
-{
- return mpSalYieldMutex;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uLong IosSalInstance::ReleaseYieldMutex()
-{
- SalYieldMutex* pYieldMutex = mpSalYieldMutex;
- if ( pYieldMutex->GetThreadId() ==
- osl::Thread::getCurrentIdentifier() )
- {
- sal_uLong nCount = pYieldMutex->GetAcquireCount();
- sal_uLong n = nCount;
- while ( n )
- {
- pYieldMutex->release();
- n--;
- }
-
- return nCount;
- }
- else
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::AcquireYieldMutex( sal_uLong nCount )
-{
- SalYieldMutex* pYieldMutex = mpSalYieldMutex;
- while ( nCount )
- {
- pYieldMutex->acquire();
- nCount--;
- }
-}
-
-// -----------------------------------------------------------------------
-
-bool IosSalInstance::CheckYieldMutex()
-{
- bool bRet = true;
-
- SalYieldMutex* pYieldMutex = mpSalYieldMutex;
- if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier())
- {
- bRet = false;
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-bool IosSalInstance::isUIAppThread() const
-{
- return osl::Thread::getCurrentIdentifier() == maMainThread;
-}
-
-// -----------------------------------------------------------------------
-
-class ReleasePoolHolder
-{
- NSAutoreleasePool* mpPool;
- public:
- ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {}
- ~ReleasePoolHolder() { [mpPool release]; }
-};
-
-void IosSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
-{
- // ensure that the per thread autorelease pool is top level and
- // will therefore not be destroyed by cocoa implicitly
- SalData::ensureThreadAutoreleasePool();
-
- // NSAutoreleasePool documentation suggests we should have
- // an own pool for each yield level
- ReleasePoolHolder aReleasePool;
-
- // Release all locks so that we don't deadlock when we pull pending
- // events from the event queue
- bool bDispatchUser = true;
- while( bDispatchUser )
- {
- sal_uLong nCount = ReleaseYieldMutex();
-
- // get one user event
- osl_acquireMutex( maUserEventListMutex );
- SalUserEvent aEvent( NULL, NULL, 0 );
- if( ! maUserEvents.empty() )
- {
- aEvent = maUserEvents.front();
- maUserEvents.pop_front();
- }
- else
- bDispatchUser = false;
- osl_releaseMutex( maUserEventListMutex );
-
- AcquireYieldMutex( nCount );
-
- // dispatch it
- if( aEvent.mpFrame && IosSalFrame::isAlive( aEvent.mpFrame ) )
- {
- aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData );
- osl_setCondition( maWaitingYieldCond );
- // return if only one event is asked for
- if( ! bHandleAllCurrentEvents )
- return;
- }
- }
-
- // handle event queue
- // events mye be only handled in the thread the app was created
- if( mnActivePrintJobs == 0 )
- {
- // we need to be woken up by a cocoa-event
- // if a user event should be posted by the event handling below
- bool bOldWaitingYield = mbWaitingYield;
- mbWaitingYield = bWait;
-
- mbWaitingYield = bOldWaitingYield;
-
- // collect update rectangles
- const std::list< IosSalFrame* > rFrames( GetSalData()->maFrames );
- for( std::list< IosSalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
- {
- if( (*it)->mbShown && ! (*it)->maInvalidRect.IsEmpty() )
- {
- (*it)->Flush( (*it)->maInvalidRect );
- (*it)->maInvalidRect.SetEmpty();
- }
- }
- osl_setCondition( maWaitingYieldCond );
- }
-}
-
-// -----------------------------------------------------------------------
-
-bool IosSalInstance::AnyInput( sal_uInt16 nType )
-{
- if( nType & VCL_INPUT_APPEVENT )
- {
- if( ! aAppEventList.empty() )
- return true;
- if( nType == VCL_INPUT_APPEVENT )
- return false;
- }
-
- if( nType & VCL_INPUT_TIMER )
- {
- if( IosSalTimer::pRunningTimer )
- {
- NSDate* pDt = [IosSalTimer::pRunningTimer fireDate];
- if( pDt && [pDt timeIntervalSinceNow] < 0 )
- {
- return true;
- }
- }
- }
- return false;
-}
-
-// -----------------------------------------------------------------------
-
-SalFrame* IosSalInstance::CreateChildFrame( SystemParentData*, sal_uLong /*nSalFrameStyle*/ )
-{
- return NULL;
-}
-
-// -----------------------------------------------------------------------
-
-SalFrame* IosSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameStyle )
-{
- SalData::ensureThreadAutoreleasePool();
-
- SalFrame* pFrame = new IosSalFrame( pParent, nSalFrameStyle );
- return pFrame;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DestroyFrame( SalFrame* pFrame )
-{
- delete pFrame;
-}
-
-// -----------------------------------------------------------------------
-
-SalObject* IosSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /* pWindowData */, sal_Bool /* bShow */ )
-{
- // SystemWindowData is meaningless on Mac OS X
- IosSalObject *pObject = NULL;
-
- if ( pParent )
- pObject = new IosSalObject( static_cast<IosSalFrame*>(pParent) );
-
- return pObject;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DestroyObject( SalObject* pObject )
-{
- delete ( pObject );
-}
-
-// -----------------------------------------------------------------------
-
-SalPrinter* IosSalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
-{
- (void) pInfoPrinter;
- return NULL;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DestroyPrinter( SalPrinter* pPrinter )
-{
- delete pPrinter;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
-{
- // ???
- (void) pList;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* )
-{
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
-{
- delete pInfo;
-}
-
-// -----------------------------------------------------------------------
-
-rtl::OUString IosSalInstance::GetDefaultPrinter()
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- // ???
- return maDefaultPrinter;
-}
-
-// -----------------------------------------------------------------------
-
-SalInfoPrinter* IosSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
- ImplJobSetup* pSetupData )
-{
- (void) pQueueInfo;
- (void) pSetupData;
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- SalInfoPrinter* pNewInfoPrinter = NULL;
-
- // ???
-
- return pNewInfoPrinter;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- delete pPrinter;
-}
-
-// -----------------------------------------------------------------------
-
-SalSystem* IosSalInstance::CreateSystem()
-{
- return new IosSalSystem();
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DestroySystem( SalSystem* pSystem )
-{
- delete pSystem;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::SetEventCallback( void*, bool(*)(void*,void*,int) )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::SetErrorEventCallback( void*, bool(*)(void*,void*,int) )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void* IosSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes )
-{
- rReturnedBytes = 1;
- rReturnedType = AsciiCString;
- return (void*)"";
-}
-
-void IosSalInstance::AddToRecentDocumentList(const rtl::OUString& /*rFileUrl*/, const rtl::OUString& /*rMimeType*/)
-{
-}
-
-// -----------------------------------------------------------------------
-
-SalTimer* IosSalInstance::CreateSalTimer()
-{
- return new IosSalTimer();
-}
-
-// -----------------------------------------------------------------------
-
-SalSystem* IosSalInstance::CreateSalSystem()
-{
- return new IosSalSystem();
-}
-
-// -----------------------------------------------------------------------
-
-SalBitmap* IosSalInstance::CreateSalBitmap()
-{
- return new QuartzSalBitmap();
-}
-
-// -----------------------------------------------------------------------
-
-SalSession* IosSalInstance::CreateSalSession()
-{
- return NULL;
-}
-
-// -----------------------------------------------------------------------
-
-class IOsImeStatus : public SalI18NImeStatus
-{
-public:
- IOsImeStatus() {}
- virtual ~IOsImeStatus() {}
-
- // asks whether there is a status window available
- // to toggle into menubar
- virtual bool canToggle() { return false; }
- virtual void toggle() {}
-};
-
-// -----------------------------------------------------------------------
-
-SalI18NImeStatus* IosSalInstance::CreateI18NImeStatus()
-{
- return new IOsImeStatus();
-}
-
-// -----------------------------------------------------------------------
-
-// YieldMutexReleaser
-YieldMutexReleaser::YieldMutexReleaser() : mnCount( 0 )
-{
- SalData* pSalData = GetSalData();
- if( ! pSalData->mpFirstInstance->isUIAppThread() )
- {
- SalData::ensureThreadAutoreleasePool();
- mnCount = pSalData->mpFirstInstance->ReleaseYieldMutex();
- }
-}
-
-YieldMutexReleaser::~YieldMutexReleaser()
-{
- if( mnCount != 0 )
- GetSalData()->mpFirstInstance->AcquireYieldMutex( mnCount );
-}
-
-//////////////////////////////////////////////////////////////
-rtl::OUString GetOUString( CFStringRef rStr )
-{
- if( rStr == 0 )
- return rtl::OUString();
- CFIndex nLength = CFStringGetLength( rStr );
- if( nLength == 0 )
- return rtl::OUString();
- const UniChar* pConstStr = CFStringGetCharactersPtr( rStr );
- if( pConstStr )
- return rtl::OUString( pConstStr, nLength );
- UniChar* pStr = reinterpret_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) );
- CFRange aRange = { 0, nLength };
- CFStringGetCharacters( rStr, aRange, pStr );
- rtl::OUString aRet( pStr, nLength );
- rtl_freeMemory( pStr );
- return aRet;
-}
-
-rtl::OUString GetOUString( NSString* pStr )
-{
- if( ! pStr )
- return rtl::OUString();
- int nLen = [pStr length];
- if( nLen == 0 )
- return rtl::OUString();
-
- rtl::OUStringBuffer aBuf( nLen+1 );
- aBuf.setLength( nLen );
- [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
- return aBuf.makeStringAndClear();
-}
-
-CFStringRef CreateCFString( const rtl::OUString& rStr )
-{
- return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() );
-}
-
-NSString* CreateNSString( const rtl::OUString& rStr )
-{
- return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()];
-}
-
-CGImageRef CreateCGImage( const Image& rImage )
-{
- BitmapEx aBmpEx( rImage.GetBitmapEx() );
- Bitmap aBmp( aBmpEx.GetBitmap() );
-
- if( ! aBmp || ! aBmp.ImplGetImpBitmap() )
- return NULL;
-
- // simple case, no transparency
- QuartzSalBitmap* pSalBmp = static_cast<QuartzSalBitmap*>(aBmp.ImplGetImpBitmap()->ImplGetSalBitmap());
-
- if( ! pSalBmp )
- return NULL;
-
- CGImageRef xImage = NULL;
- if( ! (aBmpEx.IsAlpha() || aBmpEx.IsTransparent() ) )
- xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
- else if( aBmpEx.IsAlpha() )
- {
- AlphaMask aAlphaMask( aBmpEx.GetAlpha() );
- Bitmap aMask( aAlphaMask.GetBitmap() );
- QuartzSalBitmap* pMaskBmp = static_cast<QuartzSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap());
- if( pMaskBmp )
- xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
- else
- xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
- }
- else if( aBmpEx.GetTransparentType() == TRANSPARENT_BITMAP )
- {
- Bitmap aMask( aBmpEx.GetMask() );
- QuartzSalBitmap* pMaskBmp = static_cast<QuartzSalBitmap*>(aMask.ImplGetImpBitmap()->ImplGetSalBitmap());
- if( pMaskBmp )
- xImage = pSalBmp->CreateWithMask( *pMaskBmp, 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
- else
- xImage = pSalBmp->CreateCroppedImage( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight );
- }
- else if( aBmpEx.GetTransparentType() == TRANSPARENT_COLOR )
- {
- Color aTransColor( aBmpEx.GetTransparentColor() );
- SalColor nTransColor = MAKE_SALCOLOR( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() );
- xImage = pSalBmp->CreateColorMask( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight, nTransColor );
- }
-
- return xImage;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/salnstimer.mm b/vcl/ios/source/app/salnstimer.mm
deleted file mode 100644
index db0e37a6ce31..000000000000
--- a/vcl/ios/source/app/salnstimer.mm
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "ios/saltimer.h"
-#include "ios/salnstimer.h"
-#include "ios/salinst.h"
-#include "ios/saldata.hxx"
-
-#include "svdata.hxx"
-
-@implementation TimerCallbackCaller
--(void)timerElapsed:(NSTimer*)pTimer
-{
- (void)pTimer;
- ImplSVData* pSVData = ImplGetSVData();
- if( IosSalTimer::bDispatchTimer )
- {
- if( pSVData->mpSalTimer )
- {
- YIELD_GUARD;
- pSVData->mpSalTimer->CallCallback();
-
- // NSTimer does not end nextEventMatchingMask of NSApplication
- // so we need to wakeup a waiting Yield to inform it something happened
- GetSalData()->mpFirstInstance->wakeupYield();
- }
- }
-}
-@end
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/salsys.cxx b/vcl/ios/source/app/salsys.cxx
deleted file mode 100644
index 37ac4e4d99b1..000000000000
--- a/vcl/ios/source/app/salsys.cxx
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "rtl/ustrbuf.hxx"
-
-#include "vcl/button.hxx"
-
-#include "ios/salsys.h"
-#include "ios/saldata.hxx"
-#include "ios/salinst.h"
-
-#include "svids.hrc"
-
-using ::rtl::OUString;
-
-// =======================================================================
-
-IosSalSystem::~IosSalSystem()
-{
-}
-
-unsigned int IosSalSystem::GetDisplayScreenCount()
-{
- NSArray* pScreens = [UIScreen screens];
- return pScreens ? [pScreens count] : 1;
-}
-
-Rectangle IosSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen )
-{
- NSArray* pScreens = [UIScreen screens];
- Rectangle aRet;
- UIScreen* pScreen = nil;
- if( pScreens && nScreen < [pScreens count] )
- pScreen = [pScreens objectAtIndex: nScreen];
- else
- pScreen = [UIScreen mainScreen];
-
- if( pScreen )
- {
- CGRect aFrame = pScreen.bounds;
- aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ),
- Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) );
- }
- return aRet;
-}
-
-Rectangle IosSalSystem::GetDisplayScreenWorkAreaPosSizePixel( unsigned int nScreen )
-{
- NSArray* pScreens = [UIScreen screens];
- Rectangle aRet;
- UIScreen* pScreen = nil;
- if( pScreens && nScreen < [pScreens count] )
- pScreen = [pScreens objectAtIndex: nScreen];
- else
- pScreen = [UIScreen mainScreen];
-
- if( pScreen )
- {
- CGRect aFrame = pScreen.applicationFrame;
- aRet = Rectangle( Point( static_cast<long int>(aFrame.origin.x), static_cast<long int>(aFrame.origin.y) ),
- Size( static_cast<long int>(aFrame.size.width), static_cast<long int>(aFrame.size.height) ) );
- }
- return aRet;
-}
-
-rtl::OUString IosSalSystem::GetDisplayScreenName( unsigned int nScreen )
-{
- NSArray* pScreens = [UIScreen screens];
- OUString aRet;
- if( nScreen < [pScreens count] )
- {
- ResMgr* pMgr = ImplGetResMgr();
- if( pMgr )
- {
- String aScreenName( ResId( SV_MAC_SCREENNNAME, *pMgr ) );
- aScreenName.SearchAndReplaceAllAscii( "%d", OUString::number( nScreen ) );
- aRet = aScreenName;
- }
- }
- return aRet;
-}
-
-static NSString* getStandardString( int nButtonId, bool bUseResources )
-{
- rtl::OUString aText;
- if( bUseResources )
- {
- aText = Button::GetStandardText( nButtonId );
- }
- if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource
- {
- switch( nButtonId )
- {
- case BUTTON_OK: aText = rtl::OUString( "OK" );break;
- case BUTTON_ABORT: aText = rtl::OUString( "Abort" );break;
- case BUTTON_CANCEL: aText = rtl::OUString( "Cancel" );break;
- case BUTTON_RETRY: aText = rtl::OUString( "Retry" );break;
- case BUTTON_YES: aText = rtl::OUString( "Yes" );break;
- case BUTTON_NO : aText = rtl::OUString( "No" );break;
- }
- }
- return aText.getLength() ? CreateNSString( aText) : nil;
-}
-
-@interface MessageboxDelegate : NSObject <UIAlertViewDelegate>
-{
- int *_resultPtr;
-}
-- (id)initWithResultPtr:(int *)resultPtr;
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
-@end
-
-@implementation MessageboxDelegate
-- (id)initWithResultPtr:(int *)resultPtr
-{
- _resultPtr = resultPtr;
- return [super init];
-}
-
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
- (void) alertView;
-
- *_resultPtr = buttonIndex;
-}
-@end
-
-int IosSalSystem::ShowNativeMessageBox( const rtl::OUString& rTitle,
- const rtl::OUString& rMessage,
- int nButtonCombination,
- int nDefaultButton, bool bUseResources)
-{
- NSString* pTitle = CreateNSString( rTitle );
- NSString* pMessage = CreateNSString( rMessage );
-
- struct id_entry
- {
- int nCombination;
- int nDefaultButton;
- int nTextIds[3];
- } aButtonIds[] =
- {
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } },
- { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } }
- };
-
- NSString* pDefText = nil;
- NSString* pAltText = nil;
- NSString* pOthText = nil;
-
- unsigned int nC;
- for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ )
- {
- if( aButtonIds[nC].nCombination == nButtonCombination )
- {
- if( aButtonIds[nC].nDefaultButton == nDefaultButton )
- {
- if( aButtonIds[nC].nTextIds[0] != -1 )
- pDefText = getStandardString(
- aButtonIds[nC].nTextIds[0], bUseResources );
- if( aButtonIds[nC].nTextIds[1] != -1 )
- pAltText = getStandardString(
- aButtonIds[nC].nTextIds[1], bUseResources );
- if( aButtonIds[nC].nTextIds[2] != -1 )
- pOthText = getStandardString(
- aButtonIds[nC].nTextIds[2], bUseResources );
- break;
- }
- }
- }
-
- int nResult = 1; // ???
- // How to do the delegate when this is C++?
- MessageboxDelegate *delegate = [[MessageboxDelegate alloc] initWithResultPtr: &nResult];
- UIAlertView *view = [[UIAlertView alloc] initWithTitle: pTitle message: pMessage delegate: delegate
- cancelButtonTitle: @"Cancel" otherButtonTitles: nil];
- [view show];
- [view dealloc];
- [delegate dealloc];
-
- if( pTitle )
- [pTitle release];
- if( pMessage )
- [pMessage release];
- if( pDefText )
- [pDefText release];
- if( pAltText )
- [pAltText release];
- if( pOthText )
- [pOthText release];
-
- int nRet = 0;
- if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 )
- {
- int nPressed = aButtonIds[nC].nTextIds[nResult-1];
- switch( nPressed )
- {
- case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break;
- case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break;
- case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break;
- case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break;
- case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break;
- case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break;
- case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break;
- }
- }
-
- return nRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/saltimer.cxx b/vcl/ios/source/app/saltimer.cxx
deleted file mode 100644
index d5a8bc434f8f..000000000000
--- a/vcl/ios/source/app/saltimer.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "ios/saltimer.h"
-#include "ios/salnstimer.h"
-#include "ios/saldata.hxx"
-#include "ios/salframe.h"
-#include "ios/salinst.h"
-
-// =======================================================================
-
-NSTimer* IosSalTimer::pRunningTimer = nil;
-bool IosSalTimer::bDispatchTimer = false;
-
-
-void ImplSalStartTimer( sal_uLong nMS )
-{
- SalData* pSalData = GetSalData();
- if( pSalData->mpFirstInstance->isUIAppThread() )
- {
- IosSalTimer::bDispatchTimer = true;
- NSTimeInterval aTI = double(nMS)/1000.0;
- if( IosSalTimer::pRunningTimer != nil )
- {
- if( [IosSalTimer::pRunningTimer timeInterval] == aTI )
- // set new fire date
- [IosSalTimer::pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]];
- else
- {
- [IosSalTimer::pRunningTimer invalidate];
- IosSalTimer::pRunningTimer = nil;
- }
- }
- if( IosSalTimer::pRunningTimer == nil )
- {
- IosSalTimer::pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI
- target: [[[TimerCallbackCaller alloc] init] autorelease]
- selector: @selector(timerElapsed:)
- userInfo: nil
- repeats: YES];
- }
- }
- else
- {
- SalData::ensureThreadAutoreleasePool();
- // post an event so we can get into the main thread
- // ???
- }
-}
-
-void ImplSalStopTimer()
-{
- IosSalTimer::bDispatchTimer = false;
-}
-
-IosSalTimer::IosSalTimer( )
-{
-}
-
-IosSalTimer::~IosSalTimer()
-{
- ImplSalStopTimer();
-}
-
-void IosSalTimer::Start( sal_uLong nMS )
-{
- ImplSalStartTimer( nMS );
-}
-
-void IosSalTimer::Stop()
-{
- ImplSalStopTimer();
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/app/vcluiapp.mm b/vcl/ios/source/app/vcluiapp.mm
deleted file mode 100644
index 7344937f0212..000000000000
--- a/vcl/ios/source/app/vcluiapp.mm
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "rtl/ustrbuf.hxx"
-
-#include "vcl/window.hxx"
-#include "vcl/svapp.hxx"
-#include "vcl/cmdevt.hxx"
-
-#include "ios/vcluiapp.h"
-#include "ios/salinst.h"
-#include "ios/saldata.hxx"
-#include "ios/salframe.h"
-#include "ios/salframeview.h"
-
-#include "impimagetree.hxx"
-
-@implementation VCL_UIApplication
--(void)sendEvent:(UIEvent*)pEvent
-{
- [super sendEvent: pEvent];
-}
-
--(void)sendSuperEvent:(UIEvent*)pEvent
-{
- [super sendEvent: pEvent];
-}
-
--(BOOL)application: (UIApplication*)app openFile: (NSString*)pFile
-{
- (void)app;
- const rtl::OUString aFile( GetOUString( pFile ) );
- return YES;
-}
-
--(void)application: (UIApplication*) app openFiles: (NSArray*)files
-{
- (void)app;
- rtl::OUStringBuffer aFileList( 256 );
-
- NSEnumerator* it = [files objectEnumerator];
- NSString* pFile = nil;
-
- while( (pFile = [it nextObject]) != nil )
- {
- const rtl::OUString aFile( GetOUString( pFile ) );
- }
-
- if( aFileList.getLength() )
- {
- // we have no back channel here, we have to assume success, in which case
- // replyToOpenOrPrint does not need to be called according to documentation
- // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
- const ApplicationEvent* pAppEvent = new ApplicationEvent(ApplicationEvent::TYPE_OPEN, aFileList.makeStringAndClear());
- IosSalInstance::aAppEventList.push_back( pAppEvent );
- }
-}
-
--(void)addFallbackMenuItem: (UIMenuItem*)pNewItem
-{
- // ???
- (void) pNewItem;
-}
-
--(void)removeFallbackMenuItem: (UIMenuItem*)pItem
-{
- // ???
- (void) pItem;
-}
-
-@end
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/dtrans/iOSTransferable.cxx b/vcl/ios/source/dtrans/iOSTransferable.cxx
deleted file mode 100644
index 2ff71156c01d..000000000000
--- a/vcl/ios/source/dtrans/iOSTransferable.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/types.h>
-
-#include "iOSTransferable.hxx"
-
-using namespace std;
-using namespace osl;
-using namespace cppu;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::datatransfer;
-using namespace com::sun::star::io;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::container;
-
-using ::rtl::OUString;
-
-namespace // private
-{
- bool isValidFlavor( const DataFlavor& aFlavor )
- {
- size_t len = aFlavor.MimeType.getLength();
- Type dtype = aFlavor.DataType;
- return ((len > 0) && ((dtype == getCppuType((Sequence<sal_Int8>*)0)) || (dtype == getCppuType((OUString*)0))));
- }
-
-} // namespace private
-
-
-iOSTransferable::iOSTransferable(const Reference<XMimeContentTypeFactory> rXMimeCntFactory,
- UIPasteboard* pasteboard) :
- mrXMimeCntFactory(rXMimeCntFactory),
- mPasteboard(pasteboard)
-{
- [mPasteboard retain];
-
- initClipboardItemList();
-}
-
-
-iOSTransferable::~iOSTransferable()
-{
- [mPasteboard release];
-}
-
-
-Any SAL_CALL iOSTransferable::getTransferData( const DataFlavor& aFlavor )
- throw( UnsupportedFlavorException, IOException, RuntimeException )
-{
- if (!isValidFlavor(aFlavor) || !isDataFlavorSupported(aFlavor))
- {
- throw UnsupportedFlavorException(OUString("IosClipboard: Unsupported data flavor"),
- static_cast<XTransferable*>(this));
- }
-
- throw UnsupportedFlavorException(OUString("IosClipboard: Unsupported data flavor"),
- static_cast<XTransferable*>(this));
- // ???
- return Any();
-}
-
-
-bool iOSTransferable::isUnicodeText(const DataFlavor& flavor)
-{
- return (flavor.DataType == getCppuType((OUString*)0));
-}
-
-
-Sequence< DataFlavor > SAL_CALL iOSTransferable::getTransferDataFlavors( )
- throw( RuntimeException )
-{
- return mFlavorList;
-}
-
-
-sal_Bool SAL_CALL iOSTransferable::isDataFlavorSupported(const DataFlavor& aFlavor)
- throw( RuntimeException )
-{
- for (sal_Int32 i = 0; i < mFlavorList.getLength(); i++)
- if (compareDataFlavors(aFlavor, mFlavorList[i]))
- return sal_True;
-
- return sal_False;
-}
-
-
-void iOSTransferable::initClipboardItemList()
-{
- NSArray* pboardFormats = [mPasteboard pasteboardTypes];
-
- if (pboardFormats == NULL)
- {
- throw RuntimeException(OUString("IosClipboard: Cannot get clipboard data"),
- static_cast<XTransferable*>(this));
- }
-
- // ???
-}
-
-
-/* Compares two DataFlavors. Returns true if both DataFlavor have the same media type
- and the number of parameter and all parameter values do match otherwise false
- is returned.
- */
-bool iOSTransferable::compareDataFlavors(const DataFlavor& lhs, const DataFlavor& rhs )
-{
- try
- {
- Reference<XMimeContentType> xLhs(mrXMimeCntFactory->createMimeContentType(lhs.MimeType));
- Reference<XMimeContentType> xRhs(mrXMimeCntFactory->createMimeContentType(rhs.MimeType));
-
- if (!xLhs->getFullMediaType().equalsIgnoreAsciiCase(xRhs->getFullMediaType()) ||
- !cmpAllContentTypeParameter(xLhs, xRhs))
- {
- return false;
- }
- }
- catch( IllegalArgumentException& )
- {
- OSL_FAIL( "Invalid content type detected" );
- return false;
- }
-
- return true;
-}
-
-
-bool iOSTransferable::cmpAllContentTypeParameter(const Reference<XMimeContentType> xLhs,
- const Reference<XMimeContentType> xRhs) const
-{
- Sequence<OUString> xLhsFlavors = xLhs->getParameters();
- Sequence<OUString> xRhsFlavors = xRhs->getParameters();
-
- // Stop here if the number of parameters is different already
- if (xLhsFlavors.getLength() != xRhsFlavors.getLength())
- return false;
-
- try
- {
- OUString pLhs;
- OUString pRhs;
-
- for (sal_Int32 i = 0; i < xLhsFlavors.getLength(); i++)
- {
- pLhs = xLhs->getParameterValue(xLhsFlavors[i]);
- pRhs = xRhs->getParameterValue(xLhsFlavors[i]);
-
- if (!pLhs.equalsIgnoreAsciiCase(pRhs))
- {
- return false;
- }
- }
- }
- catch(IllegalArgumentException&)
- {
- return false;
- }
-
- return true;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/dtrans/iOSTransferable.hxx b/vcl/ios/source/dtrans/iOSTransferable.hxx
deleted file mode 100644
index 843875cf0f01..000000000000
--- a/vcl/ios/source/dtrans/iOSTransferable.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#ifndef _TRANSFERABLE_HXX_
-#define _TRANSFERABLE_HXX_
-
-#include <com/sun/star/datatransfer/XTransferable.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
-#include <com/sun/star/datatransfer/XMimeContentType.hpp>
-
-#include <premac.h>
-#import <UIKit/UIKit.h>
-#include <postmac.h>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/utility.hpp>
-#include <vector>
-
-
-class iOSTransferable : public ::cppu::WeakImplHelper1<com::sun::star::datatransfer::XTransferable>,
- private ::boost::noncopyable
-{
-public:
- typedef com::sun::star::uno::Sequence< sal_Int8 > ByteSequence_t;
-
- explicit iOSTransferable(com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> rXMimeCntFactory,
- UIPasteboard* pasteboard);
-
- virtual ~iOSTransferable();
-
- //------------------------------------------------------------------------
- // XTransferable
- //------------------------------------------------------------------------
-
- virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
- throw( ::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
- throw( ::com::sun::star::uno::RuntimeException );
-
- //------------------------------------------------------------------------
- // Helper functions not part of the XTransferable interface
- //------------------------------------------------------------------------
-
- void initClipboardItemList();
-
- //com::sun::star::uno::Any getClipboardItemData(ClipboardItemPtr_t clipboardItem);
-
- bool isUnicodeText(const com::sun::star::datatransfer::DataFlavor& flavor);
-
- bool compareDataFlavors( const com::sun::star::datatransfer::DataFlavor& lhs,
- const com::sun::star::datatransfer::DataFlavor& rhs );
-
- bool cmpAllContentTypeParameter( const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xLhs,
- const com::sun::star::uno::Reference< com::sun::star::datatransfer::XMimeContentType > xRhs ) const;
-
-private:
- com::sun::star::uno::Sequence< com::sun::star::datatransfer::DataFlavor > mFlavorList;
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory;
- UIPasteboard* mPasteboard;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/dtrans/ios_clipboard.cxx b/vcl/ios/source/dtrans/ios_clipboard.cxx
deleted file mode 100644
index a7fc7af8ff9d..000000000000
--- a/vcl/ios/source/dtrans/ios_clipboard.cxx
+++ /dev/null
@@ -1,377 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "ios_clipboard.hxx"
-
-#include "iOSTransferable.hxx"
-#include <com/sun/star/datatransfer/MimeContentTypeFactory.hpp>
-#include "comphelper/makesequence.hxx"
-#include "comphelper/processfactory.hxx"
-
-#include <boost/assert.hpp>
-
-using namespace com::sun::star::datatransfer;
-using namespace com::sun::star::datatransfer::clipboard;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace cppu;
-using namespace osl;
-using namespace std;
-using namespace comphelper;
-
-using ::rtl::OUString;
-
-@implementation EventListener;
-
--(EventListener*)initWithIosClipboard: (IosClipboard*) pcb
-{
- self = [super init];
-
- if (self)
- pIosClipboard = pcb;
-
- return self;
-}
-
--(void)pasteboard:(UIPasteboard*)sender provideDataForType:(NSString*)type
-{
- if( pIosClipboard )
- pIosClipboard->provideDataForType(sender, type);
-}
-
--(void)applicationDidBecomeActive:(NSNotification*)aNotification
-{
- if( pIosClipboard )
- pIosClipboard->applicationDidBecomeActive(aNotification);
-}
-
--(void)disposing
-{
- pIosClipboard = NULL;
-}
-
-@end
-
-
-OUString clipboard_getImplementationName()
-{
- return OUString("com.sun.star.datatransfer.clipboard.IosClipboard");
-}
-
-Sequence<OUString> clipboard_getSupportedServiceNames()
-{
- return makeSequence(OUString("com.sun.star.datatransfer.clipboard.SystemClipboard"));
-}
-
-
-IosClipboard::IosClipboard(UIPasteboard* pasteboard, bool bUseSystemPasteboard) :
- WeakComponentImplHelper3<XSystemClipboard, XFlushableClipboard, XServiceInfo>(m_aMutex),
- mIsSystemPasteboard(bUseSystemPasteboard)
-{
- Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
-
- mrXMimeCntFactory = MimeContentTypeFactory::create(xContext);
-
-#if 0 // ???
- mpDataFlavorMapper = DataFlavorMapperPtr_t(new DataFlavorMapper());
-#endif
- if (pasteboard != NULL)
- {
- mPasteboard = pasteboard;
- mIsSystemPasteboard = false;
- }
- else
- {
- mPasteboard = bUseSystemPasteboard ? [UIPasteboard generalPasteboard] :
- [UIPasteboard pasteboardWithName: @"org.libreoffice.pboard" create: YES];
-
- if (mPasteboard == nil)
- {
- throw RuntimeException(OUString("IosClipboard: Cannot create pasteboard"),
- static_cast<XClipboardEx*>(this));
- }
- }
-
- [mPasteboard retain];
-
- mEventListener = [[EventListener alloc] initWithIosClipboard: this];
-
- if (mEventListener == nil)
- {
- [mPasteboard release];
-
- throw RuntimeException(
- OUString("IosClipboard: Cannot create pasteboard change listener"),
- static_cast<XClipboardEx*>(this));
- }
-
- if (mIsSystemPasteboard)
- {
- NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter];
-
- [notificationCenter addObserver: mEventListener
- selector: @selector(applicationDidBecomeActive:)
- name: @"UIApplicationDidBecomeActiveNotification"
- object: [UIApplication sharedApplication]];
- }
-
- mPasteboardChangeCount = [mPasteboard changeCount];
-}
-
-
-IosClipboard::~IosClipboard()
-{
- if (mIsSystemPasteboard)
- {
- [[NSNotificationCenter defaultCenter] removeObserver: mEventListener];
- }
-
- [mEventListener disposing];
- [mEventListener release];
- [mPasteboard release];
-}
-
-
-Reference<XTransferable> SAL_CALL IosClipboard::getContents() throw(RuntimeException)
-{
- MutexGuard aGuard(m_aMutex);
-
- // Shortcut: If we are clipboard owner already we don't need
- // to drag the data through the system clipboard
- if (mXClipboardContent.is())
- {
- return mXClipboardContent;
- }
-
- return Reference<XTransferable>(new iOSTransferable(mrXMimeCntFactory,
- mPasteboard));
-}
-
-
-void SAL_CALL IosClipboard::setContents(const Reference<XTransferable>& /*xTransferable*/,
- const Reference<XClipboardOwner>& /*xClipboardOwner*/)
- throw( RuntimeException )
-{
-#if 0 // ???
- NSArray* types = xTransferable.is() ?
- mpDataFlavorMapper->flavorSequenceToTypesArray(xTransferable->getTransferDataFlavors()) :
- [NSArray array];
-
- ClearableMutexGuard aGuard(m_aMutex);
-
- Reference<XClipboardOwner> oldOwner(mXClipboardOwner);
- mXClipboardOwner = xClipboardOwner;
-
- Reference<XTransferable> oldContent(mXClipboardContent);
- mXClipboardContent = xTransferable;
-
- mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener];
-
- aGuard.clear();
-
- // if we are already the owner of the clipboard
- // then fire lost ownership event
- if (oldOwner.is())
- {
- fireLostClipboardOwnershipEvent(oldOwner, oldContent);
- }
-
- fireClipboardChangedEvent();
-#endif
-}
-
-
-OUString SAL_CALL IosClipboard::getName() throw( RuntimeException )
-{
- return OUString();
-}
-
-
-sal_Int8 SAL_CALL IosClipboard::getRenderingCapabilities() throw( RuntimeException )
-{
- return 0;
-}
-
-
-void SAL_CALL IosClipboard::addClipboardListener(const Reference< XClipboardListener >& listener)
- throw( RuntimeException )
-{
- MutexGuard aGuard(m_aMutex);
-
- if (!listener.is())
- throw IllegalArgumentException(OUString("empty reference"),
- static_cast<XClipboardEx*>(this), 1);
-
- mClipboardListeners.push_back(listener);
-}
-
-
-void SAL_CALL IosClipboard::removeClipboardListener(const Reference< XClipboardListener >& listener)
- throw( RuntimeException )
-{
- MutexGuard aGuard(m_aMutex);
-
- if (!listener.is())
- throw IllegalArgumentException(OUString("empty reference"),
- static_cast<XClipboardEx*>(this), 1);
-
- mClipboardListeners.remove(listener);
-}
-
-
-void IosClipboard::applicationDidBecomeActive(NSNotification*)
-{
- ClearableMutexGuard aGuard(m_aMutex);
-
- int currentPboardChgCount = [mPasteboard changeCount];
-
- if (currentPboardChgCount != mPasteboardChangeCount)
- {
- mPasteboardChangeCount = currentPboardChgCount;
-
- // Clear clipboard content and owner and send lostOwnership
- // notification to the old clipboard owner as well as
- // ClipboardChanged notification to any clipboard listener
- Reference<XClipboardOwner> oldOwner(mXClipboardOwner);
- mXClipboardOwner = Reference<XClipboardOwner>();
-
- Reference<XTransferable> oldContent(mXClipboardContent);
- mXClipboardContent = Reference<XTransferable>();
-
- aGuard.clear();
-
- if (oldOwner.is())
- {
- fireLostClipboardOwnershipEvent(oldOwner, oldContent);
- }
-
- fireClipboardChangedEvent();
- }
-}
-
-
-void IosClipboard::fireClipboardChangedEvent()
-{
- ClearableMutexGuard aGuard(m_aMutex);
-
- list<Reference< XClipboardListener > > listeners(mClipboardListeners);
- ClipboardEvent aEvent;
-
- if (listeners.begin() != listeners.end())
- {
- aEvent = ClipboardEvent(static_cast<OWeakObject*>(this), getContents());
- }
-
- aGuard.clear();
-
- while (listeners.begin() != listeners.end())
- {
- if (listeners.front().is())
- {
- try { listeners.front()->changedContents(aEvent); }
- catch (RuntimeException&) { }
- }
- listeners.pop_front();
- }
-}
-
-
-void IosClipboard::fireLostClipboardOwnershipEvent(Reference<XClipboardOwner> oldOwner, Reference<XTransferable> oldContent)
-{
- BOOST_ASSERT(oldOwner.is());
-
- try { oldOwner->lostOwnership(static_cast<XClipboardEx*>(this), oldContent); }
- catch(RuntimeException&) { }
-}
-
-
-void IosClipboard::provideDataForType(UIPasteboard* /*sender*/, NSString* /*type*/)
-{
-#if 0 // ???
- if( mXClipboardContent.is() )
- {
- DataProviderPtr_t dp = mpDataFlavorMapper->getDataProvider(type, mXClipboardContent);
- NSData* pBoardData = NULL;
-
- if (dp.get() != NULL)
- {
- pBoardData = (NSData*)dp->getSystemData();
- [sender setData: pBoardData forType: type];
- }
- }
-#endif
-}
-
-
-//------------------------------------------------
-// XFlushableClipboard
-//------------------------------------------------
-
-void SAL_CALL IosClipboard::flushClipboard()
- throw(RuntimeException)
-{
-#if 0 // ???
- if (mXClipboardContent.is())
- {
- Sequence<DataFlavor> flavorList = mXClipboardContent->getTransferDataFlavors();
- sal_uInt32 nFlavors = flavorList.getLength();
-
- for (sal_uInt32 i = 0; i < nFlavors; i++)
- {
- NSString* sysType = mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i]);
-
- if (sysType != NULL)
- {
- provideDataForType(mPasteboard, sysType);
- }
- }
- mXClipboardContent.clear();
- }
-#endif
-}
-
-
-UIPasteboard* IosClipboard::getPasteboard() const
-{
- return mPasteboard;
-}
-
-
-//-------------------------------------------------
-// XServiceInfo
-//-------------------------------------------------
-
-OUString SAL_CALL IosClipboard::getImplementationName() throw( RuntimeException )
-{
- return clipboard_getImplementationName();
-}
-
-
-sal_Bool SAL_CALL IosClipboard::supportsService( const OUString& /*ServiceName*/ ) throw( RuntimeException )
-{
- return sal_False;
-}
-
-
-Sequence< OUString > SAL_CALL IosClipboard::getSupportedServiceNames() throw( RuntimeException )
-{
- return clipboard_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/dtrans/ios_clipboard.hxx b/vcl/ios/source/dtrans/ios_clipboard.hxx
deleted file mode 100644
index 1c3dc40392af..000000000000
--- a/vcl/ios/source/dtrans/ios_clipboard.hxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _IOS_CLIPBOARD_HXX_
-#define _IOS_CLIPBOARD_HXX_
-
-#include <rtl/ustring.hxx>
-#include <sal/types.h>
-#include <cppuhelper/compbase3.hxx>
-#include <com/sun/star/datatransfer/XTransferable.hpp>
-#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
-#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
-#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
-#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
-#include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp>
-#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
-#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/basemutex.hxx>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-
-#include <boost/utility.hpp>
-#include <list>
-
-#include <premac.h>
-#import <UIKit/UIKit.h>
-#include <postmac.h>
-
-class IosClipboard;
-
-@interface EventListener : NSObject
-{
- IosClipboard* pIosClipboard;
-}
-
-// Init the pasteboard change listener with a reference to the OfficeClipboard
-// instance
-- (EventListener*)initWithIosClipboard: (IosClipboard*) pcb;
-
-// Promiss resolver function
-- (void)pasteboard:(UIPasteboard*)sender provideDataForType:(NSString *)type;
-
--(void)applicationDidBecomeActive:(NSNotification*)aNotification;
-
--(void)disposing;
-@end
-
-
-class IosClipboard : public ::cppu::BaseMutex,
- public ::cppu::WeakComponentImplHelper3< com::sun::star::datatransfer::clipboard::XSystemClipboard,
- com::sun::star::datatransfer::clipboard::XFlushableClipboard,
- com::sun::star::lang::XServiceInfo >,
- private ::boost::noncopyable
-{
-public:
- /* Create a clipboard instance.
-
- @param pasteboard
- If not equal NULL the instance will be instantiated with the provided
- pasteboard reference and 'bUseSystemClipboard' will be ignored
-
- @param bUseSystemClipboard
- If 'pasteboard' is NULL 'bUseSystemClipboard' determines whether the
- system clipboard will be created (bUseSystemClipboard == true) or if
- the DragPasteboard if bUseSystemClipboard == false
- */
- IosClipboard(UIPasteboard* pasteboard = NULL,
- bool bUseSystemClipboard = true);
-
- ~IosClipboard();
-
- //------------------------------------------------
- // XClipboard
- //------------------------------------------------
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setContents( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
- const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getName()
- throw( ::com::sun::star::uno::RuntimeException );
-
- //------------------------------------------------
- // XClipboardEx
- //------------------------------------------------
-
- virtual sal_Int8 SAL_CALL getRenderingCapabilities()
- throw( ::com::sun::star::uno::RuntimeException );
-
- //------------------------------------------------
- // XClipboardNotifier
- //------------------------------------------------
-
- virtual void SAL_CALL addClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- //------------------------------------------------
- // XFlushableClipboard
- //------------------------------------------------
-
- virtual void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException );
-
- //------------------------------------------------
- // XServiceInfo
- //------------------------------------------------
-
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-
- /* Get a reference to the used pasteboard.
- */
- UIPasteboard* getPasteboard() const;
-
- /* Notify the current clipboard owner that he is no longer the clipboard owner.
- */
- void fireLostClipboardOwnershipEvent(::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner> oldOwner,
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > oldContent);
-
- void pasteboardChangedOwner();
-
- void provideDataForType(UIPasteboard* sender, NSString* type);
-
- void applicationDidBecomeActive(NSNotification* aNotification);
-
-private:
-
- /* Notify all registered XClipboardListener that the clipboard content
- has changed.
- */
- void fireClipboardChangedEvent();
-
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XMimeContentTypeFactory > mrXMimeCntFactory;
- ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > mClipboardListeners;
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > mXClipboardContent;
- com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner > mXClipboardOwner;
- bool mIsSystemPasteboard;
- UIPasteboard* mPasteboard;
- int mPasteboardChangeCount;
- EventListener* mEventListener;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/dtrans/service_entry.cxx b/vcl/ios/source/dtrans/service_entry.cxx
deleted file mode 100644
index 98f743463eda..000000000000
--- a/vcl/ios/source/dtrans/service_entry.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "osl/diagnose.h"
-
-#include "vcl/svapp.hxx"
-
-#include "ios/saldata.hxx"
-#include "ios/salinst.h"
-
-#include "ios_clipboard.hxx"
-
-using namespace ::osl;
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::cppu;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::datatransfer::clipboard;
-
-
-uno::Reference< XInterface > IosSalInstance::CreateClipboard( const Sequence< Any >& i_rArguments )
-{
- if ( Application::IsHeadlessModeEnabled() )
- return SalInstance::CreateClipboard( i_rArguments );
-
- SalData* pSalData = GetSalData();
- if( ! pSalData->mxClipboard.is() )
- pSalData->mxClipboard = uno::Reference<XInterface>(static_cast< XClipboard* >(new IosClipboard()), UNO_QUERY);
- return pSalData->mxClipboard;
-}
-
-uno::Reference<XInterface> IosSalInstance::CreateDragSource()
-{
- // ???
- return SalInstance::CreateDragSource();
-}
-
-uno::Reference<XInterface> IosSalInstance::CreateDropTarget()
-{
- // ???
- return SalInstance::CreateDropTarget();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/gdi/salgdicommon.cxx b/vcl/ios/source/gdi/salgdicommon.cxx
deleted file mode 100644
index 947c7194c96e..000000000000
--- a/vcl/ios/source/gdi/salgdicommon.cxx
+++ /dev/null
@@ -1,1599 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/types.h>
-#include <osl/file.hxx>
-#include <osl/endian.h>
-
-#include "basegfx/polygon/b2dpolygon.hxx"
-
-#include "quartz/salbmp.h"
-#include "coretext/salgdi.h"
-
-#include "fontsubset.hxx"
-#include "region.h"
-#include "sft.hxx"
-
-using namespace vcl;
-
-//typedef unsigned char Boolean; // copied from MacTypes.h, should be properly included
-typedef std::vector<unsigned char> ByteVector;
-
-static const basegfx::B2DPoint aHalfPointOfs ( 0.5, 0.5 );
-
-static void AddPolygonToPath( CGMutablePathRef xPath,
- const ::basegfx::B2DPolygon& rPolygon,
- bool bClosePath, bool bPixelSnap, bool bLineDraw )
-{
- // short circuit if there is nothing to do
- const int nPointCount = rPolygon.count();
- if( nPointCount <= 0 )
- {
- return;
- }
- (void)bPixelSnap; // TODO
- const CGAffineTransform* pTransform = NULL;
-
- const bool bHasCurves = rPolygon.areControlPointsUsed();
- for( int nPointIdx = 0, nPrevIdx = 0;; nPrevIdx = nPointIdx++ )
- {
- int nClosedIdx = nPointIdx;
- if( nPointIdx >= nPointCount )
- {
- // prepare to close last curve segment if needed
- if( bClosePath && (nPointIdx == nPointCount) )
- {
- nClosedIdx = 0;
- }
- else
- {
- break;
- }
- }
-
- ::basegfx::B2DPoint aPoint = rPolygon.getB2DPoint( nClosedIdx );
-
- if( bPixelSnap)
- {
- // snap device coordinates to full pixels
- aPoint.setX( basegfx::fround( aPoint.getX() ) );
- aPoint.setY( basegfx::fround( aPoint.getY() ) );
- }
-
- if( bLineDraw )
- {
- aPoint += aHalfPointOfs;
- }
- if( !nPointIdx )
- {
- // first point => just move there
- CGPathMoveToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() );
- continue;
- }
-
- bool bPendingCurve = false;
- if( bHasCurves )
- {
- bPendingCurve = rPolygon.isNextControlPointUsed( nPrevIdx );
- bPendingCurve |= rPolygon.isPrevControlPointUsed( nClosedIdx );
- }
-
- if( !bPendingCurve ) // line segment
- {
- CGPathAddLineToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() );
- }
- else // cubic bezier segment
- {
- basegfx::B2DPoint aCP1 = rPolygon.getNextControlPoint( nPrevIdx );
- basegfx::B2DPoint aCP2 = rPolygon.getPrevControlPoint( nClosedIdx );
- if( bLineDraw )
- {
- aCP1 += aHalfPointOfs;
- aCP2 += aHalfPointOfs;
- }
- CGPathAddCurveToPoint( xPath, pTransform, aCP1.getX(), aCP1.getY(),
- aCP2.getX(), aCP2.getY(), aPoint.getX(), aPoint.getY() );
- }
- }
-
- if( bClosePath )
- {
- CGPathCloseSubpath( xPath );
- }
-}
-
-static void AddPolyPolygonToPath( CGMutablePathRef xPath,
- const ::basegfx::B2DPolyPolygon& rPolyPoly,
- bool bPixelSnap, bool bLineDraw )
-{
- // short circuit if there is nothing to do
- const int nPolyCount = rPolyPoly.count();
- if( nPolyCount <= 0 )
- {
- return;
- }
- for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
- {
- const ::basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx );
- AddPolygonToPath( xPath, rPolygon, true, bPixelSnap, bLineDraw );
- }
-}
-
-sal_Bool QuartzSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
- const PhysicalFontFace* pFontData,
- long* pGlyphIDs, sal_uInt8* pEncoding,
- sal_Int32* pGlyphWidths, int nGlyphCount,
- FontSubsetInfo& rInfo )
-{
- // TODO: move more of the functionality here into the generic subsetter code
-
- // prepare the requested file name for writing the font-subset file
- rtl::OUString aSysPath;
- if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) )
- return sal_False;
- const rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding();
- const rtl::OString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) );
-
- // get the raw-bytes from the font to be subset
- ByteVector aBuffer;
- bool bCffOnly = false;
- if( !GetRawFontData( pFontData, aBuffer, &bCffOnly ) )
- return sal_False;
-
- // handle CFF-subsetting
- if( bCffOnly )
- {
- // provide the raw-CFF data to the subsetter
- ByteCount nCffLen = aBuffer.size();
- rInfo.LoadFont( FontSubsetInfo::CFF_FONT, &aBuffer[0], nCffLen );
-
- // NOTE: assuming that all glyphids requested on Ios are fully translated
-
- // make the subsetter provide the requested subset
- FILE* pOutFile = fopen( aToFile.getStr(), "wb" );
- bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL,
- pGlyphIDs, pEncoding, nGlyphCount, pGlyphWidths );
- fclose( pOutFile );
- return bRC;
- }
-
- // TODO: modernize psprint's horrible fontsubset C-API
- // this probably only makes sense after the switch to another SCM
- // that can preserve change history after file renames
-
- // prepare data for psprint's font subsetter
- TrueTypeFont* pSftFont = NULL;
- int nRC = ::OpenTTFontBuffer( (void*)&aBuffer[0], aBuffer.size(), 0, &pSftFont);
- if( nRC != SF_OK )
- return sal_False;
-
- // get details about the subsetted font
- TTGlobalFontInfo aTTInfo;
- ::GetTTGlobalFontInfo( pSftFont, &aTTInfo );
- rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
- rInfo.m_aPSName = String( aTTInfo.psname, RTL_TEXTENCODING_UTF8 );
- rInfo.m_aFontBBox = Rectangle( Point( aTTInfo.xMin, aTTInfo.yMin ),
- Point( aTTInfo.xMax, aTTInfo.yMax ) );
- rInfo.m_nCapHeight = aTTInfo.yMax; // Well ...
- rInfo.m_nAscent = aTTInfo.winAscent;
- rInfo.m_nDescent = aTTInfo.winDescent;
- // mac fonts usually do not have an OS2-table
- // => get valid ascent/descent values from other tables
- if( !rInfo.m_nAscent )
- rInfo.m_nAscent = +aTTInfo.typoAscender;
- if( !rInfo.m_nAscent )
- rInfo.m_nAscent = +aTTInfo.ascender;
- if( !rInfo.m_nDescent )
- rInfo.m_nDescent = +aTTInfo.typoDescender;
- if( !rInfo.m_nDescent )
- rInfo.m_nDescent = -aTTInfo.descender;
-
- // subset glyphs and get their properties
- // take care that subset fonts require the NotDef glyph in pos 0
- int nOrigCount = nGlyphCount;
- sal_uInt16 aShortIDs[ 256 ];
- sal_uInt8 aTempEncs[ 256 ];
-
- int nNotDef = -1;
- for( int i = 0; i < nGlyphCount; ++i )
- {
- aTempEncs[i] = pEncoding[i];
- sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
- if( pGlyphIDs[i] & GF_ISCHAR )
- {
- bool bVertical = (pGlyphIDs[i] & GF_ROTMASK) != 0;
- nGlyphIdx = ::MapChar( pSftFont, static_cast<sal_uInt16>(nGlyphIdx), bVertical );
- if( nGlyphIdx == 0 && pFontData->IsSymbolFont() )
- {
- // #i12824# emulate symbol aliasing U+FXXX <-> U+0XXX
- nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
- nGlyphIdx = (nGlyphIdx & 0xF000) ? (nGlyphIdx & 0x00FF) : (nGlyphIdx | 0xF000 );
- nGlyphIdx = ::MapChar( pSftFont, static_cast<sal_uInt16>(nGlyphIdx), bVertical );
- }
- }
- aShortIDs[i] = static_cast<sal_uInt16>( nGlyphIdx );
- if( !nGlyphIdx )
- if( nNotDef < 0 )
- nNotDef = i; // first NotDef glyph found
- }
-
- if( nNotDef != 0 )
- {
- // add fake NotDef glyph if needed
- if( nNotDef < 0 )
- nNotDef = nGlyphCount++;
-
- // NotDef glyph must be in pos 0 => swap glyphids
- aShortIDs[ nNotDef ] = aShortIDs[0];
- aTempEncs[ nNotDef ] = aTempEncs[0];
- aShortIDs[0] = 0;
- aTempEncs[0] = 0;
- }
- DBG_ASSERT( nGlyphCount < 257, "too many glyphs for subsetting" );
-
- // TODO: where to get bVertical?
- const bool bVertical = false;
-
- // fill the pGlyphWidths array
- // while making sure that the NotDef glyph is at index==0
- TTSimpleGlyphMetrics* pGlyphMetrics =
- ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs, nGlyphCount, bVertical );
- if( !pGlyphMetrics )
- return sal_False;
- sal_uInt16 nNotDefAdv = pGlyphMetrics[0].adv;
- pGlyphMetrics[0].adv = pGlyphMetrics[nNotDef].adv;
- pGlyphMetrics[nNotDef].adv = nNotDefAdv;
- for( int i = 0; i < nOrigCount; ++i )
- pGlyphWidths[i] = pGlyphMetrics[i].adv;
- free( pGlyphMetrics );
-
- // write subset into destination file
- nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs,
- aTempEncs, nGlyphCount, 0, NULL, 0 );
- ::CloseTTFont(pSftFont);
- return (nRC == SF_OK);
-}
-
-static inline void alignLinePoint( const SalPoint* i_pIn, float& o_fX, float& o_fY )
-{
- o_fX = static_cast<float>(i_pIn->mnX ) + 0.5;
- o_fY = static_cast<float>(i_pIn->mnY ) + 0.5;
-}
-
-void QuartzSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGraphics )
-{
- if( !pSrcGraphics )
- {
- pSrcGraphics = this;
- }
- //from unix salgdi2.cxx
- //[FIXME] find a better way to prevent calc from crashing when width and height are negative
- if( pPosAry->mnSrcWidth <= 0
- || pPosAry->mnSrcHeight <= 0
- || pPosAry->mnDestWidth <= 0
- || pPosAry->mnDestHeight <= 0 )
- {
- return;
- }
-
- // accelerate trivial operations
- /*const*/ QuartzSalGraphics* pSrc = static_cast<QuartzSalGraphics*>(pSrcGraphics);
- const bool bSameGraphics = (this == pSrc) ||
- (mbWindow && mpFrame && pSrc->mbWindow && (mpFrame == pSrc->mpFrame));
- if( bSameGraphics &&
- (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) &&
- (pPosAry->mnSrcHeight == pPosAry->mnDestHeight))
- {
- // short circuit if there is nothing to do
- if( (pPosAry->mnSrcX == pPosAry->mnDestX) &&
- (pPosAry->mnSrcY == pPosAry->mnDestY))
- return;
- // use copyArea() if source and destination context are identical
- copyArea( pPosAry->mnDestX, pPosAry->mnDestY, pPosAry->mnSrcX, pPosAry->mnSrcY,
- pPosAry->mnSrcWidth, pPosAry->mnSrcHeight, 0 );
- return;
- }
-
- ApplyXorContext();
- pSrc->ApplyXorContext();
-
- DBG_ASSERT( pSrc->mxLayer!=NULL, "QuartzSalGraphics::copyBits() from non-layered graphics" );
-
- const CGPoint aDstPoint = { static_cast<CGFloat>(+pPosAry->mnDestX - pPosAry->mnSrcX), static_cast<CGFloat>(pPosAry->mnDestY - pPosAry->mnSrcY) };
- if( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth &&
- pPosAry->mnSrcHeight == pPosAry->mnDestHeight) &&
- (!mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth) ) // workaround a Quartz crasher
- {
- // in XOR mode the drawing context is redirected to the XOR mask
- // if source and target are identical then copyBits() paints onto the target context though
- CGContextRef xCopyContext = mrContext;
- if( mpXorEmulation && mpXorEmulation->IsEnabled() )
- {
- if( pSrcGraphics == this )
- {
- xCopyContext = mpXorEmulation->GetTargetContext();
- }
- }
- CGContextSaveGState( xCopyContext );
- const CGRect aDstRect = { { static_cast<CGFloat>(pPosAry->mnDestX), static_cast<CGFloat>(pPosAry->mnDestY) }, { static_cast<CGFloat>(pPosAry->mnDestWidth), static_cast<CGFloat>(pPosAry->mnDestHeight) } };
- CGContextClipToRect( xCopyContext, aDstRect );
-
- // draw at new destination
- // NOTE: flipped drawing gets disabled for this, else the subimage would be drawn upside down
- if( pSrc->IsFlipped() )
- {
- CGContextTranslateCTM( xCopyContext, 0, +mnHeight ); CGContextScaleCTM( xCopyContext, +1, -1 );
- }
- // TODO: pSrc->size() != this->size()
- ::CGContextDrawLayerAtPoint( xCopyContext, aDstPoint, pSrc->mxLayer );
- CGContextRestoreGState( xCopyContext );
- // mark the destination rectangle as updated
- RefreshRect( aDstRect );
- }
- else
- {
- SalBitmap* pBitmap = pSrc->getBitmap( pPosAry->mnSrcX, pPosAry->mnSrcY,
- pPosAry->mnSrcWidth, pPosAry->mnSrcHeight );
-
- if( pBitmap )
- {
- SalTwoRect aPosAry( *pPosAry );
- aPosAry.mnSrcX = 0;
- aPosAry.mnSrcY = 0;
- drawBitmap( &aPosAry, *pBitmap );
- delete pBitmap;
- }
- }
-}
-
-static void DrawPattern50( void*, CGContextRef rContext )
-{
- static const CGRect aRects[2] = { { {0,0}, { 2, 2 } }, { { 2, 2 }, { 2, 2 } } };
- CGContextAddRects( rContext, aRects, 2 );
- CGContextFillPath( rContext );
-}
-
-static void getBoundRect( sal_uLong nPoints, const SalPoint *pPtAry, long &rX, long& rY, long& rWidth, long& rHeight )
-{
- long nX1 = pPtAry->mnX;
- long nX2 = nX1;
- long nY1 = pPtAry->mnY;
- long nY2 = nY1;
- for( sal_uLong n = 1; n < nPoints; n++ )
- {
- if( pPtAry[n].mnX < nX1 )
- {
- nX1 = pPtAry[n].mnX;
- }
- else if( pPtAry[n].mnX > nX2 )
- {
- nX2 = pPtAry[n].mnX;
- }
- if( pPtAry[n].mnY < nY1 )
- {
- nY1 = pPtAry[n].mnY;
- }
- else if( pPtAry[n].mnY > nY2 )
- {
- nY2 = pPtAry[n].mnY;
- }
- }
- rX = nX1;
- rY = nY1;
- rWidth = nX2 - nX1 + 1;
- rHeight = nY2 - nY1 + 1;
-}
-
-static SalColor ImplGetROPSalColor( SalROPColor nROPColor )
-{
- SalColor nSalColor;
- if ( nROPColor == SAL_ROP_0 )
- {
- nSalColor = MAKE_SALCOLOR( 0, 0, 0 );
- }
- else
- {
- nSalColor = MAKE_SALCOLOR( 255, 255, 255 );
- }
- return nSalColor;
-}
-
-// apply the XOR mask to the target context if active and dirty
-void QuartzSalGraphics::ApplyXorContext()
-{
- if( !mpXorEmulation )
- {
- return;
- }
- if( mpXorEmulation->UpdateTarget() )
- {
- RefreshRect( 0, 0, mnWidth, mnHeight ); // TODO: refresh minimal changerect
- }
-}
-
-void QuartzSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY,
- long nSrcWidth, long nSrcHeight, sal_uInt16 /*nFlags*/ )
-{
- ApplyXorContext();
-
- DBG_ASSERT( mxLayer!=NULL, "QuartzSalGraphics::copyArea() for non-layered graphics" );
-
- // in XOR mode the drawing context is redirected to the XOR mask
- // copyArea() always works on the target context though
- CGContextRef xCopyContext = mrContext;
- if( mpXorEmulation && mpXorEmulation->IsEnabled() )
- {
- xCopyContext = mpXorEmulation->GetTargetContext();
- }
- // drawing a layer onto its own context causes trouble on OSX => copy it first
- // TODO: is it possible to get rid of this unneeded copy more often?
- // e.g. on OSX>=10.5 only this situation causes problems:
- // mnBitmapDepth && (aDstPoint.x + pSrc->mnWidth) > mnWidth
- CGLayerRef xSrcLayer = mxLayer;
- // TODO: if( mnBitmapDepth > 0 )
- {
- const CGSize aSrcSize = { static_cast<CGFloat>(nSrcWidth), static_cast<CGFloat>(nSrcHeight) };
- xSrcLayer = ::CGLayerCreateWithContext( xCopyContext, aSrcSize, NULL );
- const CGContextRef xSrcContext = CGLayerGetContext( xSrcLayer );
- CGPoint aSrcPoint = { static_cast<CGFloat>(-nSrcX), static_cast<CGFloat>(-nSrcY) };
- if( IsFlipped() )
- {
- ::CGContextTranslateCTM( xSrcContext, 0, +nSrcHeight );
- ::CGContextScaleCTM( xSrcContext, +1, -1 );
- aSrcPoint.y = (nSrcY + nSrcHeight) - mnHeight;
- }
- ::CGContextDrawLayerAtPoint( xSrcContext, aSrcPoint, mxLayer );
- }
-
- // draw at new destination
- const CGPoint aDstPoint = { static_cast<CGFloat>(+nDstX), static_cast<CGFloat>(+nDstY) };
- ::CGContextDrawLayerAtPoint( xCopyContext, aDstPoint, xSrcLayer );
-
- // cleanup
- if( xSrcLayer != mxLayer )
- {
- CGLayerRelease( xSrcLayer );
- }
- // mark the destination rectangle as updated
- RefreshRect( nDstX, nDstY, nSrcWidth, nSrcHeight );
-
-}
-
-void QuartzSalGraphics::copyResolution( QuartzSalGraphics& rGraphics )
-{
- if( !rGraphics.mnRealDPIY && rGraphics.mbWindow && rGraphics.mpFrame )
- {
- rGraphics.initResolution( rGraphics.mpFrame->mpWindow );
- }
- mnRealDPIX = rGraphics.mnRealDPIX;
- mnRealDPIY = rGraphics.mnRealDPIY;
- mfFakeDPIScale = rGraphics.mfFakeDPIScale;
-}
-
-bool QuartzSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
- const SalBitmap& rSrcBitmap,
- const SalBitmap& rAlphaBmp )
-{
- // An image mask can't have a depth > 8 bits (should be 1 to 8 bits)
- if( rAlphaBmp.GetBitCount() > 8 )
- {
- return false;
- }
- // are these two tests really necessary? (see vcl/unx/source/gdi/salgdi2.cxx)
- // horizontal/vertical mirroring not implemented yet
- if( rTR.mnDestWidth < 0 || rTR.mnDestHeight < 0 )
- {
- return false;
- }
-
- const QuartzSalBitmap& rSrcSalBmp = static_cast<const QuartzSalBitmap&>(rSrcBitmap);
- const QuartzSalBitmap& rMaskSalBmp = static_cast<const QuartzSalBitmap&>(rAlphaBmp);
- CGImageRef xMaskedImage = rSrcSalBmp.CreateWithMask( rMaskSalBmp, rTR.mnSrcX,
- rTR.mnSrcY, rTR.mnSrcWidth,
- rTR.mnSrcHeight );
- if( !xMaskedImage )
- {
- return false;
- }
- if ( CheckContext() )
- {
- const CGRect aDstRect = { { static_cast<CGFloat>(rTR.mnDestX), static_cast<CGFloat>(rTR.mnDestY) }, { static_cast<CGFloat>(rTR.mnDestWidth), static_cast<CGFloat>(rTR.mnDestHeight) } };
- CGContextDrawImage( mrContext, aDstRect, xMaskedImage );
- RefreshRect( aDstRect );
- }
-
- CGImageRelease(xMaskedImage);
- return true;
-}
-
-bool QuartzSalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
- long nHeight, sal_uInt8 nTransparency )
-{
- if( !CheckContext() )
- {
- return true;
- }
- // save the current state
- CGContextSaveGState( mrContext );
- CGContextSetAlpha( mrContext, (100-nTransparency) * (1.0/100) );
-
- CGRect aRect = { { static_cast<CGFloat>(nX), static_cast<CGFloat>(nY) }, { static_cast<CGFloat>(nWidth-1), static_cast<CGFloat>(nHeight-1) } };
- if( IsPenVisible() )
- {
- aRect.origin.x += 0.5;
- aRect.origin.y += 0.5;
- }
-
- CGContextBeginPath( mrContext );
- CGContextAddRect( mrContext, aRect );
- CGContextDrawPath( mrContext, kCGPathFill );
-
- // restore state
- CGContextRestoreGState(mrContext);
- RefreshRect( aRect );
- return true;
-}
-
-void QuartzSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap )
-{
- if( !CheckContext() )
- {
- return;
- }
- const QuartzSalBitmap& rBitmap = static_cast<const QuartzSalBitmap&>(rSalBitmap);
- CGImageRef xImage = rBitmap.CreateCroppedImage( (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
- (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight );
- if( !xImage )
- {
- return;
- }
- const CGRect aDstRect = { { static_cast<CGFloat>(pPosAry->mnDestX), static_cast<CGFloat>(pPosAry->mnDestY) },
- { static_cast<CGFloat>(pPosAry->mnDestWidth), static_cast<CGFloat>(pPosAry->mnDestHeight) } };
- CGContextDrawImage( mrContext, aDstRect, xImage );
- CGImageRelease( xImage );
- RefreshRect( aDstRect );
-}
-
-void QuartzSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,SalColor )
-{
- OSL_FAIL("not implemented for color masking!");
- drawBitmap( pPosAry, rSalBitmap );
-}
-
-void QuartzSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,
- const SalBitmap& rTransparentBitmap )
-{
- if( !CheckContext() )
- {
- return;
- }
- const QuartzSalBitmap& rBitmap = static_cast<const QuartzSalBitmap&>(rSalBitmap);
- const QuartzSalBitmap& rMask = static_cast<const QuartzSalBitmap&>(rTransparentBitmap);
- CGImageRef xMaskedImage( rBitmap.CreateWithMask( rMask, pPosAry->mnSrcX, pPosAry->mnSrcY,
- pPosAry->mnSrcWidth, pPosAry->mnSrcHeight ) );
- if( !xMaskedImage )
- {
- return;
- }
- const CGRect aDstRect = { { static_cast<CGFloat>(pPosAry->mnDestX), static_cast<CGFloat>(pPosAry->mnDestY) },
- { static_cast<CGFloat>(pPosAry->mnDestWidth), static_cast<CGFloat>(pPosAry->mnDestHeight) } };
- CGContextDrawImage( mrContext, aDstRect, xMaskedImage );
- CGImageRelease( xMaskedImage );
- RefreshRect( aDstRect );
-}
-
-sal_Bool QuartzSalGraphics::drawEPS( long /*nX*/, long /*nY*/, long /*nWidth*/, long /*nHeight*/,
- void* /*pEpsData*/, sal_uLong /*nByteCount*/ )
-{
- return sal_False;
-}
-
-void QuartzSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
-{
- if( nX1 == nX2 && nY1 == nY2 )
- {
- // #i109453# platform independent code expects at least one pixel to be drawn
- drawPixel( nX1, nY1 );
- return;
- }
-
- if( !CheckContext() )
- {
- return;
- }
- CGContextBeginPath( mrContext );
- CGContextMoveToPoint( mrContext, static_cast<float>(nX1)+0.5, static_cast<float>(nY1)+0.5 );
- CGContextAddLineToPoint( mrContext, static_cast<float>(nX2)+0.5, static_cast<float>(nY2)+0.5 );
- CGContextDrawPath( mrContext, kCGPathStroke );
-
- Rectangle aRefreshRect( nX1, nY1, nX2, nY2 );
-}
-
-void QuartzSalGraphics::drawMask( const SalTwoRect* pPosAry,
- const SalBitmap& rSalBitmap,
- SalColor nMaskColor )
-{
- if( !CheckContext() )
- {
- return;
- }
- const QuartzSalBitmap& rBitmap = static_cast<const QuartzSalBitmap&>(rSalBitmap);
- CGImageRef xImage = rBitmap.CreateColorMask( pPosAry->mnSrcX, pPosAry->mnSrcY,
- pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
- nMaskColor );
- if( !xImage )
- {
- return;
- }
- const CGRect aDstRect = { { static_cast<CGFloat>(pPosAry->mnDestX), static_cast<CGFloat>(pPosAry->mnDestY) },
- { static_cast<CGFloat>(pPosAry->mnDestWidth), static_cast<CGFloat>(pPosAry->mnDestHeight) } };
- CGContextDrawImage( mrContext, aDstRect, xImage );
- CGImageRelease( xImage );
- RefreshRect( aDstRect );
-}
-
-void QuartzSalGraphics::drawPixel( long nX, long nY )
-{
- // draw pixel with current line color
- ImplDrawPixel( nX, nY, maLineColor );
-}
-
-void QuartzSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
-{
- const RGBAColor aPixelColor( nSalColor );
- ImplDrawPixel( nX, nY, aPixelColor );
-}
-
-bool QuartzSalGraphics::drawPolyLine(
- const ::basegfx::B2DPolygon& rPolyLine,
- double fTransparency,
- const ::basegfx::B2DVector& rLineWidths,
- basegfx::B2DLineJoin eLineJoin,
- com::sun::star::drawing::LineCap eLineCap)
-{
- // short circuit if there is nothing to do
- const int nPointCount = rPolyLine.count();
- if( nPointCount <= 0 )
- {
- return true;
- }
- // reject requests that cannot be handled yet
- if( rLineWidths.getX() != rLineWidths.getY() )
- {
- return false;
- }
- // #i101491# Ios does not support B2DLINEJOIN_NONE; return false to use
- // the fallback (own geometry preparation)
- // #i104886# linejoin-mode and thus the above only applies to "fat" lines
- if( (basegfx::B2DLINEJOIN_NONE == eLineJoin) &&
- (rLineWidths.getX() > 1.3) )
- {
- return false;
- }
-
- // setup line attributes
- CGLineJoin aCGLineJoin = kCGLineJoinMiter;
- switch( eLineJoin )
- {
- case ::basegfx::B2DLINEJOIN_NONE: aCGLineJoin = /*TODO?*/kCGLineJoinMiter; break;
- case ::basegfx::B2DLINEJOIN_MIDDLE: aCGLineJoin = /*TODO?*/kCGLineJoinMiter; break;
- case ::basegfx::B2DLINEJOIN_BEVEL: aCGLineJoin = kCGLineJoinBevel; break;
- case ::basegfx::B2DLINEJOIN_MITER: aCGLineJoin = kCGLineJoinMiter; break;
- case ::basegfx::B2DLINEJOIN_ROUND: aCGLineJoin = kCGLineJoinRound; break;
- }
-
- // setup cap attribute
- CGLineCap aCGLineCap(kCGLineCapButt);
-
- switch(eLineCap)
- {
- default: // com::sun::star::drawing::LineCap_BUTT:
- {
- aCGLineCap = kCGLineCapButt;
- break;
- }
- case com::sun::star::drawing::LineCap_ROUND:
- {
- aCGLineCap = kCGLineCapRound;
- break;
- }
- case com::sun::star::drawing::LineCap_SQUARE:
- {
- aCGLineCap = kCGLineCapSquare;
- break;
- }
- }
-
- // setup poly-polygon path
- CGMutablePathRef xPath = CGPathCreateMutable();
- AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true );
-
- const CGRect aRefreshRect = CGPathGetBoundingBox( xPath );
-#ifndef NO_I97317_WORKAROUND
- // #i97317# workaround for Quartz having problems with drawing small polygons
- if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) )
-#endif
- {
- // use the path to prepare the graphics context
- CGContextSaveGState( mrContext );
- CGContextAddPath( mrContext, xPath );
- // draw path with antialiased line
- CGContextSetShouldAntialias( mrContext, true );
- CGContextSetAlpha( mrContext, 1.0 - fTransparency );
- CGContextSetLineJoin( mrContext, aCGLineJoin );
- CGContextSetLineCap( mrContext, aCGLineCap );
- CGContextSetLineWidth( mrContext, rLineWidths.getX() );
- CGContextDrawPath( mrContext, kCGPathStroke );
- CGContextRestoreGState( mrContext );
-
- // mark modified rectangle as updated
- RefreshRect( aRefreshRect );
- }
-
- CGPathRelease( xPath );
-
- return true;
-}
-
-sal_Bool QuartzSalGraphics::drawPolyLineBezier( sal_uLong, const SalPoint*, const sal_uInt8* )
-{
- return sal_False;
-}
-
-bool QuartzSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly,
- double fTransparency )
-{
- // short circuit if there is nothing to do
- const int nPolyCount = rPolyPoly.count();
- if( nPolyCount <= 0 )
- {
- return true;
- }
- // ignore invisible polygons
- if( (fTransparency >= 1.0) || (fTransparency < 0) )
- {
- return true;
- }
- // setup poly-polygon path
- CGMutablePathRef xPath = CGPathCreateMutable();
- for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
- {
- const ::basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx );
- AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() );
- }
-
- const CGRect aRefreshRect = CGPathGetBoundingBox( xPath );
-#ifndef NO_I97317_WORKAROUND
- // #i97317# workaround for Quartz having problems with drawing small polygons
- if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) )
-#endif
- {
- // use the path to prepare the graphics context
- CGContextSaveGState( mrContext );
- CGContextBeginPath( mrContext );
- CGContextAddPath( mrContext, xPath );
-
- // draw path with antialiased polygon
- CGContextSetShouldAntialias( mrContext, true );
- CGContextSetAlpha( mrContext, 1.0 - fTransparency );
- CGContextDrawPath( mrContext, kCGPathEOFillStroke );
- CGContextRestoreGState( mrContext );
-
- // mark modified rectangle as updated
- RefreshRect( aRefreshRect );
- }
-
- CGPathRelease( xPath );
-
- return true;
-}
-
-void QuartzSalGraphics::drawPolyPolygon( sal_uLong nPolyCount, const sal_uLong *pPoints, PCONSTSALPOINT *ppPtAry )
-{
- if( nPolyCount <= 0 )
- return;
- if( !CheckContext() )
- return;
-
- // find bound rect
- long leftX = 0, topY = 0, maxWidth = 0, maxHeight = 0;
- getBoundRect( pPoints[0], ppPtAry[0], leftX, topY, maxWidth, maxHeight );
- for( sal_uLong n = 1; n < nPolyCount; n++ )
- {
- long nX = leftX, nY = topY, nW = maxWidth, nH = maxHeight;
- getBoundRect( pPoints[n], ppPtAry[n], nX, nY, nW, nH );
- if( nX < leftX )
- {
- maxWidth += leftX - nX;
- leftX = nX;
- }
- if( nY < topY )
- {
- maxHeight += topY - nY;
- topY = nY;
- }
- if( nX + nW > leftX + maxWidth )
- {
- maxWidth = nX + nW - leftX;
- }
- if( nY + nH > topY + maxHeight )
- {
- maxHeight = nY + nH - topY;
- }
- }
-
- // prepare drawing mode
- CGPathDrawingMode eMode;
- if( IsBrushVisible() && IsPenVisible() )
- {
- eMode = kCGPathEOFillStroke;
- }
- else if( IsPenVisible() )
- {
- eMode = kCGPathStroke;
- }
- else if( IsBrushVisible() )
- {
- eMode = kCGPathEOFill;
- }
- else
- {
- return;
- }
- // convert to CGPath
- CGContextBeginPath( mrContext );
- if( IsPenVisible() )
- {
- for( sal_uLong nPoly = 0; nPoly < nPolyCount; nPoly++ )
- {
- const sal_uLong nPoints = pPoints[nPoly];
- if( nPoints > 1 )
- {
- const SalPoint *pPtAry = ppPtAry[nPoly];
- float fX, fY;
- alignLinePoint( pPtAry, fX, fY );
- CGContextMoveToPoint( mrContext, fX, fY );
- pPtAry++;
- for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
- {
- alignLinePoint( pPtAry, fX, fY );
- CGContextAddLineToPoint( mrContext, fX, fY );
- }
- CGContextClosePath(mrContext);
- }
- }
- }
- else
- {
- for( sal_uLong nPoly = 0; nPoly < nPolyCount; nPoly++ )
- {
- const sal_uLong nPoints = pPoints[nPoly];
- if( nPoints > 1 )
- {
- const SalPoint *pPtAry = ppPtAry[nPoly];
- CGContextMoveToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
- pPtAry++;
- for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
- {
- CGContextAddLineToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
- }
- CGContextClosePath(mrContext);
- }
- }
- }
-
- CGContextDrawPath( mrContext, eMode );
-
- RefreshRect( leftX, topY, maxWidth, maxHeight );
-}
-
-void QuartzSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint *pPtAry )
-{
- if( nPoints <= 1 )
- return;
- if( !CheckContext() )
- return;
-
- long nX = 0, nY = 0, nWidth = 0, nHeight = 0;
- getBoundRect( nPoints, pPtAry, nX, nY, nWidth, nHeight );
-
- CGPathDrawingMode eMode;
- if( IsBrushVisible() && IsPenVisible() )
- {
- eMode = kCGPathEOFillStroke;
- }
- else if( IsPenVisible() )
- {
- eMode = kCGPathStroke;
- }
- else if( IsBrushVisible() )
- {
- eMode = kCGPathEOFill;
- }
- else
- {
- return;
- }
- CGContextBeginPath( mrContext );
-
- if( IsPenVisible() )
- {
- float fX, fY;
- alignLinePoint( pPtAry, fX, fY );
- CGContextMoveToPoint( mrContext, fX, fY );
- pPtAry++;
- for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
- {
- alignLinePoint( pPtAry, fX, fY );
- CGContextAddLineToPoint( mrContext, fX, fY );
- }
- }
- else
- {
- CGContextMoveToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
- pPtAry++;
- for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
- {
- CGContextAddLineToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
- }
- }
-
- CGContextDrawPath( mrContext, eMode );
- RefreshRect( nX, nY, nWidth, nHeight );
-}
-
-sal_Bool QuartzSalGraphics::drawPolygonBezier( sal_uLong, const SalPoint*, const sal_uInt8* )
-{
- return sal_False;
-}
-
-sal_Bool QuartzSalGraphics::drawPolyPolygonBezier( sal_uLong, const sal_uLong*,
- const SalPoint* const*, const sal_uInt8* const* )
-{
- return sal_False;
-}
-
-void QuartzSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
-{
- if( !CheckContext() )
- {
- return;
- }
- CGRect aRect( CGRectMake(nX, nY, nWidth, nHeight) );
- if( IsPenVisible() )
- {
- aRect.origin.x += 0.5;
- aRect.origin.y += 0.5;
- aRect.size.width -= 1;
- aRect.size.height -= 1;
- }
-
- if( IsBrushVisible() )
- {
- CGContextFillRect( mrContext, aRect );
- }
- if( IsPenVisible() )
- {
- CGContextStrokeRect( mrContext, aRect );
- }
- RefreshRect( nX, nY, nWidth, nHeight );
-}
-
-
-void QuartzSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry )
-{
- if( nPoints < 1 )
- {
- return;
- }
- if( !CheckContext() )
- {
- return;
- }
-
- long nX = 0, nY = 0, nWidth = 0, nHeight = 0;
- getBoundRect( nPoints, pPtAry, nX, nY, nWidth, nHeight );
-
- float fX, fY;
- CGContextBeginPath( mrContext );
- alignLinePoint( pPtAry, fX, fY );
- CGContextMoveToPoint( mrContext, fX, fY );
- pPtAry++;
- for( sal_uLong nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
- {
- alignLinePoint( pPtAry, fX, fY );
- CGContextAddLineToPoint( mrContext, fX, fY );
- }
- CGContextDrawPath( mrContext, kCGPathStroke );
-
- RefreshRect( nX, nY, nWidth, nHeight );
-}
-
-sal_uInt16 QuartzSalGraphics::GetBitCount() const
-{
- sal_uInt16 nBits = mnBitmapDepth ? mnBitmapDepth : 32;//24;
- return nBits;
-}
-
-SalBitmap* QuartzSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY )
-{
- DBG_ASSERT( mxLayer, "QuartzSalGraphics::getBitmap() with no layer" );
-
- ApplyXorContext();
-
- QuartzSalBitmap* pBitmap = new QuartzSalBitmap;
- if( !pBitmap->Create( mxLayer, mnBitmapDepth, nX, nY, nDX, nDY, !mbWindow ) )
- {
- delete pBitmap;
- pBitmap = NULL;
- }
-
- return pBitmap;
-}
-
-SystemGraphicsData QuartzSalGraphics::GetGraphicsData() const
-{
- SystemGraphicsData aRes;
- aRes.nSize = sizeof(aRes);
- aRes.rCGContext = mrContext;
- return aRes;
-}
-
-long QuartzSalGraphics::GetGraphicsWidth() const
-{
- long w = 0;
- if( mrContext && (mbWindow || mbVirDev) )
- {
- w = mnWidth;
- }
-
- if( w == 0 )
- {
- if( mbWindow && mpFrame )
- {
- w = mpFrame->maGeometry.nWidth;
- }
- }
- return w;
-}
-
-SalColor QuartzSalGraphics::getPixel( long nX, long nY )
-{
- // return default value on printers or when out of bounds
- if( !mxLayer || (nX < 0) || (nX >= mnWidth) ||
- (nY < 0) || (nY >= mnHeight))
- {
- return COL_BLACK;
- }
- // prepare creation of matching a CGBitmapContext
- CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
- CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big;
-#if defined OSL_BIGENDIAN
- struct{ unsigned char b, g, r, a; } aPixel;
-#else
- struct{ unsigned char a, r, g, b; } aPixel;
-#endif
-
- // create a one-pixel bitmap context
- // TODO: is it worth to cache it?
- CGContextRef xOnePixelContext =
- ::CGBitmapContextCreate( &aPixel, 1, 1, 8, sizeof(aPixel),
- aCGColorSpace, aCGBmpInfo );
-
- // update this graphics layer
- ApplyXorContext();
-
- // copy the requested pixel into the bitmap context
- if( IsFlipped() )
- {
- nY = mnHeight - nY;
- }
- const CGPoint aCGPoint = { static_cast<CGFloat>(-nX), static_cast<CGFloat>(-nY)};
- CGContextDrawLayerAtPoint( xOnePixelContext, aCGPoint, mxLayer );
- CGContextRelease( xOnePixelContext );
-
- SalColor nSalColor = MAKE_SALCOLOR( aPixel.r, aPixel.g, aPixel.b );
- return nSalColor;
-}
-
-void QuartzSalGraphics::GetResolution( long& rDPIX, long& rDPIY )
-{
- if( !mnRealDPIY )
- {
- initResolution( (mbWindow && mpFrame) ? mpFrame->mpWindow : nil );
- }
-
- rDPIX = static_cast<long>(mfFakeDPIScale * mnRealDPIX);
- rDPIY = static_cast<long>(mfFakeDPIScale * mnRealDPIY);
-}
-
-void QuartzSalGraphics::ImplDrawPixel( long nX, long nY, const RGBAColor& rColor )
-{
- if( !CheckContext() )
- {
- return;
- }
- // overwrite the fill color
- CGContextSetFillColor( mrContext, rColor.AsArray() );
- // draw 1x1 rect, there is no pixel drawing in Quartz
- CGRect aDstRect = { { static_cast<CGFloat>(nX), static_cast<CGFloat>(nY) }, { 1, 1 } };
- CGContextFillRect( mrContext, aDstRect );
- RefreshRect( aDstRect );
- // reset the fill color
- CGContextSetFillColor( mrContext, maFillColor.AsArray() );
-}
-
-void QuartzSalGraphics::initResolution( UIWindow* )
-{
- // #i100617# read DPI only once; there is some kind of weird caching going on
- // if the main screen changes
- // FIXME: this is really unfortunate and needs to be investigated
-
- SalData* pSalData = GetSalData();
- if( pSalData->mnDPIX == 0 || pSalData->mnDPIY == 0 )
- {
- UIScreen* pScreen = [UIScreen mainScreen];
-
- mnRealDPIX = mnRealDPIY = 160;
- if( pScreen )
- {
- mnRealDPIX *= [pScreen scale];
- mnRealDPIY *= [pScreen scale];
- }
- else
- {
- OSL_FAIL( "no screen found" );
- }
-
- pSalData->mnDPIX = mnRealDPIX;
- pSalData->mnDPIY = mnRealDPIY;
- }
- else
- {
- mnRealDPIX = pSalData->mnDPIX;
- mnRealDPIY = pSalData->mnDPIY;
- }
-
- mfFakeDPIScale = 1.0;
-}
-
-void QuartzSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags )
-{
- if ( CheckContext() )
- {
- CGRect aCGRect = CGRectMake( nX, nY, nWidth, nHeight);
- CGContextSaveGState(mrContext);
-
- if ( nFlags & SAL_INVERT_TRACKFRAME )
- {
- const float dashLengths[2] = { 4.0, 4.0 }; // for drawing dashed line
- CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- CGContextSetRGBStrokeColor ( mrContext, 1.0, 1.0, 1.0, 1.0 );
- CGContextSetLineDash ( mrContext, 0, dashLengths, 2 );
- CGContextSetLineWidth( mrContext, 2.0);
- CGContextStrokeRect ( mrContext, aCGRect );
- }
- else if ( nFlags & SAL_INVERT_50 )
- {
- //CGContextSetAllowsAntialiasing( mrContext, false );
- CGContextSetBlendMode(mrContext, kCGBlendModeDifference);
- CGContextAddRect( mrContext, aCGRect );
- Pattern50Fill();
- }
- else // just invert
- {
- CGContextSetBlendMode(mrContext, kCGBlendModeDifference);
- CGContextSetRGBFillColor ( mrContext,1.0, 1.0, 1.0 , 1.0 );
- CGContextFillRect ( mrContext, aCGRect );
- }
- CGContextRestoreGState( mrContext);
- RefreshRect( aCGRect );
- }
-}
-
-void QuartzSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nSalFlags )
-{
- CGPoint* CGpoints ;
- if ( CheckContext() )
- {
- CGContextSaveGState(mrContext);
- CGpoints = makeCGptArray(nPoints,pPtAry);
- CGContextAddLines ( mrContext, CGpoints, nPoints );
- if ( nSalFlags & SAL_INVERT_TRACKFRAME )
- {
- const float dashLengths[2] = { 4.0, 4.0 }; // for drawing dashed line
- CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- CGContextSetRGBStrokeColor ( mrContext, 1.0, 1.0, 1.0, 1.0 );
- CGContextSetLineDash ( mrContext, 0, dashLengths, 2 );
- CGContextSetLineWidth( mrContext, 2.0);
- CGContextStrokePath ( mrContext );
- }
- else if ( nSalFlags & SAL_INVERT_50 )
- {
- CGContextSetBlendMode(mrContext, kCGBlendModeDifference);
- Pattern50Fill();
- }
- else // just invert
- {
- CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- CGContextSetRGBFillColor( mrContext, 1.0, 1.0, 1.0, 1.0 );
- CGContextFillPath( mrContext );
- }
- const CGRect aRefreshRect = CGContextGetClipBoundingBox(mrContext);
- CGContextRestoreGState( mrContext);
- delete [] CGpoints;
- RefreshRect( aRefreshRect );
- }
-}
-
-void QuartzSalGraphics::Pattern50Fill()
-{
- static const float aFillCol[4] = { 1,1,1,1 };
- static const CGPatternCallbacks aCallback = { 0, &DrawPattern50, NULL };
- if( ! GetSalData()->mxP50Space )
- {
- GetSalData()->mxP50Space = CGColorSpaceCreatePattern( GetSalData()->mxRGBSpace );
- }
- if( ! GetSalData()->mxP50Pattern )
- {
- GetSalData()->mxP50Pattern = CGPatternCreate( NULL, CGRectMake( 0, 0, 4, 4 ),
- CGAffineTransformIdentity, 4, 4,
- kCGPatternTilingConstantSpacing,
- false, &aCallback );
- }
- CGContextSetFillColorSpace( mrContext, GetSalData()->mxP50Space );
- CGContextSetFillPattern( mrContext, GetSalData()->mxP50Pattern, aFillCol );
- CGContextFillPath( mrContext );
-}
-
-
-void QuartzSalGraphics::ResetClipRegion()
-{
- // release old path and indicate no clipping
- if( mxClipPath )
- {
- CGPathRelease( mxClipPath );
- mxClipPath = NULL;
- }
- if( CheckContext() )
- {
- SetState();
- }
-}
-
-void QuartzSalGraphics::SetLineColor()
-{
- maLineColor.SetAlpha( 0.0 ); // transparent
- if( CheckContext() )
- {
- CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
- }
-}
-
-void QuartzSalGraphics::SetLineColor( SalColor nSalColor )
-{
- maLineColor = RGBAColor( nSalColor );
- if( CheckContext() )
- {
- CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
- }
-}
-
-void QuartzSalGraphics::SetFillColor()
-{
- maFillColor.SetAlpha( 0.0 ); // transparent
- if( CheckContext() )
- {
- CGContextSetFillColor( mrContext, maFillColor.AsArray() );
- }
-}
-
-void QuartzSalGraphics::SetFillColor( SalColor nSalColor )
-{
- maFillColor = RGBAColor( nSalColor );
- if( CheckContext() )
- {
- CGContextSetFillColor( mrContext, maFillColor.AsArray() );
- }
-}
-
-bool QuartzSalGraphics::supportsOperation( OutDevSupportType eType ) const
-{
- bool bRet = false;
- switch( eType )
- {
- case OutDevSupport_TransparentRect:
- case OutDevSupport_B2DClip:
- case OutDevSupport_B2DDraw:
- bRet = true;
- break;
- default: break;
- }
- return bRet;
-}
-
-bool QuartzSalGraphics::setClipRegion( const Region& i_rClip )
-{
- // release old clip path
- if( mxClipPath )
- {
- CGPathRelease( mxClipPath );
- mxClipPath = NULL;
- }
- mxClipPath = CGPathCreateMutable();
-
- // set current path, either as polypolgon or sequence of rectangles
- if( i_rClip.HasPolyPolygon() )
- {
- basegfx::B2DPolyPolygon aClip( const_cast<Region&>(i_rClip).ConvertToB2DPolyPolygon() );
- AddPolyPolygonToPath( mxClipPath, aClip, !getAntiAliasB2DDraw(), false );
- }
- else
- {
- long nX, nY, nW, nH;
- ImplRegionInfo aInfo;
- bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
- while( bRegionRect )
- {
- if( nW && nH )
- {
- CGRect aRect = { { static_cast<CGFloat>(nX), static_cast<CGFloat>(nY) }, { static_cast<CGFloat>(nW), static_cast<CGFloat>(nH) } };
- CGPathAddRect( mxClipPath, NULL, aRect );
- }
- bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
- }
- }
- // set the current path as clip region
- if( CheckContext() )
- {
- SetState();
- }
- return true;
-}
-
-void QuartzSalGraphics::SetROPFillColor( SalROPColor nROPColor )
-{
- if( ! mbPrinter )
- SetFillColor( ImplGetROPSalColor( nROPColor ) );
-}
-
-void QuartzSalGraphics::SetROPLineColor( SalROPColor nROPColor )
-{
- if( ! mbPrinter )
- SetLineColor( ImplGetROPSalColor( nROPColor ) );
-}
-
-void QuartzSalGraphics::SetXORMode( bool bSet, bool bInvertOnly )
-{
- // return early if XOR mode remains unchanged
- if( mbPrinter )
- {
- return;
- }
- if( ! bSet && mnXorMode == 2 )
- {
- CGContextSetBlendMode( mrContext, kCGBlendModeNormal );
- mnXorMode = 0;
- return;
- }
- else if( bSet && bInvertOnly && mnXorMode == 0)
- {
- CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- mnXorMode = 2;
- return;
- }
-
- if( (mpXorEmulation == NULL) && !bSet )
- {
- return;
- }
- if( (mpXorEmulation != NULL) && (bSet == mpXorEmulation->IsEnabled()) )
- {
- return;
- }
- if( !CheckContext() )
- {
- return;
- }
- // prepare XOR emulation
- if( !mpXorEmulation )
- {
- mpXorEmulation = new XorEmulation();
- mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer );
- }
-
- // change the XOR mode
- if( bSet )
- {
- mpXorEmulation->Enable();
- mrContext = mpXorEmulation->GetMaskContext();
- mnXorMode = 1;
- }
- else
- {
- mpXorEmulation->UpdateTarget();
- mpXorEmulation->Disable();
- mrContext = mpXorEmulation->GetTargetContext();
- mnXorMode = 0;
- }
-}
-
-void QuartzSalGraphics::updateResolution()
-{
- DBG_ASSERT( mbWindow, "updateResolution on inappropriate graphics" );
-
- initResolution( (mbWindow && mpFrame) ? mpFrame->mpWindow : nil );
-}
-
-
-// -----------------------------------------------------------
-
-XorEmulation::XorEmulation()
-: m_xTargetLayer( NULL )
-, m_xTargetContext( NULL )
-, m_xMaskContext( NULL )
-, m_xTempContext( NULL )
-, m_pMaskBuffer( NULL )
-, m_pTempBuffer( NULL )
-, m_nBufferLongs( 0 )
-, m_bIsEnabled( false )
-{}
-
-XorEmulation::~XorEmulation()
-{
- Disable();
- SetTarget( 0, 0, 0, NULL, NULL );
-}
-
-void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth,
- CGContextRef xTargetContext, CGLayerRef xTargetLayer )
-{
- // prepare to replace old mask+temp context
- if( m_xMaskContext )
- {
- // cleanup the mask context
- CGContextRelease( m_xMaskContext );
- delete[] m_pMaskBuffer;
- m_xMaskContext = NULL;
- m_pMaskBuffer = NULL;
-
- // cleanup the temp context if needed
- if( m_xTempContext )
- {
- CGContextRelease( m_xTempContext );
- delete[] m_pTempBuffer;
- m_xTempContext = NULL;
- m_pTempBuffer = NULL;
- }
- }
-
- // return early if there is nothing more to do
- if( !xTargetContext )
- {
- return;
- }
- // retarget drawing operations to the XOR mask
- m_xTargetLayer = xTargetLayer;
- m_xTargetContext = xTargetContext;
-
- // prepare creation of matching CGBitmaps
- CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
- CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst;
- int nBitDepth = nTargetDepth;
- if( !nBitDepth )
- {
- nBitDepth = 32;
- }
- int nBytesPerRow = (nBitDepth == 16) ? 2 : 4;
- const size_t nBitsPerComponent = (nBitDepth == 16) ? 5 : 8;
- if( nBitDepth <= 8 )
- {
- aCGColorSpace = GetSalData()->mxGraySpace;
- aCGBmpInfo = kCGImageAlphaNone;
- nBytesPerRow = 1;
- }
- nBytesPerRow *= nWidth;
- m_nBufferLongs = (nHeight * nBytesPerRow + sizeof(sal_uLong)-1) / sizeof(sal_uLong);
-
- // create a XorMask context
- m_pMaskBuffer = new sal_uLong[ m_nBufferLongs ];
- m_xMaskContext = ::CGBitmapContextCreate( m_pMaskBuffer,
- nWidth, nHeight,
- nBitsPerComponent, nBytesPerRow,
- aCGColorSpace, aCGBmpInfo );
- // reset the XOR mask to black
- memset( m_pMaskBuffer, 0, m_nBufferLongs * sizeof(sal_uLong) );
-
- // a bitmap context will be needed for manual XORing
- // create one unless the target context is a bitmap context
- if( nTargetDepth )
- m_pTempBuffer = (sal_uLong*)CGBitmapContextGetData( m_xTargetContext );
- if( !m_pTempBuffer )
- {
- // create a bitmap context matching to the target context
- m_pTempBuffer = new sal_uLong[ m_nBufferLongs ];
- m_xTempContext = ::CGBitmapContextCreate( m_pTempBuffer,
- nWidth, nHeight,
- nBitsPerComponent, nBytesPerRow,
- aCGColorSpace, aCGBmpInfo );
- }
-
- // initialize XOR mask context for drawing
- CGContextSetFillColorSpace( m_xMaskContext, aCGColorSpace );
- CGContextSetStrokeColorSpace( m_xMaskContext, aCGColorSpace );
- CGContextSetShouldAntialias( m_xMaskContext, false );
-
- // improve the XorMask's XOR emulation a litte
- // NOTE: currently only enabled for monochrome contexts
- if( aCGColorSpace == GetSalData()->mxGraySpace )
- {
- CGContextSetBlendMode( m_xMaskContext, kCGBlendModeDifference );
- }
- // intialize the transformation matrix to the drawing target
- const CGAffineTransform aCTM = CGContextGetCTM( xTargetContext );
- CGContextConcatCTM( m_xMaskContext, aCTM );
- if( m_xTempContext )
- {
- CGContextConcatCTM( m_xTempContext, aCTM );
- }
- // initialize the default XorMask graphics state
- CGContextSaveGState( m_xMaskContext );
-}
-
-bool XorEmulation::UpdateTarget()
-{
- if( !IsEnabled() )
- {
- return false;
- }
- // update the temp bitmap buffer if needed
- if( m_xTempContext )
- {
- CGContextDrawLayerAtPoint( m_xTempContext, CGPointZero, m_xTargetLayer );
- }
- // do a manual XOR with the XorMask
- // this approach suffices for simple color manipulations
- // and also the complex-clipping-XOR-trick used in metafiles
- const sal_uLong* pSrc = m_pMaskBuffer;
- sal_uLong* pDst = m_pTempBuffer;
- for( int i = m_nBufferLongs; --i >= 0;)
- {
- *(pDst++) ^= *(pSrc++);
- }
- // write back the XOR results to the target context
- if( m_xTempContext )
- {
- CGImageRef xXorImage = CGBitmapContextCreateImage( m_xTempContext );
- const int nWidth = (int)CGImageGetWidth( xXorImage );
- const int nHeight = (int)CGImageGetHeight( xXorImage );
- // TODO: update minimal changerect
- const CGRect aFullRect = { { 0, 0 }, { static_cast<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) } };
- CGContextDrawImage( m_xTargetContext, aFullRect, xXorImage );
- CGImageRelease( xXorImage );
- }
-
- // reset the XorMask to black again
- // TODO: not needed for last update
- memset( m_pMaskBuffer, 0, m_nBufferLongs * sizeof(sal_uLong) );
-
- // TODO: return FALSE if target was not changed
- return true;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/gdi/salgdiutils.cxx b/vcl/ios/source/gdi/salgdiutils.cxx
deleted file mode 100644
index fc499e450743..000000000000
--- a/vcl/ios/source/gdi/salgdiutils.cxx
+++ /dev/null
@@ -1,304 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "basebmp/scanlineformats.hxx"
-#include "basebmp/color.hxx"
-
-#include "basegfx/range/b2drectangle.hxx"
-#include "basegfx/range/b2irange.hxx"
-#include "basegfx/vector/b2ivector.hxx"
-#include "basegfx/polygon/b2dpolygon.hxx"
-#include "basegfx/polygon/b2dpolygontools.hxx"
-
-#include "vcl/svapp.hxx"
-
-#include "coretext/salgdi.h"
-#include "ios/salframe.h"
-#include "ios/saldata.hxx"
-
-// ----------------------------------------------------------------------
-
-void QuartzSalGraphics::SetWindowGraphics( IosSalFrame* pFrame )
-{
- mpFrame = pFrame;
-
- mbWindow = true;
- mbPrinter = false;
- mbVirDev = false;
-}
-
-void QuartzSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, long nDPIY, double fScale )
-{
- mbWindow = false;
- mbPrinter = true;
- mbVirDev = false;
-
- mrContext = xContext;
- mfFakeDPIScale = fScale;
- mnRealDPIX = nDPIX;
- mnRealDPIY = nDPIY;
-
- // a previously set clip path is now invalid
- if( mxClipPath )
- {
- CGPathRelease( mxClipPath );
- mxClipPath = NULL;
- }
-
- if( mrContext )
- {
- CGContextSetFillColorSpace( mrContext, GetSalData()->mxRGBSpace );
- CGContextSetStrokeColorSpace( mrContext, GetSalData()->mxRGBSpace );
- CGContextSaveGState( mrContext );
- SetState();
- }
-}
-
-void QuartzSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext,
- int nBitmapDepth )
-{
- mbWindow = false;
- mbPrinter = false;
- mbVirDev = true;
-
- // set graphics properties
- mxLayer = xLayer;
- mrContext = xContext;
- mnBitmapDepth = nBitmapDepth;
-
- // return early if the virdev is being destroyed
- if( !xContext )
- return;
-
- // get new graphics properties
- if( !mxLayer )
- {
- mnWidth = CGBitmapContextGetWidth( mrContext );
- mnHeight = CGBitmapContextGetHeight( mrContext );
- }
- else
- {
- const CGSize aSize = CGLayerGetSize( mxLayer );
- mnWidth = static_cast<int>(aSize.width);
- mnHeight = static_cast<int>(aSize.height);
- }
-
- // prepare graphics for drawing
- const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
- CGContextSetFillColorSpace( mrContext, aCGColorSpace );
- CGContextSetStrokeColorSpace( mrContext, aCGColorSpace );
-
- // re-enable XorEmulation for the new context
- if( mpXorEmulation )
- {
- mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer );
- if( mpXorEmulation->IsEnabled() )
- mrContext = mpXorEmulation->GetMaskContext();
- }
-
- // initialize stack of CGContext states
- CGContextSaveGState( mrContext );
- SetState();
-}
-
-// ----------------------------------------------------------------------
-
-void QuartzSalGraphics::InvalidateContext()
-{
- UnsetState();
- mrContext = 0;
-}
-
-// ----------------------------------------------------------------------
-
-void QuartzSalGraphics::UnsetState()
-{
- if( mrContext )
- {
- CGContextRestoreGState( mrContext );
- mrContext = 0;
- }
- if( mxClipPath )
- {
- CGPathRelease( mxClipPath );
- mxClipPath = NULL;
- }
-}
-
-void QuartzSalGraphics::SetState()
-{
- CGContextRestoreGState( mrContext );
- CGContextSaveGState( mrContext );
-
- // setup clipping
- if( mxClipPath )
- {
- CGContextBeginPath( mrContext ); // discard any existing path
- CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path
- CGContextClip( mrContext ); // use it for clipping
- }
-
- // set RGB colorspace and line and fill colors
- CGContextSetFillColor( mrContext, maFillColor.AsArray() );
- CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
- CGContextSetShouldAntialias( mrContext, false );
- if( mnXorMode == 2 )
- CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
-}
-
-// ----------------------------------------------------------------------
-
-bool QuartzSalGraphics::CheckContext()
-{
- if( mbWindow && mpFrame != NULL )
- {
- const unsigned int nWidth = mpFrame->maGeometry.nWidth;
- const unsigned int nHeight = mpFrame->maGeometry.nHeight;
-
- CGContextRef rReleaseContext = 0;
- CGLayerRef rReleaseLayer = NULL;
-
- // check if a new drawing context is needed (e.g. after a resize)
- if( (unsigned(mnWidth) != nWidth) || (unsigned(mnHeight) != nHeight) )
- {
- mnWidth = nWidth;
- mnHeight = nHeight;
- // prepare to release the corresponding resources
- rReleaseContext = mrContext;
- rReleaseLayer = mxLayer;
- mrContext = NULL;
- mxLayer = NULL;
- }
-
- if( !mrContext )
- {
-#if 0 // No idea
- const CGSize aLayerSize = {nWidth,nHeight};
- UIGraphicsContext* puiGContext = [UIGraphicsContext graphicsContextWithWindow: mpFrame->getWindow()];
- CGContextRef xCGContext = reinterpret_cast<CGContextRef>([pUIGContext graphicsPort]);
- mxLayer = CGLayerCreateWithContext( xCGContext, aLayerSize, NULL );
- if( mxLayer )
- mrContext = CGLayerGetContext( mxLayer );
-#endif
- if( mrContext )
- {
- // copy original layer to resized layer
- if( rReleaseLayer )
- CGContextDrawLayerAtPoint( mrContext, CGPointZero, rReleaseLayer );
-
- CGContextTranslateCTM( mrContext, 0, nHeight );
- CGContextScaleCTM( mrContext, 1.0, -1.0 );
- CGContextSetFillColorSpace( mrContext, GetSalData()->mxRGBSpace );
- CGContextSetStrokeColorSpace( mrContext, GetSalData()->mxRGBSpace );
- CGContextSaveGState( mrContext );
- SetState();
-
- // re-enable XOR emulation for the new context
- if( mpXorEmulation )
- mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer );
- }
- }
-
- if( rReleaseLayer )
- CGLayerRelease( rReleaseLayer );
- else if( rReleaseContext )
- CGContextRelease( rReleaseContext );
- }
-
- DBG_ASSERT( mrContext || mbPrinter, "<<<WARNING>>> QuartzSalGraphics::CheckContext() FAILED!!!!\n" );
- return (mrContext != NULL);
-}
-
-CGContextRef QuartzSalGraphics::GetContext()
-{
- if(!mrContext)
- {
- CheckContext();
- }
- return mrContext;
-}
-
-void QuartzSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeight)
-{
- if( ! mbWindow ) // view only on Window graphics
- return;
-
- if( mpFrame )
- {
- // update a little more around the designated rectangle
- // this helps with antialiased rendering
- const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
- static_cast<long int>(lY-1) ),
- Size( static_cast<long int>(lWidth+2),
- static_cast<long int>(lHeight+2) ) );
- mpFrame->maInvalidRect.Union( aVclRect );
- }
-}
-
-CGPoint* QuartzSalGraphics::makeCGptArray(sal_uLong nPoints, const SalPoint* pPtAry)
-{
- CGPoint *CGpoints = new CGPoint[nPoints];
- if ( CGpoints )
- {
- for(sal_uLong i=0;i<nPoints;i++)
- {
- CGpoints[i].x = (float)(pPtAry[i].mnX);
- CGpoints[i].y = (float)(pPtAry[i].mnY);
- }
- }
- return CGpoints;
-}
-
-// -----------------------------------------------------------------------
-
-void QuartzSalGraphics::UpdateWindow( CGRect& )
-{
-#if 0 // Sigh, this is just basically a copy of the "aqua" code and not
- // applicable to iOS.
-
- if( !mpFrame )
- return;
- UIGraphicsContext* pContext = [UIGraphicsContext currentContext];
- if( (mxLayer != NULL) && (pContext != NULL) )
- {
- CGContextRef rCGContext = reinterpret_cast<CGContextRef>([pContext graphicsPort]);
-
- CGMutablePathRef rClip = mpFrame->getClipPath();
- if( rClip )
- {
- CGContextSaveGState( rCGContext );
- CGContextBeginPath( rCGContext );
- CGContextAddPath( rCGContext, rClip );
- CGContextClip( rCGContext );
- }
-
- ApplyXorContext();
- CGContextDrawLayerAtPoint( rCGContext, CGPointZero, mxLayer );
- if( rClip ) // cleanup clipping
- CGContextRestoreGState( rCGContext );
- }
- else
- DBG_ASSERT( mpFrame->mbInitShow, "UpdateWindow called on uneligible graphics" );
-#endif
-}
-
-// -----------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/gdi/salnativewidgets.cxx b/vcl/ios/source/gdi/salnativewidgets.cxx
deleted file mode 100644
index c3023e19245e..000000000000
--- a/vcl/ios/source/gdi/salnativewidgets.cxx
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "vcl/salnativewidgets.hxx"
-#include "vcl/decoview.hxx"
-#include "vcl/svapp.hxx"
-#include "vcl/timer.hxx"
-
-#include "coretext/salgdi.h"
-#include "ios/saldata.hxx"
-#include "ios/salframe.h"
-
-#include "premac.h"
-#include <UIKit/UIKit.h>
-#include "postmac.h"
-
-
-/*
- * IsNativeControlSupported()
- * --------------------------
- * Returns sal_True if the platform supports native
- * drawing of the control defined by nPart.
- *
- */
-sal_Bool QuartzSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
-{
- bool bOk = sal_False;
-
- // Native controls are now defaults
- // If you want to disable experimental native controls code,
- // just set the environment variable SAL_NO_NWF to something
- // and vcl controls will be used as default again.
-
- switch( nType )
- {
- case CTRL_PUSHBUTTON:
- case CTRL_RADIOBUTTON:
- case CTRL_CHECKBOX:
- case CTRL_LISTNODE:
- if( nPart == PART_ENTIRE_CONTROL )
- return true;
- break;
-
- case CTRL_SCROLLBAR:
- if( nPart == PART_DRAW_BACKGROUND_HORZ ||
- nPart == PART_DRAW_BACKGROUND_VERT ||
- nPart == PART_ENTIRE_CONTROL ||
- nPart == HAS_THREE_BUTTONS )
- return true;
- break;
-
- case CTRL_SLIDER:
- if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA )
- return true;
- break;
-
- case CTRL_EDITBOX:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == HAS_BACKGROUND_TEXTURE )
- return true;
- break;
-
- case CTRL_MULTILINE_EDITBOX:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == HAS_BACKGROUND_TEXTURE )
- return true;
- break;
-
- case CTRL_SPINBOX:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == PART_ALL_BUTTONS ||
- nPart == HAS_BACKGROUND_TEXTURE )
- return true;
- break;
-
- case CTRL_SPINBUTTONS:
- return false;
- break;
-
- case CTRL_COMBOBOX:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == HAS_BACKGROUND_TEXTURE )
- return true;
- break;
-
- case CTRL_LISTBOX:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == PART_WINDOW ||
- nPart == HAS_BACKGROUND_TEXTURE ||
- nPart == PART_SUB_EDIT
- )
- return true;
- break;
-
- case CTRL_TAB_ITEM:
- case CTRL_TAB_PANE:
- case CTRL_TAB_BODY: // see vcl/source/window/tabpage.cxx
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == PART_TABS_DRAW_RTL ||
- nPart == HAS_BACKGROUND_TEXTURE )
- return true;
- break;
-
- // when PART_BUTTON is used, toolbar icons are not highlighted when mouse rolls over.
- // More Ios compliant
- case CTRL_TOOLBAR:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == PART_DRAW_BACKGROUND_HORZ ||
- nPart == PART_DRAW_BACKGROUND_VERT)
- return true;
- break;
-
- case CTRL_WINDOW_BACKGROUND:
- if ( nPart == PART_BACKGROUND_WINDOW ||
- nPart == PART_BACKGROUND_DIALOG )
- return true;
- break;
-
- case CTRL_MENUBAR:
- if( nPart == PART_ENTIRE_CONTROL )
- return true;
- break;
-
- case CTRL_TOOLTIP: // ** TO DO
- break;
-
- case CTRL_MENU_POPUP:
- if( nPart == PART_ENTIRE_CONTROL ||
- nPart == PART_MENU_ITEM ||
- nPart == PART_MENU_ITEM_CHECK_MARK ||
- nPart == PART_MENU_ITEM_RADIO_MARK)
- return true;
- break;
- case CTRL_PROGRESS:
- case CTRL_INTROPROGRESS:
- if( nPart == PART_ENTIRE_CONTROL )
- return true;
- break;
- case CTRL_FRAME:
- if( nPart == PART_BORDER )
- return true;
- break;
- case CTRL_LISTNET:
- if( nPart == PART_ENTIRE_CONTROL )
- return true;
- break;
- }
-
- return bOk;
-}
-
-/*
- * HitTestNativeControl()
- *
- * If the return value is sal_True, bIsInside contains information whether
- * aPos was or was not inside the native widget specified by the
- * nType/nPart combination.
- */
-sal_Bool QuartzSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
- const Point& rPos, sal_Bool& rIsInside )
-{
- (void) nType;
- (void) nPart;
- (void) rControlRegion;
- (void) rPos;
- (void) rIsInside;
- return sal_False;
-}
-
-UInt32 QuartzSalGraphics::getState( ControlState nState )
-{
- (void) nState;
- return 0;
-}
-
-UInt32 QuartzSalGraphics::getTrackState( ControlState nState )
-{
- (void) nState;
- return 0;
-}
-
-/*
- * DrawNativeControl()
- *
- * Draws the requested control described by nPart/nState.
- *
- * rControlRegion: The bounding region of the complete control in VCL frame coordinates.
- * aValue: An optional value (tristate/numerical/string)
- * aCaption: A caption or title string (like button text etc)
- */
-sal_Bool QuartzSalGraphics::drawNativeControl(ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- const rtl::OUString& )
-{
- (void) nType;
- (void) nPart;
- (void) rControlRegion;
- (void) nState;
- (void) aValue;
- return sal_False;
-}
-
-/*
- * GetNativeControlRegion()
- *
- * If the return value is sal_True, rNativeBoundingRegion
- * contains the true bounding region covered by the control
- * including any adornment, while rNativeContentRegion contains the area
- * within the control that can be safely drawn into without drawing over
- * the borders of the control.
- *
- * rControlRegion: The bounding region of the control in VCL frame coordinates.
- * aValue: An optional value (tristate/numerical/string)
- * aCaption: A caption or title string (like button text etc)
- */
-sal_Bool QuartzSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState /*nState*/,
- const ImplControlValue& aValue, const rtl::OUString&,
- Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion )
-
-{
- (void) nType;
- (void) nPart;
- (void) rControlRegion;
- (void) aValue;
- (void) rNativeBoundingRegion;
- (void) rNativeContentRegion;
- return sal_False;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/gdi/salvd.cxx b/vcl/ios/source/gdi/salvd.cxx
deleted file mode 100644
index 6e32a22126e3..000000000000
--- a/vcl/ios/source/gdi/salvd.cxx
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "vcl/svapp.hxx"
-#include "vcl/sysdata.hxx"
-
-#include "ios/salvd.h"
-#include "ios/salinst.h"
-#include "coretext/salgdi.h"
-#include "ios/saldata.hxx"
-#include "ios/salframe.h"
-
-// -----------------------------------------------------------------------
-
-SalVirtualDevice* IosSalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
- long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
-{
- // #i92075# can be called first in a thread
- SalData::ensureThreadAutoreleasePool();
-
- return new IosSalVirtualDevice( static_cast< QuartzSalGraphics* >( pGraphics ), nDX, nDY, nBitCount, pData );
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice )
-{
- delete pDevice;
-}
-
-// =======================================================================
-
-IosSalVirtualDevice::IosSalVirtualDevice( QuartzSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
-: mbGraphicsUsed( false )
-, mxBitmapContext( NULL )
-, mnBitmapDepth( 0 )
-, mxLayer( NULL )
-{
- if( pGraphic && pData && pData->rCGContext )
- {
- // Create virtual device based on existing SystemGraphicsData
- // We ignore nDx and nDY, as the desired size comes from the SystemGraphicsData
- mbForeignContext = true; // the mxContext is from pData
- mpGraphics = new QuartzSalGraphics( /*pGraphic*/ );
- mpGraphics->SetVirDevGraphics( mxLayer, pData->rCGContext );
- }
- else
- {
- // create empty new virtual device
- mbForeignContext = false; // the mxContext is created within VCL
- mpGraphics = new QuartzSalGraphics(); // never fails
- mnBitmapDepth = nBitCount;
-
- // inherit resolution from reference device
- if( pGraphic )
- {
- IosSalFrame* pFrame = pGraphic->getGraphicsFrame();
- if( pFrame && IosSalFrame::isAlive( pFrame ) )
- {
- mpGraphics->setGraphicsFrame( pFrame );
- mpGraphics->copyResolution( *pGraphic );
- }
- }
-
- if( nDX && nDY )
- SetSize( nDX, nDY );
-
- // NOTE: if SetSize does not succeed, we just ignore the nDX and nDY
- }
-}
-
-// -----------------------------------------------------------------------
-
-IosSalVirtualDevice::~IosSalVirtualDevice()
-{
- if( mpGraphics )
- {
- mpGraphics->SetVirDevGraphics( NULL, NULL );
- delete mpGraphics;
- mpGraphics = 0;
- }
- Destroy();
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalVirtualDevice::Destroy()
-{
- if( mbForeignContext ) {
- // Do not delete mxContext that we have received from outside VCL
- mxLayer = NULL;
- return;
- }
-
- if( mxLayer )
- {
- if( mpGraphics )
- mpGraphics->SetVirDevGraphics( NULL, NULL );
- CGLayerRelease( mxLayer );
- mxLayer = NULL;
- }
-
- if( mxBitmapContext )
- {
- void* pRawData = CGBitmapContextGetData( mxBitmapContext );
- rtl_freeMemory( pRawData );
- CGContextRelease( mxBitmapContext );
- mxBitmapContext = NULL;
- }
-}
-
-// -----------------------------------------------------------------------
-
-SalGraphics* IosSalVirtualDevice::GetGraphics()
-{
- if( mbGraphicsUsed || !mpGraphics )
- return 0;
-
- mbGraphicsUsed = true;
- return mpGraphics;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalVirtualDevice::ReleaseGraphics( SalGraphics* )
-{
- mbGraphicsUsed = false;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool IosSalVirtualDevice::SetSize( long nDX, long nDY )
-{
- if( mbForeignContext )
- {
- // Do not delete/resize mxContext that we have received from outside VCL
- return true;
- }
-
- if( mxLayer )
- {
- const CGSize aSize = CGLayerGetSize( mxLayer );
- if( (nDX == aSize.width) && (nDY == aSize.height) )
- {
- // Yay, we do not have to do anything :)
- return true;
- }
- }
-
- Destroy();
-
- // create a Quartz layer matching to the intended virdev usage
- CGContextRef xCGContext = NULL;
- if( mnBitmapDepth && (mnBitmapDepth < 16) )
- {
- mnBitmapDepth = 8; // TODO: are 1bit vdevs worth it?
- const CGColorSpaceRef aCGColorSpace = GetSalData()->mxGraySpace;
- const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNone;
- const int nBytesPerRow = (mnBitmapDepth * nDX + 7) / 8;
-
- void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
- mxBitmapContext = ::CGBitmapContextCreate( pRawData, nDX, nDY,
- mnBitmapDepth, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
- xCGContext = mxBitmapContext;
- }
- else
- {
- // default to a UIView target context
- IosSalFrame* pSalFrame = mpGraphics->getGraphicsFrame();
- if( !pSalFrame && !GetSalData()->maFrames.empty() )
- pSalFrame = *GetSalData()->maFrames.begin();
- if( pSalFrame )
- {
-#if 0 // No idea...
- // #i91990#
- UIWindow* pWindow = pSalFrame->getWindow();
- if ( pWindow )
- {
- UIGraphicsContext* pUIContext = [UIGraphicsContext graphicsContextWithWindow: pWindow];
- if( pUIContext )
- xCGContext = reinterpret_cast<CGContextRef>([pUIContext graphicsPort]);
- }
- else
-#endif
- {
- // fall back to a bitmap context
- mnBitmapDepth = 32;
- const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace;
- const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNoneSkipFirst;
- const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
-
- void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
- mxBitmapContext = ::CGBitmapContextCreate( pRawData, nDX, nDY,
- 8, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
- xCGContext = mxBitmapContext;
- }
- }
- }
-
- DBG_ASSERT( xCGContext, "no context" );
-
- const CGSize aNewSize = { static_cast<CGFloat>(nDX), static_cast<CGFloat>(nDY) };
- mxLayer = CGLayerCreateWithContext( xCGContext, aNewSize, NULL );
-
- if( mxLayer && mpGraphics )
- {
- // get the matching Quartz context
- CGContextRef xDrawContext = CGLayerGetContext( mxLayer );
- mpGraphics->SetVirDevGraphics( mxLayer, xDrawContext, mnBitmapDepth );
- }
-
- return (mxLayer != NULL);
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalVirtualDevice::GetSize( long& rWidth, long& rHeight )
-{
- if( mxLayer )
- {
- const CGSize aSize = CGLayerGetSize( mxLayer );
- rWidth = static_cast<long>(aSize.width);
- rHeight = static_cast<long>(aSize.height);
- }
- else
- {
- rWidth = 0;
- rHeight = 0;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/window/salframe.cxx b/vcl/ios/source/window/salframe.cxx
deleted file mode 100644
index 43cc7ba24a45..000000000000
--- a/vcl/ios/source/window/salframe.cxx
+++ /dev/null
@@ -1,1106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <string>
-
-#include "rtl/ustrbuf.hxx"
-
-#include "osl/file.h"
-
-#include "vcl/svapp.hxx"
-#include "vcl/window.hxx"
-#include "vcl/timer.hxx"
-
-#include "ios/saldata.hxx"
-#include "coretext/salgdi.h"
-#include "ios/salframe.h"
-#include "ios/salmenu.h"
-#include "ios/saltimer.h"
-#include "ios/salinst.h"
-#include "ios/salframeview.h"
-
-#include "salwtype.hxx"
-
-using namespace std;
-
-// =======================================================================
-
-IosSalFrame* IosSalFrame::s_pCaptureFrame = NULL;
-
-// =======================================================================
-
-IosSalFrame::IosSalFrame( SalFrame* pParent, sal_uLong salFrameStyle ) :
- mpWindow(nil),
- mpView(nil),
- mpGraphics(NULL),
- mpParent(NULL),
- mnMinWidth(0),
- mnMinHeight(0),
- mnMaxWidth(0),
- mnMaxHeight(0),
- mbGraphics(false),
- mbShown(false),
- mbInitShow(true),
- mbPresentation( false ),
- mnStyle( salFrameStyle ),
- mnStyleMask( 0 ),
- mnLastEventTime( 0 ),
- mnLastModifierFlags( 0 ),
- mpMenu( NULL ),
- mnExtStyle( 0 ),
- mePointerStyle( POINTER_ARROW ),
- mrClippingPath( 0 ),
- mnICOptions( 0 )
-{
- maSysData.nSize = sizeof( SystemEnvData );
-
- mpParent = dynamic_cast<IosSalFrame*>(pParent);
-
- initWindowAndView();
-
- SalData* pSalData = GetSalData();
- pSalData->maFrames.push_front( this );
- pSalData->maFrameCheck.insert( this );
-}
-
-// -----------------------------------------------------------------------
-
-IosSalFrame::~IosSalFrame()
-{
- // cleanup clipping stuff
- ResetClipRegion();
-
- SalData* pSalData = GetSalData();
- pSalData->maFrames.remove( this );
- pSalData->maFrameCheck.erase( this );
-
- DBG_ASSERT( this != s_pCaptureFrame, "capture frame destroyed" );
- if( this == s_pCaptureFrame )
- s_pCaptureFrame = NULL;
-
- delete mpGraphics;
-
- if ( mpView ) {
- [mpView release];
- }
- if ( mpWindow )
- [mpWindow release];
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::initWindowAndView()
-{
- // initialize mirroring parameters
- // FIXME: screens changing
- UIScreen * pScreen = [mpWindow screen];
- if( pScreen == nil )
- pScreen = [UIScreen mainScreen];
- maScreenRect = [pScreen applicationFrame];
-
- // calculate some default geometry
- CGRect aVisibleRect = [pScreen applicationFrame];
- CocoaTouchToVCL( aVisibleRect );
-
- maGeometry.nX = static_cast<int>(aVisibleRect.origin.x + aVisibleRect.size.width / 10);
- maGeometry.nY = static_cast<int>(aVisibleRect.origin.y + aVisibleRect.size.height / 10);
- maGeometry.nWidth = static_cast<unsigned int>(aVisibleRect.size.width * 0.8);
- maGeometry.nHeight = static_cast<unsigned int>(aVisibleRect.size.height * 0.8);
-
- // calculate style mask
- if( (mnStyle & SAL_FRAME_STYLE_FLOAT) ||
- (mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) )
- ;
- else if( mnStyle & SAL_FRAME_STYLE_DEFAULT )
- {
- // make default window "maximized"
- maGeometry.nX = static_cast<int>(aVisibleRect.origin.x);
- maGeometry.nY = static_cast<int>(aVisibleRect.origin.y);
- maGeometry.nWidth = static_cast<int>(aVisibleRect.size.width);
- maGeometry.nHeight = static_cast<int>(aVisibleRect.size.height);
- }
- else
- {
- if( (mnStyle & SAL_FRAME_STYLE_MOVEABLE) )
- {
- }
- }
-
- mpWindow = [[SalFrameWindow alloc] initWithSalFrame: this];
- mpView = [[SalFrameView alloc] initWithSalFrame: this];
-
- maSysData.pView = mpView;
-
- UpdateFrameGeometry();
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::CocoaTouchToVCL( CGRect& io_rRect, bool bRelativeToScreen )
-{
- if( bRelativeToScreen )
- io_rRect.origin.y = maScreenRect.size.height - (io_rRect.origin.y+io_rRect.size.height);
- else
- io_rRect.origin.y = maGeometry.nHeight - (io_rRect.origin.y+io_rRect.size.height);
-}
-
-void IosSalFrame::VCLToCocoaTouch( CGRect& io_rRect, bool bRelativeToScreen )
-{
- if( bRelativeToScreen )
- io_rRect.origin.y = maScreenRect.size.height - (io_rRect.origin.y+io_rRect.size.height);
- else
- io_rRect.origin.y = maGeometry.nHeight - (io_rRect.origin.y+io_rRect.size.height);
-}
-
-void IosSalFrame::CocoaTouchToVCL( CGPoint& io_rPoint, bool bRelativeToScreen )
-{
- if( bRelativeToScreen )
- io_rPoint.y = maScreenRect.size.height - io_rPoint.y;
- else
- io_rPoint.y = maGeometry.nHeight - io_rPoint.y;
-}
-
-void IosSalFrame::VCLToCocoaTouch( CGPoint& io_rPoint, bool bRelativeToScreen )
-{
- if( bRelativeToScreen )
- io_rPoint.y = maScreenRect.size.height - io_rPoint.y;
- else
- io_rPoint.y = maGeometry.nHeight - io_rPoint.y;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::screenParametersChanged()
-{
- UpdateFrameGeometry();
-
- if( mpGraphics )
- mpGraphics->updateResolution();
- CallCallback( SALEVENT_DISPLAYCHANGED, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SalGraphics* IosSalFrame::GetGraphics()
-{
- if ( mbGraphics )
- return NULL;
-
- if ( !mpGraphics )
- {
- mpGraphics = new QuartzSalGraphics;
- mpGraphics->SetWindowGraphics( this );
- }
-
- mbGraphics = TRUE;
- return mpGraphics;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::ReleaseGraphics( SalGraphics *pGraphics )
-{
- (void)pGraphics;
- DBG_ASSERT( pGraphics == mpGraphics, "graphics released on wrong frame" );
- mbGraphics = FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool IosSalFrame::PostEvent( void *pData )
-{
- GetSalData()->mpFirstInstance->PostUserEvent( this, SALEVENT_USEREVENT, pData );
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-void IosSalFrame::SetTitle(const rtl::OUString& /* rTitle */)
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetIcon( sal_uInt16 )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetRepresentedURL( const rtl::OUString& /* i_rDocURL */ )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::initShow()
-{
- mbInitShow = false;
- {
- Rectangle aScreenRect;
- GetWorkArea( aScreenRect );
- if( mpParent ) // center relative to parent
- {
- // center on parent
- long nNewX = mpParent->maGeometry.nX + ((long)mpParent->maGeometry.nWidth - (long)maGeometry.nWidth)/2;
- if( nNewX < aScreenRect.Left() )
- nNewX = aScreenRect.Left();
- if( long(nNewX + maGeometry.nWidth) > aScreenRect.Right() )
- nNewX = aScreenRect.Right() - maGeometry.nWidth-1;
- long nNewY = mpParent->maGeometry.nY + ((long)mpParent->maGeometry.nHeight - (long)maGeometry.nHeight)/2;
- if( nNewY < aScreenRect.Top() )
- nNewY = aScreenRect.Top();
- if( nNewY > aScreenRect.Bottom() )
- nNewY = aScreenRect.Bottom() - maGeometry.nHeight-1;
- SetPosSize( nNewX - mpParent->maGeometry.nX,
- nNewY - mpParent->maGeometry.nY,
- 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y );
- }
- else if( ! (mnStyle & SAL_FRAME_STYLE_SIZEABLE) )
- {
- // center on screen
- long nNewX = (aScreenRect.GetWidth() - maGeometry.nWidth)/2;
- long nNewY = (aScreenRect.GetHeight() - maGeometry.nHeight)/2;
- SetPosSize( nNewX, nNewY, 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y );
- }
- }
-}
-
-void IosSalFrame::SendPaintEvent( const Rectangle* pRect )
-{
- SalPaintEvent aPaintEvt( 0, 0, maGeometry.nWidth, maGeometry.nHeight, true );
- if( pRect )
- {
- aPaintEvt.mnBoundX = pRect->Left();
- aPaintEvt.mnBoundY = pRect->Top();
- aPaintEvt.mnBoundWidth = pRect->GetWidth();
- aPaintEvt.mnBoundHeight = pRect->GetHeight();
- }
-
- CallCallback(SALEVENT_PAINT, &aPaintEvt);
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::Show(sal_Bool bVisible, sal_Bool bNoActivate)
-{
- if ( !mpWindow )
- return;
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- mbShown = bVisible;
- if(bVisible)
- {
- if( mbInitShow )
- initShow();
-
- CallCallback(SALEVENT_RESIZE, 0);
- // trigger filling our backbuffer
- SendPaintEvent();
-
- if( !bNoActivate )
- [mpWindow makeKeyAndVisible];
-#if 0 // ???
- if( mpParent )
- {
- /* #i92674# #i96433# we do not want an invisible parent to show up (which adding a visible
- child implicitly does). However we also do not want a parentless toolbar.
-
- HACK: try to decide when we should not insert a child to its parent
- floaters and ownerdraw windows have not yet shown up in cases where
- we don't want the parent to become visible
- */
- if( mpParent->mbShown || (mnStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_FLOAT) ) )
- {
- [mpParent->mpWindow addChildWindow: mpWindow];
- }
- }
-
- if( mbPresentation )
- [mpWindow makeMainWindow];
-#endif
- }
- else
- {
-#if 0 // ???
- if( mpParent && [mpWindow parentWindow] == mpParent->mpWindow )
- [mpParent->mpWindow removeChildWindow: mpWindow];
-#endif
- }
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::Enable( sal_Bool )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetMinClientSize( long nWidth, long nHeight )
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- mnMinWidth = nWidth;
- mnMinHeight = nHeight;
-
- if( mpWindow )
- {
- // Always add the decoration as the dimension concerns only
- // the content rectangle
- nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration;
- nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration;
-
-#if 0 // ???
- CGSize aSize = { nWidth, nHeight };
- // Size of full window (content+structure) although we only
- // have the client size in arguments
- [mpWindow setMinSize: aSize];
-#endif
- }
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetMaxClientSize( long nWidth, long nHeight )
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- mnMaxWidth = nWidth;
- mnMaxHeight = nHeight;
-
- if( mpWindow )
- {
- // Always add the decoration as the dimension concerns only
- // the content rectangle
- nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration;
- nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration;
-
- // Carbon windows can't have a size greater than 32767x32767
- if (nWidth>32767) nWidth=32767;
- if (nHeight>32767) nHeight=32767;
-
-#if 0 // ???
- CGSize aSize = { nWidth, nHeight };
- // Size of full window (content+structure) although we only
- // have the client size in arguments
- [mpWindow setMaxSize: aSize];
-#endif
- }
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetClientSize( long /*nWidth*/, long /*nHeight*/ )
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- if( mpWindow )
- {
-#if 0 // ???
- CGSize aSize = { nWidth, nHeight };
- [mpWindow setContentSize: aSize];
-#endif
- UpdateFrameGeometry();
- if( mbShown )
- // trigger filling our backbuffer
- SendPaintEvent();
- }
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::GetClientSize( long& rWidth, long& rHeight )
-{
- if( mbShown || mbInitShow )
- {
- rWidth = maGeometry.nWidth;
- rHeight = maGeometry.nHeight;
- }
- else
- {
- rWidth = 0;
- rHeight = 0;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetWindowState( const SalFrameState* pState )
-{
- // ???
-
- // get new geometry
- UpdateFrameGeometry();
-
- sal_uInt16 nEvent = 0;
- if( pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y) )
- {
- mbPositioned = true;
- nEvent = SALEVENT_MOVE;
- }
-
- if( pState->mnMask & (SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT) )
- {
- mbSized = true;
- nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE;
- }
- // send event that we were moved/sized
- if( nEvent )
- CallCallback( nEvent, NULL );
-
- if( mbShown && mpWindow )
- {
- // trigger filling our backbuffer
- SendPaintEvent();
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool IosSalFrame::GetWindowState( SalFrameState* pState )
-{
- if ( !mpWindow )
- return FALSE;
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- pState->mnMask = SAL_FRAMESTATE_MASK_X |
- SAL_FRAMESTATE_MASK_Y |
- SAL_FRAMESTATE_MASK_WIDTH |
- SAL_FRAMESTATE_MASK_HEIGHT |
- SAL_FRAMESTATE_MASK_STATE;
-
-#if 0 // ???
- CGRect aStateRect = [mpWindow frame];
- aStateRect = [UIWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask];
- CocoaTouchToVCL( aStateRect );
- pState->mnX = long(aStateRect.origin.x);
- pState->mnY = long(aStateRect.origin.y);
- pState->mnWidth = long(aStateRect.size.width);
- pState->mnHeight = long(aStateRect.size.height);
-#endif
- pState->mnState = SAL_FRAMESTATE_MAXIMIZED;
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetScreenNumber(unsigned int /*nScreen*/)
-{
- // ???
-}
-
-void IosSalFrame::SetApplicationID( const rtl::OUString &/*rApplicationID*/ )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::ShowFullScreen( sal_Bool /*bFullScreen*/, sal_Int32 /*nDisplay*/ )
-{
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::StartPresentation( sal_Bool /*bStart*/ )
-{
- if ( !mpWindow )
- return;
-
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetAlwaysOnTop( sal_Bool )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::ToTop(sal_uInt16 /*nFlags*/)
-{
- if ( !mpWindow )
- return;
-
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetPointer( PointerStyle /*ePointerStyle*/ )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetPointerPos( long /* nX */ , long /* nY */ )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::Flush( void )
-{
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::Flush( const Rectangle& /*rRect*/ )
-{
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::Sync()
-{
- // ???
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetInputContext( SalInputContext* pContext )
-{
- if (!pContext)
- {
- mnICOptions = 0;
- return;
- }
-
- mnICOptions = pContext->mnOptions;
-
- if(!(pContext->mnOptions & SAL_INPUTCONTEXT_TEXT))
- return;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::EndExtTextInput( sal_uInt16 )
-{
-}
-
-// -----------------------------------------------------------------------
-
-rtl::OUString IosSalFrame::GetKeyName( sal_uInt16 nKeyCode )
-{
- static std::map< sal_uInt16, rtl::OUString > aKeyMap;
- if( aKeyMap.empty() )
- {
- sal_uInt16 i;
- for( i = KEY_A; i <= KEY_Z; i++ )
- aKeyMap[ i ] = rtl::OUString( sal_Unicode( 'A' + (i - KEY_A) ) );
- for( i = KEY_0; i <= KEY_9; i++ )
- aKeyMap[ i ] = rtl::OUString( sal_Unicode( '0' + (i - KEY_0) ) );
- for( i = KEY_F1; i <= KEY_F26; i++ )
- {
- rtl::OUStringBuffer aKey( 3 );
- aKey.append( sal_Unicode( 'F' ) );
- aKey.append( sal_Int32( i - KEY_F1 + 1 ) );
- aKeyMap[ i ] = aKey.makeStringAndClear();
- }
-
- aKeyMap[ KEY_DOWN ] = rtl::OUString( sal_Unicode( 0x21e3 ) );
- aKeyMap[ KEY_UP ] = rtl::OUString( sal_Unicode( 0x21e1 ) );
- aKeyMap[ KEY_LEFT ] = rtl::OUString( sal_Unicode( 0x21e0 ) );
- aKeyMap[ KEY_RIGHT ] = rtl::OUString( sal_Unicode( 0x21e2 ) );
- aKeyMap[ KEY_HOME ] = rtl::OUString( sal_Unicode( 0x2196 ) );
- aKeyMap[ KEY_END ] = rtl::OUString( sal_Unicode( 0x2198 ) );
- aKeyMap[ KEY_PAGEUP ] = rtl::OUString( sal_Unicode( 0x21de ) );
- aKeyMap[ KEY_PAGEDOWN ] = rtl::OUString( sal_Unicode( 0x21df ) );
- aKeyMap[ KEY_RETURN ] = rtl::OUString( sal_Unicode( 0x21a9 ) );
- aKeyMap[ KEY_ESCAPE ] = rtl::OUString( "esc" );
- aKeyMap[ KEY_TAB ] = rtl::OUString( sal_Unicode( 0x21e5 ) );
- aKeyMap[ KEY_BACKSPACE ]= rtl::OUString( sal_Unicode( 0x232b ) );
- aKeyMap[ KEY_SPACE ] = rtl::OUString( sal_Unicode( 0x2423 ) );
- aKeyMap[ KEY_DELETE ] = rtl::OUString( sal_Unicode( 0x2326 ) );
- aKeyMap[ KEY_ADD ] = rtl::OUString( sal_Unicode( '+' ) );
- aKeyMap[ KEY_SUBTRACT ] = rtl::OUString( sal_Unicode( '-' ) );
- aKeyMap[ KEY_DIVIDE ] = rtl::OUString( sal_Unicode( '/' ) );
- aKeyMap[ KEY_MULTIPLY ] = rtl::OUString( sal_Unicode( '*' ) );
- aKeyMap[ KEY_POINT ] = rtl::OUString( sal_Unicode( '.' ) );
- aKeyMap[ KEY_COMMA ] = rtl::OUString( sal_Unicode( ',' ) );
- aKeyMap[ KEY_LESS ] = rtl::OUString( sal_Unicode( '<' ) );
- aKeyMap[ KEY_GREATER ] = rtl::OUString( sal_Unicode( '>' ) );
- aKeyMap[ KEY_EQUAL ] = rtl::OUString( sal_Unicode( '=' ) );
- aKeyMap[ KEY_OPEN ] = rtl::OUString( sal_Unicode( 0x23cf ) );
-
- /* yet unmapped KEYCODES:
- aKeyMap[ KEY_INSERT ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_CUT ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_COPY ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_PASTE ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_UNDO ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_REPEAT ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_FIND ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_PROPERTIES ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_FRONT ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_CONTEXTMENU ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_MENU ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_HELP ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_HANGUL_HANJA ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_DECIMAL ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_TILDE ] = rtl::OUString( sal_Unicode( ) );
- aKeyMap[ KEY_QUOTELEFT ]= rtl::OUString( sal_Unicode( ) );
- */
-
- }
-
- rtl::OUStringBuffer aResult( 16 );
-
- sal_uInt16 nUnmodifiedCode = (nKeyCode & KEY_CODE);
- std::map< sal_uInt16, rtl::OUString >::const_iterator it = aKeyMap.find( nUnmodifiedCode );
- if( it != aKeyMap.end() )
- {
- if( (nKeyCode & KEY_SHIFT) != 0 )
- aResult.append( sal_Unicode( 0x21e7 ) );
- if( (nKeyCode & KEY_MOD1) != 0 )
- aResult.append( sal_Unicode( 0x2318 ) );
- // we do not really handle Alt (see below)
- // we map it to MOD3, whichis actually Command
- if( (nKeyCode & (KEY_MOD2|KEY_MOD3)) != 0 )
- aResult.append( sal_Unicode( 0x2303 ) );
-
- aResult.append( it->second );
- }
-
- return aResult.makeStringAndClear();
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY )
-{
- if( ! mpGraphics )
- {
- GetGraphics();
- ReleaseGraphics( mpGraphics );
- }
- mpGraphics->GetResolution( o_rDPIX, o_rDPIY );
-}
-
-void IosSalFrame::UpdateSettings( AllSettings& rSettings )
-{
- if ( !mpWindow )
- return;
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- StyleSettings aStyleSettings = rSettings.GetStyleSettings();
-
- // Background Color
- Color aBackgroundColor = Color( 0xEC, 0xEC, 0xEC );
- aStyleSettings.Set3DColors( aBackgroundColor );
- aStyleSettings.SetFaceColor( aBackgroundColor );
- Color aInactiveTabColor( aBackgroundColor );
- aInactiveTabColor.DecreaseLuminance( 32 );
- aStyleSettings.SetInactiveTabColor( aInactiveTabColor );
-
- aStyleSettings.SetDialogColor( aBackgroundColor );
- aStyleSettings.SetLightBorderColor( aBackgroundColor );
- Color aShadowColor( aStyleSettings.GetShadowColor() );
- aShadowColor.IncreaseLuminance( 32 );
- aStyleSettings.SetShadowColor( aShadowColor );
-
- // get the system font settings
- Font aAppFont = aStyleSettings.GetAppFont();
- long nDPIX = 72, nDPIY = 72;
- getResolution( nDPIX, nDPIY );
-
- aStyleSettings.SetToolbarIconSize( nDPIY > 160 ? STYLE_TOOLBAR_ICONSIZE_LARGE : STYLE_TOOLBAR_ICONSIZE_SMALL );
-
- aStyleSettings.SetCursorBlinkTime( 500 );
-
- // no mnemonics on iOs
- aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_NOMNEMONICS );
-
- // images in menus false for iOS
- aStyleSettings.SetPreferredUseImagesInMenus( false );
- aStyleSettings.SetHideDisabledMenuItems( sal_True );
- aStyleSettings.SetAcceleratorsInContextMenus( sal_False );
-
- rSettings.SetStyleSettings( aStyleSettings );
-}
-
-// -----------------------------------------------------------------------
-
-const SystemEnvData* IosSalFrame::GetSystemData() const
-{
- return &maSysData;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::SetPosSize(long /*nX*/, long /*nY*/, long /*nWidth*/, long /*nHeight*/, sal_uInt16 nFlags)
-{
- if ( !mpWindow )
- return;
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- sal_uInt16 nEvent = 0;
-
- if (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y))
- {
- mbPositioned = true;
- nEvent = SALEVENT_MOVE;
- }
-
- if (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT))
- {
- mbSized = true;
- nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE;
- }
-
-#if 0 // ???
- CGRect aFrameRect = [mpWindow frame];
- CGRect aContentRect = [NSWindow contentRectForFrameRect: aFrameRect styleMask: mnStyleMask];
-
- // position is always relative to parent frame
- CGRect aParentContentRect;
-
- if( mpParent )
- {
- if( Application::GetSettings().GetLayoutRTL() )
- {
- if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 )
- nX = mpParent->maGeometry.nWidth - nWidth-1 - nX;
- else
- nX = mpParent->maGeometry.nWidth - static_cast<long int>( aContentRect.size.width-1) - nX;
- }
- CGRect aParentFrameRect = [mpParent->mpWindow frame];
- aParentContentRect = [NSWindow contentRectForFrameRect: aParentFrameRect styleMask: mpParent->mnStyleMask];
- }
- else
- aParentContentRect = maScreenRect; // use screen if no parent
-
- CocoaTouchToVCL( aContentRect );
- CocoaTouchToVCL( aParentContentRect );
-
- bool bPaint = false;
- if( (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) != 0 )
- {
- if( nWidth != aContentRect.size.width || nHeight != aContentRect.size.height )
- bPaint = true;
- }
-
- // use old window pos if no new pos requested
- if( (nFlags & SAL_FRAME_POSSIZE_X) != 0 )
- aContentRect.origin.x = nX + aParentContentRect.origin.x;
- if( (nFlags & SAL_FRAME_POSSIZE_Y) != 0)
- aContentRect.origin.y = nY + aParentContentRect.origin.y;
-
- // use old size if no new size requested
- if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 )
- aContentRect.size.width = nWidth;
- if( (nFlags & SAL_FRAME_POSSIZE_HEIGHT) != 0)
- aContentRect.size.height = nHeight;
-
- VCLToCocoaTouch( aContentRect );
-
- // do not display yet, we need to update our backbuffer
- {
- [mpWindow setFrame: [NSWindow frameRectForContentRect: aContentRect styleMask: mnStyleMask] display: NO];
- }
-
- UpdateFrameGeometry();
-
- if (nEvent)
- CallCallback(nEvent, NULL);
-
- if( mbShown && bPaint )
- {
- // trigger filling our backbuffer
- SendPaintEvent();
-
- // now inform the system that the views need to be drawn
- [mpWindow display];
- }
-#endif
-}
-
-void IosSalFrame::GetWorkArea( Rectangle& rRect )
-{
- if ( !mpWindow )
- return;
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- UIScreen* pScreen = [mpWindow screen];
- if( pScreen == nil )
- pScreen = [UIScreen mainScreen];
- CGRect aRect = [pScreen applicationFrame];
- CocoaTouchToVCL( aRect );
- rRect.Left() = static_cast<long>(aRect.origin.x);
- rRect.Top() = static_cast<long>(aRect.origin.y);
- rRect.Right() = static_cast<long>(aRect.origin.x + aRect.size.width - 1);
- rRect.Bottom() = static_cast<long>(aRect.origin.y + aRect.size.height - 1);
-}
-
-SalPointerState IosSalFrame::GetPointerState()
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- SalPointerState state;
- state.mnState = 0;
-
- // ???
-
- return state;
-}
-
-SalFrame::SalIndicatorState IosSalFrame::GetIndicatorState()
-{
- SalIndicatorState aState;
- aState.mnState = 0;
- return aState;
-}
-
-void IosSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ )
-{
-}
-
-bool IosSalFrame::SetPluginParent( SystemParentData* )
-{
- // plugin parent may be killed unexpectedly by
- // plugging process;
-
- //TODO: implement
- return sal_False;
-}
-
-sal_Bool IosSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& )
-{
- // not supported yet
- return FALSE;
-}
-
-LanguageType IosSalFrame::GetInputLanguage()
-{
- //TODO: implement
- return LANGUAGE_DONTKNOW;
-}
-
-void IosSalFrame::DrawMenuBar()
-{
-}
-
-void IosSalFrame::SetMenu( SalMenu* /*pSalMenu*/ )
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- // ???
-}
-
-void IosSalFrame::SetExtendedFrameStyle( SalExtStyle /*nStyle*/ )
-{
- // ???
-}
-
-SalFrame* IosSalFrame::GetParent() const
-{
- return mpParent;
-}
-
-void IosSalFrame::SetParent( SalFrame* pNewParent )
-{
- bool bShown = mbShown;
- // remove from child list
- Show( FALSE );
- mpParent = (IosSalFrame*)pNewParent;
- // insert to correct parent and paint
- Show( bShown );
-}
-
-void IosSalFrame::UpdateFrameGeometry()
-{
- if ( !mpWindow )
- {
- return;
- }
-
- // keep in mind that view and window coordinates are lower left
- // whereas vcl's are upper left
-
-#if 0 // ???
- // update screen rect
- NSScreen * pScreen = [mpWindow screen];
- if( pScreen )
- {
- maScreenRect = [pScreen frame];
- NSArray* pScreens = [NSScreen screens];
- if( pScreens )
- maGeometry.nDisplayScreenNumber = [pScreens indexOfObject: pScreen];
- }
-
- CGRect aFrameRect = [mpWindow frame];
-
- CGRect aContentRect = [NSWindow contentRectForFrameRect: aFrameRect styleMask: mnStyleMask];
-
- // release old track rect
- [mpView removeTrackingRect: mnTrackingRectTag];
- // install the new track rect
- CGRect aTrackRect = { { 0, 0 }, aContentRect.size };
- mnTrackingRectTag = [mpView addTrackingRect: aTrackRect owner: mpView userData: nil assumeInside: NO];
-
- // convert to vcl convention
- CocoaTouchToVCL( aFrameRect );
- CocoaTouchToVCL( aContentRect );
-
- maGeometry.nX = static_cast<int>(aContentRect.origin.x);
- maGeometry.nY = static_cast<int>(aContentRect.origin.y);
-
- maGeometry.nLeftDecoration = static_cast<unsigned int>(aContentRect.origin.x - aFrameRect.origin.x);
- maGeometry.nRightDecoration = static_cast<unsigned int>((aFrameRect.origin.x + aFrameRect.size.width) -
- (aContentRect.origin.x + aContentRect.size.width));
-
- maGeometry.nTopDecoration = static_cast<unsigned int>(aContentRect.origin.y - aFrameRect.origin.y);
- maGeometry.nBottomDecoration = static_cast<unsigned int>((aFrameRect.origin.y + aFrameRect.size.height) -
- (aContentRect.origin.y + aContentRect.size.height));
-
- maGeometry.nWidth = static_cast<unsigned int>(aContentRect.size.width);
- maGeometry.nHeight = static_cast<unsigned int>(aContentRect.size.height);
-#endif
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalFrame::CaptureMouse( sal_Bool bCapture )
-{
- /* Remark:
- we'll try to use a pidgin version of capture mouse
- on MacOSX (neither carbon nor cocoa) there is a
- CaptureMouse equivalent (in Carbon there is TrackMouseLocation
- but this is useless to use since it is blocking)
-
- However on cocoa the active frame seems to get mouse events
- also outside the window, so we'll try to forward mouse events
- to the capture frame in the hope that one of our frames
- gets a mouse event.
-
- This will break as soon as the user activates another app, but
- a mouse click will normally lead to a release of the mouse anyway.
-
- Let's see how far we get this way. Alternatively we could use one
- large overlay window like we did for the carbon implementation,
- however that is resource intensive.
- */
-
- if( bCapture )
- s_pCaptureFrame = this;
- else if( ! bCapture && s_pCaptureFrame == this )
- s_pCaptureFrame = NULL;
-}
-
-void IosSalFrame::ResetClipRegion()
-{
- if ( !mpWindow )
- {
- return;
- }
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- // release old path and indicate no clipping
- CGPathRelease( mrClippingPath );
- mrClippingPath = NULL;
-
- if( mpWindow )
- {
- [mpWindow setOpaque: YES];
- }
-}
-
-void IosSalFrame::BeginSetClipRegion( sal_uLong nRects )
-{
- if ( !mpWindow )
- {
- return;
- }
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- // release old path
- if( mrClippingPath )
- {
- CGPathRelease( mrClippingPath );
- mrClippingPath = NULL;
- }
-
- if( maClippingRects.size() > SAL_CLIPRECT_COUNT && nRects < maClippingRects.size() )
- {
- std::vector<CGRect> aEmptyVec;
- maClippingRects.swap( aEmptyVec );
- }
- maClippingRects.clear();
- maClippingRects.reserve( nRects );
-}
-
-void IosSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- if( nWidth && nHeight )
- {
- CGRect aRect = { { static_cast<CGFloat>(nX), static_cast<CGFloat>(nY) }, { static_cast<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) } };
- VCLToCocoaTouch( aRect, false );
- maClippingRects.push_back( CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height) );
- }
-}
-
-void IosSalFrame::EndSetClipRegion()
-{
- if ( !mpWindow )
- {
- return;
- }
-
- // #i113170# may not be the main thread if called from UNO API
- SalData::ensureThreadAutoreleasePool();
-
- if( ! maClippingRects.empty() )
- {
- mrClippingPath = CGPathCreateMutable();
- CGPathAddRects( mrClippingPath, NULL, &maClippingRects[0], maClippingRects.size() );
- }
- if( mpWindow )
- {
- [mpWindow setOpaque: (mrClippingPath != NULL) ? NO : YES];
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/window/salframeview.mm b/vcl/ios/source/window/salframeview.mm
deleted file mode 100644
index 0ca3441fe814..000000000000
--- a/vcl/ios/source/window/salframeview.mm
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <sal/alloca.h>
-#include <sal/macros.h>
-
-#include "vcl/window.hxx"
-#include "vcl/svapp.hxx"
-
-#include "ios/salinst.h"
-#include "coretext/salgdi.h"
-#include "ios/salframe.h"
-#include "ios/salframeview.h"
-
-#define WHEEL_EVENT_FACTOR 1.5
-
-@implementation SalFrameWindow
--(id)initWithSalFrame: (IosSalFrame*)pFrame
-{
- mpFrame = pFrame;
-#if 0
- CGRect aRect = { { pFrame->maGeometry.nX, pFrame->maGeometry.nY },
- { pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight } };
- NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ];
- [pNSWindow useOptimizedDrawing: YES]; // OSX recommendation when there are no overlapping subviews within the receiver
- return pNSWindow;
-#endif
- return nil;
-}
-
--(IosSalFrame*)getSalFrame
-{
- return mpFrame;
-}
-
--(void)displayIfNeeded
-{
- if( GetSalData() && GetSalData()->mpFirstInstance )
- {
- osl::SolarMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex();
- if( pMutex )
- {
- pMutex->acquire();
- // ??? [super displayIfNeeded];
- pMutex->release();
- }
- }
-}
-
--(BOOL)canBecomeKeyWindow
-{
- if( (mpFrame->mnStyle &
- ( SAL_FRAME_STYLE_FLOAT |
- SAL_FRAME_STYLE_TOOLTIP |
- SAL_FRAME_STYLE_INTRO
- )) == 0 )
- return YES;
- if( (mpFrame->mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) != 0 )
- return YES;
- if( (mpFrame->mnStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) )
- return YES;
- // ??? return [super canBecomeKeyWindow];
- return NO;
-}
-
--(void)windowDidBecomeKey: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
-#if 0
- static const sal_uLong nGuessDocument = SAL_FRAME_STYLE_MOVEABLE|
- SAL_FRAME_STYLE_SIZEABLE|
- SAL_FRAME_STYLE_CLOSEABLE;
-#endif
- mpFrame->CallCallback( SALEVENT_GETFOCUS, 0 );
- mpFrame->SendPaintEvent(); // repaint controls as active
- }
-}
-
--(void)windowDidResignKey: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->CallCallback(SALEVENT_LOSEFOCUS, 0);
- mpFrame->SendPaintEvent(); // repaint controls as inactive
- }
-}
-
--(void)windowDidChangeScreen: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- mpFrame->screenParametersChanged();
-}
-
--(void)windowDidMove: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->UpdateFrameGeometry();
- mpFrame->CallCallback( SALEVENT_MOVE, 0 );
- }
-}
-
--(void)windowDidResize: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->UpdateFrameGeometry();
- mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
- mpFrame->SendPaintEvent();
- }
-}
-
--(void)windowDidMiniaturize: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->mbShown = false;
- mpFrame->UpdateFrameGeometry();
- mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
- }
-}
-
--(void)windowDidDeminiaturize: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->mbShown = true;
- mpFrame->UpdateFrameGeometry();
- mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
- }
-}
-
--(BOOL)windowShouldClose: (NSNotification*)pNotification
-{
- (void)pNotification;
- YIELD_GUARD;
-
- BOOL bRet = YES;
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- // #i84461# end possible input
- mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
- if( IosSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->CallCallback( SALEVENT_CLOSE, 0 );
- bRet = NO; // application will close the window or not, AppKit shouldn't
- }
- }
-
- return bRet;
-}
-
-@end
-
-@implementation SalFrameView
-
--(id)initWithSalFrame: (IosSalFrame*)pFrame
-{
- // ???
-
- (void) pFrame;
- mfLastMagnifyTime = 0.0;
- return self;
-}
-
--(IosSalFrame*)getSalFrame
-{
- return mpFrame;
-}
-
--(BOOL)acceptsFirstResponder
-{
- return YES;
-}
-
--(BOOL)isOpaque
-{
- return mpFrame ? (mpFrame->getClipPath() != 0 ? NO : YES) : YES;
-}
-
-// helper class similar to a osl::SolarGuard for the SalYieldMutex
-// the difference is that it only does tryToAcquire instead of aquire
-// so dreaded deadlocks like #i93512# are prevented
-class TryGuard
-{
-public:
- TryGuard() { mbGuarded = ImplSalYieldMutexTryToAcquire(); }
- ~TryGuard() { if( mbGuarded ) ImplSalYieldMutexRelease(); }
- bool IsGuarded() { return mbGuarded; }
-private:
- bool mbGuarded;
-};
-
--(void)drawRect: (CGRect)aRect
-{
- // HOTFIX: #i93512# prevent deadlocks if any other thread already has the SalYieldMutex
- TryGuard aTryGuard;
- if( !aTryGuard.IsGuarded() )
- {
- // NOTE: the mpFrame access below is not guarded yet!
- // TODO: mpFrame et al need to be guarded by an independent mutex
- QuartzSalGraphics* pGraphics = (mpFrame && IosSalFrame::isAlive(mpFrame)) ? mpFrame->mpGraphics : NULL;
- if( pGraphics )
- {
- pGraphics->RefreshRect( aRect );
- }
- return;
- }
-
- if( mpFrame && IosSalFrame::isAlive( mpFrame ) )
- {
- if( mpFrame->mpGraphics )
- {
- mpFrame->mpGraphics->UpdateWindow( aRect );
- if( mpFrame->getClipPath() ) {
- // ??? [mpFrame->getWindow() invalidateShadow];
- }
- }
- }
-}
-
-@end
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/window/salmenu.cxx b/vcl/ios/source/window/salmenu.cxx
deleted file mode 100644
index 50c262e25713..000000000000
--- a/vcl/ios/source/window/salmenu.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "rtl/ustrbuf.hxx"
-
-#include "vcl/cmdevt.hxx"
-#include "vcl/floatwin.hxx"
-#include "vcl/window.hxx"
-#include "vcl/svapp.hxx"
-
-#include "ios/saldata.hxx"
-#include "ios/salinst.h"
-#include "ios/salmenu.h"
-#include "ios/salframe.h"
-
-#include "svids.hrc"
-#include "window.h"
-
-// =======================================================================
-
-SalMenu* IosSalInstance::CreateMenu( sal_Bool /*bMenuBar*/, Menu* /*pVCLMenu*/ )
-{
- // ???
- return NULL;
-}
-
-void IosSalInstance::DestroyMenu( SalMenu* pSalMenu )
-{
- delete pSalMenu;
-}
-
-SalMenuItem* IosSalInstance::CreateMenuItem( const SalItemParams* /*pItemData*/ )
-{
- // ???
- return NULL;
-}
-
-void IosSalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem )
-{
- delete pSalMenuItem;
-}
-
-
-// =======================================================================
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/window/salobj.cxx b/vcl/ios/source/window/salobj.cxx
deleted file mode 100644
index 6543f4c26ed9..000000000000
--- a/vcl/ios/source/window/salobj.cxx
+++ /dev/null
@@ -1,201 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <string.h>
-
-#include "ios/saldata.hxx"
-#include "ios/salobj.h"
-#include "ios/salframe.h"
-
-// =======================================================================
-
-IosSalObject::IosSalObject( IosSalFrame* pFrame ) :
- mpFrame( pFrame ),
- mnClipX( -1 ),
- mnClipY( -1 ),
- mnClipWidth( -1 ),
- mnClipHeight( -1 ),
- mbClip( false ),
- mnX( 0 ),
- mnY( 0 ),
- mnWidth( 20 ),
- mnHeight( 20 )
-{
- maSysData.nSize = sizeof( maSysData );
- maSysData.pView = NULL;
-
- CGRect aInitFrame = { { 0, 0 }, { 20, 20 } };
- maSysData.pView = [[UIView alloc] initWithFrame: aInitFrame];
-}
-
-// -----------------------------------------------------------------------
-
-IosSalObject::~IosSalObject()
-{
- if( maSysData.pView )
- {
- UIView *pView = maSysData.pView;
- [pView removeFromSuperview];
- [pView release];
- }
-#if 0 // ???
- if( mpClipView )
- {
- [mpClipView removeFromSuperview];
- [mpClipView release];
- }
-#endif
-}
-
-/*
- sadly there seems to be no way to impose clipping on a child view,
- especially a QTMovieView which seems to ignore the current context
- completely. Also there is no real way to shape a window; on Ios a
- similar effect to non-rectangular windows is achieved by using a
- non-opaque window and not painting where one wants the background
- to shine through.
-
- With respect to SalObject this leaves us to having an NSClipView
- containing the child view. Even a QTMovieView respects the boundaries of
- that, which gives us a clip "region" consisting of one rectangle.
- This is gives us an 80% solution only, though.
-*/
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::ResetClipRegion()
-{
- mbClip = false;
- setClippedPosSize();
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 IosSalObject::GetClipRegionType()
-{
- return SAL_OBJECT_CLIP_INCLUDERECTS;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::BeginSetClipRegion( sal_uLong )
-{
- mbClip = false;
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
-{
- if( mbClip )
- {
- if( nX < mnClipX )
- {
- mnClipWidth += mnClipX - nX;
- mnClipX = nX;
- }
- if( nX + nWidth > mnClipX + mnClipWidth )
- mnClipWidth = nX + nWidth - mnClipX;
- if( nY < mnClipY )
- {
- mnClipHeight += mnClipY - nY;
- mnClipY = nY;
- }
- if( nY + nHeight > mnClipY + mnClipHeight )
- mnClipHeight = nY + nHeight - mnClipY;
- }
- else
- {
- mnClipX = nX;
- mnClipY = nY;
- mnClipWidth = nWidth;
- mnClipHeight = nHeight;
- mbClip = true;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::EndSetClipRegion()
-{
- setClippedPosSize();
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
-{
- mnX = nX;
- mnY = nY;
- mnWidth = nWidth;
- mnHeight = nHeight;
- setClippedPosSize();
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::setClippedPosSize()
-{
- CGRect aViewRect = { { 0, 0 }, { static_cast<CGFloat>(mnWidth), static_cast<CGFloat>(mnHeight) } };
- if( maSysData.pView )
- {
- UIView *pView = maSysData.pView;
- [pView setFrame: aViewRect];
- }
-
- CGRect aClipViewRect = { { static_cast<CGFloat>(mnX), static_cast<CGFloat>(mnY) }, { static_cast<CGFloat>(mnWidth), static_cast<CGFloat>(mnHeight) } };
- CGPoint aClipPt = { 0, 0 };
- if( mbClip )
- {
- aClipViewRect.origin.x += mnClipX;
- aClipViewRect.origin.y += mnClipY;
- aClipViewRect.size.width = mnClipWidth;
- aClipViewRect.size.height = mnClipHeight;
- aClipPt.x = mnClipX;
- if( mnClipY == 0 )
- aClipPt.y = mnHeight - mnClipHeight;
- }
-
- mpFrame->VCLToCocoaTouch( aClipViewRect, false );
-#if 0 // ???
- [mpClipView setFrame: aClipViewRect];
-
- [mpClipView scrollToPoint: aClipPt];
-#endif
-}
-
-// -----------------------------------------------------------------------
-
-void IosSalObject::Show( sal_Bool /*bVisible*/ )
-{
-#if 0 // ???
- if( mpClipView )
- [mpClipView setHidden: (bVisible ? NO : YES)];
-#endif
-}
-
-// -----------------------------------------------------------------------
-
-const SystemEnvData* IosSalObject::GetSystemData() const
-{
- return &maSysData;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index 9211c5221f87..4cfccb04bd6f 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -25,11 +25,16 @@
#include "tools/color.hxx"
-#include "vcl/bitmap.hxx" // for BitmapSystemData
+#include "vcl/bitmap.hxx"
#include "vcl/salbtype.hxx"
#include "quartz/salbmp.h"
-//#include "aqua/salinst.h"
+
+#ifdef MACOSX
+#include "aqua/saldata.hxx"
+#else
+#include "saldatabasic.hxx"
+#endif
#include "bmpfast.hxx"
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
new file mode 100644
index 000000000000..c2db4d24b814
--- /dev/null
+++ b/vcl/quartz/utils.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <rtl/alloc.h>
+#include <rtl/ustrbuf.hxx>
+
+#include "quartz/utils.h"
+
+rtl::OUString GetOUString( CFStringRef rStr )
+{
+ if( rStr == 0 )
+ return rtl::OUString();
+ CFIndex nLength = CFStringGetLength( rStr );
+ if( nLength == 0 )
+ return rtl::OUString();
+ const UniChar* pConstStr = CFStringGetCharactersPtr( rStr );
+ if( pConstStr )
+ return rtl::OUString( pConstStr, nLength );
+ UniChar* pStr = reinterpret_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) );
+ CFRange aRange = { 0, nLength };
+ CFStringGetCharacters( rStr, aRange, pStr );
+ rtl::OUString aRet( pStr, nLength );
+ rtl_freeMemory( pStr );
+ return aRet;
+}
+
+rtl::OUString GetOUString( NSString* pStr )
+{
+ if( ! pStr )
+ return rtl::OUString();
+ int nLen = [pStr length];
+ if( nLen == 0 )
+ return rtl::OUString();
+
+ rtl::OUStringBuffer aBuf( nLen+1 );
+ aBuf.setLength( nLen );
+ [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
+ return aBuf.makeStringAndClear();
+}
+
+CFStringRef CreateCFString( const rtl::OUString& rStr )
+{
+ return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() );
+}
+
+NSString* CreateNSString( const rtl::OUString& rStr )
+{
+ return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()];
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index 9332bf11ac14..fee36d473054 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -223,9 +223,6 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava )
// FIXME: this is wrong
nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView );
(void)bUseJava;
-#elif defined IOS
- // FIXME: this is wrong
- nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView );
#elif defined UNX
if( !bUseJava )
{
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index dc3ca9ab6f1a..1a478e6ba2de 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8325,6 +8325,8 @@ uno::Reference< XDragSource > Window::GetDragSource()
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+#if !defined(ANDROID) && !defined(IOS)
+
if( mpWindowImpl->mpFrameData )
{
if( ! mpWindowImpl->mpFrameData->mxDragSource.is() )
@@ -8350,16 +8352,6 @@ uno::Reference< XDragSource > Window::GetDragSource()
aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget");
aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
-#elif defined IOS
- /* What does LibreOffice's use of DND concepts mean on
- * iOS, huh, is this both inter-app DND (which clearly is
- * meaningless), or intra-app? Anyway, use the same code
- * as for MacOSX for now, even if meaningless...
- */
- aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource");
- aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget");
- aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
- aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
#elif defined UNX
aDropTargetAL.realloc( 3 );
aDragSourceAL.realloc( 3 );
@@ -8391,7 +8383,7 @@ uno::Reference< XDragSource > Window::GetDragSource()
return mpWindowImpl->mpFrameData->mxDragSource;
}
-
+#endif
return uno::Reference< XDragSource > ();
}