summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rwxr-xr-x[-rw-r--r--]sc/source/core/data/documen9.cxx4
-rwxr-xr-x[-rw-r--r--]sc/source/core/tool/autoform.cxx2
-rw-r--r--sc/source/core/tool/charthelper.cxx5
-rw-r--r--sc/source/filter/starcalc/scflt.cxx13
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx1
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx20
-rw-r--r--sc/source/ui/view/tabview3.cxx9
18 files changed, 224 insertions, 42 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/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 534c2333bd9b..084ccb7ba977 100644..100755
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -704,7 +704,7 @@ void ScDocument::UpdateFontCharSet()
pItem = (SvxFontItem*)pPool->GetItem2(ATTR_FONT, i);
if ( pItem && ( pItem->GetCharSet() == eSrcSet ||
( bUpdateOld && pItem->GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) )
- pItem->GetCharSet() = eSysSet;
+ pItem->SetCharSet(eSysSet);
}
if ( pDrawLayer )
@@ -716,7 +716,7 @@ void ScDocument::UpdateFontCharSet()
pItem = (SvxFontItem*)rDrawPool.GetItem2(EE_CHAR_FONTINFO, i);
if ( pItem && ( pItem->GetCharSet() == eSrcSet ||
( bUpdateOld && pItem->GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) )
- pItem->GetCharSet() = eSysSet;
+ pItem->SetCharSet( eSysSet );
}
}
}
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 85447b6a8730..c1e261e3ba0a 100644..100755
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -387,7 +387,7 @@ sal_Bool ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVe
CharSet eSysSet = gsl_getSystemTextEncoding();
CharSet eSrcSet = rStream.GetStreamCharSet();
if( eSrcSet != eSysSet && aFont.GetCharSet() == eSrcSet )
- aFont.GetCharSet() = eSysSet;
+ aFont.SetCharSet(eSysSet);
aStacked.SetValue( aOrientation.IsStacked() );
aRotateAngle.SetValue( aOrientation.GetRotation( aRotateAngle.GetValue() ) );
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/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index a7d0150ee220..07f2462041d4 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -414,7 +414,10 @@ Sc10FontData::Sc10FontData(SvStream& rStream)
rStream >> PitchAndFamily;
sal_uInt16 nLen;
rStream >> nLen;
- rStream.Read(FaceName, nLen);
+ if (nLen < sizeof(FaceName))
+ rStream.Read(FaceName, nLen);
+ else
+ rStream.SetError(ERRCODE_IO_WRONGFORMAT);
}
@@ -452,10 +455,14 @@ Sc10NameData::Sc10NameData(SvStream& rStream)
sal_uInt8 nLen;
rStream >> nLen;
rStream.Read(Name, sizeof(Name) - 1);
+ if (nLen >= sizeof(Name))
+ nLen = sizeof(Name) - 1;
Name[nLen] = 0;
rStream >> nLen;
rStream.Read(Reference, sizeof(Reference) - 1);
+ if (nLen >= sizeof(Reference))
+ nLen = sizeof(Reference) - 1;
Reference[nLen] = 0;
rStream.Read(Reserved, sizeof(Reserved));
}
@@ -1452,6 +1459,8 @@ void Sc10Import::LoadTables()
sal_uInt8 nLen;
rStream >> nLen;
rStream.Read(TabName, sizeof(TabName) - 1);
+ if (nLen >= sizeof(TabName))
+ nLen = sizeof(TabName) - 1;
TabName[nLen] = 0;
//----------------------------------------------------------
@@ -1684,7 +1693,7 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab)
{
/*double Value =*/ ScfTools::ReadLongDouble(rStream);
sal_uInt8 Len;
- sal_Char s[256];
+ sal_Char s[256+1];
//rStream.Read(&Value, sizeof(Value));
rStream >> Len;
rStream.Read(&s[1], Len);
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"
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index aad45058de2c..3e6a7eb6085a 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -395,6 +395,8 @@ public:
void UpdateDPFromFieldPopupMenu();
+ void UpdateVisibleRange();
+
// #114409#
void CursorChanged();
void DrawLayerCreated();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 9c3327805a88..09861e778826 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -194,6 +194,8 @@ private:
void UpdateVarZoom();
+ void UpdateVisibleRange();
+
static void SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, long nPos, sal_Bool bLayoutRTL );
static long GetScrollBarPos( ScrollBar& rScroll, sal_Bool bLayoutRTL );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d350da754433..335f5ad14490 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5100,6 +5100,26 @@ sal_Bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScen
return sal_False;
}
+void ScGridWindow::UpdateVisibleRange()
+{
+ // #163911# Update the visible range outside of paint (called when switching sheets).
+ // Use the same logic here as in ScGridWindow::Draw.
+
+ SCCOL nPosX = pViewData->GetPosX( eHWhich );
+ SCROW nPosY = pViewData->GetPosY( eVWhich );
+
+ SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich);
+ if (nXRight > MAXCOL) nXRight = MAXCOL;
+ SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich);
+ if (nYBottom > MAXROW) nYBottom = MAXROW;
+
+ // Store the current visible range.
+ maVisibleRange.mnCol1 = nPosX;
+ maVisibleRange.mnCol2 = nXRight;
+ maVisibleRange.mnRow1 = nPosY;
+ maVisibleRange.mnRow2 = nYBottom;
+}
+
// #114409#
void ScGridWindow::DrawLayerCreated()
{
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 19289e4cf703..6265d823001b 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1548,6 +1548,12 @@ void ScTabView::SelectNextTab( short nDir, sal_Bool bExtendSelection )
PaintExtras();
}
+void ScTabView::UpdateVisibleRange()
+{
+ for (sal_uInt16 i=0; i<4; i++)
+ if (pGridWin[i] && pGridWin[i]->IsVisible())
+ pGridWin[i]->UpdateVisibleRange();
+}
// SetTabNo - angezeigte Tabelle
@@ -1736,6 +1742,9 @@ void ScTabView::SetTabNo( SCTAB nTab, sal_Bool bNew, sal_Bool bExtendSelection,
RepeatResize();
InvalidateSplit();
+ // #163911# Update the visible range in each GridWin directly, don't wait for the repaint event.
+ UpdateVisibleRange();
+
if ( aViewData.IsPagebreakMode() )
UpdatePageBreakData(); //! asynchron ??