Tag: cws_src680_reportdesign01 User: oj Date: 2007-09-06 09:07:46+0000 Modified: dba/reportdesign/source/core/api/FixedLine.cxx dba/reportdesign/source/core/api/ReportDefinition.cxx dba/reportdesign/source/core/inc/FixedLine.hxx dba/reportdesign/source/core/sdr/ReportDrawPage.cxx dba/reportdesign/source/core/sdr/RptObject.cxx
Log: #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.3.20.1 Delta lines: +30 -7 -------------------- --- FixedLine.cxx 2007-08-02 14:29:24+0000 1.3 +++ FixedLine.cxx 2007-09-06 09:07:42+0000 1.3.20.1 @@ -4,9 +4,9 @@ * * $RCSfile: FixedLine.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.20.1 $ * - * last change: $Author: hr $ $Date: 2007/08/02 14:29:24 $ + * last change: $Author: oj $ $Date: 2007/09/06 09:07:42 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -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); } File [changed]: ReportDefinition.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/api/ReportDefinition.cxx?r1=1.4&r2=1.4.20.1 Delta lines: +15 -7 -------------------- --- ReportDefinition.cxx 2007-08-03 09:53:39+0000 1.4 +++ ReportDefinition.cxx 2007-09-06 09:07:43+0000 1.4.20.1 @@ -4,9 +4,9 @@ * * $RCSfile: ReportDefinition.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.20.1 $ * - * last change: $Author: hr $ $Date: 2007/08/03 09:53:39 $ + * last change: $Author: oj $ $Date: 2007/09/06 09:07:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -2099,10 +2099,18 @@ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); uno::Reference< drawing::XShape > xShape; + sal_Int32 nOrientation = 1; const uno::Any* pIter = _aArgs.getConstArray(); const uno::Any* pEnd = pIter + _aArgs.getLength(); - for(;pIter != pEnd && !xShape.is();++pIter) - xShape.set(*pIter,uno::UNO_QUERY); + for(;pIter != pEnd ;++pIter) + { + beans::NamedValue aValue; + *pIter >>= aValue; + if ( aValue.Name == PROPERTY_SHAPE ) + xShape.set(aValue.Value,uno::UNO_QUERY); + else if ( aValue.Name == PROPERTY_ORIENTATION ) + aValue.Value >>= nOrientation; + } uno::Reference< uno::XInterface > xReportComponent; if ( xShape.is() ) @@ -2123,7 +2131,7 @@ } else if ( aServiceSpecifier == SERVICE_FIXEDLINE) { - xReportComponent = static_cast<cppu::OWeakObject*>(new OFixedLine(m_aProps->m_xContext,this,xShape)); + xReportComponent = static_cast<cppu::OWeakObject*>(new OFixedLine(m_aProps->m_xContext,this,xShape,nOrientation)); if ( xShape.is() ) throw uno::Exception(); } Directory: /dba/reportdesign/source/core/inc/ ============================================= File [changed]: FixedLine.hxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/inc/FixedLine.hxx?r1=1.2&r2=1.2.28.1 Delta lines: +4 -3 ------------------- --- FixedLine.hxx 2007-07-09 11:56:15+0000 1.2 +++ FixedLine.hxx 2007-09-06 09:07:43+0000 1.2.28.1 @@ -4,9 +4,9 @@ * * $RCSfile: FixedLine.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.28.1 $ * - * last change: $Author: rt $ $Date: 2007/07/09 11:56:15 $ + * last change: $Author: oj $ $Date: 2007/09/06 09:07:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -102,7 +102,8 @@ explicit OFixedLine(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext); explicit OFixedLine(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _xFactory - ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape); + ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape + ,sal_Int32 _nOrientation); DECLARE_XINTERFACE( ) // ::com::sun::star::lang::XServiceInfo Directory: /dba/reportdesign/source/core/sdr/ ============================================= File [changed]: ReportDrawPage.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/sdr/ReportDrawPage.cxx?r1=1.2&r2=1.2.28.1 Delta lines: +15 -9 -------------------- --- ReportDrawPage.cxx 2007-07-09 11:56:16+0000 1.2 +++ ReportDrawPage.cxx 2007-09-06 09:07:43+0000 1.2.28.1 @@ -4,9 +4,9 @@ * * $RCSfile: ReportDrawPage.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.28.1 $ * - * last change: $Author: rt $ $Date: 2007/07/09 11:56:16 $ + * last change: $Author: oj $ $Date: 2007/09/06 09:07:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,6 +39,7 @@ #include "corestrings.hrc" #include <com/sun/star/report/XFixedLine.hpp> +#include <com/sun/star/beans/NamedValue.hpp> #include <tools/diagnose_ex.h> #include <svx/unoshape.hxx> @@ -113,16 +114,21 @@ try { - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= xShape; xShape.clear(); // keep exactly *one* reference! - xRet.set( xFactory->createInstanceWithArguments( sServiceName, aArgs ), uno::UNO_QUERY_THROW ); - + uno::Sequence< uno::Any > aArgs(bChangeOrientation ? 2 : 1); + { + beans::NamedValue aValue; + aValue.Name = PROPERTY_SHAPE; + aValue.Value <<= xShape; xShape.clear(); // keep exactly *one* reference! + aArgs[0] <<= aValue; if ( bChangeOrientation ) { - uno::Reference< report::XFixedLine > xFixedLine( xRet, uno::UNO_QUERY_THROW ); - xFixedLine->setOrientation(0); + aValue.Name = PROPERTY_ORIENTATION; + aValue.Value <<= sal_Int32(0); + aArgs[1] <<= aValue; } } + xRet.set( xFactory->createInstanceWithArguments( sServiceName, aArgs ), uno::UNO_QUERY_THROW ); + } catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); File [changed]: RptObject.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/sdr/RptObject.cxx?r1=1.5&r2=1.5.20.1 Delta lines: +21 -11 --------------------- --- RptObject.cxx 2007-08-03 12:44:07+0000 1.5 +++ RptObject.cxx 2007-09-06 09:07:43+0000 1.5.20.1 @@ -4,9 +4,9 @@ * * $RCSfile: RptObject.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.5.20.1 $ * - * last change: $Author: hr $ $Date: 2007/08/03 12:44:07 $ + * last change: $Author: oj $ $Date: 2007/09/06 09:07:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -491,7 +491,7 @@ } //---------------------------------------------------------------------------- -sal_Bool OObjectBase::supportsService( const sal_Char* _pServiceName ) const +sal_Bool OObjectBase::supportsService( const ::rtl::OUString& _sServiceName ) const { DBG_CHKTHIS( rpt_OObjectBase,NULL); sal_Bool bSupports = sal_False; @@ -499,7 +499,7 @@ Reference< lang::XServiceInfo > xServiceInfo( m_xReportComponent , UNO_QUERY ); // TODO: cache xServiceInfo as member? if ( xServiceInfo.is() ) - bSupports = xServiceInfo->supportsService( ::rtl::OUString::createFromAscii( _pServiceName ) ); + bSupports = xServiceInfo->supportsService( _sServiceName ); return bSupports; } @@ -811,9 +811,19 @@ if ( !m_xReportComponent.is() ) m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); // set labels - if ( m_xReportComponent.is() && supportsService( "com.sun.star.report.FixedText" ) ) + if ( m_xReportComponent.is() ) + { + try + { + if ( supportsService( SERVICE_FIXEDTEXT ) ) m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) ); } + catch(const uno::Exception&) + { + OSL_ENSURE(0,"OUnoObject::EndCreate: Exception caught!"); + } + } + } // set geometry properties SetPropsFromRect(GetLogicRect()); } @@ -825,19 +835,19 @@ { sal_uInt16 nResId = 0; ::rtl::OUString aDefaultName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HERE WE HAVE TO INSERT OUR NAME!")); - if ( _pObj->supportsService( "com.sun.star.report.FixedText" ) ) + if ( _pObj->supportsService( SERVICE_FIXEDTEXT ) ) { nResId = RID_STR_CLASS_FIXEDTEXT; } - else if ( _pObj->supportsService( "com.sun.star.report.FixedLine" ) ) + else if ( _pObj->supportsService( SERVICE_FIXEDLINE ) ) { nResId = RID_STR_CLASS_FIXEDLINE; } - else if ( _pObj->supportsService( "com.sun.star.report.ImageControl" ) ) + else if ( _pObj->supportsService( SERVICE_IMAGECONTROL ) ) { nResId = RID_STR_CLASS_IMAGECONTROL; } - else if ( _pObj->supportsService( "com.sun.star.report.FormattedField" ) ) + else if ( _pObj->supportsService( SERVICE_FORMATTEDFIELD ) ) { nResId = RID_STR_CLASS_FORMATTEDFIELD; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
