InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IPageItemFocus.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Bernd Paradies
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __IPageItemFocus__
25 #define __IPageItemFocus__
26 
27 #include "IPMUnknown.h"
28 #include "widgetid.h"
29 
30 //----------------------------------------------------------------------------------------
31 // Interface IPageItemFocus
32 //----------------------------------------------------------------------------------------
33 
34 /*
35  PageItemFocus manages switches between page item event handling (PageItemEventHandler) and text event handling (FrameEventHandler).
36  Page items and text selection have different event handlers: i.e. arrow key left moves a page item to the left on the spread if the
37  PageItemEventHandler is active while the same key event moves the caret by one character to the left if the FrameEventHandler is activated.
38  If the user switches from page item selection to text selection or vice versa the corresponding event handler needs to be registered as
39  the current event handler. This is done via KeyFocusHandler::SetCurrentTargetEventHandler in three steps:
40  - calling IEventHandler::GiveUpKeyFocus() on the current event handler.
41  - replacing the current event handler with the new one.
42  - calling IEventHandler::GetKeyFocus() on the new event handler.
43 
44  There are several situations that require a change of event handlers and a call to KeyFocusHandler::SetCurrentTargetEventHandler:
45  - Activation of TextSelection after creating a new TextFrame
46  - Deactivation of TextSelection after switching to pointer tool.
47  - Activation of TextSelection after clicking with pointer tool into TextFrame.
48 
49  PageItemFocus offers a convenient API for activating and deactivating. PageItemFocus is implemented in PublicLib with kPageItemFocusImpl. It is only used by kStandOffBoss.
50  FrameViewFocus is derived from PageItemFocus and is implemented in TextEditor with kFrameViewFocusImpl. It is only used by kTextEditorBoss:
51  - kStandOffBoss uses kPageItemFocusImpl
52  - kTextEditorBoss uses kFrameViewFocusImpl
53 
54  This interface is part of the PageItem widget. It helps to differentiate between
55  several cases of deactivation.
56  Grant/RevokePageItemFocus is called, when the pageitem has the focus (i.e. if the user edits it).
57  The selection would be visible and a TextCaret would blink.
58  Suspend/ResumePageItemFocus is called when the window or the layout control view is deactivated.
59  The selection would be shadowed, but a TextCaret would disappear.
60 
61  These are possible cases for Grant/Revoke and Suspend/Resume:
62  1) Deactivate Window => Suspend( kTrue )
63  2) Reactivate Window => Resume
64  3) Change the tool => Suspend( kFalse )
65  4) Change back to the first tool => Resume
66  5) Close Document => Revoke
67  6) Create new PageItem => Grant
68  7) Place a story => Revoke
69  8) Change to an EditBox in a Panel => Suspend( kTrue )
70 
71  Call stacks:
72 
73  (1) Call stack: Activation of TextSelection after creating a new TextFrame
74  - CreateMultiColumnItemCmd::Do
75  - DoUIStuff
76  - SelectUtils::ProcessSelectText
77  - TextSelectionIntegratorSuite::SetTextSelection
78  - TextSelectionSuite::SetTextSelection
79  - TextSelectionNavigator::SetTextSelection
80  - TextSelectionNavigator::SetTextSelection_
81  - CSubject::Change
82  - CChangeManager::SubjectChanged
83  - CSB_Observer::Update
84  - CSB_Observer::HandleASBSuiteMessage
85  - SelectionExt::HandleIntegratorSuiteMessage
86  - SelectionHighlighterASB::HandleIntegratorSuiteMessage
87  - CSubject::Change
88  - CChangeManager::SubjectChanged
89  - LayoutSelectionHighlightObserver::Update
90  - SelectionHighlighterASB::ChangeHighlighting
91  - TextSelectionHighlighter::ChangeHighlighting
92  - EditorToFrame::ActivateTextEditor
93  - FrameViewFocus::GrantPageItemFocus
94  - PageItemFocus::GrantPageItemFocus
95  - FrameViewFocus::Activate
96  - PageItemFocus::Activate
97  - KeyFocusHandler::SetCurrentTargetEventHandler
98  - KeyBoard::AcquireKeyFocus
99  - KeyBoard::GrabKeyFocus
100  - MFrameEventHandler::GetKeyFocus
101  - PageItemEventHandler::GetKeyFocus
102  - FrameViewFocus::GrantPageItemFocus
103  - CObserver::Release
104 
105  (2) Call stack: Deactivation of TextSelection after switching to pointer tool.
106  - SetToolCmd::Do
107  - ToolManager::SetActiveTool
108  - PointerTool::Select
109  - CTool::Select
110  - ToolChangeSuiteASB::ToolChanged
111  - ToolChangeSuiteTextCSB::ToolChanged
112  - ToolChangeSuiteTextCSB::SelectTextFrames
113  - SelectionManager::DeselectAll
114  - ConcreteTextSelection::DeselectAll
115  - TextSelectionIntegratorSuite::SetTextSelection
116  - TextSelectionSuite::SetTextSelection
117  - TextSelectionNavigator::SetTextSelection
118  - TextSelectionNavigator::SetTextSelection_
119  - CSubject::Change
120  - CChangeManager::SubjectChanged
121  - CSB_Observer::Update
122  - CSB_Observer::HandleASBSuiteMessage
123  - SelectionExt::HandleIntegratorSuiteMessage
124  - SelectionHighlighterASB::HandleIntegratorSuiteMessage
125  - CSubject::Change
126  - CChangeManager::SubjectChanged
127  - LayoutSelectionHighlightObserver::Update
128  - SelectionHighlighterASB::ChangeHighlighting
129  - TextSelectionHighlighter::ChangeHighlighting
130  - EditorToFrame::DeactivateTextEditor
131  - FrameViewFocus::RevokePageItemFocus
132  - PageItemFocus::RevokePageItemFocus
133  - FrameViewFocus::Deactivate
134 
135 
136 
137  (3) Call stack: Activation of TextSelection after clicking with pointer tool into TextFrame.
138  - LayoutEventHandler::LButtonDn
139  - LayoutEventHandler::BeginTracking
140  - IBeamTracker::BeginTracking
141  - CTracker::BeginTracking
142  - CTextSelectTracker::DoBeginTracking
143  - TextSelectionIntegratorSuite::SelectTextInViewBegin
144  - TextSelectionSuite::SelectTextInViewBegin
145  - TextSelectionSuite::TrackSingleClickBegin
146  - TextSelectionNavigator::SetTextSelectionHmm
147  - TextSelectionNavigator::SetTextSelection
148  - TextSelectionNavigator::SetTextSelection_
149  - CSubject::Change
150  - CChangeManager::SubjectChanged
151  - CSB_Observer::Update
152  - CSB_Observer::HandleASBSuiteMessage
153  - SelectionExt::HandleIntegratorSuiteMessage
154  - SelectionHighlighterASB::HandleIntegratorSuiteMessage
155  - CSubject::Change
156  - CChangeManager::SubjectChanged
157  - LayoutSelectionHighlightObserver::Update
158  - SelectionHighlighterASB::ChangeHighlighting
159  - TextSelectionHighlighter::ChangeHighlighting
160  - EditorToFrame::ActivateTextEditor
161  - FrameViewFocus::GrantPageItemFocus
162  - PageItemFocus::GrantPageItemFocus
163  - FrameViewFocus::Activate
164  - PageItemFocus::Activate
165  - KeyFocusHandler::SetCurrentTargetEventHandler
166  - KeyBoard::AcquireKeyFocus
167  - KeyBoard::GrabKeyFocus
168  - MFrameEventHandler::GetKeyFocus
169  - PageItemEventHandler::GetKeyFocus
170  - FrameViewFocus::GrantPageItemFocus
171  - PageItemFocus::GrantPageItemFocus
172 
173  ------------------------------------------------
174 
175  <sheridan>:
176  In looking to rework this interface, here are the current uses:
177 
178  IsPageItemFocusSuspended
179  ------------------------
180  decl
181  source/public/interfaces/ui/IPageItemFocus.h
182  source/private/widgets/includes/PageItemFocus.h
183  defn
184  source/private/widgets/pageitems/PageItemFocus.cpp
185  call
186  source/private/widgets/pageitems/PageItemEventHandler.cpp
187  source/components/texteditor/widget/FrameViewFocus.cpp
188  source/components/texteditor/widget/FrameEventHandler.cpp
189  source/components/text/selection/TextSelectionHighlighter.cpp
190  source/components/cjk/ime/IMETextObserver.cpp
191 
192 
193  SuspendPageItemFocus
194  --------------------
195  decl
196  source/public/interfaces/ui/IPageItemFocus.h
197  source/private/widgets/includes/PageItemFocus.h
198  defn
199  source/private/widgets/pageitems/PageItemFocus.cpp
200  source/components/texteditor/widget/FrameViewFocus.cpp
201  call
202  source/private/widgets/pageitems/PageItemEventHandler.cpp
203  source/components/widgets/pageitems/PageItemControlView.cpp
204  source/components/texteditor/widget/FrameViewFocus.cpp
205 
206 
207  ResumePageItemFocus
208  -------------------
209  decl
210  source/public/interfaces/ui/IPageItemFocus.h
211  source/private/widgets/includes/PageItemFocus.h
212  source/components/texteditor/widget/FrameViewFocus.cpp
213  defn
214  source/private/widgets/pageitems/PageItemFocus.cpp
215  source/components/texteditor/widget/FrameViewFocus.cpp
216  call
217  source/private/widgets/pageitems/PageItemFocus.cpp
218  source/private/widgets/pageitems/PageItemEventHandler.cpp
219  source/components/widgets/pageitems/PageItemControlView.cpp
220  source/components/texteditor/widget/FrameViewFocus.cpp
221 
222 
223  RevokePageItemFocus
224  -------------------
225  decl
226  source/public/interfaces/ui/IPageItemFocus.h
227  source/private/widgets/includes/PageItemFocus.h
228  source/components/texteditor/widget/FrameViewFocus.cpp
229  defn
230  source/private/widgets/pageitems/PageItemFocus.cpp
231  source/components/texteditor/widget/FrameViewFocus.cpp
232  call
233  source/public/trackers/CTracker.cpp
234  source/private/widgets/pageitems/PageItemEventHandler.cpp
235  source/components/widgets/pageitems/PageItemControlView.cpp
236  source/components/texteditor/widget/FrameViewFocus.cpp
237  source/components/texteditor/widget/FrameItemObserver.cpp
238  source/components/texteditor/widget/EditorToFrame.cpp
239  source/components/testing/testlib/qaclasses/QADoc.cpp
240 
241 
242  GrantPageItemFocus
243  ------------------
244  decl
245  source/public/interfaces/ui/IPageItemFocus.h
246  source/private/widgets/includes/PageItemFocus.h
247  source/components/texteditor/widget/FrameViewFocus.cpp
248  defn
249  source/private/widgets/pageitems/PageItemFocus.cpp
250  source/components/texteditor/widget/FrameViewFocus.cpp
251  call
252  source/private/widgets/pageitems/PageItemEventHandler.cpp
253  source/components/texteditor/widget/FrameViewFocus.cpp
254  source/components/texteditor/widget/EditorToFrame.cpp
255  source/components/pageitems/standoff/PageItemStandOff.cpp
256 
257 
258  IsPageItemFocused
259  -----------------
260  decl
261  source/public/interfaces/ui/IPageItemFocus.h
262  source/private/widgets/includes/PageItemFocus.h
263  defn
264  source/private/widgets/pageitems/PageItemFocus.cpp
265  call
266  source/private/widgets/pageitems/PageItemEventHandler.cpp
267  source/components/widgets/pageitems/PageItemControlView.cpp
268  source/components/texteditor/widget/FrameEventHandler.cpp
269 
270 
271 */
272 
312 {
313 public:
314  enum { kDefaultIID = IID_IPAGEITEMFOCUS };
315 
320  virtual void GrantPageItemFocus() = 0;
321 
326  virtual void RevokePageItemFocus() = 0;
327 
332  virtual bool16 IsPageItemFocused() const = 0;
333 
339  virtual void SuspendPageItemFocus( bool16 bKeepVisible ) = 0;
340 
345  virtual void ResumePageItemFocus() = 0;
346 
351  virtual bool16 IsPageItemFocusSuspended() const = 0;
352 };
353 
354 #endif