Merge "Text segmentation interface" into new_text
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 4 Mar 2015 10:34:40 +0000 (02:34 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 4 Mar 2015 10:34:41 +0000 (02:34 -0800)
13 files changed:
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/multi-language-support-impl.h
dali-toolkit/public-api/controls/text-controls/text-field.cpp
dali-toolkit/public-api/controls/text-controls/text-field.h
dali-toolkit/public-api/text/bidirectional-support.cpp
dali-toolkit/public-api/text/bidirectional-support.h
dali-toolkit/public-api/text/decorator/text-decorator.cpp
dali-toolkit/public-api/text/decorator/text-decorator.h
dali-toolkit/public-api/text/multi-language-support.cpp
dali-toolkit/public-api/text/multi-language-support.h
dali-toolkit/public-api/text/shaper.cpp
dali-toolkit/public-api/text/shaper.h

index c4a636e..03dcf44 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/common/stage.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -43,16 +44,17 @@ namespace Dali
 namespace Toolkit
 {
 
-const Property::Index TextField::PROPERTY_RENDERING_BACKEND(      Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX );
-const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT(       Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 );
-const Property::Index TextField::PROPERTY_TEXT(                   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 );
-const Property::Index TextField::PROPERTY_CURSOR_IMAGE(           Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 );
-const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR(   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 );
-const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 );
-const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK(    Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 );
-const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL(  Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 );
-const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION(  Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 );
-const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE(      Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 9 );
+const Property::Index TextField::PROPERTY_RENDERING_BACKEND(       Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX );
+const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT(        Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 );
+const Property::Index TextField::PROPERTY_TEXT(                    Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 );
+const Property::Index TextField::PROPERTY_CURSOR_IMAGE(            Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 );
+const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR(    Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 );
+const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR(  Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 );
+const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK(     Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 );
+const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL(   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 );
+const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION(   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 );
+const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE(       Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 9 );
+const Property::Index TextField::PROPERTY_DECORATION_BOUNDING_BOX( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 10 );
 
 namespace Internal
 {
@@ -68,17 +70,17 @@ BaseHandle Create()
 
 TypeRegistration mType( typeid(Toolkit::TextField), typeid(Toolkit::Control), Create );
 
-PropertyRegistration property01( mType, "rendering-backend",      Toolkit::TextField::PROPERTY_RENDERING_BACKEND,      Property::INTEGER,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property02( mType, "placeholder-text",       Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT,       Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property03( mType, "text",                   Toolkit::TextField::PROPERTY_TEXT,                   Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property04( mType, "cursor-image",           Toolkit::TextField::PROPERTY_CURSOR_IMAGE,           Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property05( mType, "primary-cursor-color",   Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR,   Property::VECTOR4,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property06( mType, "secondary-cursor-color", Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR, Property::VECTOR4,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property07( mType, "enable-cursor-blink",    Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK,    Property::BOOLEAN,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property08( mType, "cursor-blink-interval",  Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL,  Property::FLOAT,            &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property09( mType, "cursor-blink-duration",  Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION,  Property::FLOAT,            &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property10( mType, "grab-handle-image",      Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE,      Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-
+PropertyRegistration property01( mType, "rendering-backend",       Toolkit::TextField::PROPERTY_RENDERING_BACKEND,       Property::INTEGER,          &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property02( mType, "placeholder-text",        Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT,        Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property03( mType, "text",                    Toolkit::TextField::PROPERTY_TEXT,                    Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property04( mType, "cursor-image",            Toolkit::TextField::PROPERTY_CURSOR_IMAGE,            Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property05( mType, "primary-cursor-color",    Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR,    Property::VECTOR4,          &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property06( mType, "secondary-cursor-color",  Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR,  Property::VECTOR4,          &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property07( mType, "enable-cursor-blink",     Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK,     Property::BOOLEAN,          &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property08( mType, "cursor-blink-interval",   Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL,   Property::FLOAT,            &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property09( mType, "cursor-blink-duration",   Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION,   Property::FLOAT,            &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property10( mType, "grab-handle-image",       Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE,       Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property11( mType, "decoration bounding-box", Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX, Property::RECTANGLE,        &TextField::SetProperty, &TextField::GetProperty );
 } // namespace
 
 Toolkit::TextField TextField::New()
@@ -193,6 +195,14 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         }
         break;
       }
+      case Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX:
+      {
+        if( impl.mDecorator )
+        {
+          impl.mDecorator->SetBoundingBox( value.Get< Rect<int> >() );
+        }
+        break;
+      }
     }
   }
 }
@@ -285,6 +295,14 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
         }
         break;
       }
+      case Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX:
+      {
+        if( impl.mDecorator )
+        {
+          value = impl.mDecorator->GetBoundingBox();
+        }
+        break;
+      }
     }
   }
 
@@ -309,6 +327,13 @@ void TextField::OnInitialize()
   mDoubleTapDetector.SetTapsRequired( 2 );
   mDoubleTapDetector.DetectedSignal().Connect( this, &TextField::OnDoubleTap );
   mDoubleTapDetector.Attach(Self());
+
+  // Set BoundingBox to stage size if not already set.
+  if ( mDecorator->GetBoundingBox().IsEmpty() )
+  {
+    Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
+    mDecorator->SetBoundingBox( Rect<int>( 0.0f, 0.0f, stageSize.width, stageSize.height ) );
+  }
 }
 
 void TextField::OnRelayout( const Vector2& size, ActorSizeContainer& container )
index f6a9a22..27d0ee2 100644 (file)
@@ -353,6 +353,13 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
   }
 }
 
+void MultilanguageSupport::ReplaceScripts( LogicalModel& model,
+                                           CharacterIndex characterIndex,
+                                           Length numberOfCharactersToRemove,
+                                           Length numberOfCharactersToInsert )
+{
+}
+
 void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
                                           const Vector<ScriptRun>& scripts,
                                           Vector<FontRun>& fonts )
@@ -528,6 +535,13 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
   }
 }
 
+void MultilanguageSupport::ValidateFonts( LogicalModel& model,
+                                          CharacterIndex characterIndex,
+                                          Length numberOfCharactersToRemove,
+                                          Length numberOfCharactersToInsert )
+{
+}
+
 } // namespace Internal
 
 } // namespace Text
index 643dea3..65933b5 100644 (file)
@@ -96,13 +96,29 @@ public:
   void SetScripts( const Vector<Character>& text,
                    const Vector<LineBreakInfo>& lineBreakInfo,
                    Vector<ScriptRun>& scripts );
+
+  /**
+   * @copydoc Dali::MultilanguageSupport::ReplaceScripts()
+   */
+  void ReplaceScripts( LogicalModel& model,
+                       CharacterIndex characterIndex,
+                       Length numberOfCharactersToRemove,
+                       Length numberOfCharactersToInsert );
+
   /**
-   * @copydoc Dali::MultilanguageSupport::ValidateFonts()
+   * @copydoc Dali::MultilanguageSupport::ValidateFonts( const Vector<Character>& text, const Vector<ScriptRun>& scripts, Vector<FontRun>& fonts )
    */
   void ValidateFonts( const Vector<Character>& text,
                       const Vector<ScriptRun>& scripts,
                       Vector<FontRun>& fonts );
 
+  /**
+   * @copydoc Dali::MultilanguageSupport::ValidateFonts( LogicalModel& model, CharacterIndex characterIndex, Length numberOfCharactersToRemove, Length numberOfCharactersToInsert )
+   */
+  void ValidateFonts( LogicalModel& model,
+                      CharacterIndex characterIndex,
+                      Length numberOfCharactersToRemove,
+                      Length numberOfCharactersToInsert );
 private:
   Vector<FontId>                  mDefaultFontPerScriptCache; ///< Caches the default font for a script.
   Vector<ValidateFontsPerScript*> mValidFontsPerScriptCache;  ///< Caches valid fonts for a script.
index bbe9d1f..397f6a5 100644 (file)
@@ -37,6 +37,7 @@ const std::string TextField::ENABLE_CURSOR_BLINK_PROPERTY_NAME("enable-cursor-bl
 const std::string TextField::CURSOR_BLINK_INTERVAL_PROPERTY_NAME("cursor-blink-interval");
 const std::string TextField::CURSOR_BLINK_DURATION_PROPERTY_NAME("cursor-blink-duration");
 const std::string TextField::GRAB_HANDLE_IMAGE_PROPERTY_NAME("grab-handle-image");
+const std::string TextField::DECORATION_BOUNDING_BOX("decoration-bounding-box");
 
 TextField TextField::New()
 {
index 293e293..4d97b03 100644 (file)
@@ -41,28 +41,30 @@ class DALI_IMPORT_API TextField : public Control
 public:
 
   // Property indices
-  static const Property::Index PROPERTY_RENDERING_BACKEND;      ///< name "rendering-backend",      type INT
-  static const Property::Index PROPERTY_PLACEHOLDER_TEXT;       ///< name "placeholder-text",       type STRING
-  static const Property::Index PROPERTY_TEXT;                   ///< name "text",                   type STRING
-  static const Property::Index PROPERTY_CURSOR_IMAGE;           ///< name "cursor-image",           type STRING
-  static const Property::Index PROPERTY_PRIMARY_CURSOR_COLOR;   ///< name "primary-cursor-color",   type VECTOR4
-  static const Property::Index PROPERTY_SECONDARY_CURSOR_COLOR; ///< name "secondary-cursor-color", type VECTOR4
-  static const Property::Index PROPERTY_ENABLE_CURSOR_BLINK;    ///< name "enable-cursor-blink",    type BOOLEAN
-  static const Property::Index PROPERTY_CURSOR_BLINK_INTERVAL;  ///< name "cursor-blink-interval",  type FLOAT
-  static const Property::Index PROPERTY_CURSOR_BLINK_DURATION;  ///< name "cursor-blink-duration",  type FLOAT
-  static const Property::Index PROPERTY_GRAB_HANDLE_IMAGE;      ///< name "grab-handle-image",      type STRING
+  static const Property::Index PROPERTY_RENDERING_BACKEND;       ///< name "rendering-backend",       type INT
+  static const Property::Index PROPERTY_PLACEHOLDER_TEXT;        ///< name "placeholder-text",        type STRING
+  static const Property::Index PROPERTY_TEXT;                    ///< name "text",                    type STRING
+  static const Property::Index PROPERTY_CURSOR_IMAGE;            ///< name "cursor-image",            type STRING
+  static const Property::Index PROPERTY_PRIMARY_CURSOR_COLOR;    ///< name "primary-cursor-color",    type VECTOR4
+  static const Property::Index PROPERTY_SECONDARY_CURSOR_COLOR;  ///< name "secondary-cursor-color",  type VECTOR4
+  static const Property::Index PROPERTY_ENABLE_CURSOR_BLINK;     ///< name "enable-cursor-blink",     type BOOLEAN
+  static const Property::Index PROPERTY_CURSOR_BLINK_INTERVAL;   ///< name "cursor-blink-interval",   type FLOAT
+  static const Property::Index PROPERTY_CURSOR_BLINK_DURATION;   ///< name "cursor-blink-duration",   type FLOAT
+  static const Property::Index PROPERTY_GRAB_HANDLE_IMAGE;       ///< name "grab-handle-image",       type STRING
+  static const Property::Index PROPERTY_DECORATION_BOUNDING_BOX; ///< name "decoration-bounding-box", type RECTANGLE
 
   // Property names
-  static const std::string RENDERING_BACKEND_PROPERTY_NAME;      ///< Property, name "rendering-backend",      type INT
-  static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME;       ///< Property, name "placeholder-text",       type STRING
-  static const std::string TEXT_PROPERTY_NAME;                   ///< Property, name "text",                   type STRING
-  static const std::string CURSOR_IMAGE_PROPERTY_NAME;           ///< Property, name "cursor-image",           type STRING
-  static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME;   ///< Property, name "primary-cursor-color",   type VECTOR4
-  static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color", type VECTOR4
-  static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME;    ///< Property, name "enable-cursor-blink",    type BOOLEAN
-  static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME;  ///< Property, name "cursor-blink-interval",  type FLOAT
-  static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME;  ///< Property, name "cursor-blink-duration",  type FLOAT
-  static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME;      ///< Property, name "grab-handle-image",      type STRING
+  static const std::string RENDERING_BACKEND_PROPERTY_NAME;      ///< Property, name "rendering-backend",       type INT
+  static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME;       ///< Property, name "placeholder-text",        type STRING
+  static const std::string TEXT_PROPERTY_NAME;                   ///< Property, name "text",                    type STRING
+  static const std::string CURSOR_IMAGE_PROPERTY_NAME;           ///< Property, name "cursor-image",            type STRING
+  static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME;   ///< Property, name "primary-cursor-color",    type VECTOR4
+  static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color",  type VECTOR4
+  static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME;    ///< Property, name "enable-cursor-blink",     type BOOLEAN
+  static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME;  ///< Property, name "cursor-blink-interval",   type FLOAT
+  static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME;  ///< Property, name "cursor-blink-duration",   type FLOAT
+  static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME;      ///< Property, name "grab-handle-image",       type STRING
+  static const std::string DECORATION_BOUNDING_BOX;              ///< Property, name "decoration-bounding-box", type RECTANGLE
 
   /**
    * Create the TextField control.
index c3b2a52..02645f4 100644 (file)
@@ -33,12 +33,27 @@ void SetBidirectionalInfo( const Vector<Character>& text,
 {
 }
 
+void ReplaceBidirectionalInfo( LogicalModel& model,
+                               CharacterIndex characterIndex,
+                               Length numberOfCharactersToRemove,
+                               Length numberOfCharactersToInsert )
+{
+}
+
 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
                    const Vector<CharacterRun>& lineRuns,
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns )
 {
 }
 
+void ReorderLines( LogicalModel& logicalModel,
+                   const VisualModel& visualModel,
+                   CharacterIndex characterIndex,
+                   Length numberOfCharactersToRemove,
+                   Length numberOfCharactersToInsert )
+{
+}
+
 } // namespace Text
 
 } // namespace Toolkit
index 178c319..e45fc06 100644 (file)
@@ -47,6 +47,25 @@ void SetBidirectionalInfo( const Vector<Character>& text,
                            Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
 
 /**
+ * Replaces the bidirectional info from the logical model.
+ *
+ * @pre The @p model needs to have a text set.
+ * @pre The @p model needs to have the line break info set.
+ *
+ * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
+ * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
+ *
+ * @param[in,out] model The text's logical model.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
+ * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
+ */
+void ReplaceBidirectionalInfo( LogicalModel& model,
+                               CharacterIndex characterIndex,
+                               Length numberOfCharactersToRemove,
+                               Length numberOfCharactersToInsert );
+
+/**
  * Sets the visual to logical and logical to visual map tables.
  *
  * Any map tables previously set are removed.
@@ -63,6 +82,28 @@ void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInf
                    const Vector<CharacterRun>& lineRuns,
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns );
 
+/**
+ * Replaces the visual to logical and logical to visual map tables.
+ *
+ * @pre The @p logicalModel needs to have a text set.
+ * @pre The @p logicalModel needs to have the line break info set.
+ * @pre The @p visualModel needs to have the laid-out lines info set.
+ *
+ * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
+ * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
+ *
+ * @param[in,out] logicalModel The text's logical model.
+ * @param[in] visualModel The text's visual model.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
+ * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
+ */
+void ReorderLines( LogicalModel& logicalModel,
+                   const VisualModel& visualModel,
+                   CharacterIndex characterIndex,
+                   Length numberOfCharactersToRemove,
+                   Length numberOfCharactersToInsert );
+
 } // namespace Text
 
 } // namespace Toolkit
index 148fbc8..0b15b49 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/constants.h>
+#include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/tap-gesture.h>
 #include <dali/public-api/events/tap-gesture-detector.h>
 #include <dali/public-api/events/pan-gesture.h>
@@ -56,6 +57,7 @@ const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.5f, 2.0f, 1.0f );
 const Dali::Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.5f, 1.5f, 1.0f );
 
 const std::size_t CURSOR_BLINK_INTERVAL = 500; // Cursor blink interval
+const std::size_t MILLISECONDS = 1000;
 
 } // end of namespace
 
@@ -116,10 +118,11 @@ struct Decorator::Impl : public ConnectionTracker
     mActiveGrabHandle(false),
     mActiveSelection( false ),
     mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ),
