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<NSWindowDelegate> 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)willEncodeRestorableState:(NSCoder*)pCoderState; 46 //-(void)didDecodeRestorableState:(NSCoder*)pCoderState; 47 //-(void)windowWillEnterVersionBrowser:(NSNotification*)pNotification; 48 -(void)dockMenuItemTriggered: (id)sender; 49 -(AquaSalFrame*)getSalFrame; 50 -(BOOL)containsMouse; 51 -(::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleContext >)accessibleContext; 52 53 /* NSDraggingDestination protocol methods 54 */ 55 -(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; 56 -(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; 57 -(void)draggingExited:(id <NSDraggingInfo>)sender; 58 -(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; 59 -(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; 60 -(void)concludeDragOperation:(id <NSDraggingInfo>)sender; 61 62 -(void)registerDraggingDestinationHandler:(id)theHandler; 63 -(void)unregisterDraggingDestinationHandler:(id)theHandler; 64 @end 65 66 @interface SalFrameView : AquaA11yWrapper <NSTextInput> 67 { 68 AquaSalFrame* mpFrame; 69 70 // for NSTextInput 71 NSEvent* mpLastEvent; 72 BOOL mbNeedSpecialKeyHandle; 73 BOOL mbInKeyInput; 74 BOOL mbKeyHandled; 75 NSRange mMarkedRange; 76 NSRange mSelectedRange; 77 id mpMouseEventListener; 78 id mDraggingDestinationHandler; 79 NSEvent* mpLastSuperEvent; 80 81 // #i102807# used by magnify event handler 82 NSTimeInterval mfLastMagnifyTime; 83 float mfMagnifyDeltaSum; 84 } 85 +(void)unsetMouseFrame: (AquaSalFrame*)pFrame; 86 -(id)initWithSalFrame: (AquaSalFrame*)pFrame; 87 -(AquaSalFrame*)getSalFrame; 88 -(BOOL)acceptsFirstResponder; 89 -(BOOL)acceptsFirstMouse: (NSEvent *)pEvent; 90 -(BOOL)isOpaque; 91 -(void)drawRect: (NSRect)aRect; 92 -(void)mouseDown: (NSEvent*)pEvent; 93 -(void)mouseDragged: (NSEvent*)pEvent; 94 -(void)mouseUp: (NSEvent*)pEvent; 95 -(void)mouseMoved: (NSEvent*)pEvent; 96 -(void)mouseEntered: (NSEvent*)pEvent; 97 -(void)mouseExited: (NSEvent*)pEvent; 98 -(void)rightMouseDown: (NSEvent*)pEvent; 99 -(void)rightMouseDragged: (NSEvent*)pEvent; 100 -(void)rightMouseUp: (NSEvent*)pEvent; 101 -(void)otherMouseDown: (NSEvent*)pEvent; 102 -(void)otherMouseDragged: (NSEvent*)pEvent; 103 -(void)otherMouseUp: (NSEvent*)pEvent; 104 -(void)scrollWheel: (NSEvent*)pEvent; 105 -(void)magnifyWithEvent: (NSEvent*)pEvent; 106 -(void)rotateWithEvent: (NSEvent*)pEvent; 107 -(void)swipeWithEvent: (NSEvent*)pEvent; 108 -(void)keyDown: (NSEvent*)pEvent; 109 -(void)flagsChanged: (NSEvent*)pEvent; 110 -(void)sendMouseEventToFrame:(NSEvent*)pEvent button:(sal_uInt16)nButton eventtype:(sal_uInt16)nEvent; 111 -(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar; 112 -(BOOL)sendKeyInputAndReleaseToFrame: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; 113 -(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; 114 -(BOOL)sendSingleCharacter:(NSEvent*)pEvent; 115 -(BOOL)handleKeyDownException:(NSEvent*)pEvent; 116 -(void)clearLastEvent; 117 /* 118 text action methods 119 */ 120 -(void)insertText:(id)aString; 121 -(void)insertTab: (id)aSender; 122 -(void)insertBacktab: (id)aSender; 123 -(void)moveLeft: (id)aSender; 124 -(void)moveLeftAndModifySelection: (id)aSender; 125 -(void)moveBackwardAndModifySelection: (id)aSender; 126 -(void)moveRight: (id)aSender; 127 -(void)moveRightAndModifySelection: (id)aSender; 128 -(void)moveForwardAndModifySelection: (id)aSender; 129 -(void)moveUp: (id)aSender; 130 -(void)moveDown: (id)aSender; 131 -(void)moveWordBackward: (id)aSender; 132 -(void)moveWordBackwardAndModifySelection: (id)aSender; 133 -(void)moveWordLeftAndModifySelection: (id)aSender; 134 -(void)moveWordForward: (id)aSender; 135 -(void)moveWordForwardAndModifySelection: (id)aSender; 136 -(void)moveWordRightAndModifySelection: (id)aSender; 137 -(void)moveToEndOfLine: (id)aSender; 138 -(void)moveToRightEndOfLine: (id)aSender; 139 -(void)moveToLeftEndOfLine: (id)aSender; 140 -(void)moveToEndOfLineAndModifySelection: (id)aSender; 141 -(void)moveToRightEndOfLineAndModifySelection: (id)aSender; 142 -(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; 143 -(void)moveToBeginningOfLine: (id)aSender; 144 -(void)moveToBeginningOfLineAndModifySelection: (id)aSender; 145 -(void)moveToEndOfParagraph: (id)aSender; 146 -(void)moveToEndOfParagraphAndModifySelection: (id)aSender; 147 -(void)moveToBeginningOfParagraph: (id)aSender; 148 -(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender; 149 -(void)moveParagraphForward: (id)aSender; 150 -(void)moveParagraphForwardAndModifySelection: (id)aSender; 151 -(void)moveParagraphBackward: (id)aSender; 152 -(void)moveParagraphBackwardAndModifySelection: (id)aSender; 153 -(void)moveToEndOfDocument: (id)aSender; 154 -(void)scrollToEndOfDocument: (id)aSender; 155 -(void)moveToEndOfDocumentAndModifySelection: (id)aSender; 156 -(void)moveToBeginningOfDocument: (id)aSender; 157 -(void)scrollToBeginningOfDocument: (id)aSender; 158 -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; 159 -(void)insertNewline: (id)aSender; 160 -(void)deleteBackward: (id)aSender; 161 -(void)deleteForward: (id)aSender; 162 -(void)cancelOperation: (id)aSender; 163 -(void)deleteBackwardByDecomposingPreviousCharacter: (id)aSender; 164 -(void)deleteWordBackward: (id)aSender; 165 -(void)deleteWordForward: (id)aSender; 166 -(void)deleteToBeginningOfLine: (id)aSender; 167 -(void)deleteToEndOfLine: (id)aSender; 168 -(void)deleteToBeginningOfParagraph: (id)aSender; 169 -(void)deleteToEndOfParagraph: (id)aSender; 170 -(void)insertLineBreak: (id)aSender; 171 -(void)insertParagraphSeparator: (id)aSender; 172 -(void)selectWord: (id)aSender; 173 -(void)selectLine: (id)aSender; 174 -(void)selectParagraph: (id)aSender; 175 -(void)selectAll: (id)aSender; 176 -(void)noop: (id)aSender; 177 /* set the correct pointer for our view */ 178 -(void)resetCursorRects; 179 -(::com::sun::star::accessibility::XAccessibleContext *)accessibleContext; 180 -(id)parentAttribute; 181 -(NSView *)viewElementForParent; 182 /* 183 Event hook for D&D service. 184 185 A drag operation will be invoked on a NSView using 186 the method 'dragImage'. This method requires the 187 actual mouse event initiating this drag operation. 188 Mouse events can only be received by subclassing 189 NSView and overriding methods like 'mouseDown' etc. 190 hence we implement a event hook here so that the 191 D&D service can register as listener for mouse 192 messages and use the last 'mouseDown' or 193 'mouseDragged' message to initiate the drag 194 operation. 195 */ 196 -(void)registerMouseEventListener: (id)theListener; 197 -(void)unregisterMouseEventListener: (id)theListener; 198 199 /* NSDraggingDestination protocol methods 200 */ 201 -(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; 202 -(NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender; 203 -(void)draggingExited:(id <NSDraggingInfo>)sender; 204 -(BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; 205 -(BOOL)performDragOperation:(id <NSDraggingInfo>)sender; 206 -(void)concludeDragOperation:(id <NSDraggingInfo>)sender; 207 208 -(void)registerDraggingDestinationHandler:(id)theHandler; 209 -(void)unregisterDraggingDestinationHandler:(id)theHandler; 210 211 @end 212 213 #endif 214