1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _WINDOW_HXX_ 28 #define _WINDOW_HXX_ 29 #include <atlbase.h> 30 extern CComModule _Module; 31 #include<atlcom.h> 32 #include<atlctl.h> 33 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> 34 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp> 35 #include <com/sun/star/datatransfer/XTransferable.hpp> 36 #include <com/sun/star/uno/Reference.h> 37 #include "../../source/inc/DtObjFactory.hxx" 38 39 40 using namespace com::sun::star::uno; 41 using namespace com::sun::star::datatransfer::dnd; 42 using namespace com::sun::star::datatransfer; 43 44 struct ThreadData 45 { 46 Reference<XDragSource> source; 47 Reference<XTransferable> transferable; 48 HANDLE evtThreadReady; 49 }; 50 51 class AWindow: public CWindowImpl<AWindow, CWindow, 52 CWinTraits<WS_CAPTION |WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0> > 53 { 54 TCHAR m_strName[80]; 55 Reference<XDropTarget> m_xDropTarget; 56 Reference<XDragSource> m_xDragSource; 57 BOOL m_isMTA; 58 59 HWND m_hwndEdit; 60 61 CDTransObjFactory m_aDataConverter; 62 63 public: 64 AWindow(LPCTSTR strName) 65 { 66 RECT rcPos= {0,0,200,200}; 67 Create(0, rcPos, strName); 68 } 69 AWindow(LPCTSTR strName, RECT pos, BOOL mta=FALSE): m_isMTA( mta) 70 { 71 Create(0, pos, strName); 72 } 73 74 ~AWindow() 75 { 76 if(m_hWnd) 77 DestroyWindow(); 78 } 79 80 81 BEGIN_MSG_MAP(AWindow) 82 MESSAGE_HANDLER( WM_CLOSE, OnClose) 83 MESSAGE_HANDLER( WM_CREATE, OnCreate) 84 MESSAGE_RANGE_HANDLER( WM_MOUSEFIRST, WM_MOUSELAST, OnMouseAction) 85 MESSAGE_HANDLER( WM_TIMER, OnTimer) 86 MESSAGE_HANDLER( WM_SIZE, OnSize) 87 MESSAGE_HANDLER( WM_SETFOCUS, OnFocus) 88 89 END_MSG_MAP() 90 91 LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 92 LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 93 LRESULT OnMouseAction(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 94 LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 95 LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 96 LRESULT OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 97 98 }; 99 100 #endif 101