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