[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-08-06 Thread Kohei Yoshida
 chart2/source/view/main/ChartView.cxx |   32 +---
 1 file changed, 1 insertion(+), 31 deletions(-)

New commits:
commit a3438ee890b360dda9201f03a78e1c5b98193c36
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Aug 5 14:57:18 2014 -0400

bnc#886540: Let's not push the available area down when no titles are there.

This improves visual layout compability with MS Office chart  looks better.

Change-Id: I348ea81152eca4e3bba9e0d9460448d9314738ad
(cherry picked from commit b398ed8e3f95b75705bb2e53d49589ef7fdbb1c7)
Reviewed-on: https://gerrit.libreoffice.org/10771
Reviewed-by: Matúš Kukan matus.ku...@collabora.com
Tested-by: Matúš Kukan matus.ku...@collabora.com

diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index c6b5878..1965f05 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2217,37 +2217,7 @@ boost::shared_ptrVTitle lcl_createTitle( 
TitleHelper::eTitleType eType
 break;
 }
 }
-else
-{
-// #i109336# Improve auto positioning in chart
-switch ( eAlignment )
-{
-case ALIGN_TOP:
-{
-rRemainingSpace.Y += nYDistance;
-rRemainingSpace.Height -= nYDistance;
-}
-break;
-case ALIGN_BOTTOM:
-{
-rRemainingSpace.Height -= nYDistance;
-}
-break;
-case ALIGN_LEFT:
-{
-rRemainingSpace.X += nXDistance;
-rRemainingSpace.Width -= nXDistance;
-}
-break;
-case ALIGN_RIGHT:
-{
-rRemainingSpace.Width -= nXDistance;
-}
-break;
-default:
-break;
-}
-}
+
 return apVTitle;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-08-01 Thread Kohei Yoshida
 chart2/source/view/main/ChartView.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit c6d544cfc10ea37316bb510a8577358ae3b7ae83
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Jul 31 23:33:14 2014 -0400

fdo#75380: Let's not always set the line style to NONE here.

This one line guarantees that no matter what the real line style is,
it will be ignored.

