X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Ftext-view%2Ftext-view-line-processor.h;h=e5ff79166362e8a4793ec975e9ee2ffcbeb2d04f;hb=refs%2Fchanges%2F61%2F27361%2F4;hp=975efb57224cf8d29ddecf6f37190779f3952d62;hpb=30f6ca1e541089b19f2b349a8a12d8a5bcaf2f9e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h b/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h index 975efb5..e5ff791 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-line-processor.h @@ -1,25 +1,25 @@ #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_LINE_PROCESSOR_H__ #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_LINE_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 "text-view-impl.h" -#include "text-view-processor-types.h" +#include namespace Dali { @@ -34,14 +34,6 @@ namespace TextViewProcessor { /** - * Updates the line layout size info. - * - * @param[in,out] lineLayoutInfo The line layout info. - * @param[in] lineHeightOffset The line height offset. - */ -void UpdateLineLayoutInfo( TextViewProcessor::LineLayoutInfo& lineLayoutInfo, float lineHeightOffset ); - -/** * Creates a data structure with info to layout the line, and data structures with useful info to modify the layout data structure if characters are added or removed. * * @param[in] line The styled line. @@ -50,32 +42,65 @@ void UpdateLineLayoutInfo( TextViewProcessor::LineLayoutInfo& lineLayoutInfo, fl */ void CreateLineInfo( const MarkupProcessor::StyledTextArray& line, TextView::RelayoutData& relayoutData, - TextViewProcessor::LineLayoutInfo& lineLayoutInfo ); + LineLayoutInfo& lineLayoutInfo ); /** - * Removes a given number of groups of words from the given line. + * Updates the line layout size info. * - * @pre \e groupIndex and \e groupIndex + \e numberOfGroups can't exceed the bounds of the line. + * @param[in,out] lineLayoutInfo The line layout info. + * @param[in] lineHeightOffset The line height offset. + */ +void UpdateLayoutInfo( LineLayoutInfo& lineLayoutInfo, float lineHeightOffset ); + +/** + * Removes a given number of words from the given line. + * + * @pre \e wordIndex and \e wordIndex + \e numberOfWords can't exceed the bounds of the line. * - * @param[in] groupIndex Index to the group of words within the line with the starting position to be deleted. - * @param[in] numberOfGroups The number of group of words to be deleted. + * @param[in] wordIndex Index to the word within the line with the starting position to be deleted. + * @param[in] numberOfWords The number of words to be deleted. * @param[in] lineHeightOffset Additional space between lines. Needed to update layout info. - * @param[in,out] lineLayout The input is the layout info of the line. The output is the layout info of the line without the removed group of words. + * @param[in,out] lineLayout The input is the layout info of the line. The output is the layout info of the line without the removed words. + */ +void RemoveWordsFromLine( std::size_t wordIndex, + std::size_t numberOfWords, + float lineHeightOffset, + LineLayoutInfo& lineLayout ); + +/** + * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info. + * @param[in] numberOfCharacters The number of characters to be deleted. + * @param[out] mergeWords Whether words need to be merged after removing characters. + * @param[out] mergeLines Whether current line need to be merged with the next one. + * @param[in,out] textInfoIndicesBegin Indices to the line, word and characters from where to delete characters. It returns from where words need to be removed. + * @param[out] textInfoIndicesEnd If lines or words need to be merged it returns info to delete them (If a word is merged, it has to be removed. Equal for lines). + * @param[out] textInfoMergeIndicesBegin The indices to the first part of the line and word to be merged. + * @param[out] textInfoMergeIndicesEnd The indices to the last part of the line and word to be merged. + * @param[in,out] lineLayout Layout info of the line where the word is located. + * @param[out] removedTextActorsFromFirstWord Stores removed text-actors of the word pointed by the 'begin' index. + * @param[out] removedTextActorsFromLastWord Stores removed text-actors of the word pointed by the 'end' index. */ -void RemoveWordGroupsFromLine( std::size_t groupIndex, - std::size_t numberOfGroups, - const PointSize& lineHeightOffset, - LineLayoutInfo& lineLayout ); +void RemoveCharactersFromLineInfo( TextView::RelayoutData& relayoutData, + std::size_t numberOfCharacters, + bool& mergeWords, + bool& mergeLines, + TextInfoIndices& textInfoIndicesBegin, + TextInfoIndices& textInfoIndicesEnd, + TextInfoIndices& textInfoMergeIndicesBegin, + TextInfoIndices& textInfoMergeIndicesEnd, + LineLayoutInfo& lineLayout, + std::vector& removedTextActorsFromFirstWord, + std::vector& removedTextActorsFromLastWord ); /** * Splits a given line in two. * * @note It deletes whatever there is in the last part of the line. * - * @param[in] indices Index to the group of words within the line, index to the word and index to the character within the word to split the line. + * @param[in] indices Index to the word within the line and index to the character within the word to split the line. * @param[in] lineHeightOffset Additional space between lines. Needed to update layout info. - * @param[in,out] firstLineLayoutInfo The input is the layout info of the given line. The output is the first part of the input line (from the group of words \e 0 to the group of words \e groupPosition). - * @param[in,out] lastLineLayoutInfo Layout info of the last part of the given line ( from the group of words \e groupPosition + \e 1 to the end of the line). + * @param[in,out] firstLineLayoutInfo The input is the layout info of the given line. The output is the first part of the input line. + * @param[in,out] lastLineLayoutInfo Layout info of the last part of the given line. */ void SplitLine( const TextInfoIndices& indices, const PointSize& lineHeightOffset, @@ -83,11 +108,11 @@ void SplitLine( const TextInfoIndices& indices, LineLayoutInfo& lastLineLayoutInfo ); /** - * Merges the two given lines by adding groups of words of the last line to the firs one. + * Merges the two given lines by adding words of the last line to the firs one. * * @note Does nothing if last part of the line is empty. * @note If the first part of the line is empty it just copy the last part to it. - * @note it asserts if the last word of the first group is a line separator (new line character) + * @note it asserts if the last word of the first line is a line separator (new line character) * * @param[in,out] firstLineLineLayoutInfo The input is the layout info of the first line. The output is the layout info of the merged line. * @param[in] lastLineLayoutInfo Layout info of the last line.