Tag: cws_src680_reportdesign01
User: oj      
Date: 2007-10-16 09:11:57+0000
Modified:
   dba/reportdesign/source/ui/report/ReportController.cxx

Log:
 #i78625# equal pos for label and control

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.4.20.3&r2=1.4.20.4
Delta lines:  +35 -16
---------------------
--- ReportController.cxx        2007-10-09 09:27:44+0000        1.4.20.3
+++ ReportController.cxx        2007-10-16 09:11:55+0000        1.4.20.4
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ReportController.cxx,v $
  *
- *  $Revision: 1.4.20.3 $
+ *  $Revision: 1.4.20.4 $
  *
- *  last change: $Author: lla $ $Date: 2007/10/09 09:27:44 $
+ *  last change: $Author: oj $ $Date: 2007/10/16 09:11:55 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -343,7 +343,7 @@
 }
 // 
-----------------------------------------------------------------------------
 // check overlapping
-void lcl_correctOverlapping(SdrObject* 
pControl,::boost::shared_ptr<OReportSection> _pReportSection)
+void lcl_correctOverlapping(SdrObject* 
pControl,::boost::shared_ptr<OReportSection> _pReportSection,bool _bAppend = 
true)
 {
     OSectionView* pSectionView = _pReportSection->getView();
     uno::Reference< report::XReportComponent> 
xComponent(pControl->getUnoShape(),uno::UNO_QUERY);
@@ -353,15 +353,16 @@
     bool bOverlapping = true;
     while ( bOverlapping )
     {
-        SdrObject* pOverlappedObj = 
isOver(aRet,*_pReportSection->getPage(),*pSectionView,true,pControl);
+        const SdrObject* pOverlappedObj = 
isOver(aRet,*_pReportSection->getPage(),*pSectionView,true,pControl);
         bOverlapping = pOverlappedObj != NULL;
         if ( bOverlapping )
         {
-            aRet.Move(0,pOverlappedObj->GetLogicRect().getHeight());
+            const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
+            aRet.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - 
aRet.Top());
             xComponent->setPositionY(aRet.Top());
         }
     }
-    if ( !bOverlapping ) // now insert objects
+    if ( !bOverlapping && _bAppend ) // now insert objects
         
pSectionView->InsertObjectAtView(pControl,*pSectionView->GetSdrPageView(),SDRINSERT_ADDMARK);
 }
 
//------------------------------------------------------------------------------
@@ -3583,8 +3584,8 @@
                                    for(i = 0; i < 
sizeof(pControl)/sizeof(pControl[0]);++i)
                                    {
                         pObjs[i] = dynamic_cast<OUnoObject*>(pControl[i]);
-                        uno::Reference<beans::XPropertySet> 
xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY);
-                        uno::Reference< report::XReportComponent> 
xShapeProp(pObjs[i]->getUnoShape(),uno::UNO_QUERY);
+                        uno::Reference<beans::XPropertySet> 
xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY_THROW);
+                        uno::Reference< report::XReportComponent> 
xShapeProp(pObjs[i]->getUnoShape(),uno::UNO_QUERY_THROW);
                         
xUnoProp->setPropertyValue(PROPERTY_NAME,xShapeProp->getPropertyValue(PROPERTY_NAME));
 
                         uno::Reference<beans::XPropertySetInfo> xInfo = 
xUnoProp->getPropertySetInfo();
@@ -3624,8 +3625,8 @@
                                    {
                                            // we have two different Views, so 
set the position x new.
                                            // pSectionViews[1].position.x = 
pSectionViews[0].position.x
-                        uno::Reference< report::XReportComponent> 
xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY);
-                        uno::Reference< report::XReportComponent> 
xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY);
+                        uno::Reference< report::XReportComponent> 
xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY_THROW);
+                        uno::Reference< report::XReportComponent> 
xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY_THROW);
                                            awt::Point aPosLabel = 
xShapePropLabel->getPosition();
                                            awt::Point aPosTextField = 
xShapePropTextField->getPosition();
                                            aPosTextField.X = aPosLabel.X;
@@ -3633,11 +3634,8 @@
                                            if (bLabelAboveTextField)
                                            {
                                                    // move the label down near 
the splitter
-                                                   
uno::Reference<report::XSection> xLabelSection = 
pReportSection[1]->getSection();
-                                                   sal_Int32 nSectionHeight = 
xLabelSection->getHeight();
-                                                   sal_Int32 nLabelHeight = 
xShapePropLabel->getHeight();
-                                                   sal_Int32 nNewYPosition = 
nSectionHeight - nLabelHeight /* - 1 */;
-                                                   aPosLabel.Y = nNewYPosition;
+                                                   const 
uno::Reference<report::XSection> xLabelSection = 
pReportSection[1]->getSection();
+                                                   aPosLabel.Y = 
xLabelSection->getHeight() - xShapePropLabel->getHeight();
                                            }
                                            else
                                            {
@@ -3647,11 +3645,32 @@
                                            
xShapePropLabel->setPosition(aPosLabel);
                                    }
                     OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl[0]);
-                    uno::Reference< report::XReportComponent> 
xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY);
+                    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)
                         
lcl_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 )
+                        {
+                            size_t nWhich = 0;
+                            if ( nY1 > nY2 )
+                            {
+                                ++nWhich;
+                                xComponent->setPositionY(nY1);
+                            }
+                            else
+                                xShapeProp->setPositionY(nY2);
+                            
lcl_correctOverlapping(pControl[nWhich],pReportSection[1 - nWhich],false);
+                            
+                            nY1 = xShapeProp->getPositionY();
+                            nY2 = xComponent->getPositionY();
+                        }
+                    }
                            }
                    }
                    else




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to