Merge "Notify multiline hint to IMF context" into devel/master
authorsuhyung Eom <suhyung.eom@samsung.com>
Fri, 12 Aug 2016 08:50:13 +0000 (01:50 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 12 Aug 2016 08:50:13 +0000 (01:50 -0700)
1  2 
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp

@@@ -307,6 -307,15 +307,15 @@@ void Controller::Impl::NotifyImfManager
    }
  }
  
+ void Controller::Impl::NotifyImfMultiLineStatus()
+ {
+   if ( mEventData )
+   {
+     LayoutEngine::Layout layout = mLayoutEngine.GetLayout();
+     mEventData->mImfManager.NotifyTextInputMultiLine( layout == LayoutEngine::MULTI_LINE_BOX );
+   }
+ }
  CharacterIndex Controller::Impl::GetLogicalCursorPosition() const
  {
    CharacterIndex cursorPosition = 0u;
@@@ -824,22 -833,15 +833,22 @@@ bool Controller::Impl::UpdateModel( Ope
        // Validate the fonts set through the mark-up string.
        Vector<FontDescriptionRun>& fontDescriptionRuns = mLogicalModel->mFontDescriptionRuns;
  
 -      // Get the default font id.
 -      const FontId defaultFontId = ( NULL == mFontDefaults ) ? 0u : mFontDefaults->GetFontId( mFontClient );
 +      // Get the default font's description.
 +      TextAbstraction::FontDescription defaultFontDescription;
 +      TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
 +      if( NULL != mFontDefaults )
 +      {
 +        defaultFontDescription = mFontDefaults->mFontDescription;
 +        defaultPointSize = mFontDefaults->mDefaultPointSize * 64u;
 +      }
  
        // Validates the fonts. If there is a character with no assigned font it sets a default one.
        // After this call, fonts are validated.
        multilanguageSupport.ValidateFonts( utf32Characters,
                                            scripts,
                                            fontDescriptionRuns,
 -                                          defaultFontId,
 +                                          defaultFontDescription,
 +                                          defaultPointSize,
                                            startIndex,
                                            requestedNumberOfCharacters,
                                            validFonts );
@@@ -2,7 -2,7 +2,7 @@@
  #define __DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H__
  
  /*
 - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + * Copyright (c) 2016 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.
@@@ -166,6 -166,7 +166,6 @@@ struct FontDefault
  {
    FontDefaults()
    : mFontDescription(),
 -    mFontStyle(),
      mDefaultPointSize( 0.f ),
      mFontId( 0u ),
      familyDefined( false ),
    }
  
    TextAbstraction::FontDescription mFontDescription;  ///< The default font's description.
 -  std::string                      mFontStyle;        ///< The font's style string set through the property system.
    float                            mDefaultPointSize; ///< The default font's point size.
    FontId                           mFontId;           ///< The font's id of the default font.
    bool familyDefined:1; ///< Whether the default font's family name is defined.
@@@ -439,6 -441,11 +439,11 @@@ struct Controller::Imp
    void NotifyImfManager();
  
    /**
+    * @brief Helper to notify IMF manager with multi line status.
+    */
+   void NotifyImfMultiLineStatus();
+   /**
     * @brief Retrieve the current cursor position.
     *
     * @return The cursor position.
@@@ -1,5 -1,5 +1,5 @@@
  /*
 - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + * Copyright (c) 2016 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.
@@@ -428,7 -428,7 +428,7 @@@ void Controller::SetDefaultFontFamily( 
  
    mImpl->mFontDefaults->mFontDescription.family = defaultFontFamily;
    DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetDefaultFontFamily %s\n", defaultFontFamily.c_str());
 -  mImpl->mFontDefaults->familyDefined = true;
 +  mImpl->mFontDefaults->familyDefined = !defaultFontFamily.empty();
  
    // Clear the font-specific data
    ClearFontData();
@@@ -446,6 -446,26 +446,6 @@@ const std::string& Controller::GetDefau
    return EMPTY_STRING;
  }
  
 -void Controller::SetDefaultFontStyle( const std::string& style )
 -{
 -  if( NULL == mImpl->mFontDefaults )
 -  {
 -    mImpl->mFontDefaults = new FontDefaults();
 -  }
 -
 -  mImpl->mFontDefaults->mFontStyle = style;
 -}
 -
 -const std::string& Controller::GetDefaultFontStyle() const
 -{
 -  if( NULL != mImpl->mFontDefaults )
 -  {
 -    return mImpl->mFontDefaults->mFontStyle;
 -  }
 -
 -  return EMPTY_STRING;
 -}
 -
  void Controller::SetDefaultFontWeight( FontWeight weight )
  {
    if( NULL == mImpl->mFontDefaults )
    mImpl->RequestRelayout();
  }
  
 +bool Controller::IsDefaultFontWeightDefined() const
 +{
 +  return mImpl->mFontDefaults->weightDefined;
 +}
 +
  FontWeight Controller::GetDefaultFontWeight() const
  {
    if( NULL != mImpl->mFontDefaults )
@@@ -493,11 -508,6 +493,11 @@@ void Controller::SetDefaultFontWidth( F
    mImpl->RequestRelayout();
  }
  
 +bool Controller::IsDefaultFontWidthDefined() const
 +{
 +  return mImpl->mFontDefaults->widthDefined;
 +}
 +
  FontWidth Controller::GetDefaultFontWidth() const
  {
    if( NULL != mImpl->mFontDefaults )
@@@ -524,11 -534,6 +524,11 @@@ void Controller::SetDefaultFontSlant( F
    mImpl->RequestRelayout();
  }
  
 +bool Controller::IsDefaultFontSlantDefined() const
 +{
 +  return mImpl->mFontDefaults->slantDefined;
 +}
 +
  FontSlant Controller::GetDefaultFontSlant() const
  {
    if( NULL != mImpl->mFontDefaults )
@@@ -950,6 -955,25 +950,6 @@@ const std::string& Controller::GetInput
    return GetDefaultFontFamily();
  }
  
 -void Controller::SetInputFontStyle( const std::string& fontStyle )
 -{
 -  if( NULL != mImpl->mEventData )
 -  {
 -    mImpl->mEventData->mInputStyle.fontStyle = fontStyle;
 -  }
 -}
 -
 -const std::string& Controller::GetInputFontStyle() const
 -{
 -  if( NULL != mImpl->mEventData )
 -  {
 -    return mImpl->mEventData->mInputStyle.fontStyle;
 -  }
 -
 -  // Return the default font's style if there is no EventData.
 -  return GetDefaultFontStyle();
 -}
 -
  void Controller::SetInputFontWeight( FontWeight weight )
  {
    if( NULL != mImpl->mEventData )
    }
  }
  
 +bool Controller::IsInputFontWeightDefined() const
 +{
 +  bool defined = false;
 +
 +  if( NULL != mImpl->mEventData )
 +  {
 +    defined = mImpl->mEventData->mInputStyle.weightDefined;
 +  }
 +
 +  return defined;
 +}
 +
  FontWeight Controller::GetInputFontWeight() const
  {
    if( NULL != mImpl->mEventData )
@@@ -1060,18 -1072,6 +1060,18 @@@ void Controller::SetInputFontWidth( Fon
    }
  }
  
 +bool Controller::IsInputFontWidthDefined() const
 +{
 +  bool defined = false;
 +
 +  if( NULL != mImpl->mEventData )
 +  {
 +    defined = mImpl->mEventData->mInputStyle.widthDefined;
 +  }
 +
 +  return defined;
 +}
 +
  FontWidth Controller::GetInputFontWidth() const
  {
    if( NULL != mImpl->mEventData )
@@@ -1126,18 -1126,6 +1126,18 @@@ void Controller::SetInputFontSlant( Fon
    }
  }
  
 +bool Controller::IsInputFontSlantDefined() const
 +{
 +  bool defined = false;
 +
 +  if( NULL != mImpl->mEventData )
 +  {
 +    defined = mImpl->mEventData->mInputStyle.slantDefined;
 +  }
 +
 +  return defined;
 +}
 +
  FontSlant Controller::GetInputFontSlant() const
  {
    if( NULL != mImpl->mEventData )
@@@ -1992,7 -1980,7 +1992,7 @@@ void Controller::KeyboardFocusGainEvent
        mImpl->ChangeState( EventData::EDITING );
        mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
      }
+     mImpl->NotifyImfMultiLineStatus();
      if( mImpl->IsShowingPlaceholderText() )
      {
        // Show alternative placeholder-text when editing