summaryrefslogtreecommitdiff
path: root/embedserv/source/embed/docholder.cxx
diff options
context:
space:
mode:
authorMikhail Voitenko <mav@openoffice.org>2003-04-02 14:44:18 +0000
committerMikhail Voitenko <mav@openoffice.org>2003-04-02 14:44:18 +0000
commitcd4bb6998c35bf7a3786ccd585183d2d663dfe5e (patch)
tree272053ad2acd4a773b62e9d20ad563bcea67c7a5 /embedserv/source/embed/docholder.cxx
parent70cc74ceb62e78df7ac41638b173a86edd3de89f (diff)
#i2822# window resizing
Diffstat (limited to 'embedserv/source/embed/docholder.cxx')
-rw-r--r--embedserv/source/embed/docholder.cxx57
1 files changed, 55 insertions, 2 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)
{