User: rt Date: 2008-01-29 13:51:11+0000 Modified: dba/reportdesign/source/ui/report/ReportSection.cxx
Log: INTEGRATION: CWS reportdesign02 (1.5.18); FILE MERGED 2007/12/20 07:48:26 oj 1.5.18.3: RESYNC: (1.5-1.6); FILE MERGED 2007/11/26 06:24:44 lla 1.5.18.2: #i80260# drag n drop, lines over all sections, no ctrl key need to move obj in different section 2007/10/30 06:56:29 oj 1.5.18.1: #i78939# change pos and size when control is outside page File Changes: Directory: /dba/reportdesign/source/ui/report/ ============================================== File [changed]: ReportSection.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/ReportSection.cxx?r1=1.6&r2=1.7 Delta lines: +60 -3 -------------------- --- ReportSection.cxx 2007-11-20 19:12:21+0000 1.6 +++ ReportSection.cxx 2008-01-29 13:51:09+0000 1.7 @@ -273,6 +273,9 @@ m_pPage->SetLftBorder(nLeftMargin); m_pPage->SetRgtBorder(nRightMargin); +// LLA: TODO +// m_pPage->SetUppBorder(-10000); + m_pView->SetDesignMode( TRUE ); m_pView->StartListening( *m_pModel ); @@ -583,18 +586,72 @@ } else { + uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition(); if ( _rEvent.PropertyName == PROPERTY_LEFTMARGIN ) { - const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN); + const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN); m_pPage->SetLftBorder(nLeftMargin); - //m_pView->GetSdrPageView()->SetPageOrigin(Point(nLeftMargin,0)); } else if ( _rEvent.PropertyName == PROPERTY_RIGHTMARGIN ) { - const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_RIGHTMARGIN); + const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN); m_pPage->SetRgtBorder(nRightMargin); } + try + { + const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN); + const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN); + const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width; + ::boost::shared_ptr<OReportSection> aSection = m_pParent->getReportSection(m_xSection); + const sal_Int32 nCount = m_xSection->getCount(); + for (sal_Int32 i = 0; i < nCount; ++i) + { + bool bChanged = false; + uno::Reference< report::XReportComponent> xReportComponent(m_xSection->getByIndex(i),uno::UNO_QUERY_THROW); + awt::Point aPos = xReportComponent->getPosition(); + awt::Size aSize = xReportComponent->getSize(); + SvxShape* pShape = SvxShape::getImplementation( xReportComponent ); + SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL; + if ( pObject ) + { + OObjectBase* pBase = dynamic_cast<OObjectBase*>(pObject); + pBase->EndListening(sal_False); + if ( aPos.X < nLeftMargin ) + { + aPos.X = nLeftMargin; + bChanged = true; + } + if ( (aPos.X + aSize.Width) > (nPaperWidth - nRightMargin) ) + { + aPos.X = nPaperWidth - nRightMargin - aSize.Width; + if ( aPos.X < nLeftMargin ) + { + aSize.Width += aPos.X - nLeftMargin; + aPos.X = nLeftMargin; + // add listener around + pBase->StartListening(); + xReportComponent->setSize(aSize); + pBase->EndListening(sal_False); + } + bChanged = true; + } + if ( aPos.Y < 0 ) + aPos.Y = 0; + if ( bChanged ) + { + xReportComponent->setPosition(aPos); + correctOverlapping(pObject,aSection,false); + } + pBase->StartListening(); + } + } + } + catch(uno::Exception) + { + OSL_ENSURE(0,"Exception caught: OReportSection::_propertyChanged("); + } + Resize(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
