diff options
author | Mikhail Voitenko <mav@openoffice.org> | 2003-03-27 14:17:36 +0000 |
---|---|---|
committer | Mikhail Voitenko <mav@openoffice.org> | 2003-03-27 14:17:36 +0000 |
commit | 60c9ea1e1e255f9bedaa5ca546df48ddf7d7ea17 (patch) | |
tree | 025593ac79cf5568a0024ba274e1d9702452b792 /embedserv | |
parent | fa66eeb587f11bea88ab5950ffd94aee221d6b31 (diff) |
#i2822# SetExtent, GetExtent
Diffstat (limited to 'embedserv')
-rwxr-xr-x | embedserv/source/embed/ed_ioleobject.cxx | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx index cfd7bbe2ee10..37029d5fb1ff 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.5 $ + * $Revision: 1.6 $ * - * last change: $Author: abi $ $Date: 2003-03-26 13:51:22 $ + * last change: $Author: mav $ $Date: 2003-03-27 15:17:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -206,17 +206,61 @@ STDMETHODIMP EmbedDocument_Impl::GetUserType( DWORD dwFormOfType, LPOLESTR *pszU STDMETHODIMP EmbedDocument_Impl::SetExtent( DWORD dwDrawAspect, SIZEL *psizel ) { - return E_NOTIMPL; + if ( !psizel ) + return E_FAIL; + + if ( m_pDocHolder->GetDocument().is() ) + { + uno::Sequence< beans::PropertyValue > aArgs = m_pDocHolder->GetDocument()->getArgs(); + for ( sal_Int32 nInd = 0; nInd < aArgs.getLength(); nInd++ ) + if ( aArgs[nInd].Name.equalsAscii( "WinExtent" ) ) + { + // should allways be there + uno::Sequence< sal_Int32 > aSize(2); + aSize[0] = psizel->cx; + aSize[1] = psizel->cy; + + aArgs[nInd].Value <<= aSize; + + break; + } + + OSL_ENSURE( nInd < aArgs.getLength(), "WinExtent seems not to be implemented!\n" ); + + m_pDocHolder->GetDocument()->attachResource( m_pDocHolder->GetDocument()->getURL(), aArgs ); + } + + return S_OK; } STDMETHODIMP EmbedDocument_Impl::GetExtent( DWORD dwDrawAspect, SIZEL *psizel ) { - if ( psizel ) + if ( !psizel ) + return E_INVALIDARG; + + if ( m_pDocHolder->GetDocument().is() ) { - psizel->cx = 10000; - psizel->cy = 10000; + uno::Sequence< beans::PropertyValue > aArgs = m_pDocHolder->GetDocument()->getArgs(); + for ( sal_Int32 nInd = 0; nInd < aArgs.getLength(); nInd++ ) + if ( aArgs[nInd].Name.equalsAscii( "WinExtent" ) ) + { + uno::Sequence< sal_Int32 > aSize; + if ( ( aArgs[nInd].Value >>= aSize ) && aSize.getLength() == 2 ) + { + psizel->cx = aSize[0]; + psizel->cy = aSize[1]; + + return S_OK; + } + + break; + } } + // return default values + psizel->cx = 500; + psizel->cy = 500; + return S_OK; } |