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