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