1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _VCL_SALFRAMEVIEW_H 29 #define _VCL_SALFRAMEVIEW_H 30 31 #include "aqua/aqua11ywrapper.h" 32 33 @interface SalFrameWindow : NSWindow 34 { 35 AquaSalFrame* mpFrame; 36 id mDraggingDestinationHandler; 37 } 38 -(id)initWithSalFrame: (AquaSalFrame*)pFrame; 39 -(BOOL)canBecomeKeyWindow; 40 -(void)displayIfNeeded; 41 -(void)windowDidBecomeKey: (NSNotification*)pNotification; 42 -(void)windowDidResignKey: (NSNotification*)pNotification; 43 -(void)windowDidChangeScreen: (NSNotification*)pNotification; 44 -(void)windowDidMove: (NSNotification*)pNotification; 45 -(void)windowDidResize: (NSNotification*)pNotification; 46 -(void)windowDidMiniaturize: (NSNotification*)pNotification; 47 -(void)windowDidDeminiaturize: (NSNotification*)pNotification; 48 -(BOOL)windowShouldClose: (NSNotification*)pNotification; 49 -(void)dockMenuItemTriggered: (id)sender; 50 -(AquaSalFrame*)getSalFrame; 51 -(BOOL)containsMouse; 52 -(::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleContext >)accessibleContext; 53 54 /* NSDraggingDestination protocol methods 55 */ 56 -(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; 57 -(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; 58 -(void)draggingExited:(id <NSDraggingInfo>)sender; 59 -(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; 60 -(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; 61 -(void)concludeDragOperation:(id <NSDraggingInfo>)sender; 62 63 -(void)registerDraggingDestinationHandler:(id)theHandler; 64 -(void)unregisterDraggingDestinationHandler:(id)theHandler; 65 @end 66 67 @interface SalFrameView : AquaA11yWrapper <NSTextInput> 68 { 69 AquaSalFrame* mpFrame; 70 71 // for NSTextInput 72 NSEvent* mpLastEvent; 73 BOOL mbNeedSpecialKeyHandle; 74 BOOL mbInKeyInput; 75 BOOL mbKeyHandled; 76 NSRange mMarkedRange; 77 NSRange mSelectedRange; 78 id mpMouseEventListener; 79 id mDraggingDestinationHandler; 80 NSEvent* mpLastSuperEvent; 81 82 // #i102807# used by magnify event handler 83 NSTimeInterval mfLastMagnifyTime; 84 float mfMagnifyDeltaSum; 85 } 86 +(void)unsetMouseFrame: (AquaSalFrame*)pFrame; 87 -(id)initWithSalFrame: (AquaSalFrame*)pFrame; 88 -(AquaSalFrame*)getSalFrame; 89 -(BOOL)acceptsFirstResponder; 90 -(BOOL)acceptsFirstMouse: (NSEvent *)pEvent; 91 -(BOOL)isOpaque; 92 -(void)drawRect: (NSRect)aRect; 93 -(void)mouseDown: (NSEvent*)pEvent; 94 -(void)mouseDragged: (NSEvent*)pEvent; 95 -(void)mouseUp: (NSEvent*)pEvent; 96 -(void)mouseMoved: (NSEvent*)pEvent; 97 -(void)mouseEntered: (NSEvent*)pEvent; 98 -(void)mouseExited: (NSEvent*)pEvent; 99 -(void)rightMouseDown: (NSEvent*)pEvent; 100 -(void)rightMouseDragged: (NSEvent*)pEvent; 101 -(void)rightMouseUp: (NSEvent*)pEvent; 102 -(void)otherMouseDown: (NSEvent*)pEvent; 103 -(void)otherMouseDragged: (NSEvent*)pEvent; 104 -(void)otherMouseUp: (NSEvent*)pEvent; 105 -(void)scrollWheel: (NSEvent*)pEvent; 106 -(void)magnifyWithEvent: (NSEvent*)pEvent; 107 -(void)rotateWithEvent: (NSEvent*)pEvent; 108 -(void)swipeWithEvent: (NSEvent*)pEvent; 109 -(void)keyDown: (NSEvent*)pEvent; 110 -(void)flagsChanged: (NSEvent*)pEvent; 111 -(void)sendMouseEventToFrame:(NSEvent*)pEvent button:(sal_uInt16)nButton eventtype:(sal_uInt16)nEvent; 112 -(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar; 113 -(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; 114 -(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; 115 -(BOOL)sendSingleCharacter:(NSEvent*)pEvent; 116 -(BOOL)handleKeyDownException:(NSEvent*)pEvent; 117 -(void)clearLastEvent; 118 /* 119 text action methods 120 */ 121 -(void)insertText:(id)aString; 122 -(void)insertTab: (id)aSender; 123 -(void)insertBacktab: (id)aSender; 124 -(void)moveLeft: (id)aSender; 125 -(void)moveLeftAndModifySelection: (id)aSender; 126 -(void)moveBackwardAndModifySelection: (id)aSender; 127 -(void)moveRight: (id)aSender; 128 -(void)moveRightAndModifySelection: (id)aSender; 129 -(void)moveForwardAndModifySelection: (id)aSender; 130 -(void)moveUp: (id)aSender; 131 -(void)moveDown: (id)aSender; 132 -(void)moveWordBackward: (id)aSender; 133 -(void)moveWordBackwardAndModifySelection: (id)aSender; 134 -(void)moveWordLeftAndModifySelection: (id)aSender; 135 -(void)moveWordForward: (id)aSender; 136 -(void)moveWordForwardAndModifySelection: (id)aSender; 137 -(void)moveWordRightAndModifySelection: (id)aSender; 138 -(void)moveToEndOfLine: (id)aSender; 139 -(void)moveToRightEndOfLine: (id)aSender; 140 -(void)moveToLeftEndOfLine: (id)aSender; 141 -(void)moveToEndOfLineAndModifySelection: (id)aSender; 142 -(void)moveToRightEndOfLineAndModifySelection: (id)aSender; 143 -(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; 144 -(void)moveToBeginningOfLine: (id)aSender; 145 -(void)moveToBeginningOfLineAndModifySelection: (id)aSender; 146 -(void)moveToEndOfParagraph: (id)aSender; 147 -(void)moveToEndOfParagraphAndModifySelection: (id)aSender; 148 -(void)moveToBeginningOfParagraph: (id)aSender; 149 -(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender; 150 -(void)moveParagraphForward: (id)aSender; 151 -(void)moveParagraphForwardAndModifySelection: (id)aSender; 152 -(void)moveParagraphBackward: (id)aSender; 153 -(void)moveParagraphBackwardAndModifySelection: (id)aSender; 154 -(void)moveToEndOfDocument: (id)aSender; 155 -(void)scrollToEndOfDocument: (id)aSender; 156 -(void)moveToEndOfDocumentAndModifySelection: (id)aSender; 157 -(void)moveToBeginningOfDocument: (id)aSender; 158 -(void)scrollToBeginningOfDocument: (id)aSender; 159 -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; 160 -(void)insertNewline: (id)aSender; 161 -(void)deleteBackward: (id)aSender; 162 -(void)deleteForward: (id)aSender; 163 -(void)cancelOperation: (id)aSender; 164 -(void)deleteBackwardByDecomposingPreviousCharacter: (id)aSender; 165 -(void)deleteWordBackward: (id)aSender; 166 -(void)deleteWordForward: (id)aSender; 167 -(void)deleteToBeginningOfLine: (id)aSender; 168 -(void)deleteToEndOfLine: (id)aSender; 169 -(void)deleteToBeginningOfParagraph: (id)aSender; 170 -(void)deleteToEndOfParagraph: (id)aSender; 171 -(void)insertLineBreak: (id)aSender; 172 -(void)insertParagraphSeparator: (id)aSender; 173 -(void)selectWord: (id)aSender; 174 -(void)selectLine: (id)aSender; 175 -(void)selectParagraph: (id)aSender; 176 -(void)selectAll: (id)aSender; 177 -(void)noop: (id)aSender; 178 /* set the correct pointer for our view */ 179 -(void)resetCursorRects; 180 -(::com::sun::star::accessibility::XAccessibleContext *)accessibleContext; 181 -(id)parentAttribute; 182 -(NSView *)viewElementForParent; 183 /* 184 Event hook for D&D service. 185 186 A drag operation will be invoked on a NSView using 187 the method 'dragImage'. This method requires the 188 actual mouse event initiating this drag operation. 189 Mouse events can only be received by subclassing 190 NSView and overriding methods like 'mouseDown' etc. 191 hence we implement a event hook here so that the 192 D&D service can register as listener for mouse 193 messages and use the last 'mouseDown' or 194 'mouseDragged' message to initiate the drag 195 operation. 196 */ 197 -(void)registerMouseEventListener: (id)theListener; 198 -(void)unregisterMouseEventListener: (id)theListener; 199 200 /* NSDraggingDestination protocol methods 201 */ 202 -(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; 203 -(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; 204 -(void)draggingExited:(id <NSDraggingInfo>)sender; 205 -(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; 206 -(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; 207 -(void)concludeDragOperation:(id <NSDraggingInfo>)sender; 208 209 -(void)registerDraggingDestinationHandler:(id)theHandler; 210 -(void)unregisterDraggingDestinationHandler:(id)theHandler; 211 212 @end 213 214 #endif 215