oox/inc/oox/vml/vmlshape.hxx          |    2 ++
 oox/inc/oox/vml/vmltextbox.hxx        |    4 ++++
 oox/inc/oox/vml/vmltextboxcontext.hxx |    3 ++-
 oox/source/token/properties.txt       |    4 ++++
 oox/source/vml/vmlshape.cxx           |    7 +++++++
 oox/source/vml/vmlshapecontext.cxx    |    4 +++-
 oox/source/vml/vmltextbox.cxx         |    1 +
 oox/source/vml/vmltextboxcontext.cxx  |   22 +++++++++++++++++++++-
 8 files changed, 44 insertions(+), 3 deletions(-)

New commits:
commit 1679aca6f61f1d28b06649a55010f72e6666abc0
Author: Luboš Luňák <l.lu...@suse.cz>
Date:   Thu Nov 8 14:24:29 2012 +0100

    implement inset attribute of <v:textbox>  (part of bnc#773061)
    
    Change-Id: I1ec9b5d9fed86c44dc0a412c2323033ea67985c9

diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index cf71006..2bdf16e 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -129,6 +129,8 @@ public:
     /** Returns the fragment path to the embedded graphic used by this shape. 
*/
     ::rtl::OUString     getGraphicPath() const;
 
+    const Drawing& getDrawing() const { return mrDrawing; }
+
 protected:
     /** Returns the coordinate system of this shape. */
     ::com::sun::star::awt::Rectangle getCoordSystem() const;
diff --git a/oox/inc/oox/vml/vmltextbox.hxx b/oox/inc/oox/vml/vmltextbox.hxx
index cc2e41b..ed716de 100644
--- a/oox/inc/oox/vml/vmltextbox.hxx
+++ b/oox/inc/oox/vml/vmltextbox.hxx
@@ -83,6 +83,10 @@ public:
     /** Returns the entire text of all text portions. */
     ::rtl::OUString     getText() const;
 
+    /// Text distance from the border (inset attribute of v:textbox), valid 
only if set.
+    bool borderDistanceSet;
+    int borderDistanceLeft, borderDistanceTop, borderDistanceRight, 
borderDistanceBottom;
+
 private:
     typedef ::std::vector< TextPortionModel > PortionVector;
 
diff --git a/oox/inc/oox/vml/vmltextboxcontext.hxx 
b/oox/inc/oox/vml/vmltextboxcontext.hxx
index 64c1c97..abe6395 100644
--- a/oox/inc/oox/vml/vmltextboxcontext.hxx
+++ b/oox/inc/oox/vml/vmltextboxcontext.hxx
@@ -66,7 +66,8 @@ public:
     explicit            TextBoxContext(
                             ::oox::core::ContextHandler2Helper& rParent,
                             TextBox& rTextBox,
-                            const AttributeList& rAttribs );
+                            const AttributeList& rAttribs,
+                            const GraphicHelper& graphicHelper );
 
     virtual ::oox::core::ContextHandlerRef
                         onCreateContext( sal_Int32 nElement, const 
AttributeList& rAttribs );
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 4710f14..8835c2c 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
@@ -383,6 +385,7 @@ RepeatDelay
 Representation
 RightAngledAxes
 RightBorder
+RightBorderDistance
 RightMargin
 RightPageFooterContent
 RightPageHeaderContent
@@ -485,6 +488,7 @@ Title
 Toggle
 TokenIndex
 TopBorder
+TopBorderDistance
 TopMargin
 Transformation
 TransitionDirection
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e68bfab..5b6b6c5 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -443,6 +443,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 0ed4d8b..ae00af2 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -28,6 +28,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"
@@ -409,7 +410,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 8bb1c39..b4dc7db 100644
--- a/oox/source/vml/vmltextbox.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -55,6 +55,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 2d70c93..841c150 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -26,6 +26,7 @@
  *
  ************************************************************************/
 
+#include "oox/vml/vmlformatting.hxx"
 #include "oox/vml/vmltextboxcontext.hxx"
 
 namespace oox {
@@ -126,10 +127,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 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to