X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcontroller%2Ftext-controller.cpp;h=548224b25d376e4ba0715deac1027e5911daded0;hb=HEAD;hp=b2c67e1ce9310cc64cbd3fe721377cb2a21f3487;hpb=977d6c6c55f117861131682e20bbfe2ef7839bea;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/controller/text-controller.cpp b/dali-toolkit/internal/text/controller/text-controller.cpp index b2c67e1..ca2c5f2 100644 --- a/dali-toolkit/internal/text/controller/text-controller.cpp +++ b/dali-toolkit/internal/text/controller/text-controller.cpp @@ -48,6 +48,7 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT const char* EMPTY_STRING = ""; const char* MIME_TYPE_TEXT_PLAIN = "text/plain;charset=utf-8"; +const char* MIME_TYPE_HTML = "application/xhtml+xml"; template void EnsureCreated(Type*& object) @@ -304,6 +305,41 @@ void Controller::SetIgnoreSpacesAfterText(bool ignore) mImpl->mModel->mIgnoreSpacesAfterText = ignore; } +bool Controller::IsRemoveFrontInset() const +{ + return mImpl->mModel->mRemoveFrontInset; +} + +void Controller::SetRemoveFrontInset(bool remove) +{ + mImpl->mModel->mRemoveFrontInset = remove; +} + +bool Controller::IsRemoveBackInset() const +{ + return mImpl->mModel->mRemoveBackInset; +} + +void Controller::SetRemoveBackInset(bool remove) +{ + mImpl->mModel->mRemoveBackInset = remove; +} + +bool Controller::IsTextCutout() const +{ + return mImpl->mTextCutout; +} + +void Controller::SetTextCutout(bool cutout) +{ + if(cutout != mImpl->mTextCutout) + { + mImpl->mModel->mVisualModel->SetCutoutEnabled(cutout); + mImpl->mTextCutout = cutout; + mImpl->RequestRelayout(); + } +} + void Controller::ChangedLayoutDirection() { mImpl->mIsLayoutDirectionChanged = true; @@ -974,6 +1010,17 @@ float Controller::GetDashedUnderlineGap() const return mImpl->mModel->mVisualModel->GetDashedUnderlineGap(); } +void Controller::SetOutlineOffset(const Vector2& outlineOffset) +{ + mImpl->mModel->mVisualModel->SetOutlineOffset(outlineOffset); + mImpl->RequestRelayout(); +} + +const Vector2& Controller::GetOutlineOffset() const +{ + return mImpl->mModel->mVisualModel->GetOutlineOffset(); +} + void Controller::SetOutlineColor(const Vector4& color) { mImpl->mModel->mVisualModel->SetOutlineColor(color); @@ -996,6 +1043,20 @@ uint16_t Controller::GetOutlineWidth() const return mImpl->mModel->mVisualModel->GetOutlineWidth(); } +void Controller::SetOutlineBlurRadius(const float& outlineBlurRadius) +{ + if(fabsf(GetOutlineBlurRadius() - outlineBlurRadius) > Math::MACHINE_EPSILON_1) + { + mImpl->mModel->mVisualModel->SetOutlineBlurRadius(outlineBlurRadius); + mImpl->RequestRelayout(); + } +} + +const float& Controller::GetOutlineBlurRadius() const +{ + return mImpl->mModel->mVisualModel->GetOutlineBlurRadius(); +} + void Controller::SetBackgroundColor(const Vector4& color) { mImpl->mModel->mVisualModel->SetBackgroundColor(color); @@ -1485,6 +1546,28 @@ void Controller::SetVisualTransformOffset(Vector2 offset) mImpl->mModel->mVisualTransformOffset = offset; } +void Controller::SetBackgroundWithCutoutEnabled(bool cutout) +{ + mImpl->mModel->mVisualModel->SetBackgroundWithCutoutEnabled(cutout); + RequestRelayout(); +} + +bool Controller::IsBackgroundWithCutoutEnabled() const +{ + return mImpl->mModel->mVisualModel->IsBackgroundWithCutoutEnabled(); +} + +void Controller::SetBackgroundColorWithCutout(const Vector4& color) +{ + mImpl->mModel->mVisualModel->SetBackgroundColorWithCutout(color); + mImpl->RequestRelayout(); +} + +const Vector4 Controller::GetBackgroundColorWithCutout() const +{ + return mImpl->mModel->mVisualModel->GetBackgroundColorWithCutout(); +} + Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection) { return Relayouter::Relayout(*this, size, layoutDirection); @@ -1577,7 +1660,7 @@ void Controller::RequestProcessInputStyleChangedSignals() if(Dali::Adaptor::IsAvailable() && !mImpl->mProcessorRegistered) { mImpl->mProcessorRegistered = true; - Dali::Adaptor::Get().RegisterProcessor(*this, true); + Dali::Adaptor::Get().RegisterProcessorOnce(*this, true); } } @@ -1708,11 +1791,27 @@ void Controller::PasteClipboardItemEvent(uint32_t id, const char* mimeType, cons mImpl->mClipboard.DataReceivedSignal().Disconnect(this, &Controller::PasteClipboardItemEvent); // If the id is 0u, it is an invalid response. + if(id == 0u) + { + return; + } + // text-controller allows only plain text type. - if(id != 0u && !strncmp(mimeType, MIME_TYPE_TEXT_PLAIN, strlen(MIME_TYPE_TEXT_PLAIN))) + if(!strncmp(mimeType, MIME_TYPE_TEXT_PLAIN, strlen(MIME_TYPE_TEXT_PLAIN))) { EventHandler::PasteClipboardItemEvent(*this, data); } + else if(!strncmp(mimeType, MIME_TYPE_HTML, strlen(MIME_TYPE_HTML))) + { + // This does not mean that text controls can parse html. + // This is temporary code, as text controls do not support html type data. + // Simply remove the tags inside the angle brackets. + // Once multiple types and data can be stored in the clipboard, this code should be removed. + std::regex reg("<[^>]*>"); + std::string result = regex_replace(data, reg, ""); + + EventHandler::PasteClipboardItemEvent(*this, result.c_str()); + } } void Controller::PasteText() @@ -1722,8 +1821,11 @@ void Controller::PasteText() // Connect the signal before calling GetData() of the clipboard. mImpl->mClipboard.DataReceivedSignal().Connect(this, &Controller::PasteClipboardItemEvent); + // If there is no plain text type data on the clipboard, request html type data. + std::string mimeType = mImpl->mClipboard.HasType(MIME_TYPE_TEXT_PLAIN) ? MIME_TYPE_TEXT_PLAIN : MIME_TYPE_HTML; + // Request clipboard service to retrieve an item. - uint id = mImpl->mClipboard.GetData(MIME_TYPE_TEXT_PLAIN); + uint id = mImpl->mClipboard.GetData(mimeType); if(id == 0u) { // If the return id is 0u, the signal is not emitted, we must disconnect signal here. @@ -1855,7 +1957,6 @@ void Controller::Process(bool postProcess) { Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - adaptor.UnregisterProcessor(*this, true); mImpl->mProcessorRegistered = false; if(NULL == mImpl->mIdleCallback) @@ -1893,7 +1994,7 @@ Controller::~Controller() { if(mImpl->mProcessorRegistered) { - Dali::Adaptor::Get().UnregisterProcessor(*this, true); + Dali::Adaptor::Get().UnregisterProcessorOnce(*this, true); } if(mImpl->mIdleCallback) {