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