Tag: cws_src680_odbmacros2 User: fs Date: 2008-03-04 12:01:37+0000 Modified: dba/reportdesign/source/ui/report/ReportController.cxx
Log: RESYNC: (1.8-1.10); FILE MERGED File Changes: Directory: /dba/reportdesign/source/ui/report/ ============================================== File [changed]: ReportController.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/ReportController.cxx?r1=1.6.34.3&r2=1.6.34.4 Delta lines: +48 -20 --------------------- --- ReportController.cxx 2008-02-06 21:46:22+0000 1.6.34.3 +++ ReportController.cxx 2008-03-04 12:01:31+0000 1.6.34.4 @@ -344,7 +344,7 @@ _xWindow = VCLUnoHelper::GetInterface(_pView); return xReportControlFormat; } -//------------------------------------------------------------------------------ +// ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OReportController::getImplementationName() throw( RuntimeException ) { return getImplementationName_Static(); @@ -2545,7 +2545,8 @@ static USHORT pRanges[] = { RPTUI_ID_LRSPACE,RPTUI_ID_BRUSH, - SID_ATTR_METRIC,SID_ATTR_METRIC + SID_ATTR_METRIC,SID_ATTR_METRIC, + 0 }; try @@ -3504,30 +3505,56 @@ uno::Reference< report::XReportComponent> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW); xShapeProp->setName(xShapeProp->getName() + sDefaultName ); - for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) + for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) // insert controls + { correctOverlapping(pControl[i],pReportSection[1-i]); + } if (!bLabelAboveTextField ) { - uno::Reference< report::XReportComponent> xComponent(pControl[1]->getUnoShape(),uno::UNO_QUERY_THROW); - sal_Int32 nY1 = xShapeProp->getPositionY(); - sal_Int32 nY2 = xComponent->getPositionY(); - while( nY1 != nY2 ) + if ( pSectionViews[0] == pSectionViews[1] ) { - size_t nWhich = 0; - if ( nY1 > nY2 ) + Rectangle aLabel = getRectangleFromControl(pControl[0]); + Rectangle aTextfield = getRectangleFromControl(pControl[1]); + + // create a Union of the given Label and Textfield + Rectangle aLabelAndTextfield( aLabel ); + aLabelAndTextfield.Union(aTextfield); + + // check if there exists other fields and if yes, move down + bool bOverlapping = true; + bool bHasToMove = false; + while ( bOverlapping ) { - ++nWhich; - xComponent->setPositionY(nY1); + const SdrObject* pOverlappedObj = isOver(aLabelAndTextfield, *pReportSection[0]->getPage(), *pSectionViews[0], true, pControl, 2); + bOverlapping = pOverlappedObj != NULL; + if ( bOverlapping ) + { + const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect(); + aLabelAndTextfield.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aLabelAndTextfield.Top()); + bHasToMove = true; } - else - xShapeProp->setPositionY(nY2); - correctOverlapping(pControl[nWhich],pReportSection[1 - nWhich],false); + } + + if (bHasToMove) + { + // There was a move down, we need to move the Label and the Textfield down + aLabel.Move(0, aLabelAndTextfield.Top() - aLabel.Top()); + aTextfield.Move(0, aLabelAndTextfield.Top() - aTextfield.Top()); + + uno::Reference< report::XReportComponent> xLabel(pControl[0]->getUnoShape(),uno::UNO_QUERY_THROW); + xLabel->setPositionY(aLabel.Top()); - nY1 = xShapeProp->getPositionY(); - nY2 = xComponent->getPositionY(); + uno::Reference< report::XReportComponent> xTextfield(pControl[1]->getUnoShape(),uno::UNO_QUERY_THROW); + xTextfield->setPositionY(aTextfield.Top()); } } + // this should never happen. + // else + // { + // DBG_ERROR("unhandled case."); + // } + } } } else @@ -3542,6 +3569,7 @@ DBG_UNHANDLED_EXCEPTION(); } } + // ----------------------------------------------------------------------------- OSectionView* OReportController::getCurrentSectionView() const { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
