diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-02-17 23:56:43 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-03-05 22:32:15 +0100 |
commit | fe1322f8d009e45ef598ec9a8a3af8b8f738eb55 (patch) | |
tree | be97ae0e28c141f3b4890f45c3ad2e0c755f1f0d | |
parent | e79377df461075815fb5d40badd81918c256c247 (diff) |
Simplify ShapeAnchor::importVmlAnchor
Change-Id: Ibee7914a0c5027b4679163e6a5108f646ad66546
Reviewed-on: https://gerrit.libreoffice.org/68122
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
-rw-r--r-- | sc/source/filter/oox/drawingbase.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx index d3ea89df7b4e..d1c670d00537 100644 --- a/sc/source/filter/oox/drawingbase.cxx +++ b/sc/source/filter/oox/drawingbase.cxx @@ -152,23 +152,27 @@ void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) meAnchorType = ANCHOR_VML; meCellAnchorType = CellAnchorType::Pixel; - ::std::vector< OUString > aTokens; - sal_Int32 nIndex = 0; - while( nIndex >= 0 ) - aTokens.push_back( rAnchor.getToken( 0, ',', nIndex ).trim() ); + sal_Int32 nValues[8]; + sal_Int32 nI{ 0 }; - OSL_ENSURE( aTokens.size() >= 8, "ShapeAnchor::importVmlAnchor - missing anchor tokens" ); - if( aTokens.size() >= 8 ) + for(sal_Int32 nIndex{ 0 }; nIndex>=0;) { - maFrom.mnCol = aTokens[ 0 ].toInt32(); - maFrom.mnColOffset = aTokens[ 1 ].toInt32(); - maFrom.mnRow = aTokens[ 2 ].toInt32(); - maFrom.mnRowOffset = aTokens[ 3 ].toInt32(); - maTo.mnCol = aTokens[ 4 ].toInt32(); - maTo.mnColOffset = aTokens[ 5 ].toInt32(); - maTo.mnRow = aTokens[ 6 ].toInt32(); - maTo.mnRowOffset = aTokens[ 7 ].toInt32(); + nValues[nI] = rAnchor.getToken( 0, ',', nIndex ).toInt32(); + if (++nI==8) + { + maFrom.mnCol = nValues[0]; + maFrom.mnColOffset = nValues[1]; + maFrom.mnRow = nValues[2]; + maFrom.mnRowOffset = nValues[3]; + maTo.mnCol = nValues[4]; + maTo.mnColOffset = nValues[5]; + maTo.mnRow = nValues[6]; + maTo.mnRowOffset = nValues[7]; + return; + } } + + OSL_FAIL("ShapeAnchor::importVmlAnchor - missing anchor tokens" ); } bool ShapeAnchor::isAnchorValid() const |