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