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