summaryrefslogtreecommitdiff
path: root/embedserv/source
diff options
context:
space:
mode:
authorAndreas Bille <abi@openoffice.org>2003-03-26 10:13:34 +0000
committerAndreas Bille <abi@openoffice.org>2003-03-26 10:13:34 +0000
commit8d45b4a32eaee1c0649809fac2be6520d74a1806 (patch)
treeb2df3a9b3c3bfb25e6859738620271ebf66e7b33 /embedserv/source
parent74d5462d024bbb66e74e9c9dc912110b918516b4 (diff)
#i2822# part of impl of IOleObject
Diffstat (limited to 'embedserv/source')
-rwxr-xr-xembedserv/source/embed/ed_ioleobject.cxx62
-rwxr-xr-xembedserv/source/embed/ed_ipersiststr.cxx20
-rw-r--r--embedserv/source/inc/docholder.hxx44
-rwxr-xr-xembedserv/source/inc/embeddoc.hxx9
4 files changed, 100 insertions, 35 deletions
diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx
index eb811339082d..eb05cd1a7064 100755
--- a/embedserv/source/embed/ed_ioleobject.cxx
+++ b/embedserv/source/embed/ed_ioleobject.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ed_ioleobject.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mav $ $Date: 2003-03-11 13:02:14 $
+ * last change: $Author: abi $ $Date: 2003-03-26 11:13:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,20 @@
#include "embeddoc.hxx"
+#ifndef _COM_SUN_STAR_FRAME_XController_HPP_
+#include <com/sun/star/frame/XController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+
+using namespace ::com::sun::star;
+
+
+extern ::rtl::OUString getFilterNameFromGUID_Impl( GUID* );
+
+
STDMETHODIMP EmbedDocument_Impl::SetClientSite( IOleClientSite* pSite )
{
m_pClientSite = pSite;
@@ -120,29 +134,47 @@ STDMETHODIMP EmbedDocument_Impl::GetClipboardData( DWORD dwReserved, IDataObject
return E_NOTIMPL;
}
+
+void EmbedDocument_Impl::notify()
+{
+ for ( AdviseSinkHashMapIterator iAdvise =
+ m_aAdviseHashMap.begin();
+ iAdvise != m_aAdviseHashMap.end();
+ iAdvise++ )
+ if ( iAdvise->second )
+ iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 );
+
+ if ( m_pDAdviseHolder )
+ m_pDAdviseHolder->SendOnDataChange( (IDataObject*)this, 0, 0 );
+}
+
+
STDMETHODIMP EmbedDocument_Impl::DoVerb( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect )
{
- if ( iVerb == OLEIVERB_PRIMARY || iVerb == OLEIVERB_OPEN || iVerb == OLEIVERB_SHOW )
+ if ( iVerb == OLEIVERB_PRIMARY || iVerb == OLEIVERB_SHOW || iVerb == OLEIVERB_OPEN )
{
+ if( m_pDocHolder )
+ m_pDocHolder->show();
+
if ( m_pClientSite )
- {
m_pClientSite->OnShowWindow( TRUE );
- m_pClientSite->OnShowWindow( FALSE );
- }
-
- for ( AdviseSinkHashMapIterator iAdvise = m_aAdviseHashMap.begin(); iAdvise != m_aAdviseHashMap.end(); iAdvise++ )
- {
- if ( iAdvise->second )
- iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 );
- }
- if ( m_pDAdviseHolder )
- m_pDAdviseHolder->SendOnDataChange( (IDataObject*)this, 0, 0 );
+ notify();
return S_OK;
}
+ else if( iVerb == OLEIVERB_HIDE )
+ {
+ if(m_pDocHolder)
+ m_pDocHolder->hide();
- return E_NOTIMPL;
+ if( m_pClientSite )
+ m_pClientSite->OnShowWindow( FALSE );
+
+ return S_OK;
+ }
+ else
+ return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::EnumVerbs( IEnumOLEVERB **ppEnumOleVerb )
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index ba59628433c8..794b97ede956 100755
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ed_ipersiststr.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mav $ $Date: 2003-03-25 08:22:13 $
+ * last change: $Author: abi $ $Date: 2003-03-26 11:13:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -234,7 +234,7 @@ EmbedDocument_Impl::EmbedDocument_Impl( const uno::Reference< lang::XMultiServic
, m_nAdviseNum( 0 )
//, m_bLoadedFromFile( sal_False )
{
- m_pDocHolder = new DocumentHolder( xFactory );
+ m_pDocHolder = new DocumentHolder( xFactory,this );
m_pDocHolder->acquire();
}
@@ -252,7 +252,7 @@ uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Imp
aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "FilterName" ) );
aArgs[0].Value <<= getFilterNameFromGUID_Impl( &m_guid );
aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ReadOnly" ) );
- aArgs[1].Value <<= ( ( nStreamMode & ( STGM_READWRITE | STGM_WRITE ) ) ? sal_True : sal_False );
+ aArgs[1].Value <<= sal_False; //( ( nStreamMode & ( STGM_READWRITE | STGM_WRITE ) ) ? sal_True : sal_False );
if ( xStream.is() )
{
@@ -285,8 +285,6 @@ uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Imp
sDocUrl = aURL.Complete;
}
}
- else // REMOVE
- sDocUrl = getTestFileURLFromGUID_Impl( &m_guid ); // REMOVE
aArgs[3].Value <<= sDocUrl;
}
@@ -425,15 +423,15 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
uno::UNO_QUERY );
if ( aDocument.is() )
{
- m_pDocHolder->SetDocument( aDocument );
+ m_pDocHolder->SetDocument( aDocument,nStreamMode );
uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if( xLoadable.is() )
{
try
{
- // xLoadable->initNew();
- xLoadable->load( fillArgsForLoading_Impl( uno::Reference< io::XInputStream >(), nStreamMode ) );
+ xLoadable->initNew();
+ // xLoadable->load( fillArgsForLoading_Impl( uno::Reference< io::XInputStream >(), nStreamMode ) );
hr = S_OK;
}
catch( uno::Exception& )
@@ -510,7 +508,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
uno::UNO_QUERY );
if ( aDocument.is() )
{
- m_pDocHolder->SetDocument( aDocument );
+ m_pDocHolder->SetDocument( aDocument,nStreamMode );
uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if( xLoadable.is() )
@@ -690,7 +688,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD dwMode )
uno::UNO_QUERY );
if ( aDocument.is() )
{
- m_pDocHolder->SetDocument( aDocument );
+ m_pDocHolder->SetDocument( aDocument,nStreamMode );
uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if( xLoadable.is() )
diff --git a/embedserv/source/inc/docholder.hxx b/embedserv/source/inc/docholder.hxx
index a24f1c7145fb..da3b52561e6b 100644
--- a/embedserv/source/inc/docholder.hxx
+++ b/embedserv/source/inc/docholder.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docholder.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mav $ $Date: 2003-03-19 08:35:38 $
+ * last change: $Author: abi $ $Date: 2003-03-26 11:13:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,25 +70,53 @@
#ifndef _COM_SUN_STAR_FRAME_XTERMINATELISTENER_HPP_
#include <com/sun/star/frame/XTerminateListener.hpp>
#endif
+#ifndef _COM_SUN_STAR_UTIL_XMODIFYLISTENER_HPP_
+#include <com/sun/star/util/XModifyListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
+#include <com/sun/star/frame/XFrame.hpp>
+#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
#endif
-class DocumentHolder : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XCloseListener,
- ::com::sun::star::frame::XTerminateListener >
+class EmbedDocument_Impl;
+
+class DocumentHolder :
+ public ::cppu::WeakImplHelper3<
+ ::com::sun::star::util::XCloseListener,
+ ::com::sun::star::frame::XTerminateListener,
+ ::com::sun::star::util::XModifyListener >
{
+private:
+
+ EmbedDocument_Impl* m_pOLEInterface;
+
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
+ DWORD m_nStreamMode;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+
+ sal_Bool IsReadOnly() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > DocumentFrame();
public:
- DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,EmbedDocument_Impl *pOLEInterface);
~DocumentHolder();
- void SetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xDoc );
+ void SetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xDoc,DWORD nStreamMode );
+
void CloseDocument();
void FreeOffice();
+ void show();
+
+ void hide();
+
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetDocument() { return m_xDocument; }
// XEventListener
@@ -106,6 +134,8 @@ public:
virtual void SAL_CALL notifyTermination( const com::sun::star::lang::EventObject& aSource );
+// XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/embedserv/source/inc/embeddoc.hxx b/embedserv/source/inc/embeddoc.hxx
index 671010447c50..4b3443a62ccd 100755
--- a/embedserv/source/inc/embeddoc.hxx
+++ b/embedserv/source/inc/embeddoc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: embeddoc.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: mav $ $Date: 2003-03-25 08:25:26 $
+ * last change: $Author: abi $ $Date: 2003-03-26 11:13:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -159,6 +159,11 @@ public:
STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName );
STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName );
+
+ // c++ - methods
+
+ void notify();
+
protected:
oslInterlockedCount m_refCount;