+ mImpl->mTextUpdateInfo.mClearAll = true;
+
+ // Restore the actual control's size.
+ mImpl->mModel->mVisualModel->mControlSize = actualControlSize;
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
+ }
+ else
+ {
+ naturalSize = mImpl->mModel->mVisualModel->GetNaturalSize();
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
+ }
+
+ naturalSize.x = ConvertToEven( naturalSize.x );
+ naturalSize.y = ConvertToEven( naturalSize.y );
+
+ return naturalSize;
+}
+
+float Controller::GetHeightForWidth( float width )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetHeightForWidth %p width %f\n", this, width );
+ // Make sure the model is up-to-date before layouting
+ ProcessModifyEvents();
+
+ Size layoutSize;
+ if( fabsf( width - mImpl->mModel->mVisualModel->mControlSize.width ) > Math::MACHINE_EPSILON_1000 ||
+ mImpl->mTextUpdateInfo.mFullRelayoutNeeded ||
+ mImpl->mTextUpdateInfo.mClearAll )
+ {
+ // Operations that can be done only once until the text changes.
+ const OperationsMask onlyOnceOperations = static_cast<OperationsMask>( CONVERT_TO_UTF32 |
+ GET_SCRIPTS |
+ VALIDATE_FONTS |
+ GET_LINE_BREAKS |
+ GET_WORD_BREAKS |
+ BIDI_INFO |
+ SHAPE_TEXT |
+ GET_GLYPH_METRICS );
+
+ // Set the update info to relayout the whole text.
+ mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
+
+ // Make sure the model is up-to-date before layouting
+ mImpl->UpdateModel( onlyOnceOperations );
+
+
+ // Layout the text for the new width.
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | LAYOUT );
+
+ // Store the actual control's width.
+ const float actualControlWidth = mImpl->mModel->mVisualModel->mControlSize.width;
+
+ DoRelayout( Size( width, MAX_FLOAT ),
+ static_cast<OperationsMask>( onlyOnceOperations |
+ LAYOUT ),
+ layoutSize );
+
+ // Do not do again the only once operations.
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending & ~onlyOnceOperations );
+
+ // Do the size related operations again.
+ const OperationsMask sizeOperations = static_cast<OperationsMask>( LAYOUT |
+ ALIGN |
+ REORDER );
+
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | sizeOperations );
+
+ // Clear the update info. This info will be set the next time the text is updated.
+ mImpl->mTextUpdateInfo.Clear();
+ mImpl->mTextUpdateInfo.mClearAll = true;
+
+ // Restore the actual control's width.
+ mImpl->mModel->mVisualModel->mControlSize.width = actualControlWidth;
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height );
+ }
+ else
+ {
+ layoutSize = mImpl->mModel->mVisualModel->GetLayoutSize();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth cached %f\n", layoutSize.height );
+ }
+
+ return layoutSize.height;
+}
+
+int Controller::GetLineCount( float width )
+{
+ GetHeightForWidth( width );
+ int numberofLines = mImpl->mModel->GetNumberOfLines();
+ return numberofLines;
+}
+
+const ModelInterface* const Controller::GetTextModel() const
+{
+ return mImpl->mModel.Get();
+}
+
+float Controller::GetScrollAmountByUserInput()
+{
+ float scrollAmount = 0.0f;
+
+ if (NULL != mImpl->mEventData && mImpl->mEventData->mCheckScrollAmount)
+ {
+ scrollAmount = mImpl->mModel->mScrollPosition.y - mImpl->mModel->mScrollPositionLast.y;
+ mImpl->mEventData->mCheckScrollAmount = false;
+ }
+ return scrollAmount;
+}
+
+bool Controller::GetTextScrollInfo( float& scrollPosition, float& controlHeight, float& layoutHeight )
+{
+ const Vector2& layout = mImpl->mModel->mVisualModel->GetLayoutSize();
+ bool isScrolled;
+
+ controlHeight = mImpl->mModel->mVisualModel->mControlSize.height;
+ layoutHeight = layout.height;
+ scrollPosition = mImpl->mModel->mScrollPosition.y;
+ isScrolled = !Equals( mImpl->mModel->mScrollPosition.y, mImpl->mModel->mScrollPositionLast.y, Math::MACHINE_EPSILON_1 );
+ return isScrolled;
+}
+
+void Controller::SetHiddenInputOption(const Property::Map& options )
+{
+ if( NULL == mImpl->mHiddenInput )
+ {
+ mImpl->mHiddenInput = new HiddenText( this );
+ }
+ mImpl->mHiddenInput->SetProperties(options);
+}
+
+void Controller::GetHiddenInputOption(Property::Map& options )
+{
+ if( NULL != mImpl->mHiddenInput )
+ {
+ mImpl->mHiddenInput->GetProperties(options);
+ }
+}
+
+void Controller::SetPlaceholderProperty( const Property::Map& map )
+{
+ const Property::Map::SizeType count = map.Count();