[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 3 commits - include/oox include/svx oox/source svx/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Jul 10 01:06:52 PDT 2014
include/oox/drawingml/chart/axisconverter.hxx | 10 ++---
include/svx/svdoole2.hxx | 7 +++
oox/source/drawingml/chart/axisconverter.cxx | 46 ++++++++++++++++-------
oox/source/drawingml/chart/objectformatter.cxx | 8 +---
oox/source/drawingml/chart/plotareaconverter.cxx | 6 +--
oox/source/token/properties.txt | 1
svx/source/svdraw/svdetc.cxx | 4 ++
svx/source/svdraw/svdoole2.cxx | 8 +++-
8 files changed, 61 insertions(+), 29 deletions(-)
New commits:
commit bac8126cf1d485eaa65d9ab480118346eff90ad2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Jul 9 21:46:34 2014 -0400
bnc#883684: Make chart objects exempt from automatic unloading.
The Memory option page contains "Number of objects" setting which controls
how many OLE objects can be loaded at any given time. When the number of
total OLE objects exceeds this number the oldest ones get unloaded. Note
that the total number is across all open documents, not per document.
Technically, chart objects are OLE objects, but unlike other OLE objects
that are embedded Calc, Writer, Draw documents, chart objects normally
"belong" to the host document. It therefore makes no sense to subject
chart objects to this automatic unloading.
In the future we may want to apply this exemption to other types of OLE
objects, like formula objects for example.. Or maybe this setting can be
removed altogether...
(cherry picked from commit b023565d4f064cd0312e8c1fcc23a9f552112935)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
Conflicts:
include/svx/svdoole2.hxx
svx/source/svdraw/svdetc.cxx
svx/source/svdraw/svdoole2.cxx
Change-Id: I7dd92550880efb4db8fc843cf1c915c712166da4
(cherry picked from commit 55612305b645a1c0872373c0a9f434763708732a)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 7a93f4b..0f1df14 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -167,6 +167,13 @@ public:
sal_Bool IsChart() const;
sal_Bool IsCalc() const;
+ /**
+ * Unloadable OLE objects are subject to automatic unloading per memory
+ * setting. The "Number of objects" setting in the Memory option controls
+ * how many OLE objects can be loaded at any given moment.
+ */
+ bool IsUnloadable() const;
+
sal_Bool UpdateLinkURL_Impl();
void BreakFileLink_Impl();
void DisconnectFileLink_Impl();
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 4caca94..afcc792 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -165,6 +165,10 @@ void OLEObjCache::UnloadOnDemand()
void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
{
+ if (!pObj->IsUnloadable())
+ // This OLE object is exempt from automatic unloading.
+ return;
+
if ( !empty() )
{
SdrOle2Obj* pExistingObj = front();
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 2929252..1102de8 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -2142,7 +2142,13 @@ sal_Bool SdrOle2Obj::IsCalc() const
return sal_False;
}
-// -----------------------------------------------------------------------------
+bool SdrOle2Obj::IsUnloadable() const
+{
+ // Right now, chart OLE objects are the only ones exempt from automatic
+ // unloading.
+ return !IsChart();
+}
+
uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
{
uno::Reference< frame::XModel > xDoc;
commit c1ed90d187eac6abae9f7e50137b20d2ce93f7ff
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Mon Jul 7 16:38:29 2014 -0400
bnc#881025: Mark axis a percent axis only when all data series are percent.
(cherry picked from commit b8c444a46b2f41dae673c6118d84276be0e6c87d)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
Conflicts:
oox/inc/drawingml/chart/axisconverter.hxx
Change-Id: I302cc1e5b164b2ce9999087293b034ec930951af
(cherry picked from commit 3997f7b8e5f07312466e66f6bcf0a4ac1c8c5a39)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
diff --git a/include/oox/drawingml/chart/axisconverter.hxx b/include/oox/drawingml/chart/axisconverter.hxx
index e107057..f2df756 100644
--- a/include/oox/drawingml/chart/axisconverter.hxx
+++ b/include/oox/drawingml/chart/axisconverter.hxx
@@ -45,12 +45,10 @@ public:
virtual ~AxisConverter();
/** Creates a chart2 axis and inserts it into the passed coordinate system. */
- void convertFromModel(
- const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
- TypeGroupConverter& rTypeGroup,
- const AxisModel* pCrossingAxis,
- sal_Int32 nAxesSetIdx,
- sal_Int32 nAxisIdx );
+ void convertFromModel(
+ const css::uno::Reference<css::chart2::XCoordinateSystem>& rxCoordSystem,
+ RefVector<TypeGroupConverter>& rTypeGroups, const AxisModel* pCrossingAxis,
+ sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx );
};
// ============================================================================
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index f290992..d30595d 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -107,6 +107,26 @@ sal_Int32 lclGetTickMark( sal_Int32 nToken )
return NONE;
}
+/**
+ * The groups is of percent type only when all of its members are of percent
+ * type.
+ */
+bool isPercent( const RefVector<TypeGroupConverter>& rTypeGroups )
+{
+ if (rTypeGroups.empty())
+ return false;
+
+ RefVector<TypeGroupConverter>::const_iterator it = rTypeGroups.begin(), itEnd = rTypeGroups.end();
+ for (; it != itEnd; ++it)
+ {
+ TypeGroupConverter& rConv = **it;
+ if (!rConv.isPercent())
+ return false;
+ }
+
+ return true;
+}
+
} // namespace
// ============================================================================
@@ -120,16 +140,20 @@ AxisConverter::~AxisConverter()
{
}
-void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCoordSystem,
- TypeGroupConverter& rTypeGroup, const AxisModel* pCrossingAxis, sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx )
+void AxisConverter::convertFromModel(
+ const Reference< XCoordinateSystem >& rxCoordSystem,
+ RefVector<TypeGroupConverter>& rTypeGroups, const AxisModel* pCrossingAxis, sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx )
{
+ if (rTypeGroups.empty())
+ return;
+
Reference< XAxis > xAxis;
try
{
namespace cssc = ::com::sun::star::chart;
namespace cssc2 = ::com::sun::star::chart2;
- const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
+ const TypeGroupInfo& rTypeInfo = rTypeGroups.front()->getTypeInfo();
ObjectFormatter& rFormatter = getFormatter();
// create the axis object (always)
@@ -189,7 +213,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
currently). */
aScaleData.AxisType = (bDateAxis && !mrModel.mbAuto) ? cssc2::AxisType::DATE : cssc2::AxisType::CATEGORY;
aScaleData.AutoDateAxis = mrModel.mbAuto;
- aScaleData.Categories = rTypeGroup.createCategorySequence();
+ aScaleData.Categories = rTypeGroups.front()->createCategorySequence();
}
else
{
@@ -199,11 +223,11 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
break;
case API_Y_AXIS:
OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( valAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:valAx)" );
- aScaleData.AxisType = rTypeGroup.isPercent() ? cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER;
+ aScaleData.AxisType = isPercent(rTypeGroups) ? cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER;
break;
case API_Z_AXIS:
OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( serAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:serAx)" );
- OSL_ENSURE( rTypeGroup.isDeep3dChart(), "AxisConverter::convertFromModel - series axis not supported by this chart type" );
+ OSL_ENSURE( rTypeGroups.front()->isDeep3dChart(), "AxisConverter::convertFromModel - series axis not supported by this chart type" );
aScaleData.AxisType = cssc2::AxisType::SERIES;
break;
}
@@ -330,7 +354,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
// axis title ---------------------------------------------------------
// in radar charts, title objects may exist, but are not shown
- if( mrModel.mxTitle.is() && (rTypeGroup.getTypeInfo().meTypeCategory != TYPECATEGORY_RADAR) )
+ if( mrModel.mxTitle.is() && (rTypeGroups.front()->getTypeInfo().meTypeCategory != TYPECATEGORY_RADAR) )
{
Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW );
TitleConverter aTitleConv( *this, *mrModel.mxTitle );
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index ff67b5f..eaa51e0 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -171,15 +171,15 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram,
ModelRef< AxisModel > xYAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Y_AXIS, C_TOKEN( valAx ) );
AxisConverter aXAxisConv( *this, *xXAxis );
- aXAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, xYAxis.get(), nAxesSetIdx, API_X_AXIS );
+ aXAxisConv.convertFromModel( xCoordSystem, aTypeGroups, xYAxis.get(), nAxesSetIdx, API_X_AXIS );
AxisConverter aYAxisConv( *this, *xYAxis );
- aYAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, xXAxis.get(), nAxesSetIdx, API_Y_AXIS );
+ aYAxisConv.convertFromModel( xCoordSystem, aTypeGroups, xXAxis.get(), nAxesSetIdx, API_Y_AXIS );
if( rFirstTypeGroup.isDeep3dChart() )
{
ModelRef< AxisModel > xZAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Z_AXIS, C_TOKEN( serAx ) );
AxisConverter aZAxisConv( *this, *xZAxis );
- aZAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, 0, nAxesSetIdx, API_Z_AXIS );
+ aZAxisConv.convertFromModel( xCoordSystem, aTypeGroups, 0, nAxesSetIdx, API_Z_AXIS );
}
// convert all chart type groups, this converts all series data and formatting
commit 74a22d42753350039ee8fcdb5e6df1e0807c0cca
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Mon Jul 7 13:26:23 2014 -0400
Adjust for the splitting of number format properties in chart.
Since 1d38cb365543924f9c50014e6b2227e77de1d0c9, "number format" and
"link number format to source" properties are 2 separate properties. Adjust
OOXML import code for that split.
Also, always set axis' number format via NumberFormat property even when it's
a percent format. The axis object doesn't keep a non-percent and percent
number formats separately.
Change-Id: I8667b6f1a78d88cc37d059518919ad1b37f154e1
(cherry picked from commit af5a6615dfdbe5c2cacdcacb00fc6f418b925c06)
(cherry picked from commit 29d5f3db525e275c62cd2eafb18899fe68198ea3)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index da1a732..f290992 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -307,13 +307,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
// number format ------------------------------------------------------
if( (aScaleData.AxisType == cssc2::AxisType::REALNUMBER) || (aScaleData.AxisType == cssc2::AxisType::PERCENT) )
- {
- bool bPercent = false;
- if( mrModel.maNumberFormat.maFormatCode.indexOf('%') >= 0)
- bPercent = true;
- mrModel.maNumberFormat.mbSourceLinked = false;
- getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat, bPercent );
- }
+ getFormatter().convertNumberFormat(aAxisProp, mrModel.maNumberFormat, false);
// position of crossing axis ------------------------------------------
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index a69dae0..b5b0a5b 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1111,11 +1111,7 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo
if( mxData->mxNumFmts.is() )
{
sal_Int32 nPropId = bPercentFormat ? PROP_PercentageNumberFormat : PROP_NumberFormat;
- if( rNumberFormat.mbSourceLinked || rNumberFormat.maFormatCode.isEmpty() )
- {
- rPropSet.setAnyProperty( nPropId, Any() );
- }
- else try
+ try
{
sal_Int32 nIndex = rNumberFormat.maFormatCode.equalsIgnoreAsciiCase("general") ?
mxData->mxNumTypes->getStandardIndex( mxData->maFromLocale ) :
@@ -1128,6 +1124,8 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo
OSL_FAIL( OStringBuffer( "ObjectFormatter::convertNumberFormat - cannot create number format '" ).
append( OUStringToOString( rNumberFormat.maFormatCode, osl_getThreadTextEncoding() ) ).append( '\'' ).getStr() );
}
+
+ rPropSet.setProperty(PROP_LinkNumberFormatToSource, makeAny(rNumberFormat.mbSourceLinked));
}
}
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index b0001e3..6d384b8 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -291,6 +291,7 @@ LineStartWidth
LineStyle
LineTransparence
LineWidth
+LinkNumberFormatToSource
LinkURL
LoadReadonly
LookUpLabels
More information about the Libreoffice-commits
mailing list