49bb4eafc05a31e73687a791a6f8134eeb82e988
[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, etc.
427    */
428   void PerformTextViewProcessorOperations();
429
430   /**
431    * Optimizes some text-view processor operations.
432    */
433   void OptimizeTextViewProcessorOperations();
434
435   /**
436    * Synchronously relays-out all text-actors.
437    *
438    * Perform text-view-processor operations, sets the new size and position of text-actors and adds them to the text-view.
439    *
440    * @param[in] textViewSize The new text-view's size.
441    * @param[in] relayoutOperationMask Defines which operations need to be done in the relayout process.
442    */
443   void DoRelayOut( const Size& textViewSize, RelayoutOperationMask relayoutOperationMask );
444
445   /**
446    * Process Snapshot. It refresh the render-task in order to generate a new snapshot image.
447    *
448    * ProcessSnapshot is called from OnRelaidOut() only if text has been relaid out.
449    * It creates a new image buffer only if the size of the text has changed.
450    *
451    * @param[in] textViewSize The new text-view's size.
452    */
453   void ProcessSnapshot( const Size& textViewSize );
454
455   /**
456    * Aligns the offscreen rendering camera actor to cover the whole text and the resulting image actor accordingly with the text view's alignment.
457    *
458    * @param[in] textViewSize The text view's size.
459    * @param[in] offscreenSize The offscreen's frame buffer's size.
460    */
461   void AlignOffscreenCameraActor( const Size& textViewSize, const Size& offscreenSize );
462
463   /**
464    * Callback called when the render task has processed.
465    *
466    * It makes the root actor invisible.
467    *
468    * @param[in] renderTask The processed render task.
469    */
470   void RenderTaskFinished( Dali::RenderTask& renderTask );
471
472   /**
473    * Destroys offscreen rendering resources.
474    *
475    * It disconects the render task finished signal from the TextView::RenderTaskFinished() method,
476    * removes the render task from the render task list and resets the offscreen camera actor, root actor,
477    * image actor and the frame buffer.
478    */
479   void DestroyOffscreenRenderingResources();
480
481   /**
482    * Called when text-view is scrolled.
483    *
484    * Sets the new scroll position. @see DoSetScrollPosition()
485    *
486    * @param[in] actor Handle of the text-view.
487    * @param[in] gesture Data structure with the parameters of the gesture.
488    */
489   void OnTextPan( Actor actor, PanGesture gesture );
490
491   /**
492    * Ensures the text-view's boundaries are fully covered of text.
493    *
494    * i.e. if the text-view's size is 100x100 and the text's size is 150x100, the scroll position
495    * can be in the range -50,0 and 50,0.
496    */
497   void TrimScrollPosition();
498
499   /**
500    * Called from SetScrollPosition() and OnTextPan()
501    *
502    * Updates the stored scroll position ensuring the text-view is always covered with text by calling
503    * TrimScrollPosition(), calculates the difference with the previous one and emits the Toolkit::TextView::SignalScrolled() signal.
504    *
505    * @param[in] position The new scroll position.
506    */
507   void DoSetScrollPosition( const Vector2& position );
508
509   /**
510    * Combines width and height exceed policies.
511    *
512    * This method is a big switch() which combines two exceed policies into one.
513    * The aim is avoid this switch inside the relayout code.
514    *
515    * i.e.  Width policy = Split. Height policy = Original. Internally the policy is SplitOriginal.
516    */
517   void CombineExceedPolicies();
518
519   /**
520    * Retrieves the text-view's root actor which stores all text-actors.
521    * It could be the text-view itself or an actor used in the snapshot mode.
522    *
523    * @return the root actor.
524    */
525   Actor GetRootActor() const;
526
527   /**
528    * Handle SetProperty for markup processing.
529    * @param[in] propertyValue The new property value.
530    */
531   void OnMarkupEnabledPeopertySet( Property::Value propertyValue );
532
533   /**
534    * Handles SetProperty for multiline policy.
535    * @param[in] propertyValue The new property value.
536    */
537   void OnMultilinePolicyPropertySet( Property::Value propertyValue );
538
539   /**
540    * Handles SetProperty for width exceed policy.
541    * @param[in] propertyValue The new property value.
542    */
543   void OnWidthExceedPolicyPropertySet( Property::Value propertyValue );
544
545   /**
546    * Handles SetProperty for height exceed policy.
547    * @param[in] propertyValue The new property value.
548    */
549   void OnHeightExceedPolicyPropertySet( Property::Value propertyValue );
550
551   /**
552    * Handles SetProperty for line justification.
553    * @param[in] propertyValue The new property value.
554    */
555   void OnLineJustificationPropertySet( Property::Value propertyValue );
556
557   /**
558    * Handles SetProperty for fade boundary.
559    * @param[in] propertyValue The new property value.
560    */
561   void OnFadeBoundaryPropertySet( Property::Value propertyValue );
562
563   /**
564    * Handles SetProperty for alignment property.
565    * @param[in] propertyIndex The property index.
566    * @param[in] propertyValue The new property value.
567    */
568   void OnAlignmentPropertySet( Property::Index propertyIndex, Property::Value propertyValue );
569
570   /**
571    * Handles GetProperty for horizontal alignment property.
572    * @return The property value of horizontal alignment.
573    */
574   std::string OnHorizontalAlignmentPropertyGet();
575
576   /**
577    * Handles GetProperty for vertical alignment property.
578    * @return The property value of vertical alignment.
579    */
580   std::string OnVerticalAlignmentPropertyGet();
581
582 public:
583
584   /**
585    * The parameters which affects the layout of the text.
586    */
587   struct LayoutParameters
588   {
589     /**
590      * Default constructor.
591      */
592     LayoutParameters();
593
594     /**
595      * Constructor
596      */
597     LayoutParameters( Toolkit::TextView::MultilinePolicy     multilinePolicy,
598                       Toolkit::TextView::ExceedPolicy        widthExceedPolicy,
599                       Toolkit::TextView::ExceedPolicy        heightExceedPolicy,
600                       Toolkit::Alignment::Type               alignment,
601                       Toolkit::TextView::LineJustification   lineJustification,
602                       float                                  lineHeightOffset,
603                       const std::string&                     ellipsizeText,
604                       bool                                   markUpEnabled );
605
606     /**
607      * Copy constructor
608      */
609     LayoutParameters( const LayoutParameters& layoutParameters );
610
611     /**
612      * Assignment operator.
613      */
614     LayoutParameters& operator=( const LayoutParameters& layoutParameters );
615
616     Toolkit::TextView::MultilinePolicy   mMultilinePolicy;     ///< Stores the multiline policy.
617     TextView::ExceedPolicy               mExceedPolicy;        ///< Stores a combination of both policies;
618     Toolkit::TextView::ExceedPolicy      mWidthExceedPolicy;   ///< Stores the text width exceed policy.
619     Toolkit::TextView::ExceedPolicy      mHeightExceedPolicy;  ///< Stores the text height exceed policy.
620     Toolkit::Alignment::Type             mHorizontalAlignment; ///< Stores the horizontal alignment for the whole text.
621     Toolkit::Alignment::Type             mVerticalAlignment;   ///< Stores the vertical alignment for the whole text.
622     Toolkit::TextView::LineJustification mLineJustification;   ///< Stores the line justification.
623     float                                mLineHeightOffset;    ///< Line height offset to be addded to the font line height (measured in PointSize).
624     MarkupProcessor::StyledTextArray     mEllipsizeText;       ///< Stores the ellipsize text
625     bool                                 mMarkUpEnabled:1;     ///< Is markup string scanning enabled
626   };
627
628   /**
629    * Some parameters which affects the text view visualization.
630    */
631   struct VisualParameters
632   {
633     /**
634      * Default constructor.
635      */
636     VisualParameters();
637
638     /**
639      * Copy constructor.
640      */
641     VisualParameters( const VisualParameters& visualParameters );
642
643     /**
644      * Assignment operator.
645      */
646     VisualParameters& operator=( const VisualParameters& visualParameters );
647
648     Toolkit::TextView::FadeBoundary mFadeBoundary;            ///< Fade boundary used in fade mode.
649     float                           mSortModifier;            ///< Stores the sort modifier for all text-actors.
650     Vector2                         mCameraScrollPosition;    ///< The scroll offset.
651     bool                            mSnapshotModeEnabled:1;   ///< Whether text-view is rendered offscreen.
652     bool                            mScrollEnabled:1;         ///< Whether the text scroll is enabled.
653     bool                            mScrollPositionTrimmed:1; ///< Whether the last scroll position set was trimmed.
654   };
655
656   /**
657    * Temporary data used to calculate line justification.
658    */
659   struct LineJustificationInfo
660   {
661     TextViewProcessor::TextInfoIndices mIndices;    ///< Indices to the first character of the new line.
662     float                              mLineLength; ///< Length of the line (or portion of line).
663   };
664
665   /**
666    * The results of the relayout process.
667    */
668   struct RelayoutData
669   {
670     /**
671      * Default constructor.
672      */
673     RelayoutData();
674
675     /**
676      * Copy constructor
677      */
678     RelayoutData( const RelayoutData& relayoutData );
679
680     /**
681      * Assignment operator.
682      */
683     RelayoutData& operator=( const RelayoutData& relayoutData );
684
685     Size                                            mTextViewSize;                ///< The text-view's size used to relaid-out the text.
686     float                                           mShrinkFactor;                ///< Shrink factor used when the exceed policy contains ShrinkToFit.
687     TextViewProcessor::TextLayoutInfo               mTextLayoutInfo;              ///< Stores metrics, layout info (size, direction, type of word) and text-actor info for the whole text.
688     std::vector<int>                                mCharacterLogicalToVisualMap; ///< Reorder map that stores each character's visual (output) index according to its logical (input) index
689     std::vector<int>                                mCharacterVisualToLogicalMap; ///< Reorder map that stores each character's logical (input) index according to its visual (output) index
690     std::vector<RenderableActor>                    mGlyphActors;                 ///< Stores handles of those text-actors which are currently added to the text-view.
691     std::vector<RenderableActor>                    mEllipsizedGlyphActors;       ///< Stores handles of those text-actors which are used to ellipsize the text.
692     Toolkit::TextView::CharacterLayoutInfoContainer mCharacterLayoutInfoTable;    ///< Stores layout info per character sorted by the character's visual index.
693     Toolkit::TextView::LineLayoutInfoContainer      mLines;                       ///< Stores an index to the first character of each line.
694     Size                                            mTextSizeForRelayoutOption;   ///< Stores the text size after relayout.
695     std::vector<LineJustificationInfo>              mLineJustificationInfo;       ///< Stores justification info per line.
696     TextActorCache                                  mTextActorCache;              ///< Stores previously created text-actors to be reused.
697   };
698
699 private:
700
701   MarkupProcessor::StyledTextArray       mCurrentStyledText;           ///< text currently displayed by the view
702   std::vector<TextViewProcessorMetadata> mTextViewProcessorOperations; ///< Stores all relayout operations which arrive between two consecutive OnRelaidOut() calls.
703
704   LayoutParameters                       mLayoutParameters;            ///< Stores some layout parameters in a struct. To be passed in layout functions.
705   VisualParameters                       mVisualParameters;            ///< Some parameters which afects text-view visualization.
706   RelayoutData                           mRelayoutData;                ///< struct with text-view's data structures used to pass all of them in one parameter.
707   RelayoutOperationMask                  mRelayoutOperations;          ///< Which relayout operations have to be done.
708
709   Layer                                  mOffscreenRootActor;          ///< Root actor for offscreen rendering.
710   ImageActor                             mOffscreenImageActor;         ///< Image actor for offscreen rendering.
711   CameraActor                            mOffscreenCameraActor;        ///< Camera actor for offscreen rendering.
712   Size                                   mCurrentOffscreenSize;        ///< Current used ofscreen size.
713   FrameBufferImage                       mFrameBufferImage;            ///< Frame buffer used for offscreen rendering.
714   RenderTask                             mRenderTask;                  ///< Used to generate an offscreen rendering.
715
716   PanGestureDetector                     mPanGestureDetector;          ///< Pan gesture for text scrolling.
717
718   /**
719    * Helper class used to prevent the modification of some members.
720    */
721   struct Lock
722   {
723     Lock( bool& lock )
724     : mLock( lock )
725     {
726       mLock = true;
727     }
728
729     ~Lock()
730     {
731       mLock = false;
732     }
733
734     bool& mLock;
735   };
736
737   bool                                            mLockPreviousSnapshotMode;      ///< Whether previous stored snapshot mode should be modified.
738   bool                                            mPreviousSnapshotModeEnabled:1; ///< Stores the previous snapshot mode value.
739   bool                                            mMarkUpEnabled:1;               ///< enable to scan for mark-up
740
741   Toolkit::TextView::ScrolledSignalV2             mScrolledSignalV2;              ///< Signal emitted when text is scrolled.
742 };
743
744 } // namespace Internal
745
746 // Helpers for public-api forwarding methods
747
748 inline Internal::TextView& GetImpl( TextView& textView )
749 {
750   DALI_ASSERT_ALWAYS( textView );
751
752   RefObject& handle = textView.GetImplementation();
753
754   return static_cast< Internal::TextView& >( handle );
755 }
756
757 inline const Internal::TextView& GetImpl( const TextView& textView )
758 {
759   DALI_ASSERT_ALWAYS( textView );
760
761   const RefObject& handle = textView.GetImplementation();
762
763   return static_cast< const Internal::TextView& >( handle );
764 }
765
766 } // namespace Toolkit
767
768 } // namespace Dali
769
770 #endif // __DALI_TOOLKIT_INTERNAL_ITEM_VIEW_H__