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