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