(Text Controller) Moved some input properties into a different class & some functiona... 40/266340/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 10 Nov 2021 21:17:38 +0000 (21:17 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 18 Nov 2021 09:53:20 +0000 (09:53 +0000)
Change-Id: I4d2cbd392d305ccd2ee31972df132713ff5cc19c

dali-toolkit/internal/file.list
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller-input-properties.cpp [new file with mode: 0644]
dali-toolkit/internal/text/text-controller-input-properties.h [new file with mode: 0644]
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index 322900697047bddf0ba38668a8b5dff3bdf67b76..7a0b010b4017ae761fb573f5848118da1a3fb17e 100644 (file)
@@ -161,6 +161,7 @@ SET( toolkit_src_files
    ${toolkit_src_dir}/text/text-controller-impl-event-handler.cpp
    ${toolkit_src_dir}/text/text-controller-impl-model-updater.cpp
    ${toolkit_src_dir}/text/text-controller-input-font-handler.cpp
+   ${toolkit_src_dir}/text/text-controller-input-properties.cpp
    ${toolkit_src_dir}/text/text-controller-placeholder-handler.cpp
    ${toolkit_src_dir}/text/text-controller-relayouter.cpp
    ${toolkit_src_dir}/text/text-controller-text-updater.cpp
index 2edca46cecb23d01f20b97e74b821d546a46bcef..4334f0e6548fbe5c5735bec3ff160eee9bf072a2 100644 (file)
@@ -783,6 +783,11 @@ void Controller::Impl::SetEditable(bool editable)
   if(mEventData)
   {
     mEventData->mEditingEnabled = editable;
+
+    if(mEventData->mDecorator)
+    {
+      mEventData->mDecorator->SetEditable(editable);
+    }
   }
 }
 
@@ -1732,6 +1737,86 @@ Actor Controller::Impl::CreateBackgroundActor()
   return actor;
 }
 