-    mCursorBlinkDuration(0.0f),
+    mCursorBlinkDuration( 0.0f ),
     mCursorBlinkStatus( true ),
-    mGrabDisplacementX(0.0f),
-    mGrabDisplacementY(0.0f)
+    mGrabDisplacementX( 0.0f ),
+    mGrabDisplacementY( 0.0f ),
+    mBoundingBox( Rect<int>() )
   {
   }
 
@@ -467,7 +470,7 @@ struct Decorator::Impl : public ConnectionTracker
   TapGestureDetector mTapDetector;
   PanGestureDetector mPanGestureDetector;
 
-
+  Rect<int> mBoundingBox;
 };
 
 DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer )
@@ -475,6 +478,16 @@ DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer )
   return DecoratorPtr( new Decorator(parent, observer) );
 }
 
+void Decorator::SetBoundingBox( const Rect<int>& boundingBox )
+{
+  mImpl->mBoundingBox = boundingBox;
+}
+
+const Rect<int>& Decorator::GetBoundingBox() const
+{
+  return mImpl->mBoundingBox;
+}
+
 void Decorator::Relayout( const Vector2& size )
 {
   mImpl->Relayout( size );
@@ -554,7 +567,7 @@ void Decorator::StopCursorBlink()
 
 void Decorator::SetCursorBlinkInterval( float seconds )
 {
-  mImpl->mCursorBlinkInterval = seconds*1000; // Convert to milliseconds
+  mImpl->mCursorBlinkInterval = seconds*MILLISECONDS; // Convert to milliseconds
 }
 
 float Decorator::GetCursorBlinkInterval() const
index 144f0ef..4038d3f 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/math/rect.h>
 
 namespace Dali
 {
@@ -128,6 +129,36 @@ public:
   static DecoratorPtr New( Dali::Toolkit::Internal::Control& parent, Observer& observer );
 
   /**
+   * @brief Set the bounding box which handles, popup and similar decorations will not exceed.
+   *
+   * The default value is the width and height of the stage from the top left origin.
+   * If a title bar for example is on the top of the screen then the y should be the title's height and
+   * the boundary height the stage height minus the title's height.
+   * Restrictions - The boundary box should be set up with a fixed z position for the text-input and the default camera.
+   *
+   * ------------------------------------------
+   * |(x,y)                                   |
+   * |o---------------------------------------|
+   * ||                                      ||
+   * ||            Bounding Box              || boundary height
+   * ||                                      ||
+   * |----------------------------------------|
+   * ------------------------------------------
+   *               boundary width
+   *
+   * @param[in] boundingBox Vector( x coordinate, y coordinate, width, height )
+   */
+  void SetBoundingBox( const Rect<int>& boundingBox );
+
+  /**
+   * @brief Retrieve the bounding box origin and dimensions.
+   *
+   * default is set once control is added to stage, before this the return vector will be Vector4:ZERO
+   * @return Rect<int> the bounding box origin, width and height
+   */
+  const Rect<int>& GetBoundingBox() const;
+
+  /**
    * @brief The decorator waits until a relayout before creating actors etc.
    *
    * @param[in] size The size of the parent control after size-negotiation.
index b9edd83..1d43f37 100644 (file)
@@ -57,6 +57,17 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
                                          scripts );
 }
 
+void MultilanguageSupport::ReplaceScripts( LogicalModel& model,
+                                           CharacterIndex characterIndex,
+                                           Length numberOfCharactersToRemove,
+                                           Length numberOfCharactersToInsert )
+{
+  GetImplementation( *this ).ReplaceScripts( model,
+                                             characterIndex,
+                                             numberOfCharactersToRemove,
+                                             numberOfCharactersToInsert );
+}
+
 void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
                                           const Vector<ScriptRun>& scripts,
                                           Vector<FontRun>& fonts )
@@ -66,6 +77,17 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
                                             fonts );
 }
 
+void MultilanguageSupport::ValidateFonts( LogicalModel& model,
+                                          CharacterIndex characterIndex,
+                                          Length numberOfCharactersToRemove,
+                                          Length numberOfCharactersToInsert )
+{
+  GetImplementation( *this ).ValidateFonts( model,
+                                            characterIndex,
+                                            numberOfCharactersToRemove,
+                                            numberOfCharactersToInsert );
+}
+
 } // namespace Text
 
 } // namespace Toolkit
index 531fdad..36eb349 100644 (file)
@@ -97,6 +97,24 @@ public:
                    Vector<ScriptRun>& scripts );
 
   /**
+   * Replaces the scrips of the given range of characters.
+   *
+   * @pre The @p model needs to have a text set.
+   *
+   * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
+   * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
+   *
+   * @param[in,out] model The text's logical model.
+   * @param[in] characterIndex Index to the first character.
+   * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
+   * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
+   */
+  void ReplaceScripts( LogicalModel& model,
+                       CharacterIndex characterIndex,
+                       Length numberOfCharactersToRemove,
+                       Length numberOfCharactersToInsert );
+
+  /**
    * @brief Validates the character's font of the whole text.
    *
    * It may update fonts set by application developers.
@@ -116,6 +134,28 @@ public:
   void ValidateFonts( const Vector<Character>& text,
                       const Vector<ScriptRun>& scripts,
                       Vector<FontRun>& fonts );
+
+  /**
+   * Validates the character's font of the given range of characters.
+   *
+   * It may update fonts set by the mark-up processor.
+   * It sets default fonts based on the script to those characters without a font set.
+   *
+   * @pre The @p model needs to have a text set.
+   * @pre The @p model needs to have the scripts set.
+   *
+   * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
+   * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
+   *
+   * @param[in,out] model The text's logical model.
+   * @param[in] characterIndex Index to the first character.
+   * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
+   * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
+   */
+  void ValidateFonts( LogicalModel& model,
+                      CharacterIndex characterIndex,
+                      Length numberOfCharactersToRemove,
+                      Length numberOfCharactersToInsert );
 };
 
 } // namespace Text
