summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-11-08 14:24:29 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-11-08 15:19:37 +0100
commitf2c55815128fde9f760c5cbf81e3ab18402c5b3d (patch)
treec43ba4cd11300759657b489714313f8cd7f81a22 /oox/source
parent6063fd0402e0b63aec4a6740e94e4f76fcc312c1 (diff)
implement inset attribute of <v:textbox> (part of bnc#773061)
Change-Id: I1ec9b5d9fed86c44dc0a412c2323033ea67985c9
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/token/properties.txt4
-rw-r--r--oox/source/vml/vmlshape.cxx7
-rw-r--r--oox/source/vml/vmlshapecontext.cxx4
-rw-r--r--oox/source/vml/vmltextbox.cxx1
-rw-r--r--oox/source/vml/vmltextboxcontext.cxx22
5 files changed, 36 insertions, 2 deletions
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index c925d1fe7b1e..a252bb2efcd3 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -34,6 +34,7 @@ BorderStyle
BorderTransparency
BorderWidth
BottomBorder
+BottomBorderDistance
BottomMargin
BulletChar
BulletColor
@@ -263,6 +264,7 @@ LabelPosition
LabelSeparator
LayoutInfo
LeftBorder
+LeftBorderDistance
LeftMargin
LeftPageFooterContent
LeftPageHeaderContent
@@ -384,6 +386,7 @@ RepeatDelay
Representation
RightAngledAxes
RightBorder
+RightBorderDistance
RightMargin
RightPageFooterContent
RightPageHeaderContent
@@ -495,6 +498,7 @@ Title
Toggle
TokenIndex
TopBorder
+TopBorderDistance
TopMargin
Transformation
TransitionDirection
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 8d84edd33418..3d5eb1fc0e65 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -449,6 +449,13 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
{
PropertySet( xShape ).setAnyProperty( PROP_FrameIsAutomaticHeight, makeAny( maTypeModel.mbAutoHeight ) );
PropertySet( xShape ).setAnyProperty( PROP_SizeType, makeAny( maTypeModel.mbAutoHeight ? SizeType::MIN : SizeType::FIX ) );
+ if( getTextBox()->borderDistanceSet )
+ {
+ PropertySet( xShape ).setAnyProperty( PROP_LeftBorderDistance, makeAny( getTextBox()->borderDistanceLeft ));
+ PropertySet( xShape ).setAnyProperty( PROP_TopBorderDistance, makeAny( getTextBox()->borderDistanceTop ));
+ PropertySet( xShape ).setAnyProperty( PROP_RightBorderDistance, makeAny( getTextBox()->borderDistanceRight ));
+ PropertySet( xShape ).setAnyProperty( PROP_BottomBorderDistance, makeAny( getTextBox()->borderDistanceBottom ));
+ }
}
else
{
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 35525e69f76f..394c963abd32 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -19,6 +19,7 @@
#include "oox/vml/vmlshapecontext.hxx"
+#include "oox/core/xmlfilterbase.hxx"
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
@@ -406,7 +407,8 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const Attri
// Custom shape in Writer with a textbox are transformed into a frame
dynamic_cast<SimpleShape&>( mrShape ).setService(
"com.sun.star.text.TextFrame");
- return new TextBoxContext( *this, mrShapeModel.createTextBox(), rAttribs );
+ return new TextBoxContext( *this, mrShapeModel.createTextBox(), rAttribs,
+ mrShape.getDrawing().getFilter().getGraphicHelper());
case VMLX_TOKEN( ClientData ):
return new ClientDataContext( *this, mrShapeModel.createClientData(), rAttribs );
case VMLPPT_TOKEN( textdata ):
diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx
index 131bdca4147a..03c4eff90e9d 100644
--- a/oox/source/vml/vmltextbox.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -38,6 +38,7 @@ TextPortionModel::TextPortionModel( const TextFontModel& rFont, const OUString&
}
TextBox::TextBox()
+ : borderDistanceSet( false )
{
}
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index 33a64b4c2102..a651fa2e74d6 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "oox/vml/vmlformatting.hxx"
#include "oox/vml/vmltextboxcontext.hxx"
namespace oox {
@@ -117,10 +118,29 @@ void TextPortionContext::onEndElement()
// ============================================================================
-TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBox, const AttributeList& /*rAttribs*/ ) :
+TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBox, const AttributeList& rAttribs,
+ const GraphicHelper& graphicHelper ) :
ContextHandler2( rParent ),
mrTextBox( rTextBox )
{
+ if( rAttribs.getString( XML_insetmode ).get() != "auto" )
+ {
+ OUString inset = rAttribs.getString( XML_inset ).get();
+ OUString value;
+ ConversionHelper::separatePair( value, inset, inset, ',' );
+ rTextBox.borderDistanceLeft = ConversionHelper::decodeMeasureToEmu( graphicHelper,
+ value.isEmpty() ? "0.1in" : value, 0, false, false );
+ ConversionHelper::separatePair( value, inset, inset, ',' );
+ rTextBox.borderDistanceTop = ConversionHelper::decodeMeasureToEmu( graphicHelper,
+ value.isEmpty() ? "0.05in" : value, 0, false, false );
+ ConversionHelper::separatePair( value, inset, inset, ',' );
+ rTextBox.borderDistanceRight = ConversionHelper::decodeMeasureToEmu( graphicHelper,
+ value.isEmpty() ? "0.1in" : value, 0, false, false );
+ ConversionHelper::separatePair( value, inset, inset, ',' );
+ rTextBox.borderDistanceBottom = ConversionHelper::decodeMeasureToEmu( graphicHelper,
+ value.isEmpty() ? "0.05in" : value, 0, false, false );
+ rTextBox.borderDistanceSet = true;
+ }
}
ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )