summaryrefslogtreecommitdiff
path: root/embedserv/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'embedserv/source/inc')
-rwxr-xr-xembedserv/source/inc/common.h56
-rw-r--r--embedserv/source/inc/docholder.hxx290
-rwxr-xr-xembedserv/source/inc/embeddoc.hxx210
-rw-r--r--embedserv/source/inc/embeddocaccess.hxx85
-rw-r--r--embedserv/source/inc/embservconst.h81
-rw-r--r--embedserv/source/inc/iipaobj.hxx74
-rw-r--r--embedserv/source/inc/intercept.hxx195
-rwxr-xr-xembedserv/source/inc/servprov.hxx100
-rwxr-xr-xembedserv/source/inc/stdafx.h42
-rw-r--r--embedserv/source/inc/syswinwrapper.hxx177
-rw-r--r--embedserv/source/inc/xwin.hxx252
11 files changed, 1562 insertions, 0 deletions
diff --git a/embedserv/source/inc/common.h b/embedserv/source/inc/common.h
new file mode 100755
index 000000000000..ddbf8e832591
--- /dev/null
+++ b/embedserv/source/inc/common.h
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+#include "stdafx.h"
+#include <initguid.h>
+
+#include <rtl/ustring.hxx>
+#include <osl/interlck.h>
+#include <comphelper/classids.hxx>
+
+#include "embservconst.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace frame {
+ class XModel;
+ }
+ namespace beans {
+ struct PropertyValue;
+ }
+ namespace io {
+ class XInputStream;
+ class XOutputStream;
+ }
+} } }
+
+#endif
diff --git a/embedserv/source/inc/docholder.hxx b/embedserv/source/inc/docholder.hxx
new file mode 100644
index 000000000000..6f4bb5d619fd
--- /dev/null
+++ b/embedserv/source/inc/docholder.hxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCHOLDER_HXX_
+#define _DOCHOLDER_HXX_
+
+#include "common.h"
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <cppuhelper/implbase4.hxx>
+
+#include <rtl/ref.hxx>
+
+#include "embeddocaccess.hxx"
+
+class EmbedDocument_Impl;
+class Interceptor;
+class CIIAObj;
+
+namespace winwrap {
+ class CHatchWin;
+}
+
+
+class DocumentHolder :
+ public ::cppu::WeakImplHelper4<
+ ::com::sun::star::util::XCloseListener,
+ ::com::sun::star::frame::XTerminateListener,
+ ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::ui::XDockingAreaAcceptor>
+{
+private:
+ ::osl::Mutex m_aMutex;
+
+ BOOL m_bAllowInPlace;
+ LPOLEINPLACESITE m_pIOleIPSite;
+ LPOLEINPLACEFRAME m_pIOleIPFrame;
+ LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow;
+ winwrap::CHatchWin* m_pCHatchWin;
+
+ ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xInterceptorLocker;
+ Interceptor* m_pInterceptor;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
+ RECT m_aBorder;
+
+ // contains top level system window data
+ bool m_bOnDeactivate;
+ HWND m_hWndxWinParent;
+ HWND m_hWndxWinCont;
+ HMENU m_nMenuHandle;
+ HMENU m_nMenuShared;
+ HOLEMENU m_nOLEMenu;
+ com::sun::star::uno::Reference<
+ com::sun::star::awt::XWindow> m_xEditWindow;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::awt::XWindow> m_xContainerWindow;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xDocument;
+ sal_Int16 m_nMacroExecMode;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XLayoutManager> m_xLayoutManager;
+
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XFrame > m_xFrame;
+
+ ::rtl::OUString m_aContainerName,m_aDocumentNamePart,m_aFilterName;
+
+ CComPtr< IDispatch > m_pIDispatch;
+
+ sal_Bool m_bLink;
+
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XFrame > DocumentFrame();
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >
+ CreateNewInterceptor();
+
+ void ClearInterceptorInternally();
+
+ void LoadDocInFrame( sal_Bool bPluginMode );
+public:
+
+
+ // the instance to which we belong
+ static HINSTANCE m_hInstance;
+
+ HWND GetEditWindowParentHandle() const
+ {
+ return m_hWndxWinParent;
+ }
+
+ void SetContainerWindowHandle(HWND hWndxWinCont)
+ {
+ m_hWndxWinCont = hWndxWinCont;
+ }
+
+ DocumentHolder(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
+
+ ~DocumentHolder();
+
+ // Methods for inplace activation
+
+
+ BOOL isActive() const;
+ void DisableInplaceActivation(BOOL);
+ HRESULT InPlaceActivate(LPOLECLIENTSITE,BOOL);
+ void InPlaceDeactivate(void);
+ HRESULT UIActivate();
+ void UIDeactivate();
+ BOOL InPlaceMenuCreate(void);
+ BOOL InPlaceMenuDestroy(void);
+
+ void OpenIntoWindow(void);
+ BOOL Undo(void);
+
+ // further methods
+
+ void SetDocument(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xDoc,
+ sal_Bool bLink = sal_False
+ );
+
+ sal_Bool ExecuteSuspendCloseFrame();
+
+ void DisconnectFrameDocument( sal_Bool bComplete = sal_False );
+ void CloseDocument();
+ void CloseFrame();
+ void ClearInterceptor();
+ void FreeOffice();
+
+ void resizeWin( const SIZEL& rNewSize );
+
+ void setTitle(const rtl::OUString& aDocumentName);
+ rtl::OUString getTitle() const { return m_aDocumentNamePart; }
+
+ void setContainerName(const rtl::OUString& aContainerName);
+ rtl::OUString getContainerName() const { return m_aContainerName; }
+ void OnPosRectChanged(LPRECT lpRect) const;
+ void show();
+
+ sal_Bool HasFrame() { return m_xFrame.is(); }
+ sal_Bool IsLink() { return m_bLink; }
+
+ /** hides the document window, even in case of an external container
+ * side managed window.
+ */
+
+ void hide();
+
+ IDispatch* GetIDispatch();
+
+ HRESULT GetDocumentBorder( RECT *pRect );
+ // HRESULT SetVisArea( const RECTL *pRect );
+ // HRESULT GetVisArea( RECTL *pRect );
+ HRESULT SetExtent( const SIZEL *pSize );
+ HRESULT GetExtent( SIZEL *pSize );
+ // sets extension on the hatchwindow
+ HRESULT SetContRects(LPCRECT pRect);
+ HRESULT SetObjectRects(LPCRECT aRect, LPCRECT aClip);
+
+ HWND GetTopMostWinHandle() const
+ {
+ return m_hWndxWinParent;
+ }
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >
+ GetDocument() const
+ {
+ return m_xDocument;
+ }
+
+ // XEventListener
+ virtual void SAL_CALL
+ disposing( const com::sun::star::lang::EventObject& aSource )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XCloseListener
+ virtual void SAL_CALL
+ queryClosing(
+ const com::sun::star::lang::EventObject& aSource,
+ sal_Bool bGetsOwnership
+ )
+ throw(
+ ::com::sun::star::util::CloseVetoException
+ );
+
+ virtual void SAL_CALL
+ notifyClosing(
+ const com::sun::star::lang::EventObject& aSource
+ )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTerminateListener
+ virtual void SAL_CALL
+ queryTermination(
+ const com::sun::star::lang::EventObject& aSource
+ )
+ throw(
+ ::com::sun::star::frame::TerminationVetoException
+ );
+
+ virtual void SAL_CALL
+ notifyTermination(
+ const com::sun::star::lang::EventObject& aSource
+ )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+
+ // XModifyListener
+ virtual void SAL_CALL
+ modified(
+ const ::com::sun::star::lang::EventObject& aEvent
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ // XDockingAreaAcceptor
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindow> SAL_CALL
+ getContainerWindow(
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual sal_Bool SAL_CALL
+ requestDockingAreaSpace(
+ const ::com::sun::star::awt::Rectangle& RequestedSpace
+ )
+ throw(
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ setDockingAreaSpace(
+ const ::com::sun::star::awt::Rectangle& BorderSpace
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+};
+
+#endif
+
diff --git a/embedserv/source/inc/embeddoc.hxx b/embedserv/source/inc/embeddoc.hxx
new file mode 100755
index 000000000000..ec3efe19d8c0
--- /dev/null
+++ b/embedserv/source/inc/embeddoc.hxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _EMBEDDOC_HXX_
+#define _EMBEDDOC_HXX_
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
+#undef _DEBUG
+#endif
+#if defined(_MSC_VER) && (_MSC_VER > 1310)
+#pragma warning(disable : 4917 4555)
+#endif
+
+#include "common.h"
+#include <oleidl.h>
+#include <objidl.h>
+
+#include <hash_map>
+#include <com/sun/star/uno/Reference.h>
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/SEQUENCE.h>
+#endif
+
+#include "embeddocaccess.hxx"
+#include "docholder.hxx"
+
+typedef ::std::hash_map< DWORD, IAdviseSink* > AdviseSinkHashMap;
+typedef ::std::hash_map< DWORD, IAdviseSink* >::iterator AdviseSinkHashMapIterator;
+
+class GDIMetaFile;
+class CIIAObj;
+
+class EmbedDocument_Impl
+ : public IPersistStorage,
+ public IDataObject,
+ public IOleObject,
+ public IOleInPlaceObject,
+ public IPersistFile,
+ public IDispatch,
+ public IExternalConnection
+{
+protected:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ fillArgsForLoading_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStream,
+ DWORD nStreamMode,
+ LPCOLESTR pFilePath = NULL );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ fillArgsForStoring_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream );
+
+ HRESULT SaveTo_Impl( IStorage* pStg );
+
+ sal_uInt64 getMetaFileHandle_Impl( sal_Bool isEnhMeta );
+
+public:
+ EmbedDocument_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& smgr,
+ const GUID* guid );
+ virtual ~EmbedDocument_Impl();
+
+ /* IUnknown methods */
+ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ /* IPersistMethod */
+ STDMETHOD(GetClassID)(CLSID *pClassID);
+
+ /* IPersistStorage methods */
+ STDMETHOD(IsDirty) ();
+ STDMETHOD(InitNew) ( IStorage *pStg );
+ STDMETHOD(Load) ( IStorage* pStr );
+ STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad );
+ STDMETHOD(SaveCompleted) ( IStorage *pStgNew );
+ STDMETHOD(HandsOffStorage) (void);
+
+ /* IDataObject methods */
+ STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium );
+ STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium );
+ STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc );
+ STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut );
+ STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease );
+ STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc );
+ STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection );
+ STDMETHOD(DUnadvise) ( DWORD dwConnection );
+ STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise );
+
+ /* IOleObject methods */
+ STDMETHOD(SetClientSite) ( IOleClientSite* pSite );
+ STDMETHOD(GetClientSite) ( IOleClientSite** pSite );
+ STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj );
+ STDMETHOD(Close) ( DWORD dwSaveOption);
+ STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk );
+ STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk );
+ STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved );
+ STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject );
+ STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect );
+ STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb );
+ STDMETHOD(Update) ();
+ STDMETHOD(IsUpToDate) ();
+ STDMETHOD(GetUserClassID) ( CLSID *pClsid );
+ STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType );
+ STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel );
+ STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel );
+ STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection );
+ STDMETHOD(Unadvise) ( DWORD dwConnection );
+ STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise );
+ STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus );
+ STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal );
+
+ /* IOleInPlaceObject methods */
+ STDMETHOD(GetWindow)(HWND *);
+ STDMETHOD(ContextSensitiveHelp)(BOOL);
+ STDMETHOD(InPlaceDeactivate)();
+ STDMETHOD(UIDeactivate)();
+ STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT);
+ STDMETHOD(ReactivateAndUndo)();
+
+ /* IPersistFile methods */
+ STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode );
+ STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember );
+ STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName );
+ STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName );
+
+ /* IDispatch methods */
+ STDMETHOD(GetTypeInfoCount) ( unsigned int FAR* pctinfo );
+ STDMETHOD(GetTypeInfo) ( unsigned int iTInfo, LCID lcid, ITypeInfo FAR* FAR* ppTInfo );
+ STDMETHOD(GetIDsOfNames) ( REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgDispId );
+ STDMETHOD(Invoke) ( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr );
+
+ /* IExternalConnection methods */
+ virtual DWORD STDMETHODCALLTYPE AddConnection( DWORD extconn, DWORD reserved);
+ virtual DWORD STDMETHODCALLTYPE ReleaseConnection( DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses);
+
+ // c++ - methods
+
+ void notify( bool bDataChanged = true );
+ HRESULT SaveObject();
+ HRESULT ShowObject();
+ GUID GetGUID() const { return m_guid; }
+ HRESULT OLENotifyClosing();
+
+ void Deactivate();
+ HRESULT OLENotifyDeactivation();
+
+protected:
+ oslInterlockedCount m_refCount;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
+ DocumentHolder* m_pDocHolder;
+ ::rtl::OUString m_aFileName;
+
+ CComPtr< IStorage > m_pMasterStorage;
+ CComPtr< IStream > m_pOwnStream;
+ CComPtr< IStream > m_pExtStream;
+ GUID m_guid;
+
+ sal_Bool m_bIsDirty;
+
+ CComPtr< IOleClientSite > m_pClientSite;
+ CComPtr< IDataAdviseHolder > m_pDAdviseHolder;
+
+ AdviseSinkHashMap m_aAdviseHashMap;
+ DWORD m_nAdviseNum;
+
+ ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOwnAccess;
+
+ sal_Bool m_bIsInVerbHandling;
+};
+
+class BooleanGuard_Impl
+{
+ sal_Bool& m_bValue;
+
+public:
+ BooleanGuard_Impl( sal_Bool& bValue )
+ : m_bValue( bValue )
+ {
+ m_bValue = sal_True;
+ }
+
+ ~BooleanGuard_Impl()
+ {
+ m_bValue = sal_False;
+ }
+};
+
+#endif //_EMBEDDOC_HXX_
diff --git a/embedserv/source/inc/embeddocaccess.hxx b/embedserv/source/inc/embeddocaccess.hxx
new file mode 100644
index 000000000000..8cc9388f6d18
--- /dev/null
+++ b/embedserv/source/inc/embeddocaccess.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _EMBEDDOCACCESS_HXX_
+#define _EMBEDDOCACCESS_HXX_
+
+#include <cppuhelper/weak.hxx>
+
+#define OLESERV_SAVEOBJECT 1
+#define OLESERV_CLOSE 2
+#define OLESERV_NOTIFY 3
+#define OLESERV_NOTIFYCLOSING 4
+#define OLESERV_SHOWOBJECT 5
+#define OLESERV_DEACTIVATE 6
+
+#include <oleidl.h>
+#ifndef __MINGW32__
+#if defined(_MSC_VER) && (_MSC_VER > 1310)
+#pragma warning(disable : 4265)
+#include <atldbcli.h>
+#else
+#include <atlcomcli.h>
+#endif
+#endif
+#include <cppuhelper/weak.hxx>
+
+class EmbedDocument_Impl;
+struct LockedEmbedDocument_Impl
+{
+private:
+ EmbedDocument_Impl* m_pEmbedDocument;
+
+public:
+ LockedEmbedDocument_Impl();
+ LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument );
+ LockedEmbedDocument_Impl( const LockedEmbedDocument_Impl& aDocLock );
+
+ ~LockedEmbedDocument_Impl();
+
+ LockedEmbedDocument_Impl& operator=( const LockedEmbedDocument_Impl& aDocLock );
+
+ EmbedDocument_Impl* GetEmbedDocument() { return m_pEmbedDocument; }
+
+ void ExecuteMethod( sal_Int16 nId );
+};
+
+class EmbeddedDocumentInstanceAccess_Impl : public ::cppu::OWeakObject
+{
+ ::osl::Mutex m_aMutex;
+ EmbedDocument_Impl* m_pEmbedDocument;
+
+ public:
+ EmbeddedDocumentInstanceAccess_Impl( EmbedDocument_Impl* pDoc )
+ : m_pEmbedDocument( pDoc )
+ {}
+
+ LockedEmbedDocument_Impl GetEmbedDocument();
+ void ClearEmbedDocument();
+};
+
+#endif
diff --git a/embedserv/source/inc/embservconst.h b/embedserv/source/inc/embservconst.h
new file mode 100644
index 000000000000..df4764c5010f
--- /dev/null
+++ b/embedserv/source/inc/embservconst.h
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _EMBSERVCONST_H_
+#define _EMBSERVCONST_H_
+
+#include <initguid.h>
+
+#ifndef _COMPHELPER_CLASSIDS_HXX
+#include <comphelper/classids.hxx>
+#endif
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+const sal_Int32 nConstBufferSize = 32000;
+
+#define SUPPORTED_FACTORIES_NUM 10
+
+#ifdef __MINGW32__
+#define DECLSPEC_SELECTANY
+#endif
+#if defined(__MINGW32__) && !defined(INITGUID)
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer;
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer;
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer;
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer;
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer;
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer;
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer;
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer;
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer;
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer;
+#else
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer = { SO3_SW_OLE_EMBED_CLASSID_60 };
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer = { SO3_SW_OLE_EMBED_CLASSID_8 };
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer = { SO3_SC_OLE_EMBED_CLASSID_60 };
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer = { SO3_SC_OLE_EMBED_CLASSID_8 };
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer = { SO3_SDRAW_OLE_EMBED_CLASSID_60 };
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer = { SO3_SDRAW_OLE_EMBED_CLASSID_8 };
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_60 };
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_8 };
+
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer = { SO3_SM_OLE_EMBED_CLASSID_60 };
+EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer = { SO3_SM_OLE_EMBED_CLASSID_8 };
+#endif
+
+#endif
+
diff --git a/embedserv/source/inc/iipaobj.hxx b/embedserv/source/inc/iipaobj.hxx
new file mode 100644
index 000000000000..9d423dc880c8
--- /dev/null
+++ b/embedserv/source/inc/iipaobj.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _IIPAOBJ_HXX_
+#define _IIPAOBJ_HXX_
+#if defined(_MSC_VER) && (_MSC_VER > 1310)
+#pragma warning(disable : 4917 4555)
+#endif
+
+#include "stdafx.h"
+#include <oleidl.h>
+
+#include <osl/interlck.h>
+#include <rtl/ref.hxx>
+class EmbedDocument_Impl;
+class DocumentHolder;
+
+class CIIAObj
+ : public IOleInPlaceActiveObject
+{
+
+public:
+
+ CIIAObj( DocumentHolder * );
+ virtual ~CIIAObj();
+
+ /* IUnknown methods */
+ STDMETHODIMP QueryInterface(REFIID, LPVOID FAR * ppvObj);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+ /* IOleInPlaceActiveObject methods */
+ STDMETHODIMP GetWindow(HWND *);
+ STDMETHODIMP ContextSensitiveHelp(BOOL);
+ STDMETHODIMP TranslateAccelerator(LPMSG);
+ STDMETHODIMP OnFrameWindowActivate(BOOL);
+ STDMETHODIMP OnDocWindowActivate(BOOL);
+ STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW
+ , BOOL);
+ STDMETHODIMP EnableModeless(BOOL);
+
+
+private:
+
+ oslInterlockedCount m_refCount;
+ ::rtl::Reference< DocumentHolder > m_rDocHolder;
+};
+
+
+#endif \ No newline at end of file
diff --git a/embedserv/source/inc/intercept.hxx b/embedserv/source/inc/intercept.hxx
new file mode 100644
index 000000000000..e02662e1797c
--- /dev/null
+++ b/embedserv/source/inc/intercept.hxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _INTERCEPT_HXX_
+#define _INTERCEPT_HXX_
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XInterceptorInfo.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+
+#include <rtl/ref.hxx>
+#include "embeddocaccess.hxx"
+
+
+class StatusChangeListenerContainer;
+class EmbedDocument_Impl;
+class DocumentHolder;
+
+class Interceptor
+ : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::frame::XDispatchProviderInterceptor,
+ ::com::sun::star::frame::XInterceptorInfo,
+ ::com::sun::star::frame::XDispatch>
+{
+public:
+
+ Interceptor(
+ const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess,
+ DocumentHolder* pDocH,
+ sal_Bool bLink );
+
+ ~Interceptor();
+
+ void DisconnectDocHolder();
+
+ void generateFeatureStateEvent();
+
+ // overwritten to release the statuslistner.
+
+
+ // XComponent
+ virtual void SAL_CALL
+ addEventListener(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ void SAL_CALL
+ dispose() throw(::com::sun::star::uno::RuntimeException);
+
+
+
+ //XDispatch
+ virtual void SAL_CALL
+ dispatch(
+ const ::com::sun::star::util::URL& URL,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addStatusListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XStatusListener >& Control,
+ const ::com::sun::star::util::URL& URL )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeStatusListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XStatusListener >& Control,
+ const ::com::sun::star::util::URL& URL )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ //XInterceptorInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ SAL_CALL getInterceptedURLs( )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+
+ //XDispatchProvider ( inherited by XDispatchProviderInterceptor )
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > SAL_CALL
+ queryDispatch(
+ const ::com::sun::star::util::URL& URL,
+ const ::rtl::OUString& TargetFrameName,
+ sal_Int32 SearchFlags )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > > SAL_CALL
+ queryDispatches(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::frame::DispatchDescriptor >& Requests )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+
+ //XDispatchProviderInterceptor
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider > SAL_CALL
+ getSlaveDispatchProvider( )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ setSlaveDispatchProvider(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider > SAL_CALL
+ getMasterDispatchProvider( )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ setMasterDispatchProvider(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider >& NewSupplier )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+
+private:
+
+ osl::Mutex m_aMutex;
+
+ ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > m_xDocHLocker;
+ DocumentHolder* m_pDocH;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider;
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ m_aInterceptedURL;
+
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ StatusChangeListenerContainer* m_pStatCL;
+
+ sal_Bool m_bLink;
+};
+
+#endif
diff --git a/embedserv/source/inc/servprov.hxx b/embedserv/source/inc/servprov.hxx
new file mode 100755
index 000000000000..60906fa25c32
--- /dev/null
+++ b/embedserv/source/inc/servprov.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SERVPROV_HXX
+#define _SERVPROV_HXX
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
+#undef _DEBUG
+#endif
+
+#include "common.h"
+#include <oleidl.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/XInterface.hpp>
+#ifndef __COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#include <cppuhelper/weak.hxx>
+
+
+class EmbedProviderFactory_Impl;
+
+class EmbedServer_Impl : public ::cppu::OWeakObject, ::com::sun::star::lang::XTypeProvider
+{
+public:
+ EmbedServer_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xFactory );
+ virtual ~EmbedServer_Impl();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ CComPtr< EmbedProviderFactory_Impl > m_pOLEFactories[ SUPPORTED_FACTORIES_NUM ];
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+};
+
+class EmbedProviderFactory_Impl : public IClassFactory
+{
+public:
+
+ EmbedProviderFactory_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid);
+ virtual ~EmbedProviderFactory_Impl();
+
+ sal_Bool registerClass();
+ sal_Bool deregisterClass();
+
+ /* IUnknown methods */
+ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ /* IClassFactory methods */
+ STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
+ STDMETHOD(LockServer)(int fLock);
+
+protected:
+
+ oslInterlockedCount m_refCount;
+ GUID m_guid;
+ DWORD m_factoryHandle;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+};
+
+#endif
diff --git a/embedserv/source/inc/stdafx.h b/embedserv/source/inc/stdafx.h
new file mode 100755
index 000000000000..d20cb068be8f
--- /dev/null
+++ b/embedserv/source/inc/stdafx.h
@@ -0,0 +1,42 @@
+#if !defined(AFX_STDAFX_H_)
+#define AFX_STDAFX_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+#define _ATL_APARTMENT_THREADED
+// #define _ATL_STATIC_REGISTRY
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(push, 1)
+#pragma warning(disable: 4548)
+#pragma warning(disable: 4505)
+#endif
+#include <atlbase.h>
+//You may derive a class from CComModule and use it if you want to override
+//something, but do not change the name of _Module
+extern CComModule _Module;
+#ifdef __MINGW32__
+#include <algorithm>
+using ::std::min;
+using ::std::max;
+#endif
+#include <atlcom.h>
+#include <atlctl.h>
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#pragma warning(pop)
+#endif
+
+#endif
+
diff --git a/embedserv/source/inc/syswinwrapper.hxx b/embedserv/source/inc/syswinwrapper.hxx
new file mode 100644
index 000000000000..43fdde6f3cf0
--- /dev/null
+++ b/embedserv/source/inc/syswinwrapper.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include <windows.h>
+
+/**
+ ** CWindow: Our basic window class.
+ **/
+
+
+class DocumentHolder;
+
+
+namespace winwrap {
+
+
+ void TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo);
+
+
+ LRESULT APIENTRY HatchWndProc(
+ HWND hWnd, UINT iMsg
+ , WPARAM wParam, LPARAM lParam);
+
+
+ BOOL HatchWindowRegister(HINSTANCE hInst);
+
+ class CWindow
+ {
+ protected:
+ HINSTANCE m_hInst; //Task instance
+ HWND m_hWnd; //Window handle of the window
+
+ public:
+ //Standard Class Functions
+ CWindow(HINSTANCE);
+ ~CWindow(void);
+
+ //Just returns members. No need to modify
+ HWND Window(void);
+ HINSTANCE Instance(void);
+ };
+
+
+
+ class Tracker {
+ public:
+ // Constructors
+ Tracker();
+ Tracker(LPCRECT lpSrcRect, UINT nStyle);
+
+ // Style Flags
+ enum StyleFlags
+ {
+ solidLine = 1, dottedLine = 2, hatchedBorder = 4,
+ resizeInside = 8, resizeOutside = 16, hatchInside = 32,
+ };
+
+ // Hit-Test codes
+ enum TrackerHit
+ {
+ hitNothing = -1,
+ hitTopLeft = 0, hitTopRight = 1,
+ hitBottomRight = 2, hitBottomLeft = 3,
+ hitTop = 4, hitRight = 5, hitBottom = 6,
+ hitLeft = 7, hitMiddle = 8
+ };
+
+ // Attributes
+ UINT m_nStyle; // current state
+ RECT m_rect; // current position (always in pixels)
+ SIZE m_sizeMin; // minimum X and Y size during track operation
+ int m_nHandleSize; // size of resize handles (default from WIN.INI)
+
+ // Operations
+ void Draw(HDC hDC) const;
+ void GetTrueRect(LPRECT lpTrueRect) const;
+ BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
+ BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
+ HWND hWndClipTo = NULL);
+// BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
+ int HitTest(POINT point) const;
+ int NormalizeHit(int nHandle) const;
+
+ // Overridables
+ virtual void DrawTrackerRect(
+ LPRECT lpRect, HWND hWndClipTo,
+ HDC hDC, HWND hWnd);
+ virtual void AdjustRect(int nHandle, LPRECT lpRect);
+ virtual void OnChangedRect(const RECT& rectOld);
+ virtual UINT GetHandleMask() const;
+
+// Implementation
+ public:
+ virtual ~Tracker();
+
+protected:
+ BOOL m_bAllowInvert; // flag passed to Track or TrackRubberBand
+ RECT m_rectLast;
+ SIZE m_sizeLast;
+ BOOL m_bErase; // TRUE if DrawTrackerRect is called for erasing
+ BOOL m_bFinalErase; // TRUE if DragTrackerRect called for final erase
+
+ // implementation helpers
+ int HitTestHandles(POINT point) const;
+ void GetHandleRect(int nHandle,RECT* pHandleRect) const;
+ void GetModifyPointers(
+ int nHandle,int**ppx, int**ppy, int* px, int*py);
+ virtual int GetHandleSize(LPRECT lpRect = NULL) const;
+ BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo);
+ void Construct();
+ };
+
+
+
+//Width of the border
+#define HATCHWIN_BORDERWIDTHDEFAULT 4
+
+
+ class CHatchWin : public CWindow
+ {
+ friend LRESULT APIENTRY HatchWndProc(HWND, UINT, WPARAM, LPARAM);
+
+ public:
+
+ const DocumentHolder* m_pDocHolder;
+ Tracker m_aTracker;
+
+ int m_dBorder;
+ int m_dBorderOrg;
+ UINT m_uID;
+ HWND m_hWndParent;
+ HWND m_hWndKid;
+ HWND m_hWndAssociate;
+ RECT m_rcPos;
+ RECT m_rcClip;
+
+ public:
+ CHatchWin(HINSTANCE,const DocumentHolder*);
+ ~CHatchWin(void);
+
+ BOOL Init(HWND, UINT, HWND);
+
+ HWND HwndAssociateSet(HWND);
+ HWND HwndAssociateGet(void);
+
+ void RectsSet(LPRECT, LPRECT);
+ void ChildSet(HWND);
+ void ShowHatch(BOOL);
+ void SetTrans();
+ };
+
+}
diff --git a/embedserv/source/inc/xwin.hxx b/embedserv/source/inc/xwin.hxx
new file mode 100644
index 000000000000..de043dea28d2
--- /dev/null
+++ b/embedserv/source/inc/xwin.hxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XWIN_HXX_
+#define _XWIN_HXX_
+
+
+#include "common.h"
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+
+
+class ContainerWindowWrapper:
+ public ::cppu::WeakImplHelper2<
+ ::com::sun::star::awt::XWindow,
+ ::com::sun::star::awt::XSystemDependentWindowPeer>
+{
+public:
+
+ ContainerWindowWrapper(HWND aHwnd);
+
+ ~ ContainerWindowWrapper();
+
+
+ // XComponent
+
+ virtual void SAL_CALL
+ dispose(
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+
+ // XSystemDependentWindowPeer
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getWindowHandle(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId,
+ sal_Int16 SystemType
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ // XWindow
+
+ virtual void SAL_CALL
+ setPosSize(
+ sal_Int32 X,
+ sal_Int32 Y,
+ sal_Int32 Width,
+ sal_Int32 Height,
+ sal_Int16 Flags
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL
+ getPosSize(
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ setVisible(
+ sal_Bool Visible
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ setEnable(
+ sal_Bool Enable
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ setFocus(
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addWindowListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindowListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeWindowListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindowListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addFocusListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeFocusListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addKeyListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XKeyListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeKeyListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XKeyListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addMouseListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeMouseListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addMouseMotionListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseMotionListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removeMouseMotionListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseMotionListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ addPaintListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XPaintListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ removePaintListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XPaintListener >& xListener
+ )
+ throw (
+ ::com::sun::star::uno::RuntimeException
+ );
+
+
+private:
+
+ osl::Mutex m_aMutex;
+ cppu::OInterfaceContainerHelper *m_pDisposeEventListeners;
+
+ HWND m_aHwnd;
+};
+
+
+#endif