index 6a68310..376a1b7 100644 (file)
@@ -193,6 +193,14 @@ void ShapeText( const Vector<Character>& text,
   charactersPerGlyph.Resize( totalNumberOfGlyphs );
 }
 
+void ShapeText( const LogicalModel& logicalModel,
+                VisualModel& visualModel,
+                CharacterIndex characterIndex,
+                Length numberOfCharactersToRemove,
+                Length numberOfCharactersToInsert )
+{
+}
+
 } // namespace Text
 
 } // namespace Toolkit
index 3381610..e18fd76 100644 (file)
@@ -32,6 +32,9 @@ namespace Toolkit
 namespace Text
 {
 
+class LogicalModel;
+class VisualModel;
+
 /**
  * Shapes the whole text.
  *
@@ -51,6 +54,29 @@ void ShapeText( const Vector<Character>& text,
                 Vector<CharacterIndex>& characterIndices,
                 Vector<Length>& charactersPerGlyph );
 
+/**
+ * Replaces the shape info of the given range of characters.
+ *
+ * @pre The @p model needs to have a text set.
+ * @pre The @p model needs to have the scripts set.
+ * @pre The @p model needs to have the fonts set.
+ * @pre The @p model needs to have the bidirectional info set.
+ *
+ * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
+ * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
+ *
+ * @param[in] logicalModel The text's logical model.
+ * @param[in,out] visualModel The text's logical model.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
+ * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
+ */
+void ShapeText( const LogicalModel& logicalModel,
+                VisualModel& visualModel,
+                CharacterIndex characterIndex,
+                Length numberOfCharactersToRemove,
+                Length numberOfCharactersToInsert );
+
 } // namespace Text
 
 } // namespace Toolkit