diff options
Diffstat (limited to 'embedserv')
-rw-r--r-- | embedserv/source/embed/docholder.cxx | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index b3a632f0b..b870d4a96 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docholder.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: rt $ $Date: 2003-04-24 13:54:12 $ + * last change: $Author: hr $ $Date: 2003-06-16 11:36:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -147,7 +147,7 @@ DocumentHolder::~DocumentHolder() if( m_xFrame.is() ) CloseFrame(); - + if ( m_xFactory.is() ) FreeOffice(); } @@ -185,7 +185,7 @@ void DocumentHolder::CloseDocument() if ( xBroadcaster.is() ) { xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); - + uno::Reference< util::XCloseable > xCloseable( xBroadcaster, uno::UNO_QUERY ); if ( xCloseable.is() ) { @@ -218,7 +218,7 @@ void DocumentHolder::CloseFrame() if(xComp.is()) xComp->dispose(); } - + m_xFrame = uno::Reference< frame::XFrame >(); } @@ -226,9 +226,9 @@ void DocumentHolder::SetDocument( const uno::Reference< frame::XModel >& xDoc) { if ( m_xDocument.is() ) CloseDocument(); - + m_xDocument = xDoc; - + uno::Reference< util::XCloseBroadcaster > xBroadcaster( m_xDocument, uno::UNO_QUERY ); if ( xBroadcaster.is() ) xBroadcaster->addCloseListener( (util::XCloseListener*)this ); @@ -250,19 +250,19 @@ uno::Reference< frame::XFrame > DocumentHolder::DocumentFrame() { rtl::OUString aDesktopSrvNm( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")); - + uno::Reference<frame::XDesktop> xDesktop( m_xFactory->createInstance(aDesktopSrvNm), uno::UNO_QUERY); - + uno::Reference<frame::XFrame> xFrame( xDesktop,uno::UNO_QUERY); - + if( xFrame.is() ) m_xFrame = xFrame->findFrame( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")),0); } - + if( m_xFrame.is() ) { // intercept @@ -272,7 +272,7 @@ uno::Reference< frame::XFrame > DocumentHolder::DocumentFrame() xDPI->registerDispatchProviderInterceptor( m_pInterceptor = new Interceptor(m_pOLEInterface,this)); } - + return m_xFrame; } @@ -293,11 +293,11 @@ void DocumentHolder::show() else { uno::Reference<frame::XComponentLoader> xComponentLoader( DocumentFrame(),uno::UNO_QUERY); - + if(xComponentLoader.is()) { uno::Sequence<beans::PropertyValue> aSeq(2); - + uno::Any aAny; aAny <<= uno::Reference<uno::XInterface>( GetDocument(),uno::UNO_QUERY); @@ -307,15 +307,15 @@ void DocumentHolder::show() -1, aAny, beans::PropertyState_DIRECT_VALUE); - + aAny <<= sal_False; - aSeq[1] = beans::PropertyValue( + aSeq[1] = beans::PropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly")), -1, aAny, beans::PropertyState_DIRECT_VALUE); - + xComponentLoader->loadComponentFromURL( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:object")), @@ -346,28 +346,28 @@ void DocumentHolder::resizeWin( const SIZEL& rNewSize ) { 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 ); + POINT aOldOffset; + aOldOffset.x = aOldSize.cx; + aOldOffset.y = aOldSize.cy; + BOOL bIsOk = LPtoDP( hdc, &aOldOffset, 1 ); + + POINT aNewOffset; + aNewOffset.x = rNewSize.cx; + aNewOffset.y = rNewSize.cy; + bIsOk = LPtoDP( hdc, &aNewOffset, 1 ); 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 ); - + sal_Int32 aWidthDelta = aWinRect.Width - aOldOffset.x; + sal_Int32 aHeightDelta = aWinRect.Height - aOldOffset.y; + if ( aWidthDelta > 0 && aHeightDelta > 0 ) - xWindow->setPosSize(0, - 0, - aRectNew.right - aRectNew.left + aWidthDelta, - aRectNew.bottom - aRectNew.top + aHeightDelta, + xWindow->setPosSize(0, + 0, + aNewOffset.x + aWidthDelta, + aNewOffset.y + aHeightDelta, awt::PosSize::SIZE ); } } @@ -378,7 +378,7 @@ void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) { if(m_xFrame.is()) { - if(m_aFilterName.getLength() == 0) + if(m_aFilterName.getLength() == 0) { rtl::OUString aFilterName; uno::Sequence<beans::PropertyValue> aSeq; @@ -388,7 +388,7 @@ void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) m_xDocument->getArgs(); for(sal_Int32 j = 0; j < aSeq.getLength(); ++j) { - if(aSeq[j].Name == + if(aSeq[j].Name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName"))) { @@ -397,7 +397,7 @@ void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) } } } - + if(aFilterName.getLength()) { uno::Reference<container::XNameAccess> xNameAccess( @@ -446,7 +446,7 @@ void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) } } } - + m_aDocumentNamePart = aDocumentName; if(m_pInterceptor) @@ -488,7 +488,7 @@ IDispatch* DocumentHolder::GetIDispatch() { VARIANT* pVariant = *(VARIANT**)anyResult.getValue(); if ( pVariant->vt == VT_DISPATCH ) - m_pIDispatch = pVariant->pdispVal; + m_pIDispatch = pVariant->pdispVal; VariantClear( pVariant ); CoTaskMemFree( pVariant ); @@ -587,7 +587,7 @@ HRESULT DocumentHolder::SetExtent( const SIZEL *pSize ) HRESULT DocumentHolder::GetExtent( SIZEL *pSize ) { RECTL aRect; - if ( pSize && GetVisArea( &aRect ) ) + if ( pSize && SUCCEEDED( GetVisArea( &aRect ) ) ) { pSize->cx = aRect.right - aRect.left; pSize->cy = aRect.top - aRect.bottom; @@ -604,7 +604,7 @@ void SAL_CALL DocumentHolder::disposing( const com::sun::star::lang::EventObject { m_pIDispatch = NULL; m_xDocument = uno::Reference< frame::XModel >(); - + } if( m_xFrame.is() && m_xFrame == aSource.Source ) @@ -625,13 +625,13 @@ void SAL_CALL DocumentHolder::notifyClosing( const lang::EventObject& aSource ) aSource.Source, uno::UNO_QUERY ); if ( xEventBroadcaster.is() ) xEventBroadcaster->removeCloseListener( (util::XCloseListener*)this ); - + if ( m_xDocument.is() && m_xDocument == aSource.Source ) { m_pIDispatch = NULL; m_xDocument = uno::Reference< frame::XModel >(); } - + if( m_xFrame.is() && m_xFrame == aSource.Source ) m_xFrame = uno::Reference< frame::XFrame >(); } @@ -648,7 +648,7 @@ void SAL_CALL DocumentHolder::notifyTermination( const lang::EventObject& aSourc OSL_ENSURE( !m_xDocument.is(), "Just a disaster..." ); uno::Reference< frame::XDesktop > xDesktop( aSource.Source, uno::UNO_QUERY ); - + if ( xDesktop.is() ) xDesktop->removeTerminateListener( (frame::XTerminateListener*)this ); } |