modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUi_Clipboard.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an ”AS IS” BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FUi_Clipboard.h
20  * @brief               This is the header file for the _Clipboard class.
21  *
22  * This header file contains the declarations of the %_Clipboard class.
23  */
24
25 #ifndef _FUI_INTERNAL_CLIPBOARD_H_
26 #define _FUI_INTERNAL_CLIPBOARD_H_
27
28 #include <unique_ptr.h>
29 #include <FBaseObject.h>
30 #include <FUiClipboardTypes.h>
31 #include "FUi_Types.h"
32 #include "FUi_EcoreEvas.h"
33 #include "FUi_ClipboardPopupEvent.h"
34
35 namespace Tizen { namespace Base { namespace Collection {
36 class IList;
37 }}} // Tizen::Base::Collection
38
39 namespace Tizen { namespace Ui { namespace Controls {
40 class _PublicClipboardPopupEvent;
41 }}} // Tizen::Ui::Controls
42
43 namespace Tizen { namespace Graphics {
44 class Bitmap;
45 }} // Tizen::Graphics
46
47 namespace Tizen { namespace Ui
48 {
49 class _ClipboardItem;
50 class IClipboardPopupEventListener;
51 class _IClipboardPopupEventListener;
52
53 class _Clipboard
54         : public Tizen::Base::Object
55 {
56 public:
57         static _Clipboard* GetInstance(void);
58         static void ReleaseInstance(void);
59
60         result CopyItem(const _ClipboardItem& item);
61
62         Tizen::Base::Collection::IList* RetrieveItemsN(unsigned long dataTypes);
63         const _ClipboardItem* RetrieveLatestItemN(unsigned long dataTypes);
64
65         result ShowPopup(unsigned long dataTypes, const IClipboardPopupEventListener &listener);
66         result HidePopup(void);
67         bool IsPopupVisible(void);
68
69         void FireEvent(int format, char* pData);
70
71         result AddClipboardPopupEventListener(_IClipboardPopupEventListener& listener);
72         result RemoveClipboardPopupEventListener(_IClipboardPopupEventListener& listener);
73
74         void FirePopupEvent(_ClipboardPopupState state, int width, int height);
75
76 private:
77         _ClipFormat ConvertToClipFormat(ClipboardDataType type);
78         ClipboardDataType ConvertToDataType(int format, const char* pData);
79
80         char* EncodeToCharN(const Tizen::Base::String& string);
81
82         char* CreateImageFileN(const Tizen::Graphics::Bitmap& bitmap);
83         Tizen::Graphics::Bitmap* LoadBitmapN(const Tizen::Base::String& path);
84
85         Tizen::Base::String CreateImageFilePath(void);
86         result RemoveUnnecessaryImageFiles(void);
87         result RemoveAllImageFiles(void);
88
89         bool IsValidDataType(unsigned long dataTypes);
90         bool IsVideoDataType(const char* pChar);
91         bool IsAudioDataType(const char* pChar);
92
93         _Clipboard(void);
94         virtual ~_Clipboard(void);
95
96         _Clipboard(const _Clipboard& rhs);
97         _Clipboard& operator =(const _Clipboard& rhs);
98
99 private:
100         Tizen::Ui::Controls::_PublicClipboardPopupEvent* __pPublicEvent;
101         std::unique_ptr<_ClipboardPopupEvent> __pEvent;
102
103         static _Clipboard* __pInstance;
104 }; // _Clipboard
105
106 }} // Tizen::Ui
107
108 #endif  // _FUI_INTERNAL_CLIPBOARD_H_