summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-06-10 18:19:30 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-06-12 13:17:32 +0000
commitb56c4afb219c3ad2507af9d4eadf0c765c3bc0e0 (patch)
tree13bf38bc773490f501f487fc82f55171f08162b2 /oox
parent15a4ad716c169f8502a4156238a3e79a9d7b7319 (diff)
Related bnc#862510: extend handling of txXfrm
We don't actually need to check mbAnchorCtr to change text spacing. This txXfrm workaround works only with rectangles, because other shapes' text area can be smaller then the shape size. So add some condition to avoid using it for other shapes. Plus fix typos cause regression introduced in: 53c376d35b7223d53e8c9403390afe53d1f69089 (cherry picked from commit 98dd0f2bb5801f974374ef341037e094e4275cbb) Conflicts: sd/qa/unit/import-tests.cxx Change-Id: I87917b8e0b2bb97ae1bba773e7dda7f81682736f Reviewed-on: https://gerrit.libreoffice.org/9728 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/textbodyproperties.cxx6
-rw-r--r--oox/source/drawingml/transform2dcontext.cxx56
2 files changed, 34 insertions, 28 deletions
diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx
index 3861ebe78a1c..93a2f5f8b3e8 100644
--- a/oox/source/drawingml/textbodyproperties.cxx
+++ b/oox/source/drawingml/textbodyproperties.cxx
@@ -80,9 +80,9 @@ void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation )
// Hack for n#760986
// TODO: Preferred method would be to have a textbox on top
// of the shape and the place it according to the (off,ext)
- if( nOff == 0 && moTextOffLeft && mbAnchorCtr ) nVal = *moTextOffLeft;
- if( nOff == 1 && moTextOffUpper ) nVal = *moTextOffLeft;
- if( nOff == 2 && moTextOffRight && mbAnchorCtr ) nVal = *moTextOffRight;
+ if( nOff == 0 && moTextOffLeft ) nVal = *moTextOffLeft;
+ if( nOff == 1 && moTextOffUpper ) nVal = *moTextOffUpper;
+ if( nOff == 2 && moTextOffRight ) nVal = *moTextOffRight;
if( nOff == 3 && moTextOffLower ) nVal = *moTextOffLower;
if( nVal < 0 ) nVal = 0;
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index 92166c494e37..0064780b1318 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -55,37 +55,43 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
{
if( mbtxXfrm )
{
- switch( aElementToken )
+ // Workaround: only for rectangles
+ const sal_Int32 nType = mrShape.getCustomShapeProperties()->getShapePresetType();
+ if( nType == XML_rect || nType == XML_roundRect )
{
- case A_TOKEN( off ):
- {
- OUString sXValue = rAttribs.getString( XML_x ).get();
- OUString sYValue = rAttribs.getString( XML_y ).get();
- if( !sXValue.isEmpty() )
- mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
- if( !sYValue.isEmpty() )
- mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
- }
- break;
- case A_TOKEN( ext ):
- {
- const OUString sXValue = rAttribs.getString( XML_cx ).get();
- const OUString sYValue = rAttribs.getString( XML_cy ).get();
- if( !sXValue.isEmpty() )
+ switch( aElementToken )
+ {
+ case A_TOKEN( off ):
{
- mrShape.getTextBody()->getTextProperties().moTextOffRight = GetCoordinate(mrShape.getSize().Width - sXValue.toInt32());
- if( mrShape.getTextBody()->getTextProperties().moTextOffLeft )
- *mrShape.getTextBody()->getTextProperties().moTextOffRight -= *mrShape.getTextBody()->getTextProperties().moTextOffLeft;
+ const OUString sXValue = rAttribs.getString( XML_x ).get();
+ const OUString sYValue = rAttribs.getString( XML_y ).get();
+ if( !sXValue.isEmpty() && nType == XML_rect )
+ mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
+ if( !sYValue.isEmpty() )
+ mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
}
- if( !sYValue.isEmpty() )
+ break;
+ case A_TOKEN( ext ):
{
- mrShape.getTextBody()->getTextProperties().moTextOffLower = GetCoordinate(mrShape.getSize().Height - sYValue.toInt32());
- if( mrShape.getTextBody()->getTextProperties().moTextOffUpper )
- *mrShape.getTextBody()->getTextProperties().moTextOffLower -= *mrShape.getTextBody()->getTextProperties().moTextOffUpper;
+ const OUString sXValue = rAttribs.getString( XML_cx ).get();
+ const OUString sYValue = rAttribs.getString( XML_cy ).get();
+ if( !sXValue.isEmpty() && nType == XML_rect )
+ {
+ mrShape.getTextBody()->getTextProperties().moTextOffRight = GetCoordinate(mrShape.getSize().Width - sXValue.toInt32());
+ if( mrShape.getTextBody()->getTextProperties().moTextOffLeft )
+ *mrShape.getTextBody()->getTextProperties().moTextOffRight -= *mrShape.getTextBody()->getTextProperties().moTextOffLeft;
+ }
+ if( !sYValue.isEmpty() )
+ {
+ mrShape.getTextBody()->getTextProperties().moTextOffLower = GetCoordinate(mrShape.getSize().Height - sYValue.toInt32());
+ if( mrShape.getTextBody()->getTextProperties().moTextOffUpper )
+ *mrShape.getTextBody()->getTextProperties().moTextOffLower -= *mrShape.getTextBody()->getTextProperties().moTextOffUpper;
+
+ }
}
- }
- break;
+ break;
+ }
}
return 0;
}