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