Support character-spacing tag in markup
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / view-model.h
old mode 100755 (executable)
new mode 100644 (file)
index 1b81e7a..c7b0b18
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_VIEW_MODEL_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/public-api/common/dali-vector.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/text/text-enumerations.h>
-#include <dali-toolkit/internal/text/text-model-interface.h>
 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali-toolkit/internal/text/bounded-paragraph-run.h>
+#include <dali-toolkit/internal/text/text-model-interface.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Text
 {
-
 /**
  * @brief Responsible of creating and store temporary modifications of the text model.
  * i.e. The elide of text.
@@ -49,7 +47,7 @@ public:
    *
    * @param[in] model Pointer to the text's model interface.
    */
-  ViewModel( const ModelInterface* const model );
+  ViewModel(const ModelInterface* const model);
 
   /**
    * @brief Virtual destructor.
@@ -84,11 +82,16 @@ public:
   Text::VerticalAlignment::Type GetVerticalAlignment() const override;
 
   /**
- * @copydoc ModelInterface::GetVerticalLineAlignment()
- */
 * @copydoc ModelInterface::GetVerticalLineAlignment()
 */
   DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const override;
 
   /**
+  * @copydoc ModelInterface::GetEllipsisPosition()
+  */
+  DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
+
+  /**
    * @copydoc ModelInterface::IsTextElideEnabled()
    */
   bool IsTextElideEnabled() const override;
@@ -119,6 +122,26 @@ public:
   Length GetNumberOfGlyphs() const override;
 
   /**
+   * @copydoc ModelInterface::GetStartIndexOfElidedGlyphs()
+   */
+  GlyphIndex GetStartIndexOfElidedGlyphs() const override;
+
+  /**
+   * @copydoc ModelInterface::GetEndIndexOfElidedGlyphs()
+   */
+  GlyphIndex GetEndIndexOfElidedGlyphs() const override;
+
+  /**
+   * @copydoc ModelInterface::GetFirstMiddleIndexOfElidedGlyphs()
+   */
+  GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
+
+  /**
+   * @copydoc ModelInterface::GetSecondMiddleIndexOfElidedGlyphs()
+   */
+  GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
+
+  /**
    * @copydoc ModelInterface::GetGlyphs()
    */
   const GlyphInfo* const GetGlyphs() const override;
@@ -149,6 +172,11 @@ public:
   const ColorIndex* const GetBackgroundColorIndices() const override;
 
   /**
+   * @copydoc ModelInterface::IsMarkupBackgroundColorSet()
+   */
+  bool const IsMarkupBackgroundColorSet() const override;
+
+  /**
    * @copydoc ModelInterface::GetDefaultColor()
    */
   const Vector4& GetDefaultColor() const override;
@@ -184,6 +212,21 @@ public:
   float GetUnderlineHeight() const override;
 
   /**
+   * @copydoc ModelInterface::GetUnderlineType()
+   */
+  Text::Underline::Type GetUnderlineType() const override;
+
+  /**
+   * @copydoc ModelInterface::GetDashedUnderlineWidth()
+   */
+  float GetDashedUnderlineWidth() const override;
+
+  /**
+   * @copydoc ModelInterface::GetDashedUnderlineGap()
+   */
+  float GetDashedUnderlineGap() const override;
+
+  /**
    * @copydoc ModelInterface::GetNumberOfUnderlineRuns()
    */
   Length GetNumberOfUnderlineRuns() const override;
@@ -191,7 +234,7 @@ public:
   /**
    * @copydoc ModelInterface::GetUnderlineRuns()
    */
-  void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const override;
+  void GetUnderlineRuns(UnderlinedGlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const override;
 
   /**
    * @copydoc ModelInterface::GetOutlineColor()
@@ -213,21 +256,98 @@ public:
    */
   bool IsBackgroundEnabled() const override;
 
-/**
-   * @brief Does the text elide.
+  /**
+   * @copydoc ModelInterface::IsMarkupProcessorEnabled()
+   */
+  bool IsMarkupProcessorEnabled() const override;
+
+  /**
+  * @copydoc ModelInterface::GetHyphens()
+  */
+  const GlyphInfo* GetHyphens() const override;
+
+  /**
+  * @copydoc ModelInterface::GetHyphens()
+  */
+  const Length* GetHyphenIndices() const override;
+
+  /**
+  * @copydoc ModelInterface::GetHyphens()
+  */
+  Length GetHyphensCount() const override;
+
+  /**
+  * @copydoc ModelInterface::GetCharacterSpacing()
+  */
+  const float GetCharacterSpacing() const override;
+
+  /**
+  * @copydoc ModelInterface::GetTextBuffer()
+  */
+  const Character* GetTextBuffer() const override;
+
+  /**
+  * @copydoc ModelInterface::GetGlyphsToCharacters()
+  */
+  const Vector<CharacterIndex>& GetGlyphsToCharacters() const override;
+
+  /**
+   * @brief Does the text elide at the end, start or middle of text according to ellipsis position
    *
    * It stores a copy of the visible glyphs and removes as many glyphs as needed
-   * from the last visible line to add the ellipsis glyph.
+   * from the last visible line to add the ellipsis glyph in END case,
+   * from the first visible line to add the ellipsis glyph in START case,
+   * between the first and last visible lines to add the ellipsis glyph.
    *
    * It stores as well a copy of the positions for each visible glyph.
    */
   void ElideGlyphs();
 
+  float GetStrikethroughHeight() const override;
+
+  const Vector4& GetStrikethroughColor() const override;
+
+  bool IsStrikethroughEnabled() const override;
+
+  /**
+   * @copydoc ModelInterface::GetNumberOfStrikethroughRuns()
+   */
+  Length GetNumberOfStrikethroughRuns() const override;
+
+  /**
+   * @copydoc ModelInterface::GetNumberOfBoundedParagraphRuns()
+   */
+  virtual Length GetNumberOfBoundedParagraphRuns() const override;
+
+  /**
+   * @copydoc ModelInterface::GetBoundedParagraphRuns()
+   */
+  virtual const Vector<BoundedParagraphRun>& GetBoundedParagraphRuns() const override;
+
+  /**
+   * @copydoc ModelInterface::GetStrikethroughRuns()
+   */
+  void GetStrikethroughRuns(StrikethroughGlyphRun* strikethroughRuns, StrikethroughRunIndex index, Length numberOfRuns) const override;
+
+  /**
+   * @copydoc ModelInterface::GetNumberOfCharacterSpacingGlyphRuns()
+   */
+  Length GetNumberOfCharacterSpacingGlyphRuns() const override;
+
+  /**
+   * @copydoc ModelInterface::GetCharacterSpacingGlyphRuns()
+   */
+  const Vector<CharacterSpacingGlyphRun>& GetCharacterSpacingGlyphRuns() const override;
+
 private:
-  const ModelInterface* const mModel;            ///< Pointer to the text's model.
-  Vector<GlyphInfo>           mElidedGlyphs;     ///< Stores the glyphs of the elided text.
-  Vector<Vector2>             mElidedLayout;     ///< Stores the positions of each glyph of the elided text.
-  bool                        mIsTextElided : 1; ///< Whether the text has been elided.
+  const ModelInterface* const mModel;                           ///< Pointer to the text's model.
+  Vector<GlyphInfo>           mElidedGlyphs;                    ///< Stores the glyphs of the elided text.
+  Vector<Vector2>             mElidedLayout;                    ///< Stores the positions of each glyph of the elided text.
+  bool                        mIsTextElided : 1;                ///< Whether the text has been elided.
+  GlyphIndex                  mStartIndexOfElidedGlyphs;        ///< The start index of elided glyphs.
+  GlyphIndex                  mEndIndexOfElidedGlyphs;          ///< The end index of elided glyphs.
+  GlyphIndex                  mFirstMiddleIndexOfElidedGlyphs;  ///< The first end index of elided glyphs, index before ellipsis of middle.
+  GlyphIndex                  mSecondMiddleIndexOfElidedGlyphs; ///< The second end index of elided glyphs, index of ellipsis of middle.
 };
 
 } // namespace Text