Tag: cws_src680_mav17 User: mav Date: 05/02/23 00:24:43 Modified: /dba/dbaccess/source/core/dataaccess/ documentdefinition.cxx
Log: #i35991# let the existing form be opened with the same size and in nonmodified state File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: documentdefinition.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.cxx?r1=1.19&r2=1.19.28.1 Delta lines: +67 -5 -------------------- --- documentdefinition.cxx 21 Jan 2005 17:04:28 -0000 1.19 +++ documentdefinition.cxx 23 Feb 2005 08:24:40 -0000 1.19.28.1 @@ -2,9 +2,9 @@ * * $RCSfile: documentdefinition.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.19.28.1 $ * - * last change: $Author: kz $ $Date: 2005/01/21 17:04:28 $ + * last change: $Author: mav $ $Date: 2005/02/23 08:24:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,9 @@ #ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ #include <com/sun/star/awt/XTopWindow.hpp> #endif +#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_ +#include <com/sun/star/awt/Size.hpp> +#endif #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> #endif @@ -221,6 +224,9 @@ #ifndef _COM_SUN_STAR_TASK_XINTERACTIONDISAPPROVE_HPP_ #include <com/sun/star/task/XInteractionDisapprove.hpp> #endif +#ifndef _DRAFTS_COM_SUN_STAR_FRAME_XLAYOUTMANAGER_HPP_ +#include <drafts/com/sun/star/frame/XLayoutManager.hpp> +#endif #ifndef _CPPUHELPER_COMPBASE1_HXX_ #include <cppuhelper/compbase1.hxx> #endif @@ -662,11 +668,13 @@ // object is new, so we an interceptor for save xModel.set(getComponent(),UNO_QUERY); + Reference< XFrame > xFrame; if ( xModel.is() ) { + xFrame = xModel->getCurrentController()->getFrame(); + if ( m_xListener.is() ) { - Reference<XFrame> xFrame = xModel->getCurrentController()->getFrame(); if ( xFrame.is() ) { Reference<XTopWindow> xTopWindow( xFrame->getContainerWindow(),UNO_QUERY ); @@ -683,7 +691,6 @@ // remove the frame from the desktop because we need full control of it. if ( m_xFrameLoader.is() ) { - Reference<XFrame> xFrame = xModel->getCurrentController()->getFrame(); Reference<XFramesSupplier> xSup(m_xFrameLoader,UNO_QUERY); if ( xSup.is() ) { @@ -703,6 +710,36 @@ Reference<XPropertySet> xProp = xViewSup->getViewSettings(); if ( xProp.is() ) { + // The visual area size can be changed by the setting of the following properties + // so it should be restored later + Reference< XVisualObject > xVisObj( xModel, UNO_QUERY ); + ::com::sun::star::awt::Size aOrigSize; + if ( xVisObj.is() ) + { + try { + aOrigSize = xVisObj->getVisualAreaSize( Aspects::MSOLE_CONTENT ); + } catch ( Exception& ) + {} + } + + // Layout manager should not layout while the size is still not restored + // so it will stay locked for this time + Reference<::drafts::com::sun::star::frame::XLayoutManager> xLayoutManager; + if ( xFrame.is() ) + { + try + { + Reference< XPropertySet > xPropSet( xFrame, UNO_QUERY_THROW ); + xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager; + if ( xLayoutManager.is() ) + xLayoutManager->lock(); + + } + catch( Exception& ) + {} + } + + // setting of the visual properties try { xProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowRulers")),makeAny(sal_True)); @@ -717,8 +754,33 @@ catch(Exception&) { } + + // setting of the ruler changes the visual area so it should be restored + if ( xVisObj.is() && aOrigSize.Width && aOrigSize.Height ) + { + try + { + xVisObj->setVisualAreaSize( Aspects::MSOLE_CONTENT, aOrigSize ); + } catch ( Exception& ) + {} } + + // setting of the visual area set the form to modified state, it should be restored + try + { + // unlock the layout manager + // and let it layout before setting of the modified state + if ( xLayoutManager.is() ) + xLayoutManager->unlock(); + + Reference< XModifiable > xModif( xModel, UNO_QUERY_THROW ); + xModif->setModified( sal_False ); } + catch( Exception& ) + {} + } + } + } } fillReportData(!bOpenInDesign); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
