Merge "TextContoller Copy and Cut buttons functional" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
index 326770d..dc5d3a6 100644 (file)
@@ -19,8 +19,9 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/devel-api/adaptor-framework/clipboard.h>
 #include <dali/devel-api/adaptor-framework/imf-manager.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
@@ -47,7 +48,9 @@ struct Event
     PAN_EVENT,
     GRAB_HANDLE_EVENT,
     LEFT_SELECTION_HANDLE_EVENT,
-    RIGHT_SELECTION_HANDLE_EVENT
+    RIGHT_SELECTION_HANDLE_EVENT,
+    SELECT,
+    SELECT_ALL
   };
 
   union Param
@@ -198,6 +201,7 @@ struct Controller::Impl
     mFontDefaults( NULL ),
     mEventData( NULL ),
     mFontClient(),
+    mClipboard(),
     mView(),
     mLayoutEngine(),
     mModifyEvents(),
@@ -212,6 +216,7 @@ struct Controller::Impl
     mVisualModel  = VisualModel::New();
 
     mFontClient = TextAbstraction::FontClient::Get();
+    mClipboard = Clipboard::Get();
 
     mView.SetVisualModel( mVisualModel );
 
@@ -306,6 +311,12 @@ struct Controller::Impl
     ClearPreEditFlag();
   }
 
+  bool IsClipboardEmpty()
+  {
+    bool result( mClipboard && mClipboard.NumberOfItems() );
+    return !result; // // If NumberOfItems greater than 0, return false
+  }
+
   void UpdateModel( OperationsMask operationsRequired );
 
   /**
@@ -324,6 +335,18 @@ struct Controller::Impl
 
   void OnHandleEvent( const Event& event );
 
+  void OnSelectEvent( const Event& event );
+
+  void OnSelectAllEvent();
+
+  void RetreiveSelection( std::string& selectedText, bool deleteAfterRetreival );
+
+  bool CopyStringToClipboard( std::string& source );
+
+  void SendSelectionToClipboard( bool deleteAfterSending );
+
+  void PasteTextFromClipboard();
+
   void RepositionSelectionHandles( CharacterIndex selectionStart, CharacterIndex selectionEnd );
   void RepositionSelectionHandles( float visualX, float visualY );
 
@@ -423,6 +446,7 @@ struct Controller::Impl
   FontDefaults* mFontDefaults;             ///< Avoid allocating this when the user does not specify a font.
   EventData* mEventData;                   ///< Avoid allocating everything for text input until EnableTextInput().
   TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
+  Clipboard mClipboard;                   ///< Handle to the system clipboard
   View mView;                              ///< The view interface to the rendering back-end.
   LayoutEngine mLayoutEngine;              ///< The layout engine.
   std::vector<ModifyEvent> mModifyEvents;  ///< Temporary stores the text set until the next relayout.