summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorOcke.Janssen <Ocke.Janssen@oracle.com>2011-02-03 11:58:53 +0100
committerOcke.Janssen <Ocke.Janssen@oracle.com>2011-02-03 11:58:53 +0100
commitac4b181239597f70edfd49bf684c1e16256d71ab (patch)
treeba2cb71b87b6a6ed99dac1e17e5a5705141cf1fa /reportdesign
parentd6421660dd2ef25c0aaebe078d24919462f67d31 (diff)
dba34d: #i102719# do not allow charts to have negative positions
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx41
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx8
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx12
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx8
-rw-r--r--reportdesign/source/ui/report/dlgedfunc.cxx2
5 files changed, 46 insertions, 25 deletions
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 7d1cdbc6db30..272f0d6f4ecd 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -765,14 +765,7 @@ void OUnoObject::NbcMove( const Size& rSize )
}
if (bPositionFixed)
{
- // OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- // if ( pRptModel )
- // {
- // if (! pRptModel->GetUndoEnv().IsLocked())
- // {
- GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
- // }
- // }
+ GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
}
// set geometry properties
SetPropsFromRect(GetLogicRect());
@@ -1040,14 +1033,40 @@ void OOle2Obj::NbcMove( const Size& rSize )
// stop listening
OObjectBase::EndListening(sal_False);
+ bool bPositionFixed = false;
+ Size aUndoSize(0,0);
+ bool bUndoMode = false;
if ( m_xReportComponent.is() )
{
OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ if (pRptModel->GetUndoEnv().IsUndoMode())
+ {
+ // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
+ bUndoMode = true;
+ }
OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
- m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.A());
- m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.B());
- }
+ // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
+ int nNewX = m_xReportComponent->getPositionX() + rSize.A();
+ // can this hinder us to set components outside the area?
+ // if (nNewX < 0)
+ // {
+ // nNewX = 0;
+ // }
+ m_xReportComponent->setPositionX(nNewX);
+ int nNewY = m_xReportComponent->getPositionY() + rSize.B();
+ if (nNewY < 0 && !bUndoMode)
+ {
+ aUndoSize.B() = abs(nNewY);
+ bPositionFixed = true;
+ nNewY = 0;
+ }
+ m_xReportComponent->setPositionY(nNewY);
+ }
+ if (bPositionFixed)
+ {
+ GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
+ }
// set geometry properties
SetPropsFromRect(GetLogicRect());
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 084bd77f8d5b..af953a457edb 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -866,7 +866,10 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
uno::Reference< inspection::XNumericControl > xNumericControl(aOut.Control,uno::UNO_QUERY);
xNumericControl->setDecimalDigits( 2 );
xNumericControl->setValueUnit( util::MeasureUnit::MM_100TH );
- xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
+ uno::Reference< drawing::XShapeDescriptor> xShapeDesc(m_xReportComponent,uno::UNO_QUERY);
+ bool bSetMin = !xShapeDesc.is() || xShapeDesc->getShapeType() != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape"));
+ if ( bSetMin )
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
if ( nDisplayUnit != -1 )
xNumericControl->setDisplayUnit( nDisplayUnit );
uno::Reference< report::XReportComponent> xComp(m_xReportComponent,uno::UNO_QUERY);
@@ -884,7 +887,8 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
case PROPERTY_ID_POSITIONX:
case PROPERTY_ID_POSITIONY:
case PROPERTY_ID_WIDTH:
- xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
+ if ( bSetMin )
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
xNumericControl->setMaxValue(beans::Optional<double>(sal_True,double(aSize.Width - nLeftMargin - nRightMargin)));
if ( PROPERTY_ID_WIDTH == nId )
{
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 288692a7d7de..fc553667341f 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -876,15 +876,14 @@ SdrObject* isOver(const Rectangle& _rRect, SdrPage& _rPage, SdrView& _rView, boo
{
if ( _pIgnore != pObjIter
&& (_bAllObjects || !_rView.IsObjMarked(pObjIter))
- && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL))
{
if (_nIgnoreType == ISOVER_IGNORE_CUSTOMSHAPES && pObjIter->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
{
continue;
}
- OUnoObject* pObj = dynamic_cast<OUnoObject*>(pObjIter);
- if (pObj != NULL)
+ if (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL)
{
Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
@@ -922,7 +921,7 @@ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _
}
if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter))
- && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
{
Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
@@ -936,10 +935,9 @@ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _
SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects)
{
SdrObject* pOverlappedObj = NULL;
- OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(_pObj);
- if ( pUnoObj ) // this doesn't need to be done for shapes
+ if (dynamic_cast<OUnoObject*>(_pObj) != NULL || dynamic_cast<OOle2Obj*>(_pObj) != NULL) // this doesn't need to be done for shapes
{
- Rectangle aRect = pUnoObj->GetCurrentBoundRect();
+ Rectangle aRect = _pObj->GetCurrentBoundRect();
pOverlappedObj = isOver(aRect,_rPage,_rView,_bUnMarkedObjects,_pObj);
}
return pOverlappedObj;
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 164fb95f4d34..d092d43d08fd 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -85,7 +85,7 @@ bool lcl_getNewRectSize(const Rectangle& _aObjRect,long& _nXMov, long& _nYMov,Sd
aNewRect.Move(_nXMov,_nYMov);
break;
}
- if ( dynamic_cast<OUnoObject*>(_pObj) )
+ if (dynamic_cast<OUnoObject*>(_pObj) != NULL || dynamic_cast<OOle2Obj*>(_pObj) != NULL)
{
pOverlappedObj = isOver(aNewRect,*_pObj->GetPage(),*_pView,true,_pObj);
if ( pOverlappedObj && _pObj != pOverlappedObj )
@@ -865,7 +865,7 @@ void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAli
TRectangleMap::iterator aInterSectRectIter = aSortRectangles.begin();
for (; aInterSectRectIter != aRectIter; ++aInterSectRectIter)
{
- if ( pView == aInterSectRectIter->second.second && dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) )
+ if ( pView == aInterSectRectIter->second.second && (dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) || dynamic_cast<OOle2Obj*>(aInterSectRectIter->second.first)))
{
SdrObject* pPreviousObj = aInterSectRectIter->second.first;
Rectangle aIntersectRect = aTest.GetIntersection(_bBoundRects ? pPreviousObj->GetCurrentBoundRect() : pPreviousObj->GetSnapRect());
@@ -1680,7 +1680,7 @@ void OViewsWindow::handleKey(const KeyCode& _rCode)
for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
{
SdrMark* pMark = rMarkList.GetMark(i);
- bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL|| dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
}
@@ -1768,7 +1768,7 @@ void OViewsWindow::handleKey(const KeyCode& _rCode)
for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
{
SdrMark* pMark = rMarkList.GetMark(i);
- bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL || dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj()) != NULL;
if ( bCheck )
aNewRect.Union(pMark->GetMarkedSdrObj()->GetLastBoundRect());
}
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 3afb16b7ae0c..efc19451725a 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -622,7 +622,7 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
while( (pObjIter = aIter.Next()) != NULL && !bIsSetPoint)
{
if ( m_rView.IsObjMarked(pObjIter)
- && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
{
Rectangle aNewRect = pObjIter->GetLastBoundRect();
long nDx = rDragStat.IsHorFixed() ? 0 : rDragStat.GetDX();