Rebased ref, commits from common ancestor: commit 494f7aba24375934021c9aced14f7eb6ef19138e Author: Douglas Mencken <dougmenc...@gmail.com> Date: Wed Oct 8 10:38:28 2014 -0400
use GNU objc ABI/runtime instead of NeXT ABI/runtime when compiler is GCC with workaround for "cannot find interface declaration for NXConstantString" also, + include <objc/objc-api.h> when OBJC_EXPORT is not defined + include <objc/message.h> for objc_msgSend Change-Id: I5f0df322435be8244d372642dee1c21d783306f1 diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index d952518..143a1bd 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -215,6 +215,9 @@ #ifdef MACOSX #define __OPENTRANSPORTPROVIDERS__ // these are already defined #define TimeValue CFTimeValue // Do not conflict with TimeValue in sal/inc/osl/time.h +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <Carbon/Carbon.h> #undef TimeValue # ifndef ETIME diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 185fb26..52a0b5a 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -59,9 +59,21 @@ gb_CXXFLAGS := \ # these are to get g++ to switch to Objective-C++ mode # (see toolkit module for a case where it is necessary to do it this way) -gb_OBJCXXFLAGS := -x objective-c++ -fobjc-exceptions - -gb_OBJCFLAGS := -x objective-c -fobjc-exceptions +gb_OBJCXXFLAGS := \ + -x objective-c++ \ + -fobjc-exceptions \ + $(if $(filter TRUE,$(COM_GCC_IS_CLANG)),,\ + -fgnu-runtime \ + -fconstant-string-class=NSConstantString \ + ) + +gb_OBJCFLAGS := \ + -x objective-c \ + -fobjc-exceptions \ + $(if $(filter TRUE,$(COM_GCC_IS_CLANG)),,\ + -fgnu-runtime \ + -fconstant-string-class=NSConstantString \ + ) # LinkTarget class diff --git a/vcl/inc/osx/a11yfactory.h b/vcl/inc/osx/a11yfactory.h index c739f3e..4e92126 100644 --- a/vcl/inc/osx/a11yfactory.h +++ b/vcl/inc/osx/a11yfactory.h @@ -20,6 +20,10 @@ #ifndef INCLUDED_VCL_INC_OSX_A11YFACTORY_H #define INCLUDED_VCL_INC_OSX_A11YFACTORY_H +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif + #include "osxvcltypes.h" #include "a11ywrapper.h" #include <com/sun/star/accessibility/XAccessibleContext.hpp> diff --git a/vcl/inc/osx/osxvcltypes.h b/vcl/inc/osx/osxvcltypes.h index f1659c4..96edccc 100644 --- a/vcl/inc/osx/osxvcltypes.h +++ b/vcl/inc/osx/osxvcltypes.h @@ -21,6 +21,9 @@ #define INCLUDED_VCL_INC_OSX_OSXVCLTYPES_H #include "premac.h" +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #import <Cocoa/Cocoa.h> #import <AppKit/NSEvent.h> #include "postmac.h" diff --git a/vcl/inc/osx/printview.h b/vcl/inc/osx/printview.h index e396bd8..b63900b 100644 --- a/vcl/inc/osx/printview.h +++ b/vcl/inc/osx/printview.h @@ -21,6 +21,9 @@ #define INCLUDED_VCL_INC_OSX_PRINTVIEW_H #include "premac.h" +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <Cocoa/Cocoa.h> #include "postmac.h" diff --git a/vcl/inc/osx/saldata.hxx b/vcl/inc/osx/saldata.hxx index 413754b..1665b06 100644 --- a/vcl/inc/osx/saldata.hxx +++ b/vcl/inc/osx/saldata.hxx @@ -23,6 +23,9 @@ #include <config_features.h> #include "premac.h" +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <Cocoa/Cocoa.h> #include "postmac.h" diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h index 8a88a26..4efcbe0 100644 --- a/vcl/inc/osx/salinst.h +++ b/vcl/inc/osx/salinst.h @@ -25,6 +25,9 @@ #include "osl/conditn.h" #ifdef MACOSX +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include "osx/osxvcltypes.h" #endif diff --git a/vcl/inc/osx/saltimer.h b/vcl/inc/osx/saltimer.h index b751a81..e663c65 100644 --- a/vcl/inc/osx/saltimer.h +++ b/vcl/inc/osx/saltimer.h @@ -21,6 +21,9 @@ #define INCLUDED_VCL_INC_OSX_SALTIMER_H #include "premac.h" +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <Cocoa/Cocoa.h> #include "postmac.h" diff --git a/vcl/inc/osx/vclnsapp.h b/vcl/inc/osx/vclnsapp.h index 541b509..675cacc 100644 --- a/vcl/inc/osx/vclnsapp.h +++ b/vcl/inc/osx/vclnsapp.h @@ -23,6 +23,9 @@ #include <config_features.h> #include "premac.h" +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include "Cocoa/Cocoa.h" #include "postmac.h" diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index e408250..ac264ec 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -23,6 +23,9 @@ #include <iostream> #include <premac.h> +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <CoreFoundation/CoreFoundation.h> #include <Foundation/Foundation.h> #ifdef MACOSX diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx index 33bd19b..429330c 100644 --- a/vcl/osx/DataFlavorMapping.cxx +++ b/vcl/osx/DataFlavorMapping.cxx @@ -36,6 +36,9 @@ #include <string.h> #include <premac.h> +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <Cocoa/Cocoa.h> #include <postmac.h> diff --git a/vcl/osx/DataFlavorMapping.hxx b/vcl/osx/DataFlavorMapping.hxx index a3cff1c..31f4eb5 100644 --- a/vcl/osx/DataFlavorMapping.hxx +++ b/vcl/osx/DataFlavorMapping.hxx @@ -26,6 +26,9 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <premac.h> +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #import <Cocoa/Cocoa.h> #include <postmac.h> diff --git a/vcl/osx/DragActionConversion.hxx b/vcl/osx/DragActionConversion.hxx index fbb5ea3..b77047d 100644 --- a/vcl/osx/DragActionConversion.hxx +++ b/vcl/osx/DragActionConversion.hxx @@ -23,6 +23,9 @@ #include <sal/types.h> #include <premac.h> +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #import <Cocoa/Cocoa.h> #include <postmac.h> diff --git a/vcl/osx/DragSource.hxx b/vcl/osx/DragSource.hxx index 491716d..403ed51 100644 --- a/vcl/osx/DragSource.hxx +++ b/vcl/osx/DragSource.hxx @@ -33,6 +33,9 @@ #include <boost/utility.hpp> #include <premac.h> +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #import <Cocoa/Cocoa.h> #include <postmac.h> diff --git a/vcl/osx/PictToBmpFlt.cxx b/vcl/osx/PictToBmpFlt.cxx index 77c67a6..097050e 100644 --- a/vcl/osx/PictToBmpFlt.cxx +++ b/vcl/osx/PictToBmpFlt.cxx @@ -18,6 +18,9 @@ */ #include <premac.h> +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <Carbon/Carbon.h> #include <QuickTime/QuickTime.h> #include <postmac.h> diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index b9a7ac1..f947566 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -38,6 +38,7 @@ #include "quartz/utils.h" #if MACOSX_SDK_VERSION < 1060 +#include <objc/message.h> #include "vcl/timer.hxx" #include "osx/saltimer.h" #endif @@ -45,6 +46,9 @@ #include "salwtype.hxx" #include "premac.h" +#ifndef OBJC_EXPORT +#include <objc/objc-api.h> +#endif #include <objc/objc-runtime.h> // needed for theming // FIXME: move theming code to salnativewidgets.cxx commit 9d9dfb943561120896513c23efa54aee63bca069 Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sat Oct 25 05:13:09 2014 -0400 Revert another "is always >= 1080" commit reverted commit: fe25090e992eefd0c43ca73b656632a650793b1a use MACOSX_SDK_VERSION instead of MAC_OS_X_VERSION_MIN_ALLOWED Change-Id: Ib6e63e664dc073a8d751306f613e8be4918c406a diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index 1a0a0a3..f292437 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -45,7 +45,7 @@ $(call gb_ExternalProject_get_state_target,curl,build): $(if $(filter IOS MACOSX,$(OS)),,--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out")) \ $(if $(filter IOS,$(OS)),--with-darwinssl) \ $(if $(filter MACOSX,$(OS)),\ - --with-darwinssl) \ + $(if $(filter 1050,$(MACOSX_SDK_VERSION)),,--with-darwinssl)) \ --without-ssl \ --without-libidn --enable-ftp --enable-ipv6 --enable-http --disable-gopher \ --disable-file --disable-ldap --disable-telnet --disable-dict --without-libssh2 \ diff --git a/external/nss/ExternalPackage_nss.mk b/external/nss/ExternalPackage_nss.mk index c6d8953fd..986565e 100644 --- a/external/nss/ExternalPackage_nss.mk +++ b/external/nss/ExternalPackage_nss.mk @@ -26,6 +26,7 @@ $(eval $(call gb_ExternalPackage_add_files,nss,$(LIBO_LIB_FOLDER),\ dist/out/lib/libsmime3.dylib \ dist/out/lib/libsoftokn3.dylib \ dist/out/lib/libssl3.dylib \ + $(if $(filter 1050,$(MACOSX_SDK_VERSION)),dist/out/lib/libsqlite3.dylib) \ )) else ifeq ($(OS),WNT) $(eval $(call gb_ExternalPackage_add_files,nss,$(LIBO_LIB_FOLDER),\ diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk index f518bb4..c87bbf0 100644 --- a/external/nss/ExternalProject_nss.mk +++ b/external/nss/ExternalProject_nss.mk @@ -65,7 +65,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalProject $(if $(filter arm64,$(CC)),USE_64=1)) \ $(if $(filter MACOSX,$(OS)),\ $(if $(filter-out POWERPC,$(CPUNAME)),MACOS_SDK_DIR=$(MACOSX_SDK_PATH)) \ - NSS_USE_SYSTEM_SQLITE=1) \ + $(if $(filter-out 1050,$(MACOSX_SDK_VERSION)),NSS_USE_SYSTEM_SQLITE=1)) \ $(if $(filter SOLARIS,$(OS)),NS_USE_GCC=1) \ $(if $(CROSS_COMPILING),\ $(if $(filter MACOSXPOWERPC,$(OS)$(CPUNAME)),CPU_ARCH=ppc) \ diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk index 045892e..54a9ad1 100644 --- a/external/python3/ExternalProject_python3.mk +++ b/external/python3/ExternalProject_python3.mk @@ -69,8 +69,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) : $(if $(filter WNT-GCC,$(OS)-$(COM)),--with-threads ac_cv_printf_zd_format=no) \ $(if $(filter MACOSX,$(OS)), \ $(if $(filter INTEL,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) \ - --with-universal-archs=intel \ - ) \ + $(if $(filter 1050,$(MACOSX_SDK_VERSION)),--with-universal-archs=32-bit,--with-universal-archs=intel) \ + ) \ --enable-framework=/@__________________________________________________OOO --with-framework-name=LibreOfficePython, \ --enable-shared \ ) \ diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm index 2eac5b3..86d1da3 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -307,7 +307,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno:: SolarMutexGuard aGuard; -#if HAVE_FEATURE_MACOSX_SANDBOX +#if MACOSX_SDK_VERSION >= 1070 && HAVE_FEATURE_MACOSX_SANDBOX static NSUserDefaults *userDefaults; static bool triedUserDefaults = false; @@ -341,7 +341,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno:: { NSURL *url = [files objectAtIndex:nIndex]; -#if HAVE_FEATURE_MACOSX_SANDBOX +#if MACOSX_SDK_VERSION >= 1070 && HAVE_FEATURE_MACOSX_SANDBOX if (userDefaults != NULL && [url respondsToSelector:@selector(bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:)]) { diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 995b936..dd0d3f1 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -35,7 +35,7 @@ inline rtl::OString OUStringToOString(const rtl_uString* s) osl_getThreadTextEncoding()); } -#if HAVE_FEATURE_MACOSX_SANDBOX +#if defined(MACOSX) && MACOSX_SDK_VERSION >= 1070 && HAVE_FEATURE_MACOSX_SANDBOX #include <Foundation/Foundation.h> #include <Security/Security.h> @@ -289,7 +289,7 @@ int open_c(const char *cpPath, int oflag, int mode) int result = open(cpPath, oflag, mode); -#if HAVE_FEATURE_MACOSX_SANDBOX +#if defined(MACOSX) && MACOSX_SDK_VERSION >= 1070 && HAVE_FEATURE_MACOSX_SANDBOX if (isSandboxed && result != -1 && (oflag & O_CREAT) && (oflag & O_EXCL)) { // A new file was created. Check if it is outside the sandbox. commit fa28aa5d38d62e4cdfadd67a2f827a2bf9ad309e Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sat Oct 25 04:23:02 2014 -0400 Use MACOSX_SDK_VERSION instead of MAC_OS_X_VERSION_MAX_ALLOWED Change-Id: If24adf787821b2f83a7ecf8806f4d36b9eb7dbdc diff --git a/fpicker/source/aqua/FilterHelper.mm b/fpicker/source/aqua/FilterHelper.mm index d162af3..e078fb6 100644 --- a/fpicker/source/aqua/FilterHelper.mm +++ b/fpicker/source/aqua/FilterHelper.mm @@ -385,7 +385,7 @@ bool FilterHelper::filenameMatchesFilter(NSString* sFilename) } NSFileManager *manager = [NSFileManager defaultManager]; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 NSDictionary* pAttribs = [manager fileAttributesAtPath: sFilename traverseLink: NO]; #else NSDictionary* pAttribs = [manager attributesOfItemAtPath: sFilename error: nil]; diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm index 80acb10..8de8b7e 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.mm +++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm @@ -83,7 +83,7 @@ NSString* resolveAlias( NSString* i_pSystemPath ) kCFURLPOSIXPathStyle, false); if( rUrl != NULL ) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 FSRef rFS; if( CFURLGetFSRef( rUrl, &rFS ) ) { diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm index 144ead6..2eac5b3 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -769,7 +769,7 @@ void SalAquaFilePicker::updateSaveFileNameExtension() { rtl::OUString suffix = (*(aStringList.begin())).copy(1); NSString *requiredFileType = [NSString stringWithOUString:suffix]; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 [m_pDialog setRequiredFileType:requiredFileType]; #else [m_pDialog setAllowedFileTypes:[NSArray arrayWithObjects:requiredFileType, nil]]; diff --git a/fpicker/source/aqua/SalAquaPicker.mm b/fpicker/source/aqua/SalAquaPicker.mm index baff7c3..6c224d9 100644 --- a/fpicker/source/aqua/SalAquaPicker.mm +++ b/fpicker/source/aqua/SalAquaPicker.mm @@ -165,7 +165,7 @@ int SalAquaPicker::run() int retVal = 0; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 NSString *startDirectory; if (m_sDisplayDirectory.getLength() > 0) { NSString *temp = [NSString stringWithOUString:m_sDisplayDirectory]; @@ -193,7 +193,7 @@ int SalAquaPicker::run() switch(m_nDialogType) { case NAVIGATIONSERVICES_DIRECTORY: case NAVIGATIONSERVICES_OPEN: -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 retVal = [(NSOpenPanel*)m_pDialog runModalForDirectory:startDirectory file:nil types:nil]; #else [m_pDialog setDirectoryURL:startDirectory]; @@ -201,7 +201,7 @@ int SalAquaPicker::run() #endif break; case NAVIGATIONSERVICES_SAVE: -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 retVal = [m_pDialog runModalForDirectory:startDirectory file:[NSString stringWithOUString:((SalAquaFilePicker*)this)->getSaveFileName()]]; #else [m_pDialog setDirectoryURL:startDirectory]; @@ -215,7 +215,7 @@ int SalAquaPicker::run() } if (retVal == NSFileHandlingPanelOKButton) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 NSString* pDir = [m_pDialog directory]; if (pDir) { implsetDisplayDirectory([[NSURL fileURLWithPath:pDir] OUStringForInfo:FULLPATH]); diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm index 868026c..25f8f0d 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm @@ -350,7 +350,7 @@ Reference< XSpellAlternatives > aLang = [aLang stringByAppendingString:aTaggedCountry]; } [macSpell setLanguage:aLang]; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 NSArray *guesses = [macSpell guessesForWord:aNSStr]; #else NSArray *guesses = [macSpell guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr language:aLang inSpellDocumentWithTag:0]; diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index a234fce..696e97f 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -157,7 +157,7 @@ int macxp_resolveAlias(char *path, int buflen) (void) buflen; return 0; #else -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 FSRef aFSRef; OSStatus nErr; Boolean bFolder; @@ -181,7 +181,7 @@ int macxp_resolveAlias(char *path, int buflen) if ( unprocessedPath ) *unprocessedPath = '\0'; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 nErr = noErr; bFolder = FALSE; bAliased = FALSE; diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 82bd117..47c1c91 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -93,7 +93,7 @@ public: sal_uLong mnICOptions; // To prevent display sleep during presentation -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 boost::shared_ptr< Timer > mpActivityTimer; #else IOPMAssertionID mnAssertionID; diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h index 7e957b6..d125743 100644 --- a/vcl/inc/osx/salframeview.h +++ b/vcl/inc/osx/salframeview.h @@ -22,7 +22,7 @@ #include "osx/a11ywrapper.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 @interface SalFrameWindow : NSWindow #else @interface SalFrameWindow : NSWindow<NSWindowDelegate> @@ -63,7 +63,7 @@ -(void)unregisterDraggingDestinationHandler:(id)theHandler; @end -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 @interface SalFrameView : AquaA11yWrapper <NSTextInput> #else @interface SalFrameView : AquaA11yWrapper <NSTextInputClient> @@ -121,7 +121,7 @@ /* text action methods */ -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 -(void)insertText:(id)aString; #else -(void)insertText:(id)aString replacementRange:(NSRange)replacementRange; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 45a12c4..1e823e5 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -30,7 +30,7 @@ #include "osx/osxvcltypes.h" #include "osx/salframe.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 // The following symbols are SPI (System Programming Interface) in 10.5. extern "C" { void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); diff --git a/vcl/osx/DropTarget.cxx b/vcl/osx/DropTarget.cxx index e8179a9..2147cb9 100644 --- a/vcl/osx/DropTarget.cxx +++ b/vcl/osx/DropTarget.cxx @@ -264,13 +264,13 @@ NSDragOperation DropTarget::draggingUpdated(id sender) } if (dragOp == NSDragOperationNone) -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 SetThemeCursor(kThemeNotAllowedCursor); #else [[NSCursor operationNotAllowedCursor] set]; #endif else if (dragOp == NSDragOperationCopy) -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 SetThemeCursor(kThemeCopyArrowCursor); #else [[NSCursor dragCopyCursor] set]; diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 43a0674..b9a7ac1 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -37,7 +37,7 @@ #include "osx/a11yfactory.h" #include "quartz/utils.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 #include "vcl/timer.hxx" #include "osx/saltimer.h" #endif @@ -198,7 +198,7 @@ void AquaSalFrame::initWindowAndView() [mpNSWindow setAcceptsMouseMovedEvents: YES]; [mpNSWindow setHasShadow: YES]; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 objc_msgSend(mpNSWindow, @selector(setDelegate:), mpNSWindow); #else [mpNSWindow setDelegate: static_cast<id<NSWindowDelegate> >(mpNSWindow)]; @@ -759,7 +759,7 @@ void AquaSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) SendPaintEvent(); } -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 class PreventSleepTimer : public AutoTimer { public: @@ -791,7 +791,7 @@ void AquaSalFrame::StartPresentation( bool bStart ) if( bStart ) { GetSalData()->maPresentationFrames.push_back( this ); -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 mpActivityTimer.reset( new PreventSleepTimer() ); #else /* OS X 10.6 and above */ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, @@ -806,7 +806,7 @@ void AquaSalFrame::StartPresentation( bool bStart ) else { GetSalData()->maPresentationFrames.remove( this ); -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 mpActivityTimer.reset(); #else IOPMAssertionRelease(mnAssertionID); diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 8e74086..19dda57 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -166,7 +166,7 @@ static const struct ExceptionalKey static AquaSalFrame* getMouseContainerFrame() { AquaSalFrame* pDispatchFrame = NULL; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 NSInteger nWindows = 0; NSCountWindows( &nWindows ); NSInteger* pWindows = (NSInteger*)alloca( nWindows * sizeof(NSInteger) ); @@ -776,7 +776,7 @@ private: if( bNewSeries ) mfMagnifyDeltaSum = 0.0; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 mfMagnifyDeltaSum += [pEvent deltaZ]; #else mfMagnifyDeltaSum += [pEvent magnification]; @@ -784,7 +784,7 @@ private: mfLastMagnifyTime = [pEvent timestamp]; // TODO: change to 0.1 when COMMAND_WHEEL_ZOOM handlers allow finer zooming control -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 static const float fMagnifyFactor = 0.25; #else static const float fMagnifyFactor = 0.25*500; // steps are 500 times smaller for -magnification @@ -1041,13 +1041,13 @@ private: } } -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 -(void)insertText:(id)aString #else -(void)insertText:(id)aString replacementRange:(NSRange)replacementRange #endif { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 (void) replacementRange; // FIXME: surely it must be used #endif @@ -1619,13 +1619,13 @@ private: return mSelectedRange; } -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange #else - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange replacementRange:(NSRange)replacementRange #endif { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 (void) replacementRange; // FIXME - use it! #endif @@ -1697,14 +1697,14 @@ private: mSelectedRange = mMarkedRange = NSMakeRange(NSNotFound, 0); } -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 - (NSAttributedString *)attributedSubstringFromRange:(NSRange)aRange #else - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange #endif { (void) aRange; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 (void) actualRange; #endif @@ -1750,7 +1750,7 @@ private: mpLastEvent = nil; } -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 - (NSRect)firstRectForCharacterRange:(NSRange)aRange #else - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange @@ -1758,7 +1758,7 @@ private: { // FIXME - These should probably be used? (void) aRange; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 (void) actualRange; #endif diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index d8adf03..4336b4c 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -1046,7 +1046,7 @@ NSImage* CreateNSImage( const Image& rImage ) NSImage* pImage = [[NSImage alloc] initWithSize: NSMakeSize( aSize.Width(), aSize.Height() )]; if( pImage ) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 [pImage setFlipped:YES]; [pImage lockFocus]; #else diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index 37a936b..87d824f 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -246,7 +246,7 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) : if( ! mbMenuBar ) { mpMenu = [[SalNSMenu alloc] initWithMenu: this]; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 objc_msgSend(mpMenu, @selector(setDelegate:), mpMenu); #else [mpMenu setDelegate: (id<NSMenuDelegate>)mpMenu]; diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 52c0902..c6f77c7 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -462,7 +462,7 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName, { [mpPrintInfo setJobDisposition: NSPrintSaveJob]; NSString* pPath = CreateNSString( *i_pFileName ); -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 [pPrintDict setObject:[NSURL fileURLWithPath:pPath] forKey:NSPrintSavePath]; #else [pPrintDict setObject:[NSURL fileURLWithPath:pPath] forKey:NSPrintJobSavingURL]; diff --git a/vcl/quartz/CTRunData.hxx b/vcl/quartz/CTRunData.hxx index b6d1a1d..a0666e5 100644 --- a/vcl/quartz/CTRunData.hxx +++ b/vcl/quartz/CTRunData.hxx @@ -12,7 +12,7 @@ #include "premac.h" #if defined(MACOSX) && MACOSX_SDK_VERSION < 1080 #include <ApplicationServices/ApplicationServices.h> -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 // The following symbols are SPI (System Programming Interface) in 10.5 extern "C" { void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 38cf249..699dff7 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -83,7 +83,7 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD ) ((mpFontData->GetWeight() < WEIGHT_SEMIBOLD) && (mpFontData->GetWeight() != WEIGHT_DONTKNOW)) ) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 int nStroke = -10.0; CFNumberRef rStroke = CFNumberCreate(NULL, kCFNumberSInt32Type, &nStroke); CFDictionarySetValue(mpStyleDict, kCTStrokeWidthAttributeName, rStroke); @@ -323,7 +323,7 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool // get font-enabled status if( bFontEnabled ) { int bEnabled = TRUE; // by default (and when we're on OS X < 10.6) it's "enabled" -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 CFNumberRef pEnabled = (CFNumberRef)CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute ); CFNumberGetValue( pEnabled, kCFNumberIntType, &bEnabled ); #endif diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index cd9771a..a2cebe1 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -267,7 +267,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) // - CoreText handles spaces specially (in particular at the text end) if( mnTrailingSpaceCount ) { -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 +#if MACOSX_SDK_VERSION < 1070 // don't recreate line layout here, because this can lead to problems // (looks like internal issues inside early CoreText versions) mfTrailingSpaceWidth = CTLineGetTrailingWhitespaceWidth( mpCTLine ); @@ -304,7 +304,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) mfBaseAdv = mfTrailingSpaceWidth; } } -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 +#if MACOSX_SDK_VERSION < 1070 CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth - mfTrailingSpaceWidth ); #else CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth); @@ -323,7 +323,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) SAL_INFO( "vcl.ct", "CFRelease(" << mpCTLine << ")" ); CFRelease( mpCTLine ); mpCTLine = pNewCTLine; -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 +#if MACOSX_SDK_VERSION < 1070 mfCachedWidth = nPixelWidth; #else mfCachedWidth = nPixelWidth + mfTrailingSpaceWidth; @@ -382,7 +382,7 @@ bool CTLayout::DrawTextSpecial( SalGraphics& rGraphics, sal_uInt32 flags ) const CFDictionaryGetCount(mpTextStyle->GetStyleDict()), mpTextStyle->GetStyleDict()); -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MACOSX_SDK_VERSION < 1060 /* just don't do 'kCTStrokeWidthAttributeName' */ #else int nStroke = 2; diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index d33e570..f61d7ed 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -339,7 +339,7 @@ static bool AddTempDevFont(const OUString& rFontFileURL) bool success = false; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#if MACOSX_SDK_VERSION >= 1060 CFErrorRef error; success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, &error); if (!success) commit 89b8cad00d50a06ab4abb261885901ed1823590e Author: Douglas Mencken <dougmenc...@gmail.com> Date: Sat Oct 25 03:58:37 2014 -0400 Revert "MAC_OS_X_VERSION_MAX_ALLOWED is always >= 1080 now" This reverts commit b02e958fa0bf7d062a5b8aff03d22325e3068feb. Change-Id: Ia7bf904071ac93f31c999433c74369c56c74c470 diff --git a/fpicker/source/aqua/FilterHelper.mm b/fpicker/source/aqua/FilterHelper.mm index cef9074..d162af3 100644 --- a/fpicker/source/aqua/FilterHelper.mm +++ b/fpicker/source/aqua/FilterHelper.mm @@ -385,7 +385,11 @@ bool FilterHelper::filenameMatchesFilter(NSString* sFilename) } NSFileManager *manager = [NSFileManager defaultManager]; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + NSDictionary* pAttribs = [manager fileAttributesAtPath: sFilename traverseLink: NO]; +#else NSDictionary* pAttribs = [manager attributesOfItemAtPath: sFilename error: nil]; +#endif if( pAttribs ) { NSObject* pType = [pAttribs objectForKey: NSFileType]; diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm index 858eb27..80acb10 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.mm +++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm @@ -83,6 +83,25 @@ NSString* resolveAlias( NSString* i_pSystemPath ) kCFURLPOSIXPathStyle, false); if( rUrl != NULL ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + FSRef rFS; + if( CFURLGetFSRef( rUrl, &rFS ) ) + { + Boolean bIsFolder = false; + Boolean bAlias = false; + OSErr err = FSResolveAliasFile( &rFS, true, &bIsFolder, &bAlias); + if( (err == noErr) && bAlias ) + { + CFURLRef rResolvedUrl = CFURLCreateFromFSRef( kCFAllocatorDefault, &rFS ); + if( rResolvedUrl != NULL ) + { + pResolvedPath = (NSString*)CFURLCopyFileSystemPath( rResolvedUrl, kCFURLPOSIXPathStyle ); + CFRelease( rResolvedUrl ); + } + } + } + CFRelease( rUrl ); +#else CFErrorRef rError; CFDataRef rBookmark = CFURLCreateBookmarkDataFromFile( NULL, rUrl, &rError ); CFRelease( rUrl ); @@ -102,6 +121,7 @@ NSString* resolveAlias( NSString* i_pSystemPath ) CFRelease( rResolvedUrl ); } } +#endif } return pResolvedPath; diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm index 11e5ee6..144ead6 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -769,7 +769,11 @@ void SalAquaFilePicker::updateSaveFileNameExtension() { rtl::OUString suffix = (*(aStringList.begin())).copy(1); NSString *requiredFileType = [NSString stringWithOUString:suffix]; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + [m_pDialog setRequiredFileType:requiredFileType]; +#else [m_pDialog setAllowedFileTypes:[NSArray arrayWithObjects:requiredFileType, nil]]; +#endif OSL_TRACE("disallowing other file types"); [m_pDialog setAllowsOtherFileTypes:NO]; diff --git a/fpicker/source/aqua/SalAquaPicker.mm b/fpicker/source/aqua/SalAquaPicker.mm index 664088f..baff7c3 100644 --- a/fpicker/source/aqua/SalAquaPicker.mm +++ b/fpicker/source/aqua/SalAquaPicker.mm @@ -165,6 +165,19 @@ int SalAquaPicker::run() int retVal = 0; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + NSString *startDirectory; + if (m_sDisplayDirectory.getLength() > 0) { + NSString *temp = [NSString stringWithOUString:m_sDisplayDirectory]; + NSURL *url = [NSURL URLWithString:temp]; + startDirectory = [url path]; + + OSL_TRACE("start dir: %s", [startDirectory UTF8String]); + } + else { + startDirectory = NSHomeDirectory(); + } +#else NSURL *startDirectory; if (m_sDisplayDirectory.getLength() > 0) { NSString *temp = [NSString stringWithOUString:m_sDisplayDirectory]; @@ -175,17 +188,26 @@ int SalAquaPicker::run() else { startDirectory = [NSURL fileURLWithPath:NSHomeDirectory() isDirectory:YES]; } +#endif switch(m_nDialogType) { case NAVIGATIONSERVICES_DIRECTORY: case NAVIGATIONSERVICES_OPEN: +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + retVal = [(NSOpenPanel*)m_pDialog runModalForDirectory:startDirectory file:nil types:nil]; +#else [m_pDialog setDirectoryURL:startDirectory]; retVal = [(NSOpenPanel*)m_pDialog runModal]; +#endif break; case NAVIGATIONSERVICES_SAVE: +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + retVal = [m_pDialog runModalForDirectory:startDirectory file:[NSString stringWithOUString:((SalAquaFilePicker*)this)->getSaveFileName()]]; +#else [m_pDialog setDirectoryURL:startDirectory]; [m_pDialog setNameFieldStringValue:[NSString stringWithOUString:((SalAquaFilePicker*)this)->getSaveFileName()]]; retVal = [m_pDialog runModal]; +#endif break; // [m_pDialog beginSheetForDirectory:startDirectory file:[m_pDialog saveFilename] modalForWindow:[NSApp keyWindow] modalDelegate:((SalAquaFilePicker*)this)->getDelegate() didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; default: @@ -193,10 +215,17 @@ int SalAquaPicker::run() } if (retVal == NSFileHandlingPanelOKButton) { +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + NSString* pDir = [m_pDialog directory]; + if (pDir) { + implsetDisplayDirectory([[NSURL fileURLWithPath:pDir] OUStringForInfo:FULLPATH]); + } +#else NSURL* pDir = [m_pDialog directoryURL]; if (pDir) { implsetDisplayDirectory([pDir OUStringForInfo:FULLPATH]); } +#endif } DBG_PRINT_EXIT(CLASS_NAME, __func__, retVal); diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm index aa06d13..868026c 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm @@ -350,7 +350,11 @@ Reference< XSpellAlternatives > aLang = [aLang stringByAppendingString:aTaggedCountry]; } [macSpell setLanguage:aLang]; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + NSArray *guesses = [macSpell guessesForWord:aNSStr]; +#else NSArray *guesses = [macSpell guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr language:aLang inSpellDocumentWithTag:0]; +#endif count = [guesses count]; if (count) { diff --git a/sal/osl/unx/memory.c b/sal/osl/unx/memory.c index e9fb9a8..f31c28c 100644 --- a/sal/osl/unx/memory.c +++ b/sal/osl/unx/memory.c @@ -24,6 +24,13 @@ void* osl_aligned_alloc( sal_Size align, sal_Size size ) { #if defined __ANDROID__ return memalign(align, size); +#elif defined MAC_OS_X_VERSION_MAX_ALLOWED && MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + void* ptr = malloc(size + (align - 1) + sizeof(void*)); + if (!ptr) return NULL; + char* aptr = ((char*)ptr) + sizeof(void*); + aptr += (align - ((size_t)aptr & (align - 1))) & (align - 1); + ((void**)aptr)[-1] = ptr; + return aptr; #else void* ptr; int err = posix_memalign(&ptr, align, size); @@ -34,7 +41,11 @@ void* osl_aligned_alloc( sal_Size align, sal_Size size ) void osl_aligned_free( void* p ) { +#if defined MAC_OS_X_VERSION_MAX_ALLOWED && MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + free(((void**)p)[-1]); +#else free(p); +#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index cb5734d..a234fce 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -157,10 +157,17 @@ int macxp_resolveAlias(char *path, int buflen) (void) buflen; return 0; #else +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + FSRef aFSRef; + OSStatus nErr; + Boolean bFolder; + Boolean bAliased; +#else CFStringRef cfpath; CFURLRef cfurl; CFErrorRef cferror; CFDataRef cfbookmark; +#endif char *unprocessedPath = path; @@ -174,6 +181,49 @@ int macxp_resolveAlias(char *path, int buflen) if ( unprocessedPath ) *unprocessedPath = '\0'; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + nErr = noErr; + bFolder = FALSE; + bAliased = FALSE; + + if ( FSPathMakeRef( (const UInt8 *)path, &aFSRef, 0 ) == noErr ) + { + nErr = FSResolveAliasFileWithMountFlags( &aFSRef, TRUE, &bFolder, &bAliased, kResolveAliasFileNoUI ); + if ( nErr == nsvErr ) + { + errno = ENOENT; + nRet = -1; + } + else if ( nErr == noErr && bAliased ) + { + char tmpPath[ PATH_MAX ]; + if ( FSRefMakePath( &aFSRef, (UInt8 *)tmpPath, PATH_MAX ) == noErr ) + { + int nLen = strlen( tmpPath ) + ( unprocessedPath ? strlen( unprocessedPath + 1 ) + 1 : 0 ); + if ( nLen < buflen && nLen < PATH_MAX ) + { + if ( unprocessedPath ) + { + int nTmpPathLen = strlen( tmpPath ); + strcat( tmpPath, "/" ); + strcat( tmpPath, unprocessedPath + 1 ); + strcpy( path, tmpPath); + unprocessedPath = path + nTmpPathLen; + } + else if ( !unprocessedPath ) + { + strcpy( path, tmpPath); + } + } + else + { + errno = ENAMETOOLONG; + nRet = -1; + } + } + } + } +#else cfpath = CFStringCreateWithCString( NULL, path, kCFStringEncodingUTF8 ); cfurl = CFURLCreateWithFileSystemPath( NULL, cfpath, kCFURLPOSIXPathStyle, false ); CFRelease( cfpath ); @@ -233,6 +283,7 @@ int macxp_resolveAlias(char *path, int buflen) } } } +#endif if ( unprocessedPath ) *unprocessedPath++ = '/'; diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 7611b6d..82bd117 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -93,7 +93,11 @@ public: sal_uLong mnICOptions; // To prevent display sleep during presentation +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + boost::shared_ptr< Timer > mpActivityTimer; +#else IOPMAssertionID mnAssertionID; +#endif public: /** Constructor diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h index 93f8b8f..7e957b6 100644 --- a/vcl/inc/osx/salframeview.h +++ b/vcl/inc/osx/salframeview.h @@ -22,7 +22,11 @@ #include "osx/a11ywrapper.h" +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +@interface SalFrameWindow : NSWindow +#else @interface SalFrameWindow : NSWindow<NSWindowDelegate> +#endif { AquaSalFrame* mpFrame; id mDraggingDestinationHandler; @@ -59,7 +63,11 @@ -(void)unregisterDraggingDestinationHandler:(id)theHandler; @end +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +@interface SalFrameView : AquaA11yWrapper <NSTextInput> +#else @interface SalFrameView : AquaA11yWrapper <NSTextInputClient> +#endif { AquaSalFrame* mpFrame; @@ -113,7 +121,11 @@ /* text action methods */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +-(void)insertText:(id)aString; +#else -(void)insertText:(id)aString replacementRange:(NSRange)replacementRange; +#endif -(void)insertTab: (id)aSender; -(void)insertBacktab: (id)aSender; -(void)moveLeft: (id)aSender; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 23d3bb3..45a12c4 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -29,6 +29,15 @@ #include <ApplicationServices/ApplicationServices.h> #include "osx/osxvcltypes.h" #include "osx/salframe.h" + +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +// The following symbols are SPI (System Programming Interface) in 10.5. +extern "C" { + void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); + const CGSize* CTRunGetAdvancesPtr(CTRunRef run); + extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel; +} +#endif #else #include <CoreGraphics/CoreGraphics.h> #include <CoreText/CoreText.h> diff --git a/vcl/osx/DropTarget.cxx b/vcl/osx/DropTarget.cxx index 7ee0f5b..e8179a9 100644 --- a/vcl/osx/DropTarget.cxx +++ b/vcl/osx/DropTarget.cxx @@ -264,9 +264,17 @@ NSDragOperation DropTarget::draggingUpdated(id sender) } if (dragOp == NSDragOperationNone) +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + SetThemeCursor(kThemeNotAllowedCursor); +#else [[NSCursor operationNotAllowedCursor] set]; +#endif else if (dragOp == NSDragOperationCopy) +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + SetThemeCursor(kThemeCopyArrowCursor); +#else [[NSCursor dragCopyCursor] set]; +#endif else [[NSCursor arrowCursor] set]; diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index f205caf..43a0674 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -37,6 +37,11 @@ #include "osx/a11yfactory.h" #include "quartz/utils.h" +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#include "vcl/timer.hxx" +#include "osx/saltimer.h" +#endif + #include "salwtype.hxx" #include "premac.h" @@ -193,7 +198,11 @@ void AquaSalFrame::initWindowAndView() [mpNSWindow setAcceptsMouseMovedEvents: YES]; [mpNSWindow setHasShadow: YES]; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + objc_msgSend(mpNSWindow, @selector(setDelegate:), mpNSWindow); +#else [mpNSWindow setDelegate: static_cast<id<NSWindowDelegate> >(mpNSWindow)]; +#endif if( [mpNSWindow respondsToSelector: @selector(setRestorable:)]) { @@ -750,6 +759,27 @@ void AquaSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) SendPaintEvent(); } +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +class PreventSleepTimer : public AutoTimer +{ +public: + PreventSleepTimer() + { + SetTimeout( 30000 ); + Start(); + } + + virtual ~PreventSleepTimer() + { + } + + virtual void Timeout() SAL_OVERRIDE + { + UpdateSystemActivity(OverallAct); + } +}; +#endif + void AquaSalFrame::StartPresentation( bool bStart ) { if ( !mpNSWindow ) @@ -761,10 +791,14 @@ void AquaSalFrame::StartPresentation( bool bStart ) if( bStart ) { GetSalData()->maPresentationFrames.push_back( this ); +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + mpActivityTimer.reset( new PreventSleepTimer() ); +#else /* OS X 10.6 and above */ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, CFSTR("LibreOffice presentation running"), &mnAssertionID); +#endif [mpNSWindow setLevel: NSPopUpMenuWindowLevel]; if( mbShown ) [mpNSWindow makeMainWindow]; @@ -772,7 +806,11 @@ void AquaSalFrame::StartPresentation( bool bStart ) else { GetSalData()->maPresentationFrames.remove( this ); +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + mpActivityTimer.reset(); +#else IOPMAssertionRelease(mnAssertionID); +#endif [mpNSWindow setLevel: NSNormalWindowLevel]; } } diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 7440436..8e74086 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -34,6 +34,14 @@ #define WHEEL_EVENT_FACTOR 1.5 +// for allowing fullscreen support on deployment targets < OSX 10.7 +#if !defined(MAC_OS_X_VERSION_10_7) + #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) + #define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8) +// #define NSFullScreenWindowMask (1 << 14) +#endif + + static sal_uInt16 ImplGetModifierMask( unsigned int nMask ) { sal_uInt16 nRet = 0; @@ -158,6 +166,18 @@ static const struct ExceptionalKey static AquaSalFrame* getMouseContainerFrame() { AquaSalFrame* pDispatchFrame = NULL; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + NSInteger nWindows = 0; + NSCountWindows( &nWindows ); + NSInteger* pWindows = (NSInteger*)alloca( nWindows * sizeof(NSInteger) ); + NSWindowList( nWindows, pWindows ); // NSWindowList is supposed to be in z-order front to back + for(int i = 0; i < nWindows && ! pDispatchFrame; i++ ) + { + NSWindow* pWin = [NSApp windowWithWindowNumber: pWindows[i]]; + if( pWin && [pWin isMemberOfClass: [SalFrameWindow class]] && [(SalFrameWindow*)pWin containsMouse] ) + pDispatchFrame = [(SalFrameWindow*)pWin getSalFrame]; + } +#else NSArray* aWindows = [NSWindow windowNumbersWithOptions:0]; for(NSUInteger i = 0; i < [aWindows count] && ! pDispatchFrame; i++ ) { @@ -165,6 +185,7 @@ static AquaSalFrame* getMouseContainerFrame() if( pWin && [pWin isMemberOfClass: [SalFrameWindow class]] && [(SalFrameWindow*)pWin containsMouse] ) pDispatchFrame = [(SalFrameWindow*)pWin getSalFrame]; } +#endif return pDispatchFrame; } @@ -755,11 +776,19 @@ private: if( bNewSeries ) mfMagnifyDeltaSum = 0.0; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + mfMagnifyDeltaSum += [pEvent deltaZ]; +#else mfMagnifyDeltaSum += [pEvent magnification]; +#endif mfLastMagnifyTime = [pEvent timestamp]; // TODO: change to 0.1 when COMMAND_WHEEL_ZOOM handlers allow finer zooming control +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + static const float fMagnifyFactor = 0.25; +#else static const float fMagnifyFactor = 0.25*500; // steps are 500 times smaller for -magnification +#endif static const float fMinMagnifyStep = 15.0 / fMagnifyFactor; if( fabs(mfMagnifyDeltaSum) <= fMinMagnifyStep ) return; @@ -1012,9 +1041,15 @@ private: } } +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +-(void)insertText:(id)aString +#else -(void)insertText:(id)aString replacementRange:(NSRange)replacementRange +#endif { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 (void) replacementRange; // FIXME: surely it must be used +#endif YIELD_GUARD; @@ -1584,9 +1619,15 @@ private: return mSelectedRange; } +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange +#else - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange replacementRange:(NSRange)replacementRange +#endif { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 (void) replacementRange; // FIXME - use it! +#endif YIELD_GUARD; @@ -1656,10 +1697,16 @@ private: mSelectedRange = mMarkedRange = NSMakeRange(NSNotFound, 0); } +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +- (NSAttributedString *)attributedSubstringFromRange:(NSRange)aRange +#else - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange +#endif { (void) aRange; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 (void) actualRange; +#endif // FIXME - Implement return nil; @@ -1703,11 +1750,17 @@ private: mpLastEvent = nil; } +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +- (NSRect)firstRectForCharacterRange:(NSRange)aRange +#else - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange +#endif { // FIXME - These should probably be used? (void) aRange; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 (void) actualRange; +#endif YIELD_GUARD; diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index 71758b6..d8adf03 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -1046,7 +1046,12 @@ NSImage* CreateNSImage( const Image& rImage ) NSImage* pImage = [[NSImage alloc] initWithSize: NSMakeSize( aSize.Width(), aSize.Height() )]; if( pImage ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + [pImage setFlipped:YES]; + [pImage lockFocus]; +#else [pImage lockFocusFlipped:YES]; +#endif NSGraphicsContext* pContext = [NSGraphicsContext currentContext]; CGContextRef rCGContext = reinterpret_cast<CGContextRef>([pContext graphicsPort]); diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index 41e7711..37a936b 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -246,7 +246,11 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) : if( ! mbMenuBar ) { mpMenu = [[SalNSMenu alloc] initWithMenu: this]; +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + objc_msgSend(mpMenu, @selector(setDelegate:), mpMenu); +#else [mpMenu setDelegate: (id<NSMenuDelegate>)mpMenu]; +#endif } else { diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 9440bb3..52c0902 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -462,7 +462,11 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName, { [mpPrintInfo setJobDisposition: NSPrintSaveJob]; NSString* pPath = CreateNSString( *i_pFileName ); +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + [pPrintDict setObject:[NSURL fileURLWithPath:pPath] forKey:NSPrintSavePath]; +#else [pPrintDict setObject:[NSURL fileURLWithPath:pPath] forKey:NSPrintJobSavingURL]; +#endif [pPath release]; } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 0df3ab3..38cf249 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -83,9 +83,13 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD ) ((mpFontData->GetWeight() < WEIGHT_SEMIBOLD) && (mpFontData->GetWeight() != WEIGHT_DONTKNOW)) ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 int nStroke = -10.0; CFNumberRef rStroke = CFNumberCreate(NULL, kCFNumberSInt32Type, &nStroke); CFDictionarySetValue(mpStyleDict, kCTStrokeWidthAttributeName, rStroke); +#else /* kCTStrokeWidthAttributeName is not available */ + /* do we really need "fake" bold? */ +#endif } // fake italic @@ -319,8 +323,10 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool // get font-enabled status if( bFontEnabled ) { int bEnabled = TRUE; // by default (and when we're on OS X < 10.6) it's "enabled" +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 CFNumberRef pEnabled = (CFNumberRef)CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute ); CFNumberGetValue( pEnabled, kCFNumberIntType, &bEnabled ); +#endif *bFontEnabled = bEnabled; } diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index a0bcd24..cd9771a 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -267,6 +267,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) // - CoreText handles spaces specially (in particular at the text end) if( mnTrailingSpaceCount ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 + // don't recreate line layout here, because this can lead to problems + // (looks like internal issues inside early CoreText versions) + mfTrailingSpaceWidth = CTLineGetTrailingWhitespaceWidth( mpCTLine ); +#else if(mfTrailingSpaceWidth <= 0.0) { mfTrailingSpaceWidth = CTLineGetTrailingWhitespaceWidth( mpCTLine ); @@ -291,7 +296,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) SAL_INFO( "vcl.ct", "CTLineCreateWithAttributedString(\"" << GetOUString(aCFText) << "\") = " << mpCTLine ); CFRelease( pAttrStr ); CFRelease( aCFText ); - +#endif // in RTL-layouts trailing spaces are leftmost // TODO: use BiDi-algorithm to thoroughly check this assumption if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) @@ -299,9 +304,12 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) mfBaseAdv = mfTrailingSpaceWidth; } } +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 + CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth - mfTrailingSpaceWidth ); +#else CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, nPixelWidth); SAL_INFO( "vcl.ct", "CTLineCreateJustifiedLine(" << mpCTLine << ",1.0," << nPixelWidth << ") = " << pNewCTLine ); - +#endif if( !pNewCTLine ) { // CTLineCreateJustifiedLine can and does fail @@ -315,7 +323,11 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) SAL_INFO( "vcl.ct", "CFRelease(" << mpCTLine << ")" ); CFRelease( mpCTLine ); mpCTLine = pNewCTLine; +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 + mfCachedWidth = nPixelWidth; +#else mfCachedWidth = nPixelWidth + mfTrailingSpaceWidth; +#endif } } @@ -370,9 +382,13 @@ bool CTLayout::DrawTextSpecial( SalGraphics& rGraphics, sal_uInt32 flags ) const CFDictionaryGetCount(mpTextStyle->GetStyleDict()), mpTextStyle->GetStyleDict()); +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + /* just don't do 'kCTStrokeWidthAttributeName' */ +#else int nStroke = 2; CFNumberRef rStroke = CFNumberCreate(NULL, kCFNumberSInt32Type, &nStroke); CFDictionarySetValue(styledict, kCTStrokeWidthAttributeName, rStroke); +#endif CFAttributedStringRef pAttrStr = CFAttributedStringCreate( NULL, diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 2462ec0..d33e570 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -339,12 +339,28 @@ static bool AddTempDevFont(const OUString& rFontFileURL) bool success = false; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 CFErrorRef error; success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, &error); if (!success) { CFRelease(error); } +#else /* CTFontManagerRegisterFontsForURL is not available on OS X <10.6 */ + CGDataProviderRef dataProvider = CGDataProviderCreateWithURL(rFontURL); + CGFontRef graphicsFont = CGFontCreateWithDataProvider(dataProvider); + if (graphicsFont) + { + CTFontRef coreTextFont = CTFontCreateWithGraphicsFont(graphicsFont, /*fontSize*/ 0, /*matrix*/ NULL, /*attributes*/ NULL); + if (coreTextFont) + { + success = true; + CFRelease(coreTextFont); + } + CGFontRelease(graphicsFont); + } + CGDataProviderRelease(dataProvider); +#endif return success; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits