summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2011-03-16 09:28:51 +0100
committerobo <obo@openoffice.org>2011-03-16 09:28:51 +0100
commitb491f91e8d6cebe3ade4f805152100489eb91754 (patch)
tree2044126a9afc2cbf0680777189b4bd7166ad473a
parent9f608513ff7f842116a3a16242142c5e46d91840 (diff)
parentfd37636ef1253a46ee1834bdb9588a99fbc96b86 (diff)
CWS-TOOLING: integrate CWS chart51
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx67
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx9
-rw-r--r--chart2/source/inc/CharacterProperties.hxx3
-rw-r--r--chart2/source/inc/ExponentialRegressionCurveCalculator.hxx7
-rw-r--r--[-rwxr-xr-x]chart2/source/model/main/Diagram.cxx1
-rw-r--r--[-rwxr-xr-x]chart2/source/tools/CharacterProperties.cxx25
-rw-r--r--chart2/source/tools/ExponentialRegressionCurveCalculator.cxx77
-rwxr-xr-xchart2/source/view/charttypes/VSeriesPlotter.cxx16
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx3
-rw-r--r--sc/source/core/tool/charthelper.cxx5
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx1
11 files changed, 177 insertions, 37 deletions
diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
index aa50b1fc41df..8104516c7177 100644
--- a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
@@ -193,6 +193,40 @@ void CharacterPropertyItemConverter::FillSpecialItem(
}
break;
+ case EE_CHAR_OVERLINE:
+ {
+ SvxOverlineItem aItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
+ bool bModified = false;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharOverline" ) ) );
+ if ( aValue.hasValue() )
+ {
+ aItem.PutValue( aValue, MID_TL_STYLE );
+ bModified = true;
+ }
+
+ aValue = GetPropertySet()->getPropertyValue( C2U( "CharOverlineHasColor" ) );
+ if ( aValue.hasValue() &&
+ ( *reinterpret_cast< const sal_Bool* >( aValue.getValue() ) != sal_False ) )
+ {
+ aItem.PutValue( aValue, MID_TL_HASCOLOR );
+ bModified = true;
+ }
+
+ aValue = GetPropertySet()->getPropertyValue( C2U( "CharOverlineColor" ) );
+ if ( aValue.hasValue() )
+ {
+ aItem.PutValue( aValue, MID_TL_COLOR );
+ bModified = true;
+ }
+
+ if ( bModified )
+ {
+ rOutItemSet.Put( aItem );
+ }
+ }
+ break;
+
case EE_CHAR_ITALIC:
case EE_CHAR_ITALIC_CJK:
case EE_CHAR_ITALIC_CTL:
@@ -397,6 +431,39 @@ bool CharacterPropertyItemConverter::ApplySpecialItem(
}
break;
+ case EE_CHAR_OVERLINE:
+ {
+ const SvxOverlineItem& rItem = static_cast< const SvxOverlineItem & >( rItemSet.Get( nWhichId ) );
+
+ if ( rItem.QueryValue( aValue, MID_TL_STYLE ) )
+ {
+ if ( aValue != GetPropertySet()->getPropertyValue( C2U( "CharOverline" ) ) )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharOverline" ), aValue );
+ bChanged = true;
+ }
+ }
+
+ if ( rItem.QueryValue( aValue, MID_TL_COLOR ) )
+ {
+ if ( aValue != GetPropertySet()->getPropertyValue( C2U( "CharOverlineColor" ) ) )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharOverlineColor" ), aValue );
+ bChanged = true;
+ }
+ }
+
+ if ( rItem.QueryValue( aValue, MID_TL_HASCOLOR ) )
+ {
+ if ( aValue != GetPropertySet()->getPropertyValue( C2U( "CharOverlineHasColor" ) ) )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharOverlineHasColor" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
case EE_CHAR_ITALIC:
case EE_CHAR_ITALIC_CJK:
case EE_CHAR_ITALIC_CTL:
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 1692c5761ae9..ed855296427b 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1686,7 +1686,16 @@ bool ChartController::requestQuickHelp(
if ( bSuccess )
{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit() )
+ {
+ this->EndTextEdit();
+ }
this->impl_selectObjectAndNotiy();
+ if ( m_pChartWindow )
+ {
+ m_pChartWindow->Invalidate();
+ }
return sal_True;
}
diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx
index 0742435e9bfe..676618d0bc5c 100644
--- a/chart2/source/inc/CharacterProperties.hxx
+++ b/chart2/source/inc/CharacterProperties.hxx
@@ -63,6 +63,9 @@ public:
PROP_CHAR_UNDERLINE,
PROP_CHAR_UNDERLINE_COLOR,
PROP_CHAR_UNDERLINE_HAS_COLOR,
+ PROP_CHAR_OVERLINE,
+ PROP_CHAR_OVERLINE_COLOR,
+ PROP_CHAR_OVERLINE_HAS_COLOR,
PROP_CHAR_WEIGHT,
PROP_CHAR_POSTURE,
PROP_CHAR_AUTO_KERNING,
diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
index 91c3034ea79c..acecde281001 100644
--- a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
@@ -63,9 +63,10 @@ private:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
- // formula is: f(x) = m_fSlope ^ x + m_fIntercept
- double m_fSlope;
- double m_fIntercept;
+ // formula is: f(x) = exp(m_fLogIntercept) * exp( m_fLogSlope * x )
+ // mathematical model f(x) = Intercept * Slope^x
+ double m_fLogSlope;
+ double m_fLogIntercept;
};
} // namespace chart
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 322e84e1bc11..c6b9a0f2e112 100755..100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -196,6 +196,7 @@ private:
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
+ ::chart::SceneProperties::AddDefaultsToMap( rOutMap );
}
};
diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx
index c403ca046b9e..f0c37a47c96c 100755..100644
--- a/chart2/source/tools/CharacterProperties.cxx
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -161,6 +161,28 @@ void CharacterProperties::AddPropertiesToVector(
::getBooleanCppuType(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharOverline (see awt.FontUnderline)
+ rOutProperties.push_back(
+ Property( C2U( "CharOverline" ),
+ PROP_CHAR_OVERLINE,
+ ::getCppuType( reinterpret_cast< const sal_Int16* >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ) );
+ // CharOverlineColor
+ rOutProperties.push_back(
+ Property( C2U( "CharOverlineColor" ),
+ PROP_CHAR_OVERLINE_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32* >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ) );
+ // CharOverlineHasColor
+ rOutProperties.push_back(
+ Property( C2U( "CharOverlineHasColor" ),
+ PROP_CHAR_OVERLINE_HAS_COLOR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ) );
// CharWeight (see awt.FontWeight)
rOutProperties.push_back(
Property( C2U( "CharWeight" ),
@@ -503,6 +525,9 @@ void CharacterProperties::AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE, awt::FontUnderline::NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_OVERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE_HAS_COLOR, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
index d7bb86174323..495be222b6f4 100644
--- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
@@ -43,11 +43,11 @@ namespace chart
{
ExponentialRegressionCurveCalculator::ExponentialRegressionCurveCalculator() :
- m_fSlope( 0.0 ),
- m_fIntercept( 0.0 )
+ m_fLogSlope( 0.0 ),
+ m_fLogIntercept( 0.0 )
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
+ ::rtl::math::setNan( & m_fLogSlope );
+ ::rtl::math::setNan( & m_fLogIntercept );
}
ExponentialRegressionCurveCalculator::~ExponentialRegressionCurveCalculator()
@@ -67,9 +67,9 @@ void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
const size_t nMax = aValues.first.size();
if( nMax == 0 )
{
- ::rtl::math::setNan( & m_fSlope );
- ::rtl::math::setNan( & m_fIntercept );
- ::rtl::math::setNan( & m_fCorrelationCoeffitient );
+ ::rtl::math::setNan( & m_fLogSlope );
+ ::rtl::math::setNan( & m_fLogIntercept );
+ ::rtl::math::setNan( & m_fCorrelationCoeffitient );// actual it is coefficient of determination
return;
}
@@ -96,12 +96,10 @@ void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
fQxy += fDeltaX * fDeltaY;
}
- m_fSlope = fQxy / fQx;
- m_fIntercept = fAverageY - m_fSlope * fAverageX;
+ m_fLogSlope = fQxy / fQx;
+ m_fLogIntercept = fAverageY - m_fLogSlope * fAverageX;
m_fCorrelationCoeffitient = fQxy / sqrt( fQx * fQy );
- m_fSlope = exp( m_fSlope );
- m_fIntercept = exp( m_fIntercept );
}
double SAL_CALL ExponentialRegressionCurveCalculator::getCurveValue( double x )
@@ -111,10 +109,10 @@ double SAL_CALL ExponentialRegressionCurveCalculator::getCurveValue( double x )
double fResult;
::rtl::math::setNan( & fResult );
- if( ! ( ::rtl::math::isNan( m_fSlope ) ||
- ::rtl::math::isNan( m_fIntercept )))
+ if( ! ( ::rtl::math::isNan( m_fLogSlope ) ||
+ ::rtl::math::isNan( m_fLogIntercept )))
{
- fResult = m_fIntercept * pow( m_fSlope, x );
+ fResult = exp(m_fLogIntercept + x * m_fLogSlope);
}
return fResult;
@@ -150,31 +148,48 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
const uno::Reference< util::XNumberFormatter >& xNumFormatter,
::sal_Int32 nNumberFormatKey ) const
{
+ double fIntercept = exp(m_fLogIntercept);
+ double fSlope = exp(m_fLogSlope);
+ bool bHasSlope = !rtl::math::approxEqual( fSlope, 1.0 );
+ bool bHasIntercept = !rtl::math::approxEqual( fIntercept, 1.0 );
+
OUStringBuffer aBuf( C2U( "f(x) = " ));
- if( m_fIntercept == 0.0 ||
- m_fSlope == 0.0 )
- {
- aBuf.append( sal_Unicode( '0' ));
- }
- else if( rtl::math::approxEqual( m_fSlope, 1.0 ) )
+ if ( fIntercept == 0.0)
{
- aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ // underflow, a true zero is impossible
+ aBuf.append( C2U( "exp( " ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept) );
+ aBuf.append( (m_fLogSlope < 0.0) ? C2U( " - " ) : C2U( " + " ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fLogSlope)) );
+ aBuf.append( C2U( " x )" ));
}
else
{
- if( ! rtl::math::approxEqual( m_fIntercept, 1.0 ) )
+ if (bHasIntercept)
{
- aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
- aBuf.append( sal_Unicode( 0x00b7 ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, fIntercept) );
+ aBuf.append( C2U( " exp( " ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogSlope) );
+ aBuf.append( C2U( " x )" ));
+ }
+ else
+ {
+ // show logarithmic output, if intercept and slope both are near one
+ // otherwise drop output of intercept, which is 1 here
+ aBuf.append( C2U( " exp( " ));
+ if (!bHasSlope)
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept) );
+ aBuf.append( (m_fLogSlope < 0.0) ? C2U( " - " ) : C2U( " + " ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fLogSlope)) );
+ }
+ else
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogSlope) );
+ }
+ aBuf.append( C2U( " x )" ));
}
-
- if( m_fSlope < 0.0 )
- aBuf.append( sal_Unicode( '(' ));
- aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope ));
- if( m_fSlope < 0.0 )
- aBuf.append( sal_Unicode( ')' ));
- aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "^x" ));
}
return aBuf.makeStringAndClear();
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 1077591dfce8..d245d44365ae 100755
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1154,9 +1154,19 @@ void VSeriesPlotter::createRegressionCurveEquationShapes(
if( xTextShape.is())
{
ShapeFactory::setShapeName( xTextShape, rEquationCID );
- xTextShape->setPosition(
- RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
- aScreenPosition2D, xTextShape->getSize(), aRelativePosition.Anchor ));
+ awt::Size aSize( xTextShape->getSize() );
+ awt::Point aPos( RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ aScreenPosition2D, aSize, aRelativePosition.Anchor ) );
+ //ensure that the equation is fully placed within the page (if possible)
+ if( (aPos.X + aSize.Width) > m_aPageReferenceSize.Width )
+ aPos.X = m_aPageReferenceSize.Width - aSize.Width;
+ if( aPos.X < 0 )
+ aPos.X = 0;
+ if( (aPos.Y + aSize.Height) > m_aPageReferenceSize.Height )
+ aPos.Y = m_aPageReferenceSize.Height - aSize.Height;
+ if( aPos.Y < 0 )
+ aPos.Y = 0;
+ xTextShape->setPosition(aPos);
}
}
}
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 99b7c0bd2ae0..18b5f2717afd 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -242,6 +242,9 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProper
( C2U( "CharUnderline" ), C2U("CharUnderline") )
( C2U( "CharUnderlineColor" ), C2U("CharUnderlineColor") )
( C2U( "CharUnderlineHasColor" ), C2U("CharUnderlineHasColor") )
+ ( C2U( "CharOverline" ), C2U("CharOverline") )
+ ( C2U( "CharOverlineColor" ), C2U("CharOverlineColor") )
+ ( C2U( "CharOverlineHasColor" ), C2U("CharOverlineHasColor") )
( C2U( "CharWeight" ), C2U("CharWeight") )
( C2U( "CharWeightAsian" ), C2U("CharWeightAsian") )
( C2U( "CharWeightComplex" ), C2U("CharWeightComplex") )
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index a2db16dff690..64b2a7776bb5 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -309,6 +309,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
if ( xEmbeddedObj.is() )
{
bool bDisableDataTableDialog = false;
+ sal_Int32 nOldState = xEmbeddedObj->getCurrentState();
svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj );
uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY );
if ( xProps.is() &&
@@ -333,6 +334,10 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
}
}
}
+ if ( xEmbeddedObj->getCurrentState() != nOldState )
+ {
+ xEmbeddedObj->changeState( nOldState );
+ }
}
}
}
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 80a8d46de9da..368a27b4bd5d 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -56,6 +56,7 @@
#include "drwlayer.hxx"
#include "userdat.hxx"
#include "scmod.hxx"
+#include "client.hxx"
#include "charthelper.hxx"
#include "docuno.hxx"
#include "docsh.hxx"