diff options
Diffstat (limited to 'vcl/aqua/source/app/vclnsapp.mm')
-rw-r--r-- | vcl/aqua/source/app/vclnsapp.mm | 86 |
1 files changed, 38 insertions, 48 deletions
diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 6e1fc45fc9b8..db736634a7d8 100644 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * 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/. * - * OpenOffice.org - a multi-platform office productivity suite + * This file incorporates work covered by the following license notice: * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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" @@ -47,7 +37,7 @@ #import "apple_remote/RemoteControl.h" #include "postmac.h" - + @implementation CocoaThreadEnabler -(void)enableCocoaThreads:(id)param { @@ -103,10 +93,10 @@ return; } } - + /* * #i98949# - Cmd-M miniaturize window, Cmd-Option-M miniaturize all windows - */ + */ if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"m"] ) { if ( nModMask == NSCommandKeyMask && ([pFrame->getWindow() styleMask] & NSMiniaturizableWindowMask) ) @@ -121,7 +111,7 @@ return; } } - + // #i90083# handle frame switching // FIXME: lousy workaround if( (nModMask & (NSControlKeyMask|NSAlternateKeyMask)) == 0 ) @@ -139,21 +129,21 @@ return; } } - + // get information whether the event was handled; keyDown returns nothing GetSalData()->maKeyEventAnswer[ pEvent ] = false; bool bHandled = false; - + // dispatch to view directly to avoid the key event being consumed by the menubar // popup windows do not get the focus, so they don't get these either // simplest would be dispatch this to the key window always if it is without parent // however e.g. in document we want the menu shortcut if e.g. the stylist has focus - if( pFrame->mpParent && (pFrame->mnStyle & SAL_FRAME_STYLE_FLOAT) == 0 ) + if( pFrame->mpParent && (pFrame->mnStyle & SAL_FRAME_STYLE_FLOAT) == 0 ) { [[pKeyWin contentView] keyDown: pEvent]; bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; } - + // see whether the main menu consumes this event // if not, we want to dispatch it ourselves. Unless we do this "trick" // the main menu just beeps for an unknown or disabled key equivalent @@ -183,7 +173,7 @@ unsigned int nModMask = ([pEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)); if( nModMask == NSCommandKeyMask ) { - + if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] ) { if( [NSApp sendAction: @selector(paste:) to: nil from: nil] ) @@ -263,7 +253,7 @@ -(void)cycleFrameBackward: (AquaSalFrame*)pCurFrame { // do the same as cycleFrameForward only with a reverse iterator - + // find current frame in list std::list< AquaSalFrame* >& rFrames( GetSalData()->maFrames ); std::list< AquaSalFrame* >::reverse_iterator it = rFrames.rbegin(); @@ -299,7 +289,7 @@ } } } - + -(NSMenu*)applicationDockMenu:(NSApplication *)sender { (void)sender; @@ -322,10 +312,10 @@ { (void)app; rtl::OUStringBuffer aFileList( 256 ); - + NSEnumerator* it = [files objectEnumerator]; NSString* pFile = nil; - + while( (pFile = [it nextObject]) != nil ) { const rtl::OUString aFile( GetOUString( pFile ) ); @@ -336,7 +326,7 @@ aFileList.append( aFile ); } } - + if( aFileList.getLength() ) { // we have no back channel here, we have to assume success, in which case @@ -362,10 +352,10 @@ (void)bShowPrintPanels; // currently ignores print settings an bShowPrintPanels rtl::OUStringBuffer aFileList( 256 ); - + NSEnumerator* it = [files objectEnumerator]; NSString* pFile = nil; - + while( (pFile = [it nextObject]) != nil ) { if( aFileList.getLength() > 0 ) @@ -385,7 +375,7 @@ NSApplicationTerminateReply aReply = NSTerminateNow; { YIELD_GUARD; - + SalData* pSalData = GetSalData(); if( ! pSalData->maFrames.empty() ) { @@ -393,7 +383,7 @@ [NSApp activateIgnoringOtherApps: YES]; aReply = pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; } - + if( aReply == NSTerminateNow ) { ApplicationEvent aEv(ApplicationEvent::TYPE_PRIVATE_DOSHUTDOWN); @@ -403,7 +393,7 @@ // can occur in Desktop::doShutdown for example } } - + return aReply; } @@ -411,7 +401,7 @@ { (void)pNotification; YIELD_GUARD; - + const SalData* pSalData = GetSalData(); if( !pSalData->maFrames.empty() ) pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); @@ -421,7 +411,7 @@ { (void)pNotification; YIELD_GUARD; - + SalData* pSalData = GetSalData(); std::list< AquaSalFrame* >::iterator it; for( it = pSalData->maFrames.begin(); it != pSalData->maFrames.end(); ++it ) @@ -469,7 +459,7 @@ if (pSalData->mpMainController->remoteControl) { // [remoteControl startListening: self]; - // does crash because the right thing to do is + // does crash because the right thing to do is // [GetSalData()->mpMainController->remoteControl startListening: self]; // but the instance variable 'remoteControl' is declared protected // workaround : declare remoteControl instance variable as public in RemoteMainController.m @@ -495,12 +485,12 @@ if (pSalData->mpMainController->remoteControl) { // [remoteControl stopListening: self]; - // does crash because the right thing to do is + // does crash because the right thing to do is // [GetSalData()->mpMainController->remoteControl stopListening: self]; // but the instance variable 'remoteControl' is declared protected // workaround : declare remoteControl instance variable as public in RemoteMainController.m - [pSalData->mpMainController->remoteControl stopListening: self]; + [pSalData->mpMainController->remoteControl stopListening: self]; #ifdef DEBUG NSLog(@"Apple Remote will resign active - Releasing remote controls"); #endif |