X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Flogical-model-impl.h;h=9f2fa31c00223d0ed9c37ad50819908843c539e2;hp=7a28ba639049ef79881602db1e0fa54d386c5824;hb=a827febe27e8131e681c24c255472bbbf097905f;hpb=4d763eb68b5aa2448dfc81d90fc5ce598c68c99f diff --git a/dali-toolkit/internal/text/logical-model-impl.h b/dali-toolkit/internal/text/logical-model-impl.h index 7a28ba6..9f2fa31 100644 --- a/dali-toolkit/internal/text/logical-model-impl.h +++ b/dali-toolkit/internal/text/logical-model-impl.h @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace Dali @@ -88,26 +89,48 @@ public: // Visual <--> Logical conversion tables. /** - * @brief Sets the visual to logical and the logical to visual map tables. + * @brief Retrieves the logical cursor index for the given visual cursor index. * - * Replaces any map tables previously set. + * @pre The method FetchBidirectionalLineInfo() must be called before. If the result of FetchBidirectionalLineInfo() is false, + * then the character is not in a bidirectional line and the result will be invalid. * - * @note If the number of runs is zero the bidirectional info buffer is cleared. + * @param[in] visualCursorIndex The visual cursor index. * - * @param[in] bidirectionalInfo Pointer to a buffer with all the bidirectional info runs. - * @param[in] numberOfRuns The number of bidirectional info runs. + * @return The logical cursor index. */ - void SetVisualToLogicalMap( const BidirectionalLineInfoRun* const bidirectionalInfo, - Length numberOfRuns ); + CharacterIndex GetLogicalCursorIndex( CharacterIndex visualCursorIndex ); /** * @brief Retrieves the logical character index for the given visual character index. * + * @pre The method FetchBidirectionalLineInfo() must be called before. If the result of FetchBidirectionalLineInfo() is false, + * then the character is not in a bidirectional line and the result will be invalid. + * * @param[in] visualCharacterIndex The visual character index. * * @return The logical character index. */ - CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const; + CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ); + + /** + * @brief Fetch the bidirectional line info for the given character. + * + * Call GetBidirectionalLineInfo() to retrieve the last fetched line. + * + * @param[in] characterIndex The character index. + * + * @return @e true if the given @e character is in a bidirectional line. + */ + bool FetchBidirectionalLineInfo( CharacterIndex characterIndex ); + + /** + * @brief Retrieves the last fetched bidirectional line info. + * + * @return The index of the bidirectional line info. + */ + BidirectionalLineRunIndex GetBidirectionalLineInfo() const; + + // Text style. /** * @brief Updates the text's style runs with the added or removed text. @@ -130,6 +153,30 @@ public: */ void ClearFontDescriptionRuns(); + // Paragraphs + + /** + * @brief Creates the paragraph info. + * + * @pre The line break info must be set. + * + * @param[in] startIndex The character from where the paragraph info is set. + * @param[in] numberOfCharacters The number of characters. + */ + void CreateParagraphInfo( CharacterIndex startIndex, + Length numberOfCharacters ); + + /** + * @brief Find the paragraphs which contains the given characters. + * + * @param[in] index The first character's index of the run. + * @param[in] numberOfCharacters The number of characters of the run. + * @param[out] paragraphs Indices to the paragraphs which contain the characters. + */ + void FindParagraphs( CharacterIndex index, + Length numberOfCharacters, + Vector& paragraphs ); + protected: /** @@ -159,12 +206,12 @@ public: Vector mFontDescriptionRuns; Vector mLineBreakInfo; Vector mWordBreakInfo; + Vector mParagraphInfo; Vector mBidirectionalParagraphInfo; - Vector mCharacterDirections; ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ). + Vector mCharacterDirections; ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ). Vector mBidirectionalLineInfo; - Vector mLogicalToVisualMap; ///< Bidirectional logical to visual conversion table. - Vector mVisualToLogicalMap; ///< Bidirectional visual to logical conversion table. - Vector mVisualToLogicalCursorMap; ///< Bidirectional visual to logical cursor conversion table. + + BidirectionalLineRunIndex mBidirectionalLineIndex; ///< The last fetched bidirectional line info. }; } // namespace Text