[Libreoffice-commits] core.git: 2 commits - chart2/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Apr 10 07:16:04 PDT 2014
chart2/source/controller/main/ChartController.hxx | 6
chart2/source/controller/main/ChartController_Window.cxx | 272 +++++++--------
2 files changed, 136 insertions(+), 142 deletions(-)
New commits:
commit 6f97be903beee9f6ad5f1e859ec1b402501a4d47
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Apr 9 15:31:00 2014 -0400
Reduce indentation by early bailout.
Change-Id: I64c88b007564d3ca7b4f4bd95a458fee6bda7854
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index d141d01..7cd99f2 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1848,165 +1848,165 @@ bool ChartController::impl_DragDataPoint( const OUString & rCID, double fAdditio
void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
{
SolarMutexGuard aGuard;
- if( m_pDrawViewWrapper && m_pChartWindow )
- {
- Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel()));
- sal_uInt16 nModifier = rEvent.GetModifier();
- sal_Bool bLeftDown = rEvent.IsLeft();
- if ( m_pDrawViewWrapper->IsTextEdit() )
- {
- if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) )
- {
- m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferredPointer(
- aMousePos, m_pChartWindow, nModifier, bLeftDown ) );
- return;
- }
- }
- else if( m_pDrawViewWrapper->IsAction() )
- {
- return;//don't change pointer during running action
- }
+ if (!m_pDrawViewWrapper || !m_pChartWindow)
+ return;
- SdrHdl* pHitSelectionHdl = 0;
- if( m_aSelection.isResizeableObjectSelected() )
- pHitSelectionHdl = m_pDrawViewWrapper->PickHandle( aMousePos );
+ Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel()));
+ sal_uInt16 nModifier = rEvent.GetModifier();
+ sal_Bool bLeftDown = rEvent.IsLeft();
- if( pHitSelectionHdl )
+ if ( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) )
{
+ m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferredPointer(
+ aMousePos, m_pChartWindow, nModifier, bLeftDown ) );
+ return;
+ }
+ }
+ else if( m_pDrawViewWrapper->IsAction() )
+ {
+ return;//don't change pointer during running action
+ }
- Pointer aPointer = m_pDrawViewWrapper->GetPreferredPointer(
- aMousePos, m_pChartWindow, nModifier, bLeftDown );
- bool bForceArrowPointer = false;
+ SdrHdl* pHitSelectionHdl = 0;
+ if( m_aSelection.isResizeableObjectSelected() )
+ pHitSelectionHdl = m_pDrawViewWrapper->PickHandle( aMousePos );
- ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
+ if( pHitSelectionHdl )
+ {
+ Pointer aPointer = m_pDrawViewWrapper->GetPreferredPointer(
+ aMousePos, m_pChartWindow, nModifier, bLeftDown );
+ bool bForceArrowPointer = false;
- switch( aPointer.GetStyle())
- {
- case POINTER_NSIZE:
- case POINTER_SSIZE:
- case POINTER_WSIZE:
- case POINTER_ESIZE:
- case POINTER_NWSIZE:
- case POINTER_NESIZE:
- case POINTER_SWSIZE:
- case POINTER_SESIZE:
- if( ! m_aSelection.isResizeableObjectSelected() )
- bForceArrowPointer = true;
- break;
- case POINTER_MOVE:
- if ( !aOID.isDragableObject() )
- bForceArrowPointer = true;
- break;
- case POINTER_MOVEPOINT:
- case POINTER_MOVEBEZIERWEIGHT:
- // there is no point-editing in a chart
- // the POINTER_MOVEBEZIERWEIGHT appears in 3d data points
- bForceArrowPointer = true;
- break;
- default:
- break;
- }
+ ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
- if( bForceArrowPointer )
- m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
- else
- m_pChartWindow->SetPointer( aPointer );
+ switch( aPointer.GetStyle())
+ {
+ case POINTER_NSIZE:
+ case POINTER_SSIZE:
+ case POINTER_WSIZE:
+ case POINTER_ESIZE:
+ case POINTER_NWSIZE:
+ case POINTER_NESIZE:
+ case POINTER_SWSIZE:
+ case POINTER_SESIZE:
+ if( ! m_aSelection.isResizeableObjectSelected() )
+ bForceArrowPointer = true;
+ break;
+ case POINTER_MOVE:
+ if ( !aOID.isDragableObject() )
+ bForceArrowPointer = true;
+ break;
+ case POINTER_MOVEPOINT:
+ case POINTER_MOVEBEZIERWEIGHT:
+ // there is no point-editing in a chart
+ // the POINTER_MOVEBEZIERWEIGHT appears in 3d data points
+ bForceArrowPointer = true;
+ break;
+ default:
+ break;
}
+
+ if( bForceArrowPointer )
+ m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
else
+ m_pChartWindow->SetPointer( aPointer );
+
+ return;
+ }
+
+ // #i12587# support for shapes in chart
+ if ( m_eDrawMode == CHARTDRAW_INSERT &&
+ ( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) )
+ {
+ PointerStyle ePointerStyle = POINTER_DRAW_RECT;
+ SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() );
+ switch ( eKind )
{
- // #i12587# support for shapes in chart
- if ( m_eDrawMode == CHARTDRAW_INSERT &&
- ( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) )
- {
- PointerStyle ePointerStyle = POINTER_DRAW_RECT;
- SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() );
- switch ( eKind )
+ case OBJ_LINE:
{
- case OBJ_LINE:
- {
- ePointerStyle = POINTER_DRAW_LINE;
- }
- break;
- case OBJ_RECT:
- case OBJ_CUSTOMSHAPE:
- {
- ePointerStyle = POINTER_DRAW_RECT;
- }
- break;
- case OBJ_CIRC:
- {
- ePointerStyle = POINTER_DRAW_ELLIPSE;
- }
- break;
- case OBJ_FREELINE:
- {
- ePointerStyle = POINTER_DRAW_POLYGON;
- }
- break;
- case OBJ_TEXT:
- {
- ePointerStyle = POINTER_DRAW_TEXT;
- }
- break;
- case OBJ_CAPTION:
- {
- ePointerStyle = POINTER_DRAW_CAPTION;
- }
- break;
- default:
- {
- ePointerStyle = POINTER_DRAW_RECT;
- }
- break;
+ ePointerStyle = POINTER_DRAW_LINE;
}
- m_pChartWindow->SetPointer( Pointer( ePointerStyle ) );
- return;
- }
+ break;
+ case OBJ_RECT:
+ case OBJ_CUSTOMSHAPE:
+ {
+ ePointerStyle = POINTER_DRAW_RECT;
+ }
+ break;
+ case OBJ_CIRC:
+ {
+ ePointerStyle = POINTER_DRAW_ELLIPSE;
+ }
+ break;
+ case OBJ_FREELINE:
+ {
+ ePointerStyle = POINTER_DRAW_POLYGON;
+ }
+ break;
+ case OBJ_TEXT:
+ {
+ ePointerStyle = POINTER_DRAW_TEXT;
+ }
+ break;
+ case OBJ_CAPTION:
+ {
+ ePointerStyle = POINTER_DRAW_CAPTION;
+ }
+ break;
+ default:
+ {
+ ePointerStyle = POINTER_DRAW_RECT;
+ }
+ break;
+ }
+ m_pChartWindow->SetPointer( Pointer( ePointerStyle ) );
+ return;
+ }
- OUString aHitObjectCID(
- SelectionHelper::getHitObjectCID(
- aMousePos, *m_pDrawViewWrapper, true /*bGetDiagramInsteadOf_Wall*/ ));
+ OUString aHitObjectCID(
+ SelectionHelper::getHitObjectCID(
+ aMousePos, *m_pDrawViewWrapper, true /*bGetDiagramInsteadOf_Wall*/ ));
- if( m_pDrawViewWrapper->IsTextEdit() )
+ if( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) )
+ {
+ m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
+ return;
+ }
+ }
+
+ if( aHitObjectCID.isEmpty() )
+ {
+ //additional shape was hit
+ m_pChartWindow->SetPointer( POINTER_MOVE );
+ }
+ else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) )
+ {
+ if( (m_eDragMode == SDRDRAG_ROTATE)
+ && SelectionHelper::isRotateableObject( aHitObjectCID
+ , getModel() ) )
+ m_pChartWindow->SetPointer( Pointer( POINTER_ROTATE ) );
+ else
+ {
+ ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID );
+ if( eHitObjectType == OBJECTTYPE_DATA_POINT )
{
- if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) )
+ if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID())
+ && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) )
{
m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
return;
}
}
-
- if( aHitObjectCID.isEmpty() )
- {
- //additional shape was hit
- m_pChartWindow->SetPointer( POINTER_MOVE );
- }
- else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) )
- {
- if( (m_eDragMode == SDRDRAG_ROTATE)
- && SelectionHelper::isRotateableObject( aHitObjectCID
- , getModel() ) )
- m_pChartWindow->SetPointer( Pointer( POINTER_ROTATE ) );
- else
- {
- ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID );
- if( eHitObjectType == OBJECTTYPE_DATA_POINT )
- {
- if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID())
- && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) )
- {
- m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
- return;
- }
- }
- m_pChartWindow->SetPointer( POINTER_MOVE );
- }
- }
- else
- m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
+ m_pChartWindow->SetPointer( POINTER_MOVE );
}
}
+ else
+ m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
}
} //namespace chart
commit ae4060cae9d26aca23d8f1e9d6782ca66c4ce6d3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Apr 9 12:34:38 2014 -0400
Let's remove these...
Change-Id: Ie4f15c894c13fd52e1ee175381a1e62b33864d39
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 5333789..d73d151 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -24,11 +24,8 @@
#include "CommandDispatchContainer.hxx"
#include "SelectionHelper.hxx"
-// header for enum SdrDragMode
#include <svx/svdtypes.hxx>
-// header for class Timer
#include <vcl/timer.hxx>
-// header for class MouseEvent
#include <vcl/event.hxx>
#include <cppuhelper/implbase12.hxx>
@@ -135,9 +132,6 @@ class ChartController : public ::cppu::WeakImplHelper12 <
,::com::sun::star::ui::XContextMenuInterception //(optional interface)
,::com::sun::star::util::XCloseListener //(needed for communication with XModel)
,::com::sun::star::lang::XServiceInfo
- // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
- // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
- // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
,::com::sun::star::frame::XDispatch
,::com::sun::star::awt::XWindow //this is the Window Controller part of this Controller, that will be given to a Frame via setComponent
,::com::sun::star::lang::XMultiServiceFactory
More information about the Libreoffice-commits
mailing list