User: ihi Date: 2007-11-20 18:57:38+0000 Modified: dba/reportdesign/source/core/api/FixedLine.cxx
Log: INTEGRATION: CWS reportdesign01 (1.3.20); FILE MERGED 2007/09/06 09:07:42 oj 1.3.20.1: #i77507# check for width, height of a fixed line File Changes: Directory: /dba/reportdesign/source/core/api/ ============================================= File [changed]: FixedLine.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/api/FixedLine.cxx?r1=1.3&r2=1.4 Delta lines: +27 -4 -------------------- --- FixedLine.cxx 2007-08-02 14:29:24+0000 1.3 +++ FixedLine.cxx 2007-11-20 18:57:35+0000 1.4 @@ -66,6 +66,9 @@ #include <com/sun/star/text/ParagraphVertAlign.hpp> #include <boost/bind.hpp> #include "ReportHelperImpl.hxx" + +#define MIN_WIDTH 80 +#define MIN_HEIGHT 20 // ============================================================================= namespace reportdesign { @@ -137,16 +140,17 @@ { DBG_CTOR(rpt_OFixedLine,NULL); m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDLINE,m_aProps.aComponent.m_xContext->getServiceManager()); - m_aProps.aComponent.m_nWidth = 8; + m_aProps.aComponent.m_nWidth = MIN_WIDTH; } // ----------------------------------------------------------------------------- OFixedLine::OFixedLine(uno::Reference< uno::XComponentContext > const & _xContext ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory - ,uno::Reference< drawing::XShape >& _xShape) + ,uno::Reference< drawing::XShape >& _xShape + ,sal_Int32 _nOrientation) :FixedLineBase(m_aMutex) ,FixedLinePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getLineOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nOrientation(1) +,m_nOrientation(_nOrientation) ,m_LineColor(0) ,m_LineTransparence(0) ,m_LineWidth(0) @@ -155,9 +159,28 @@ m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDLINE,m_aProps.aComponent.m_xContext->getServiceManager()); m_aProps.aComponent.m_xFactory = _xFactory; osl_incrementInterlockedCount( &m_refCount ); + try + { + awt::Size aSize = _xShape->getSize(); + if ( m_nOrientation == 1 ) + { + if ( aSize.Width < MIN_WIDTH ) + { + aSize.Width = MIN_WIDTH; + _xShape->setSize(aSize); + } + } + else if ( MIN_HEIGHT > aSize.Height ) { + aSize.Height = MIN_HEIGHT; + _xShape->setSize(aSize); + } m_aProps.aComponent.setShape(_xShape,this,m_refCount); } + catch(uno::Exception&) + { + OSL_ENSURE(0,"OFixedLine::OFixedLine: Exception caught!"); + } osl_decrementInterlockedCount( &m_refCount ); } // ----------------------------------------------------------------------------- @@ -503,7 +526,7 @@ // ----------------------------------------------------------------------------- void SAL_CALL OFixedLine::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) { - if ( aSize.Width < 8 && m_nOrientation == 1 ) + if ( (aSize.Width < MIN_WIDTH && m_nOrientation == 1) || (aSize.Height < MIN_HEIGHT && m_nOrientation == 0) ) throw beans::PropertyVetoException(); OShapeHelper::setSize(aSize,this); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
