X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-view%2Ftext-processor.h;h=9814c096ddca57d22cf0da5d445cdb91fb3b8fae;hb=refs%2Ftags%2Fsubmit%2Ftizen%2F20150309.074330;hp=269b8ce590b253b23a9878c5fea310728bbe64eb;hpb=e2eda444afbe82e9591fe198eef339227f90a616;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/text-view/text-processor.h b/dali-toolkit/internal/controls/text-view/text-processor.h index 269b8ce..9814c09 100644 --- a/dali-toolkit/internal/controls/text-view/text-processor.h +++ b/dali-toolkit/internal/controls/text-view/text-processor.h @@ -1,21 +1,22 @@ #ifndef __DALI_TOOLKIT_TEXT_PROCESSOR_H__ #define __DALI_TOOLKIT_TEXT_PROCESSOR_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // INTERNAL INCLUDES #include @@ -31,67 +32,31 @@ namespace Internal namespace TextProcessor { +// Forward declarations. +struct BidirectionalParagraphInfo; /** - * Splits the given text in lines. + * Splits the given text in paragraphs. * * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but * not necessarily the case for text in TextView) * - * @param [in] text The given text. - * @param [out] lines The text split in lines. + * @param [in] styledTextArray The given text. + * @param [out] paragraphs The text split in paragraphs. + * @param [out] styles The styles of each character of each paragraph. */ -void SplitInLines( const MarkupProcessor::StyledTextArray& text, - std::vector& lines ); +void SplitInParagraphs( const MarkupProcessor::StyledTextArray& styledTextArray, + std::vector& paragraphs, + std::vector< Vector >& styles ); /** - * Splits the given line in words. - * - * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but - * not necessarily the case for text in TextView) + * Finds the position of all word separators (currently white spaces and new paragraph characters '\n') in the given text. * - * @param [in] line The given line. - * @param [out] words The line split in words. - */ -void SplitInWords( const MarkupProcessor::StyledTextArray& line, - std::vector& words ); - -/** - * Whether the text begins with right-to-left (bidirectional) character. - * @param [in] text The given text. - * @return \e true if the text begins right-to-left character. - */ -bool BeginsRightToLeftCharacter( const Text& text ); - -/** - * @copydoc BeginsRightToLeftCharacter( const Text& text ) - */ -bool BeginsRightToLeftCharacter( const MarkupProcessor::StyledTextArray& text ); - -/** - * Whether the text contains any right-to-left (bidirectional) character. - * @param [in] text The given text. - * @return \e true if the text contains right-to-left character. - */ -bool ContainsRightToLeftCharacter( const Text& text ); - -/** - * @copydoc ContainsRightToLeftCharacter( const Text& text ) - */ -bool ContainsRightToLeftCharacter( const MarkupProcessor::StyledTextArray& text ); - -/** - * Convert the text as specified by the Unicode Bidirectional Algorithm. - * The text is converted only if it is bidirectional. - * @param[in] line The line of text to be converted. - * @param[out] convertedText The text converted. Text is grouped in chunks which only have one direction. - * @param[out] logicalToVisualMap The character position map from the logical input text to the visual output text. - * @param[out] visualToLogicalMap The character position map from the visual output text to the logical input text. + * @param [in] paragraph The given paragraph. + * @param [out] positions Positions within the paragraph of all word sepatators. */ - void ConvertBidirectionalText( const MarkupProcessor::StyledTextArray& line, - std::vector& convertedText, - std::vector& logicalToVisualMap, - std::vector& visualToLogicalMap ); +void SplitInWords( const Text& paragraph, + Vector& positions ); /** * Finds the nearest word in a string to a specified