summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-02-12 12:19:16 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-02-12 12:19:16 +0000
commit1e63c22ae21ff2fcca61c3d3287ea29b8d3ff7dc (patch)
treec210488e150ecbe4228eaf753d7837d79536e41b /reportdesign
parent450b4c31a08c676baa0faf5890f1de8b443e34b7 (diff)
INTEGRATION: CWS dba24g_SRC680 (1.2.68.1.2); FILE MERGED
2008/01/30 12:43:02 lla 1.2.68.1.2.1: #i85662# D&D loop fix
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/inc/UITools.hxx14
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx78
2 files changed, 79 insertions, 13 deletions
diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx
index 5bfe9230bf69..0c22beaaef30 100644
--- a/reportdesign/source/ui/inc/UITools.hxx
+++ b/reportdesign/source/ui/inc/UITools.hxx
@@ -6,9 +6,9 @@
*
* $RCSfile: UITools.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: rt $ $Date: 2008-01-29 13:48:54 $
+ * last change: $Author: vg $ $Date: 2008-02-12 13:19:02 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -51,6 +51,7 @@
class SdrPage;
class SdrObject;
+class SdrUnoObj;
class SdrView;
class Rectangle;
namespace comphelper
@@ -138,6 +139,8 @@ namespace rptui
*/
SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL);
+ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj* _pIgnoreList[], int _nIgnoreListLength);
+
/** checks whether the given OUnoObject object rectangle overlapps another object in that view.
*
* \param _pObj
@@ -160,6 +163,13 @@ namespace rptui
* \param _bInsert TRUE whe the control should be inserted, otherwise not.
*/
void correctOverlapping(SdrObject* pControl,::boost::shared_ptr<OReportSection> _pReportSection,bool _bInsert = true);
+
+ /** returns a Rectangle of a given SdrObject
+ *
+ * \param pControl the SdrObject
+ */
+
+ Rectangle getRectangleFromControl(SdrObject* pControl);
}
#endif //RPTUI_UITOOLS_HXX
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 01bd5e1b661a..dfc2f96a8f5c 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: UITools.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: vg $ $Date: 2008-02-12 13:10:54 $
+ * last change: $Author: vg $ $Date: 2008-02-12 13:19:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -824,6 +824,44 @@ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _
}
return pOverlappedObj;
}
+// -----------------------------------------------------------------------------
+bool checkArrayForOccurance(SdrObject* _pObjToCheck, SdrUnoObj* _pIgnore[], int _nListLength)
+{
+ for(int i=0;i<_nListLength;i++)
+ {
+ SdrObject *pIgnore = _pIgnore[i];
+ if (pIgnore == _pObjToCheck)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj * _pIgnoreList[], int _nIgnoreListLength)
+{
+ SdrObject* pOverlappedObj = NULL;
+ SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
+ SdrObject* pObjIter = NULL;
+
+ while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
+ {
+ if (checkArrayForOccurance(pObjIter, _pIgnoreList, _nIgnoreListLength))
+ {
+ continue;
+ }
+
+ if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter))
+ && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ {
+ Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
+ if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
+ pOverlappedObj = pObjIter;
+ }
+ }
+ return pOverlappedObj;
+}
+
//----------------------------------------------------------------------------
SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects)
{
@@ -869,28 +907,46 @@ uno::Sequence< ::rtl::OUString > getParameterNames( const uno::Reference< sdbc::
return aNames;
}
// -----------------------------------------------------------------------------
+Rectangle getRectangleFromControl(SdrObject* _pControl)
+{
+ if (_pControl)
+ {
+ uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY);
+ if (xComponent.is())
+ {
+ Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
+ aRect.setHeight(aRect.getHeight() + 1);
+ aRect.setWidth(aRect.getWidth() + 1);
+ return aRect;
+ }
+ }
+ return Rectangle();
+}
+// -----------------------------------------------------------------------------
// check overlapping
-void correctOverlapping(SdrObject* pControl,::boost::shared_ptr<OReportSection> _pReportSection,bool _bInsert)
+void correctOverlapping(SdrObject* _pControl,::boost::shared_ptr<OReportSection> _pReportSection,bool _bInsert)
{
OSectionView* pSectionView = _pReportSection->getView();
- uno::Reference< report::XReportComponent> xComponent(pControl->getUnoShape(),uno::UNO_QUERY);
- Rectangle aRet(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
- aRet.setHeight(aRet.getHeight() + 1);
- aRet.setWidth(aRet.getWidth() + 1);
+ uno::Reference< report::XReportComponent> xComponent(_pControl->getUnoShape(),uno::UNO_QUERY);
+ // Rectangle aRet(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
+ // aRet.setHeight(aRet.getHeight() + 1);
+ // aRet.setWidth(aRet.getWidth() + 1);
+ Rectangle aRect = getRectangleFromControl(_pControl);
+
bool bOverlapping = true;
while ( bOverlapping )
{
- SdrObject* pOverlappedObj = isOver(aRet,*_pReportSection->getPage(),*pSectionView,true,pControl);
+ SdrObject* pOverlappedObj = isOver(aRect,*_pReportSection->getPage(),*pSectionView,true, _pControl);
bOverlapping = pOverlappedObj != NULL;
if ( bOverlapping )
{
const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
- aRet.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRet.Top());
- xComponent->setPositionY(aRet.Top());
+ aRect.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRect.Top());
+ xComponent->setPositionY(aRect.Top());
}
}
if ( !bOverlapping && _bInsert ) // now insert objects
- pSectionView->InsertObjectAtView(pControl,*pSectionView->GetSdrPageView(),SDRINSERT_ADDMARK);
+ pSectionView->InsertObjectAtView(_pControl,*pSectionView->GetSdrPageView(),SDRINSERT_ADDMARK);
}
// -----------------------------------------------------------------------------
} // namespace rptui