1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_OSX_SALFRAMEVIEW_H
21 #define INCLUDED_VCL_INC_OSX_SALFRAMEVIEW_H
23 #include <osx/a11ywrapper.h>
27 @interface SalFrameWindow
: NSWindow
<NSWindowDelegate
>
29 AquaSalFrame
* mpFrame
;
30 id mDraggingDestinationHandler
;
31 BOOL mbInWindowDidResize
;
32 NSTimer
* mpLiveResizeTimer
;
33 NSTimer
* mpResetParentWindowTimer
;
35 -(id
)initWithSalFrame
: (AquaSalFrame
*)pFrame
;
36 -(void)clearLiveResizeTimer
;
37 -(void)clearResetParentWindowTimer
;
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)windowDidChangeBackingProperties
:(NSNotification
*)pNotification
;
50 -(void)windowWillStartLiveResize
:(NSNotification
*)pNotification
;
51 -(void)windowDidEndLiveResize
:(NSNotification
*)pNotification
;
52 //-(void)willEncodeRestorableState:(NSCoder*)pCoderState;
53 //-(void)didDecodeRestorableState:(NSCoder*)pCoderState;
54 //-(void)windowWillEnterVersionBrowser:(NSNotification*)pNotification;
55 -(void)dockMenuItemTriggered
: (id
)sender
;
56 -(AquaSalFrame
*)getSalFrame
;
58 -(css::uno::Reference
< css::accessibility::XAccessibleContext
>)accessibleContext
;
60 /* NSDraggingDestination protocol methods
62 -(NSDragOperation
)draggingEntered
:(id
<NSDraggingInfo
>)sender
;
63 -(NSDragOperation
)draggingUpdated
:(id
<NSDraggingInfo
>)sender
;
64 -(void)draggingExited
:(id
<NSDraggingInfo
>)sender
;
65 -(BOOL
)prepareForDragOperation
:(id
<NSDraggingInfo
>)sender
;
66 -(BOOL
)performDragOperation
:(id
<NSDraggingInfo
>)sender
;
67 -(void)concludeDragOperation
:(id
<NSDraggingInfo
>)sender
;
69 -(void)registerDraggingDestinationHandler
:(id
)theHandler
;
70 -(void)unregisterDraggingDestinationHandler
:(id
)theHandler
;
72 -(void)endExtTextInput
;
73 -(void)endExtTextInput
:(EndExtTextInputFlags
)nFlags
;
75 -(void)windowDidResizeWithTimer
:(NSTimer
*)pTimer
;
77 -(BOOL
)isIgnoredWindow
;
79 // NSAccessibilityElement overrides
80 -(id
)accessibilityApplicationFocusedUIElement
;
81 -(id
)accessibilityFocusedUIElement
;
82 -(BOOL
)accessibilityIsIgnored
;
83 -(BOOL
)isAccessibilityElement
;
85 -(void)resetParentWindow
;
89 @interface SalFrameView
: NSView
<NSTextInputClient
>
91 AquaSalFrame
* mpFrame
;
92 AquaA11yWrapper
* mpChildWrapper
;
93 BOOL mbNeedChildWrapper
;
95 // for NSTextInput/NSTextInputClient
97 BOOL mbNeedSpecialKeyHandle
;
100 NSRange mMarkedRange
;
101 NSRange mSelectedRange
;
102 id mpMouseEventListener
;
103 id mDraggingDestinationHandler
;
104 NSEvent
* mpLastSuperEvent
;
106 // #i102807# used by magnify event handler
107 NSTimeInterval mfLastMagnifyTime
;
108 float mfMagnifyDeltaSum
;
110 BOOL mbInEndExtTextInput
;
111 BOOL mbInCommitMarkedText
;
112 NSAttributedString
* mpLastMarkedText
;
113 BOOL mbTextInputWantsNonRepeatKeyDown
;
114 NSTrackingArea
* mpLastTrackingArea
;
116 +(void)unsetMouseFrame
: (AquaSalFrame
*)pFrame
;
117 -(id
)initWithSalFrame
: (AquaSalFrame
*)pFrame
;
119 -(AquaSalFrame
*)getSalFrame
;
120 -(BOOL
)acceptsFirstResponder
;
121 -(BOOL
)acceptsFirstMouse
: (NSEvent
*)pEvent
;
123 -(void)drawRect
: (NSRect
)aRect
;
124 -(void)mouseDown
: (NSEvent
*)pEvent
;
125 -(void)mouseDragged
: (NSEvent
*)pEvent
;
126 -(void)mouseUp
: (NSEvent
*)pEvent
;
127 -(void)mouseMoved
: (NSEvent
*)pEvent
;
128 -(void)mouseEntered
: (NSEvent
*)pEvent
;
129 -(void)mouseExited
: (NSEvent
*)pEvent
;
130 -(void)rightMouseDown
: (NSEvent
*)pEvent
;
131 -(void)rightMouseDragged
: (NSEvent
*)pEvent
;
132 -(void)rightMouseUp
: (NSEvent
*)pEvent
;
133 -(void)otherMouseDown
: (NSEvent
*)pEvent
;
134 -(void)otherMouseDragged
: (NSEvent
*)pEvent
;
135 -(void)otherMouseUp
: (NSEvent
*)pEvent
;
136 -(void)scrollWheel
: (NSEvent
*)pEvent
;
137 -(void)magnifyWithEvent
: (NSEvent
*)pEvent
;
138 -(void)rotateWithEvent
: (NSEvent
*)pEvent
;
139 -(void)swipeWithEvent
: (NSEvent
*)pEvent
;
140 -(void)keyDown
: (NSEvent
*)pEvent
;
141 -(void)flagsChanged
: (NSEvent
*)pEvent
;
142 -(void)sendMouseEventToFrame
:(NSEvent
*)pEvent button
:(sal_uInt16
)nButton eventtype
:(SalEvent
)nEvent
;
143 -(BOOL
)sendKeyInputAndReleaseToFrame
: (sal_uInt16
)nKeyCode character
: (sal_Unicode
)aChar
;
144 -(BOOL
)sendKeyInputAndReleaseToFrame
: (sal_uInt16
)nKeyCode character
: (sal_Unicode
)aChar modifiers
: (unsigned int)nMod
;
145 -(BOOL
)sendKeyToFrameDirect
: (sal_uInt16
)nKeyCode character
: (sal_Unicode
)aChar modifiers
: (unsigned int)nMod
;
146 -(BOOL
)sendSingleCharacter
:(NSEvent
*)pEvent
;
147 -(BOOL
)handleKeyDownException
:(NSEvent
*)pEvent
;
148 -(void)clearLastEvent
;
149 -(void)clearLastMarkedText
;
150 -(void)clearLastTrackingArea
;
151 -(void)updateTrackingAreas
;
155 -(void)insertText
:(id
)aString replacementRange
:(NSRange
)replacementRange
;
156 -(void)insertTab
: (id
)aSender
;
157 -(void)insertBacktab
: (id
)aSender
;
158 -(void)moveLeft
: (id
)aSender
;
159 -(void)moveLeftAndModifySelection
: (id
)aSender
;
160 -(void)moveBackwardAndModifySelection
: (id
)aSender
;
161 -(void)moveRight
: (id
)aSender
;
162 -(void)moveRightAndModifySelection
: (id
)aSender
;
163 -(void)moveForwardAndModifySelection
: (id
)aSender
;
164 -(void)moveUp
: (id
)aSender
;
165 -(void)moveDown
: (id
)aSender
;
166 -(void)moveWordBackward
: (id
)aSender
;
167 -(void)moveWordBackwardAndModifySelection
: (id
)aSender
;
168 -(void)moveWordLeftAndModifySelection
: (id
)aSender
;
169 -(void)moveWordForward
: (id
)aSender
;
170 -(void)moveWordForwardAndModifySelection
: (id
)aSender
;
171 -(void)moveWordRightAndModifySelection
: (id
)aSender
;
172 -(void)moveToEndOfLine
: (id
)aSender
;
173 -(void)moveToRightEndOfLine
: (id
)aSender
;
174 -(void)moveToLeftEndOfLine
: (id
)aSender
;
175 -(void)moveToEndOfLineAndModifySelection
: (id
)aSender
;
176 -(void)moveToRightEndOfLineAndModifySelection
: (id
)aSender
;
177 -(void)moveToLeftEndOfLineAndModifySelection
: (id
)aSender
;
178 -(void)moveToBeginningOfLine
: (id
)aSender
;
179 -(void)moveToBeginningOfLineAndModifySelection
: (id
)aSender
;
180 -(void)moveToEndOfParagraph
: (id
)aSender
;
181 -(void)moveToEndOfParagraphAndModifySelection
: (id
)aSender
;
182 -(void)moveToBeginningOfParagraph
: (id
)aSender
;
183 -(void)moveToBeginningOfParagraphAndModifySelection
: (id
)aSender
;
184 -(void)moveParagraphForward
: (id
)aSender
;
185 -(void)moveParagraphForwardAndModifySelection
: (id
)aSender
;
186 -(void)moveParagraphBackward
: (id
)aSender
;
187 -(void)moveParagraphBackwardAndModifySelection
: (id
)aSender
;
188 -(void)moveToEndOfDocument
: (id
)aSender
;
189 -(void)scrollToEndOfDocument
: (id
)aSender
;
190 -(void)moveToEndOfDocumentAndModifySelection
: (id
)aSender
;
191 -(void)moveToBeginningOfDocument
: (id
)aSender
;
192 -(void)scrollToBeginningOfDocument
: (id
)aSender
;
193 -(void)moveToBeginningOfDocumentAndModifySelection
: (id
)aSender
;
194 -(void)insertNewline
: (id
)aSender
;
195 -(void)deleteBackward
: (id
)aSender
;
196 -(void)deleteForward
: (id
)aSender
;
197 -(void)cancelOperation
: (id
)aSender
;
198 -(void)deleteBackwardByDecomposingPreviousCharacter
: (id
)aSender
;
199 -(void)deleteWordBackward
: (id
)aSender
;
200 -(void)deleteWordForward
: (id
)aSender
;
201 -(void)deleteToBeginningOfLine
: (id
)aSender
;
202 -(void)deleteToEndOfLine
: (id
)aSender
;
203 -(void)deleteToBeginningOfParagraph
: (id
)aSender
;
204 -(void)deleteToEndOfParagraph
: (id
)aSender
;
205 -(void)insertLineBreak
: (id
)aSender
;
206 -(void)insertParagraphSeparator
: (id
)aSender
;
207 -(void)selectWord
: (id
)aSender
;
208 -(void)selectLine
: (id
)aSender
;
209 -(void)selectParagraph
: (id
)aSender
;
210 -(void)selectAll
: (id
)aSender
;
211 -(void)noop
: (id
)aSender
;
212 /* set the correct pointer for our view */
213 -(void)resetCursorRects
;
214 -(css::accessibility::XAccessibleContext
*)accessibleContext
;
215 -(id
)parentAttribute
;
216 -(NSWindow
*)windowForParent
;
218 Event hook for D&D service.
220 A drag operation will be invoked on a NSView using
221 the method 'dragImage'. This method requires the
222 actual mouse event initiating this drag operation.
223 Mouse events can only be received by subclassing
224 NSView and overriding methods like 'mouseDown' etc.
225 hence we implement an event hook here so that the
226 D&D service can register as listener for mouse
227 messages and use the last 'mouseDown' or
228 'mouseDragged' message to initiate the drag
231 -(void)registerMouseEventListener
: (id
)theListener
;
232 -(void)unregisterMouseEventListener
: (id
)theListener
;
234 /* NSDraggingDestination protocol methods
236 -(NSDragOperation
)draggingEntered
:(id
<NSDraggingInfo
>)sender
;
237 -(NSDragOperation
)draggingUpdated
:(id
<NSDraggingInfo
>)sender
;
238 -(void)draggingExited
:(id
<NSDraggingInfo
>)sender
;
239 -(BOOL
)prepareForDragOperation
:(id
<NSDraggingInfo
>)sender
;
240 -(BOOL
)performDragOperation
:(id
<NSDraggingInfo
>)sender
;
241 -(void)concludeDragOperation
:(id
<NSDraggingInfo
>)sender
;
243 -(void)registerDraggingDestinationHandler
:(id
)theHandler
;
244 -(void)unregisterDraggingDestinationHandler
:(id
)theHandler
;
246 -(void)endExtTextInput
;
247 -(void)endExtTextInput
:(EndExtTextInputFlags
)nFlags
;
248 -(void)deleteTextInputWantsNonRepeatKeyDown
;
250 -(void)insertRegisteredWrapperIntoWrapperRepository
;
251 -(void)registerWrapper
;
252 -(void)revokeWrapper
;
254 // NSAccessibilityElement overrides
255 -(id
)accessibilityAttributeValue
:(NSString
*)pAttribute
;
256 -(BOOL
)accessibilityIsIgnored
;
257 -(NSArray
*)accessibilityAttributeNames
;
258 -(BOOL
)accessibilityIsAttributeSettable
:(NSString
*)pAttribute
;
259 -(NSArray
*)accessibilityParameterizedAttributeNames
;
260 -(BOOL
)accessibilitySetOverrideValue
:(id
)pValue forAttribute
:(NSString
*)pAttribute
;
261 -(void)accessibilitySetValue
:(id
)pValue forAttribute
:(NSString
*)pAttribute
;
262 -(id
)accessibilityAttributeValue
:(NSString
*)pAttribute forParameter
:(id
)pParameter
;
263 -(id
)accessibilityFocusedUIElement
;
264 -(NSString
*)accessibilityActionDescription
:(NSString
*)pAction
;
265 -(void)accessibilityPerformAction
:(NSString
*)pAction
;
266 -(NSArray
*)accessibilityActionNames
;
267 -(id
)accessibilityHitTest
:(NSPoint
)aPoint
;
268 -(NSArray
*)accessibilityVisibleChildren
;
269 -(NSArray
*)accessibilitySelectedChildren
;
270 -(NSArray
*)accessibilityChildren
;
271 -(NSArray
<id
<NSAccessibilityElement
>> *)accessibilityChildrenInNavigationOrder
;
275 @interface SalFrameViewA11yWrapper
: AquaA11yWrapper
277 SalFrameView
* mpParentView
;
279 -(id
)initWithParent
:(SalFrameView
*)pParentView accessibleContext
:(::com::sun::star::uno::Reference
<::com::sun::star::accessibility::XAccessibleContext
>&)rxAccessibleContext
;
283 #endif // INCLUDED_VCL_INC_OSX_SALFRAMEVIEW_H
285 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */