diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-07-08 07:25:04 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-07-08 07:25:04 +0000 |
commit | 446697c27881c27c38f6bb1785c577ec7119c0e2 (patch) | |
tree | dd0330634e842985c87cb3784867ccf9b27e17f5 /embeddedobj/source/general/docholder.cxx | |
parent | 60bb74ce77ee756db3eae4ba68901369ba316dab (diff) |
INTEGRATION: CWS fwk90 (1.32.6); FILE MERGED
2008/05/28 14:40:17 mav 1.32.6.1: #i67015# integrate the patch
Diffstat (limited to 'embeddedobj/source/general/docholder.cxx')
-rw-r--r-- | embeddedobj/source/general/docholder.cxx | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 72c15af6280e..93a5a28dd46d 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: docholder.cxx,v $ - * $Revision: 1.33 $ + * $Revision: 1.34 $ * * This file is part of OpenOffice.org. * @@ -180,13 +180,17 @@ DocumentHolder::DocumentHolder( const uno::Reference< lang::XMultiServiceFactory m_nNoBorderResizeReact( 0 ), m_nNoResizeReact( 0 ) { - m_aOutplaceFrameProps.realloc( 2 ); + m_aOutplaceFrameProps.realloc( 3 ); beans::NamedValue aArg; aArg.Name = ::rtl::OUString::createFromAscii("TopWindow"); aArg.Value <<= sal_True; m_aOutplaceFrameProps[0] <<= aArg; + aArg.Name = ::rtl::OUString::createFromAscii("MakeVisible"); + aArg.Value <<= sal_False; + m_aOutplaceFrameProps[1] <<= aArg; + const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); uno::Reference< frame::XDesktop > xDesktop( m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); if ( xDesktop.is() ) @@ -203,10 +207,10 @@ DocumentHolder::DocumentHolder( const uno::Reference< lang::XMultiServiceFactory aArg.Name = ::rtl::OUString::createFromAscii("ParentFrame"); aArg.Value <<= xDesktop; //TODO/LATER: should use parent document frame - m_aOutplaceFrameProps[1] <<= aArg; + m_aOutplaceFrameProps[2] <<= aArg; } else - m_aOutplaceFrameProps.realloc( 1 ); + m_aOutplaceFrameProps.realloc( 2 ); } //--------------------------------------------------------------------------- @@ -934,6 +938,41 @@ uno::Reference< frame::XFrame > DocumentHolder::GetDocFrame() xOwnLM->unlock(); } + try + { + uno::Reference< awt::XWindow > xHWindow = m_xFrame->getContainerWindow(); + + if( xHWindow.is() ) + { + uno::Reference< beans::XPropertySet > xMonProps( m_xFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), uno::UNO_QUERY_THROW ); + const rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); + sal_Int32 nDisplay = 0; + xMonProps->getPropertyValue( sPropName ) >>= nDisplay; + + uno::Reference< container::XIndexAccess > xMultiMon( xMonProps, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xMonitor( xMultiMon->getByIndex( nDisplay ), uno::UNO_QUERY_THROW ); + awt::Rectangle aWorkRect; + xMonitor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WorkArea" ) ) ) >>= aWorkRect; + awt::Rectangle aWindowRect = xHWindow->getPosSize(); + + if (( aWindowRect.Width < aWorkRect.Width) && ( aWindowRect.Height < aWorkRect.Height )) + { + int OffsetX = ( aWorkRect.Width - aWindowRect.Width ) / 2 + aWorkRect.X; + int OffsetY = ( aWorkRect.Height - aWindowRect.Height ) /2 + aWorkRect.Y; + xHWindow->setPosSize( OffsetX, OffsetY, aWindowRect.Width, aWindowRect.Height, awt::PosSize::POS ); + } + else + { + xHWindow->setPosSize( aWorkRect.X, aWorkRect.Y, aWorkRect.Width, aWorkRect.Height, awt::PosSize::POSSIZE ); + } + + xHWindow->setVisible( sal_True ); + } + } + catch ( uno::Exception& ) + { + } + return m_xFrame; } |