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