User: vg Date: 2008-02-12 13:19:33+0000 Modified: dba/reportdesign/source/ui/report/ReportController.cxx
Log: INTEGRATION: CWS dba24g_SRC680 (1.6.12.2.2); FILE MERGED 2008/01/30 12:43:02 lla 1.6.12.2.2.1: #i85662# D&D loop fix 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.9&r2=1.10 Delta lines: +43 -16 --------------------- --- ReportController.cxx 2008-02-12 13:11:10+0000 1.9 +++ ReportController.cxx 2008-02-12 13:19:31+0000 1.10 @@ -341,7 +341,7 @@ _xWindow = VCLUnoHelper::GetInterface(_pView); return xReportControlFormat; } -//------------------------------------------------------------------------------ +// ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OReportController::getImplementationName() throw( RuntimeException ) { return getImplementationName_Static(); @@ -3533,30 +3533,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 @@ -3571,6 +3597,7 @@ DBG_UNHANDLED_EXCEPTION(); } } + // ----------------------------------------------------------------------------- OSectionView* OReportController::getCurrentSectionView() const { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