Change-Id: I3bceaf49ce13ddb42ceb56750d8a4ccfef54033b
(cherry picked from commit 6053491532a5d9954caaa4abf09af30850f0cb94)
Reviewed-on: https://gerrit.libreoffice.org/10672
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index c519aef..c6b5878 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2293,7 +2293,6 @@ void formatPage(
 
 //format page
 tPropertyNameValueMap aNameValueMap;
-aNameValueMap.insert( tPropertyNameValueMap::value_type( LineStyle, 
uno::makeAny( drawing::LineStyle_NONE )));
 PropertyMapper::getValueMap( aNameValueMap, 
PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xModelPage );
 
 OUString aCID( ObjectIdentifier::createClassifiedIdentifier( 
OBJECTTYPE_PAGE, OUString() ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-06-30 Thread Kohei Yoshida
 chart2/source/controller/dialogs/DataBrowserModel.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit eb4a6f38829bfb9e2569c2a9b6e0e0ad6277555c
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Jun 26 14:51:47 2014 -0400

fdo#79151: No need to offset column index by category labels.

In fact, doing so would lead to a corrupt internal data table.  The
internal data stores category labels separately from the column data, so
there is no reason why we need to offset for category labels here.

(cherry picked from commit ecde8155fefcdacb08177a10a4eddc24f6675b0b)

Conflicts:
chart2/source/controller/dialogs/DataBrowserModel.cxx

Change-Id: I29dd99e53837cba7a1e28d2a1ef39a5384378805
Reviewed-on: https://gerrit.libreoffice.org/9928
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx 
b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 8bfa963..e3544e0 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -344,9 +344,6 @@ void DataBrowserModel::insertDataSeries( sal_Int32 
nAfterColumnIndex )
 
 if( xChartType.is())
 {
-sal_Int32 nOffset = 0;
-if( xDiagram.is()  lcl_ShowCategories( xDiagram ))
-nOffset=getCategoryColumnCount();
 // get shared sequences of current series
 Reference chart2::XDataSeriesContainer  xSeriesCnt( xChartType, 
uno::UNO_QUERY );
 lcl_tSharedSeqVec aSharedSequences;
@@ -364,7 +361,6 @@ void DataBrowserModel::insertDataSeries( sal_Int32 
nAfterColumnIndex )
 xSource-getDataSequences());
 sal_Int32 nSeqIdx = 0;
 sal_Int32 nSeqSize = aLSequences.getLength();
-nStartCol -= (nOffset - 1);
 for( sal_Int32 nIndex = nStartCol;
  (nSeqIdx  nSeqSize);
  ++nSeqIdx )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-05-05 Thread Markus Mohrhard
 chart2/source/controller/chartapiwrapper/TitleWrapper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 22d18dfa05e159c7f298e5eb49d8c89356cc5efb
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Wed Apr 30 02:33:02 2014 +0200

be explicit about text rotations, fdo#70670

Change-Id: I5090a49c2383e6a30165a8eca22b527972c0f507
Reviewed-on: https://gerrit.libreoffice.org/9231
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
index 9ca382f..f15196e 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -502,7 +502,7 @@ const std::vector WrappedProperty*  
TitleWrapper::createWrappedProperties()
 ::std::vector ::chart::WrappedProperty*  aWrappedProperties;
 
 aWrappedProperties.push_back( new WrappedTitleStringProperty( 
m_spChart2ModelContact-m_xContext ) );
-aWrappedProperties.push_back( new WrappedTextRotationProperty( 
m_eTitleType==TitleHelper::Y_AXIS_TITLE || 
m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
+aWrappedProperties.push_back( new WrappedTextRotationProperty( true ) );
 aWrappedProperties.push_back( new WrappedStackedTextProperty() );
 WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, 
this );
 WrappedAutomaticPositionProperties::addWrappedProperties( 
aWrappedProperties );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source xmloff/source

2014-05-05 Thread Markus Mohrhard
 chart2/source/tools/ErrorBar.cxx  |2 +-
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |   15 +++
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 206d59068e1293382a6d11b4caef7ebbd323fb86
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Wed Apr 30 01:20:36 2014 +0200

set graphic properties for error bars during import, fdo#78041

Change-Id: I43138745b074dcacdafa090d97eeb9aa2ccecf78
Reviewed-on: https://gerrit.libreoffice.org/9233
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index cd55836..5a639bf 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -165,7 +165,7 @@ void ErrorBar::setPropertyValue( const OUString rPropName, 
const uno::Any rAny
 else if(rPropName == ShowNegativeError)
 rAny = mbShowNegativeError;
 else if(rPropName == ErrorBarRangePositive || rPropName == 
ErrorBarRangeNegative)
-throw uno::RuntimeException(read-only property, static_cast 
uno::XWeak*(this));
+throw beans::UnknownPropertyException(read-only property, 
static_cast uno::XWeak*(this));
 else
 LineProperties::setPropertyValue(rPropName, rAny);
 
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx 
b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index c72f1af..e55b771 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -1011,6 +1011,19 @@ 
SchXMLStatisticsObjectContext::~SchXMLStatisticsObjectContext()
 
 namespace {
 
+void SetErrorBarStyleProperties( const OUString rStyleName, uno::Reference 
beans::XPropertySet  xBarProp,
+SchXMLImportHelper rImportHelper )
+{
+const SvXMLStylesContext* pStylesCtxt = 
rImportHelper.GetAutoStylesContext();
+const SvXMLStyleContext* pStyle = 
pStylesCtxt-FindStyleChildContext(rImportHelper.GetChartFamilyID(),
+rStyleName);
+
+XMLPropStyleContext * pSeriesStyleContext =
+const_cast XMLPropStyleContext * ( dynamic_cast const 
XMLPropStyleContext * ( pStyle ));
+
+pSeriesStyleContext-FillPropertySet( xBarProp );
+}
+
 void SetErrorBarPropertiesFromStyleName( const OUString aStyleName, 
uno::Reference beans::XPropertySet xBarProp,
 SchXMLImportHelper rImportHelper, 
OUString aPosRange, OUString aNegRange)
 {
@@ -1177,6 +1190,8 @@ void SchXMLStatisticsObjectContext::StartElement( const 
uno::Reference xml::sax
 
xBarProp-setPropertyValue(ShowNegativeError,uno::makeAny(sal_True));
 
 // first import defaults from parent style
+SetErrorBarStyleProperties( maSeriesStyleName, xBarProp, 
mrImportHelper );
+SetErrorBarStyleProperties( sAutoStyleName, xBarProp, 
mrImportHelper );
 SetErrorBarPropertiesFromStyleName( maSeriesStyleName, 
xBarProp, mrImportHelper, aPosRange, aNegRange );
 SetErrorBarPropertiesFromStyleName( sAutoStyleName, 
xBarProp, mrImportHelper, aPosRange, aNegRange );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-03-19 Thread Markus Mohrhard
 chart2/source/tools/NumberFormatterWrapper.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d5580b252ad4cfea10422c044366c3c6c1ebed83
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Wed Mar 19 04:50:20 2014 +0100

the type in the Any is a util::Date and not a DateTime, fdo#74549

Either that was always broken or it is a recent regression that
operator= does not convert from Date to DateTime.

Change-Id: Ic948224c139ed84b3fe006385fcafd6ce16c30f1
(cherry picked from commit 22c7da0ca5438b69165609db2a1ef219aa167dc2)
Reviewed-on: https://gerrit.libreoffice.org/8652
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx 
b/chart2/source/tools/NumberFormatterWrapper.cxx
index 1501532..4994215 100644
--- a/chart2/source/tools/NumberFormatterWrapper.cxx
+++ b/chart2/source/tools/NumberFormatterWrapper.cxx
@@ -26,7 +26,7 @@
 #include svl/zformat.hxx
 #include tools/color.hxx
 #include i18nlangtag/mslangid.hxx
-#include com/sun/star/util/DateTime.hpp
+#include com/sun/star/util/Date.hpp
 
 namespace chart
 {
@@ -79,7 +79,7 @@ Date NumberFormatterWrapper::getNullDate() const
 sal_uInt16 nYear = 1899,nDay = 30,nMonth = 12;
 Date aRet(nDay,nMonth,nYear);
 
-util::DateTime aUtilDate;
+util::Date aUtilDate;
 if( m_aNullDate.hasValue()  (m_aNullDate = aUtilDate) )
 {
 aRet = Date(aUtilDate.Day,aUtilDate.Month,aUtilDate.Year);
@@ -114,7 +114,7 @@ OUString NumberFormatterWrapper::getFormattedString( 
sal_Int32 nNumberFormatKey,
 nMonth = pDate-GetMonth();
 nDay = pDate-GetDay();
 } // if ( pDate )
-util::DateTime aNewNullDate;
+util::Date aNewNullDate;
 m_aNullDate = aNewNullDate;
 
m_pNumberFormatter-ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-03-11 Thread Markus Mohrhard
 chart2/source/tools/ErrorBar.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 787a663d8579921af4176feeb265dea8aac4d50c
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Tue Mar 11 22:10:30 2014 +0100

fix negative error bar range export, fdo#75510

Change-Id: Icca2f9fc26b15b968a940e5c73f7ad3781f75e94
(cherry picked from commit 7470b3ef17570581fe590a4853de59cac1be6ea5)
Reviewed-on: https://gerrit.libreoffice.org/8535
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index 3e305b9..cd55836 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -254,7 +254,7 @@ uno::Any ErrorBar::getPropertyValue(const OUString 
rPropName)
 uno::Sequence uno::Reference chart2::data::XLabeledDataSequence 
  aSequences =
 getDataSequences();
 
-aRange = getSourceRangeStrFromLabeledSequences( aSequences, true );
+aRange = getSourceRangeStrFromLabeledSequences( aSequences, false 
);
 }
 
 aRet = aRange;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-03-07 Thread Laurent Balland-Poirier
 chart2/source/tools/PolynomialRegressionCurveCalculator.cxx |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit cade56eef6d23aa7dd6e374858cf30ff3fcd163b
Author: Laurent Balland-Poirier laurent.balland-poir...@laposte.net
Date:   Wed Mar 5 10:43:54 2014 +0100

fdo#75538 R^2 calculation of trendline similar to LINEST function

Modify for forced intercept of trendline, calculation of R^2 in the same
way as LINEST function does calculation
Update fo 4.2

Change-Id: I06ba4e7f5e07f7db150e1bf1070870bf64ad6f61
Reviewed-on: https://gerrit.libreoffice.org/8462
Reviewed-by: Tomaž Vajngerl qui...@gmail.com
Tested-by: Tomaž Vajngerl qui...@gmail.com

diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx 
b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index 21b564d..3c15d28 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -168,7 +168,6 @@ void SAL_CALL 
PolynomialRegressionCurveCalculator::recalculateRegression(
 double aSumError = 0.0;
 double aSumTotal = 0.0;
 double aSumYpred2 = 0.0;
-double aSumYactual2 = 0.0;
 
 for( sal_Int32 i = 0; i  aNoValues; i++ )
 {
@@ -177,15 +176,14 @@ void SAL_CALL 
PolynomialRegressionCurveCalculator::recalculateRegression(
 double yPredicted = getCurveValue( xValue );
 aSumTotal += (yActual - yAverage) * (yActual - yAverage);
 aSumError += (yActual - yPredicted) * (yActual - yPredicted);
-aSumYpred2 += yPredicted * yPredicted;
-aSumYactual2 += yActual * yActual;
+if(mForceIntercept)
+aSumYpred2 += (yPredicted - mInterceptValue) * (yPredicted - 
mInterceptValue);
 }
 
 double aRSquared = 0.0;
 if(mForceIntercept)
 {
-if(aSumYactual2 != 0.0)
-aRSquared = aSumYpred2 / aSumYactual2;
+aRSquared = aSumYpred2 / (aSumError + aSumYpred2);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2014-02-10 Thread Laurent Balland-Poirier
 chart2/source/tools/PolynomialRegressionCurveCalculator.cxx |   15 +++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit bac928cf6405c869ab83bc136dac52b037386108
Author: Laurent Balland-Poirier laurent.balland-poir...@laposte.net
Date:   Wed Jan 8 22:37:52 2014 +0100

fdo#73374 Trendline: correct R^2 for forced intercept

In case of forced intercept, R^2 must be calculated in a different way.
This patch calculates R^2 of trend line in the same way as LINEST
function.

Change-Id: I3ac361f014569261f05d513acb3428de5c7641ab
Reviewed-on: https://gerrit.libreoffice.org/7326
Reviewed-by: Tomaž Vajngerl qui...@gmail.com
Tested-by: Tomaž Vajngerl qui...@gmail.com
(cherry picked from commit 9e67015be6e9e53e19466117d692de17c18463da)
Reviewed-on: https://gerrit.libreoffice.org/7956
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx 
b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index 951c071..21b564d 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -167,6 +167,8 @@ void SAL_CALL 
PolynomialRegressionCurveCalculator::recalculateRegression(
 // Calculate correlation coeffitient
 double aSumError = 0.0;
 double aSumTotal = 0.0;
+double aSumYpred2 = 0.0;
+double aSumYactual2 = 0.0;
 
 for( sal_Int32 i = 0; i  aNoValues; i++ )
 {
@@ -175,9 +177,20 @@ void SAL_CALL 
PolynomialRegressionCurveCalculator::recalculateRegression(
 double yPredicted = getCurveValue( xValue );
 aSumTotal += (yActual - yAverage) * (yActual - yAverage);
 aSumError += (yActual - yPredicted) * (yActual - yPredicted);
+aSumYpred2 += yPredicted * yPredicted;
+aSumYactual2 += yActual * yActual;
 }
 
-double aRSquared = 1.0 - (aSumError / aSumTotal);
+double aRSquared = 0.0;
+if(mForceIntercept)
+{
+if(aSumYactual2 != 0.0)
+aRSquared = aSumYpred2 / aSumYactual2;
+}
+else
+{
+aRSquared = 1.0 - (aSumError / aSumTotal);
+}
 
 if (aRSquared  0.0)
 m_fCorrelationCoeffitient = std::sqrt(aRSquared);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source include/svx offapi/com offapi/UnoApi_offapi.mk svx/source

2014-01-10 Thread Kohei Yoshida
 chart2/source/view/inc/AbstractShapeFactory.hxx |   17 +---
 chart2/source/view/inc/OpenglShapeFactory.hxx   |   13 +++---
 chart2/source/view/inc/ShapeFactory.hxx |   13 +++---
 chart2/source/view/main/OpenglShapeFactory.cxx  |   12 +++---
 chart2/source/view/main/ShapeFactory.cxx|   21 +++---
 chart2/source/view/main/VLegend.cxx |2 -
 include/svx/unoshape.hxx|   14 +--
 offapi/UnoApi_offapi.mk |1 
 offapi/com/sun/star/drawing/XShapes2.idl|   47 
 svx/source/unodraw/unoshap2.cxx |   39 +++
 10 files changed, 136 insertions(+), 43 deletions(-)

New commits:
commit 3a9aad596ac874e086acc897edcf8fe0212d65a8
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Jan 10 11:30:59 2014 -0500

fdo#72005: Insert the border rectangle to the bottom of the stack.

This will make the border and fill shape to be drawn first, then everything
else drawn on top.

This commit may look large, but it's actually a very trivial change. The
important part is in SvxShapeGroup where new methods have been added to 
allow
different insertion positions for the new shapes being inserted, and have
the chart2 code make use of it to insert the fill rectangle to the bottom
rather than to the top.

(cherry picked from commit 10840ad753b60886ea5175060cb0ec2a77e1579a)
(cherry picked from commit d1846cd8d4530d620b996f27a0ea7ab0c91639b5)

Change-Id: I999160daf6fc9ce3d7e641f57b1998543df1cc4e
Reviewed-on: https://gerrit.libreoffice.org/7379
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx 
b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 36b2554..73fbf69 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -23,7 +23,7 @@
 #include com/sun/star/drawing/PolyPolygonShape3D.hpp
 #include com/sun/star/drawing/Position3D.hpp
 #include com/sun/star/drawing/XDrawPage.hpp
-#include com/sun/star/drawing/XShapes.hpp
+#include com/sun/star/drawing/XShapes2.hpp
 #include com/sun/star/graphic/XGraphic.hpp
 #include com/sun/star/lang/XMultiServiceFactory.hpp
 
@@ -60,6 +60,8 @@ class AbstractShapeFactory
 {
 public:
 
+enum StackPosition { Top, Bottom };
+
 static AbstractShapeFactory* 
getOrCreateShapeFactory(::com::sun::star::uno::Reference 
::com::sun::star::lang::XMultiServiceFactory xFactory);
 
 virtual ~AbstractShapeFactory() {};
@@ -211,12 +213,13 @@ public:
 
 virtual ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShape 
 createRectangle(
-const ::com::sun::star::uno::Reference
-::com::sun::star::drawing::XShapes  xTarget
-, const ::com::sun::star::awt::Size rSize
-, const ::com::sun::star::awt::Point rPosition
-, const tNameSequence rPropNames
-, const tAnySequence rPropValues ) = 0;
+const com::sun::star::uno::Reference
+com::sun::star::drawing::XShapes  xTarget,
+const com::sun::star::awt::Size rSize,
+const com::sun::star::awt::Point rPosition,
+const tNameSequence rPropNames,
+const tAnySequence rPropValues,
+StackPosition ePos = Top ) = 0;
 
 virtual ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShape 
 createRectangle(
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx 
b/chart2/source/view/inc/OpenglShapeFactory.hxx
index 7d8ebdc..164ba93 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -162,12 +162,13 @@ public:
 
 virtual ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShape 
 createRectangle(
-const ::com::sun::star::uno::Reference
-::com::sun::star::drawing::XShapes  xTarget
-, const ::com::sun::star::awt::Size rSize
-, const ::com::sun::star::awt::Point rPosition
-, const tNameSequence rPropNames
-, const tAnySequence rPropValues );
+const com::sun::star::uno::Reference
+com::sun::star::drawing::XShapes  xTarget,
+const com::sun::star::awt::Size rSize,
+const com::sun::star::awt::Point rPosition,
+const tNameSequence rPropNames,
+const tAnySequence rPropValues,
+StackPosition ePos = Top );
 
 virtual ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShape 
 createRectangle(
diff --git a/chart2/source/view/inc/ShapeFactory.hxx 
b/chart2/source/view/inc/ShapeFactory.hxx
index 5afb686..ed592d2 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -177,12 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source chart2/uiconfig

2013-12-14 Thread Laurent Balland-Poirier
 chart2/source/controller/dialogs/res_Trendline.cxx |   53 +
 chart2/source/controller/dialogs/res_Trendline.hxx |4 -
 chart2/uiconfig/ui/tp_Trendline.ui |9 ---
 3 files changed, 27 insertions(+), 39 deletions(-)

New commits:
commit fefdd355b5acc465159a57ee2972d1574fc1ef49
Author: Laurent Balland-Poirier laurent.balland-poir...@laposte.net
Date:   Fri Dec 13 07:25:20 2013 +0100

fdo#40316 Remove SpinButton in UI for extrapolate trendline

UI Trendline: Spinbutton are not adapted for real value of x-values used
in extrapolate For/Back-ward. Replaced with FormattedFiled
like Intercept value

Change-Id: Idc49f842a0f76906eb3c027e15a493e625c3d535
Reviewed-on: https://gerrit.libreoffice.org/7067
Reviewed-by: Tomaž Vajngerl qui...@gmail.com
Tested-by: Tomaž Vajngerl qui...@gmail.com

diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx 
b/chart2/source/controller/dialogs/res_Trendline.cxx
index c8bba7e..91552e4 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -54,8 +54,8 @@ TrendlineResources::TrendlineResources( Window * pParent, 
const SfxItemSet rInA
 pTabPage-get(m_pNF_Degree,degree);
 pTabPage-get(m_pNF_Period,period);
 pTabPage-get(m_pEE_Name,entry_name);
-pTabPage-get(m_pNF_ExtrapolateForward,extrapolateForward);
-pTabPage-get(m_pNF_ExtrapolateBackward,extrapolateBackward);
+pTabPage-get(m_pFmtFld_ExtrapolateForward,extrapolateForward);
+pTabPage-get(m_pFmtFld_ExtrapolateBackward,extrapolateBackward);
 pTabPage-get(m_pCB_SetIntercept,setIntercept);
 pTabPage-get(m_pFmtFld_InterceptValue,interceptValue);
 pTabPage-get(m_pCB_ShowEquation,showEquation);
@@ -81,11 +81,6 @@ TrendlineResources::TrendlineResources( Window * pParent, 
const SfxItemSet rInA
 m_pNF_Period-SetModifyHdl( aLink );
 m_pFmtFld_InterceptValue-SetModifyHdl( aLink );
 
-m_pNF_ExtrapolateForward-SetMin( SAL_MIN_INT64 );
-m_pNF_ExtrapolateForward-SetMax( SAL_MAX_INT64 );
-m_pNF_ExtrapolateBackward-SetMin( SAL_MIN_INT64 );
-m_pNF_ExtrapolateBackward-SetMax( SAL_MAX_INT64 );
-
 Reset( rInAttrs );
 UpdateControlStates();
 }
@@ -159,27 +154,21 @@ void TrendlineResources::Reset( const SfxItemSet 
rInAttrs )
 m_pNF_Period-SetValue( 2 );
 }
 
+double nValue = 0.0;
 if( rInAttrs.GetItemState( SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, 
sal_True, pPoolItem ) == SFX_ITEM_SET )
 {
-double nValue = static_cast const SvxDoubleItem * ( pPoolItem 
)-GetValue() * 100;
-m_pNF_ExtrapolateForward-SetValue( (sal_Int64) nValue );
-}
-else
-{
-m_pNF_ExtrapolateForward-SetValue( 0 );
+nValue = ((const SvxDoubleItem*)pPoolItem)-GetValue() ;
 }
+lcl_setValue( *m_pFmtFld_ExtrapolateForward, nValue );
 
+nValue = 0.0;
 if( rInAttrs.GetItemState( SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, 
sal_True, pPoolItem ) == SFX_ITEM_SET )
 {
-double nValue = static_cast const SvxDoubleItem * ( pPoolItem 
)-GetValue() * 100;
-m_pNF_ExtrapolateBackward-SetValue( (sal_Int64) nValue );
-}
-else
-{
-m_pNF_ExtrapolateBackward-SetValue( 0 );
+nValue = ((const SvxDoubleItem*)pPoolItem)-GetValue() ;
 }
+lcl_setValue( *m_pFmtFld_ExtrapolateBackward, nValue );
 
-double nValue = 0.0;;
+nValue = 0.0;
 if( rInAttrs.GetItemState( SCHATTR_REGRESSION_INTERCEPT_VALUE, sal_True, 
pPoolItem ) == SFX_ITEM_SET )
 {
 nValue = ((const SvxDoubleItem*)pPoolItem)-GetValue() ;
@@ -273,19 +262,21 @@ sal_Bool TrendlineResources::FillItemSet(SfxItemSet 
rOutAttrs) const
 sal_Int32 aPeriod = m_pNF_Period-GetValue();
 rOutAttrs.Put(SfxInt32Item( SCHATTR_REGRESSION_PERIOD, aPeriod ) );
 
-double aExtrapolateForwardValue = m_pNF_ExtrapolateForward-GetValue() / 
100.0;
-rOutAttrs.Put(SvxDoubleItem( aExtrapolateForwardValue, 
SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD ) );
+sal_uInt32 nIndex = 0;
+double aValue = 0.0;
+
m_pNumFormatter-IsNumberFormat(m_pFmtFld_ExtrapolateForward-GetText(),nIndex,aValue);
+rOutAttrs.Put(SvxDoubleItem( aValue, 
SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD ) );
 
-double aExtrapolateBackwardValue = m_pNF_ExtrapolateBackward-GetValue() / 
100.0;
-rOutAttrs.Put(SvxDoubleItem( aExtrapolateBackwardValue, 
SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD ) );
+aValue = 0.0;
+
m_pNumFormatter-IsNumberFormat(m_pFmtFld_ExtrapolateBackward-GetText(),nIndex,aValue);
+rOutAttrs.Put(SvxDoubleItem( aValue, 
SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD ) );
 
 if( m_pCB_SetIntercept-GetState() != STATE_DONTKNOW )
 rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SET_INTERCEPT, 
m_pCB_SetIntercept-IsChecked() ));
 
-double aInterceptValue = 0.0;
-sal_uInt32 nIndex = 0;
-

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2013-12-10 Thread Laurent Balland-Poirier
 chart2/source/controller/dialogs/ObjectNameProvider.cxx|   15 
--
 chart2/source/controller/dialogs/Strings.src   |4 ++
 chart2/source/inc/Strings.hrc  |3 +-
 chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx |4 ++
 4 files changed, 23 insertions(+), 3 deletions(-)

New commits:
commit 3df5f7c2848b4e71c18edfddeae254e24ee88384
Author: Laurent Balland-Poirier laurent.balland-poir...@laposte.net
Date:   Tue Dec 10 09:21:16 2013 +0100

fdo#40315 Improve text for moving average trendline

Change text in status bar for moving average trendline:
no equation, no R²

Change-Id: I0e18a72ff1f1d78e3bb28cab4d5f215c096898dc
Reviewed-on: https://gerrit.libreoffice.org/7015
Tested-by: Tomaž Vajngerl qui...@gmail.com
Reviewed-by: Tomaž Vajngerl qui...@gmail.com

diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx 
b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 73d8416..39a776f 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -563,12 +563,14 @@ OUString ObjectNameProvider::getHelpText( const OUString 
rObjectCID, const Refe
 {
 Reference chart2::XRegressionCurveCalculator  
xCalculator( xCurve-getCalculator(), uno::UNO_QUERY_THROW );
 sal_Int32 aDegree = 2;
+sal_Int32 aPeriod = 2;
 sal_Bool aForceIntercept = false;
 double aInterceptValue = 0.0;
 uno::Reference beans::XPropertySet  xProperties( 
xCurve, uno::UNO_QUERY );
 if ( xProperties.is())
 {
 xProperties-getPropertyValue( 
PolynomialDegree) = aDegree;
+xProperties-getPropertyValue( 
MovingAveragePeriod) = aPeriod;
 xProperties-getPropertyValue( 
ForceIntercept) = aForceIntercept;
 if (aForceIntercept)
 xProperties-getPropertyValue( 
InterceptValue) = aInterceptValue;
@@ -576,9 +578,18 @@ OUString ObjectNameProvider::getHelpText( const OUString 
rObjectCID, const Refe
 xCalculator-setRegressionProperties(aDegree, 
aForceIntercept, aInterceptValue, 2);
 RegressionCurveHelper::initializeCurveCalculator( 
xCalculator, xSeries, xChartModel );
 
+// change text for Moving Average
+OUString aWildcard( %PERIOD );
+sal_Int32 nIndex = 
xCalculator-getRepresentation().indexOf( aWildcard );
+if( nIndex != -1 )
+{  // replace period
+aRet = xCalculator-getRepresentation();
+aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), OUString::number(aPeriod) );
+}
+
 // replace formula
-OUString aWildcard( %FORMULA );
-sal_Int32 nIndex = aRet.indexOf( aWildcard );
+aWildcard = %FORMULA;
+nIndex = aRet.indexOf( aWildcard );
 if( nIndex != -1 )
 aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), xCalculator-getRepresentation());
 
diff --git a/chart2/source/controller/dialogs/Strings.src 
b/chart2/source/controller/dialogs/Strings.src
index 1aae59a..51ef8b6 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -319,6 +319,10 @@ String STR_OBJECT_CURVE_WITH_PARAMETERS
 {
 Text [ en-US ] = Trend line %FORMULA with accuracy R² = %RSQUARED;
 };
+String STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS
+{
+Text [ en-US ] = Moving average trend line with period = %PERIOD;
+};
 String STR_OBJECT_AVERAGE_LINE
 {
 Text [ en-US ] = Mean Value Line;
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index eb696a5..81f3ede 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -22,7 +22,7 @@
 // this includes no link dependency
 #include svl/solar.hrc
 
-//next free is 297
+//next free is 303
 
 //-
 //chart types
@@ -206,6 +206,7 @@
 
 #define STR_OBJECT_CURVE_WITH_PARAMETERS(RID_APP_START + 264)
 #define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS (RID_APP_START + 265)
+#define STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS (RID_APP_START + 302)
 
 #define STR_OBJECT_CURVE_EQUATION   (RID_APP_START + 268)
 #define STR_OBJECT_SHAPE(RID_APP_START + 290)
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2013-12-09 Thread Tomaž Vajngerl
 chart2/source/view/charttypes/VSeriesPlotter.cxx |   37 +++
 1 file changed, 18 insertions(+), 19 deletions(-)

New commits:
commit 306d6d7f199067594378e2c9d084016d1442367a
Author: Tomaž Vajngerl qui...@gmail.com
Date:   Mon Dec 9 19:53:20 2013 +0100

fdo#72137 Allocate enough points in MovingAverageRegression calc.

Change-Id: I9ae058cad678cdb86709a4e40e3d4bd47900d386

diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 44e4c58..a1749ce 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -997,20 +997,15 @@ void VSeriesPlotter::createRegressionCurvesShapes( 
VDataSeries rVDataSeries,
 xProperties-getPropertyValue( InterceptValue) = 
aInterceptValue;
 }
 
-double fMinX;
-double fMaxX;
-
 double fChartMinX = m_pPosHelper-getLogicMinX();
 double fChartMaxX = m_pPosHelper-getLogicMaxX();
 
+double fMinX = fChartMinX;
+double fMaxX = fChartMaxX;
+
 double fPointScale = 1.0;
 
-if( bAverageLine )
-{
-fMinX = fChartMinX;
-fMaxX = fChartMaxX;
-}
-else
+if( !bAverageLine )
 {
 rVDataSeries.getMinMaxXValue(fMinX, fMaxX);
 fMaxX += aExtrapolateForward;
@@ -1018,6 +1013,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( 
VDataSeries rVDataSeries,
 
 fPointScale = (fMaxX - fMinX) / (fChartMaxX - fChartMinX);
 }
+
 xCalculator-setRegressionProperties(aDegree, aForceIntercept, 
aInterceptValue, aPeriod);
 xCalculator-recalculateRegression( rVDataSeries.getAllX(), 
rVDataSeries.getAllY() );
 sal_Int32 nPointCount = 100 * fPointScale;
@@ -1025,15 +1021,6 @@ void VSeriesPlotter::createRegressionCurvesShapes( 
VDataSeries rVDataSeries,
 if ( nPointCount  2 )
 nPointCount = 2;
 
-drawing::PolyPolygonShape3D aRegressionPoly;
-aRegressionPoly.SequenceX.realloc(1);
-aRegressionPoly.SequenceY.realloc(1);
-aRegressionPoly.SequenceZ.realloc(1);
-aRegressionPoly.SequenceX[0].realloc(nPointCount);
-aRegressionPoly.SequenceY[0].realloc(nPointCount);
-aRegressionPoly.SequenceZ[0].realloc(nPointCount);
-sal_Int32 nRealPointCount=0;
-
 std::vector ExplicitScaleData  aScales( m_pPosHelper-getScales());
 uno::Reference chart2::XScaling  xScalingX;
 uno::Reference chart2::XScaling  xScalingY;
@@ -1048,7 +1035,19 @@ void VSeriesPlotter::createRegressionCurvesShapes( 
VDataSeries rVDataSeries,
 fMinX, fMaxX, nPointCount,
 xScalingX, xScalingY, bMaySkipPoints ));
 
-for(sal_Int32 nP=0; nPaCalculatedPoints.getLength(); nP++)
+nPointCount = aCalculatedPoints.getLength();
+
+drawing::PolyPolygonShape3D aRegressionPoly;
+aRegressionPoly.SequenceX.realloc(1);
+aRegressionPoly.SequenceY.realloc(1);
+aRegressionPoly.SequenceZ.realloc(1);
+aRegressionPoly.SequenceX[0].realloc(nPointCount);
+aRegressionPoly.SequenceY[0].realloc(nPointCount);
+aRegressionPoly.SequenceZ[0].realloc(nPointCount);
+
+sal_Int32 nRealPointCount = 0;
+
+for(sal_Int32 nP = 0; nP  aCalculatedPoints.getLength(); ++nP)
 {
 double fLogicX = aCalculatedPoints[nP].X;
 double fLogicY = aCalculatedPoints[nP].Y;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2013-12-08 Thread Laurent Balland-Poirier
 chart2/source/controller/dialogs/res_Trendline.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 476af21852660edf10442794e712a2433fa3bad4
Author: Laurent Balland-Poirier laurent.balland-poir...@laposte.net
Date:   Mon Dec 9 07:54:38 2013 +0100

fdo#40314 Force intercept only for linear/poly trendlines

Force intercept option is available only for linear and polynomial
trendlines

Change-Id: I98f551a51b4d1e85924ce23135588a03fabbea35
Reviewed-on: https://gerrit.libreoffice.org/7001
Reviewed-by: Tomaž Vajngerl qui...@gmail.com
Tested-by: Tomaž Vajngerl qui...@gmail.com

diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx 
b/chart2/source/controller/dialogs/res_Trendline.cxx
index e1b6a07..c8bba7e 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -303,10 +303,11 @@ void TrendlineResources::FillValueSets()
 void TrendlineResources::UpdateControlStates()
 {
 bool bMovingAverage = ( m_eTrendLineType == CHREGRESS_MOVING_AVERAGE );
+bool bInterceptAvailable = ( m_eTrendLineType == CHREGRESS_LINEAR ) || ( 
m_eTrendLineType == CHREGRESS_POLYNOMIAL );
 m_pNF_ExtrapolateForward-Enable(!bMovingAverage);
 m_pNF_ExtrapolateBackward-Enable(!bMovingAverage);
-m_pCB_SetIntercept-Enable(!bMovingAverage);
-m_pFmtFld_InterceptValue-Enable(!bMovingAverage);
+m_pCB_SetIntercept-Enable( bInterceptAvailable );
+m_pFmtFld_InterceptValue-Enable( bInterceptAvailable );
 if(bMovingAverage)
 {
 m_pCB_ShowEquation-SetState( STATE_NOCHECK );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2013-12-03 Thread Tomaž Vajngerl
 chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx |  
299 ++
 chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx  |  
193 ++
 chart2/source/view/main/ChartItemPool.cxx|
2 
 3 files changed, 139 insertions(+), 355 deletions(-)

New commits:
commit 8ad8e8754cadebf9c06dd487a9816e0980ee36b0
Author: Tomaž Vajngerl qui...@gmail.com
Date:   Thu Nov 21 20:25:53 2013 +0100

Simplify conversion from/to ItemSet/PropertySet for RegressionCurves

Change-Id: I5ddf53f984508a88fd02063eb9f81cd05cf627c9
Reviewed-on: https://gerrit.libreoffice.org/6872
Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com
Reviewed-by: Thorsten Behrens t...@documentfoundation.org
Tested-by: Thorsten Behrens t...@documentfoundation.org

diff --git 
a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
index bce1e7f..6b28439 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -68,6 +68,51 @@ namespace
 return eType;
 }
 
+template class T, class D
+bool lclConvertToPropertySet(const SfxItemSet rItemSet, sal_uInt16 nWhichId, 
uno::Referencebeans::XPropertySet xProperties, OUString aPropertyID)
+{
+OSL_ASSERT(xProperties.is());
+if( xProperties.is() )
+{
+T aValue = static_castT(static_castconst D(rItemSet.Get( nWhichId 
)).GetValue());
+T aOldValue = aValue;
+bool aSuccess = xProperties-getPropertyValue( aPropertyID ) = 
aOldValue;
+if (!aSuccess || aOldValue != aValue)
+{
+xProperties-setPropertyValue( aPropertyID , uno::makeAny( aValue 
));
+return true;
+}
+}
+return false;
+}
+
+template class T, class D
+void lclConvertToItemSet(SfxItemSet rItemSet, sal_uInt16 nWhichId, 
uno::Referencebeans::XPropertySet xProperties, OUString aPropertyID)
+{
+OSL_ASSERT(xProperties.is());
+if( xProperties.is() )
+{
+T aValue = static_castT(static_castconst D(rItemSet.Get( nWhichId 
)).GetValue());
+if(xProperties-getPropertyValue( aPropertyID ) = aValue)
+{
+rItemSet.Put(D( nWhichId, aValue ));
+}
+}
+}
+
+void lclConvertToItemSetDouble(SfxItemSet rItemSet, sal_uInt16 nWhichId, 
uno::Referencebeans::XPropertySet xProperties, OUString aPropertyID)
+{
+OSL_ASSERT(xProperties.is());
+if( xProperties.is() )
+{
+double aValue = static_castdouble(static_castconst 
SvxDoubleItem(rItemSet.Get( nWhichId )).GetValue());
+if(xProperties-getPropertyValue( aPropertyID ) = aValue)
+{
+rItemSet.Put(SvxDoubleItem( aValue, nWhichId ));
+}
+}
+}
+
 } // anonymous namespace
 
 namespace chart
@@ -128,8 +173,8 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
 uno::Reference chart2::XRegressionCurve  xCurve( GetPropertySet(), 
uno::UNO_QUERY );
 bool bChanged = false;
 
-OSL_ASSERT( xCurve.is());
-if( !xCurve.is())
+OSL_ASSERT(xCurve.is());
+if(!xCurve.is())
 return false;
 
 switch( nWhichId )
@@ -151,7 +196,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
 m_xCurveContainer,
 xCurve,
 uno::Reference uno::XComponentContext ());
-uno::Reference beans::XPropertySet  xProperties( xCurve, 
uno::UNO_QUERY );
+uno::Referencebeans::XPropertySet xProperties( xCurve, 
uno::UNO_QUERY );
 resetPropertySet( xProperties );
 bChanged = true;
 }
@@ -160,324 +205,128 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
 
 case SCHATTR_REGRESSION_DEGREE:
 {
-sal_Int32 aDegree = static_cast sal_Int32 (
-static_cast const SfxInt32Item  (
-rItemSet.Get( nWhichId )).GetValue());
-
 uno::Reference beans::XPropertySet  xProperties( xCurve, 
uno::UNO_QUERY );
-OSL_ASSERT( xProperties.is());
-if( xProperties.is() )
-{
-sal_Int32 aOldDegree = 2;
-xProperties-getPropertyValue( PolynomialDegree ) = 
aOldDegree;
-if (aOldDegree != aDegree)
-{
-xProperties-setPropertyValue( PolynomialDegree , 
uno::makeAny( aDegree ));
-bChanged = true;
-}
-}
+bChanged = lclConvertToPropertySetsal_Int32, 
SfxInt32Item(rItemSet, nWhichId, xProperties, OUString(PolynomialDegree));
 }
 break;
 
 case SCHATTR_REGRESSION_PERIOD:
 {
-sal_Int32 aPeriod = static_cast sal_Int32 (
-static_cast const SfxInt32Item  (
-rItemSet.Get( nWhichId 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source

2013-12-03 Thread Tomaž Vajngerl
 chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx |  
261 --
 1 file changed, 117 insertions(+), 144 deletions(-)

New commits:
commit 67bbe10ef7c6d5bdb5af7276533656d2504238c2
Author: Tomaž Vajngerl qui...@gmail.com
Date:   Wed Nov 20 22:40:51 2013 +0100

DRY-cleanup RegressionCurveItemConverter

Change-Id: I8fb799b2efc81587252161ccadfa1dbd6b096bda
Reviewed-on: https://gerrit.libreoffice.org/6871
Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com
Reviewed-by: Thorsten Behrens t...@documentfoundation.org
Tested-by: Thorsten Behrens t...@documentfoundation.org

diff --git 
a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
index 2bf7900..bce1e7f 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -128,55 +128,52 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
 uno::Reference chart2::XRegressionCurve  xCurve( GetPropertySet(), 
uno::UNO_QUERY );
 bool bChanged = false;
 
+OSL_ASSERT( xCurve.is());
+if( !xCurve.is())
+return false;
+
 switch( nWhichId )
 {
 case SCHATTR_REGRESSION_TYPE:
 {
-OSL_ASSERT( xCurve.is());
-if( xCurve.is())
+SvxChartRegress eRegress = static_cast SvxChartRegress (
+static_cast sal_Int32 ( 
RegressionCurveHelper::getRegressionType( xCurve )));
+SvxChartRegress eNewRegress = static_cast const 
SvxChartRegressItem  (
+rItemSet.Get( nWhichId )).GetValue();
+if( eRegress != eNewRegress )
 {
-SvxChartRegress eRegress = static_cast SvxChartRegress (
-static_cast sal_Int32 ( 
RegressionCurveHelper::getRegressionType( xCurve )));
-SvxChartRegress eNewRegress = static_cast const 
SvxChartRegressItem  (
-rItemSet.Get( nWhichId )).GetValue();
-if( eRegress != eNewRegress )
-{
-// note that changing the regression type changes the 
object
-// for which this converter was created. Not optimal, but
-// currently the only way to handle the type in the
-// regression curve properties dialog
-xCurve = RegressionCurveHelper::changeRegressionCurveType(
-lcl_convertRegressionType( eNewRegress ),
-m_xCurveContainer,
-xCurve,
-uno::Reference uno::XComponentContext ());
-uno::Reference beans::XPropertySet  xProperties( xCurve, 
uno::UNO_QUERY );
-resetPropertySet( xProperties );
-bChanged = true;
-}
+// note that changing the regression type changes the object
+// for which this converter was created. Not optimal, but
+// currently the only way to handle the type in the
+// regression curve properties dialog
+xCurve = RegressionCurveHelper::changeRegressionCurveType(
+lcl_convertRegressionType( eNewRegress ),
+m_xCurveContainer,
+xCurve,
+uno::Reference uno::XComponentContext ());
+uno::Reference beans::XPropertySet  xProperties( xCurve, 
uno::UNO_QUERY );
+resetPropertySet( xProperties );
+bChanged = true;
 }
 }
 break;
 
 case SCHATTR_REGRESSION_DEGREE:
 {
-if( xCurve.is())
-{
-sal_Int32 aDegree = static_cast sal_Int32 (
-static_cast const SfxInt32Item  (
-rItemSet.Get( nWhichId )).GetValue());
+sal_Int32 aDegree = static_cast sal_Int32 (
+static_cast const SfxInt32Item  (
+rItemSet.Get( nWhichId )).GetValue());
 
-uno::Reference beans::XPropertySet  xProperties( xCurve, 
uno::UNO_QUERY );
-OSL_ASSERT( xProperties.is());
-if( xProperties.is() )
+uno::Reference beans::XPropertySet  xProperties( xCurve, 
uno::UNO_QUERY );
+OSL_ASSERT( xProperties.is());
+if( xProperties.is() )
+{
+sal_Int32 aOldDegree = 2;
+xProperties-getPropertyValue( PolynomialDegree ) = 
aOldDegree;
+if (aOldDegree != aDegree)
 {
-sal_Int32 aOldDegree = 2;
-xProperties-getPropertyValue( PolynomialDegree ) = 
aOldDegree;
-if (aOldDegree != aDegree)
-{
- 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - chart2/source chart2/uiconfig

2013-12-03 Thread Tomaž Vajngerl
 chart2/source/controller/dialogs/res_Trendline.cxx   |   
56 ++
 chart2/source/controller/dialogs/res_Trendline.hxx   |
1 
 chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx |   
15 ++
 chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx  |   
16 ++
 chart2/source/inc/chartview/ChartSfxItemIds.hxx  |
3 
 chart2/source/tools/RegressionCurveHelper.cxx|   
12 ++
 chart2/source/tools/RegressionCurveModel.cxx |
9 +
 chart2/source/view/main/ChartItemPool.cxx|
1 
 chart2/uiconfig/ui/tp_Trendline.ui   |   
45 ++--
 9 files changed, 127 insertions(+), 31 deletions(-)

New commits:
commit 04e704c1c28d6554bc0f03ece2fbff3a11b745ef
Author: Tomaž Vajngerl qui...@gmail.com
Date:   Sat Nov 23 16:06:28 2013 +0100

Custom name for a trend line (shown in legend).

Previously, a trendline name was fixed to a combination of the
trendline type and the name of the series. With this it is possible
to add a custom name for the trendline, which is shown in the
legend.

Change-Id: I61eaaf14e6df45088abdf1f3e9c24877d26ae8a7
Reviewed-on: https://gerrit.libreoffice.org/6873
Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com
Reviewed-by: Thorsten Behrens t...@documentfoundation.org
Tested-by: Thorsten Behrens t...@documentfoundation.org

diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx 
b/chart2/source/controller/dialogs/res_Trendline.cxx
index db83486..76be297 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -24,6 +24,7 @@
 #include chartview/ChartSfxItemIds.hxx
 
 #include svl/intitem.hxx
+#include svl/stritem.hxx
 #include sfx2/tabdlg.hxx
 
 #include vector
@@ -36,26 +37,28 @@ TrendlineResources::TrendlineResources( Window * pParent, 
const SfxItemSet rInA
 m_eTrendLineType( CHREGRESS_LINEAR ),
 m_bTrendLineUnique( true )
 {
-((SfxTabPage*)pParent)-get(m_pRB_Linear,linear);
-((SfxTabPage*)pParent)-get(m_pRB_Logarithmic,logarithmic);
-((SfxTabPage*)pParent)-get(m_pRB_Exponential,exponential);
-((SfxTabPage*)pParent)-get(m_pRB_Power,power);
-((SfxTabPage*)pParent)-get(m_pRB_Polynomial,polynomial);
-((SfxTabPage*)pParent)-get(m_pRB_MovingAverage,movingAverage);
-((SfxTabPage*)pParent)-get(m_pNF_Degree,degree);
-((SfxTabPage*)pParent)-get(m_pNF_Period,period);
-((SfxTabPage*)pParent)-get(m_pNF_ExtrapolateForward,extrapolateForward);
-
((SfxTabPage*)pParent)-get(m_pNF_ExtrapolateBackward,extrapolateBackward);
-((SfxTabPage*)pParent)-get(m_pCB_SetIntercept,setIntercept);
-((SfxTabPage*)pParent)-get(m_pNF_InterceptValue,interceptValue);
-((SfxTabPage*)pParent)-get(m_pCB_ShowEquation,showEquation);
-
((SfxTabPage*)pParent)-get(m_pCB_ShowCorrelationCoeff,showCorrelationCoefficient);
-((SfxTabPage*)pParent)-get(m_pFI_Linear,imageLinear);
-((SfxTabPage*)pParent)-get(m_pFI_Logarithmic,imageLogarithmic);
-((SfxTabPage*)pParent)-get(m_pFI_Exponential,imageExponential);
-((SfxTabPage*)pParent)-get(m_pFI_Power,imagePower);
-((SfxTabPage*)pParent)-get(m_pFI_Polynomial,imagePolynomial);
-((SfxTabPage*)pParent)-get(m_pFI_MovingAverage,imageMovingAverage);
+SfxTabPage* pTabPage = reinterpret_castSfxTabPage*(pParent);
+pTabPage-get(m_pRB_Linear,linear);
+pTabPage-get(m_pRB_Logarithmic,logarithmic);
+pTabPage-get(m_pRB_Exponential,exponential);
+pTabPage-get(m_pRB_Power,power);
+pTabPage-get(m_pRB_Polynomial,polynomial);
+pTabPage-get(m_pRB_MovingAverage,movingAverage);
+pTabPage-get(m_pNF_Degree,degree);
+pTabPage-get(m_pNF_Period,period);
+pTabPage-get(m_pEE_Name,entry_name);
+pTabPage-get(m_pNF_ExtrapolateForward,extrapolateForward);
+pTabPage-get(m_pNF_ExtrapolateBackward,extrapolateBackward);
+pTabPage-get(m_pCB_SetIntercept,setIntercept);
+pTabPage-get(m_pNF_InterceptValue,interceptValue);
+pTabPage-get(m_pCB_ShowEquation,showEquation);
+pTabPage-get(m_pCB_ShowCorrelationCoeff,showCorrelationCoefficient);
+pTabPage-get(m_pFI_Linear,imageLinear);
+pTabPage-get(m_pFI_Logarithmic,imageLogarithmic);
+pTabPage-get(m_pFI_Exponential,imageExponential);
+pTabPage-get(m_pFI_Power,imagePower);
+pTabPage-get(m_pFI_Polynomial,imagePolynomial);
+pTabPage-get(m_pFI_MovingAverage,imageMovingAverage);
 FillValueSets();
 
 Link aLink = LINK(this, TrendlineResources, SelectTrendLine );
@@ -110,6 +113,16 @@ void TrendlineResources::Reset( const SfxItemSet rInAttrs 
)
 {
 const SfxPoolItem *pPoolItem = NULL;
 
+if( rInAttrs.GetItemState( SCHATTR_REGRESSION_CURVE_NAME, sal_True, 
pPoolItem ) == SFX_ITEM_SET )
+{
+OUString aName = static_cast const