+void Controller::Impl::RelayoutForNewLineSize()
+{
+  // relayout all characters
+  mTextUpdateInfo.mCharacterIndex             = 0;
+  mTextUpdateInfo.mNumberOfCharactersToRemove = mTextUpdateInfo.mPreviousNumberOfCharacters;
+  mTextUpdateInfo.mNumberOfCharactersToAdd    = mModel->mLogicalModel->mText.Count();
+  mOperationsPending                          = static_cast<OperationsMask>(mOperationsPending | LAYOUT);
+
+  //remove selection
+  if(mEventData && mEventData->mState == EventData::SELECTING)
+  {
+    ChangeState(EventData::EDITING);
+  }
+
+  RequestRelayout();
+}
+
+bool Controller::Impl::IsInputStyleChangedSignalsQueueEmpty()
+{
+  return (NULL == mEventData) || (0u == mEventData->mInputStyleChangedQueue.Count());
+}
+
+void Controller::Impl::ProcessInputStyleChangedSignals()
+{
+  if(mEventData)
+  {
+    if(mEditableControlInterface)
+    {
+      // Emit the input style changed signal for each mask
+      std::for_each(mEventData->mInputStyleChangedQueue.begin(),
+                    mEventData->mInputStyleChangedQueue.end(),
+                    [&](const auto mask) { mEditableControlInterface->InputStyleChanged(mask); } );
+    }
+
+    mEventData->mInputStyleChangedQueue.Clear();
+  }
+}
+
+void Controller::Impl::ScrollBy(Vector2 scroll)
+{
+  if(mEventData && (fabs(scroll.x) > Math::MACHINE_EPSILON_0 || fabs(scroll.y) > Math::MACHINE_EPSILON_0))
+  {
+    const Vector2& layoutSize    = mModel->mVisualModel->GetLayoutSize();
+    const Vector2  currentScroll = mModel->mScrollPosition;
+
+    scroll.x = -scroll.x;
+    scroll.y = -scroll.y;
+
+    if(fabs(scroll.x) > Math::MACHINE_EPSILON_0)
+    {
+      mModel->mScrollPosition.x += scroll.x;
+      ClampHorizontalScroll(layoutSize);
+    }
+
+    if(fabs(scroll.y) > Math::MACHINE_EPSILON_0)
+    {
+      mModel->mScrollPosition.y += scroll.y;
+      ClampVerticalScroll(layoutSize);
+    }
+
+    if(mModel->mScrollPosition != currentScroll)
+    {
+      mEventData->mDecorator->UpdatePositions(mModel->mScrollPosition - currentScroll);
+      RequestRelayout();
+    }
+  }
+}
+
+float Controller::Impl::GetHorizontalScrollPosition()
+{
+  // Scroll values are negative internally so we convert them to positive numbers
+  return mEventData ? -mModel->mScrollPosition.x : 0.0f;
+}
+
+float Controller::Impl::GetVerticalScrollPosition()
+{
+  // Scroll values are negative internally so we convert them to positive numbers
+  return mEventData ? -mModel->mScrollPosition.y : 0.0f;
+}
+
 void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns)
 {
   //Underlined character runs for markup-processor
index 0c6297f3383dba4eaf04e6571dd35eb688d6e6cc..219ca7286501894f2bfa02097c1014530a49dc9b 100644 (file)
@@ -771,6 +771,37 @@ struct Controller::Impl
    */
   Actor CreateBackgroundActor();
 
+  /**
+   * @brief fill needed relayout parameters when line size is changed & request relayout.
+   */
+  void RelayoutForNewLineSize();
+
+  /**
+   * @copydoc Controller::IsInputStyleChangedSignalsQueueEmpty
+   */
+  bool IsInputStyleChangedSignalsQueueEmpty();
+
+  /**
+   * @copydoc Controller::ProcessInputStyleChangedSignals
+   */
+  void ProcessInputStyleChangedSignals();
+
+  /**
+   * @copydoc Controller::ScrollBy()
+   */
+  void ScrollBy(Vector2 scroll);
+
+  /**
+   * @copydoc Controller::GetHorizontalScrollPosition()
+   */
+  float GetHorizontalScrollPosition();
+
+  /**
+   * @copydoc Controller::GetVerticalScrollPosition()
+   */
+  float GetVerticalScrollPosition();
+
+
 public:
   /**
    * @brief Gets implementation from the controller handle.
diff --git a/dali-toolkit/internal/text/text-controller-input-properties.cpp b/dali-toolkit/internal/text/text-controller-input-properties.cpp
new file mode 100644 (file)
index 0000000..99ef15a
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/text/text-controller-input-properties.h>
+
+// EXTERNAL INCLUDES
+//#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+//#include <dali/devel-api/adaptor-framework/window-devel.h>
+//#include <dali/integration-api/debug.h>
+#include <memory.h>
+#include <cmath>
+#include <limits>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali-toolkit/internal/text/text-controller-event-handler.h>
+#include <dali-toolkit/internal/text/text-controller-impl.h>
+#include <dali-toolkit/internal/text/text-controller-input-font-handler.h>
+#include <dali-toolkit/internal/text/text-controller-placeholder-handler.h>
+#include <dali-toolkit/internal/text/text-controller-relayouter.h>
+#include <dali-toolkit/internal/text/text-controller-text-updater.h>
+#include <dali-toolkit/internal/text/text-editable-control-interface.h>
+
+namespace
+{
+const std::string EMPTY_STRING("");
+}
+
+namespace Dali::Toolkit::Text
+{
+
+void Controller::InputProperties::SetInputColor(Controller& controller, const Vector4& color)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mInputStyle.textColor      = color;
+    controller.mImpl->mEventData->mInputStyle.isDefaultColor = false;
+
+    if(EventData::SELECTING == controller.mImpl->mEventData->mState || EventData::EDITING == controller.mImpl->mEventData->mState || EventData::INACTIVE == controller.mImpl->mEventData->mState)
+    {
+      if(EventData::SELECTING == controller.mImpl->mEventData->mState)
+      {
+        const bool handlesCrossed = controller.mImpl->mEventData->mLeftSelectionPosition > controller.mImpl->mEventData->mRightSelectionPosition;
+
+        // Get start and end position of selection
+        const CharacterIndex startOfSelectedText  = handlesCrossed ? controller.mImpl->mEventData->mRightSelectionPosition : controller.mImpl->mEventData->mLeftSelectionPosition;
+        const Length         lengthOfSelectedText = (handlesCrossed ? controller.mImpl->mEventData->mLeftSelectionPosition : controller.mImpl->mEventData->mRightSelectionPosition) - startOfSelectedText;
+
+        // Add the color run.
+        const VectorBase::SizeType numberOfRuns = controller.mImpl->mModel->mLogicalModel->mColorRuns.Count();
+        controller.mImpl->mModel->mLogicalModel->mColorRuns.Resize(numberOfRuns + 1u);
+
+        ColorRun& colorRun                       = *(controller.mImpl->mModel->mLogicalModel->mColorRuns.Begin() + numberOfRuns);
+        colorRun.color                           = color;
+        colorRun.characterRun.characterIndex     = startOfSelectedText;
+        colorRun.characterRun.numberOfCharacters = lengthOfSelectedText;
+
+        controller.mImpl->mTextUpdateInfo.mCharacterIndex             = startOfSelectedText;
+        controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+        controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd    = lengthOfSelectedText;
+      }
+      else
+      {
+        controller.mImpl->mTextUpdateInfo.mCharacterIndex             = 0;
+        controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = controller.mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+        controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd    = controller.mImpl->mModel->mLogicalModel->mText.Count();
+      }
+
+      // Request to relayout.
+      controller.mImpl->mOperationsPending = static_cast<OperationsMask>(controller.mImpl->mOperationsPending | COLOR);
+      controller.mImpl->RequestRelayout();
+    }
+  }
+}
+
+const Vector4& Controller::InputProperties::GetInputColor(const Controller& controller)
+{
+  // Return event text input color if we have it, otherwise just return the default text's color
+  return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.textColor : controller.mImpl->mTextColor;
+}
+
+void Controller::InputProperties::SetInputLineSpacing(Controller& controller, float lineSpacing)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mInputStyle.lineSpacing          = lineSpacing;
+    controller.mImpl->mEventData->mInputStyle.isLineSpacingDefined = true;
+  }
+}
+
+float Controller::InputProperties::GetInputLineSpacing(const Controller& controller)
+{
+  return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.lineSpacing : 0.0f;
+}
+
+void Controller::InputProperties::SetInputShadowProperties(Controller& controller, const std::string& shadowProperties)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
+  }
+}
+
+const std::string& Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
+{
+  return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
+}
+
+void Controller::InputProperties::SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
+  }
+}
+
+const std::string& Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
+{
+  return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
+}
+
+void Controller::InputProperties::SetInputEmbossProperties(Controller& controller, const std::string& embossProperties)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
+  }
+}
+
+const std::string& Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
+{
+  return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.embossProperties : controller.GetDefaultEmbossProperties();
+}
+
+void Controller::InputProperties::SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
+  }
+}
+
+const std::string& Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
+{
+  return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.outlineProperties : controller.GetDefaultOutlineProperties();
+}
+
+void Controller::InputProperties::SetInputModePassword(Controller& controller, bool passwordInput)
+{
+  if(controller.mImpl->mEventData)
+  {
+    controller.mImpl->mEventData->mPasswordInput = passwordInput;
+  }
+}
+
+bool Controller::InputProperties::IsInputModePassword(Controller& controller)
+{
+  return controller.mImpl->mEventData && controller.mImpl->mEventData->mPasswordInput;
+}
+
+} // namespace Dali::Toolkit::Text
diff --git a/dali-toolkit/internal/text/text-controller-input-properties.h b/dali-toolkit/internal/text/text-controller-input-properties.h
new file mode 100644 (file)
index 0000000..d453b5f
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_PROPERTIES_H
+#define DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_PROPERTIES_H
+
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
+#include <dali/public-api/events/gesture.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-controller.h>
+//#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+//#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+//#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+//#include <dali-toolkit/internal/text/decorator/text-decorator.h>
+//#include <dali-toolkit/internal/text/hidden-text.h>
+//#include <dali-toolkit/internal/text/input-filter.h>
+//#include <dali-toolkit/internal/text/layouts/layout-engine.h>
+//#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
+//#include <dali-toolkit/internal/text/text-model-interface.h>
+//#include <dali-toolkit/internal/text/text-selectable-control-interface.h>
+//#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+namespace Dali::Toolkit::Text
+{
+struct Controller::InputProperties
+{
+  static void SetInputColor(Controller& controller, const Vector4& color);
+
+  static const Vector4& GetInputColor(const Controller& controller);
+
+  static void SetInputLineSpacing(Controller& controller, float lineSpacing);
+
+  static float GetInputLineSpacing(const Controller& controller);
+
+  static void SetInputShadowProperties(Controller& controller, const std::string& shadowProperties);
+
+  static const std::string& GetInputShadowProperties(const Controller& controller);
+
+  static void SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties);
+
+  static const std::string& GetInputUnderlineProperties(const Controller& controller);
+
+  static void SetInputEmbossProperties(Controller& controller, const std::string& embossProperties);
+
+  static const std::string& GetInputEmbossProperties(const Controller& controller);
+
+  static void SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties);
+
+  static const std::string& GetInputOutlineProperties(const Controller& controller);
+
+  static void SetInputModePassword(Controller& controller, bool passwordInput);
+
+  static bool IsInputModePassword(Controller& controller);
+};
+
+
+} // namespace Dali::Toolkit::Text
+
+#endif // DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_PROPERTIES_H
index 6e4d3616de7dc053b9bca1d93916f0b987d0f747..19af9997f99f376d6a71037ee77fbbed7de422ed 100644 (file)
@@ -31,6 +31,7 @@
 #include <dali-toolkit/internal/text/text-controller-event-handler.h>
 #include <dali-toolkit/internal/text/text-controller-impl.h>
 #include <dali-toolkit/internal/text/text-controller-input-font-handler.h>
+#include <dali-toolkit/internal/text/text-controller-input-properties.h>
 #include <dali-toolkit/internal/text/text-controller-placeholder-handler.h>
 #include <dali-toolkit/internal/text/text-controller-relayouter.h>
 #include <dali-toolkit/internal/text/text-controller-text-updater.h>
@@ -998,23 +999,6 @@ const std::string& Controller::GetDefaultOutlineProperties() const
   return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
 }
 
-void Controller::RelayoutForNewLineSize()
-{
-  // relayout all characters
-  mImpl->mTextUpdateInfo.mCharacterIndex             = 0;
-  mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
-  mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd    = mImpl->mModel->mLogicalModel->mText.Count();
-  mImpl->mOperationsPending                          = static_cast<OperationsMask>(mImpl->mOperationsPending | LAYOUT);
-
-  //remove selection
-  if(mImpl->mEventData && mImpl->mEventData->mState == EventData::SELECTING)
-  {
-    mImpl->ChangeState(EventData::EDITING);
-  }
-
-  mImpl->RequestRelayout();
-}
-
 bool Controller::SetDefaultLineSpacing(float lineSpacing)
 {
   if(std::fabs(lineSpacing - mImpl->mLayoutEngine.GetDefaultLineSpacing()) > Math::MACHINE_EPSILON_1000)
@@ -1022,7 +1006,7 @@ bool Controller::SetDefaultLineSpacing(float lineSpacing)
     mImpl->mLayoutEngine.SetDefaultLineSpacing(lineSpacing);
     mImpl->mRecalculateNaturalSize = true;
 
-    RelayoutForNewLineSize();
+    mImpl->RelayoutForNewLineSize();
     return true;
   }
   return false;
@@ -1040,7 +1024,7 @@ bool Controller::SetDefaultLineSize(float lineSize)
     mImpl->mLayoutEngine.SetDefaultLineSize(lineSize);
     mImpl->mRecalculateNaturalSize = true;
 
-    RelayoutForNewLineSize();
+    mImpl->RelayoutForNewLineSize();
     return true;
   }
   return false;
@@ -1053,52 +1037,12 @@ float Controller::GetDefaultLineSize() const
 
 void Controller::SetInputColor(const Vector4& color)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mInputStyle.textColor      = color;
-    mImpl->mEventData->mInputStyle.isDefaultColor = false;
-
-    if(EventData::SELECTING == mImpl->mEventData->mState || EventData::EDITING == mImpl->mEventData->mState || EventData::INACTIVE == mImpl->mEventData->mState)
-    {
-      if(EventData::SELECTING == mImpl->mEventData->mState)
-      {
-        const bool handlesCrossed = mImpl->mEventData->mLeftSelectionPosition > mImpl->mEventData->mRightSelectionPosition;
-
-        // Get start and end position of selection
-        const CharacterIndex startOfSelectedText  = handlesCrossed ? mImpl->mEventData->mRightSelectionPosition : mImpl->mEventData->mLeftSelectionPosition;
-        const Length         lengthOfSelectedText = (handlesCrossed ? mImpl->mEventData->mLeftSelectionPosition : mImpl->mEventData->mRightSelectionPosition) - startOfSelectedText;
-
-        // Add the color run.
-        const VectorBase::SizeType numberOfRuns = mImpl->mModel->mLogicalModel->mColorRuns.Count();
-        mImpl->mModel->mLogicalModel->mColorRuns.Resize(numberOfRuns + 1u);
-
-        ColorRun& colorRun                       = *(mImpl->mModel->mLogicalModel->mColorRuns.Begin() + numberOfRuns);
-        colorRun.color                           = color;
-        colorRun.characterRun.characterIndex     = startOfSelectedText;
-        colorRun.characterRun.numberOfCharacters = lengthOfSelectedText;
-
-        mImpl->mTextUpdateInfo.mCharacterIndex             = startOfSelectedText;
-        mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
-        mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd    = lengthOfSelectedText;
-      }
-      else
-      {
-        mImpl->mTextUpdateInfo.mCharacterIndex             = 0;
-        mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
-        mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd    = mImpl->mModel->mLogicalModel->mText.Count();
-      }
-
-      // Request to relayout.
-      mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending | COLOR);
-      mImpl->RequestRelayout();
-    }
-  }
+  InputProperties::SetInputColor(*this, color);
 }
 
 const Vector4& Controller::GetInputColor() const
 {
-  // Return event text input color if we have it, otherwise just return the default text's color
-  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.textColor : mImpl->mTextColor;
+  return InputProperties::GetInputColor(*this);
 }
 
 void Controller::SetInputFontFamily(const std::string& fontFamily)
@@ -1168,81 +1112,62 @@ float Controller::GetInputFontPointSize() const
 
 void Controller::SetInputLineSpacing(float lineSpacing)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mInputStyle.lineSpacing          = lineSpacing;
-    mImpl->mEventData->mInputStyle.isLineSpacingDefined = true;
-  }
+  InputProperties::SetInputLineSpacing(*this, lineSpacing);
 }
 
 float Controller::GetInputLineSpacing() const
 {
-  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.lineSpacing : 0.0f;
+  return InputProperties::GetInputLineSpacing(*this);
 }
 
 void Controller::SetInputShadowProperties(const std::string& shadowProperties)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
-  }
+  InputProperties::SetInputShadowProperties(*this, shadowProperties);
 }
 
 const std::string& Controller::GetInputShadowProperties() const
 {
-  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
+  return InputProperties::GetInputShadowProperties(*this);
 }
 
 void Controller::SetInputUnderlineProperties(const std::string& underlineProperties)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
-  }
+  InputProperties::SetInputUnderlineProperties(*this, underlineProperties);
 }
 
 const std::string& Controller::GetInputUnderlineProperties() const
 {
-  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
+  return InputProperties::GetInputUnderlineProperties(*this);
 }
 
 void Controller::SetInputEmbossProperties(const std::string& embossProperties)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
-  }
+  InputProperties::SetInputEmbossProperties(*this, embossProperties);
 }
 
 const std::string& Controller::GetInputEmbossProperties() const
 {
-  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.embossProperties : GetDefaultEmbossProperties();
+  return InputProperties::GetInputEmbossProperties(*this);
 }
 
 void Controller::SetInputOutlineProperties(const std::string& outlineProperties)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
-  }
+  InputProperties::SetInputOutlineProperties(*this, outlineProperties);
 }
 
 const std::string& Controller::GetInputOutlineProperties() const
 {
-  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.outlineProperties : GetDefaultOutlineProperties();
+  return InputProperties::GetInputOutlineProperties(*this);
 }
 
 void Controller::SetInputModePassword(bool passwordInput)
 {
-  if(mImpl->mEventData)
-  {
-    mImpl->mEventData->mPasswordInput = passwordInput;
-  }
+  InputProperties::SetInputModePassword(*this, passwordInput);
 }
 
 bool Controller::IsInputModePassword()
 {
-  return mImpl->mEventData && mImpl->mEventData->mPasswordInput;
+  return InputProperties::IsInputModePassword(*this);
 }
 
 void Controller::SetNoTextDoubleTapAction(NoTextTap::Action action)
@@ -1491,23 +1416,12 @@ void Controller::RequestRelayout()
 
 bool Controller::IsInputStyleChangedSignalsQueueEmpty()
 {
-  return (NULL == mImpl->mEventData) || (0u == mImpl->mEventData->mInputStyleChangedQueue.Count());
+  return mImpl->IsInputStyleChangedSignalsQueueEmpty();
 }
 
 void Controller::ProcessInputStyleChangedSignals()
 {
-  if(mImpl->mEventData)
-  {
-    if(mImpl->mEditableControlInterface)
-    {
-      // Emit the input style changed signal for each mask
-      std::for_each(mImpl->mEventData->mInputStyleChangedQueue.begin(),
-                    mImpl->mEventData->mInputStyleChangedQueue.end(),
-                    [&](const auto mask) { mImpl->mEditableControlInterface->InputStyleChanged(mask); } );
-    }
-
-    mImpl->mEventData->mInputStyleChangedQueue.Clear();
-  }
+  mImpl->ProcessInputStyleChangedSignals();
 }
 
 void Controller::KeyboardFocusGainEvent()
@@ -1704,52 +1618,21 @@ bool Controller::IsEditable() const
 void Controller::SetEditable(bool editable)
 {
   mImpl->SetEditable(editable);
-  if(mImpl->mEventData && mImpl->mEventData->mDecorator)
-  {
-    mImpl->mEventData->mDecorator->SetEditable(editable);
-  }
 }
 
 void Controller::ScrollBy(Vector2 scroll)
 {
-  if(mImpl->mEventData && (fabs(scroll.x) > Math::MACHINE_EPSILON_0 || fabs(scroll.y) > Math::MACHINE_EPSILON_0))
-  {
-    const Vector2& layoutSize    = mImpl->mModel->mVisualModel->GetLayoutSize();
-    const Vector2  currentScroll = mImpl->mModel->mScrollPosition;
-
-    scroll.x = -scroll.x;
-    scroll.y = -scroll.y;
-
-    if(fabs(scroll.x) > Math::MACHINE_EPSILON_0)
-    {
-      mImpl->mModel->mScrollPosition.x += scroll.x;
-      mImpl->ClampHorizontalScroll(layoutSize);
-    }
-
-    if(fabs(scroll.y) > Math::MACHINE_EPSILON_0)
-    {
-      mImpl->mModel->mScrollPosition.y += scroll.y;
-      mImpl->ClampVerticalScroll(layoutSize);
-    }
-
-    if(mImpl->mModel->mScrollPosition != currentScroll)
-    {
-      mImpl->mEventData->mDecorator->UpdatePositions(mImpl->mModel->mScrollPosition - currentScroll);
-      mImpl->RequestRelayout();
-    }
-  }
+  mImpl->ScrollBy(scroll);
 }
 
 float Controller::GetHorizontalScrollPosition()
 {
-  // Scroll values are negative internally so we convert them to positive numbers
-  return mImpl->mEventData ? -mImpl->mModel->mScrollPosition.x : 0.0f;
+  return mImpl->GetHorizontalScrollPosition();
 }
 
 float Controller::GetVerticalScrollPosition()
 {
-  // Scroll values are negative internally so we convert them to positive numbers
-  return mImpl->mEventData ? -mImpl->mModel->mScrollPosition.y : 0.0f;
+  return mImpl->GetVerticalScrollPosition();
 }
 
 void Controller::DecorationEvent(HandleType handleType, HandleState state, float x, float y)
index 324038444fcf93ef62d6740de0ae5befa9fabb9f..ec3cbb99601c975f1bab920eef6a2fdc8cebd736 100644 (file)
@@ -1896,11 +1896,6 @@ private: // Helpers.
    */
   void ResetScrollPosition();
 
-  /**
-   * @brief fill needed relayout parameters when line size is changed & request relayout.
-   */
-  void RelayoutForNewLineSize();
-
 private: // Private contructors & copy operator.
   /**
    * @brief Private constructor.
@@ -1941,6 +1936,7 @@ public:
 private:
   struct EventHandler;
   struct InputFontHandler;
+  struct InputProperties;
   struct PlaceholderHandler;
   struct Relayouter;
   struct TextUpdater;