f35f2de37a2dd004369b0054f813e3e76f71dd95
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
24 #include <dali-toolkit/internal/controls/text-view/text-actor-cache.h>
25 #include <dali-toolkit/internal/controls/text-view/text-view-processor-types.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35
36 /**
37  * TextView is a custom control for text aligning and multiline support
38  */
39 class TextView : public Control
40 {
41 public:
42
43   // Properties
44   enum
45   {
46     TEXTVIEW_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
47     TEXTVIEW_PROPERTY_END_INDEX = TEXTVIEW_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
48   };
49
50   /**
51    * Internal exceed policy with the valid combinations.
52    */
53   enum ExceedPolicy
54   {
55     Original,             ///< Original size (even if it exceeds the witdh or the height).
56     OriginalFade,         ///< Original size if it exceeds the width but faded if it exceeds the height.
57     OriginalShrink,       ///< Shrunk if it exceeds the height.
58     SplitOriginal,        ///< Split if it exceeds the width but no action if it exceeds the height.
59     SplitFade,            ///< Split if it exceeds the width and faded if it exceeds the height.
60     SplitShrink,          ///< Split if it exceeds the width and shrunk if it exceeds the height.
61     SplitEllipsizeEnd,    ///< Split if it exceeds the width and ellipsize if it exceeds the height.
62     Fade,                 ///< Faded if it exceeds any boundary.
63     FadeOriginal,         ///< Faded if it exceeds the width but no action if it exceeds the height.
64     ShrinkOriginal,       ///< Shrunk if it exceeds the width but no action if it exceeds the height.
65     ShrinkFade,           ///< Shrunk if it exceeds the width and faded if it exceeds the height.
66     Shrink,               ///< Shrunk if it exceeds any boundary.
67     EllipsizeEndOriginal, ///< Ellipsized by the end if it exceeds the width but no action if it exceeds the height.
68     EllipsizeEnd          ///< Ellipsized by the end if it exceeds the width and/or the height.
69   };
70
71   // Between two OnRelaidOut methods, several calls to InsertTextAt, RemoveTextFrom or SetText can happen.
72   // TextViewProcessorMetadata stores the type of operation. A vector stores all operations between two OnRelaidOut calls.
73
74   enum TextViewProcessorMetadataType
75   {
76     TextSet,             ///< Sets new text.
77     TextInserted,        ///< Inserts text into current text.
78     TextReplaced,        ///< Replaces some text from current text.
79     TextRemoved,         ///< Removes some text from current text.
80     NewLineHeight,       ///< Sets a new line height offset.
81     NewStyle             ///< Sets a new style to the whole text.
82   };
83
84   /**
85    * Stores info about which data structures need to be modified when the OnRelaidOut() method is called
86    */
87   struct TextViewProcessorMetadata
88   {
89     TextViewProcessorMetadata();
90
91     TextViewProcessorMetadataType    mType;               ///< Stores the type of operation.
92     std::size_t                      mPosition;           ///< Character position within the text.
93     std::size_t                      mNumberOfCharacters; ///< Number of characters to be removed/ replaced.
94     MarkupProcessor::StyledTextArray mText;               ///< The new text.
95     TextStyle::Mask                  mStyleMask;          ///< The style mask.
96   };
97
98   /**
99    * Defines which operations have to be done in the relayout process.
100    */
101   enum RelayoutOperationMask
102   {
103     NO_RELAYOUT = 0x0,                         ///< Does nothing.
104     RELAYOUT_REMOVE_TEXT_ACTORS = 0x1,         ///< Removes current text-actors from the text-view.
105     RELAYOUT_SIZE_POSITION = 0x2,              ///< Calculates size and position of the text but it doesn't calculate alignment.
106     RELAYOUT_ALIGNMENT = 0x4,                  ///< Aligns the whole text.
107     RELAYOUT_VISIBILITY = 0x8,                 ///< Calculates the visibility.
108     RELAYOUT_INITIALIZE_TEXT_ACTORS = 0x10,    ///< Initialize text-actors (create handles).
109     RELAYOUT_TEXT_ACTOR_UPDATE = 0x20,         ///< Updates text-actors (set size, position, style, ...)
110     RELAYOUT_INSERT_TO_TEXT_VIEW = 0x40,       ///< Adds the text-actors to the text-view.
111     RELAYOUT_ALL = 0xFF                        ///< Does all operations.
112   };
113
114   //////////////////////////////////////////////
115
116   /**
117    * Create a new TextView.
118    * @return A smart-pointer to the newly allocated TextView.
119    */
120   static Toolkit::TextView New();
121
122   /**
123    * @copydoc SetText( const std::string& text )
124    */
125   void SetText( const std::string& text );
126
127   /**
128    * @copydoc SetText( const StyledTextArray& text )
129    */
130   void SetText( const MarkupProcessor::StyledTextArray& text );
131
132   /**
133    * @copydoc InsertTextAt( std::size_t position, const std::string& text )
134    */
135   void InsertTextAt( std::size_t position, const std::string& text );
136
137   /**
138    * @copydoc InsertTextAt( std::size_t position, const std::string& text )
139    */
140   void InsertTextAt( std::size_t position, const MarkupProcessor::StyledTextArray& text );
141
142   /**
143    * @copydoc RemoveTextFrom( std::size_t position, std::size_t numberOfCharacters )
144    */
145   void RemoveTextFrom( std::size_t position, std::size_t numberOfCharacters );
146
147   /**
148    * @copydoc ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const std::string& text )
149    */
150   void ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const std::string& text );
151
152   /**
153    * @copydoc ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const std::string& text )
154    */
155   void ReplaceTextFromTo( std::size_t position, std::size_t numberOfCharacters, const MarkupProcessor::StyledTextArray& text );
156
157   /**
158    * @copydoc GetText()
159    */
160   std::string GetText() const;
161
162   /**
163    * @copydoc SetLineHeightOffset()
164    */
165   void SetLineHeightOffset( PointSize offset );
166
167   /**
168    * @copydoc GetLineHeightOffset()
169    */
170   PointSize GetLineHeightOffset() const;
171
172   /**
173    * @copydoc SetStyleToCurrentText()
174    */
175   void SetStyleToCurrentText( const TextStyle& style, TextStyle::Mask mask );
176
177   /**
178    * @copydoc SetTextAlignment( Toolkit::Alignment::Type align )
179    */
180   void SetTextAlignment( Toolkit::Alignment::Type align );
181
182   /**
183    * @copydoc GetTextAlignment()
184    */
185   Toolkit::Alignment::Type GetTextAlignment() const;
186
187   /**
188    * @copydoc SetMultilinePolicy()
189    */
190   void SetMultilinePolicy( Toolkit::TextView::MultilinePolicy policy );
191
192   /**
193    * @copydoc GetMultilinePolicy()
194    */
195   Toolkit::TextView::MultilinePolicy GetMultilinePolicy() const;
196
197   /**
198    * @copydoc SetWidthExceedPolicy()
199    */
200   void SetWidthExceedPolicy( Toolkit::TextView::ExceedPolicy policy );
201
202   /**
203    * @copydoc GetWidthExceedPolicy()
204    */
205   Toolkit::TextView::ExceedPolicy GetWidthExceedPolicy() const;
206
207   /**
208    * @copydoc SetHeightExceedPolicy()
209    */
210   void SetHeightExceedPolicy( Toolkit::TextView::ExceedPolicy policy );
211
212   /**
213    * @copydoc GetHeightExceedPolicy()
214    */
215   Toolkit::TextView::ExceedPolicy GetHeightExceedPolicy() const;
216
217   /**
218    * @copydoc SetLineJustification()
219    */
220   void SetLineJustification( Toolkit::TextView::LineJustification justification );
221
222   /**
223    * @copydoc GetLineJustification()
224    */
225   Toolkit::TextView::LineJustification GetLineJustification() const;
226
227   /**
228    * @copydoc SetFadeBoundary()
229    */
230   void SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary );
231
232   /**
233    * @copydoc GetFadeBoundary()
234    */
235   const Toolkit::TextView::FadeBoundary& GetFadeBoundary() const;
236
237   /**
238    * @copydoc SetEllipsizeText()
239    */
240   void SetEllipsizeText( const std::string& ellipsizeText );
241
242   /**
243    * @copydoc SetEllipsizeText()
244    */
245   void SetEllipsizeText( const MarkupProcessor::StyledTextArray& ellipsizeText );
246
247   /**
248    * @copydoc GetEllipsizeText()
249    */
250   std::string GetEllipsizeText() const;
251
252   /**
253    * Checks if relayout the text is needed. If it is, it relais out the text
254    * by calling DoRelayOut().
255    */
256   void GetTextLayoutInfo();
257
258   /**
259    * Calls GetTextLayoutInfo() and fills the given data structure.
260    *
261    * @see GetTextLayoutInfo()
262    */
263   void GetTextLayoutInfo( Toolkit::TextView::TextLayoutInfo& textLayoutInfo );
264
265   /**
266    * @copydoc SetSortModifier()
267    */
268   void SetSortModifier( float depthOffset );
269
270   /**
271    * @copydoc SetSnapshotModeEnabled()
272    */
273   void SetSnapshotModeEnabled( bool enable );
274
275   /**
276    * @copydoc IsSnapshotModeEnabled()
277    */
278   bool IsSnapshotModeEnabled() const;
279
280   /**
281    * @brief Sets whether markup processing should be carried out.
282    *
283    * @param[in] enable whether markup processing is carried out or not.
284    */
285   void SetMarkupProcessingEnabled( bool enable );
286
287   /**
288    * @brief Returns whether markup processing is enabled or not
289    *
290    * @return true is markup processing is enabled
291    */
292   bool IsMarkupProcessingEnabled() const;
293
294   /**
295    * @copydoc SetScrollEnabled()
296    */
297   void SetScrollEnabled( bool enable );
298
299   /**
300    * @copydoc IsScrollEnabled()
301    */
302   bool IsScrollEnabled() const;
303
304   /**
305    * @copydoc SetScrollPosition()
306    * @see DoSetScrollPosition()
307    */
308   void SetScrollPosition( const Vector2& position );
309
310   /**
311    * @copydoc GetScrollPosition()
312    */
313   const Vector2& GetScrollPosition() const;
314
315   /**
316    * @copydoc IsScrollPositionTrimmed()
317    */
318   bool IsScrollPositionTrimmed() const;
319
320   /**
321    * @copydoc ScrolledSignal()
322    */
323   Toolkit::TextView::ScrolledSignalV2& ScrolledSignal();
324
325   /**
326    * Connects a callback function with the object's signals.
327    * @param[in] object The object providing the signal.
328    * @param[in] tracker Used to disconnect the signal.
329    * @param[in] signalName The signal to connect to.
330    * @param[in] functor A newly allocated FunctorDelegate.
331    * @return True if the signal was connected.
332    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
333    */
334   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
335
336   // Properties
337
338   /**
339    * Called when a property of an object of this type is set.
340    * @param[in] object The object whose property is set.
341    * @param[in] index The property index.
342    * @param[in] value The new property value.
343    */
344   static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
345
346   /**
347    * Called to retrieve a property of an object of this type.
348    * @param[in] object The object whose property is to be retrieved.
349    * @param[in] index The property index.
350    * @return The current value of the property.
351    */
352   static Property::Value GetProperty( BaseObject* object, Property::Index index );
353
354
355 private: // From Control
356
357   /**
358    * @copydoc Toolkit::Control::OnInitialize()
359    */
360   virtual void OnInitialize();
361
362   /**
363    * @copydoc Toolkit::Control::OnFontChange( )
364    */
365   virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange );
366
367   /**
368    * @copydoc Toolkit::Control::OnControlSizeSet()
369    */
370   virtual void OnControlSizeSet( const Vector3& size );
371
372   /**
373    * @copydoc Toolkit::Control::OnRelaidOut()
374    *
375    * Removes text-actor and calls DoRelayOut()..
376    */
377   virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
378
379   /**
380    * Retrieves the text-view's natural size.
381    *
382    * @return The natural size.
383    */
384   virtual Vector3 GetNaturalSize();
385
386   /**
387    * Retrieves the text-view's \e height for a given \e width.
388    *
389    * @param[in] width The given \e width.
390    *
391    * @return The \e height for the given \e width.
392    */
393   virtual float GetHeightForWidth( float width );
394
395   /**
396    * Retrieves the text-view's \e width for a given \e height.
397    *
398    * @param[in] height The given \e height.
399    *
400    * @return The \e width for the given \e height.
401    */
402   virtual float GetWidthForHeight( float height );
403
404 protected:
405
406   /**
407    * Construct a new TextView.
408    */
409   TextView();
410
411   /**
412    * A reference counted object may only be deleted by calling Unreference()
413    */
414   virtual ~TextView();
415
416 private:
417
418   // Undefined
419   TextView( const TextView& );
420
421   // Undefined
422   TextView& operator=( const TextView& rhs );
423
424   /**
425    * Executes synchronously relayout operations such as set, insert, remove or replace text, etc.
426    */
427   void PerformTextViewProcessorOperations();
428
429   /**
430    * Optimizes some text-view processor operations.
431    */
432   void OptimizeTextViewProcessorOperations();
433
434   /**
435    * Synchronously relays-out all text-actors.
436    *
437    * Perform text-view-processor operations, sets the new size and position of text-actors and adds them to the text-view.
438    *
439    * @param[in] textViewSize The new text-view's size.
440    * @param[in] relayoutOperationMask Defines which operations need to be done in the relayout process.
441    */
442   void DoRelayOut( const Size& textViewSize, RelayoutOperationMask relayoutOperationMask );
443
444   /**
445    * Process Snapshot. It refresh the render-task in order to generate a new snapshot image.
446    *
447    * ProcessSnapshot is called from OnRelaidOut() only if text has been relaid out.
448    * It creates a new image buffer only if the size of the text has changed.
449    *
450    * @param[in] textViewSize The new text-view's size.
451    */
452   void ProcessSnapshot( const Size& textViewSize );
453
454   /**
455    * Aligns the offscreen rendering camera actor to cover the whole text and the resulting image actor accordingly with the text view's alignment.
456    *
457    * @param[in] textViewSize The text view's size.
458    * @param[in] offscreenSize The offscreen's frame buffer's size.
459    */
460   void AlignOffscreenCameraActor( const Size& textViewSize, const Size& offscreenSize );
461
462   /**
463    * Callback called when the render task has processed.
464    *
465    * It makes the root actor invisible.
466    *
467    * @param[in] renderTask The processed render task.
468    */
469   void RenderTaskFinished( Dali::RenderTask& renderTask );
470
471   /**
472    * Destroys offscreen rendering resources.
473    *
474    * It disconects the render task finished signal from the TextView::RenderTaskFinished() method,
475    * removes the render task from the render task list and resets the offscreen camera actor, root actor,
476    * image actor and the frame buffer.
477    */
478   void DestroyOffscreenRenderingResources();
479
480   /**
481    * Called when text-view is scrolled.
482    *
483    * Sets the new scroll position. @see DoSetScrollPosition()
484    *
485    * @param[in] actor Handle of the text-view.
486    * @param[in] gesture Data structure with the parameters of the gesture.
487    */
488   void OnTextPan( Actor actor, PanGesture gesture );
489
490   /**
491    * Ensures the text-view's boundaries are fully covered of text.
492    *
493    * i.e. if the text-view's size is 100x100 and the text's size is 150x100, the scroll position
494    * can be in the range -50,0 and 50,0.
495    */
496   void TrimScrollPosition();
497
498   /**
499    * Called from SetScrollPosition() and OnTextPan()
500    *
501    * Updates the stored scroll position ensuring the text-view is always covered with text by calling
502    * TrimScrollPosition(), calculates the difference with the previous one and emits the Toolkit::TextView::SignalScrolled() signal.
503    *
504    * @param[in] position The new scroll position.
505    */
506   void DoSetScrollPosition( const Vector2& position );
507
508   /**
509    * Combines width and height exceed policies.
510    *
511    * This method is a big switch() which combines two exceed policies into one.
512    * The aim is avoid this switch inside the relayout code.
513    *
514    * i.e.  Width policy = Split. Height policy = Original. Internally the policy is SplitOriginal.
515    */
516   void CombineExceedPolicies();
517
518   /**
519    * Retrieves the text-view's root actor which stores all text-actors.
520    * It could be the text-view itself or an actor used in the snapshot mode.
521    *
522    * @return the root actor.
523    */
524   Actor GetRootActor() const;
525
526   /**
527    * Handle SetProperty for markup processing.
528    * @param[in] propertyValue The new property value.
529    */
530   void OnMarkupEnabledPeopertySet( Property::Value propertyValue );
531
532   /**
533    * Handles SetProperty for multiline policy.
534    * @param[in] propertyValue The new property value.
535    */
536   void OnMultilinePolicyPropertySet( Property::Value propertyValue );
537
538   /**
539    * Handles SetProperty for width exceed policy.
540    * @param[in] propertyValue The new property value.
541    */
542   void OnWidthExceedPolicyPropertySet( Property::Value propertyValue );
543
544   /**
545    * Handles SetProperty for height exceed policy.
546    * @param[in] propertyValue The new property value.
547    */
548   void OnHeightExceedPolicyPropertySet( Property::Value propertyValue );
549
550   /**
551    * Handles SetProperty for line justification.
552    * @param[in] propertyValue The new property value.
553    */
554   void OnLineJustificationPropertySet( Property::Value propertyValue );
555
556   /**
557    * Handles SetProperty for fade boundary.
558    * @param[in] propertyValue The new property value.
559    */
560   void OnFadeBoundaryPropertySet( Property::Value propertyValue );
561
562   /**
563    * Handles SetProperty for alignment property.
564    * @param[in] propertyIndex The property index.
565    * @param[in] propertyValue The new property value.
566    */
567   void OnAlignmentPropertySet( Property::Index propertyIndex, Property::Value propertyValue );
568
569   /**
570    * Handles GetProperty for horizontal alignment property.
571    * @return The property value of horizontal alignment.
572    */
573   std::string OnHorizontalAlignmentPropertyGet();
574
575   /**
576    * Handles GetProperty for vertical alignment property.
577    * @return The property value of vertical alignment.
578    */
579   std::string OnVerticalAlignmentPropertyGet();
580
581 public:
582
583   /**
584    * The parameters which affects the layout of the text.
585    */
586   struct LayoutParameters
587   {
588     /**
589      * Default constructor.
590      */
591     LayoutParameters();
592
593     /**
594      * Constructor
595      */
596     LayoutParameters( Toolkit::TextView::MultilinePolicy     multilinePolicy,
597                       Toolkit::TextView::ExceedPolicy        widthExceedPolicy,
598                       Toolkit::TextView::ExceedPolicy        heightExceedPolicy,
599                       Toolkit::Alignment::Type               alignment,
600                       Toolkit::TextView::LineJustification   lineJustification,
601                       float                                  lineHeightOffset,
602                       const std::string&                     ellipsizeText,
603                       bool                                   markUpEnabled );
604
605     /**
606      * Copy constructor
607      */
608     LayoutParameters( const LayoutParameters& layoutParameters );
609
610     /**
611      * Assignment operator.
612      */
613     LayoutParameters& operator=( const LayoutParameters& layoutParameters );
614
615     Toolkit::TextView::MultilinePolicy   mMultilinePolicy;     ///< Stores the multiline policy.
616     TextView::ExceedPolicy               mExceedPolicy;        ///< Stores a combination of both policies;
617     Toolkit::TextView::ExceedPolicy      mWidthExceedPolicy;   ///< Stores the text width exceed policy.
618     Toolkit::TextView::ExceedPolicy      mHeightExceedPolicy;  ///< Stores the text height exceed policy.
619     Toolkit::Alignment::Type             mHorizontalAlignment; ///< Stores the horizontal alignment for the whole text.
620     Toolkit::Alignment::Type             mVerticalAlignment;   ///< Stores the vertical alignment for the whole text.
621     Toolkit::TextView::LineJustification mLineJustification;   ///< Stores the line justification.
622     float                                mLineHeightOffset;    ///< Line height offset to be addded to the font line height (measured in PointSize).
623     MarkupProcessor::StyledTextArray     mEllipsizeText;       ///< Stores the ellipsize text
624     bool                                 mMarkUpEnabled:1;     ///< Is markup string scanning enabled
625   };
626
627   /**
628    * Some parameters which affects the text view visualization.
629    */
630   struct VisualParameters
631   {
632     /**
633      * Default constructor.
634      */
635     VisualParameters();
636
637     /**
638      * Copy constructor.
639      */
640     VisualParameters( const VisualParameters& visualParameters );
641
642     /**
643      * Assignment operator.
644      */
645     VisualParameters& operator=( const VisualParameters& visualParameters );
646
647     Toolkit::TextView::FadeBoundary mFadeBoundary;            ///< Fade boundary used in fade mode.
648     float                           mSortModifier;            ///< Stores the sort modifier for all text-actors.
649     Vector2                         mCameraScrollPosition;    ///< The scroll offset.
650     bool                            mSnapshotModeEnabled:1;   ///< Whether text-view is rendered offscreen.
651     bool                            mScrollEnabled:1;         ///< Whether the text scroll is enabled.
652     bool                            mScrollPositionTrimmed:1; ///< Whether the last scroll position set was trimmed.
653   };
654
655   /**
656    * Temporary data used to calculate line justification.
657    */
658   struct LineJustificationInfo
659   {
660     TextViewProcessor::TextInfoIndices mIndices;    ///< Indices to the first character of the new line.
661     float                              mLineLength; ///< Length of the line (or portion of line).
662   };
663
664   /**
665    * The results of the relayout process.
666    */
667   struct RelayoutData
668   {
669     /**
670      * Default constructor.
671      */
672     RelayoutData();
673
674     /**
675      * Copy constructor
676      */
677     RelayoutData( const RelayoutData& relayoutData );
678
679     /**
680      * Assignment operator.
681      */
682     RelayoutData& operator=( const RelayoutData& relayoutData );
683
684     Size                                            mTextViewSize;                ///< The text-view's size used to relaid-out the text.
685     float                                           mShrinkFactor;                ///< Shrink factor used when the exceed policy contains ShrinkToFit.
686     TextViewProcessor::TextLayoutInfo               mTextLayoutInfo;              ///< Stores metrics, layout info (size, direction, type of word) and text-actor info for the whole text.
687     std::vector<int>                                mCharacterLogicalToVisualMap; ///< Reorder map that stores each character's visual (output) index according to its logical (input) index
688     std::vector<int>                                mCharacterVisualToLogicalMap; ///< Reorder map that stores each character's logical (input) index according to its visual (output) index
689     std::vector<RenderableActor>                    mGlyphActors;                 ///< Stores handles of those text-actors which are currently added to the text-view.
690     std::vector<RenderableActor>                    mEllipsizedGlyphActors;       ///< Stores handles of those text-actors which are used to ellipsize the text.
691     Toolkit::TextView::CharacterLayoutInfoContainer mCharacterLayoutInfoTable;    ///< Stores layout info per character sorted by the character's visual index.
692     Toolkit::TextView::LineLayoutInfoContainer      mLines;                       ///< Stores an index to the first character of each line.
693     Size                                            mTextSizeForRelayoutOption;   ///< Stores the text size after relayout.
694     std::vector<LineJustificationInfo>              mLineJustificationInfo;       ///< Stores justification info per line.
695     TextActorCache                                  mTextActorCache;              ///< Stores previously created text-actors to be reused.
696   };
697
698 private:
699
700   MarkupProcessor::StyledTextArray       mCurrentStyledText;           ///< text currently displayed by the view
701   std::vector<TextViewProcessorMetadata> mTextViewProcessorOperations; ///< Stores all relayout operations which arrive between two consecutive OnRelaidOut() calls.
702
703   LayoutParameters                       mLayoutParameters;            ///< Stores some layout parameters in a struct. To be passed in layout functions.
704   VisualParameters                       mVisualParameters;            ///< Some parameters which afects text-view visualization.
705   RelayoutData                           mRelayoutData;                ///< struct with text-view's data structures used to pass all of them in one parameter.
706   RelayoutOperationMask                  mRelayoutOperations;          ///< Which relayout operations have to be done.
707
708   Layer                                  mOffscreenRootActor;          ///< Root actor for offscreen rendering.
709   ImageActor                             mOffscreenImageActor;         ///< Image actor for offscreen rendering.
710   CameraActor                            mOffscreenCameraActor;        ///< Camera actor for offscreen rendering.
711   Size                                   mCurrentOffscreenSize;        ///< Current used ofscreen size.
712   FrameBufferImage                       mFrameBufferImage;            ///< Frame buffer used for offscreen rendering.
713   RenderTask                             mRenderTask;                  ///< Used to generate an offscreen rendering.
714
715   PanGestureDetector                     mPanGestureDetector;          ///< Pan gesture for text scrolling.
716
717   /**
718    * Helper class used to prevent the modification of some members.
719    */
720   struct Lock
721   {
722     Lock( bool& lock )
723     : mLock( lock )
724     {
725       mLock = true;
726     }
727
728     ~Lock()
729     {
730       mLock = false;
731     }
732
733     bool& mLock;
734   };
735
736   bool                                            mLockPreviousSnapshotMode;      ///< Whether previous stored snapshot mode should be modified.
737   bool                                            mPreviousSnapshotModeEnabled:1; ///< Stores the previous snapshot mode value.
738   bool                                            mMarkUpEnabled:1;               ///< enable to scan for mark-up
739
740   Toolkit::TextView::ScrolledSignalV2             mScrolledSignalV2;              ///< Signal emitted when text is scrolled.
741 };
742
743 } // namespace Internal
744
745 // Helpers for public-api forwarding methods
746
747 inline Internal::TextView& GetImpl( TextView& textView )
748 {
749   DALI_ASSERT_ALWAYS( textView );
750
751   RefObject& handle = textView.GetImplementation();
752
753   return static_cast< Internal::TextView& >( handle );
754 }
755
756 inline const Internal::TextView& GetImpl( const TextView& textView )
757 {
758   DALI_ASSERT_ALWAYS( textView );
759
760   const RefObject& handle = textView.GetImplementation();
761
762   return static_cast< const Internal::TextView& >( handle );
763 }
764
765 } // namespace Toolkit
766
767 } // namespace Dali
768
769 #endif // __DALI_TOOLKIT_INTERNAL_ITEM_VIEW_H__