diff options
-rw-r--r-- | embedserv/source/embed/docholder.cxx | 57 | ||||
-rwxr-xr-x | embedserv/source/embed/ed_ioleobject.cxx | 10 | ||||
-rw-r--r-- | embedserv/source/inc/docholder.hxx | 6 |
3 files changed, 67 insertions, 6 deletions
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index b92d6924a0f6..ed95bc4b342a 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docholder.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: abi $ $Date: 2003-04-01 13:10:06 $ + * last change: $Author: mav $ $Date: 2003-04-02 15:44:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,6 +103,13 @@ #ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ #include <com/sun/star/awt/XTopWindow.hpp> #endif +#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_ +#include <com/sun/star/awt/PosSize.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_XVIEW_HPP_ +#include <com/sun/star/awt/XView.hpp> +#endif + #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif @@ -305,6 +312,52 @@ void DocumentHolder::show() } } +void DocumentHolder::resizeWin( const SIZEL& rNewSize ) +{ + if ( m_xFrame.is() && m_pOLEInterface ) + { + uno::Reference< awt::XWindow > xWindow( m_xFrame->getContainerWindow(), uno::UNO_QUERY ); + uno::Reference< awt::XView > xView( xWindow, uno::UNO_QUERY ); + + if ( xWindow.is() && xView.is() ) + { + float fScale = 0.1; + xView->setZoom( fScale, fScale ); + + SIZEL aOldSize; + m_pOLEInterface->GetExtent( DVASPECT_CONTENT, &aOldSize ); + + if ( aOldSize.cx != rNewSize.cx || aOldSize.cy != rNewSize.cy ) + { + HDC hdc = GetDC( NULL ); + SetMapMode( hdc, MM_HIMETRIC ); + + RECT aRectOld = { 0, 0, 0, 0 }; + aRectOld.right = aOldSize.cx; + aRectOld.bottom = -aOldSize.cy; + LPtoDP( hdc, (POINT*)&aRectOld, 2 ); + + RECT aRectNew = { 0, 0, 0, 0 }; + aRectNew.right = rNewSize.cx; + aRectNew.bottom = -rNewSize.cy; + LPtoDP( hdc, (POINT*)&aRectNew, 2 ); + + ReleaseDC( NULL, hdc ); + + awt::Rectangle aWinRect = xWindow->getPosSize(); + sal_Int32 aWidthDelta = aWinRect.Width - ( aRectOld.right - aRectOld.left ); + sal_Int32 aHeightDelta = aWinRect.Height - ( aRectOld.bottom - aRectOld.top ); + + if ( aWidthDelta > 0 && aHeightDelta > 0 ) + xWindow->setPosSize(0, + 0, + aRectNew.right - aRectNew.left + aWidthDelta, + aRectNew.bottom - aRectNew.top + aHeightDelta, + awt::PosSize::SIZE ); + } + } + } +} void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) { diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx index f7c9f5a618c7..131a7cf7c915 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.9 $ + * $Revision: 1.10 $ * - * last change: $Author: abi $ $Date: 2003-04-01 13:10:06 $ + * last change: $Author: mav $ $Date: 2003-04-02 15:44:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,7 +148,13 @@ STDMETHODIMP EmbedDocument_Impl::DoVerb( LONG iVerb, LPMSG lpmsg, IOleClientSite iVerb == OLEIVERB_OPEN ) { if( m_pDocHolder ) + { + SIZEL aEmbSize; + + GetExtent( DVASPECT_CONTENT, &aEmbSize ); m_pDocHolder->show(); + m_pDocHolder->resizeWin( aEmbSize ); + } if ( m_pClientSite ) m_pClientSite->OnShowWindow( TRUE ); diff --git a/embedserv/source/inc/docholder.hxx b/embedserv/source/inc/docholder.hxx index 4dc05f49ffb5..146bca82b01d 100644 --- a/embedserv/source/inc/docholder.hxx +++ b/embedserv/source/inc/docholder.hxx @@ -2,9 +2,9 @@ * * $RCSfile: docholder.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: abi $ $Date: 2003-04-01 13:10:07 $ + * last change: $Author: mav $ $Date: 2003-04-02 15:44:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,6 +112,8 @@ public: void CloseFrame(); void FreeOffice(); + void resizeWin( const SIZEL& rNewSize ); + void setTitle(const rtl::OUString& aDocumentName); void show(); |