Changeset 51556 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 5, 2014 2:38:31 PM (11 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r51551 r51556 10393 10393 10394 10394 <interface 10395 name="IDnDSource" extends="$unknown" 10396 uuid="6bdc3f97-f6df-4357-b252-5fa16e0c1e24" 10395 name="IDnDBase" extends="$unknown" 10396 uuid="b15cf9ca-4078-4786-a1be-af773a36e19f" 10397 wsmap="managed" 10398 > 10399 <desc>Base abstract interface for drag'n drop.</desc> 10400 10401 <method name="isFormatSupported" > 10402 <desc> 10403 Checks if a specific drag'n drop MIME / Content-type format is supported. 10404 </desc> 10405 <param name="format" type="wstring" dir="in"> 10406 <desc>Format to check for.</desc> 10407 </param> 10408 <param name="supported" type="boolean" dir="return"> 10409 <desc>Returns @c true if the specified format is supported, @c false if not.</desc> 10410 </param> 10411 </method> 10412 10413 <method name="addFormats" > 10414 <desc> 10415 Adds MIME / Content-type formats to the supported formats. 10416 </desc> 10417 <param name="formats" type="wstring" safearray="yes" dir="in"> 10418 <desc>Collection of formats to add.</desc> 10419 </param> 10420 </method> 10421 10422 <method name="removeFormats" > 10423 <desc> 10424 Removes MIME / Content-type formats from the supported formats. 10425 </desc> 10426 <param name="formats" type="wstring" safearray="yes" dir="in"> 10427 <desc>Collection of formats to remove.</desc> 10428 </param> 10429 </method> 10430 10431 <attribute name="formats" type="wstring" safearray="yes" readonly="yes"> 10432 <desc>Returns all supported drag'n drop formats.</desc> 10433 </attribute> 10434 10435 </interface> 10436 10437 <interface 10438 name="IDnDSource" extends="IDnDBase" 10439 uuid="b69c400d-be63-4255-898a-e706d66b1637" 10397 10440 wsmap="managed" 10398 10441 > … … 10473 10516 10474 10517 <interface 10475 name="IDnDTarget" extends=" $unknown"10476 uuid=" 50862c12-7618-4542-a7c7-6a21de2644f7"10518 name="IDnDTarget" extends="IDnDBase" 10519 uuid="2366c45c-4633-41a1-9fa6-0ef9f244434c" 10477 10520 wsmap="managed" 10478 10521 > -
trunk/src/VBox/Main/include/GuestDirectoryImpl.h
r51321 r51556 64 64 * @{ */ 65 65 /** @} */ 66 67 66 HRESULT close(); 67 HRESULT read(ComPtr<IFsObjInfo> &aObjInfo); 68 68 69 69 struct Data -
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r51476 r51556 139 139 int hostCall(uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const; 140 140 GuestDnDResponse *response(void) { return m_pResponse; } 141 std::vector<com::Utf8Str> supportedFormats(void) const { return m_strSupportedFormats; }141 std::vector<com::Utf8Str> defaultFormats(void) const { return m_strDefaultFormats; } 142 142 /** @} */ 143 143 … … 163 163 /** @name Singleton properties. 164 164 * @{ */ 165 /** List of supported MIME types (formats). */166 std::vector<com::Utf8Str> m_str SupportedFormats;165 /** List of supported default MIME/Content-type formats. */ 166 std::vector<com::Utf8Str> m_strDefaultFormats; 167 167 /** Pointer to guest implementation. */ 168 168 const ComObjPtr<Guest> m_pGuest; … … 192 192 #define GuestDnDInst() GuestDnD::getInstance() 193 193 194 /** 195 * IDnDBase class implementation for sharing code between 196 * IGuestDnDSource and IGuestDnDTarget implementation. 197 */ 198 class GuestDnDBase 199 { 200 protected: 201 202 GuestDnDBase(void); 203 204 protected: 205 206 /** Shared IDnDBase method implementations. 207 * @{ */ 208 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported); 209 HRESULT getFormats(std::vector<com::Utf8Str> &aFormats); 210 HRESULT addFormats(const std::vector<com::Utf8Str> &aFormats); 211 HRESULT removeFormats(const std::vector<com::Utf8Str> &aFormats); 212 /** @} */ 213 214 protected: 215 216 /** @name Attributes. 217 * @{ */ 218 /** Pointer to guest implementation. */ 219 const ComObjPtr<Guest> m_pGuest; 220 /** List of supported MIME/Content-type formats. */ 221 std::vector<com::Utf8Str> m_strFormats; 222 /** @} */ 223 }; 224 194 225 #endif /* ____H_GUESTDNDPRIVATE */ 195 226 -
trunk/src/VBox/Main/include/GuestDnDSourceImpl.h
r51476 r51556 23 23 24 24 class ATL_NO_VTABLE GuestDnDSource : 25 public GuestDnDSourceWrap 25 public GuestDnDSourceWrap, 26 protected GuestDnDBase 26 27 { 27 28 public: … … 39 40 private: 40 41 41 /** Wrapped @name IDnDSource methods. 42 /** Private wrapped @name IDnDBase methods. 43 * @{ */ 44 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported); 45 HRESULT getFormats(std::vector<com::Utf8Str> &aFormats); 46 HRESULT addFormats(const std::vector<com::Utf8Str> &aFormats); 47 HRESULT removeFormats(const std::vector<com::Utf8Str> &aFormats); 48 /** @} */ 49 50 /** Private wrapped @name IDnDSource methods. 42 51 * @{ */ 43 52 HRESULT dragIsPending(ULONG uScreenId, std::vector<com::Utf8Str> &aFormats, std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction); -
trunk/src/VBox/Main/include/GuestDnDTargetImpl.h
r51476 r51556 23 23 24 24 class ATL_NO_VTABLE GuestDnDTarget : 25 public GuestDnDTargetWrap 25 public GuestDnDTargetWrap, 26 protected GuestDnDBase 26 27 { 27 28 public: … … 39 40 private: 40 41 41 /** Wrapped @name IDnDTarget methods. 42 /** Private wrapped @name IDnDBase methods. 43 * @{ */ 44 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported); 45 HRESULT getFormats(std::vector<com::Utf8Str> &aFormats); 46 HRESULT addFormats(const std::vector<com::Utf8Str> &aFormats); 47 HRESULT removeFormats(const std::vector<com::Utf8Str> &aFormats); 48 /** @} */ 49 50 /** Private wrapped @name IDnDTarget methods. 42 51 * @{ */ 43 52 HRESULT enter(ULONG aScreenId, ULONG ax, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const std::vector<com::Utf8Str> &aFormats, DnDAction_T *aResultAction); -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r51529 r51556 449 449 m_pResponse = new GuestDnDResponse(pGuest); 450 450 451 /* List of supported MIME types. 452 * Note: If you add something here, make sure you test it with all supported guest OSes! 453 ** @todo Make this MIME list configurable / extendable (by extra data?). Currently 454 * this is done hardcoded on every guest platform (*NIX/Windows). 455 */ 456 const com::Utf8Str arrEntries[] = { 457 "text/uri-list", 458 /* Text */ 459 "text/plain;charset=utf-8", 460 "UTF8_STRING", 461 "text/plain", 462 "TEXT", 463 "STRING", 464 /* OpenOffice formats */ 465 "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", 466 "application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", 467 }; 468 451 /* List of supported default MIME types. */ 452 const com::Utf8Str arrEntries[] = { VBOX_DND_FORMATS_DEFAULT }; 469 453 for (size_t i = 0; i < RT_ELEMENTS(arrEntries); i++) 470 m_str SupportedFormats.push_back(arrEntries[0]);454 m_strDefaultFormats.push_back(arrEntries[i]); 471 455 } 472 456 … … 841 825 # endif /* VBOX_WITH_DRAG_AND_DROP_GH */ 842 826 827 /////////////////////////////////////////////////////////////////////////////// 828 829 GuestDnDBase::GuestDnDBase(void) 830 { 831 m_strFormats = GuestDnDInst()->defaultFormats(); 832 } 833 834 HRESULT GuestDnDBase::isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported) 835 { 836 *aSupported = std::find(m_strFormats.begin(), 837 m_strFormats.end(), aFormat) != m_strFormats.end() 838 ? TRUE : FALSE; 839 return S_OK; 840 } 841 842 HRESULT GuestDnDBase::getFormats(std::vector<com::Utf8Str> &aFormats) 843 { 844 aFormats = m_strFormats; 845 846 return S_OK; 847 } 848 849 HRESULT GuestDnDBase::addFormats(const std::vector<com::Utf8Str> &aFormats) 850 { 851 for (size_t i = 0; i < aFormats.size(); ++i) 852 { 853 Utf8Str strFormat = aFormats.at(i); 854 if (std::find(m_strFormats.begin(), 855 m_strFormats.end(), strFormat) == m_strFormats.end()) 856 { 857 m_strFormats.push_back(strFormat); 858 } 859 } 860 861 return S_OK; 862 } 863 864 HRESULT GuestDnDBase::removeFormats(const std::vector<com::Utf8Str> &aFormats) 865 { 866 for (size_t i = 0; i < aFormats.size(); ++i) 867 { 868 Utf8Str strFormat = aFormats.at(i); 869 std::vector<com::Utf8Str>::iterator itFormat = std::find(m_strFormats.begin(), 870 m_strFormats.end(), strFormat); 871 if (itFormat != m_strFormats.end()) 872 m_strFormats.erase(itFormat); 873 } 874 875 return S_OK; 876 } 877 843 878 #endif /* VBOX_WITH_DRAG_AND_DROP */ 844 879 -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r51489 r51556 92 92 } 93 93 94 // implementation of wrapped private getters/setters for attributes 94 // implementation of wrapped IDnDBase methods. 95 ///////////////////////////////////////////////////////////////////////////// 96 97 HRESULT GuestDnDSource::isFormatSupported(const com::Utf8Str &aFormat, 98 BOOL *aSupported) 99 { 100 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 101 ReturnComNotImplemented(); 102 #else /* VBOX_WITH_DRAG_AND_DROP */ 103 104 return GuestDnDBase::isFormatSupported(aFormat, aSupported); 105 #endif /* VBOX_WITH_DRAG_AND_DROP */ 106 } 107 108 HRESULT GuestDnDSource::getFormats(std::vector<com::Utf8Str> &aFormats) 109 { 110 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 111 ReturnComNotImplemented(); 112 #else /* VBOX_WITH_DRAG_AND_DROP */ 113 114 return GuestDnDBase::getFormats(aFormats); 115 #endif /* VBOX_WITH_DRAG_AND_DROP */ 116 } 117 118 HRESULT GuestDnDSource::addFormats(const std::vector<com::Utf8Str> &aFormats) 119 { 120 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 121 ReturnComNotImplemented(); 122 #else /* VBOX_WITH_DRAG_AND_DROP */ 123 124 return GuestDnDBase::addFormats(aFormats); 125 #endif /* VBOX_WITH_DRAG_AND_DROP */ 126 } 127 128 HRESULT GuestDnDSource::removeFormats(const std::vector<com::Utf8Str> &aFormats) 129 { 130 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 131 ReturnComNotImplemented(); 132 #else /* VBOX_WITH_DRAG_AND_DROP */ 133 134 return GuestDnDBase::removeFormats(aFormats); 135 #endif /* VBOX_WITH_DRAG_AND_DROP */ 136 } 137 138 // implementation of wrapped IDnDTarget methods. 95 139 ///////////////////////////////////////////////////////////////////////////// 96 140 … … 135 179 defaultAction = GuestDnD::toMainAction(pResp->defAction()); 136 180 137 GuestDnD::toFormatVector(GuestDnDInst()->supportedFormats(), 138 pResp->format(), aFormats); 181 GuestDnD::toFormatVector(m_strFormats, pResp->format(), aFormats); 139 182 GuestDnD::toMainActions(pResp->allActions(), aAllowedActions); 140 183 } -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r51489 r51556 26 26 #include "AutoCaller.h" 27 27 28 #include <algorithm> /* For std::find(). */ 28 29 #include <iprt/cpp/utils.h> /* For unconst(). */ 29 30 … … 90 91 } 91 92 92 // implementation of wrapped private getters/setters for attributes 93 // implementation of wrapped IDnDBase methods. 94 ///////////////////////////////////////////////////////////////////////////// 95 96 HRESULT GuestDnDTarget::isFormatSupported(const com::Utf8Str &aFormat, 97 BOOL *aSupported) 98 { 99 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 100 ReturnComNotImplemented(); 101 #else /* VBOX_WITH_DRAG_AND_DROP */ 102 103 return GuestDnDBase::isFormatSupported(aFormat, aSupported); 104 #endif /* VBOX_WITH_DRAG_AND_DROP */ 105 } 106 107 HRESULT GuestDnDTarget::getFormats(std::vector<com::Utf8Str> &aFormats) 108 { 109 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 110 ReturnComNotImplemented(); 111 #else /* VBOX_WITH_DRAG_AND_DROP */ 112 113 return GuestDnDBase::getFormats(aFormats); 114 #endif /* VBOX_WITH_DRAG_AND_DROP */ 115 } 116 117 HRESULT GuestDnDTarget::addFormats(const std::vector<com::Utf8Str> &aFormats) 118 { 119 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 120 ReturnComNotImplemented(); 121 #else /* VBOX_WITH_DRAG_AND_DROP */ 122 123 return GuestDnDBase::addFormats(aFormats); 124 #endif /* VBOX_WITH_DRAG_AND_DROP */ 125 } 126 127 HRESULT GuestDnDTarget::removeFormats(const std::vector<com::Utf8Str> &aFormats) 128 { 129 #if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH) 130 ReturnComNotImplemented(); 131 #else /* VBOX_WITH_DRAG_AND_DROP */ 132 133 return GuestDnDBase::removeFormats(aFormats); 134 #endif /* VBOX_WITH_DRAG_AND_DROP */ 135 } 136 137 // implementation of wrapped IDnDTarget methods. 93 138 ///////////////////////////////////////////////////////////////////////////// 94 139 … … 127 172 128 173 /* Make a flat data string out of the supported format list. */ 129 Utf8Str strFormats = GuestDnD::toFormatString(GuestDnDInst()->supportedFormats(), 130 aFormats); 174 Utf8Str strFormats = GuestDnD::toFormatString(m_strFormats, aFormats); 131 175 /* If there is no valid supported format, ignore this request. */ 132 176 if (strFormats.isEmpty()) … … 195 239 196 240 /* Make a flat data string out of the supported format list. */ 197 RTCString strFormats = GuestDnD::toFormatString(GuestDnDInst()->supportedFormats(), 198 aFormats); 241 RTCString strFormats = GuestDnD::toFormatString(m_strFormats, aFormats); 199 242 /* If there is no valid supported format, ignore this request. */ 200 243 if (strFormats.isEmpty()) … … 288 331 289 332 /* Make a flat data string out of the supported format list. */ 290 Utf8Str strFormats = GuestDnD::toFormatString(GuestDnDInst()->supportedFormats(), 291 aFormats); 333 Utf8Str strFormats = GuestDnD::toFormatString(m_strFormats, aFormats); 292 334 /* If there is no valid supported format, ignore this request. */ 293 335 if (strFormats.isEmpty())
Note:
See TracChangeset
for help on using the changeset viewer.