[Libreoffice-commits] .: 3 commits - oox/inc oox/source sw/qa writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Apr 23 08:04:18 PDT 2012


 oox/inc/oox/vml/vmlshape.hxx                 |    1 +
 oox/source/token/properties.txt              |    1 +
 oox/source/vml/vmlshape.cxx                  |    2 ++
 oox/source/vml/vmlshapecontext.cxx           |    1 +
 sw/qa/extras/ooxmltok/data/n757890.docx      |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx           |   27 +++++++++++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    2 ++
 7 files changed, 34 insertions(+)

New commits:
commit 8ee0e1f3fc54727f03674be415302109f6d87dc1
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Apr 23 17:00:23 2012 +0200

    n#757890 add testcase

diff --git a/sw/qa/extras/ooxmltok/data/n757890.docx b/sw/qa/extras/ooxmltok/data/n757890.docx
new file mode 100644
index 0000000..f70368a
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n757890.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 5aff21c..e5bdece 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -28,11 +28,14 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/SetVariableType.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/XDependentTextField.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
 #include <test/bootstrapfixture.hxx>
@@ -53,6 +56,7 @@ public:
     void testN751117();
     void testN751017();
     void testN750935();
+    void testN757890();
 
     CPPUNIT_TEST_SUITE(OoxmlModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -60,6 +64,7 @@ public:
     CPPUNIT_TEST(testN751117);
     CPPUNIT_TEST(testN751017);
     CPPUNIT_TEST(testN750935);
+    CPPUNIT_TEST(testN757890);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -185,6 +190,28 @@ void OoxmlModelTest::testN750935()
     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
 }
 
+void OoxmlModelTest::testN757890()
+{
+    load("n757890.docx");
+
+    // The w:pStyle token affected the text outside the textbox.
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+    uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+    OUString aValue;
+    xPara->getPropertyValue("ParaStyleName") >>= aValue;
+    CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aValue);
+
+    // This wan't centered
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+    sal_Int16 nValue;
+    xFrame->getPropertyValue("HoriOrient") >>= nValue;
+    CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(OoxmlModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 5dd8e91934618532bdb7f3d80035d8301a782b32
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Apr 23 16:22:54 2012 +0200

    n#757890 dmapper: paragraph properties of shape text should have limited scope

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index dcc20cf..b597ddf 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3239,10 +3239,12 @@ void DomainMapper::markLastParagraphInSection( )
 void DomainMapper::lcl_startShape( uno::Reference< drawing::XShape > xShape )
 {
     m_pImpl->PushShapeContext( xShape );
+    lcl_startParagraphGroup();
 }
 
 void DomainMapper::lcl_endShape( )
 {
+    lcl_endParagraphGroup();
     m_pImpl->PopShapeContext( );
 }
 
commit a5b3bf724e355ceb476991f4ecaa56fd019e3067
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Apr 23 11:48:42 2012 +0200

    n#757890 oox: implement mso-position-horizontal shape property for textframes

diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 82c0f3e..d969577 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -80,6 +80,7 @@ struct ShapeTypeModel
     ::rtl::OUString     maMarginLeft;           ///< X position of the shape bounding box to shape anchor (number with unit).
     ::rtl::OUString     maMarginTop;            ///< Y position of the shape bounding box to shape anchor (number with unit).
     ::rtl::OUString     maPositionVerticalRelative; ///< The Y position is relative to this.
+    ::rtl::OUString     maPositionHorizontal;   ///< The X position orientation (default: absolute).
     ::rtl::OUString     maRotation;             ///< Rotation of the shape, in degrees.
     ::rtl::OUString     maFlip;                 ///< Flip type of the shape (can be "x" or "y").
     sal_Bool            mbAutoHeight;           ///< If true, the height value is a minimum value (mostly used for textboxes)
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index a86df72..c476fde 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -219,6 +219,7 @@ HelpText
 HideInactiveSelection
 HoriJustify
 HoriJustifyMethod
+HoriOrient
 HoriOrientPosition
 HorizontalSplitMode
 HorizontalSplitPositionTwips
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 2b61e91..4000932 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -389,6 +389,8 @@ 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 (maTypeModel.maPositionHorizontal == "center")
+            PropertySet(xShape).setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::CENTER));
     }
 
     // Import Legacy Fragments (if any)
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 57a85e9..ddae966 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -348,6 +348,7 @@ void ShapeTypeContext::setStyle( const OUString& rStyle )
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "margin-left" ) ) )   mrTypeModel.maMarginLeft = aValue;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "margin-top" ) ) )    mrTypeModel.maMarginTop = aValue;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "mso-position-vertical-relative" ) ) ) mrTypeModel.maPositionVerticalRelative = aValue;
+            else if( aName == "mso-position-horizontal" ) mrTypeModel.maPositionHorizontal = aValue;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "mso-fit-shape-to-text" ) ) )          mrTypeModel.mbAutoHeight = sal_True;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "rotation" ) ) )      mrTypeModel.maRotation = aValue;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "flip" ) ) )      mrTypeModel.maFlip = aValue;


More information about the Libreoffice-commits mailing list