37e5e5f781104fd6d131b76b57702d268565965f
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
3
4 /*
5  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * 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, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/clipboard.h>
23 #include <dali/devel-api/text-abstraction/font-client.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/internal/text/input-style.h>
27 #include <dali-toolkit/internal/text/text-controller.h>
28 #include <dali-toolkit/internal/text/text-model.h>
29 #include <dali-toolkit/internal/text/text-view.h>
30
31 namespace Dali
32 {
33
34 namespace Toolkit
35 {
36
37 namespace Text
38 {
39
40 //Forward declarations
41 struct CursorInfo;
42
43 struct Event
44 {
45   // Used to queue input events until DoRelayout()
46   enum Type
47   {
48     CURSOR_KEY_EVENT,
49     TAP_EVENT,
50     PAN_EVENT,
51     LONG_PRESS_EVENT,
52     GRAB_HANDLE_EVENT,
53     LEFT_SELECTION_HANDLE_EVENT,
54     RIGHT_SELECTION_HANDLE_EVENT,
55     SELECT,
56     SELECT_ALL
57   };
58
59   union Param
60   {
61     int mInt;
62     unsigned int mUint;
63     float mFloat;
64   };
65
66   Event( Type eventType )
67   : type( eventType )
68   {
69     p1.mInt = 0;
70     p2.mInt = 0;
71     p3.mInt = 0;
72   }
73
74   Type type;
75   Param p1;
76   Param p2;
77   Param p3;
78 };
79
80 struct EventData
81 {
82   enum State
83   {
84     INACTIVE,
85     INTERRUPTED,
86     SELECTING,
87     EDITING,
88     EDITING_WITH_POPUP,
89     EDITING_WITH_GRAB_HANDLE,
90     EDITING_WITH_PASTE_POPUP,
91     GRAB_HANDLE_PANNING,
92     SELECTION_HANDLE_PANNING,
93     TEXT_PANNING
94   };
95
96   EventData( DecoratorPtr decorator );
97
98   ~EventData();
99
100   static bool IsEditingState( State stateToCheck )
101   {
102     return ( stateToCheck == EDITING || stateToCheck == EDITING_WITH_POPUP || stateToCheck == EDITING_WITH_GRAB_HANDLE || stateToCheck == EDITING_WITH_PASTE_POPUP );
103   }
104
105   DecoratorPtr       mDecorator;               ///< Pointer to the decorator.
106   ImfManager         mImfManager;              ///< The Input Method Framework Manager.
107   std::string        mPlaceholderTextActive;   ///< The text to display when the TextField is empty with key-input focus.
108   std::string        mPlaceholderTextInactive; ///< The text to display when the TextField is empty and inactive.
109   Vector4            mPlaceholderTextColor;    ///< The in/active placeholder text color.
110
111   /**
112    * This is used to delay handling events until after the model has been updated.
113    * The number of updates to the model is minimized to improve performance.
114    */
115   std::vector<Event> mEventQueue;              ///< The queue of touch events etc.
116
117   Vector<InputStyle::Mask> mInputStyleChangedQueue; ///< Queue of changes in the input style. Used to emit the signal in the iddle callback.
118
119   InputStyle         mInputStyle;              ///< The style to be set to the new inputed text.
120
121   State              mPreviousState;           ///< Stores the current state before it's updated with the new one.
122   State              mState;                   ///< Selection mode, edit mode etc.
123
124   CharacterIndex     mPrimaryCursorPosition;   ///< Index into logical model for primary cursor.
125   CharacterIndex     mLeftSelectionPosition;   ///< Index into logical model for left selection handle.
126   CharacterIndex     mRightSelectionPosition;  ///< Index into logical model for right selection handle.
127
128   CharacterIndex     mPreEditStartPosition;    ///< Used to remove the pre-edit text if necessary.
129   Length             mPreEditLength;           ///< Used to remove the pre-edit text if necessary.
130
131   float              mCursorHookPositionX;     ///< Used to move the cursor with the keys or when scrolling the text vertically with the handles.
132
133   Controller::NoTextTap::Action mDoubleTapAction; ///< Action to be done when there is a double tap on top of 'no text'
134   Controller::NoTextTap::Action mLongPressAction; ///< Action to be done when there is a long press on top of 'no text'
135
136   bool mIsShowingPlaceholderText        : 1;   ///< True if the place-holder text is being displayed.
137   bool mPreEditFlag                     : 1;   ///< True if the model contains text in pre-edit state.
138   bool mDecoratorUpdated                : 1;   ///< True if the decorator was updated during event processing.
139   bool mCursorBlinkEnabled              : 1;   ///< True if cursor should blink when active.
140   bool mGrabHandleEnabled               : 1;   ///< True if grab handle is enabled.
141   bool mGrabHandlePopupEnabled          : 1;   ///< True if the grab handle popu-up should be shown.
142   bool mSelectionEnabled                : 1;   ///< True if selection handles, highlight etc. are enabled.
143   bool mUpdateCursorHookPosition        : 1;   ///< True if the cursor hook position must be updated. Used to move the cursor with the keys 'up' and 'down'.
144   bool mUpdateCursorPosition            : 1;   ///< True if the visual position of the cursor must be recalculated.
145   bool mUpdateGrabHandlePosition        : 1;   ///< True if the visual position of the grab handle must be recalculated.
146   bool mUpdateLeftSelectionPosition     : 1;   ///< True if the visual position of the left selection handle must be recalculated.
147   bool mUpdateRightSelectionPosition    : 1;   ///< True if the visual position of the right selection handle must be recalculated.
148   bool mIsLeftHandleSelected            : 1;   ///< Whether is the left handle the one which is selected.
149   bool mIsRightHandleSelected           : 1;   ///< Whether is the right handle the one which is selected.
150   bool mUpdateHighlightBox              : 1;   ///< True if the text selection high light box must be updated.
151   bool mScrollAfterUpdatePosition       : 1;   ///< Whether to scroll after the cursor position is updated.
152   bool mScrollAfterDelete               : 1;   ///< Whether to scroll after delete characters.
153   bool mAllTextSelected                 : 1;   ///< True if the selection handles are selecting all the text.
154   bool mUpdateInputStyle                : 1;   ///< Whether to update the input style after moving the cursor.
155   bool mPasswordInput                   : 1;   ///< True if password input is enabled.
156   bool mCheckScrollAmount               : 1;   ///< Whether to check scrolled amount after updating the position
157 };
158
159 struct ModifyEvent
160 {
161   enum Type
162   {
163     TEXT_REPLACED,    ///< The entire text was replaced
164     TEXT_INSERTED,    ///< Insert characters at the current cursor position
165     TEXT_DELETED      ///< Characters were deleted
166   };
167
168   Type type;
169 };
170
171 struct FontDefaults
172 {
173   FontDefaults()
174   : mFontDescription(),
175     mDefaultPointSize( 0.f ),
176     mFontId( 0u ),
177     familyDefined( false ),
178     weightDefined( false ),
179     widthDefined( false ),
180     slantDefined( false ),
181     sizeDefined( false )
182   {
183     // Initially use the default platform font
184     TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
185     fontClient.GetDefaultPlatformFontDescription( mFontDescription );
186   }
187
188   FontId GetFontId( TextAbstraction::FontClient& fontClient )
189   {
190     if( !mFontId )
191     {
192       const PointSize26Dot6 pointSize = static_cast<PointSize26Dot6>( mDefaultPointSize * 64.f );
193       mFontId = fontClient.GetFontId( mFontDescription, pointSize );
194     }
195
196     return mFontId;
197   }
198
199   TextAbstraction::FontDescription mFontDescription;  ///< The default font's description.
200   float                            mDefaultPointSize; ///< The default font's point size.
201   FontId                           mFontId;           ///< The font's id of the default font.
202   bool familyDefined:1; ///< Whether the default font's family name is defined.
203   bool weightDefined:1; ///< Whether the default font's weight is defined.
204   bool  widthDefined:1; ///< Whether the default font's width is defined.
205   bool  slantDefined:1; ///< Whether the default font's slant is defined.
206   bool   sizeDefined:1; ///< Whether the default font's point size is defined.
207 };
208
209 /**
210  * @brief Stores indices used to update the text.
211  * Stores the character index where the text is updated and the number of characters removed and added.
212  * Stores as well indices to the first and the last paragraphs to be updated.
213  */
214 struct TextUpdateInfo
215 {
216   TextUpdateInfo()
217   : mCharacterIndex( 0u ),
218     mNumberOfCharactersToRemove( 0u ),
219     mNumberOfCharactersToAdd( 0u ),
220     mPreviousNumberOfCharacters( 0u ),
221     mParagraphCharacterIndex( 0u ),
222     mRequestedNumberOfCharacters( 0u ),
223     mStartGlyphIndex( 0u ),
224     mStartLineIndex( 0u ),
225     mEstimatedNumberOfLines( 0u ),
226     mClearAll( true ),
227     mFullRelayoutNeeded( true ),
228     mIsLastCharacterNewParagraph( false )
229   {}
230
231   ~TextUpdateInfo()
232   {}
233
234   CharacterIndex    mCharacterIndex;                ///< Index to the first character to be updated.
235   Length            mNumberOfCharactersToRemove;    ///< The number of characters to be removed.
236   Length            mNumberOfCharactersToAdd;       ///< The number of characters to be added.
237   Length            mPreviousNumberOfCharacters;    ///< The number of characters before the text update.
238
239   CharacterIndex    mParagraphCharacterIndex;       ///< Index of the first character of the first paragraph to be updated.
240   Length            mRequestedNumberOfCharacters;   ///< The requested number of characters.
241   GlyphIndex        mStartGlyphIndex;
242   LineIndex         mStartLineIndex;
243   Length            mEstimatedNumberOfLines;         ///< The estimated number of lines. Used to avoid reallocations when layouting.
244
245   bool              mClearAll:1;                    ///< Whether the whole text is cleared. i.e. when the text is reset.
246   bool              mFullRelayoutNeeded:1;          ///< Whether a full re-layout is needed. i.e. when a new size is set to the text control.
247   bool              mIsLastCharacterNewParagraph:1; ///< Whether the last character is a new paragraph character.
248
249   void Clear()
250   {
251     // Clear all info except the mPreviousNumberOfCharacters member.
252     mCharacterIndex = static_cast<CharacterIndex>( -1 );
253     mNumberOfCharactersToRemove = 0u;
254     mNumberOfCharactersToAdd = 0u;
255     mParagraphCharacterIndex = 0u;
256     mRequestedNumberOfCharacters = 0u;
257     mStartGlyphIndex = 0u;
258     mStartLineIndex = 0u;
259     mEstimatedNumberOfLines = 0u;
260     mClearAll = false;
261     mFullRelayoutNeeded = false;
262     mIsLastCharacterNewParagraph = false;
263   }
264 };
265
266 struct UnderlineDefaults
267 {
268   std::string properties;
269   // TODO: complete with underline parameters.
270 };
271
272 struct ShadowDefaults
273 {
274   std::string properties;
275   // TODO: complete with shadow parameters.
276 };
277
278 struct EmbossDefaults
279 {
280   std::string properties;
281   // TODO: complete with emboss parameters.
282 };
283
284 struct OutlineDefaults
285 {
286   std::string properties;
287   // TODO: complete with outline parameters.
288 };
289
290 struct Controller::Impl
291 {
292   Impl( ControlInterface* controlInterface,
293         EditableControlInterface* editableControlInterface )
294   : mControlInterface( controlInterface ),
295     mEditableControlInterface( editableControlInterface ),
296     mModel(),
297     mFontDefaults( NULL ),
298     mUnderlineDefaults( NULL ),
299     mShadowDefaults( NULL ),
300     mEmbossDefaults( NULL ),
301     mOutlineDefaults( NULL ),
302     mEventData( NULL ),
303     mFontClient(),
304     mClipboard(),
305     mView(),
306     mMetrics(),
307     mModifyEvents(),
308     mTextColor( Color::BLACK ),
309     mTextUpdateInfo(),
310     mOperationsPending( NO_OPERATION ),
311     mMaximumNumberOfCharacters( 50u ),
312     mRecalculateNaturalSize( true ),
313     mMarkupProcessorEnabled( false ),
314     mClipboardHideEnabled( true ),
315     mIsAutoScrollEnabled( false ),
316     mAutoScrollDirectionRTL( false )
317   {
318     mModel = Model::New();
319
320     mFontClient = TextAbstraction::FontClient::Get();
321     mClipboard = Clipboard::Get();
322
323     mView.SetVisualModel( mModel->mVisualModel );
324
325     // Use this to access FontClient i.e. to get down-scaled Emoji metrics.
326     mMetrics = Metrics::New( mFontClient );
327     mLayoutEngine.SetMetrics( mMetrics );
328
329     // Set the text properties to default
330     mModel->mVisualModel->SetUnderlineEnabled( false );
331     mModel->mVisualModel->SetUnderlineHeight( 0.0f );
332   }
333
334   ~Impl()
335   {
336     delete mFontDefaults;
337     delete mUnderlineDefaults;
338     delete mShadowDefaults;
339     delete mEmbossDefaults;
340     delete mOutlineDefaults;
341     delete mEventData;
342   }
343
344   // Text Controller Implementation.
345
346   /**
347    * @copydoc Text::Controller::RequestRelayout()
348    */
349   void RequestRelayout();
350
351   /**
352    * @brief Request a relayout using the ControlInterface.
353    */
354   void QueueModifyEvent( ModifyEvent::Type type )
355   {
356     if( ModifyEvent::TEXT_REPLACED == type)
357     {
358       // Cancel previously queued inserts etc.
359       mModifyEvents.Clear();
360     }
361
362     ModifyEvent event;
363     event.type = type;
364     mModifyEvents.PushBack( event );
365
366     // The event will be processed during relayout
367     RequestRelayout();
368   }
369
370   /**
371    * @brief Helper to move the cursor, grab handle etc.
372    */
373   bool ProcessInputEvents();
374
375   /**
376    * @brief Helper to check whether any place-holder text is available.
377    */
378   bool IsPlaceholderAvailable() const
379   {
380     return ( mEventData &&
381              ( !mEventData->mPlaceholderTextInactive.empty() ||
382                !mEventData->mPlaceholderTextActive.empty() )
383            );
384   }
385
386   bool IsShowingPlaceholderText() const
387   {
388     return ( mEventData && mEventData->mIsShowingPlaceholderText );
389   }
390
391   /**
392    * @brief Helper to check whether active place-holder text is available.
393    */
394   bool IsFocusedPlaceholderAvailable() const
395   {
396     return ( mEventData && !mEventData->mPlaceholderTextActive.empty() );
397   }
398
399   bool IsShowingRealText() const
400   {
401     return ( !IsShowingPlaceholderText() &&
402              0u != mModel->mLogicalModel->mText.Count() );
403   }
404
405   /**
406    * @brief Called when placeholder-text is hidden
407    */
408   void PlaceholderCleared()
409   {
410     if( mEventData )
411     {
412       mEventData->mIsShowingPlaceholderText = false;
413
414       // Remove mPlaceholderTextColor
415       mModel->mVisualModel->SetTextColor( mTextColor );
416     }
417   }
418
419   void ClearPreEditFlag()
420   {
421     if( mEventData )
422     {
423       mEventData->mPreEditFlag = false;
424       mEventData->mPreEditStartPosition = 0;
425       mEventData->mPreEditLength = 0;
426     }
427   }
428
429   void ResetImfManager()
430   {
431     if( mEventData )
432     {
433       // Reset incase we are in a pre-edit state.
434       if( mEventData->mImfManager )
435       {
436         mEventData->mImfManager.Reset(); // Will trigger a message ( commit, get surrounding )
437       }
438
439       ClearPreEditFlag();
440     }
441   }
442
443   /**
444    * @brief Helper to notify IMF manager with surrounding text & cursor changes.
445    */
446   void NotifyImfManager();
447
448   /**
449    * @brief Helper to notify IMF manager with multi line status.
450    */
451   void NotifyImfMultiLineStatus();
452
453   /**
454    * @brief Retrieve the current cursor position.
455    *
456    * @return The cursor position.
457    */
458   CharacterIndex GetLogicalCursorPosition() const;
459
460   /**
461    * @brief Retrieves the number of consecutive white spaces starting from the given @p index.
462    *
463    * @param[in] index The character index from where to count the number of consecutive white spaces.
464    *
465    * @return The number of consecutive white spaces.
466    */
467   Length GetNumberOfWhiteSpaces( CharacterIndex index ) const;
468
469   /**
470    * @brief Retrieve any text previously set starting from the given @p index.
471    *
472    * @param[in] index The character index from where to retrieve the text.
473    * @param[out] text A string of UTF-8 characters.
474    *
475    * @see Dali::Toolkit::Text::Controller::GetText()
476    */
477   void GetText( CharacterIndex index, std::string& text ) const;
478
479   bool IsClipboardEmpty()
480   {
481     bool result( mClipboard && mClipboard.NumberOfItems() );
482     return !result; // If NumberOfItems greater than 0, return false
483   }
484
485   bool IsClipboardVisible()
486   {
487     bool result( mClipboard && mClipboard.IsVisible() );
488     return result;
489   }
490
491   /**
492    * @brief Calculates the start character index of the first paragraph to be updated and
493    * the end character index of the last paragraph to be updated.
494    *
495    * @param[out] numberOfCharacters The number of characters to be updated.
496    */
497   void CalculateTextUpdateIndices( Length& numberOfCharacters );
498
499   /**
500    * @brief Helper to clear completely the parts of the model specified by the given @p operations.
501    *
502    * @note It never clears the text stored in utf32.
503    */
504   void ClearFullModelData( OperationsMask operations );
505
506   /**
507    * @brief Helper to clear completely the parts of the model related with the characters specified by the given @p operations.
508    *
509    * @note It never clears the text stored in utf32.
510    *
511    * @param[in] startIndex Index to the first character to be cleared.
512    * @param[in] endIndex Index to the last character to be cleared.
513    * @param[in] operations The operations required.
514    */
515   void ClearCharacterModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
516
517   /**
518    * @brief Helper to clear completely the parts of the model related with the glyphs specified by the given @p operations.
519    *
520    * @note It never clears the text stored in utf32.
521    * @note Character indices are transformed to glyph indices.
522    *
523    * @param[in] startIndex Index to the first character to be cleared.
524    * @param[in] endIndex Index to the last character to be cleared.
525    * @param[in] operations The operations required.
526    */
527   void ClearGlyphModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
528
529   /**
530    * @brief Helper to clear the parts of the model specified by the given @p operations and from @p startIndex to @p endIndex.
531    *
532    * @note It never clears the text stored in utf32.
533    *
534    * @param[in] startIndex Index to the first character to be cleared.
535    * @param[in] endIndex Index to the last character to be cleared.
536    * @param[in] operations The operations required.
537    */
538   void ClearModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
539
540   /**
541    * @brief Updates the logical and visual models. Updates the style runs in the visual model when the text's styles changes.
542    *
543    * When text or style changes the model is set with some operations pending.
544    * When i.e. the text's size or a relayout is required this method is called
545    * with a given @p operationsRequired parameter. The operations required are
546    * matched with the operations pending to perform the minimum number of operations.
547    *
548    * @param[in] operationsRequired The operations required.
549    *
550    * @return @e true if the model has been modified.
551    */
552   bool UpdateModel( OperationsMask operationsRequired );
553
554   /**
555    * @brief Retreieves the default style.
556    *
557    * @param[out] inputStyle The default style.
558    */
559   void RetrieveDefaultInputStyle( InputStyle& inputStyle );
560
561   /**
562    * @brief Retrieve the line height of the default font.
563    */
564   float GetDefaultFontLineHeight();
565
566   void OnCursorKeyEvent( const Event& event );
567
568   void OnTapEvent( const Event& event );
569
570   void OnPanEvent( const Event& event );
571
572   void OnLongPressEvent( const Event& event );
573
574   void OnHandleEvent( const Event& event );
575
576   void OnSelectEvent( const Event& event );
577
578   void OnSelectAllEvent();
579
580   /**
581    * @brief Retrieves the selected text. It removes the text if the @p deleteAfterRetrieval parameter is @e true.
582    *
583    * @param[out] selectedText The selected text encoded in utf8.
584    * @param[in] deleteAfterRetrieval Whether the text should be deleted after retrieval.
585    */
586   void RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval );
587
588   void ShowClipboard();
589
590   void HideClipboard();
591
592   void SetClipboardHideEnable(bool enable);
593
594   bool CopyStringToClipboard( std::string& source );
595
596   void SendSelectionToClipboard( bool deleteAfterSending );
597
598   void RequestGetTextFromClipboard();
599
600   void RepositionSelectionHandles();
601   void RepositionSelectionHandles( float visualX, float visualY, Controller::NoTextTap::Action action );
602
603   void SetPopupButtons();
604
605   void ChangeState( EventData::State newState );
606
607   /**
608    * @brief Calculates the cursor's position for a given character index in the logical order.
609    *
610    * It retrieves as well the line's height and the cursor's height and
611    * if there is a valid alternative cursor, its position and height.
612    *
613    * @param[in] logical The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
614    * @param[out] cursorInfo The line's height, the cursor's height, the cursor's position and whether there is an alternative cursor.
615    */
616   void GetCursorPosition( CharacterIndex logical,
617                           CursorInfo& cursorInfo );
618
619   /**
620    * @brief Calculates the new cursor index.
621    *
622    * It takes into account that in some scripts multiple characters can form a glyph and all of them
623    * need to be jumped with one key event.
624    *
625    * @param[in] index The initial new index.
626    *
627    * @return The new cursor index.
628    */
629   CharacterIndex CalculateNewCursorIndex( CharacterIndex index ) const;
630
631   /**
632    * @brief Updates the cursor position.
633    *
634    * Sets the cursor's position into the decorator. It transforms the cursor's position into decorator's coords.
635    * It sets the position of the secondary cursor if it's a valid one.
636    * Sets which cursors are active.
637    *
638    * @param[in] cursorInfo Contains the selection handle position in Actor's coords.
639    *
640    */
641   void UpdateCursorPosition( const CursorInfo& cursorInfo );
642
643   /**
644    * @brief Updates the position of the given selection handle. It transforms the handle's position into decorator's coords.
645    *
646    * @param[in] handleType One of the selection handles.
647    * @param[in] cursorInfo Contains the selection handle position in Actor's coords.
648    */
649   void UpdateSelectionHandle( HandleType handleType,
650                               const CursorInfo& cursorInfo );
651
652   /**
653    * @biref Clamps the horizontal scrolling to get the control always filled with text.
654    *
655    * @param[in] layoutSize The size of the laid out text.
656    */
657   void ClampHorizontalScroll( const Vector2& layoutSize );
658
659   /**
660    * @biref Clamps the vertical scrolling to get the control always filled with text.
661    *
662    * @param[in] layoutSize The size of the laid out text.
663    */
664   void ClampVerticalScroll( const Vector2& layoutSize );
665
666   /**
667    * @brief Scrolls the text to make a position visible.
668    *
669    * @pre mEventData must not be NULL. (there is a text-input or selection capabilities).
670    *
671    * @param[in] position A position in text coords.
672    * @param[in] lineHeight The line height for the given position.
673    *
674    * This method is called after inserting text, moving the cursor with the grab handle or the keypad,
675    * or moving the selection handles.
676    */
677   void ScrollToMakePositionVisible( const Vector2& position, float lineHeight );
678
679   /**
680    * @brief Scrolls the text to make the cursor visible.
681    *
682    * This method is called after deleting text.
683    */
684   void ScrollTextToMatchCursor( const CursorInfo& cursorInfo );
685
686 private:
687   // Declared private and left undefined to avoid copies.
688   Impl( const Impl& );
689   // Declared private and left undefined to avoid copies.
690   Impl& operator=( const Impl& );
691
692 public:
693
694   ControlInterface* mControlInterface;     ///< Reference to the text controller.
695   EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
696   ModelPtr mModel;                         ///< Pointer to the text's model.
697   FontDefaults* mFontDefaults;             ///< Avoid allocating this when the user does not specify a font.
698   UnderlineDefaults* mUnderlineDefaults;   ///< Avoid allocating this when the user does not specify underline parameters.
699   ShadowDefaults* mShadowDefaults;         ///< Avoid allocating this when the user does not specify shadow parameters.
700   EmbossDefaults* mEmbossDefaults;         ///< Avoid allocating this when the user does not specify emboss parameters.
701   OutlineDefaults* mOutlineDefaults;       ///< Avoid allocating this when the user does not specify outline parameters.
702   EventData* mEventData;                   ///< Avoid allocating everything for text input until EnableTextInput().
703   TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
704   Clipboard mClipboard;                    ///< Handle to the system clipboard
705   View mView;                              ///< The view interface to the rendering back-end.
706   MetricsPtr mMetrics;                     ///< A wrapper around FontClient used to get metrics & potentially down-scaled Emoji metrics.
707   Layout::Engine mLayoutEngine;            ///< The layout engine.
708   Vector<ModifyEvent> mModifyEvents;       ///< Temporary stores the text set until the next relayout.
709   Vector4 mTextColor;                      ///< The regular text color
710   TextUpdateInfo mTextUpdateInfo;          ///< Info of the characters updated.
711   OperationsMask mOperationsPending;       ///< Operations pending to be done to layout the text.
712   Length mMaximumNumberOfCharacters;       ///< Maximum number of characters that can be inserted.
713
714   bool mRecalculateNaturalSize:1;          ///< Whether the natural size needs to be recalculated.
715   bool mMarkupProcessorEnabled:1;          ///< Whether the mark-up procesor is enabled.
716   bool mClipboardHideEnabled:1;            ///< Whether the ClipboardHide function work or not
717   bool mIsAutoScrollEnabled:1;             ///< Whether auto text scrolling is enabled.
718   CharacterDirection mAutoScrollDirectionRTL:1;  ///< Direction of auto scrolling, true if rtl
719
720 };
721
722 } // namespace Text
723
724 } // namespace Toolkit
725
726 } // namespace Dali
727
728 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H