2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/controller/text-controller-spannable-handler.h>
22 #include <dali/integration-api/debug.h>
26 #include <dali-toolkit/internal/text/controller/text-controller-impl.h>
27 #include <dali-toolkit/internal/text/controller/text-controller-text-updater.h>
28 #include <dali-toolkit/internal/text/logical-model-impl.h>
29 #include <dali-toolkit/internal/text/spannable/spans/base-span-impl.h>
33 #if defined(DEBUG_ENABLED)
34 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
45 void Controller::SpannableHandler::SetSpannedText(Controller& controller, const Text::Spanned& spannedText)
48 const std::string& text = spannedText.ToString();
49 Controller::TextUpdater::SetText(controller, text);
51 Controller::Impl& impl = *controller.mImpl;
52 LogicalModelPtr& logicalModel = impl.mModel->mLogicalModel;
55 logicalModel->mSpannedTextPlaced = true;
57 std::vector<Dali::Toolkit::Text::BaseSpan> spans;
58 std::vector<Dali::Toolkit::Text::Range> ranges;
59 spannedText.RetrieveAllSpansAndRanges(spans, ranges);
61 for(std::vector<Dali::Toolkit::Text::BaseSpan>::size_type i = 0; i < spans.size(); i++)
63 GetImplementation(spans[i]).CreateStyleCharacterRun(logicalModel, ranges[i]);
68 } // namespace Toolkit