Kaydet (Commit) 7302c4f6 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

Change series and trendline pop-up to support more trendlines.

Conflicts:
	chart2/source/controller/main/ChartController_Window.cxx

Change-Id: I70eb06d74670f54fa3792723711e9f73700f12ba
üst 01fc2a65
......@@ -1301,7 +1301,7 @@ void SAL_CALL ChartController::executeDispatch_ChartType()
void SAL_CALL ChartController::executeDispatch_SourceData()
{
git gr //convert properties to ItemSet
//convert properties to ItemSet
uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
OSL_ENSURE( xChartDoc.is(), "Invalid XChartDocument" );
if( !xChartDoc.is())
......
......@@ -228,9 +228,12 @@ const short HITPIX=2; //hit-tolerance in pixel
//-----------------------------------------------------------------
// awt::XWindow
//-----------------------------------------------------------------
void SAL_CALL ChartController
::setPosSize( sal_Int32 X, sal_Int32 Y
, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
void SAL_CALL ChartController::setPosSize(
sal_Int32 X,
sal_Int32 Y,
sal_Int32 Width,
sal_Int32 Height,
sal_Int16 Flags )
throw (uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -250,9 +253,11 @@ const short HITPIX=2; //hit-tolerance in pixel
sal_Int32 nScaleXDenominator = aModelPageSize.Width;
sal_Int32 nScaleYNumerator = aLogicSize.Height();
sal_Int32 nScaleYDenominator = aModelPageSize.Height;
MapMode aNewMapMode( MAP_100TH_MM, Point(0,0)
, Fraction(nScaleXNumerator,nScaleXDenominator)
, Fraction(nScaleYNumerator,nScaleYDenominator) );
MapMode aNewMapMode(
MAP_100TH_MM,
Point(0,0),
Fraction(nScaleXNumerator, nScaleXDenominator),
Fraction(nScaleYNumerator, nScaleYDenominator) );
m_pChartWindow->SetMapMode(aNewMapMode);
m_pChartWindow->setPosSizePixel( X, Y, Width, Height, Flags );
......@@ -289,12 +294,11 @@ const short HITPIX=2; //hit-tolerance in pixel
}
}
awt::Rectangle SAL_CALL ChartController
::getPosSize()
awt::Rectangle SAL_CALL ChartController::getPosSize()
throw (uno::RuntimeException)
{
//@todo
awt::Rectangle aRet(0,0,0,0);
awt::Rectangle aRet(0, 0, 0, 0);
uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
if(xWindow.is())
......@@ -303,8 +307,7 @@ const short HITPIX=2; //hit-tolerance in pixel
return aRet;
}
void SAL_CALL ChartController
::setVisible( sal_Bool Visible )
void SAL_CALL ChartController::setVisible( sal_Bool Visible )
throw (uno::RuntimeException)
{
//@todo
......@@ -314,8 +317,7 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->setVisible( Visible );
}
void SAL_CALL ChartController
::setEnable( sal_Bool Enable )
void SAL_CALL ChartController::setEnable( sal_Bool Enable )
throw (uno::RuntimeException)
{
//@todo
......@@ -325,8 +327,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->setEnable( Enable );
}
void SAL_CALL ChartController
::setFocus() throw (uno::RuntimeException)
void SAL_CALL ChartController::setFocus()
throw (uno::RuntimeException)
{
//@todo
uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
......@@ -335,9 +337,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->setFocus();
}
void SAL_CALL ChartController
::addWindowListener( const uno::Reference<
awt::XWindowListener >& xListener )
void SAL_CALL ChartController::addWindowListener(
const uno::Reference< awt::XWindowListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -347,9 +348,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->addWindowListener( xListener );
}
void SAL_CALL ChartController
::removeWindowListener( const uno::Reference<
awt::XWindowListener >& xListener )
void SAL_CALL ChartController::removeWindowListener(
const uno::Reference< awt::XWindowListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -359,9 +359,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->removeWindowListener( xListener );
}
void SAL_CALL ChartController
::addFocusListener( const uno::Reference<
awt::XFocusListener >& xListener )
void SAL_CALL ChartController::addFocusListener(
const uno::Reference< awt::XFocusListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -371,9 +370,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->addFocusListener( xListener );
}
void SAL_CALL ChartController
::removeFocusListener( const uno::Reference<
awt::XFocusListener >& xListener )
void SAL_CALL ChartController::removeFocusListener(
const uno::Reference< awt::XFocusListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -383,9 +381,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->removeFocusListener( xListener );
}
void SAL_CALL ChartController
::addKeyListener( const uno::Reference<
awt::XKeyListener >& xListener )
void SAL_CALL ChartController::addKeyListener(
const uno::Reference< awt::XKeyListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -395,9 +392,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->addKeyListener( xListener );
}
void SAL_CALL ChartController
::removeKeyListener( const uno::Reference<
awt::XKeyListener >& xListener )
void SAL_CALL ChartController::removeKeyListener(
const uno::Reference< awt::XKeyListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -407,9 +403,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->removeKeyListener( xListener );
}
void SAL_CALL ChartController
::addMouseListener( const uno::Reference<
awt::XMouseListener >& xListener )
void SAL_CALL ChartController::addMouseListener(
const uno::Reference< awt::XMouseListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -419,9 +414,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->addMouseListener( xListener );
}
void SAL_CALL ChartController
::removeMouseListener( const uno::Reference<
awt::XMouseListener >& xListener )
void SAL_CALL ChartController::removeMouseListener(
const uno::Reference< awt::XMouseListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -431,9 +425,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->removeMouseListener( xListener );
}
void SAL_CALL ChartController
::addMouseMotionListener( const uno::Reference<
awt::XMouseMotionListener >& xListener )
void SAL_CALL ChartController::addMouseMotionListener(
const uno::Reference< awt::XMouseMotionListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -443,9 +436,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->addMouseMotionListener( xListener );
}
void SAL_CALL ChartController
::removeMouseMotionListener( const uno::Reference<
awt::XMouseMotionListener >& xListener )
void SAL_CALL ChartController::removeMouseMotionListener(
const uno::Reference< awt::XMouseMotionListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -455,9 +447,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->removeMouseMotionListener( xListener );
}
void SAL_CALL ChartController
::addPaintListener( const uno::Reference<
awt::XPaintListener >& xListener )
void SAL_CALL ChartController::addPaintListener(
const uno::Reference< awt::XPaintListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -467,9 +458,8 @@ const short HITPIX=2; //hit-tolerance in pixel
xWindow->addPaintListener( xListener );
}
void SAL_CALL ChartController
::removePaintListener( const uno::Reference<
awt::XPaintListener >& xListener )
void SAL_CALL ChartController::removePaintListener(
const uno::Reference< awt::XPaintListener >& xListener )
throw (uno::RuntimeException)
{
//@todo
......@@ -506,7 +496,7 @@ void ChartController::execute_Paint( const Rectangle& rRect )
uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
if( xProp.is() )
{
awt::Size aResolution(1000,1000);
awt::Size aResolution(1000, 1000);
{
SolarMutexGuard aGuard;
if( m_pChartWindow )
......@@ -582,8 +572,11 @@ IMPL_LINK_NOARG(ChartController, DoubleClickWaitingHdl)
if( m_pChartWindow )
{
Window::PointerState aPointerState( m_pChartWindow->GetPointerState() );
MouseEvent aMouseEvent( aPointerState.maPos,1/*nClicks*/,
0/*nMode*/, static_cast< sal_uInt16 >( aPointerState.mnState )/*nButtons*/,
MouseEvent aMouseEvent(
aPointerState.maPos,
1/*nClicks*/,
0/*nMode*/,
static_cast< sal_uInt16 >( aPointerState.mnState )/*nButtons*/,
0/*nModifier*/ );
impl_SetMousePointer( aMouseEvent );
}
......@@ -686,8 +679,11 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
return;
}
m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper
, rMEvt.IsRight(), m_bWaitingForDoubleClick );
m_aSelection.adaptSelectionToNewPos(
aMPos,
pDrawViewWrapper,
rMEvt.IsRight(),
m_bWaitingForDoubleClick );
if( !m_aSelection.isRotateableObjectSelected( getModel() ) )
{
......@@ -758,12 +754,11 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
impl_SetMousePointer( rMEvt );
}
void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
{
}
//-----------------
void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
{
ControllerLockGuard aCLGuard( getModel() );
......@@ -970,10 +965,12 @@ void ChartController::execute_Resize()
if(m_pChartWindow)
m_pChartWindow->Invalidate();
}
void ChartController::execute_Activate()
{
///// pDrawViewWrapper->SetEditMode(sal_True);
}
void ChartController::execute_Deactivate()
{
/*
......@@ -981,9 +978,11 @@ void ChartController::execute_Deactivate()
this->ReleaseMouse();
*/
}
void ChartController::execute_GetFocus()
{
}
void ChartController::execute_LoseFocus()
{
//this->ReleaseMouse();
......@@ -1130,9 +1129,9 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
}
if( bHasDataLabelsAtSeries )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatDataLabels" );
if( xTrendline.is() )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendline" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatDataLabels" );
//if( xTrendline.is() )
// lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatTrendline" );
if( bHasEquation )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
if( xMeanValue.is() )
......@@ -1145,11 +1144,13 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
xPopupMenu->insertSeparator( -1 );
if( !bHasDataLabelsAtSeries )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertDataLabels" );
if( !xTrendline.is() )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendline" );
else if( !bHasEquation )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertDataLabels" );
//if( !xTrendline.is() )
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendline" );
//else if( !bHasEquation )
//lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendlineEquation" );
if( !xMeanValue.is() )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertMeanValue" );
if( !bHasXErrorBars )
......@@ -1159,9 +1160,9 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteDataLabels" );
if( xTrendline.is() )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendline" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteDataLabels" );
//if( xTrendline.is() )
// lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteTrendline" );
if( bHasEquation )
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
if( xMeanValue.is() )
......@@ -1192,12 +1193,13 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
}
else if( OBJECTTYPE_DATA_CURVE == eObjectType )
{
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:FormatTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:InsertR2Value" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DeleteR2Value" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteTrendline" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:FormatTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertTrendlineEquationAndR2" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:InsertR2Value" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteTrendlineEquation" );
lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, ".uno:DeleteR2Value" );
}
else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType )
{
......
......@@ -242,12 +242,12 @@ void ControllerState::update(
if( xRegCurveCnt.is())
{
uno::Reference< chart2::XRegressionCurve > xRegCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
bMayFormatTrendline = bMayDeleteTrendline = xRegCurve.is();
// Trendline
bMayAddTrendline = true;
// Mean Value
bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt );
bMayAddTrendline = ! bMayDeleteTrendline;
bMayAddMeanValue = ! bMayDeleteMeanValue;
bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
}
}
......@@ -275,8 +275,11 @@ void ControllerState::update(
if( aObjectType == OBJECTTYPE_DATA_CURVE )
{
bMayFormatTrendline = true;
bMayDeleteTrendline = true;
uno::Reference< chart2::XRegressionCurve > xRegCurve(
ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
// Trendline Equation
bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
}
......@@ -286,10 +289,10 @@ void ControllerState::update(
bool bHasR2Value = false;
try
{
uno::Reference< beans::XPropertySet > xEqProp(
uno::Reference< beans::XPropertySet > xEquationProperties(
ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
if( xEqProp.is())
xEqProp->getPropertyValue( "ShowCorrelationCoefficient" ) >>= bHasR2Value;
if( xEquationProperties.is() )
xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient" ) >>= bHasR2Value;
}
catch(const uno::RuntimeException& e)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment